-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNBO_script.py
46 lines (31 loc) · 1022 Bytes
/
NBO_script.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
40
41
42
43
44
45
46
#
#Karnjit Parmar
#2021
#
#!/usr/bin/env python
import glob, os
comfilename = "mynewfile.txt"
def writefile(comfilename):
charge = 0
multiplicity = 1
new_file_path = os.path.join(os.getcwd(), comfilename + ".com")
comfile = open(new_file_path,'w')
xyz_path = os.path.join(os.getcwd(), comfilename)
xyzfile = open(xyz_path, 'r')
comfile.write("%chk=" + comfilename + ".chk")
comfile.write('\n%mem=00\n%nproc=32\n')
comfile.write("# opt M062X/6-31+g(d,p) pop=(full,nbo6read) gfoldprint")
comfile.write('\n\n' + comfilename + '\n\n')
#write charge + multiplicity
comfile.write(str(charge) + ' ' + str(multiplicity) + '\n')
xyzlen = xyzfile.readlines()
type(xyzlen)
for i in range(0, len(xyzlen)):
if (i>1):
comfile.write(xyzlen[i])
comfile.write('\n$nbo ARCHIVE PLOT BNDIDX file=' + comfilename + ' CMO NLMO STERIC NRT NRTMEM=1 NRTREF=150 NRTTHR=10 MEMORY=1561449115 $end\n\n')
os.chdir(os.getcwd())
for file in glob.glob("*.xyz"):
print("writing file:")
print(file)
writefile(file)