Document and clean up do_numbering()
[alexxy/gromacs.git] / src / gromacs / gmxpreprocess / readir.h
index 939b1cd3fc92832189a70b4236e3d8f3e3d18de3..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.
 #ifndef GMX_GMXPREPROCESS_READIR_H
 #define GMX_GMXPREPROCESS_READIR_H
 
+#include <string>
+
 #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;
@@ -57,6 +61,8 @@ struct t_blocka;
 struct t_grpopts;
 struct t_inpfile;
 struct t_inputrec;
+struct t_pull_group;
+struct t_pull_coord;
 struct t_rot;
 struct warninp;
 typedef warninp* warninp_t;
@@ -82,21 +88,22 @@ enum
 
 struct t_gromppopts
 {
-    int   warnings;
-    int   nshake;
-    char* include;
-    char* define;
-    bool  bGenVel;
-    bool  bGenPairs;
-    real  tempi;
-    int   seed;
-    bool  bOrire;
-    bool  bMorse;
-    char* wall_atomtype[2];
-    char* couple_moltype;
-    int   couple_lam0;
-    int   couple_lam1;
-    bool  bCoupleIntra;
+    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 */
@@ -105,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 */
@@ -134,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.
  */
 
@@ -148,17 +157,22 @@ void do_index(const char*                   mdparin,
 
 std::vector<std::string> read_pullparams(std::vector<t_inpfile>* inp, pull_params_t* pull, warninp_t wi);
 /* Reads the pull parameters, returns a list of the pull group names */
-
-void make_pull_groups(pull_params_t*                   pull,
-                      gmx::ArrayRef<const std::string> pullGroupNames,
-                      const t_blocka*                  grps,
-                      char**                           gnames);
+void process_pull_groups(gmx::ArrayRef<t_pull_group>      pullGroups,
+                         gmx::ArrayRef<const std::string> pullGroupNames,
+                         const t_blocka*                  grps,
+                         char**                           gnames);
 /* Process the pull group parameters after reading the index groups */
 
-void make_pull_coords(pull_params_t* pull);
+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()