MolSSI / QCFractal

A distributed compute and database platform for quantum chemistry.
https://molssi.github.io/QCFractal/
BSD 3-Clause "New" or "Revised" License
144 stars 47 forks source link

wb97m-d3bj, b97-d3bj methods fail because of splitting into functional+dispersion correction calculations #688

Closed pavankum closed 2 years ago

pavankum commented 2 years ago

Describe the bug For b97-d3bj and wb97m-d3bj methods, an energy calculation seems to be divided into b97, wb97m plus the d3bj dispersion correction, and this results in psi4 throwing an input_error saying method doesn't exist since there are no functionals b97 and wb97m separately. Not sure where the split happens since qcengine works fine with the above functionals.

To Reproduce Not sure how to reproduce this. On this single point energies dataset, all runs under those two specs fail. Here is one error message along with the input it takes, where we can see in the qcspec under model the method is wb97m, which is invalid

Code to retrieve the error

import lzma

from qcfractal.interface import FractalClient

client = FractalClient.from_file()
ds = client.get_collection('Dataset', 'OpenFF Theory Benchmarking Single Point Energies v1.0')

spec_name = 'wb97m-d3bj/dzvp'
method = 'wb97m-d3bj'
basis = 'dzvp'
recs = ds.get_records(method=method, basis=basis, keywords=spec_name)

indx = len(recs)
print("Record ID: ", recs[indx - 1].iloc[0].record.id, "Status: ", recs[indx - 1].iloc[0].record.status)
print(client.query_tasks(base_result=int(recs[indx - 1].iloc[0].record.id)))
kv = client.query_kvstore(recs[indx - 1].iloc[0].record.error)
out = lzma.decompress(kv[list(kv.keys())[0]].data).decode()
print("-----------")
print(bytes(str(out), 'utf-8').decode("unicode_escape"))```

Output of this code snippet

Record ID:  76485400 Status:  RecordStatusEnum.error
[TaskRecord(id='12656653', spec=PythonComputeSpec(function='qcengine.compute', args=[{'id': '76485400', 'schema_name': 'qcschema_input', 'schema_version': 1, 'molecule': {'schema_name': 'qcschema_molecule', 'schema_version': 2, 'validated': True, 'symbols': array(['C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'N',
       'O', 'O', 'S', 'H', 'H', 'H', 'H', 'H', 'H', 'H', 'H', 'H', 'H'],
      dtype='<U1'), 'geometry': array([[ 7.14598936,  4.89303268,  8.02149883],
       [ 2.79347219, -1.99557317, 17.54585318],
       [ 4.52882721,  4.70904974,  8.08403528],
       [ 8.55000079,  2.67234348,  7.95773156],
       [ 2.12545009,  0.08776928, 16.09607116],
       [ 2.84822952, -4.38094863, 16.44620594],
       [ 3.32259548,  2.38187589,  8.09785823],
       [ 7.35599604,  0.34624741,  7.98313022],
       [ 1.51538521, -0.19788194, 13.56210275],
       [ 2.26358961, -4.67704744, 13.90985213],
       [ 4.71059822,  0.11142542,  8.06422807],
       [ 1.58460843, -2.58821631, 12.47662429],
       [ 3.77897953, -2.31157612,  8.03158474],
       [ 0.60637131, -5.63751252,  8.75874961],
       [-0.96921459, -1.19681482,  8.5413268 ],
       [ 1.09853832, -2.95116639,  9.15804378],
       [ 8.06743884,  6.7157386 ,  8.00926758],
       [ 3.25513831, -1.76521521, 19.52251861],
       [ 3.39187616,  6.4099792 ,  8.10920113],
       [10.59299664,  2.75020135,  7.90212378],
       [ 2.07506508,  1.94578132, 16.94516669],
       [ 3.3549825 , -6.00966146, 17.57188645],
       [ 1.28607386,  2.28364014,  8.07551813],
       [ 8.44155974, -1.38552546,  7.94368976],
       [ 0.94522212,  1.40257696, 12.43522855],
       [ 2.30753771, -6.50381382, 12.99918077]]), 'name': 'C12H10NO2S', 'identifiers': {'molecule_hash': '7b0ec48bf946eb89891c5bc1a401f2e85deea56f', 'molecular_formula': 'C12H10NO2S'}, 'molecular_charge': -1.0, 'molecular_multiplicity': 1, 'connectivity': [[0, 2, 2.0], [0, 3, 1.0], [0, 16, 1.0], [1, 4, 2.0], [1, 5, 1.0], [1, 17, 1.0], [2, 6, 1.0], [2, 18, 1.0], [3, 7, 2.0], [3, 19, 1.0], [4, 8, 1.0], [4, 20, 1.0], [5, 9, 2.0], [5, 21, 1.0], [6, 10, 2.0], [6, 22, 1.0], [7, 10, 1.0], [7, 23, 1.0], [8, 11, 2.0], [8, 24, 1.0], [9, 11, 1.0], [9, 25, 1.0], [10, 12, 1.0], [11, 15, 1.0], [12, 15, 1.0], [13, 15, 2.0], [14, 15, 2.0]], 'fix_com': True, 'fix_orientation': True, 'fix_symmetry': 'c1', 'provenance': {'creator': 'QCElemental', 'version': 'v0.17.0', 'routine': 'qcelemental.molparse.from_schema'}, 'id': '45139497', 'extras': {'canonical_isomeric_explicit_hydrogen_mapped_smiles': '[H:17][c:1]1[c:3]([c:7]([c:11]([c:8]([c:4]1[H:20])[H:24])[N-:13][S:16](=[O:14])(=[O:15])[c:12]2[c:9]([c:5]([c:2]([c:6]([c:10]2[H:26])[H:22])[H:18])[H:21])[H:25])[H:23])[H:19]'}}, 'driver': 'energy', 'model': {'method': 'wb97m', 'basis': 'dzvp'}, 'keywords': {'maxiter': 200, 'scf_properties': ['dipole', 'quadrupole', 'wiberg_lowdin_indices', 'mayer_indices']}, 'protocols': {'wavefunction': 'none'}, 'extras': {'_qcfractal_tags': {'program': 'psi4', 'keywords': '2'}}, 'provenance': {'creator': 'QCElemental', 'version': 'v0.20.0', 'routine': 'qcelemental.models.results'}}, 'psi4'], kwargs={}), parser='single', status=<TaskStatusEnum.error: 'ERROR'>, program='psi4', procedure=None, manager='PacificResearchPlatformQM-openff-qca-qm-7465d46b55-gfjbg-4b16e2ca-418c-4b48-8f28-cf1dfd2a8add', priority=<PriorityEnum.NORMAL: 1>, tag='openff', base_result='76485400', modified_on=datetime.datetime(2021, 9, 21, 8, 29, 10, 429772), created_on=datetime.datetime(2021, 9, 17, 17, 9, 55, 349003))]
-----------
{"error_type": "input_error", "error_message": "QCEngine Input Error: Traceback (most recent call last):
  File "/opt/conda/envs/qcfractal/lib//python3.7/site-packages/psi4/driver/schema_wrapper.py", line 407, in run_qcschema
    ret_data = run_json_qcschema(input_model.dict(), clean, False, keep_wfn=keep_wfn)
  File "/opt/conda/envs/qcfractal/lib//python3.7/site-packages/psi4/driver/schema_wrapper.py", line 554, in run_json_qcschema
    val, wfn = methods_dict_[json_data["driver"]](method, **kwargs)
  File "/opt/conda/envs/qcfractal/lib//python3.7/site-packages/psi4/driver/driver.py", line 555, in energy
    optstash = driver_util._set_convergence_criterion('energy', lowername, 6, 8, 6, 8, 6)
  File "/opt/conda/envs/qcfractal/lib//python3.7/site-packages/psi4/driver/driver_util.py", line 77, in _set_convergence_criterion
    _method_exists(ptype, method_name)
  File "/opt/conda/envs/qcfractal/lib//python3.7/site-packages/psi4/driver/driver_util.py", line 49, in _method_exists
    raise ValidationError('%s method "%s" is not available.%s' % (Cptype, method_name, alternatives))
psi4.driver.p4util.exceptions.ValidationError: Energy method "wb97m" is not available. Did you mean? wb97 wb97x wb97xv wb97mv wb97m-v
", "extras": null}

Expected behavior

A local fractal run with one of the above specs works fine so it is a bit confusing what's the source of error is

import qcfractal.interface as ptl
from qcfractal.interface import FractalClient
from qcfractal import FractalSnowflakeHandler
import time

local_fractal_instance = FractalSnowflakeHandler(ncores=8)
client = FractalClient(local_fractal_instance)
mol = ptl.Molecule(symbols=["H", "H"], geometry=[0, 0, 0, 0, 5, 0])
mol_id = client.add_molecules([mol])[0]
# Ask the server to compute a new computation
r = client.add_compute("psi4", "wb97m-d3bj", "dzvp", "energy", None, [mol_id])
print(r)
print(r.ids)
time.sleep(10)
proc = client.query_procedures(id=r.ids)[0]
print(proc)
print(proc.properties.scf_total_energy)
bennybp commented 2 years ago

Fixed in #691 (I believe)