Fix expanded ensemble on checkpoint restarts
authorPascal Merz <pascal.merz@me.com>
Fri, 3 Apr 2020 01:23:16 +0000 (19:23 -0600)
committerPascal Merz <pascal.merz@me.com>
Fri, 3 Apr 2020 01:23:16 +0000 (19:23 -0600)
Fixes #3465.

Also adds a release note, and sets StartingBehavior const in ISimulator
to make its behavior more obvious.

docs/release-notes/2020/2020.2.rst
src/gromacs/mdrun/isimulator.h
src/gromacs/mdrun/md.cpp

index e197cfb6b6c5da867d1a91618c470e60d6d33416..2b2097684c6ec931afc4f5c8e0e8f393f7930728 100644 (file)
@@ -26,6 +26,15 @@ This will be fixed in release-2021.
 
 :issue:`3441`
 
+Expanded ensemble simulations restarted from checkpoints
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+
+When restarting expanded ensemble simulations from checkpoints, expanded
+ensemble would silently refuse to run, and simulations would remain in
+their original lambda state.
+
+:issue:`3465`
+
 Fixes for ``gmx`` tools
 ^^^^^^^^^^^^^^^^^^^^^^^
 
index bd192bd8d5f168eae86ebdc3bb2f7db8b432a2d8..e1ee7ccbcb94dc27c640203d003ff2a70e30bdff 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -190,7 +190,7 @@ protected:
     //! Contains command-line options to mdrun.
     const MdrunOptions& mdrunOptions;
     //! Whether the simulation will start afresh, or restart with/without appending.
-    StartingBehavior startingBehavior;
+    const StartingBehavior startingBehavior;
     //! Handles virtual sites.
     gmx_vsite_t* vsite;
     //! Handles constraints.
index 6f64d3205c45f99c74cbd37e5feac58079b8c289..bdc0f22acc3c8ff13fc3ab00710732dcea8d819e 100644 (file)
@@ -782,7 +782,7 @@ void gmx::LegacySimulator::do_md()
             bDoDHDL     = do_per_step(step, ir->fepvals->nstdhdl);
             bDoFEP      = ((ir->efep != efepNO) && do_per_step(step, nstfep));
             bDoExpanded = (do_per_step(step, ir->expandedvals->nstexpanded) && (ir->bExpanded)
-                           && (step > 0) && (startingBehavior == StartingBehavior::NewSimulation));
+                           && (!bFirstStep));
         }
 
         bDoReplEx = (useReplicaExchange && (step > 0) && !bLastStep
@@ -1177,7 +1177,7 @@ void gmx::LegacySimulator::do_md()
         bInteractiveMDstep = imdSession->run(step, bNS, state->box, state->x.rvec_array(), t);
 
         /* kludge -- virial is lost with restart for MTTK NPT control. Must reload (saved earlier). */
-        if (startingBehavior != StartingBehavior::NewSimulation
+        if (startingBehavior != StartingBehavior::NewSimulation && bFirstStep
             && (inputrecNptTrotter(ir) || inputrecNphTrotter(ir)))
         {
             copy_mat(state->svir_prev, shake_vir);