openmmforcefields
openmmforcefields copied to clipboard
Parametrization tests failing
I'm seeing this error:
FAILED openmmforcefields/tests/test_template_generators.py::TestSMIRNOFFTemplateGenerator::test_partial_charges_are_none - RuntimeError: C=O could not be fully assigned charges. Charges were assigned to atoms set() but the molecule contains {0, 1, 2, 3}.
FAILED openmmforcefields/tests/test_template_generators.py::TestSMIRNOFFTemplateGenerator::test_parameterize - RuntimeError: C=O could not be fully assigned charges. Charges were assigned to atoms set() but the molecule contains {0, 1, 2, 3}.
Which I've seen many times before but keep forgetting the source of
Originally posted by @mattwthompson in https://github.com/openmm/openmmforcefields/issues/313#issuecomment-1832557204
The last time this happened it appeared to be because the OpenEye license was out of date, although that doesn't seem likely since this line passes? https://github.com/openmm/openmmforcefields/blob/637d551a4408cc6145529cd9dc30e267f4178367/.github/workflows/ci.yaml#L50
Related https://github.com/openmm/openmmforcefields/issues/278 #279 https://github.com/openmm/openmmforcefields/pull/277
Hmmm yes this smells like something is failing deeper in the codebase but the issue isn't being bubbled up and instead we end up with a None
or something
The error message isn't particularly helpful since it captures atoms missing charges in the context of trying a bunch of different things, whereas only one attempt (AM1-BCC) is really relevant here. So (guessing) the other charge methods (library charges, charge increments, charge_from_molecules
) do nothing and when AM1-BCC fails, it is treated like any other failure and just ticks on to the next method. But AM1-BCC is the last one, so there's nothing to fall back to.
Here's where it's thrown: https://github.com/openforcefield/openff-interchange/blob/v0.3.18/openff/interchange/smirnoff/_nonbonded.py#L762C9-L769
I think the traceback could be more helpful to downstream developers (like me!) including information such as what was tried and what failed, or maybe if AM1-BCC fails there should be a more specific exception there instead of later, since AM1-BCC failing will cause the failure later. If I'm right, I'll patch Interchange to be more helpful here, but that wouldn't completely resolve the issue of these simple molecules not getting charges.