Move functionality to mdrunutility
[alexxy/gromacs.git] / src / gromacs / mdrunutility / multisim.h
similarity index 77%
rename from src/gromacs/mdrun/multisim.h
rename to src/gromacs/mdrunutility/multisim.h
index 41b51459dff9351ae38e5edac8606eadf3b6095e..ad8ba7731b3b6072f5250391e7e40fe56092f429 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2018, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
  *
  * \author Mark Abraham <mark.j.abraham@gmail.com>
  * \inlibraryapi
- * \ingroup module_mdrun
+ * \ingroup module_mdrunutility
  */
-#ifndef GMX_MDRUN_MULTISIM_H
-#define GMX_MDRUN_MULTISIM_H
+#ifndef GMX_MDRUNUTILITY_MULTISIM_H
+#define GMX_MDRUNUTILITY_MULTISIM_H
 
 #include <string>
 
@@ -61,4 +61,19 @@ gmx_multisim_t *init_multisystem(MPI_Comm                         comm,
 //! Cleans up multi-system handler.
 void done_multisim(gmx_multisim_t *ms);
 
+//! Are we doing multiple independent simulations?
+static bool inline isMultiSim(const gmx_multisim_t *ms)
+{
+    return ms != nullptr;
+}
+
+//! Are we the master simulation of a possible multi-simulation?
+bool isMasterSim(const gmx_multisim_t *ms);
+
+/*! \brief Are we the master rank (of the master simulation, for a multi-sim).
+ *
+ * This rank prints the remaining run time etc. */
+bool isMasterSimMasterRank(const gmx_multisim_t *ms,
+                           bool                  isMaster);
+
 #endif