-
Notifications
You must be signed in to change notification settings - Fork 6
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
Port plugins from Interchange #53
Conversation
2258c5d
to
12ce05a
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
hey @mattwthompson, thanks for writing this up made it a lot easier to track down, the clue is that the first energy you report is very close to the expected energy at |
Thanks for fixing the tests! The energy differences reporting in CI are now small, though not quite to the desired tolerance.
Maybe - the issue that concerns me is how vdW and custom vdW handlers define if Interchange is provided a force field that says its vdW(-like) interactions should be cutoff, I don't want to give the user back a force with no cutoff. In spec, there's nothing that covers this case, but out of spec I imagine we can fudge it by allowing a
I'd like this to work but it's already set fairly large (20 nm) and continuing to bump it up might cause tests to run much slower (at least on my machine it does). Messing around with the platform and maybe loosening the tolerance could help here, but it could be fragile and might not be worth the trouble of deviating from the hand-calculated reference energies. When I bump it to 40 nm and switch to the Reference platform, the double exponential energy test passes locally but the damped Buckingham fails (if barely):
of course this is probably going to run differently on CI runners, different developers' machines, etc. Do you have a preference between these options? |
What about a second method like I think for this test we can manually change the system to have no cutoff to match the values I calculated by hand with no cutoffs. Seems like the last issue is the Buckingham water test simulation which has v-sites should we expect that to work yet? |
Do you imagine this as an alternative to
Sounds good to me.
I think so - the virtual sites are only on the water and only include charges, right? That should work since that's the same thing that the double exponential model supports, I probably just forgot to copy something over. I'll have a look. |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main openforcefield/openff-interchange#53 +/- ##
==========================================
- Coverage 79.06% 75.21% -3.86%
==========================================
Files 5 4 -1
Lines 301 238 -63
==========================================
- Hits 238 179 -59
+ Misses 63 59 -4
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
Some egg on my face; even though However, now that tests are passing, I think this is finally ready for a review! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If possible I would like to remove some of the duplicated code in the collections to simplify making new plugins, otherwise, this looks great!
""" | ||
return ["vdw", "VirtualSites"] | ||
|
||
def create_virtual_sites( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this method intended to do? Why would the creation of a v-site be different?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, this one turned out a little weirder than I expected. The short explanation is that nothing in this repo needs to handle processing virtual sites as a special case, so I've just removed that method altogether.
Earlier I put this in because I wanted to get the non-bonded functionals working before making sure the virtual sites logic was also working, so throwing an exception was just a stop-gap. The way Interchange stores virtual site information is a little complex, it does it in three steps: It turns out Interchange doesn't even use these methods anymore! No wonder this wasn't causing any problems. Previously I was thinking of a design in which each non-bonded handler made its own virtual sites, but now I have it set up so that a single class manages the virtual sites' geometry, charges, and vdW parameters. That complexity is tucked away here, and I'm pretty sure it works just the same as if the 4-site water model used 12-6 Lennard Jones; it just creates a non-interacting potential:
In [1]: from openff.toolkit import ForceField, Molecule
In [2]: from rich.pretty import pprint
In [3]: interchange = ForceField(
...: "buckingham-force-field.offxml",
...: load_plugins=True,
...: ).create_interchange(
...: Molecule.from_smiles("O").to_topology(),
...: )
In [4]: pprint([*interchange["DampedBuckingham68"].potentials.values()])
[
│ Potential(
│ │ parameters={
│ │ │ 'a': <Quantity(1600000.0, 'kilojoule_per_mole')>,
│ │ │ 'b': <Quantity(42.0, '1 / nanometer')>,
│ │ │ 'c6': <Quantity(0.003, 'kilojoule_per_mole * nanometer ** 6')>,
│ │ │ 'c8': <Quantity(3e-05, 'kilojoule_per_mole * nanometer ** 8')>
│ │ },
│ │ map_key=None
│ ),
│ Potential(
│ │ parameters={
│ │ │ 'a': <Quantity(0.0, 'kilojoule_per_mole')>,
│ │ │ 'b': <Quantity(0.0, '1 / nanometer')>,
│ │ │ 'c6': <Quantity(0.0, 'kilojoule_per_mole * nanometer ** 6')>,
│ │ │ 'c8': <Quantity(0.0, 'kilojoule_per_mole * nanometer ** 8')>
│ │ },
│ │ map_key=None
│ ),
│ Potential(
│ │ parameters={'sigma': <Quantity(0.0, 'angstrom')>, 'epsilon': <Quantity(0.0, 'kilocalorie_per_mole')>},
│ │ map_key=None
│ )
]
These three objects are the Buckingham interactions for oxygen, hydrogen, and the virtual site, respectively.
If you ever want to have custom dispersion interactions on the virtual sites this'll get tricker. I'm honestly not sure if getting this to look correct would be a small fix or large undertaking, and if you don't need it now then I'd prefer leaving this as-is. These changes would probably go into Interchange, not here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, great job!
Thanks! |
Description
A different version of openforcefield/openff-interchange#45, copying over some existing code.
Todos
Notable points that this PR has either accomplished or will accomplish.
Questions
Status