From 626e3818a325f07add061fed5287ced77697a58a Mon Sep 17 00:00:00 2001 From: Berk Hess Date: Tue, 30 Oct 2018 09:46:53 +0100 Subject: [PATCH] Work around expanded ensemble issues Two bugs could cause expanded ensemble sampling to use outdated or zero energies. In these cases mdrun now modifies nstcalcenergy to 1 to avoid these bugs. Note: This change should not be merged upstream, since there is a proper fix for release-2019. Refs #2714 Refs #2718 Change-Id: I79be9c5da55eaebb857bac6a98e6671720532e0e --- docs/release-notes/2018/2018.4.rst | 11 +++++++++++ src/programs/mdrun/md.cpp | 14 ++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/docs/release-notes/2018/2018.4.rst b/docs/release-notes/2018/2018.4.rst index e754d0b84a..14fbcad41d 100644 --- a/docs/release-notes/2018/2018.4.rst +++ b/docs/release-notes/2018/2018.4.rst @@ -37,6 +37,17 @@ contribution was missing from the foreign Hamiltonian values. :issue: `2703` +Work around bugs with expanded ensemble runs +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +With expanded ensemble runs, the energies would be outdated or zero +with the velocity Verlet integrator with nstcalcenergy>1 or with +other integrators when nstexpanded was not a multiple of nstcalcenergy. +In these cases mdrun now sets nstcalcenergy to 1. + +:issue: `2714` +:issue: `2718` + Fixes for ``gmx`` tools ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/programs/mdrun/md.cpp b/src/programs/mdrun/md.cpp index 1695e0b72d..de5a7031ff 100644 --- a/src/programs/mdrun/md.cpp +++ b/src/programs/mdrun/md.cpp @@ -125,6 +125,7 @@ #include "gromacs/utility/logger.h" #include "gromacs/utility/real.h" #include "gromacs/utility/smalloc.h" +#include "gromacs/utility/stringutil.h" #include "deform.h" #include "membed.h" @@ -315,6 +316,19 @@ double gmx::do_md(FILE *fplog, t_commrec *cr, const gmx::MDLogger &mdlog, gmx_membed_t *membed, gmx_walltime_accounting_t walltime_accounting) { + /* Workaround for 2 bugs in release-2018. + * NOTE: Proper fix is in release-2019, do not merge this change there. + */ + if (ir->bExpanded && (EI_VV(ir->eI) || + ir->expandedvals->nstexpanded % ir->nstcalcenergy != 0)) + { + ir->nstcalcenergy = 1; + std::string note = + gmx::formatString("NOTE: There are issues with expanded ensemble and certain combination of nstexpanded and nstcalcenergy, setting nstcalcenergy to %d", + ir->nstcalcenergy); + GMX_LOG(mdlog.warning).asParagraph().appendText(note); + } + gmx_mdoutf_t outf = nullptr; gmx_int64_t step, step_rel; double elapsed_time; -- 2.11.4.GIT