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

finished up FMO cluster INDAT and ICHARG

parent 0732a039
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -200,16 +200,15 @@ def FMOintEnGamess(curr_sys, tsk_d):
frag_d[i] = tmp #initial
xyz = mol.printMol("gamess")
if tsk_d["guess_charges"] == "true":
if mDB.isAnion(mol):
frag_d[i] = mySed(frag_d[i], tag = "ICHARG", repl = "ICHARG=-1")
frag_d["anions"].append(i)
frag_d[i][comment_line] += " anion " + mDB.getAnion(mol)
charge_list.append("-1")
line_no.append("0," + str(n) + ",-" + str(n + len(xyz)))
line_no.append("0," + str(n) + ",-" + str(n + len(xyz) - 1) + ",")
n += len(xyz)
......@@ -219,7 +218,7 @@ def FMOintEnGamess(curr_sys, tsk_d):
frag_d[i][comment_line] += " cation " + mDB.getCation(mol)
charge_list.append("1")
line_no.append("0," + str(n) + ",-" + str(n + len(xyz)))
line_no.append("0," + str(n) + ",-" + str(n + len(xyz) - 1) + ",")
n += len(xyz)
......@@ -230,7 +229,7 @@ def FMOintEnGamess(curr_sys, tsk_d):
frag_d[i][comment_line] += " neutral " #+ getNeutralMol(mol)
charge_list.append("0")
line_no.append("0," + str(n) + ",-" + str(n + len(xyz)))
line_no.append("0," + str(n) + ",-" + str(n + len(xyz) - 1) + ",")
n += len(xyz)
......@@ -244,7 +243,31 @@ def FMOintEnGamess(curr_sys, tsk_d):
# now only do we put everything together for cluster
charge_list = ",".join(charge_list)
frag_d["cluster"] = mySed(frag_d["cluster"], tag = "INDAT(1)", repl = "INDAT(1)=" + charge_list)
frag_d["cluster"] = mySed(frag_d["cluster"], tag = "ICHARG", repl = "ICHARG(1)=" + charge_list)
# INDAT(1)
line_no.append("0")
frag_d["cluster"] = mySed(frag_d["cluster"], tag = "INDAT\(1\)", repl = "INDAT(1)=" + line_no[0])
indat_line = pos_uniq(frag_d["cluster"], "INDAT") + 1
sep_str = "\n" + 13 * " " # indent for lines after INDAT
frag_d["cluster"].insert(indat_line, sep_str.join(line_no[1:]))
# because join doesn't put sep_str in front of first instance
frag_d["cluster"][indat_line] = 9 * " " + frag_d["cluster"][indat_line]
# indent FMO section
# note that this has no effect on line_no lines
# since you are inserting spaces in front of \n, i.e. previous line
# not sure if this will affect GAMESS reading it in
# the space after FMO so doesn't match FMOXYZ
fmo_line = pos_uniq(frag_d["cluster"], "FMO$") + 1
not_fmo_end = True
while not_fmo_end:
if not re.search("\\$END", frag_d["cluster"][fmo_line]):
frag_d["cluster"][fmo_line] = 4 * " " + frag_d["cluster"][fmo_line]
fmo_line += 1
else:
not_fmo_end = False
# flatten first, [[ ... ]]
cluster_xyz = [i for j in cluster_xyz for i in j]
......
File mode changed from 100644 to 100755
......@@ -6,7 +6,8 @@ import collections as col
# functions for accessing databases
def isAnion(mol):
def isAnion(mol, q = False):
# q for quiet
a = mol.atomListAsElem_Sym()
# note the next only returns the first value--no duplicates allowed, or detected
# checking done via Counter() from collections, no sorting required, duplicates included
......@@ -15,7 +16,8 @@ def isAnion(mol):
isAni = False
for key, anion in AnionDB.items():
if col.Counter(a) == col.Counter(anion):
cf.warning("Anion detected ", key)
if not q:
cf.warning("Anion detected ", key)
isAni = True
break
#return True
......@@ -24,12 +26,13 @@ def isAnion(mol):
# return False
return isAni
def isCation(mol):
def isCation(mol, q = False):
a = mol.atomListAsElem_Sym()
isCat = False
for key, cation in CationDB.items():
if col.Counter(a) == col.Counter(cation):
cf.warning("Cation detected ", key)
if not q:
cf.warning("Cation detected ", key)
#return True
isCat = True
break
......
File mode changed from 100644 to 100755
......@@ -2,6 +2,7 @@
from chemF import *
import molDB as mDB # for checking mol is in molDB, if now, warn
from inp_formats import *
import re, os
import sys, getopt, argparse
......@@ -111,7 +112,14 @@ def main():
# collect atoms into molecules
if "nfrag" in taskDict:
print("nfrag detected: ", taskDict["nfrag"])
curr_sys.aggregateMol(nfrag = taskDict["nfrag"])
for mol in curr_sys.molDict.values():
if not mDB.isAnion(mol, q = True) and not mDB.isCation(mol, q = True):
warning("WARNING! ",
col.Counter(mol.atomListAsElem_Sym()),
" is not found in the database")
# printing using functions in formats.py
a = 1
......@@ -174,6 +182,7 @@ def main():
# these print nicely now
# ironing out the last bits of the cluster input file
# can use enumerate to get sequential cation/anion input files
#print(a)
for cation in a["cations"]:
prettyPrint(a[cation], "cation_" + str(cation) + ".ok")
for anion in a["anions"]:
......
File mode changed from 100644 to 100755
......@@ -7,3 +7,4 @@ using=/short/k96/apps/src/ppqc/xyz_files/rand.xyz
title=My_Awesome_Input_File
RUNTYP=ENERGY
template=/short/k96/apps/src/ppqc/templates/fmo.template
#cluster_template=/short/k96/apps/src/ppqc/templates/fmo_cluster.template
......@@ -7,10 +7,6 @@
NFRAG=4 NBODY=1
MPLEVL(1)=2
INDAT(1)=0,1,-16,
0,17,-21,
0,22,-37,
0,38,-42,
0
ICHARG(1)=1,-1,1,-1
RESPAP=0 RESPPC=-1 RESDIM=4 RCORSD=4
$END
......
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