Description
The mapping between potential handlers to OpenMM forces in Interchange.to_openmm
is ... complex and nebulous. It's unavoidably complex with the current SMIRNOFF spec and requirements from downstream users (see: non-LJ functional forms, tinkering with partial charges, free energy frameworks implicit solvent models, ...) but the provenance could at least be made clear.
For example, the SMIRNOFF spec allows separate cutoffs for Lennard-Jones and electrostatic interactions but implementing this in OpenMM requires four separate forces, one NonbondedForce
, one CustomNonbondedForce
, and two CustomBondForce
s. Using a non-LJ pair potential is also another poorly-supported case in the sense that exporters generally look for a handler named vdW
and crash if one is not found. The list goes on and on and eventually includes things like one-to-many and many-to-one mappings.
Maybe OpenMM's force groups would be a way to implement this? This could be handled by at some point returning a mapping between PotentialHandler
objects/indices/something to force group IDs (or however it's implemented in OpenMM). Either way it should be documented.
This is relevant to free energy work but should also be of general interest.
cc: @SimonBoothroyd whose input this is based off of.