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

Restarting simulation from .xml file yields wrong timestamp on Plumed output #52

Open
mdpoleto opened this issue Jul 14, 2021 · 4 comments

Comments

@mdpoleto
Copy link

mdpoleto commented Jul 14, 2021

Hi,

I ran a metadynamics simulation on strides of 100ns each using OpenMM v7.5.1 + Plumed v2.7. Although I can successfully restart my simulation and Plumed continues outputting data as it should, the timestamp used seems to be incorrect.

I am restarting my simulation using the .xml state file outputted at 800ns. I am explicitly defining the correct "simulation.currentStep" and current time ("simulation.context.setTime()") before actually triggering the "simulation.step(nsteps)" command but Plumed still outputs a timestamp starting from 0.

Below there is a set of input files that should yield the error. This error only appears when I restart my simulation from the .xml state file. Loading from the checkpoint works just fine.

restart_timestamp.zip

Any ideas on this is highly appreciated.
Thanks!

@raimis
Copy link

raimis commented Jul 30, 2021

OpenMM states files doesn't store the number of steps, just a simulation time. I guess, the rational is that OpenMM have variable-timestep integrators. So, when you restart a simulation from a XML file the new context starts counting steps from zero. Meanwhile, the checkpoint preserves entire context data. Probably @peastman can comment more on this.

On the other side, PLUMED assumes a fixed time step (

plumed_cmd(plumedmain, "setTimestep", &dt);
) and require to pass the number of steps (
plumed_cmd(plumedmain, "setStep", &step);
).

This might be solved with the next release (openmm/openmm#2655, openmm/openmm#3191), but apart the wrong step count, PLUMED should work correctly after these restarts.

@peastman
Copy link
Member

I don't have any good solution for the current version. Having States record the step count should provide a straightforward solution. That's tentatively planned for inclusion in the next release.

@mdpoleto
Copy link
Author

mdpoleto commented Aug 5, 2021

Thank you both for the clarification. I am not sure if this is a Plumed or a OpenMM-Plumed plugin kind of modification but I wonder if Plumed could re-read the current step number (or the simulation time) as defined by OpenMM the same way it reads the current atomic position. That way users can define the correct "simulation.currentStep" and current time ("simulation.context.setTime()") in the OpenMM script when restarting a simulation.

@raimis
Copy link

raimis commented Sep 16, 2021

After openmm/openmm#3248 is merged and released, we can solve this issues.

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

3 participants