-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdftb+2traj.py
More file actions
executable file
·35 lines (27 loc) · 893 Bytes
/
dftb+2traj.py
File metadata and controls
executable file
·35 lines (27 loc) · 893 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env python3
#
# Script to convert DFTB+ MD output to ASE ext-xyz trajectory
# by Patrick Melix
# 2018/02/13
#
# You can import the module and then call .main() or use it as a script
import os
from ase import io
from ase.io.dftb import read_dftb_lattice
def main():
if not os.path.isfile('geo_end.xyz'):
raise ValueError('File geo_end.xyz does not exist')
if not os.path.isfile('md.out'):
raise ValueError('File md.out does not exist')
#if output exists mv to .bak
outFile = 'traj.xyz'
if os.path.isfile(outFile):
print('ATTENTION: {:} exists, moving to *.bak'.format(outFile))
os.rename(outFile, outFile+'.bak')
mol = io.read('geo_end.xyz', index=slice(0,None))
read_dftb_lattice(images=mol)
for frame in mol:
frame.wrap()
frame.write(outFile,append=True)
if __name__ == "__main__":
main()