Print lambda state to log file if using AWH for FEP.
[alexxy/gromacs.git] / src / gromacs / mdtypes / state.cpp
index 61c280f997638ae99c8587c0f599acba707fd351..5e80a742083019c6035677a379cf248bd59cc7d8 100644 (file)
@@ -280,6 +280,19 @@ void preserve_box_shape(const t_inputrec* ir, matrix box_rel, matrix box)
     }
 }
 
+void printLambdaStateToLog(FILE* fplog, const gmx::ArrayRef<real> lambda, const bool isInitialOutput)
+{
+    if (fplog != nullptr)
+    {
+        fprintf(fplog, "%s vector of lambda components:[ ", isInitialOutput ? "Initial" : "Current");
+        for (const auto& l : lambda)
+        {
+            fprintf(fplog, "%10.4f ", l);
+        }
+        fprintf(fplog, "]\n%s", isInitialOutput ? "" : "\n");
+    }
+}
+
 void initialize_lambdas(FILE*               fplog,
                         const t_inputrec&   ir,
                         bool                isMaster,
@@ -338,13 +351,6 @@ void initialize_lambdas(FILE*               fplog,
     }
 
     /* Send to the log the information on the current lambdas */
-    if (fplog != nullptr)
-    {
-        fprintf(fplog, "Initial vector of lambda components:[ ");
-        for (const auto& l : lambda)
-        {
-            fprintf(fplog, "%10.4f ", l);
-        }
-        fprintf(fplog, "]\n");
-    }
+    const bool isInitialOutput = true;
+    printLambdaStateToLog(fplog, lambda, isInitialOutput);
 }