"[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",
{ "-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},
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,