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

Augment checkpoint storage to save velocities #531

Closed
zhang-ivy opened this issue Dec 6, 2021 · 3 comments · Fixed by #555 or #602
Closed

Augment checkpoint storage to save velocities #531

zhang-ivy opened this issue Dec 6, 2021 · 3 comments · Fixed by #555 or #602

Comments

@zhang-ivy
Copy link
Contributor

I am seeing dips in potential energy when I resume a repex simulation:
image (5)

I next decided to investigate the first dip in potential energy (at iteration 791). Here are histograms of replica energies for each iteration, colored by iteration number:
image (6)

We figured out that these dips are caused by resuming simulations from a checkpoint file. Since we are not saving velocities in the checkpoint, the velocities start at 0 when resuming a simulation.

The short term solution for this is to set reassign_velocities=True in the LangevinSplittingDynamicsMove() when I instantiate it.
The long term solution is to save velocities in the checkpoint.

@zhang-ivy
Copy link
Contributor Author

@ijpulidos : I just checked to see if this issue was resolved, but I am still seeing the same issue, even when using openmmtools >= 0.21.3 (the PR for saving velocities in the checkpoint file was introduced in 0.21.3).

I ran repex on ala->thr dipeptide in solvent with reassign_velocities=False:

move = mcmc.LangevinSplittingDynamicsMove(timestep= 4.0 * unit.femtoseconds,
                                          collision_rate=1.0 / unit.picosecond,
                                          n_steps=250,
                                          reassign_velocities=False,
                                          n_restart_attempts=20,
                                          splitting="V R R R O R R R V",
                                          constraint_tolerance=1e-06)

Here is the potential energy vs time plot:
image

You can see dips in the energy when I resumed it (2 different times: once at 1000 iterations, and once shortly thereafter).

The problem goes away when I set reassign_velocities=True, which was the short term fix I mentioned in the original post of this issue.

Attached are files to reproduce this behavior:

reproduce_velocity_problem.zip

@zhang-ivy zhang-ivy reopened this Jul 1, 2022
@mikemhenry
Copy link
Contributor

I guess the next step is to confirm that we really are using the velocities that we save. Another thing that could be weird is, depending on the integrator, it might either need the forces saved or some sort of flag to calculate the forces before doing a step.

@jchodera
Copy link
Member

jchodera commented Jul 3, 2022

@mikemhenry : We're missing test coverage of velocity restoration, so I'd start there.

For example:

and so on

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants