forked from Angel-Jia/VASP-script
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexcongjf.py
39 lines (33 loc) · 1.04 KB
/
excongjf.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
33
34
35
36
37
38
39
#!/bin/env python
import sys
import os
import subprocess
default_file = 'CONTCAR'
if len(sys.argv) == 1:
print ''
print "Usage: excongif.py directory1 directory2 ... (file)"
print "Please try again!\n"
exit(0)
if not os.path.isdir(sys.argv[-1]):
default_file = sys.argv[-1]
print ''
print '--------------------'
print "Default file: %s" % default_file
dir_list = []
for directory in sys.argv[1:]:
if os.path.isdir(directory):
dir_list.append(directory.rstrip('/'))
else:
print "%s is not a directory!" % directory
print ''
print 'Processing...'
for directory in dir_list:
pipe = subprocess.Popen("vas2gv.pl %s" % (directory + '/' + default_file),
shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
error = pipe.stderr.read()
if error != '':
print "Error in path(%s): %s" % (directory, error)
continue
os.system("mv %s %s" % (directory + '/' + default_file + '.gjf', directory + '.gjf'))
print ''
print '----- Done -----\n'