-
Notifications
You must be signed in to change notification settings - Fork 63
/
Copy pathgjf2xyz.py
32 lines (26 loc) · 876 Bytes
/
gjf2xyz.py
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
#!/bin/env python3
import re
from VASP import readGjf, writeXYZ
import sys
space = re.compile(r'\s+')
if len(sys.argv) == 1:
print("")
print("Usage: %s line1,line2,.... T/F vaspfile" % sys.argv[0].split('/')[-1])
print("the format of line1,line2,... can be either x or x-x")
print("try again")
print("")
exit(1)
print('')
print('############ This script converts gjf to xyz ############')
print(' ############ gjf -> xyz ############')
print('')
for gjf_file in sys.argv[1:]:
print(' processing %s' % gjf_file)
elements, num_atoms, coordinates = readGjf(gjf_file)
if gjf_file.endswith('.gjf'):
gjf_file = '%s.xyz' % gjf_file[:-4]
else:
gjf_file = '%s.xyz' % gjf_file
writeXYZ(gjf_file, 1, elements, num_atoms, coordinates)
print('')
print(' ---------- Done ----------')