Skip to content

Commit 680f29e

Browse files
committed
Added standard energy and gradients to results
* Added 'energy' and 'gradients' to optional results to support e.g. Energy Scan * Fixed crashing bug in description of the Energy substep.
1 parent 6198055 commit 680f29e

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

HISTORY.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
=======
22
History
33
=======
4+
2024.5.23 -- Added standard energy and gradients to results
5+
* Added 'energy' and 'gradients' to optional results to support e.g. Energy Scan
6+
* Fixed crashing bug in description of the Energy substep.
7+
48
2024.3.17 -- Updated the installer
59
* Updated the installer to use the new version of the SEAMM installer.
610
* Finalizes installing either with Conda or Docker

psi4_step/energy.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def description_text(
6060
):
6161
"""Prepare information about what this node will do"""
6262

63-
if P is not None:
63+
if P is None:
6464
P = self.parameters.values_to_dict()
6565

6666
if P["level"] == "recommended":
@@ -273,6 +273,7 @@ def get_input(self, calculation_type="energy", restart=None):
273273
lines.append(
274274
f"Eelec, wfn = {calculation_type}('{functional}', return_wfn=True)"
275275
)
276+
lines.append(f"G = gradient('{functional}', ref_wfn=wfn)")
276277
else:
277278
if calculation_type == "gradient":
278279
lines.append(
@@ -290,6 +291,7 @@ def get_input(self, calculation_type="energy", restart=None):
290291
lines.append(
291292
f"Eelec, wfn = {calculation_type}('{method}', return_wfn=True)"
292293
)
294+
lines.append(f"G = gradient('{method}', ref_wfn=wfn)")
293295
else:
294296
if calculation_type == "gradient":
295297
lines.append(
@@ -332,6 +334,11 @@ def get_input(self, calculation_type="energy", restart=None):
332334
for item in arrays:
333335
variables[item] = wfn.array_variable(item).np.tolist()
334336
variables["Eelec"] = Eelec
337+
variables["energy"] = Eelec
338+
try:
339+
variables["gradient"] = np.array(G).tolist()
340+
except Exception:
341+
pass
335342
variables["_method"] = "{method}"
336343
variables["_method_string"] = "{method_string}"
337344

psi4_step/psi4_metadata.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1624,6 +1624,19 @@
16241624
Optional units for the result. If present, the value should be in these units.
16251625
"""
16261626
metadata["results"] = {
1627+
"energy": {
1628+
"description": "The total energy",
1629+
"dimensionality": "scalar",
1630+
"property": "total energy#Psi4#{model}",
1631+
"type": "float",
1632+
"units": "kJ/mol",
1633+
},
1634+
"gradients": {
1635+
"description": "The gradients",
1636+
"dimensionality": "[3, n_atoms]",
1637+
"type": "float",
1638+
"units": "kJ/mol/Å",
1639+
},
16271640
"(T) CORRECTION ENERGY": {
16281641
"calculation": ["energy", "optimization", "thermochemistry", "vibrations"],
16291642
"description": "",
@@ -1816,7 +1829,6 @@
18161829
"description": "the electronic energy from the current method",
18171830
"dimensionality": "scalar",
18181831
"methods": ["ccsd", "ccsd(t)", "dft", "hf", "lccd", "mp2", "mp3", "mp4"],
1819-
"property": "total energy#Psi4#{model}",
18201832
"type": "float",
18211833
"units": "E_h",
18221834
},

0 commit comments

Comments
 (0)