Skip to content
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

[HybridTopologyFactory] Copying virtual sites from old/new systems to hybrid system leads to exception #1193

Open
IAlibay opened this issue May 5, 2023 · 2 comments

Comments

@IAlibay
Copy link

IAlibay commented May 5, 2023

Expected behaviour

Passing a system with virtual sites in the non-core, non-unique portions of the old & new systems, should lead to those virtual sites existing in the hybrid system. For example a system that has been parameterised with amber/tip4pew_standard.xml (with ThreeParticleAverageSite virtual sites) should work.

Actual behaviour

The code in HybridTopologyFactory._handle_virtual_sites throws the following exception when handling a system solvated with tip4pew:

Exception: the System object does not own its corresponding OpenMM object

Further context

Original OpenFE issue: OpenFreeEnergy/openfe#394
We're fixing this in OpenFE's version of HybridTopologyFactory here: OpenFreeEnergy/openfe#395
I'm happy to push it back into perses' HTF once that's done.

My understanding is that there are two issues here:

  1. We can't copy a VirtualSite class that's already registered to an existing System to another one.
  2. The current code in HybridTopologyFactory does not appear to correctly handle creating VirtualSites with the right particle indices in the hybrid system.

I think the answer here is that we'll have to create methods for each VirtualSite subclass that we want to handle that correctly copies the virtual site with the right hybrid system indices for the reference particles. For now I've got it working for ThreeParticleAverageSite, but I don't have a test case with other types of virtual sites (I think OpenFF wants at least ThreeParticleAverageSite and LocalCoordinateSites).

@ijpulidos ijpulidos added this to the 0.10.3 - Bugfix release milestone May 8, 2023
@ijpulidos
Copy link
Contributor

@IAlibay Thanks! We would love to have this, please feel free to make a PR once you have the fix.

@IAlibay
Copy link
Author

IAlibay commented May 8, 2023

@ijpulidos - our approach I think is going to be to deal with ThreeParticleAverageSite for now and disallow other virtual sites (since it's the only case we encounter in the wild today). Then we'll add in extra bits for OpenFF as they need it, would that work for y'all here too?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants