Merge branch release-2016
[alexxy/gromacs.git] / src / gromacs / gmxpreprocess / readir.cpp
index 1f0f2a054cc88d85b3049ffaf9e6b9a31e2e3a52..9b7df159ddfd6410a05dd1921e1d3ce531a545f4 100644 (file)
@@ -4145,11 +4145,14 @@ void triple_check(const char *mdparin, t_inputrec *ir, gmx_mtop_t *sys,
             CHECK(ir->opts.tau_t[i] < 0);
         }
 
-        for (i = 0; i < ir->opts.ngtc; i++)
+        if (ir->etc == etcANDERSENMASSIVE && ir->comm_mode != ecmNO)
         {
-            int nsteps = (int)(ir->opts.tau_t[i]/ir->delta_t);
-            sprintf(err_buf, "tau_t/delta_t for group %d for temperature control method %s must be a multiple of nstcomm (%d), as velocities of atoms in coupled groups are randomized every time step. The input tau_t (%8.3f) leads to %d steps per randomization", i, etcoupl_names[ir->etc], ir->nstcomm, ir->opts.tau_t[i], nsteps);
-            CHECK((nsteps % ir->nstcomm) && (ir->etc == etcANDERSENMASSIVE));
+            for (i = 0; i < ir->opts.ngtc; i++)
+            {
+                int nsteps = static_cast<int>(ir->opts.tau_t[i]/ir->delta_t + 0.5);
+                sprintf(err_buf, "tau_t/delta_t for group %d for temperature control method %s must be a multiple of nstcomm (%d), as velocities of atoms in coupled groups are randomized every time step. The input tau_t (%8.3f) leads to %d steps per randomization", i, etcoupl_names[ir->etc], ir->nstcomm, ir->opts.tau_t[i], nsteps);
+                CHECK(nsteps % ir->nstcomm != 0);
+            }
         }
     }