Eliminate mdlib/mdrun.h
[alexxy/gromacs.git] / src / gromacs / mdlib / sim_util.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,2018,2019, 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 #ifndef GMX_MDLIB_SIM_UTIL_H
38 #define GMX_MDLIB_SIM_UTIL_H
39
40 #include "gromacs/fileio/enxio.h"
41 #include "gromacs/mdlib/vcm.h"
42 #include "gromacs/timing/wallcycle.h"
43 #include "gromacs/timing/walltime_accounting.h"
44 #include "gromacs/utility/arrayref.h"
45
46 struct gmx_ekindata_t;
47 struct gmx_enerdata_t;
48 struct gmx_output_env_t;
49 struct gmx_pme_t;
50 struct nonbonded_verlet_t;
51 struct t_forcerec;
52 struct t_mdatoms;
53 struct t_nrnb;
54
55 namespace gmx
56 {
57 class BoxDeformation;
58 class Constraints;
59 class EnergyOutput;
60 class IMDOutputProvider;
61 class MDLogger;
62 class Update;
63 }
64
65 typedef struct gmx_global_stat *gmx_global_stat_t;
66
67 /*! \brief Parallellizes put_atoms_in_box()
68  *
69  * This wrapper function around put_atoms_in_box() with the ugly manual
70  * workload splitting is needed to avoid silently introducing multithreading
71  * in tools.
72  * \param[in]    ePBC   The pbc type
73  * \param[in]    box    The simulation box
74  * \param[inout] x      The coordinates of the atoms
75  */
76 void put_atoms_in_box_omp(int ePBC, const matrix box, gmx::ArrayRef<gmx::RVec> x);
77
78
79
80 /* ROUTINES from stat.c */
81 gmx_global_stat_t global_stat_init(const t_inputrec *ir);
82
83 void global_stat_destroy(gmx_global_stat_t gs);
84
85 void global_stat(const gmx_global_stat *gs,
86                  const t_commrec *cr, gmx_enerdata_t *enerd,
87                  tensor fvir, tensor svir, rvec mu_tot,
88                  const t_inputrec *inputrec,
89                  gmx_ekindata_t *ekind,
90                  const gmx::Constraints *constr, t_vcm *vcm,
91                  int nsig, real *sig,
92                  int *totalNumberOfBondedInteractions,
93                  gmx_bool bSumEkinhOld, int flags);
94 /* All-reduce energy-like quantities over cr->mpi_comm_mysim */
95
96 bool do_per_step(int64_t step, int64_t nstep);
97 /* Return TRUE if io should be done */
98
99 /* ROUTINES from sim_util.c */
100
101 /*! \brief Fills fep_state, lambda, and lam0 if needed
102  *
103  * If FEP or simulated tempering is in use:
104  *
105  *    fills non-null lam0 with the initial lambda values, and
106  *    on master rank fills fep_state and lambda.
107  *
108  * Reports the initial lambda state to the log file. */
109 void initialize_lambdas(FILE               *fplog,
110                         const t_inputrec   &ir,
111                         bool                isMaster,
112                         int                *fep_state,
113                         gmx::ArrayRef<real> lambda,
114                         double             *lam0);
115
116 void do_constrain_first(FILE *log, gmx::Constraints *constr,
117                         const t_inputrec *inputrec, const t_mdatoms *md,
118                         t_state *state);
119
120 /* Routine in sim_util.c */
121
122 gmx_bool use_GPU(const nonbonded_verlet_t *nbv);
123
124 #endif