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