b889e5bf34af4b3365101d99f916dd6d0ea109e6
[alexxy/gromacs.git] / include / pull_rotation.h
1 /*
2  * This file is part of the GROMACS molecular simulation package.
3  *
4  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
5  * Copyright (c) 2001-2008, The GROMACS development team,
6  * check out http://www.gromacs.org for more information.
7  * Copyright (c) 2012,2013, by the GROMACS development team, led by
8  * David van der Spoel, Berk Hess, Erik Lindahl, and including many
9  * others, as listed in the AUTHORS file in the top-level source
10  * directory and at http://www.gromacs.org.
11  *
12  * GROMACS is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU Lesser General Public License
14  * as published by the Free Software Foundation; either version 2.1
15  * of the License, or (at your option) any later version.
16  *
17  * GROMACS is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20  * Lesser General Public License for more details.
21  *
22  * You should have received a copy of the GNU Lesser General Public
23  * License along with GROMACS; if not, see
24  * http://www.gnu.org/licenses, or write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
26  *
27  * If you want to redistribute modifications to GROMACS, please
28  * consider that scientific software is very special. Version
29  * control is crucial - bugs must be traceable. We will be happy to
30  * consider code for inclusion in the official distribution, but
31  * derived work must not be called official GROMACS. Details are found
32  * in the README & COPYING files - if they are missing, get the
33  * official version at http://www.gromacs.org.
34  *
35  * To help us fund GROMACS development, we humbly ask that you cite
36  * the research papers on the package. Check out http://www.gromacs.org.
37  */
38
39 /*! \file pull_rotation.h
40  *
41  *  @brief Enforced rotation of protein parts or other groups of particles.
42  *
43  *  This file contains routines that are used to enforce rotational motion
44  *  upon a subgroup of particles.
45  *
46  */
47
48 #ifndef _pull_rotation_h
49 #define _pull_rotation_h
50 #include "visibility.h"
51 #include "vec.h"
52 #include "typedefs.h"
53
54
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58
59
60 /*! \brief Initialize the enforced rotation groups.
61  *
62  * This routine does the memory allocation for various helper arrays, opens
63  * the output files etc.
64  *
65  * \param fplog             General output file, normally md.log.
66  * \param ir                Struct containing MD input parameters, among those
67  *                          also the enforced rotation parameters.
68  * \param nfile             Number of entries in the fnm structure.
69  * \param fnm               The filenames struct containing also the names
70  *                          of the rotation output files.
71  * \param cr                Pointer to MPI communication data.
72  * \param x                 The positions of all MD particles.
73  * \param mtop              Molecular topology.
74  * \param oenv              Needed to open the rotation output xvgr file.
75  * \param Flags             Flags passed over from main, used to determine
76  *                          whether or not we are doing a rerun.
77  */
78 GMX_LIBMD_EXPORT
79 extern void init_rot(FILE *fplog, t_inputrec *ir, int nfile, const t_filenm fnm[],
80                      t_commrec *cr, rvec *x, matrix box, gmx_mtop_t *mtop, const output_env_t oenv,
81                      gmx_bool bVerbose, unsigned long Flags);
82
83
84 /*! \brief Make a selection of the home atoms for all enforced rotation groups.
85  *
86  * This routine is similar to dd_make_local_pull_groups, but works only with
87  * domain decomposition. It should be called at every domain decomposition.
88  *
89  * \param dd                Structure containing domain decomposition data.
90  * \param rot               Pointer to all the enforced rotation data.
91  */
92 extern void dd_make_local_rotation_groups(gmx_domdec_t *dd, t_rot *rot);
93
94
95 /*! \brief Calculation of the enforced rotation potential.
96  *
97  * This is the main enforced rotation module which is called during every time
98  * step. Here the rotation potential as well as the resulting forces are
99  * calculated.
100  *
101  * \param cr                Pointer to MPI communication data.
102  * \param ir                Struct containing MD input parameters, among those
103  * \param box               Simulation box, needed to make group whole.
104  * \param x                 The positions of all the local particles.
105  * \param t                 Time.
106  * \param step              The time step.
107  * \param wcycle            During the potential calculation the wallcycles are
108  *                          counted. Later they enter the dynamic load balancing.
109  * \param bNS               After domain decomposition / neighborsearching several
110  *                          local arrays have to be updated (masses, shifts)
111  */
112 extern void do_rotation(t_commrec *cr, t_inputrec *ir, matrix box, rvec x[], real t,
113                         gmx_large_int_t step, gmx_wallcycle_t wcycle, gmx_bool bNS);
114
115
116 /*! \brief Add the enforced rotation forces to the official force array.
117  *
118  * Adds the forces from enforced rotation potential to the local forces and
119  * sums up the contributions to the rotation potential from all the nodes. Since
120  * this needs communication, this routine should be called after the SR forces
121  * have been evaluated (in order not to spoil cycle counts).
122  * This routine also outputs data to the various rotation output files (e.g.
123  * the potential, the angle of the group, torques and more).
124  *
125  * \param rot               Pointer to all the enforced rotation data.
126  * \param f                 The local forces to which the rotational forces have
127  *                          to be added.
128  * \param cr                Pointer to MPI communication data.
129  * \param step              The time step, used for output.
130  * \param t                 Time, used for output.
131  */
132 extern real add_rot_forces(t_rot *rot, rvec f[], t_commrec *cr, gmx_large_int_t step, real t);
133
134
135 /*! \brief Close the enforced rotation output files.
136  *
137  * \param fplog             General output file, normally md.log.
138  * \param rot               Pointer to all the enforced rotation data.
139  */
140 GMX_LIBMD_EXPORT
141 extern void finish_rot(FILE *fplog, t_rot *rot);
142
143
144 #ifdef __cplusplus
145 }
146 #endif
147
148
149 #endif