MolSSI / QCEngine

Quantum chemistry program executor and IO standardizer (QCSchema).
https://molssi.github.io/QCEngine/
BSD 3-Clause "New" or "Revised" License
162 stars 78 forks source link

The output dictionary from TeraChem does not have the 'return_energy' key in the properties. #444

Closed hjnpark closed 3 months ago

hjnpark commented 4 months ago

Describe the bug

When I submit an optimization procedure through QCFractal using geomeTRIC and TeraChem, I encounter the following KeyError.

File "/home/heepark/github/geomeTRIC/geometric/engine.py", line 1863, in calc_new
energy = ret["properties"]["return_energy"]
KeyError: 'return_energy'

Line 1863 of engine.py

To Reproduce

import numpy as np
from geometric.molecule import Molecule as geoM
from qcelemental.models import Molecule as qcel
from qcfractal.snowflake import FractalSnowflake
from geometric.nifty import bohr2ang

M = geoM('HCN.xyz')
s = FractalSnowflake()
client = s.client()

sp_spec = {
    'program':"terachem",
    'driver':"gradient",
    'method':"hf",
    'basis':"3-21g",
}

opt_spec = {
    'program':'geometric',
    'qc_specification':sp_spec,
}

elmol = qcel(symbols=M.elem, geometry=np.array(M.xyzs) / bohr2ang, molecular_charge = 0, molecular_multiplicity = 1)

_, ids = client.add_optimizations(elmol, **opt_spec)
s.await_results()
rec = client.get_optimizations(ids)[0]
print(rec.stdout)
print(rec.error)

Expected behavior

Adding a line in terachem.py fixes the problem for me, but tests are failing because the output.json from QCEngineRecords does not have return_energy in its properties.

Additional context

If what I did here is not a good idea, I can modify geomeTRIC's engine.py to make it work instead. Thank you!

hjnpark commented 3 months ago

I will modify geomeTRIC's engine.py to avoid this issue. Thank you!