Disable cos acceleration for non leap-frog code paths
authorPascal Merz <pascal.merz@me.com>
Thu, 11 Feb 2021 06:23:24 +0000 (23:23 -0700)
committerPascal Merz <pascal.merz@me.com>
Thu, 25 Feb 2021 06:13:06 +0000 (23:13 -0700)
The cos acceleration is only applied in leap-frog. grompp and mdrun
would, however, happily accept non-zero cos-accel input, and report
viscosity-related quantities without ever applying the acceleration
for all other integrators.

This change adds a check at grompp time (to avoid new tprs with
non-implemented parameter combinations being created), and at
runner time (to catch older tprs). Should probably be backported
to the supported releases.

Refs #3903

docs/release-notes/2020/2020.6.rst
src/gromacs/gmxpreprocess/readir.cpp
src/gromacs/mdrun/runner.cpp

index be79e901f1cd58563dd171f4fb300c2d54323e5e..b067a7d0b62912212869b0d132a542b737deebba 100644 (file)
@@ -14,6 +14,20 @@ previous 2020.5 version, to fix known issues.
 Fixes where mdrun could behave incorrectly
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
+Cosine acceleration failed to abort if it could not be run
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+
+Cosine acceleration is only compatible with the leap-frog
+integrator (mdp option `integrator = md`). Gromacs did, however,
+accept input files requesting cosine acceleration for other
+integration algorithms, and did report viscosity-related
+quantities from these simulations. Since the cosine acceleration
+was never applied in these cases, any results obtained from
+simulations with enabled cosine acceleration and integrators
+other than `md` should be regarded as invalid.
+
+:issue:`3903`
+
 Fixes for ``gmx`` tools
 ^^^^^^^^^^^^^^^^^^^^^^^
 
index 9e0eaf33b36dda7cc2d1d701a0af3edb90f3e0f7..553df84e150fc31a78b8cb6aabfbd800cec00f75 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013-2020, by the GROMACS development team, led by
+ * Copyright (c) 2013-2020,2021, 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.
@@ -1403,6 +1403,12 @@ void check_ir(const char*                   mdparin,
     {
         gmx_fatal(FARGS, "AdResS simulations are no longer supported");
     }
+
+    // cosine acceleration is only supported in leap-frog
+    if (ir->cos_accel != 0.0 && ir->eI != eiMD)
+    {
+        warning_error(wi, "cos-acceleration is only supported by integrator = md");
+    }
 }
 
 /* interpret a number of doubles from a string and put them in an array,
index 3c9def3eaa786fd032bbfecbde701cb33171121e..c2b3c088d76e3f16b6f33cb678baa84f70e80f38 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2011-2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2011-2019,2020,2021, 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.
@@ -1521,6 +1521,11 @@ int Mdrunner::mdrunner()
         gmx_enerdata_t enerd(mtop.groups.groups[SimulationAtomGroupType::EnergyOutput].size(),
                              inputrec->fepvals->n_lambda);
 
+        // cos acceleration is only supported by md, but older tpr
+        // files might still combine it with other integrators
+        GMX_RELEASE_ASSERT(inputrec->cos_accel == 0.0 || inputrec->eI == eiMD,
+                           "cos_acceleration is only supported by integrator=md");
+
         /* Kinetic energy data */
         gmx_ekindata_t ekind;
         init_ekindata(fplog, &mtop, &(inputrec->opts), &ekind, inputrec->cos_accel);