Refactored pull data structures
[alexxy/gromacs.git] / src / gromacs / pulling / pull.h
index f1f49bd7ace6b6e5bed7898c16f25cf2d504aa41..c73ca640dc7455ee6fb6536fcf2d9061e5d69a1d 100644 (file)
@@ -67,7 +67,7 @@ struct t_pbc;
  * \param[in]     pbc       Information structure about periodicity.
  * \param[out]    value     The value of the pull coordinate.
  */
-void get_pull_coord_value(t_pull             *pull,
+void get_pull_coord_value(struct pull_t      *pull,
                           int                 coord_ind,
                           const struct t_pbc *pbc,
                           double             *value);
@@ -77,7 +77,7 @@ void get_pull_coord_value(t_pull             *pull,
  *
  * \param pull              The pull group.
  */
-void clear_pull_forces(t_pull *pull);
+void clear_pull_forces(struct pull_t *pull);
 
 
 /*! \brief Determine the COM pull forces and add them to f, return the potential
@@ -95,7 +95,7 @@ void clear_pull_forces(t_pull *pull);
  *
  * \returns The pull potential energy.
  */
-real pull_potential(t_pull *pull, t_mdatoms *md, struct t_pbc *pbc,
+real pull_potential(struct pull_t *pull, t_mdatoms *md, struct t_pbc *pbc,
                     t_commrec *cr, double t, real lambda,
                     rvec *x, rvec *f, tensor vir, real *dvdlambda);
 
@@ -114,7 +114,7 @@ real pull_potential(t_pull *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(t_pull *pull, t_mdatoms *md, struct t_pbc *pbc,
+void pull_constraint(struct pull_t *pull, t_mdatoms *md, struct t_pbc *pbc,
                      t_commrec *cr, double dt, double t,
                      rvec *x, rvec *xp, rvec *v, tensor vir);
 
@@ -127,56 +127,57 @@ void pull_constraint(t_pull *pull, t_mdatoms *md, struct t_pbc *pbc,
  * \param md             All atoms.
  */
 void dd_make_local_pull_groups(gmx_domdec_t *dd,
-                               t_pull *pull, t_mdatoms *md);
-
-
-/*! \brief Get memory and initialize the fields of pull that still need it, and
- * do runtype specific initialization.
- *
- * \param fplog      General output file, normally md.log.
- * \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 lambda     FEP lambda.
- * \param bOutFile   Open output files?
- * \param Flags      Flags passed over from main, used to determine
- *                   whether or not we are appending.
+                               struct pull_t *pull, t_mdatoms *md);
+
+
+/*! \brief Allocate, initialize and return a pull work struct.
+ *
+ * \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 lambda      FEP lambda.
+ * \param bOutFile    Open output files?
+ * \param Flags       Flags passed over from main, used to determine
+ *                    whether or not we are appending.
  */
-void init_pull(FILE              *fplog,
-               t_inputrec        *ir,
-               int                nfile,
-               const t_filenm     fnm[],
-               gmx_mtop_t        *mtop,
-               t_commrec        * cr,
-               const output_env_t oenv,
-               real               lambda,
-               gmx_bool           bOutFile,
-               unsigned long      Flags);
+struct pull_t *init_pull(FILE                *fplog,
+                         const pull_params_t *pull_params,
+                         const t_inputrec    *ir,
+                         int                  nfile,
+                         const t_filenm       fnm[],
+                         gmx_mtop_t          *mtop,
+                         t_commrec          * cr,
+                         const output_env_t   oenv,
+                         real                 lambda,
+                         gmx_bool             bOutFile,
+                         unsigned long        Flags);
 
 
 /*! \brief Close the pull output files.
  *
  * \param pull       The pull group.
  */
-void finish_pull(t_pull *pull);
+void finish_pull(struct pull_t *pull);
 
 
 /*! \brief Print the pull output (x and/or f)
  *
- * \param pull     The pull group.
+ * \param pull     The pull data structure.
  * \param step     Time step number.
  * \param time     Time.
  */
-void pull_print_output(t_pull *pull, gmx_int64_t step, double time);
+void pull_print_output(struct pull_t *pull, gmx_int64_t step, double time);
 
 
 /*! \brief Calculates centers of mass all pull groups.
  *
  * \param[in] cr       Struct for communication info.
- * \param[in] pull     The pull group.
+ * \param[in] pull     The pull data structure.
  * \param[in] md       All atoms.
  * \param[in] pbc      Information struct about periodicity.
  * \param[in] t        Time, only used for cylinder ref.
@@ -185,13 +186,27 @@ void pull_print_output(t_pull *pull, gmx_int64_t step, double time);
  *
  */
 void pull_calc_coms(t_commrec        *cr,
-                    t_pull           *pull,
+                    struct pull_t    *pull,
                     t_mdatoms        *md,
                     struct t_pbc     *pbc,
                     double            t,
                     rvec              x[],
                     rvec             *xp);
 
+
+/*! \brief Returns if we have pull coordinates with potential pulling.
+ *
+ * \param[in] pull     The pull data structure.
+ */
+gmx_bool pull_have_potential(const struct pull_t *pull);
+
+
+/*! \brief Returns if we have pull coordinates with constraint pulling.
+ *
+ * \param[in] pull     The pull data structure.
+ */
+gmx_bool pull_have_constraint(const struct pull_t *pull);
+
 #ifdef __cplusplus
 }
 #endif