Clean up some headers in mdlib
[alexxy/gromacs.git] / src / gromacs / mdlib / update_vv.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,2015,2016,2017 by the GROMACS development team.
7  * Copyright (c) 2018,2019,2020,2021, by the GROMACS development team, led by
8  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
9  * and including many others, as listed in the AUTHORS file in the
10  * top-level source directory and at http://www.gromacs.org.
11  *
12  * GROMACS is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU Lesser General Public License
14  * as published by the Free Software Foundation; either version 2.1
15  * of the License, or (at your option) any later version.
16  *
17  * GROMACS is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20  * Lesser General Public License for more details.
21  *
22  * You should have received a copy of the GNU Lesser General Public
23  * License along with GROMACS; if not, see
24  * http://www.gnu.org/licenses, or write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
26  *
27  * If you want to redistribute modifications to GROMACS, please
28  * consider that scientific software is very special. Version
29  * control is crucial - bugs must be traceable. We will be happy to
30  * consider code for inclusion in the official distribution, but
31  * derived work must not be called official GROMACS. Details are found
32  * in the README & COPYING files - if they are missing, get the
33  * official version at http://www.gromacs.org.
34  *
35  * To help us fund GROMACS development, we humbly ask that you cite
36  * the research papers on the package. Check out http://www.gromacs.org.
37  */
38 #ifndef GMX_MDLIB_UPDATE_VV_H
39 #define GMX_MDLIB_UPDATE_VV_H
40
41 #include <cstdio>
42
43 #include <array>
44 #include <vector>
45
46 #include "gromacs/math/vectypes.h"
47 #include "gromacs/mdtypes/md_enums.h"
48
49 class gmx_ekindata_t;
50 struct gmx_enerdata_t;
51 struct gmx_global_stat;
52 struct gmx_localtop_t;
53 struct gmx_mtop_t;
54 struct gmx_wallcycle;
55 struct pull_t;
56 struct t_commrec;
57 struct t_extmass;
58 struct t_fcdata;
59 struct t_forcerec;
60 struct t_inputrec;
61 struct t_mdatoms;
62 struct t_nrnb;
63 class t_state;
64 struct t_vcm;
65
66 namespace gmx
67 {
68 class Constraints;
69 class ForceBuffers;
70 class MDLogger;
71 class SimulationSignaller;
72 class Update;
73 enum class StartingBehavior : int;
74 } // namespace gmx
75
76 /*! \brief Make the first step of Velocity Verlet integration
77  *
78  * \param[in]  step              Current timestep.
79  * \param[in]  bFirstStep        Is it a first step.
80  * \param[in]  bInitStep         Is it an initialization step.
81  * \param[in]  startingBehavior  Describes whether this is a restart appending to output files.
82  * \param[in]  nstglobalcomm     Will globals be computed on this step.
83  * \param[in]  ir                Input record.
84  * \param[in]  fr                Force record.
85  * \param[in]  cr                Comunication record.
86  * \param[in]  state             Simulation state.
87  * \param[in]  mdatoms           MD atoms data.
88  * \param[in]  fcdata            Force calculation data.
89  * \param[in]  MassQ             Mass/pressure data.
90  * \param[in]  vcm               Center of mass motion removal.
91  * \param[in]  top_global        Global topology.
92  * \param[in]  top               Local topology.
93  * \param[in]  enerd             Energy data.
94  * \param[in]  ekind             Kinetic energy data.
95  * \param[in]  gstat             Storage of thermodynamic parameters data.
96  * \param[out] last_ekin         Kinetic energies of the last step.
97  * \param[in]  bCalcVir          If the virial is computed on this step.
98  * \param[in]  total_vir         Total virial tensor.
99  * \param[in]  shake_vir         Constraints virial.
100  * \param[in]  force_vir         Force virial.
101  * \param[in]  pres              Pressure tensor.
102  * \param[in]  M                 Parrinello-Rahman velocity scaling matrix.
103  * \param[in]  do_log            Do logging on this step.
104  * \param[in]  do_ene            Print energies on this step.
105  * \param[in]  bCalcEner         Compute energies on this step.
106  * \param[in]  bGStat            Collect globals this step.
107  * \param[in]  bStopCM           Stop the center of mass motion on this step.
108  * \param[in]  bTrotter          Do trotter routines this step.
109  * \param[in]  bExchanged        If this is a replica exchange step.
110  * \param[out] bSumEkinhOld      Old kinetic energies will need to be summed up.
111  * \param[out] saved_conserved_quantity  Place to store the conserved energy.
112  * \param[in]  f                 Force buffers.
113  * \param[in]  upd               Update object.
114  * \param[in]  constr            Constraints object.
115  * \param[in]  nullSignaller     Simulation signaller.
116  * \param[in]  trotter_seq       NPT variables.
117  * \param[in]  nrnb              Cycle counters.
118  * \param[in]  mdlog             Logger.
119  * \param[in]  fplog             Another logger.
120  * \param[in]  wcycle            Wall-clock cycle counter.
121  */
122 void integrateVVFirstStep(int64_t                                  step,
123                           bool                                     bFirstStep,
124                           bool                                     bInitStep,
125                           gmx::StartingBehavior                    startingBehavior,
126                           int                                      nstglobalcomm,
127                           const t_inputrec*                        ir,
128                           t_forcerec*                              fr,
129                           t_commrec*                               cr,
130                           t_state*                                 state,
131                           t_mdatoms*                               mdatoms,
132                           const t_fcdata&                          fcdata,
133                           t_extmass*                               MassQ,
134                           t_vcm*                                   vcm,
135                           const gmx_mtop_t&                        top_global,
136                           const gmx_localtop_t&                    top,
137                           gmx_enerdata_t*                          enerd,
138                           gmx_ekindata_t*                          ekind,
139                           gmx_global_stat*                         gstat,
140                           real*                                    last_ekin,
141                           bool                                     bCalcVir,
142                           tensor                                   total_vir,
143                           tensor                                   shake_vir,
144                           tensor                                   force_vir,
145                           tensor                                   pres,
146                           matrix                                   M,
147                           bool                                     do_log,
148                           bool                                     do_ene,
149                           bool                                     bCalcEner,
150                           bool                                     bGStat,
151                           bool                                     bStopCM,
152                           bool                                     bTrotter,
153                           bool                                     bExchanged,
154                           bool*                                    bSumEkinhOld,
155                           real*                                    saved_conserved_quantity,
156                           gmx::ForceBuffers*                       f,
157                           gmx::Update*                             upd,
158                           gmx::Constraints*                        constr,
159                           gmx::SimulationSignaller*                nullSignaller,
160                           std::array<std::vector<int>, ettTSEQMAX> trotter_seq,
161                           t_nrnb*                                  nrnb,
162                           const gmx::MDLogger&                     mdlog,
163                           FILE*                                    fplog,
164                           gmx_wallcycle*                           wcycle);
165
166
167 /*! \brief Make the second step of Velocity Verlet integration
168  *
169  * \param[in]  step              Current timestep.
170  * \param[in]  ir                Input record.
171  * \param[in]  fr                Force record.
172  * \param[in]  cr                Comunication record.
173  * \param[in]  state             Simulation state.
174  * \param[in]  mdatoms           MD atoms data.
175  * \param[in]  fcdata            Force calculation data.
176  * \param[in]  MassQ             Mass/pressure data.
177  * \param[in]  vcm               Center of mass motion removal.
178  * \param[in]  pull_work         Pulling data.
179  * \param[in]  enerd             Energy data.
180  * \param[in]  ekind             Kinetic energy data.
181  * \param[in]  gstat             Storage of thermodynamic parameters data.
182  * \param[out] dvdl_constr       FEP data for constraints.
183  * \param[in]  bCalcVir          If the virial is computed on this step.
184  * \param[in]  total_vir         Total virial tensor.
185  * \param[in]  shake_vir         Constraints virial.
186  * \param[in]  force_vir         Force virial.
187  * \param[in]  pres              Pressure tensor.
188  * \param[in]  M                 Parrinello-Rahman velocity scaling matrix.
189  * \param[in]  lastbox           Last recorded PBC box.
190  * \param[in]  do_log            Do logging on this step.
191  * \param[in]  do_ene            Print energies on this step.
192  * \param[in]  bGStat            Collect globals this step.
193  * \param[out] bSumEkinhOld      Old kinetic energies need to be summed up.
194  * \param[in]  f                 Force buffers.
195  * \param[in]  cbuf              Buffer to store intermediate coordinates
196  * \param[in]  upd               Update object.
197  * \param[in]  constr            Constraints object.
198  * \param[in]  nullSignaller     Simulation signaller.
199  * \param[in]  trotter_seq       NPT variables.
200  * \param[in]  nrnb              Cycle counters.
201  * \param[in]  wcycle            Wall-clock cycle counter.
202  */
203 void integrateVVSecondStep(int64_t                                  step,
204                            const t_inputrec*                        ir,
205                            t_forcerec*                              fr,
206                            t_commrec*                               cr,
207                            t_state*                                 state,
208                            t_mdatoms*                               mdatoms,
209                            const t_fcdata&                          fcdata,
210                            t_extmass*                               MassQ,
211                            t_vcm*                                   vcm,
212                            pull_t*                                  pull_work,
213                            gmx_enerdata_t*                          enerd,
214                            gmx_ekindata_t*                          ekind,
215                            gmx_global_stat*                         gstat,
216                            real*                                    dvdl_constr,
217                            bool                                     bCalcVir,
218                            tensor                                   total_vir,
219                            tensor                                   shake_vir,
220                            tensor                                   force_vir,
221                            tensor                                   pres,
222                            matrix                                   M,
223                            matrix                                   lastbox,
224                            bool                                     do_log,
225                            bool                                     do_ene,
226                            bool                                     bGStat,
227                            bool*                                    bSumEkinhOld,
228                            gmx::ForceBuffers*                       f,
229                            std::vector<gmx::RVec>*                  cbuf,
230                            gmx::Update*                             upd,
231                            gmx::Constraints*                        constr,
232                            gmx::SimulationSignaller*                nullSignaller,
233                            std::array<std::vector<int>, ettTSEQMAX> trotter_seq,
234                            t_nrnb*                                  nrnb,
235                            gmx_wallcycle*                           wcycle);
236
237
238 #endif // GMX_MDLIB_UPDATE_VV_H