enforcePeriodicBox with RPMD Integrator

The functionality of OpenMM will (eventually) include everything that one would need to run modern molecular simulation.
POST REPLY
User avatar
Nabil Faruk
Posts: 5
Joined: Mon Jul 09, 2012 11:33 am

enforcePeriodicBox with RPMD Integrator

Post by Nabil Faruk » Wed Mar 20, 2013 3:39 pm

Currently (I'm still on OpenMM 4.1.1 but I'm assuming this is still an issue for OpenMM 5), when you call getState() on a context set up by the RPMD Integrator and have the parameter enforcePeriodicBox=1, particle positions are translated into the box by molecule centers, but the copies are not considered (you have to get state info one copy at a time). In the output trajectory, this can result in a copy on one side of the box, but another whose center crossed the boundary will be shifted over to the other side. This can cause issues if you run the integrator multiple times in a row and set up particle positions from the last config of the previous run (i.e. restarting after a computer crash or if you're like me and using an external program between runs to do things). The problem is that you will have high spring energy between the separated copies.

I fixed this problem by making my own function to enforce the periodic box after calling the state on all of the copies. I used the code found in [OpenMM base directory]/openmmapi/src/Context.cpp between

Code: Select all

if (enforcePeriodicBox) {
...
}
as a starting point, but instead of center of molecule I was using centroid of the copies and translated all of the copies of a molecule together. It may be useful to have a native solution for this though, because other people might run into this problem. It complicated by each copy being contained in a different context, so I don't think the getState() in Context.cpp can be modified.

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

Re: enforcePeriodicBox with RPMD Integrator

Post by Peter Eastman » Thu Mar 21, 2013 10:33 am

Thanks, that's a really good suggestion. I've just added it to the tracker: https://simtk.org/tracker/index.php?fun ... 1&atid=436.

Peter

POST REPLY