Merge branch 'release-4-6'
[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
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 /*! \file
45  * \brief
46  * The "Computational Electrophysiology" protocol for ion/water position swapping.
47  *
48  * \ingroup group_mdrun
49  */
50
51 #ifndef GMX_SWAP_SWAPCOORDS_H
52 #define GMX_SWAP_SWAPCOORDS_H
53
54 #include "typedefs.h"
55 #include "types/commrec.h"
56
57 #ifdef __cplusplus
58 extern "C" {
59 #endif
60
61
62 /*! \brief Initialize ion / water position swapping ("Computational Electrophysiology").
63  *
64  * This routine does the memory allocation for various helper arrays, opens
65  * the output file, sets up swap data checkpoint writing, etc.
66  *
67  * \param[in] fplog         General output file, normally md.log.
68  * \param[in] bVerbose      Should we be quiet or verbose?
69  * \param[in] ir            Structure containing MD input parameters, among those
70  *                          also the structure needed for position swapping.
71  * \param[in] fn            Output file name for swap data.
72  * \param[in] mtop          Molecular topology.
73  * \param[in] x             The initial positions of all particles.
74  * \param[in] box           The simulation box.
75  * \param[in] swapstate     Swap-related data that is read from or written to checkpoint.
76  * \param[in] cr            Pointer to MPI communication data.
77  * \param[in] oenv          Needed to open the swap output XVGR file.
78  * \param[in] Flags         Flags passed over from main, used to determine
79  *                          whether we are doing a rerun, appending, etc.
80  */
81 extern void init_swapcoords(
82         FILE              *fplog,
83         gmx_bool           bVerbose,
84         t_inputrec        *ir,
85         const char        *fn,
86         gmx_mtop_t        *mtop,
87         rvec               x[],
88         matrix             box,
89         swapstate_t       *swapstate,
90         t_commrec         *cr,
91         const output_env_t oenv,
92         unsigned long      Flags);
93
94
95 /*! \brief Make a selection of the home atoms for the swap groups. These are
96  * the ions, the water, and the channels. This routine should be called at every
97  * domain decomposition.
98  *
99  * \param[in] dd            Structure containing domain decomposition data.
100  * \param[in] si_pub        Pointer to the swap data structure.
101  */
102 extern void dd_make_local_swap_groups(gmx_domdec_t *dd, t_swapcoords *si_pub);
103
104
105 /*! \brief "Computational Electrophysiology" main routine within MD loop.
106  *
107  * \param[in] cr       Pointer to MPI communication data.
108  * \param[in] step     The number of the MD time step.
109  * \param[in] t        The time.
110  * \param[in] ir       Structure containing MD input parameters, among those
111  *                     also the structure needed for position swapping.
112  * \param[in] wcycle   Count wallcycles of swap routines for diagnostic output.
113  * \param[in] x        Positions of home particles this node owns.
114  * \param[in] box      The simulation box.
115  * \param[in] mtop     Molecular topology.
116  * \param[in] bVerbose Should we be quiet or verbose?
117  * \param[in] bRerun   Are we doing a rerun?
118  *
119  * \returns Whether at least one pair of molecules was swapped.
120  */
121 extern gmx_bool do_swapcoords(
122         t_commrec        *cr,
123         gmx_int64_t       step,
124         double            t,
125         t_inputrec       *ir,
126         gmx_wallcycle_t   wcycle,
127         rvec              x[],
128         matrix            box,
129         gmx_mtop_t       *mtop,
130         gmx_bool          bVerbose,
131         gmx_bool          bRerun);
132
133
134 #ifdef __cplusplus
135 }
136 #endif
137
138 #endif