Commit b768920c authored by Samuel Tan's avatar Samuel Tan
Browse files

added optGamess and cleaned other functions too

parent 9278856c
......@@ -128,7 +128,7 @@ class System(object):
if v: # verbose
self.aggregateMol(2) # default 2 fragments
self.printSys() # show some results
self.printFragSys() # show some results
def calcAllDist(self):
# calculate all distances between *molecules* in system
......@@ -152,11 +152,17 @@ class System(object):
self.molDict.pop(mol2)
def printSys(self, fmt = None):
def printFragSys(self, fmt = None):
for i,mol in self.molDict.items():
print("this is molecule: ", i)
print(mol.printMol(fmt))
def printSys(self, fmt = None):
l = []
for mol in self.molDict.values():
l += mol.printMol(fmt)
return l
####################################################################
### ============ FUNCTIONS ================== ###
......
......@@ -6,4 +6,3 @@ memddi=100
guess_charges=true
using=xyz_files/c1mim-br-p1.xyz
title=random title
runtyp=OPTIMIZE
......@@ -10,23 +10,23 @@ import re
# must ensure last step is atomPrint()
# otherwise the string mangling messes up the tabling space!!
def optGamess(curr_sys, tsk_d, template = None):
def optGamess(curr_sys, tsk_d):
if not curr_sys:
print("missing system arg in optGamess()")
return 1
if "template" in tsk_d:
tmp = read_xyz(scriptPath("templates/optGamess.template"))
out_f = read_xyz(tsk_d["template"])
else:
tmp = read_xyz(template)
out_f = read_xyz(scriptPath("templates/optGamess.template"))
# replace anything mentioned in task file with
# "variable = value"
for key,val in tsk_d.items():
tmp = mySed(tmp, key, str(key) + "=" + str(val))
out_f = mySed(out_f, key, str(key) + "=" + str(val))
if tsk_d.get("title"):
tmp = mySed(tmp, "title", tsk_d["title"])
out_f = mySed(out_f, "title", tsk_d["title"])
else:
warning("no title")
......@@ -34,7 +34,9 @@ def optGamess(curr_sys, tsk_d, template = None):
out_f = insert_List(out_f, tag = "xyz_data", insertThis = curr_sys.printSys("gamess"))
# add space in front of GROUP keywords, signaled by "$"
# doing this last so insert_List() etc don't interfere with it
out_f[i] = [" " + line if line.startswith("$") else line for line in out_f[i]]
out_f = [" " + line if str(line).startswith("$") else line for line in out_f]
print(out_f)
return out_f
......@@ -45,15 +47,15 @@ def genPsi4(curr_sys, tsk_d, template = None):
return 1
if "template" in tsk_d:
tmp = read_xyz(template)
out_f = read_xyz(template)
else:
tmp = read_xyz(scriptPath("templates/psi4sapt.template")
out_f = read_xyz(scriptPath("templates/psi4sapt.template"))
# replace anything mentioned in task file with
# "variable = value"
for key,val in tsk_d.items():
tmp = mySed(tmp, key, str(key) + "=" + str(val))
out_f = mySed(out_f, key, str(key) + "=" + str(val))
# guessing charges
charge_mult = col.defaultdict(list)
......@@ -105,25 +107,25 @@ def genPsi4(curr_sys, tsk_d, template = None):
return out_f
def genGamess(curr_sys, tsk_d, template = None):
def genGamess(curr_sys, tsk_d):
if not curr_sys:
print("missing system arg in genGamess()")
return 1
if "template" in tsk_d:
tmp = read_xyz(template)
tmp = read_xyz(tsk_d["template"])
else:
tmp = read_xyz(scriptPath("templates/efp.template"))
# replace anything mentioned in task file with
# replace anything mentioned in task file withM`
# "variable = value"
for key,val in tsk_d.items():
tmp = mySed(tmp, key, str(key) + "=" + str(val))
#if tsk_d.get("title"):
# tmp = mySed(tmp, "title", tsk_d["title"])
# tmp = mySed(tmp, "title", tsk_d["titlM`e"])
#else:
# print("no title")
# print("no title")M`M`M`M`M`M`M`M`M`M`
out_f = {}
# create EFP inputs
......
task=optGamess
nfrag=2
mwords=300
memddi=100
guess_charges=true
using=xyz_files/c1mim-br-p1.xyz
title=stuff
runtyp=OPTIMIZE
ppqc 100644 → 100755
......@@ -38,6 +38,7 @@ def prettyPrint(contentsList, out_filename = None):
def usage():
usage_str = "Usage:\n \t sqcpp.py <task_file> -i <xyz_file> -o <output_file>"
warning(usage_str)
......@@ -89,15 +90,17 @@ def main():
except FileNotFoundError:
print("FileNotFoundError: specified xyz file can't be found")
sys.exit(2)
# collect atoms into molecules
curr_sys.aggregateMol(nfrag = taskDict["nfrag"])
if "nfrag" in taskDict:
curr_sys.aggregateMol(nfrag = taskDict["nfrag"])
# printing using functions in formats.py
a = 1
# Psi4 SAPT
if taskDict["task"] == "psi4sapt":
a = genPsi4(curr_sys = curr_sys, tsk_d = taskDict, template = taskDict["template"])
a = genPsi4(curr_sys = curr_sys, tsk_d = taskDict)
a = prettyPrint(a, taskDict.get("out_filename"))
......@@ -109,7 +112,7 @@ def main():
print("Please remove line from task file and use a template file instead")
return 0
a = optGamess(curr_sys = curr_sys, tsk_d = taskDict)
a = prettyPrint(a, taskDict.get("out_filename"))
a = prettyPrint(a)
# GAMESS EFP
......@@ -120,12 +123,17 @@ def main():
print("Please remove line from task file and use a template file instead")
return 0
a = genGamess(curr_sys = curr_sys, tsk_d = taskDict)
prettyPrint(a[0], "efp_frag_0.inp")
prettyPrint(a[1], "efp_frag_1.inp")
if taskDict.get("out_filename"):
prettyPrint(a[0], "efp_frag_0.inp")
prettyPrint(a[1], "efp_frag_1.inp")
else:
prettyPrint(a[0])
prettyPrint(a[1])
else:
print("Task not recognized")
return 1
return a
......
task=psi4sapt
title=c1mim-bf4-p1-opt_IL_aTZ_sapt2plus3
using=c1mim-bf4-p1.xyz
using=./xyz_files/c1mim-bf4-p1.xyz
nfrag=2
basis=aug-cc-pVTZ
memory=32 Gb
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment