SYCL: Avoid using no_init read accessor in rocFFT
[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,2015,2016,2017 by the GROMACS development team.
6  * Copyright (c) 2018,2019,2020,2021, 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
38  * \defgroup module_swap "Computational Electrophysiology" position swapping (swap)
39  * \ingroup group_mdrun
40  * \brief
41  * Implements the "Computational Electrophysiology" protocol.
42  *
43  * \author Carsten Kutzner <ckutzne@gwdg.de>
44  */
45 /*! \libinternal \file
46  * \brief
47  * The "Computational Electrophysiology" protocol for ion/water position swapping.
48  *
49  * \author Carsten Kutzner <ckutzne@gwdg.de>
50  * \inlibraryapi
51  * \ingroup module_swap
52  */
53 #ifndef GMX_SWAP_SWAPCOORDS_H
54 #define GMX_SWAP_SWAPCOORDS_H
55
56 #include <cstdio>
57
58 #include <memory>
59
60 #include "gromacs/math/vectypes.h"
61 #include "gromacs/utility/basedefinitions.h"
62
63 struct gmx_domdec_t;
64 struct gmx_mtop_t;
65 struct gmx_output_env_t;
66 struct gmx_wallcycle;
67 struct swaphistory_t;
68 struct t_commrec;
69 struct t_inputrec;
70 class t_state;
71 struct t_swap;
72 struct t_swapcoords;
73 struct ObservablesHistory;
74
75 namespace gmx
76 {
77 enum class StartingBehavior;
78 class IMDModule;
79 class LocalAtomSetManager;
80 struct MdrunOptions;
81
82 /*! \brief
83  * Creates a module for Computational Electrophysiology swapping.
84  */
85 std::unique_ptr<IMDModule> createSwapCoordinatesModule();
86
87 } // namespace gmx
88
89 /*! \brief Initialize ion / water position swapping ("Computational Electrophysiology").
90  *
91  * This routine does the memory allocation for various helper arrays, opens
92  * the output file, sets up swap data checkpoint writing, etc. and returns it.
93  *
94  * \param[in] fplog         General output file, normally md.log.
95  * \param[in] ir            Structure containing MD input parameters, among those
96  *                          also the structure needed for position swapping.
97  * \param[in] fn            Output file name for swap data.
98  * \param[in] mtop          Molecular topology.
99  * \param[in] globalState   The global state, only used on the master rank.
100  * \param[in] oh            Contains struct with swap data that is read from or written to checkpoint.
101  * \param[in] cr            Pointer to MPI communication data.
102  * \param[in] atomSets      Manager tending to swap atom indices.
103  * \param[in] oenv          Needed to open the swap output XVGR file.
104  * \param[in] mdrunOptions  Options for mdrun.
105  * \param[in] startingBehavior  Describes whether this is a restart appending to output files
106  */
107 t_swap* init_swapcoords(FILE*                     fplog,
108                         const t_inputrec*         ir,
109                         const char*               fn,
110                         const gmx_mtop_t&         mtop,
111                         const t_state*            globalState,
112                         ObservablesHistory*       oh,
113                         t_commrec*                cr,
114                         gmx::LocalAtomSetManager* atomSets,
115                         const gmx_output_env_t*   oenv,
116                         const gmx::MdrunOptions&  mdrunOptions,
117                         gmx::StartingBehavior     startingBehavior);
118
119
120 /*! \brief Finalizes ion / water position swapping, if it was active.
121  *
122  * \param[in] s             Pointer to swap data.
123  */
124 void finish_swapcoords(t_swap* s);
125
126
127 /*! \brief "Computational Electrophysiology" main routine within MD loop.
128  *
129  * \param[in] cr       Pointer to MPI communication data.
130  * \param[in] step     The number of the MD time step.
131  * \param[in] t        The time.
132  * \param[in] ir       Structure containing MD input parameters
133  * \param[in,out] s    The structure needed for position swapping.
134  * \param[in] wcycle   Count wallcycles of swap routines for diagnostic output.
135  * \param[in] x        Positions of home particles this node owns.
136  * \param[in] box      The simulation box.
137  * \param[in] bVerbose Should we be quiet or verbose?
138  * \param[in] bRerun   Are we doing a rerun?
139  *
140  * \returns Whether at least one pair of molecules was swapped.
141  */
142 gmx_bool do_swapcoords(t_commrec*        cr,
143                        int64_t           step,
144                        double            t,
145                        const t_inputrec* ir,
146                        t_swap*           s,
147                        gmx_wallcycle*    wcycle,
148                        rvec              x[],
149                        matrix            box,
150                        gmx_bool          bVerbose,
151                        gmx_bool          bRerun);
152
153 #endif