[Openmm-team] carrying forward a state

Christopher Bayly bayly at eyesopen.com
Tue May 1 13:15:53 PDT 2012


I am looking for guidance and preferably a sample python snippet for how to carry forward the correct components of a state between MD stages. Here is my situation:

Stage 1 performs MD on a periodic system with a barostat and extra restraining forces. At the end I wish to carry forward what is needed to continue the MD in the second stage. Obviously positions and velocities are needed.

Stage 2 continues the MD but now at constant volume and without any extra restraining forces. The constant volume should be the final volume out of the constant-pressure Stage 1.

Question 1: Should I 
a) make a new simulation/system/context for Stage 2 based on only the relevant components from Stage 1's final state, or
b) keep the same simulation/system/context but rejig the simulation and forces to reflect the different conditions of Stage 2

Question 2: If I were to use only the relevant components from Stage 1's state, would positions and velocities be all I needed or are there other things also? Would I need to get and set the Box dimensions?
What I have in mind looks something like:
-------------------
...
NPTstate= NPTsimulation.context.getState( getPositions=True, getVelocities=True )
...
NVTsimulation.context.setPositions( NPTstate.getPositions() )
NVTsimulation.context.setVelocities( NPTstate.getVelocities() )
...
--------------------


Questions 3: If I am finished with Stage 1's simulation/system/context because I set up a new one for Stage 2, should I delete them to free up memory? How should I deal with this?

Christopher


More information about the Openmm-team mailing list