Fix nstep command line override print
authorSzilard Pall <pall.szilard@gmail.com>
Wed, 10 Dec 2014 16:49:07 +0000 (17:49 +0100)
committerSzilard Pall <pall.szilard@gmail.com>
Wed, 10 Dec 2014 19:49:41 +0000 (20:49 +0100)
The commit addresses two issues:
- printing negative simulation length with "-nsteps -1";
- eliminates rounding when converting a non-integer time-step value from
  fs to ps units.

Fixes #1633

Change-Id: If1aac7e0f4e8e37f3e9777fa4eaa79744f3ccd65

src/programs/mdrun/runner.c

index 923f0f654461ddd943684299ef919dfc18229d4f..9129317a255091612f00be9f8f5198c508a7e282 100644 (file)
@@ -1022,11 +1022,11 @@ static void override_nsteps_cmdline(FILE            *fplog,
         char stmp[STRLEN];
 
         ir->nsteps = nsteps_cmdline;
-        if (EI_DYNAMICS(ir->eI))
+        if (EI_DYNAMICS(ir->eI) && nsteps_cmdline != -1)
         {
-            sprintf(stmp, "Overriding nsteps with value passed on the command line: %s steps, %.3f ps",
+            sprintf(stmp, "Overriding nsteps with value passed on the command line: %s steps, %.3g ps",
                     gmx_step_str(nsteps_cmdline, sbuf),
-                    nsteps_cmdline*ir->delta_t);
+                    fabs(nsteps_cmdline*ir->delta_t));
         }
         else
         {