Restructure the load balancing timing
[gromacs.git] / src / gromacs / pulling / pull_rotation.h
blobc80efd2a604234ac92ed8c60c69e5a47764d4f03
1 /*
2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
5 * Copyright (c) 2001-2008, The GROMACS development team.
6 * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by
7 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
8 * and including many others, as listed in the AUTHORS file in the
9 * top-level source directory and at http://www.gromacs.org.
11 * GROMACS is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public License
13 * as published by the Free Software Foundation; either version 2.1
14 * of the License, or (at your option) any later version.
16 * GROMACS is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with GROMACS; if not, see
23 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
24 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 * If you want to redistribute modifications to GROMACS, please
27 * consider that scientific software is very special. Version
28 * control is crucial - bugs must be traceable. We will be happy to
29 * consider code for inclusion in the official distribution, but
30 * derived work must not be called official GROMACS. Details are found
31 * in the README & COPYING files - if they are missing, get the
32 * official version at http://www.gromacs.org.
34 * To help us fund GROMACS development, we humbly ask that you cite
35 * the research papers on the package. Check out http://www.gromacs.org.
38 /*! \libinternal \file
40 * \brief
41 * Declares functions to enforce rotational motion upon a group of particles.
43 * \author Carsten Kutzner <ckutzne@gwdg.de>
45 * \inlibraryapi
48 #ifndef GMX_PULLING_PULL_ROTATION_H
49 #define GMX_PULLING_PULL_ROTATION_H
51 #include <stdio.h>
53 #include "gromacs/math/vectypes.h"
54 #include "gromacs/utility/basedefinitions.h"
56 struct gmx_domdec_t;
57 struct gmx_mtop_t;
58 struct gmx_output_env_t;
59 struct t_commrec;
60 struct t_filenm;
61 struct t_inputrec;
62 struct t_rot;
64 #ifdef __cplusplus
65 extern "C" {
66 #endif
69 /*! \brief Initializes the enforced rotation groups.
71 * This routine does the memory allocation for various helper arrays, opens
72 * the output files etc.
74 * \param fplog General output file, normally md.log.
75 * \param ir Struct containing MD input parameters, among those
76 * also the enforced rotation parameters.
77 * \param nfile Number of entries in the fnm structure.
78 * \param fnm The filenames struct containing also the names
79 * of the rotation output files.
80 * \param cr Pointer to MPI communication data.
81 * \param x The positions of all MD particles.
82 * \param box The simulation box.
83 * \param mtop Molecular topology.
84 * \param oenv Needed to open the rotation output xvgr file.
85 * \param bVerbose Whether to print extra status information.
86 * \param Flags Flags passed over from main, used to determine
87 * whether or not we are doing a rerun.
89 extern void init_rot(FILE *fplog, t_inputrec *ir, int nfile, const t_filenm fnm[],
90 struct t_commrec *cr, rvec *x, matrix box, gmx_mtop_t *mtop, const gmx_output_env_t *oenv,
91 gmx_bool bVerbose, unsigned long Flags);
94 /*! \brief Make a selection of the home atoms for all enforced rotation groups.
96 * This routine is similar to \ref dd_make_local_pull_groups, but works only with
97 * domain decomposition. It should be called at every domain decomposition.
99 * \param dd Structure containing domain decomposition data.
100 * \param rot Pointer to all the enforced rotation data.
102 extern void dd_make_local_rotation_groups(struct gmx_domdec_t *dd, t_rot *rot);
105 /*! \brief Calculates the enforced rotation potential(s).
107 * This is the main enforced rotation module which is called during every time
108 * step. Here the rotation potential as well as the resulting forces are
109 * calculated.
111 * \param cr Pointer to MPI communication data.
112 * \param ir Struct containing MD input parameters, among those
113 * \param box Simulation box, needed to make group whole.
114 * \param x The positions of all the local particles.
115 * \param t Time.
116 * \param step The time step.
117 * \param bNS After domain decomposition / neighbor searching several
118 * local arrays have to be updated (masses, shifts)
120 extern void do_rotation(struct t_commrec *cr, t_inputrec *ir, matrix box, rvec x[], real t,
121 gmx_int64_t step, gmx_bool bNS);
124 /*! \brief Add the enforced rotation forces to the official force array.
126 * Adds the forces from enforced rotation potential to the local forces and
127 * sums up the contributions to the rotation potential from all the nodes. Since
128 * this needs communication, this routine should be called after the short range
129 * forces have been evaluated (in order not to spoil cycle counts).
130 * This routine also outputs data to the rotation output files (e.g.
131 * the potential, the angle of the group(s), and torques).
133 * \param rot Pointer to all the enforced rotation data.
134 * \param f The local forces to which the rotational forces have
135 * to be added.
136 * \param cr Pointer to MPI communication data.
137 * \param step The time step, used for output.
138 * \param t Time, used for output.
139 * \returns The potential energy of the rotation potentials.
141 extern real add_rot_forces(t_rot *rot, rvec f[], struct t_commrec *cr, gmx_int64_t step, real t);
144 /*! \brief Close the enforced rotation output files.
146 * \param rot Pointer to all the enforced rotation data.
148 extern void finish_rot(t_rot *rot);
151 #ifdef __cplusplus
153 #endif
156 #endif