32322ad580513eb63423b65cbc6aab5ec6dbf155
[alexxy/gromacs.git] / src / gromacs / essentialdynamics / edsam.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-2004, The GROMACS development team.
6  * Copyright (c) 2013,2014, 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.
10  *
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.
15  *
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.
20  *
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.
25  *
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.
33  *
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.
36  */
37 /*! \libinternal \file
38  *
39  * \brief
40  * Declares functions to calculate both essential dynamics constraints
41  * as well as flooding potentials and forces.
42  *
43  * \authors Bert de Groot <bgroot@gwdg.de>, Oliver Lange <oliver.lange@tum.de>,
44  * Carsten Kutzner <ckutzne@gwdg.de>
45  *
46  * \inlibraryapi
47  */
48 #ifndef GMX_ESSENTIALDYNAMICS_EDSAM_H
49 #define GMX_ESSENTIALDYNAMICS_EDSAM_H
50
51 #include "gromacs/legacyheaders/typedefs.h"
52 #include "gromacs/fileio/filenm.h"
53
54 #ifdef __cplusplus
55 extern "C" {
56 #endif
57
58 /*! \brief Applies essential dynamics constrains as defined in the .edi input file.
59  *
60  * \param ir                MD input parameter record.
61  * \param step              Number of the time step.
62  * \param cr                Data needed for MPI communication.
63  * \param xs                The local positions on this processor.
64  * \param v                 The local velocities.
65  * \param box               The simulation box.
66  * \param ed                The essential dynamics data.
67  */
68 void do_edsam(t_inputrec *ir, gmx_int64_t step,
69               t_commrec *cr, rvec xs[], rvec v[], matrix box, gmx_edsam_t ed);
70
71
72 /*! \brief Reads in the .edi file containing the essential dynamics and flooding data.
73  *
74  * This function opens the ED input and output files, reads in all datasets it finds
75  * in the input file, and cross-checks whether the .edi file information is consistent
76  * with the essential dynamics data found in the checkpoint file (if present).
77  * gmx make_edi can be used to create an .edi input file.
78  *
79  * \param natoms            Number of atoms of the whole MD system.
80  * \param EDstate           Essential dynamics and flooding data stored in the checkpoint file.
81  * \param nfile             Number of entries (files) in the fnm structure.
82  * \param fnm               The filenames struct; it contains also the names of the
83  *                          essential dynamics and flooding in + output files.
84  * \param Flags             Flags passed over from main, used to determine
85  *                          whether we are appending.
86  * \param oenv              Needed to open the output xvgr file.
87  * \param cr                Data needed for MPI communication.
88  * \returns                 Pointer to the initialized essential dynamics / flooding data.
89  */
90 gmx_edsam_t ed_open(int natoms, edsamstate_t *EDstate, int nfile, const t_filenm fnm[],
91                     unsigned long Flags, const output_env_t oenv, t_commrec *cr);
92
93
94 /*! \brief Initializes the essential dynamics and flooding module.
95  *
96  * \param mtop              Molecular topology.
97  * \param ir                MD input parameter record.
98  * \param cr                Data needed for MPI communication.
99  * \param ed                The essential dynamics data.
100  * \param x                 Positions of the whole MD system.
101  * \param box               The simulation box.
102  * \param EDstate           ED data stored in the checkpoint file.
103  */
104 void init_edsam(gmx_mtop_t *mtop, t_inputrec *ir, t_commrec *cr,
105                 gmx_edsam_t ed, rvec x[], matrix box, edsamstate_t *EDstate);
106
107
108 /*! \brief Make a selection of the home atoms for the ED groups.
109  *
110  * Should be called at every domain decomposition.
111  *
112  * \param dd                Domain decomposition data.
113  * \param ed                Essential dynamics and flooding data.
114  */
115 void dd_make_local_ed_indices(gmx_domdec_t *dd, gmx_edsam_t ed);
116
117
118 /*! \brief Evaluate the flooding potential(s) and forces as requested in the .edi input file.
119  *
120  * \param cr                Data needed for MPI communication.
121  * \param ir                MD input parameter record.
122  * \param x                 Positions on the local processor.
123  * \param force             Forcefield forces to which the flooding forces are added.
124  * \param ed                The essential dynamics data.
125  * \param box               The simulation box.
126  * \param step              Number of the time step.
127  * \param bNS               Are we in a neighbor searching step?
128  */
129 void do_flood(t_commrec *cr, t_inputrec *ir, rvec x[], rvec force[], gmx_edsam_t ed,
130               matrix box, gmx_int64_t step, gmx_bool bNS);
131
132
133 #ifdef __cplusplus
134 }
135 #endif
136
137 #endif