-
Notifications
You must be signed in to change notification settings - Fork 86
Add support for espaloma small molecule parameters #182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The current test failure is because I don't have a way to tell espaloma to use user-provided charges yet: @yuanqing-wang: Is there a way to optionally tell espaloma to use charges from the |
|
This is waiting on a new release following the merger of choderalab/espaloma#95, where we will be able to add support for retaining the charges provided in Hopefully, we can also get espaloma onto conda-forge. |
|
The espaloma charge API in I'll update this PR to test! |
…om nn or molecule
|
@yuanqing-wang: It looks like espaloma is failing (perhaps due to the charge model?) here. Can you take a look at the exception and stack trace? |
It looks like it's because your testing molecule doesn't have an |
|
@jchodera could you rerun the tests? it should work now |
|
Tests have been re-run! It seems I'm running into a large discrepancy between the espaloma -> ffxml -> System energy and the System energy: I'll have to run this locally and manually inspect the differences between the serialized XML files written during the failure. |
|
I've figured out why the energy test is failing: The improper ffxml entries we create are not being applied to the molecular system because the impropers defined by espaloma do not match the expected
The espaloma 6-fold scheme compared with the SMIRNOFF 3-fold scheme is illustrated here: To remedy this, we will either have to produce a new generation of espaloma models that use the SMIRNOFF 3-fold consistent impropers or add a new improper matching mode to |
|
Yuanqing tagged us on this. We discussed this in a call with John and the details from that must not have gotten propagated back here. I'm dealing with something on deadline, but to summarize very briefly: If you include all six permutations of the relevant atoms, impropers can only be used to force atomic centers to be planar (essentially, one set of three gives force vectors which follow the right hand rule, basically, whereas the other set follows the left-hand rule, so the only configuration of atoms where you don't have a restoring force towards "flat" is when all of the atoms are co-planar). In OpenFF we also allow impropers which are NOT attempting to ensure the atoms involved are co-planar (e.g. such as for trivalent nitrogens), so it's important to ensure you only use the three with the same handedness. |
|
In terms of periodicity: I don't know why you would want these to have periodicities up to 6. If the minima is away from zero, the best way to deal with this would be to move the minima of the potential away from zero (e.g. applying symmetric potentials but with minima shifted away from zero). But chemically, these should not have high periodicities since there is always only one or two minima (either at "flat" or at "somewhat puckered"). |
Sorry I didn't quite follow this argument. If one set of parameters force atomic centers to be planar, then if you take the negative of all those parameters, they would force atomic centers to not be planar? |
if we have infinitive periodicities, we should be able to approximate any arbitrary functions of the dihedral angles. we just picked a number that's close enough to infinity. it would be nice if we could also optimize periodicities but that is a discrete variable and is very difficult to optimize |
No. The issue arises if you TRY and force atomic centers to not be planar (as we are doing in some of our fitting experiments, as some centers SHOULD be nonplanar). The direction of the force in such a situation can be computed from the cross product of relevant vectors (per OpenMM docs) but, if the atoms are puckered up (for example) then the cross products of three of the permutations will point up, and the other three will point down. Essentially, they fight with one another. The magnitudes differ in the different directions (up vs down), and the end result is that the force becomes zero (and the center stabilizes) ONLY if it is planar. To put it another way, it's impossible to impropers that have minima away from zero if you're applying all six permutations; it's only possible to have minima away from zero if you use only terms with the same "handedness".
Of course you could, yes. However, that can introduce a lot of terms. More conventionally force fields have used a SINGLE periodicity for these, though. Impropers are certainly non-periodic so it's unclear to me why you would want to use an expansion with many different periodicities. The two most important scenarios you have to deal with are:
A smal fraction of the time you may see a third scenario where the potential is roughly flat between +/-30 degrees. |
Sorry I still don't quite understand what's wrong with this little thought experiment of mine: Imagine I used all six permutations. This argument says that it's impossible to have minima away from zero. So the minima has to be at zero. Now I flip the sign of all of my parameters---zero is now a maxima. I don't know where my minima is. But it sure isn't at zero. |
|
@davidlmobley : Thanks for the detailed points here! I don't think there is a concern with using multiple periodicities here---they're all symmetric and periodic, and there is no reason to stick to the lowest-order ( Instead, the question is whether six-fold impropers can be used for the same class of interactions that the SMIRNOFF three-fold impropers are used (for enforcing planarity or pyramidality). Because the six-fold impropers almost cancel (and would cancel exactly if bond lengths and angles are symmetric), I'm not even sure they can even be used to enforce planarity. I think they end up adding a kind of local multibody term that espaloma may be exploiting advantageously. @kaminow is adding the standard SMIRNOFF three-fold impropers for us to refit and compare both three-fold and six-fold models, but now you have me wondering if we may not want both: By including three-fold and six-fold impropers (with separate parameters generated for each), we could potentially have the best of both worlds. We should also try ablating impropers entirely to see how much this degrades performance. For now, I'll proceed by adding support for six-fold impropers to OpenMM as well, so that we can deploy all of these combinations to test the real impact on binding free energies. |
|
@yuanqing-wang : Looks like this is finally working! I'll get this merged and then we can do some testing with perses. |

This PR adds support for espaloma small molecule parameters.
Addresses #181
SMIRNOFFResidueTemplateGeneratorto separate out OpenMMSystemconversion into a mixinEspalomaResidueTemplateGeneratorEspalomaResidueTemplateGeneratorSystemGeneratorREADME.mdvalidators(espalomawill be optional)