MolSSI / QCEngine

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

GAMESS and calculated nuclear repulsion energy differ #276

Open eljost opened 4 years ago

eljost commented 4 years ago

Describe the bug The nuclear repulsion energy (NRE) obtained by GAMESS and QCElemental differ by a subtle amount in the present test case (H2O2). Updating the GAMESS NRE with the QCElemental NRE in the harvester fails, even though both energies differ only by ~ 5.0e-10 Hartree.

The failing line: https://github.com/MolSSI/QCEngine/blob/a206fb9f1a5d214b67e2a7124771a688a4418501/qcengine/programs/gamess/harvester.py#L27

To Reproduce

from pprint import pprint

import qcelemental as qcel
import qcengine as qcng

molecule = qcel.models.Molecule.from_file("molecule.json")
inp = {
    "molecule": molecule,
    "driver": "gradient",
    "model": {
        "method": "hf",
        "basis": "accd",
    },
    "keywords": {
        "contrl__ispher": 1,
    },
}
result = qcng.compute(inp, program="gamess", return_dict=True)
pprint(result["error"])

The molecule.json file is given below:

{"schema_name": "qcschema_molecule", "schema_version": 2, "validated": true, "symbols": ["H", "H", "O", "O"], "geometry": [-0.67536264, -4.586972, 0.03533376, -1.05022487, 0.59869986, 2.40963753, -1.34934182, -2.68059739, 0.03533376, -0.37926563, -1.30873884, 2.41148478], "name": "H2O2", "molecular_charge": 0.0, "molecular_multiplicity": 1, "fix_com": false, "fix_orientation": false, "provenance": {"creator": "QCElemental", "version": "v0.15.1", "routine": "qcelemental.molparse.from_schema"}}

Expected behavior Checking up to 11 decimal places is probably too harsh, at least in this case. A possible fix would be to replace the line shown above with

qcel_nre = outMol.nuclear_repulsion_energy()
outqcvar.__setitem__("NUCLEAR REPULSION ENERGY", qcel_nre, accept_places=6)

which would only check up to 6 decimal places I guess. But it looks somehow ugly and directly calls a dunder-method...

Additional context Occurs with Python 3.8.5 and recent versions of QCElemental and -Engine (v.0.17 in both cases).