Document and clean up do_numbering()
[alexxy/gromacs.git] / src / gromacs / gmxpreprocess / readir.h
index 65050546ff4003ed05215ab1662986c553a95a47..fef3384e11903f9541b9f477713c5a736b9fa132 100644 (file)
@@ -4,7 +4,7 @@
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
  * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
- * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020,2021, 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.
 
 #include "gromacs/fileio/readinp.h"
 #include "gromacs/math/vectypes.h"
+#include "gromacs/mdtypes/multipletimestepping.h"
 #include "gromacs/utility/arrayref.h"
 #include "gromacs/utility/real.h"
 
 namespace gmx
 {
 class MDModules;
-struct MdModulesNotifier;
+struct MDModulesNotifiers;
 } // namespace gmx
 
 struct gmx_mtop_t;
@@ -87,23 +88,22 @@ enum
 
 struct t_gromppopts
 {
-    int         warnings     = 0;
-    int         nshake       = 0;
-    char*       include      = nullptr;
-    char*       define       = nullptr;
-    bool        bGenVel      = false;
-    bool        bGenPairs    = false;
-    real        tempi        = 0;
-    int         seed         = 0;
-    int         numMtsLevels = 0;
-    std::string mtsLevel2Forces;
-    bool        bOrire           = false;
-    bool        bMorse           = false;
-    char*       wall_atomtype[2] = { nullptr, nullptr };
-    char*       couple_moltype   = nullptr;
-    int         couple_lam0      = 0;
-    int         couple_lam1      = 0;
-    bool        bCoupleIntra     = false;
+    int                warnings  = 0;
+    int                nshake    = 0;
+    char*              include   = nullptr;
+    char*              define    = nullptr;
+    bool               bGenVel   = false;
+    bool               bGenPairs = false;
+    real               tempi     = 0;
+    int                seed      = 0;
+    gmx::GromppMtsOpts mtsOpts;
+    bool               bOrire           = false;
+    bool               bMorse           = false;
+    char*              wall_atomtype[2] = { nullptr, nullptr };
+    char*              couple_moltype   = nullptr;
+    int                couple_lam0      = 0;
+    int                couple_lam1      = 0;
+    bool               bCoupleIntra     = false;
 };
 
 /*! \brief Initialise object to hold strings parsed from an .mdp file */
@@ -112,16 +112,18 @@ void init_inputrec_strings();
 /*! \brief Clean up object that holds strings parsed from an .mdp file */
 void done_inputrec_strings();
 
-void check_ir(const char*                   mdparin,
-              const gmx::MdModulesNotifier& mdModulesNotifier,
-              t_inputrec*                   ir,
-              t_gromppopts*                 opts,
-              warninp_t                     wi);
-/* Validate inputrec data.
- * Fatal errors will be added to nerror.
+/*! \brief Performs all validation on \p ir that can be done without index groups and topology
+ *
+ * Any errors, warnings or notes are added to \p wi
  */
-int search_string(const char* s, int ng, char* gn[]);
-/* Returns the index of string s in the index groups */
+void check_ir(const char*                    mdparin,
+              const gmx::MDModulesNotifiers& mdModulesNotifiers,
+              t_inputrec*                    ir,
+              t_gromppopts*                  opts,
+              warninp_t                      wi);
+
+//! Returns the index of string \p s in \p gn or exit with a verbose fatal error when not found
+int search_string(const char* s, int ng, char* const gn[]);
 
 void double_check(t_inputrec* ir, matrix box, bool bHasNormalConstraints, bool bHasAnyConstraints, warninp_t wi);
 /* Do more checks */
@@ -141,13 +143,13 @@ void get_ir(const char*     mdparin,
  * function is called. Also prints the input file back to mdparout.
  */
 
-void do_index(const char*                   mdparin,
-              const char*                   ndx,
-              gmx_mtop_t*                   mtop,
-              bool                          bVerbose,
-              const gmx::MdModulesNotifier& notifier,
-              t_inputrec*                   ir,
-              warninp_t                     wi);
+void do_index(const char*                    mdparin,
+              const char*                    ndx,
+              gmx_mtop_t*                    mtop,
+              bool                           bVerbose,
+              const gmx::MDModulesNotifiers& mdModulesNotifiers,
+              t_inputrec*                    ir,
+              warninp_t                      wi);
 /* Read the index file and assign grp numbers to atoms.
  */
 
@@ -165,7 +167,12 @@ void checkPullCoords(gmx::ArrayRef<const t_pull_group> pullGroups,
                      gmx::ArrayRef<const t_pull_coord> pullCoords);
 /* Process the pull coordinates after reading the pull groups */
 
-pull_t* set_pull_init(t_inputrec* ir, const gmx_mtop_t* mtop, rvec* x, matrix box, real lambda, warninp_t wi);
+pull_t* set_pull_init(t_inputrec*                    ir,
+                      const gmx_mtop_t&              mtop,
+                      gmx::ArrayRef<const gmx::RVec> x,
+                      matrix                         box,
+                      real                           lambda,
+                      warninp_t                      wi);
 /* Prints the initial pull group distances in x.
  * If requested, adds the current distance to the initial reference location.
  * Returns the pull_t pull work struct. This should be passed to finish_pull()