Decouple nsttcouple and nstpcouple from nstlist
authorBerk Hess <hess@kth.se>
Sun, 13 Sep 2020 09:30:20 +0000 (09:30 +0000)
committerPaul Bauer <paul.bauer.q@gmail.com>
Sun, 13 Sep 2020 09:30:20 +0000 (09:30 +0000)
The default values of nsttcouple and nstpcouple of -1 would cause
nstlist to be used as the coupling interval. But coupling intervals
should not be linked to nstlist. The default is now set to 10, which
will not change settings for mdp files where nstlist was not specified
as the default nstlist value is also 10.

docs/release-notes/2021/major/miscellaneous.rst
docs/user-guide/mdp-options.rst
src/gromacs/mdtypes/inputrec.cpp

index 712b93da878e5d4f861cc93093fa85be05ec46d8..68c87e9f814bf66229b62de1ec390a9289a40bca 100644 (file)
@@ -7,6 +7,12 @@ Miscellaneous
    Also, please use the syntax :issue:`number` to reference issues on GitLab, without the
    a space between the colon and number!
 
+Default values for temperature and pressure coupling intervals are now 10
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+With the default mdp input value of -1 for nsttcouple and nstpcouple, grompp would
+set these values to nstlist. Now these are set to 10 and thus independent of nstlist
+(note that grompp may choose smaller values when needed for accurate integration).
+
 Uniform and manual CMake GPU-support configuration
 """"""""""""""""""""""""""""""""""""""""""""""""""
 The GPU accelerations setup has been changed to be uniform for CUDA and OpenCL. Either
index cd78e3151ec8c5cb493b2662ebf853ac53e23543..2ea402530c4848f1e13d8e4a47b5b54969e476e1 100644 (file)
@@ -976,8 +976,10 @@ Temperature coupling
 
    (-1)
    The frequency for coupling the temperature. The default value of -1
-   sets :mdp:`nsttcouple` equal to :mdp:`nstlist`, unless
-   :mdp:`nstlist` <=0, then a value of 10 is used. For velocity
+   sets :mdp:`nsttcouple` equal to 10, or fewer steps if required
+   for accurate integration. Note that the default value is not 1
+   because additional computation and communication is required for
+   obtaining the kinetic energy. For velocity
    Verlet integrators :mdp:`nsttcouple` is set to 1.
 
 .. mdp:: nh-chain-length
@@ -1110,8 +1112,10 @@ Pressure coupling
 
    (-1)
    The frequency for coupling the pressure. The default value of -1
-   sets :mdp:`nstpcouple` equal to :mdp:`nstlist`, unless
-   :mdp:`nstlist` <=0, then a value of 10 is used. For velocity
+   sets :mdp:`nstpcouple` equal to 10, or fewer steps if required
+   for accurate integration. Note that the default value is not 1
+   because additional computation and communication is required for
+   obtaining the virial. For velocity
    Verlet integrators :mdp:`nstpcouple` is set to 1.
 
 .. mdp:: tau-p
index d712869ddef8533e431b4f204dc38c1b49bf10d3..89dc64b4ca79732017658cc88d1e1b2d8beb0ffd 100644 (file)
@@ -65,6 +65,9 @@
 //! Macro to select a bool name
 #define EBOOL(e) gmx::boolToString(e)
 
+/* Default values for nstcalcenergy, used when the are no other restrictions. */
+constexpr int c_defaultNstCalcEnergy = 10;
+
 /* The minimum number of integration steps required for reasonably accurate
  * integration of first and second order coupling algorithms.
  */
@@ -72,6 +75,12 @@ const int nstmin_berendsen_tcouple = 5;
 const int nstmin_berendsen_pcouple = 10;
 const int nstmin_harmonic          = 20;
 
+/* Default values for nst T- and P- coupling intervals, used when the are no other
+ * restrictions.
+ */
+constexpr int c_defaultNstTCouple = 10;
+constexpr int c_defaultNstPCouple = 10;
+
 t_inputrec::t_inputrec()
 {
     // TODO When this memset is removed, remove the suppression of
@@ -87,21 +96,20 @@ t_inputrec::~t_inputrec()
     done_inputrec(this);
 }
 
-static int nst_wanted(const t_inputrec* ir)
+int ir_optimal_nstcalcenergy(const t_inputrec* ir)
 {
+    int nst;
+
     if (ir->nstlist > 0)
     {
-        return ir->nstlist;
+        nst = ir->nstlist;
     }
     else
     {
-        return 10;
+        nst = c_defaultNstCalcEnergy;
     }
-}
 
-int ir_optimal_nstcalcenergy(const t_inputrec* ir)
-{
-    return nst_wanted(ir);
+    return nst;
 }
 
 int tcouple_min_integration_steps(int etc)
@@ -134,7 +142,7 @@ int ir_optimal_nsttcouple(const t_inputrec* ir)
 
     nmin = tcouple_min_integration_steps(ir->etc);
 
-    nwanted = nst_wanted(ir);
+    nwanted = c_defaultNstTCouple;
 
     tau_min = 1e20;
     if (ir->etc != etcNO)
@@ -191,7 +199,7 @@ int ir_optimal_nstpcouple(const t_inputrec* ir)
 
     nmin = pcouple_min_integration_steps(ir->epc);
 
-    nwanted = nst_wanted(ir);
+    nwanted = c_defaultNstPCouple;
 
     if (nmin == 0 || ir->delta_t * nwanted <= ir->tau_p)
     {