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)
committerMark Abraham <mark.j.abraham@gmail.com>
Thu, 11 Feb 2021 12:47:34 +0000 (12:47 +0000)
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

src/gromacs/gmxpreprocess/readir.cpp
src/gromacs/mdrun/runner.cpp

index 603fae0cdb70794af898c92431a6f6d437502fa8..6595bff142eefec8798a74cefad4c2d81c450c9b 100644 (file)
@@ -1477,6 +1477,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 cb76c778a31747e22a9dc1ff1e043fdb3ebeea48..9d509473f9c7e4ef71bca79b94bedbdc6252f952 100644 (file)
@@ -1858,6 +1858,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, &(inputrec->opts), &ekind, inputrec->cos_accel);