Periodic boundary condition for CustomNonbondedForce in CustomCVForce

The functionality of OpenMM will (eventually) include everything that one would need to run modern molecular simulation.
POST REPLY
User avatar
Xinqiang Ding
Posts: 33
Joined: Tue May 05, 2015 2:27 pm

Periodic boundary condition for CustomNonbondedForce in CustomCVForce

Post by Xinqiang Ding » Thu Jul 20, 2017 12:31 pm

I'm trying to use the CustomCVForce, which uses two CustomNonbonedForce as collective variables. Each CustomNonbonedForce uses CutoffPeriodic. The cutoff distance is 1.4 nanometer and the box size of the system is 2.89 nanometer.When I try to create the context, it raises the Exception:
CustomNonbondedForce: The cutoff distance cannot be greater than half the periodic box size.
When I add these two CustomNonbonedForces to the system directly, there is no exception.
Any idea about why it happens?

Here are my thoughts:
In order to add a CustomCVForce, OpenMM will create a new subsystem and a new subcontext. I'm wondering if the new subsystem or new context will use the box size of the original system to which the CustomCVForce is added.

Thanks,
Xinqiang

User avatar
Peter Eastman
Posts: 2577
Joined: Thu Aug 09, 2007 1:25 pm

Re: Periodic boundary condition for CustomNonbondedForce in CustomCVForce

Post by Peter Eastman » Fri Jul 21, 2017 10:02 am

You're exactly right. When it created the internal System for evaluating CVs, it didn't copy over the default periodic box vectors. It did copy over the current box vectors every time it evaluated CVs, so it still produced correct results (as long as you didn't hit that exception). But in your case, it was getting stopped by the initial check on the default vectors when the inner context was first created.

I just posted a pull request with the fix: https://github.com/pandegroup/openmm/pull/1861. Could you test it and make sure it fixes the problem for you?

Peter

User avatar
Xinqiang Ding
Posts: 33
Joined: Tue May 05, 2015 2:27 pm

Re: Periodic boundary condition for CustomNonbondedForce in CustomCVForce

Post by Xinqiang Ding » Fri Jul 21, 2017 12:15 pm

Thanks for the quick fix. I have tested it and it does fix the problem.

Xinqiang

User avatar
Peter Eastman
Posts: 2577
Joined: Thu Aug 09, 2007 1:25 pm

Re: Periodic boundary condition for CustomNonbondedForce in CustomCVForce

Post by Peter Eastman » Fri Jul 21, 2017 1:00 pm

Thanks! I just merged the fix.

POST REPLY