Merge branch release-2018
[alexxy/gromacs.git] / src / gromacs / pulling / pull.h
index ac423e866fef68569fe1a4903946963fe0370db2..ccb7cb8ab0c71b1745529374d75189bf387de020 100644 (file)
 
 #include "gromacs/math/vectypes.h"
 #include "gromacs/mdtypes/pull-params.h"
-#include "gromacs/pulling/pull_internal.h"
 #include "gromacs/utility/basedefinitions.h"
 #include "gromacs/utility/real.h"
 
 struct ContinuationOptions;
 struct gmx_mtop_t;
 struct gmx_output_env_t;
+struct pull_coord_work_t;
 struct pull_params_t;
 struct t_commrec;
 struct t_filenm;
@@ -71,6 +71,7 @@ struct t_pbc;
 namespace gmx
 {
 class ForceWithVirial;
+class LocalAtomSetManager;
 }
 
 /*! \brief Returns if the pull coordinate is an angle
@@ -184,9 +185,9 @@ void clear_pull_forces(struct pull_t *pull);
  *
  * \returns The pull potential energy.
  */
-real pull_potential(struct pull_t *pull, t_mdatoms *md, struct t_pbc *pbc,
-                    t_commrec *cr, double t, real lambda,
-                    rvec *x, gmx::ForceWithVirial *force, real *dvdlambda);
+real pull_potential(struct pull_t *pull, const t_mdatoms *md, struct t_pbc *pbc,
+                    const t_commrec *cr, double t, real lambda,
+                    const rvec *x, gmx::ForceWithVirial *force, real *dvdlambda);
 
 
 /*! \brief Constrain the coordinates xp in the directions in x
@@ -203,8 +204,8 @@ real pull_potential(struct pull_t *pull, t_mdatoms *md, struct t_pbc *pbc,
  * \param[in,out] v      Velocities, which may get a pull correction.
  * \param[in,out] vir    The virial, which, if != NULL, gets a pull correction.
  */
-void pull_constraint(struct pull_t *pull, t_mdatoms *md, struct t_pbc *pbc,
-                     t_commrec *cr, double dt, double t,
+void pull_constraint(struct pull_t *pull, const t_mdatoms *md, struct t_pbc *pbc,
+                     const t_commrec *cr, double dt, double t,
                      rvec *x, rvec *xp, rvec *v, tensor vir);
 
 
@@ -213,10 +214,8 @@ void pull_constraint(struct pull_t *pull, t_mdatoms *md, struct t_pbc *pbc,
  *
  * \param cr             Structure for communication info.
  * \param pull           The pull group.
- * \param md             All atoms.
  */
-void dd_make_local_pull_groups(t_commrec *cr,
-                               struct pull_t *pull, t_mdatoms *md);
+void dd_make_local_pull_groups(const t_commrec *cr, struct pull_t *pull);
 
 
 /*! \brief Allocate, initialize and return a pull work struct.
@@ -224,27 +223,35 @@ void dd_make_local_pull_groups(t_commrec *cr,
  * \param fplog       General output file, normally md.log.
  * \param pull_params The pull input parameters containing all pull settings.
  * \param ir          The inputrec.
- * \param nfile       Number of files.
- * \param fnm         Standard filename struct.
  * \param mtop        The topology of the whole system.
  * \param cr          Struct for communication info.
- * \param oenv        Output options.
+ * \param atomSets    The manager that handles the pull atom sets
  * \param lambda      FEP lambda.
- * \param bOutFile    Open output files?
- * \param continuationOptions  Options for continuing from checkpoint file
  */
 struct pull_t *init_pull(FILE                      *fplog,
                          const pull_params_t       *pull_params,
                          const t_inputrec          *ir,
-                         int                        nfile,
-                         const t_filenm             fnm[],
                          const gmx_mtop_t          *mtop,
-                         t_commrec                * cr,
-                         const gmx_output_env_t    *oenv,
-                         real                       lambda,
-                         gmx_bool                   bOutFile,
-                         const ContinuationOptions &continuationOptions);
+                         const t_commrec           *cr,
+                         gmx::LocalAtomSetManager  *atomSets,
+                         real                       lambda);
 
+/*! \brief Set up and open the pull output files, when requested.
+ *
+ * NOTE: This should only be called on the master rank and only when
+ *       doing dynamics (e.g. not with energy minimization).
+ *
+ * \param pull        The pull work data struct
+ * \param nfile       Number of files.
+ * \param fnm         Standard filename struct.
+ * \param oenv        Output options.
+ * \param continuationOptions  Options for continuing from checkpoint file
+ */
+void init_pull_output_files(pull_t                    *pull,
+                            int                        nfile,
+                            const t_filenm             fnm[],
+                            const gmx_output_env_t    *oenv,
+                            const ContinuationOptions &continuationOptions);
 
 /*! \brief Close the pull output files.
  *
@@ -259,7 +266,7 @@ void finish_pull(struct pull_t *pull);
  * \param step     Time step number.
  * \param time     Time.
  */
-void pull_print_output(struct pull_t *pull, gmx_int64_t step, double time);
+void pull_print_output(struct pull_t *pull, int64_t step, double time);
 
 
 /*! \brief Calculates centers of mass all pull groups.
@@ -273,13 +280,13 @@ void pull_print_output(struct pull_t *pull, gmx_int64_t step, double time);
  * \param[in,out] xp   Updated x, can be NULL.
  *
  */
-void pull_calc_coms(t_commrec        *cr,
-                    struct pull_t    *pull,
-                    t_mdatoms        *md,
-                    struct t_pbc     *pbc,
-                    double            t,
-                    rvec              x[],
-                    rvec             *xp);
+void pull_calc_coms(const t_commrec *cr,
+                    pull_t          *pull,
+                    const t_mdatoms *md,
+                    t_pbc           *pbc,
+                    double           t,
+                    const rvec       x[],
+                    rvec            *xp);
 
 /*! \brief Margin for checking PBC distances compared to half the box size in pullCheckPbcWithinGroups() */
 static constexpr real c_pullGroupPbcMargin = 0.9;