Merge "Merge branch release-5-0"
authorTeemu Murtola <teemu.murtola@gmail.com>
Sat, 17 Jan 2015 17:34:03 +0000 (18:34 +0100)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Sat, 17 Jan 2015 17:34:03 +0000 (18:34 +0100)
src/programs/mdrun/mdrun.cpp
src/programs/mdrun/runner.cpp

index c5848740250c216acbfd073b37e310d49e7f52a2..6f398157219934aa37cc09b7aea6d0d01cb3908d 100644 (file)
@@ -377,7 +377,11 @@ int gmx_mdrun(int argc, char *argv[])
         "[PAR]",
         "With option [TT]-maxh[tt] a simulation is terminated and a checkpoint",
         "file is written at the first neighbor search step where the run time",
-        "exceeds [TT]-maxh[tt]*0.99 hours.",
+        "exceeds [TT]-maxh[tt]*0.99 hours. This option is particularly useful in",
+        "combination with setting [TT]nsteps[tt] to -1 either in the mdp or using the",
+        "similarly named command line option. This results in an infinite run,",
+        "terminated only when the time limit set by [TT]-maxh[tt] is reached (if any)"
+        "or upon receiving a signal."
         "[PAR]",
         "When [TT]mdrun[tt] receives a TERM signal, it will set nsteps to the current",
         "step plus one. When [TT]mdrun[tt] receives an INT signal (e.g. when ctrl+C is",
@@ -563,7 +567,7 @@ int gmx_mdrun(int argc, char *argv[])
         { "-append",  FALSE, etBOOL, {&bAppendFiles},
           "Append to previous output files when continuing from checkpoint instead of adding the simulation part number to all file names" },
         { "-nsteps",  FALSE, etINT64, {&nsteps},
-          "Run this number of steps, overrides .mdp file option" },
+          "Run this number of steps, overrides .mdp file option (-1 means infinite, -2 means use mdp option, smaller is invalid)" },
         { "-maxh",   FALSE, etREAL, {&max_hours},
           "Terminate after 0.99 times this time (hours)" },
         { "-multi",   FALSE, etINT, {&nmultisim},
index fc4ab2b4fc5a88cd27f6a52167fe708eaf088600..3699360ead0295e831d6ecd7ae2491129a62d7d9 100644 (file)
@@ -914,31 +914,36 @@ static void override_nsteps_cmdline(FILE            *fplog,
                                     t_inputrec      *ir,
                                     const t_commrec *cr)
 {
-    char sbuf[STEPSTRSIZE];
-
     assert(ir);
     assert(cr);
 
     /* override with anything else than the default -2 */
     if (nsteps_cmdline > -2)
     {
-        char stmp[STRLEN];
+        char sbuf_steps[STEPSTRSIZE];
+        char sbuf_msg[STRLEN];
 
         ir->nsteps = nsteps_cmdline;
         if (EI_DYNAMICS(ir->eI) && nsteps_cmdline != -1)
         {
-            sprintf(stmp, "Overriding nsteps with value passed on the command line: %s steps, %.3g ps",
-                    gmx_step_str(nsteps_cmdline, sbuf),
+            sprintf(sbuf_msg, "Overriding nsteps with value passed on the command line: %s steps, %.3g ps",
+                    gmx_step_str(nsteps_cmdline, sbuf_steps),
                     fabs(nsteps_cmdline*ir->delta_t));
         }
         else
         {
-            sprintf(stmp, "Overriding nsteps with value passed on the command line: %s steps",
-                    gmx_step_str(nsteps_cmdline, sbuf));
+            sprintf(sbuf_msg, "Overriding nsteps with value passed on the command line: %s steps",
+                    gmx_step_str(nsteps_cmdline, sbuf_steps));
         }
 
-        md_print_warn(cr, fplog, "%s\n", stmp);
+        md_print_warn(cr, fplog, "%s\n", sbuf_msg);
+    }
+    else if (nsteps_cmdline < -2)
+    {
+        gmx_fatal(FARGS, "Invalid nsteps value passed on the command line: %d",
+                  nsteps_cmdline);
     }
+    /* Do nothing if nsteps_cmdline == -2 */
 }
 
 int mdrunner(gmx_hw_opt_t *hw_opt,