openforcefield / openff-interchange

A project (and object) for storing, manipulating, and converting molecular mechanics data.
https://docs.openforcefield.org/projects/interchange
MIT License
71 stars 23 forks source link

Support custom mixing rules #571

Open mattwthompson opened 1 year ago

mattwthompson commented 1 year ago

Description It would be useful, at least for fitting experiments, to use non-Lorentz-Berthelot mixing rules. This is already partially implemented by nature of Foyer's OPLS-AA using geometric mixing rules, but it would be useful to support more cases, including as general as arbitrary expressions. These are generally straightforward to implement in OpenMM. As far as I know, GROMACS supports these two but nothing more exotic. I'm not sure what Amber supports.

This should be implemented by allowing other values to SMIRNOFFvdWHandler.mixing_rule or the same attribute on similar classes. I'm not sure if these should be allowed to be a mix of expressions and names, possible both using aliases.

@chapincavender and others at OpenFF have interest in experimenting with the mixing/combining rule for experimental non-bonded fits. It's not identified at an immediate priority.

mattwthompson commented 1 year ago

Here is where it would ultimately land in the OpenMM exporter: https://github.com/openforcefield/openff-interchange/blob/348e1518363c9c8f9ec95cf737a939c196249d5f/openff/interchange/interop/openmm/_nonbonded.py#L576

after being set earlier while processing things:

https://github.com/openforcefield/openff-interchange/blob/348e1518363c9c8f9ec95cf737a939c196249d5f/openff/interchange/interop/openmm/_nonbonded.py#L95

mattwthompson commented 1 year ago

579 begins implementing geometric mixing rules with OpenMM. It'll take more rearranging than I originally though to support arbitrary user-defined expressions; implementing a set of pre-defined rules would not be difficult, even if this list is potentially long.