Restarted simulations with expanded ensemble (and trotter decomposition)
When restarting from checkpoint, expanded ensemble will silently be ignored. In 88c7ed2de9e66d3ad80598e0534a165205371fe7, `startingFromCheckpoint` was replaced by `startingBehavior != StartingBehavior::NewSimulation`. The difference between the two variants is that `startingFromCheckpoint` was set to false at the end of the first step, while `startingBehavior` stays unchanged throughout the simulation. As a consequence, a line like `(step > 0) && (!startingFromCheckpoint)` used to be true for every step after step zero, except for the first step of a restart. `(step > 0) && (startingBehavior == StartingBehavior::NewSimulation)`, on the other hand, will never be true in simulations restarted from checkpoint. Expanded ensemble is now guarded by a boolean set as ``` bDoExpanded = (do_per_step(step, ir->expandedvals->nstexpanded) && (ir->bExpanded) && (step > 0) && (startingBehavior == StartingBehavior::NewSimulation)); ``` which will never be true in restarted simulations. This bug affects the master and release-2020 branches. Due to the same change, we are also resetting the force and shake virials to a backup-ed state every step. This does, however, not have any major implications, as the backup is also done every step, and the virials are not used between their backup and reset. Note that the same problem caused a bugfix in 6529c2da4073fd5930928d17f7dad323de4c2cfd, but failed to detect the full magnitude of the problem.
issue