From bayly at eyesopen.com Tue May 1 13:15:53 2012 From: bayly at eyesopen.com (Christopher Bayly) Date: Thu May 24 22:03:11 2012 Subject: [Openmm-team] carrying forward a state Message-ID: <2D9DC30C-75C2-4C45-8C3B-403EAE935D0A@esyesopen.com> 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