-
Notifications
You must be signed in to change notification settings - Fork 24
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
Created OpenMM Topology and System virtual site atom indices don't match #1049
Comments
The "ideal scenario" askIf we could change behaviour to not have virtual sites being added at the end of the system, but rather at the end of each residue (edit: read here as continuous molecule - I know that would be a pain for polymers otherwise), that would save a lot of headaches downstream. Particularly, this behaviour doesn't match OpenMM's default behaviour (i.e. what happens with Modeller) when it comes to virtual sites. What this means is that I can be presented with a pair of OpenMM System and Topology and not know if I should expect the indices to match or if I need to shift all the indices because the virtual sites got shuffled around. So I have to build shims everywhere to handle OpenFF specific behaviour. The alternative asks
|
Virtual sites being added to the end of the system is intentional1, them not matching up with the topology is not. The ordering in the topology derives from toolkit behavior, although it's never properly supported virtual sites. I'm going to look into updating the topology output to match the system's ordering, alternatively with some options to pick between them. The internals already have some toggles here (by comparison, GROMACS prefers virtual sites at the end of each molecule - not residue) but this must not be exposed at the OpenMM export. I can't commit to changing the default behavior, but these indices lining up seems like a completely reasonable user expectation. These details need to be better documented as well. I notice that this particular behavior (matching up, but all virtual sites at end) isn't your ideal scenario nor is it an alternative ask - is this something that's workable, or would you still need to build a shim? Footnotes
|
If the OpenMM Topology matches the OpenMM System, then that works for us. That possibility didn't cross my mind since I just couldn't work out "how" (since OpenMM Topologies need contiguous indices for each residue). |
Sadly, I'm running into this now. The stopgap solution probably will have a weak spot with residue accounting, though I'm hoping the rest of the particle indexing will make sense or at least be self-consistent. |
I'll have to think about it a bit more, but I suspect that for us fixing indexing at the risk of residues being split kinda breaks things in different ways 😅 |
I get that - I'm not sure there'll be a perfect solution here. The major constraints I'm working with are
I have a swing at this in draft at #1051, from where I'll continue to add in some tests and iterate. Documentation probably won't be added until something crystalizes out. Footnotes |
Okay, so ...
The snippet in the beginning of this issue now runs this without error (the 20th atom is not a virtual site): for index, atom in enumerate(omm_top.atoms()):
if atom.name == "EP":
assert omm_sys.isVirtualSite(index) |
Expectation
The atom indices of an OpenMM Topology match those of its associated System, this includes virtual sites.
Current status
Creating an OpenMM Topology with virtual sites puts the virtual site at the end of each residue whilst the System has them completely at the end of the entire System. This means that if you have more than one residue, the atom indices don't match.
Reproduction
Output
Software versions
Interchange v0.3.27
The text was updated successfully, but these errors were encountered: