-
Notifications
You must be signed in to change notification settings - Fork 80
GAMESS EFP Support #256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
GAMESS EFP Support #256
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -26,7 +26,10 @@ def harvest(p4Mol, gamessout: str, **largs) -> Tuple[PreservingDict, Molecule, l | |||
if outMol: | ||||
outqcvar["NUCLEAR REPULSION ENERGY"] = outMol.nuclear_repulsion_energy() | ||||
if p4Mol: | ||||
if abs(outMol.nuclear_repulsion_energy() - p4Mol.nuclear_repulsion_energy()) > 1.0e-3: | ||||
# temporary hack until qcel lets us do EFP with an 'empty' QM molecule | ||||
if p4Mol.extras is not None and "efp" in p4Mol.extras: | ||||
outMol = p4Mol | ||||
elif abs(outMol.nuclear_repulsion_energy() - p4Mol.nuclear_repulsion_energy()) > 1.0e-3: | ||||
raise ValueError( | ||||
"""gamess outfile (NRE: %f) inconsistent with Psi4 input (NRE: %f).""" | ||||
% (outMol.nuclear_repulsion_energy(), p4Mol.nuclear_repulsion_energy()) | ||||
|
@@ -319,6 +322,55 @@ def harvest_outfile_pass(outtext): | |||
logger.debug("matched dft xc") | ||||
qcvar["DFT XC ENERGY"] = mobj.group(1) | ||||
|
||||
# Process EFP | ||||
mobj = re.search( | ||||
# fmt: off | ||||
r"^\s+" + r"ELECTROSTATIC ENERGY =" + r"\s+" + NUMBER + r"\s*" + | ||||
r"^\s+" + r"REPULSION ENERGY =" + r"\s+" + NUMBER + r"\s*" + | ||||
r"^\s+" + r"POLARIZATION ENERGY =" + r"\s+" + NUMBER + r"\s*" + | ||||
r"^\s+" + r"--------------------------------------" + r"\s*" + | ||||
r"^\s+" + r"FINAL EFP ENERGY =" + r"\s+" + NUMBER + r"\s*", | ||||
# fmt: on | ||||
outtext, | ||||
re.MULTILINE, | ||||
) | ||||
if mobj: | ||||
logger.debug("matched efp") | ||||
print("matched efp") | ||||
qcvar["EFP ELECTROSTATIC ENERGY"] = mobj.group(1) | ||||
qcvar["EFP REPULSION ENERGY"] = mobj.group(2) | ||||
qcvar["EFP POLARIZATION ENERGY"] = mobj.group(3) | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nice for now, may have to revisit in future. i'm against a 3rd labels set. https://github.com/loriab/pylibefp/blob/master/pylibefp/wrapper.py#L961-L966 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Noted, that's going to be a headache later on |
||||
qcvar["EFP DISPERSION ENERGY"] = 0.0 | ||||
qcvar["EFP CHARGE TRANSFER ENERGY"] = 0.0 | ||||
qcvar["EFP TOTAL ENERGY"] = mobj.group(4) | ||||
qcvar_coord = Molecule(validate=False, symbols=[], geometry=[]) | ||||
|
||||
mobj = re.search( | ||||
# fmt: off | ||||
r"^\s+" + r"ELECTROSTATIC ENERGY =" + r"\s+" + NUMBER + r"\s*" + | ||||
r"^\s+" + r"REPULSION ENERGY =" + r"\s+" + NUMBER + r"\s*" + | ||||
r"^\s+" + r"POLARIZATION ENERGY =" + r"\s+" + NUMBER + r"\s*" + | ||||
r"^\s+" + r"TOTAL DISPERSION ENERGY\(E6\+E7\+E8\) =" + r"\s+" + NUMBER + r"\s*" + | ||||
r"^\s+" + r"E7 DISPERSION ENERGY =" + r"\s+" + NUMBER + r"\s*" + | ||||
r"^\s+" + r"E6 DISPERSION ENERGY =" + r"\s+" + NUMBER + r"\s*" + | ||||
r"^\s+" + r"CHARGE TRANSFER ENRGY =" + r"\s+" + NUMBER + r"\s*" + | ||||
r"^\s+" + r"--------------------------------------" + r"\s*" + | ||||
r"^\s+" + r"FINAL EFP ENERGY =" + r"\s+" + NUMBER + r"\s*", | ||||
# fmt: on | ||||
outtext, | ||||
re.MULTILINE, | ||||
) | ||||
if mobj: | ||||
logger.debug("matched efp") | ||||
print("matched efp") | ||||
qcvar["EFP ELECTROSTATIC ENERGY"] = mobj.group(1) | ||||
qcvar["EFP REPULSION ENERGY"] = mobj.group(2) | ||||
qcvar["EFP POLARIZATION ENERGY"] = mobj.group(3) | ||||
qcvar["EFP DISPERSION ENERGY"] = mobj.group(4) | ||||
qcvar["EFP CHARGE TRANSFER ENERGY"] = mobj.group(7) | ||||
qcvar["EFP TOTAL ENERGY"] = mobj.group(8) | ||||
qcvar_coord = Molecule(validate=False, symbols=[], geometry=[]) | ||||
|
||||
# Process Geometry | ||||
mobj = re.search( | ||||
# fmt: off | ||||
|
@@ -445,6 +497,10 @@ def harvest_outfile_pass(outtext): | |||
qcvar["CURRENT REFERENCE ENERGY"] = qcvar["DFT TOTAL ENERGY"] | ||||
qcvar["CURRENT ENERGY"] = qcvar["DFT TOTAL ENERGY"] | ||||
|
||||
if "EFP TOTAL ENERGY" in qcvar: | ||||
qcvar["CURRENT REFERENCE ENERGY"] = qcvar["EFP TOTAL ENERGY"] | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. unless something needs it, maybe drop the current ref line. it's questionable. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had to add that line since QCEngine/qcengine/programs/gamess/runner.py Line 155 in 4525eb3
What exactly is questionable about it? Would setting There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you could get away with |
||||
qcvar["CURRENT ENERGY"] = qcvar["EFP TOTAL ENERGY"] | ||||
|
||||
if "FCI TOTAL ENERGY" in qcvar: # and 'FCI CORRELATION ENERGY' in qcvar: | ||||
qcvar["CURRENT ENERGY"] = qcvar["FCI TOTAL ENERGY"] | ||||
|
||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,7 +85,7 @@ def compute(self, input_data: AtomicInput, config: "TaskConfig") -> AtomicResult | |
def build_input( | ||
self, input_model: AtomicInput, config: "TaskConfig", template: Optional[str] = None | ||
) -> Dict[str, Any]: | ||
gamessrec = {"infiles": {}, "scratch_directory": config.scratch_directory} | ||
gamessrec = {"infiles": {}, "outfiles": [], "scratch_directory": config.scratch_directory} | ||
|
||
opts = copy.deepcopy(input_model.keywords) | ||
|
||
|
@@ -107,7 +107,18 @@ def build_input( | |
# Handle conversion from schema (flat key/value) keywords into local format | ||
optcmd = format_keywords(opts) | ||
|
||
gamessrec["infiles"]["gamess.inp"] = optcmd + molcmd | ||
# Currently passing in the entire GAMESS-formatted EFP command (i.e. the $EFRAG section) | ||
# In the future, should be passed in as actual data fragments, coordinates, etc.) | ||
if input_model.molecule.extras is not None and "efp" in input_model.molecule.extras: | ||
efpcmd = input_model.molecule.extras["efp"] | ||
gamessrec["infiles"]["gamess.inp"] = optcmd + efpcmd + molcmd | ||
else: | ||
gamessrec["infiles"]["gamess.inp"] = optcmd + molcmd | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what's in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suppose I should rename that variable from This is a short-tem solution. Eventually, we need an input-parsing function that takes in your I added an example script to the PR description that demonstrates how you'd run MAKEFP and then get an EFP interaction energy. This will give you a better idea of what the |
||
|
||
# Store the generated efp if running makefp | ||
if opts["contrl__runtyp"] == "makefp": | ||
gamessrec["outfiles"].append("gamess.efp") | ||
|
||
gamessrec["command"] = [which("rungms"), "gamess"] # rungms JOB VERNO NCPUS >& JOB.log & | ||
|
||
return gamessrec | ||
|
@@ -133,7 +144,11 @@ def build_input( | |
def execute(self, inputs, extra_outfiles=None, extra_commands=None, scratch_name=None, timeout=None): | ||
|
||
success, dexe = execute( | ||
inputs["command"], inputs["infiles"], [], scratch_messy=False, scratch_directory=inputs["scratch_directory"] | ||
inputs["command"], | ||
inputs["infiles"], | ||
inputs["outfiles"], | ||
scratch_messy=False, | ||
scratch_directory=inputs["scratch_directory"], | ||
) | ||
return success, dexe | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.