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

enable rigid optimization with geometric #431

Closed ldamore closed 9 months ago

ldamore commented 9 months ago

Recently a rigid optimization has been introduced in geometric that may be used for calculating interaction energy curves of molecular dimers while excluding the effects of intramolecular deformations. To enable this feature, in geometric command line the options --rigid yes and --conmethod 1 need to be used. geometric.readthedocs.io/en/latest/constraints.html

I am using qcengine with a custom OpenMMHarness (I skip copy pasting this custom function) to run the optimization, I tried specify rigid yes and conmethod in the keywords dict of OptimizationInput, the optimization does not give errors and finished successfully, however the conformation (i.e. bond length, angles and dihedral) of the monomers in the dimer does vary, meaning that the keywords for the rigid optimization are not passed correctly to geometric

import qcengine
from qcengine.programs.openmm import OpenMMHarness
from qcengine.programs import register_program
from qcelemental.models import AtomicInput, OptimizationInput, AtomicResult, Provenance
from qcelemental.models.common_models import Model
from qcelemental.models.procedures import QCInputSpecification
from rdkit import Chem

dimer = Molecule.from_file("path/to/molfile.mol")
model = Model(method="openff_unconstrained-2.0.0.offxml", basis="smirnoff")
qc_mol = dimer.to_qcschema()

opt_task = OptimizationInput(initial_molecule=qc_mol, 
                                                 input_specification=QCInputSpecification(model=model), 
                                                 keywords={"program":"openmmdimerharness", 
                                                                    "coordsys": "tric", 
                                                                    "maxiter": 500, 
                                                                     "rigid": True,                 #    Here are the two keywords
                                                                     "conmethod": 1})         #
result = qcengine.compute_procedure(input_data=opt_task, procedure="geometric")  

If the keywords simply get passed through, geometric should work with the rigid optimization as expected, however this is not the case and I suspect something would be needed in qcengine to enable this opt.

Looking forward for some help / hint

ldamore commented 9 months ago

Closed since it works correctly with expected behavior. I was just connected to a notebook running the wrong geometric version :)