-
Notifications
You must be signed in to change notification settings - Fork 21
Description
Describe the bug
Theoretically I should be able to re-fit virtual sites with Evaluator, but I can't because I can't retrieve a virtual site parameter by SMIRKS. This is by design as SMIRKS does not uniquely identify a VirtualSite parameter -- multiple are allowed to have the same SMIRKS. Therefore another solution is necessary. Interchange has VirtualSiteKeys.
To Reproduce
Apologies, I have no small MRE right now; I'm running into bugs while trialling a 4-site water model fit with ForceBalance. The problematic code is in system_subset:
openff-evaluator/openff/evaluator/utils/openmm.py
Lines 238 to 242 in 884b850
| parameter = ( | |
| handler | |
| if parameter_key.smirks is None | |
| else handler.parameters[parameter_key.smirks] | |
| ) |
When the parameter key being fit is a virtual site, this triggers the NotImplementedError linked in the openff toolkit.
Additional context
While pushing through getting a 4-site fit off the ground, I quickly patched this code as shown here: aa77c20
This is hacky as ParameterKey.smirks was probably not intended to hold all these attributes, but there were no other fields in ParameterKey to easily slot this on. It's also hardcoded to match corresponding patches I put in ForceBalance here and here.
This hardecoded vsite key was constructed to broadly approximate the Interchange version. The best solution would actually somehow incorporate a more canonical version of Interchange's VirtualSiteKey. However, I'm not certain the best way to, especially if ParameterKey.smirks needs to be a str.