openforcefield / openff-qcsubmit

Automated tools for submitting molecules to QCFractal
https://openff-qcsubmit.readthedocs.io/en/latest/index.html
MIT License
26 stars 4 forks source link

Toolkit 0.11 support #203

Closed Yoshanuikabundi closed 1 year ago

Yoshanuikabundi commented 1 year ago

Description

Update QCSubmit to work with the OpenFF Toolkit 0.11+

Todos

Test failures (running locally on my machine):

Remaining failing tests

The remaining failing tests seem to all stem from the same cause. I think what's happening is that we're passing conformers to geomeTRIC as OpenFF units, when it expects OpenMM units, but I can't find the place in code where this happens. I think the fix will be as simple as inserting an .to_openmm() in the right spot, but I don't know where that spot is. Here's the relevant Tornado output:

INFO     tornado.application:managers.py:622 Processed 1 tasks: 0 succeeded / 1 failed).
INFO     tornado.application:managers.py:623 Task ids, submission status, calculation status below
INFO     tornado.application:managers.py:625     Task 5 : sent / failed: unknown
INFO     tornado.application:managers.py:627 The following tasks failed with the errors:
INFO     tornado.application:managers.py:629 Error message for task id 5
INFO     tornado.application:managers.py:630     Error type: unknown
INFO     tornado.application:managers.py:631     Backtrace: 
geomeTRIC run_json error:
Traceback (most recent call last):
  File "/home/joshmitchell/Documents/openff/qcsubmit/nogit/env/lib/python3.9/site-packages/geometric/run_json.py", line 225, in geometric_run_json
    geometric.optimize.Optimize(coords, M, IC, engine, None, params)
  File "/home/joshmitchell/Documents/openff/qcsubmit/nogit/env/lib/python3.9/site-packages/geometric/optimize.py", line 1331, in Optimize
    return optimizer.optimizeGeometry()
  File "/home/joshmitchell/Documents/openff/qcsubmit/nogit/env/lib/python3.9/site-packages/geometric/optimize.py", line 1293, in optimizeGeometry
    self.calcEnergyForce()
  File "/home/joshmitchell/Documents/openff/qcsubmit/nogit/env/lib/python3.9/site-packages/geometric/optimize.py", line 1002, in calcEnergyForce
    spcalc = self.engine.calc(self.X, self.dirname)
  File "/home/joshmitchell/Documents/openff/qcsubmit/nogit/env/lib/python3.9/site-packages/geometric/engine.py", line 873, in calc
    return self.calc_new(coords, dirname)
  File "/home/joshmitchell/Documents/openff/qcsubmit/nogit/env/lib/python3.9/site-packages/geometric/engine.py", line 865, in calc_new
    raise QCEngineAPIEngineError("QCEngineAPI computation did not execute correctly. Message: " + ret["error"]["error_message"])
geometric.errors.QCEngineAPIEngineError: QCEngineAPI computation did not execute correctly. Message: QCEngine Execution Error:
Traceback (most recent call last):
  File "/home/joshmitchell/Documents/openff/qcsubmit/nogit/env/lib/python3.9/site-packages/qcengine/util.py", line 114, in compute_wrapper
    yield metadata
  File "/home/joshmitchell/Documents/openff/qcsubmit/nogit/env/lib/python3.9/site-packages/qcengine/compute.py", line 105, in compute
    output_data = executor.compute(input_data, config)
  File "/home/joshmitchell/Documents/openff/qcsubmit/nogit/env/lib/python3.9/site-packages/qcengine/programs/openmm.py", line 300, in compute
    context.setPositions(off_mol.conformers[0])
  File "/home/joshmitchell/Documents/openff/qcsubmit/nogit/env/lib/python3.9/site-packages/openmm/openmm.py", line 12108, in setPositions
    return _openmm.Context_setPositions(self, positions)
ValueError: in method Context_setPositions, argument 2 could not be converted to type std::vector< Vec3,std::allocator< Vec3 > > const &

Questions

Status

jthorton commented 1 year ago

Hi @Yoshanuikabundi, thanks for taking this on!

The issue with the tests is due to this line in qcengine which assumes that the conformer is already in openmm units should be an easy fix I think!

Yoshanuikabundi commented 1 year ago

Oh I didn't realise QCEngine used OpenFF Molecules internally! Thanks for pointing that out @jthorton!

Yoshanuikabundi commented 1 year ago

OK this PR now passes tests locally when used together with https://github.com/MolSSI/QCEngine/pull/378 and https://github.com/openforcefield/openff-toolkit/pull/1417

This is probably best released as 0.4.0 - I've made no attempt to preserve compatibility with earlier versions of the toolkit, so if bug patch releases for the old toolkit is required it'll be helpful to have the v0.3 series available.

Yoshanuikabundi commented 1 year ago

I've had to move CI from Python 3.7 to 3.8 as it is required by v0.11.

Yoshanuikabundi commented 1 year ago

Superseded by #204