Skip to content

Commit

Permalink
cc2, cc3, bccd, cepa, dhdft, sdsc separation, zapt. format (#376)
Browse files Browse the repository at this point in the history
* cc2, cc3, bccd, cepa, dhdft, sdsc separation, zapt. format

* changelog entries

* ccd df/cd uhf refs

* fix up for geometric v1.0

* dummy commit
  • Loading branch information
loriab authored Nov 11, 2022
1 parent 7f8c58a commit 17248bb
Show file tree
Hide file tree
Showing 12 changed files with 3,775 additions and 358 deletions.
25 changes: 25 additions & 0 deletions docs/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,31 @@ Changelog
.. +++++++++
v0.25.0 / 2022-11-DD
--------------------

Breaking Changes
++++++++++++++++
- (:pr:`376`) GAMESS - slight breaking changes of (1) ROHF MP2 ZAPT quantities now stored in "ZAPT" variables, not "MP2"
variables; and (2) "HF TOTAL ENERGY" no longer stores DFT energy in DFT computation.
- (:pr:`376`) testing - reference quantities now indexed by "standard" or "semicanonical" orbitals since program defaults
differ (mostly in CCSD ROHF FC). Downstream projects using the stdsuite interface will need to add an extra argument to query
reference data.

New Features
++++++++++++

Enhancements
++++++++++++
- (:pr:`376`) Cfour - added parsing for BCCD and BCCD(T) methods.
- (:pr:`376`) NWChem - B2PLYP double-hybrid can now be run and parsed. Added CC2 parsing.
- (:pr:`376`) testing - added parsing contracts for ZAPT2, CEPA(1), CEPA(3), ACPF, AQCC, BCCD, BCCD(T), CC2, CC3, and DH-DFT. Added conventional references for most.
- (:pr:`378`) OpenFF - Support OpenFF Toolkit v0.11+

Bug Fixes
+++++++++


v0.24.1 / 2022-08-16
--------------------

Expand Down
6 changes: 6 additions & 0 deletions qcengine/programs/cfour/germinate.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ def muster_modelchem(method: str, driver: "DriverEnum") -> Dict[str, Any]:
elif method == "mp4":
opts["calc_level"] = "mp4"

elif method == "bccd":
opts["calc_level"] = "b-ccd"

elif method == "cc2":
opts["calc_level"] = "cc2"

Expand All @@ -57,6 +60,9 @@ def muster_modelchem(method: str, driver: "DriverEnum") -> Dict[str, Any]:
# Can't use (T) b/c bug in xsymcor lops it off
opts["calc_level"] = "ccsd[t]"

elif method == "bccd(t)":
opts["calc_level"] = "b-ccd(t)"

elif method == "ccsdt":
opts["calc_level"] = "ccsdt"

Expand Down
91 changes: 61 additions & 30 deletions qcengine/programs/cfour/harvester.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,8 @@ def harvest_outfile_pass(outtext):
module = None
error = ""

# TODO: BCC
# CI
# TODO: CI
# other ROHF tests
# vcc/ecc

NUMBER = r"(?x:" + regex.NUMBER + ")"
DECIMAL = r"(?x:" + regex.DECIMAL + ")"
Expand Down Expand Up @@ -117,7 +115,10 @@ def harvest_outfile_pass(outtext):
mobj = re.search(r"^\s+" + r"(?:E\(SCF\)=)" + r"\s+" + NUMBER + r"\s+" + NUMBER + r"\s*$", outtext, re.MULTILINE)
if mobj:
logger.debug("matched scf2")
psivar["SCF TOTAL ENERGY"] = mobj.group(1)
mobj5 = re.search(r"BRUECKNER\s+IBRKNR\s+ON", outtext)
if not mobj5:
# interferes with ROHF BCCD
psivar["SCF TOTAL ENERGY"] = mobj.group(1)

if "SCF TOTAL ENERGY" not in psivar:
# can be too greedy and match across scf cycles
Expand Down Expand Up @@ -457,36 +458,48 @@ def harvest_outfile_pass(outtext):
psivar["QCISD(T) CORRELATION ENERGY"] = psivar["QCISD(T) TOTAL ENERGY"] - psivar["SCF TOTAL ENERGY"]

# Process CC Iterations
mobj = re.search(
cciterations = re.compile(
# fmt: off
r'^\s+' + r'(?P<fullCC>(?P<iterCC>L?CC(?:\w+(?:-(?:1|1b|2|3))?))(?:\(T\))?)' + r'\s+(?:energy will be calculated.)\s*' +
r'(?:.*?)' +
r'^\s+' + r'(?:\d+)' + r'\s+' + r"(?P<corl>" + NUMBER + r")" + r'\s+' + r"(?P<tot>" + NUMBER + r")" + r'\s+DIIS\s*' +
r'^\s*(?:-+)\s*' +
r'^\s*(?:A miracle (?P<ccprog>has come|come) to pass. The CC iterations have converged.)\s*$',
# fmt: on
outtext,
re.MULTILINE | re.DOTALL,
re.MULTILINE
| re.DOTALL,
)
if mobj:
logger.debug("matched cc with full %s iterating %s" % (mobj.group("fullCC"), mobj.group("iterCC")))
module = {"has come": "vcc", "come": "ecc"}[mobj.group("ccprog")]
mobj_list = [m.groupdict() for m in cciterations.finditer(outtext)]
if mobj_list:
first_match = mobj_list[0]
last_match = mobj_list[-1]

logger.debug("matched cc with full %s iterating %s" % (last_match["fullCC"], last_match["iterCC"]))
module = {"has come": "vcc", "come": "ecc"}[last_match["ccprog"]]

mobj4 = re.search(r"CALCLEVEL\s+ICLLVL\s+CCSDT-1b", outtext)
mtd = mobj.group("iterCC").upper()
mtd = last_match["iterCC"].upper()
if mtd == "CCSDT-1":
if mobj4 and module == "vcc":
mtd = "CCSDT-1B"
else:
mtd = "CCSDT-1A"
elif mtd == "CCSDT-1b":
mtd = "CCSDT-1B"
psivar[f"{mtd} CORRELATION ENERGY"] = mobj.group("corl")
psivar[f"{mtd} TOTAL ENERGY"] = mobj.group("tot")

mobj3 = re.search(r"SCF reference function: RHF", outtext)
if mobj3 and mtd not in ["CCSDT-1A", "CCSDT-1B", "CCSDT-2", "CCSDT-3", "CCSDT"]:
psivar[f"{mtd} DOUBLES ENERGY"] = mobj.group("corl")
mobj5 = re.search(r"BRUECKNER\s+IBRKNR\s+ON", outtext)
if mobj5 and mtd == "CCSD":
# BCCD corl = last Brueckner iter total E - first Brueckner iter HF E
psivar[f"BCCD CORRELATION ENERGY"] = Decimal(last_match["tot"]) - psivar["SCF TOTAL ENERGY"]
psivar[f"BCCD TOTAL ENERGY"] = last_match["tot"]
logger.debug("matched Brueckner iter")
else:
psivar[f"{mtd} CORRELATION ENERGY"] = last_match["corl"]
psivar[f"{mtd} TOTAL ENERGY"] = last_match["tot"]

mobj3 = re.search(r"SCF reference function: RHF", outtext)
if mobj3 and mtd not in ["CCSDT-1A", "CCSDT-1B", "CCSDT-2", "CCSDT-3", "CCSDT"]:
psivar[f"{mtd} DOUBLES ENERGY"] = last_match["corl"]

mobj = re.search(
# fmt: off
Expand Down Expand Up @@ -558,10 +571,12 @@ def harvest_outfile_pass(outtext):
if mobj:
logger.debug("matched ccsd(t) vcc")
psivar["SCF TOTAL ENERGY"] = mobj.group(1)
psivar["CCSD TOTAL ENERGY"] = mobj.group(2)
psivar["(T) CORRECTION ENERGY"] = Decimal(mobj.group(3)) - Decimal(mobj.group(2))
psivar["CCSD(T) CORRELATION ENERGY"] = Decimal(mobj.group(3)) - Decimal(mobj.group(1))
psivar["CCSD(T) TOTAL ENERGY"] = mobj.group(3)
mobj5 = re.search(r"BRUECKNER\s+IBRKNR\s+ON", outtext)
if not mobj5:
psivar["CCSD TOTAL ENERGY"] = mobj.group(2)
psivar["(T) CORRECTION ENERGY"] = Decimal(mobj.group(3)) - Decimal(mobj.group(2))
psivar["CCSD(T) CORRELATION ENERGY"] = Decimal(mobj.group(3)) - Decimal(mobj.group(1))
psivar["CCSD(T) TOTAL ENERGY"] = mobj.group(3)
module = "vcc"

mobj = re.search(
Expand All @@ -575,9 +590,15 @@ def harvest_outfile_pass(outtext):
)
if mobj:
logger.debug("matched ccsd(t) vcc v2")
psivar["CCSD TOTAL ENERGY"] = mobj.group(1)
psivar["(T) CORRECTION ENERGY"] = Decimal(mobj.group(2)) - Decimal(mobj.group(1))
psivar["CCSD(T) TOTAL ENERGY"] = mobj.group(2)
mobj5 = re.search(r"BRUECKNER\s+IBRKNR\s+ON", outtext)
if mobj5:
psivar["B(T) CORRECTION ENERGY"] = Decimal(mobj.group(2)) - Decimal(mobj.group(1))
psivar["BCCD(T) TOTAL ENERGY"] = mobj.group(2)
psivar["BCCD(T) CORRELATION ENERGY"] = psivar["BCCD CORRELATION ENERGY"] + psivar["B(T) CORRECTION ENERGY"]
else:
psivar["CCSD TOTAL ENERGY"] = mobj.group(1)
psivar["(T) CORRECTION ENERGY"] = Decimal(mobj.group(2)) - Decimal(mobj.group(1))
psivar["CCSD(T) TOTAL ENERGY"] = mobj.group(2)
module = "vcc"

mobj = re.search(
Expand Down Expand Up @@ -825,13 +846,15 @@ def harvest_outfile_pass(outtext):
else:
ss = Decimal(mobj.group(3)) + Decimal(mobj.group(4))

if not (
re.search(r"executable xvcc finished", outtext)
and re.search(r"The reference state is a ROHF wave function.", outtext)
):
psivar["%s SAME-SPIN CORRELATION ENERGY" % (mobj.group("iterCC"))] = ss
psivar["%s OPPOSITE-SPIN CORRELATION ENERGY" % (mobj.group("iterCC"))] = mobj.group(5)
psivar["%s CORRELATION ENERGY" % (mobj.group("iterCC"))] = mobj.group(6)
mobj5 = re.search(r"BRUECKNER\s+IBRKNR\s+ON", outtext)
if not mobj5:
if not (
re.search(r"executable xvcc finished", outtext)
and re.search(r"The reference state is a ROHF wave function.", outtext)
):
psivar["%s SAME-SPIN CORRELATION ENERGY" % (mobj.group("iterCC"))] = ss
psivar["%s OPPOSITE-SPIN CORRELATION ENERGY" % (mobj.group("iterCC"))] = mobj.group(5)
psivar["%s CORRELATION ENERGY" % (mobj.group("iterCC"))] = mobj.group(6)

mobj = re.search(
# fmt: off
Expand Down Expand Up @@ -1086,6 +1109,10 @@ def harvest_outfile_pass(outtext):
psivar["CURRENT CORRELATION ENERGY"] = psivar["CCD CORRELATION ENERGY"]
psivar["CURRENT ENERGY"] = psivar["CCD TOTAL ENERGY"]

if "BCCD TOTAL ENERGY" in psivar and "BCCD CORRELATION ENERGY" in psivar:
psivar["CURRENT CORRELATION ENERGY"] = psivar["BCCD CORRELATION ENERGY"]
psivar["CURRENT ENERGY"] = psivar["BCCD TOTAL ENERGY"]

if "CCSD TOTAL ENERGY" in psivar and "CCSD CORRELATION ENERGY" in psivar:
psivar["CURRENT CORRELATION ENERGY"] = psivar["CCSD CORRELATION ENERGY"]
psivar["CURRENT ENERGY"] = psivar["CCSD TOTAL ENERGY"]
Expand All @@ -1102,6 +1129,10 @@ def harvest_outfile_pass(outtext):
psivar["CURRENT CORRELATION ENERGY"] = psivar["A-CCSD(T) CORRELATION ENERGY"]
psivar["CURRENT ENERGY"] = psivar["A-CCSD(T) TOTAL ENERGY"]

if "BCCD(T) TOTAL ENERGY" in psivar and "BCCD(T) CORRELATION ENERGY" in psivar:
psivar["CURRENT CORRELATION ENERGY"] = psivar["BCCD(T) CORRELATION ENERGY"]
psivar["CURRENT ENERGY"] = psivar["BCCD(T) TOTAL ENERGY"]

if "CC3 TOTAL ENERGY" in psivar and "CC3 CORRELATION ENERGY" in psivar:
psivar["CURRENT CORRELATION ENERGY"] = psivar["CC3 CORRELATION ENERGY"]
psivar["CURRENT ENERGY"] = psivar["CC3 TOTAL ENERGY"]
Expand Down
9 changes: 7 additions & 2 deletions qcengine/programs/gamess/harvester.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,8 @@ def harvest_outfile_pass(outtext):
)
if mobj:
logger.debug("matched mp2 b")
qcvar["MP2 CORRELATION ENERGY"] = mobj.group(2)
qcvar["MP2 TOTAL ENERGY"] = mobj.group(3)
qcvar["ZAPT2 CORRELATION ENERGY"] = mobj.group(2)
qcvar["ZAPT2 TOTAL ENERGY"] = mobj.group(3)

mobj = re.search(
# fmt: off
Expand Down Expand Up @@ -633,6 +633,10 @@ def harvest_outfile_pass(outtext):
qcvar["CURRENT CORRELATION ENERGY"] = qcvar["MP2 CORRELATION ENERGY"]
qcvar["CURRENT ENERGY"] = qcvar["MP2 TOTAL ENERGY"]

if "ZAPT2 TOTAL ENERGY" in qcvar and "ZAPT2 CORRELATION ENERGY" in qcvar:
qcvar["CURRENT CORRELATION ENERGY"] = qcvar["ZAPT2 CORRELATION ENERGY"]
qcvar["CURRENT ENERGY"] = qcvar["ZAPT2 TOTAL ENERGY"]

if "CISD TOTAL ENERGY" in qcvar and "CISD CORRELATION ENERGY" in qcvar:
qcvar["CURRENT CORRELATION ENERGY"] = qcvar["CISD CORRELATION ENERGY"]
qcvar["CURRENT ENERGY"] = qcvar["CISD TOTAL ENERGY"]
Expand Down Expand Up @@ -664,6 +668,7 @@ def harvest_outfile_pass(outtext):
if "DFT TOTAL ENERGY" in qcvar:
qcvar["CURRENT REFERENCE ENERGY"] = qcvar["DFT TOTAL ENERGY"]
qcvar["CURRENT ENERGY"] = qcvar["DFT TOTAL ENERGY"]
qcvar.pop("HF TOTAL ENERGY")

if "FCI TOTAL ENERGY" in qcvar: # and 'FCI CORRELATION ENERGY' in qcvar:
qcvar["CURRENT ENERGY"] = qcvar["FCI TOTAL ENERGY"]
Expand Down
17 changes: 12 additions & 5 deletions qcengine/programs/nwchem/harvester.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,16 +214,17 @@ def harvest_outfile_pass(outtext):
# fmt: off
r'^\s+' + r'DFT energy' + r'\s+' + NUMBER + r'\s*' +
r'^\s+' + r'Unscaled MP2 energy' + r'\s+' + NUMBER + r'\s*' +
r'^\s+' + r'Total DFT+MP2 energy' + r'\s+' + NUMBER + r'\s*$',
r'^\s+' + r'Total DFT\+MP2 energy' + r'\s+' + NUMBER + r'\s*$',
# fmt: on
outtext,
re.MULTILINE,
)
if mobj:
logger.debug("matched dft-mp2")
psivar["DFT TOTAL ENERGY"] = mobj.group(1)
psivar["MP2 CORRELATION ENERGY"] = mobj.group(2)
psivar["MP2 TOTAL ENERGY"] = mobj.group(3)
psivar.pop("DFT TOTAL ENERGY") # remove previously defined DFT energy w/o DH contribution
psivar["DFT FUNCTIONAL TOTAL ENERGY"] = mobj.group(1)
psivar["CURRENT REFERENCE ENERGY"] = mobj.group(1)
psivar["DFT TOTAL ENERGY"] = mobj.group(3)

# 3) MP2 with CCSD or CCSD(T) calculation (through CCSD(T) directive)
mobj = re.search(
Expand Down Expand Up @@ -1077,7 +1078,9 @@ def harvest_outfile_pass(outtext):
psivar["CURRENT ENERGY"] = psivar["LCCSD TOTAL ENERGY"]

if "DFT TOTAL ENERGY" in psivar:
psivar["CURRENT REFERENCE ENERGY"] = psivar["DFT TOTAL ENERGY"]
if "CURRENT REFERENCE ENERGY" not in psivar:
# already set for DH-DFT
psivar["CURRENT REFERENCE ENERGY"] = psivar["DFT TOTAL ENERGY"]
psivar["CURRENT ENERGY"] = psivar["DFT TOTAL ENERGY"]

# Process TCE CURRENT energies
Expand All @@ -1092,6 +1095,10 @@ def harvest_outfile_pass(outtext):
psivar["CURRENT CORRELATION ENERGY"] = psivar["CCD CORRELATION ENERGY"]
psivar["CURRENT ENERGY"] = psivar["CCD TOTAL ENERGY"]

if "CC2 TOTAL ENERGY" in psivar and "CC2 CORRELATION ENERGY" in psivar:
psivar["CURRENT CORRELATION ENERGY"] = psivar["CC2 CORRELATION ENERGY"]
psivar["CURRENT ENERGY"] = psivar["CC2 TOTAL ENERGY"]

if "CCSD TOTAL ENERGY" in psivar and "CCSD CORRELATION ENERGY" in psivar:
psivar["CURRENT CORRELATION ENERGY"] = psivar["CCSD CORRELATION ENERGY"]
psivar["CURRENT ENERGY"] = psivar["CCSD TOTAL ENERGY"]
Expand Down
Loading

0 comments on commit 17248bb

Please sign in to comment.