8a0ff766370f330a12dd3a33b4d531655cc7ffcc
[alexxy/gromacs.git] / src / gromacs / swap / swapcoords.h
1 /*
2  * This file is part of the GROMACS molecular simulation package.
3  *
4  * Copyright (c) 2013, The GROMACS development team.
5  * Copyright (c) 2013,2014, by the GROMACS development team, led by
6  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
7  * and including many others, as listed in the AUTHORS file in the
8  * top-level source directory and at http://www.gromacs.org.
9  *
10  * GROMACS is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public License
12  * as published by the Free Software Foundation; either version 2.1
13  * of the License, or (at your option) any later version.
14  *
15  * GROMACS is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18  * Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public
21  * License along with GROMACS; if not, see
22  * http://www.gnu.org/licenses, or write to the Free Software Foundation,
23  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
24  *
25  * If you want to redistribute modifications to GROMACS, please
26  * consider that scientific software is very special. Version
27  * control is crucial - bugs must be traceable. We will be happy to
28  * consider code for inclusion in the official distribution, but
29  * derived work must not be called official GROMACS. Details are found
30  * in the README & COPYING files - if they are missing, get the
31  * official version at http://www.gromacs.org.
32  *
33  * To help us fund GROMACS development, we humbly ask that you cite
34  * the research papers on the package. Check out http://www.gromacs.org.
35  */
36 /*! \libinternal
37  * \defgroup module_swap "Computational Electrophysiology" position swapping (swap)
38  * \ingroup group_mdrun
39  * \brief
40  * Implements the "Computational Electrophysiology" protocol.
41  *
42  * \author Carsten Kutzner <ckutzne@gwdg.de>
43  */
44 /*! \libinternal \file
45  * \brief
46  * The "Computational Electrophysiology" protocol for ion/water position swapping.
47  *
48  * \author Carsten Kutzner <ckutzne@gwdg.de>
49  * \inlibraryapi
50  * \ingroup module_swap
51  */
52 #ifndef GMX_SWAP_SWAPCOORDS_H
53 #define GMX_SWAP_SWAPCOORDS_H
54
55 #include "gromacs/legacyheaders/typedefs.h"
56 #include "gromacs/legacyheaders/types/commrec.h"
57
58 #ifdef __cplusplus
59 extern "C" {
60 #endif
61
62
63 /*! \brief Initialize ion / water position swapping ("Computational Electrophysiology").
64  *
65  * This routine does the memory allocation for various helper arrays, opens
66  * the output file, sets up swap data checkpoint writing, etc.
67  *
68  * \param[in] fplog         General output file, normally md.log.
69  * \param[in] bVerbose      Should we be quiet or verbose?
70  * \param[in] ir            Structure containing MD input parameters, among those
71  *                          also the structure needed for position swapping.
72  * \param[in] fn            Output file name for swap data.
73  * \param[in] mtop          Molecular topology.
74  * \param[in] x             The initial positions of all particles.
75  * \param[in] box           The simulation box.
76  * \param[in] swapstate     Swap-related data that is read from or written to checkpoint.
77  * \param[in] cr            Pointer to MPI communication data.
78  * \param[in] oenv          Needed to open the swap output XVGR file.
79  * \param[in] Flags         Flags passed over from main, used to determine
80  *                          whether we are doing a rerun, appending, etc.
81  */
82 extern void init_swapcoords(
83         FILE              *fplog,
84         gmx_bool           bVerbose,
85         t_inputrec        *ir,
86         const char        *fn,
87         gmx_mtop_t        *mtop,
88         rvec               x[],
89         matrix             box,
90         swapstate_t       *swapstate,
91         t_commrec         *cr,
92         const output_env_t oenv,
93         unsigned long      Flags);
94
95
96 /*! \brief Make a selection of the home atoms for the swap groups. These are
97  * the ions, the water, and the channels. This routine should be called at every
98  * domain decomposition.
99  *
100  * \param[in] dd            Structure containing domain decomposition data.
101  * \param[in] si_pub        Pointer to the swap data structure.
102  */
103 extern void dd_make_local_swap_groups(gmx_domdec_t *dd, t_swapcoords *si_pub);
104
105
106 /*! \brief "Computational Electrophysiology" main routine within MD loop.
107  *
108  * \param[in] cr       Pointer to MPI communication data.
109  * \param[in] step     The number of the MD time step.
110  * \param[in] t        The time.
111  * \param[in] ir       Structure containing MD input parameters, among those
112  *                     also the structure needed for position swapping.
113  * \param[in] wcycle   Count wallcycles of swap routines for diagnostic output.
114  * \param[in] x        Positions of home particles this node owns.
115  * \param[in] box      The simulation box.
116  * \param[in] mtop     Molecular topology.
117  * \param[in] bVerbose Should we be quiet or verbose?
118  * \param[in] bRerun   Are we doing a rerun?
119  *
120  * \returns Whether at least one pair of molecules was swapped.
121  */
122 extern gmx_bool do_swapcoords(
123         t_commrec        *cr,
124         gmx_int64_t       step,
125         double            t,
126         t_inputrec       *ir,
127         gmx_wallcycle_t   wcycle,
128         rvec              x[],
129         matrix            box,
130         gmx_mtop_t       *mtop,
131         gmx_bool          bVerbose,
132         gmx_bool          bRerun);
133
134
135 #ifdef __cplusplus
136 }
137 #endif
138
139 #endif