Move foreign potential energy accumulation
[alexxy/gromacs.git] / src / gromacs / mdlib / force.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, 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_FORCE_H
39 #define GMX_MDLIB_FORCE_H
40
41 #include "gromacs/math/arrayrefwithpadding.h"
42 #include "gromacs/math/vectypes.h"
43 #include "gromacs/utility/arrayref.h"
44
45 class DDBalanceRegionHandler;
46 struct gmx_edsam;
47 struct gmx_enerdata_t;
48 struct gmx_enfrot;
49 struct SimulationGroups;
50 struct gmx_localtop_t;
51 struct gmx_multisim_t;
52 struct gmx_wallcycle;
53 class history_t;
54 class InteractionDefinitions;
55 struct pull_t;
56 struct t_commrec;
57 struct t_forcerec;
58 struct t_inputrec;
59 struct t_lambda;
60 struct t_mdatoms;
61 struct t_nrnb;
62
63 namespace gmx
64 {
65 class Awh;
66 class ForceOutputs;
67 class ForceWithVirial;
68 class ImdSession;
69 class MdrunScheduleWorkload;
70 class MDLogger;
71 class StepWorkload;
72 class VirtualSitesHandler;
73 } // namespace gmx
74
75 void do_force(FILE*                               log,
76               const t_commrec*                    cr,
77               const gmx_multisim_t*               ms,
78               const t_inputrec*                   inputrec,
79               gmx::Awh*                           awh,
80               gmx_enfrot*                         enforcedRotation,
81               gmx::ImdSession*                    imdSession,
82               pull_t*                             pull_work,
83               int64_t                             step,
84               t_nrnb*                             nrnb,
85               gmx_wallcycle*                      wcycle,
86               const gmx_localtop_t*               top,
87               const matrix                        box,
88               gmx::ArrayRefWithPadding<gmx::RVec> coordinates,
89               history_t*                          hist,
90               gmx::ArrayRefWithPadding<gmx::RVec> force,
91               tensor                              vir_force,
92               const t_mdatoms*                    mdatoms,
93               gmx_enerdata_t*                     enerd,
94               gmx::ArrayRef<const real>           lambda,
95               t_forcerec*                         fr,
96               gmx::MdrunScheduleWorkload*         runScheduleWork,
97               gmx::VirtualSitesHandler*           vsite,
98               rvec                                mu_tot,
99               double                              t,
100               gmx_edsam*                          ed,
101               int                                 legacyFlags,
102               const DDBalanceRegionHandler&       ddBalanceRegionHandler);
103
104 /* Communicate coordinates (if parallel).
105  * Do neighbor searching (if necessary).
106  * Calculate forces.
107  * Communicate forces (if parallel).
108  * Spread forces for vsites (if present).
109  *
110  * f is always required.
111  */
112
113
114 /* Compute listed forces, Ewald, PME corrections add when (when used).
115  *
116  * xWholeMolecules only needs to contain whole molecules when orientation
117  * restraints need to be computed and can be empty otherwise.
118  */
119 void do_force_lowlevel(t_forcerec*                               fr,
120                        const t_inputrec*                         ir,
121                        const t_commrec*                          cr,
122                        const gmx_multisim_t*                     ms,
123                        t_nrnb*                                   nrnb,
124                        gmx_wallcycle*                            wcycle,
125                        const t_mdatoms*                          md,
126                        gmx::ArrayRefWithPadding<const gmx::RVec> coordinates,
127                        gmx::ArrayRef<const gmx::RVec>            xWholeMolecules,
128                        history_t*                                hist,
129                        gmx::ForceOutputs*                        forceOutputs,
130                        gmx_enerdata_t*                           enerd,
131                        const matrix                              box,
132                        const real*                               lambda,
133                        const rvec*                               mu_tot,
134                        const gmx::StepWorkload&                  stepWork,
135                        const DDBalanceRegionHandler&             ddBalanceRegionHandler);
136 /* Call all the force routines */
137
138 #endif