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