Remove spurious newline from log file
authorBerk Hess <hess@kth.se>
Tue, 17 Sep 2019 14:14:35 +0000 (16:14 +0200)
committerMagnus Lundborg <magnus.lundborg@scilifelab.se>
Tue, 17 Sep 2019 16:57:28 +0000 (18:57 +0200)
The annealing print function always added a newline.
Made calls to annealing and energy/log print conditional,
as they create needless overhead.

Change-Id: I63c0c6c9f1803aa8d42f59b40d7e2bff6fb6ac10

src/gromacs/mdrun/md.cpp

index 1f27a0d1273b735d08e1f02368e9abac412d7c14..279c766398a33e9b48f491e439186b5c263975c2 100644 (file)
@@ -250,8 +250,8 @@ void gmx::LegacySimulator::do_md()
     }
 
     initialize_lambdas(fplog, *ir, MASTER(cr), &state_global->fep_state, state_global->lambda, lam0);
-    Update upd(ir, deform);
-    bool   doSimulatedAnnealing = initSimulatedAnnealing(ir, &upd);
+    Update     upd(ir, deform);
+    const bool doSimulatedAnnealing = initSimulatedAnnealing(ir, &upd);
     if (startingBehavior != StartingBehavior::RestartWithAppending)
     {
         pleaseCiteCouplingAlgorithms(fplog, *ir);
@@ -1434,11 +1434,17 @@ void gmx::LegacySimulator::do_md()
             gmx_bool do_dr  = do_per_step(step, ir->nstdisreout);
             gmx_bool do_or  = do_per_step(step, ir->nstorireout);
 
-            energyOutput.printAnnealingTemperatures(do_log ? fplog : nullptr, groups, &(ir->opts));
-            energyOutput.printStepToEnergyFile(mdoutf_get_fp_ene(outf), do_ene, do_dr, do_or,
-                                               do_log ? fplog : nullptr,
-                                               step, t,
-                                               fcd, awh.get());
+            if (doSimulatedAnnealing)
+            {
+                energyOutput.printAnnealingTemperatures(do_log ? fplog : nullptr, groups, &(ir->opts));
+            }
+            if (do_log || do_ene || do_dr || do_or)
+            {
+                energyOutput.printStepToEnergyFile(mdoutf_get_fp_ene(outf), do_ene, do_dr, do_or,
+                                                   do_log ? fplog : nullptr,
+                                                   step, t,
+                                                   fcd, awh.get());
+            }
 
             if (ir->bPull)
             {