Split lines with many copyright years
[gromacs.git] / src / gromacs / mdlib / md_support.h
blob69b788df35656293d27693d58e052c98c2609e9a
1 /*
2 * This file is part of the GROMACS molecular simulation package.
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.
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.
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.
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.
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.
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.
38 #ifndef GMX_MDLIB_MD_SUPPORT_H
39 #define GMX_MDLIB_MD_SUPPORT_H
41 #include "gromacs/mdlib/vcm.h"
42 #include "gromacs/timing/wallcycle.h"
44 struct gmx_ekindata_t;
45 struct gmx_enerdata_t;
46 struct gmx_global_stat;
47 struct gmx_multisim_t;
48 struct gmx_signalling_t;
49 struct t_extmass;
50 struct t_forcerec;
51 struct t_grpopts;
52 struct t_inputrec;
53 struct t_lambda;
54 struct t_nrnb;
55 class t_state;
56 struct t_trxframe;
58 namespace gmx
60 template<typename T>
61 class ArrayRef;
62 class Constraints;
63 class MDLogger;
64 class SimulationSignaller;
65 } // namespace gmx
67 /* Define a number of flags to better control the information
68 * passed to compute_globals in md.c and global_stat.
71 /* we are computing the kinetic energy from average velocities */
72 #define CGLO_EKINAVEVEL (1u << 2u)
73 /* we are removing the center of mass momenta */
74 #define CGLO_STOPCM (1u << 3u)
75 /* bGStat is defined in do_md */
76 #define CGLO_GSTAT (1u << 4u)
77 /* Sum the energy terms in global computation */
78 #define CGLO_ENERGY (1u << 6u)
79 /* Sum the kinetic energy terms in global computation */
80 #define CGLO_TEMPERATURE (1u << 7u)
81 /* Sum the kinetic energy terms in global computation */
82 #define CGLO_PRESSURE (1u << 8u)
83 /* Sum the constraint term in global computation */
84 #define CGLO_CONSTRAINT (1u << 9u)
85 /* Reading ekin from the trajectory */
86 #define CGLO_READEKIN (1u << 10u)
87 /* we need to reset the ekin rescaling factor here */
88 #define CGLO_SCALEEKIN (1u << 11u)
89 /* After a new DD partitioning, we need to set a flag to schedule
90 * global reduction of the total number of bonded interactions that
91 * will be computed, to check none are missing. */
92 #define CGLO_CHECK_NUMBER_OF_BONDED_INTERACTIONS (1u << 12u)
95 /*! \brief Return the number of steps that will take place between
96 * intra-simulation communications, given the constraints of the
97 * inputrec. */
98 int computeGlobalCommunicationPeriod(const gmx::MDLogger& mdlog, t_inputrec* ir, const t_commrec* cr);
100 /*! \brief Return true if the \p value is equal across the set of multi-simulations
102 * \todo This duplicates some of check_multi_int. Consolidate. */
103 bool multisim_int_all_are_equal(const gmx_multisim_t* ms, int64_t value);
105 void rerun_parallel_comm(t_commrec* cr, t_trxframe* fr, gmx_bool* bLastStep);
107 //! \brief Allocate and initialize node-local state entries
108 void set_state_entries(t_state* state, const t_inputrec* ir);
110 /* Set the lambda values in the global state from a frame read with rerun */
111 void setCurrentLambdasRerun(int64_t step,
112 const t_lambda* fepvals,
113 const t_trxframe* rerun_fr,
114 const double* lam0,
115 t_state* globalState);
117 /* Set the lambda values at each step of mdrun when they change */
118 void setCurrentLambdasLocal(int64_t step,
119 const t_lambda* fepvals,
120 const double* lam0,
121 gmx::ArrayRef<real> lambda,
122 int currentFEPState);
124 int multisim_min(const gmx_multisim_t* ms, int nmin, int n);
125 /* Set an appropriate value for n across the whole multi-simulation */
128 /* Compute global variables during integration
130 * Coordinates x are needed for kinetic energy calculation with cosine accelation
131 * and for COM removal with rotational and acceleration correction modes.
132 * Velocities v are needed for kinetic energy calculation and for COM removal.
134 void compute_globals(gmx_global_stat* gstat,
135 t_commrec* cr,
136 const t_inputrec* ir,
137 t_forcerec* fr,
138 gmx_ekindata_t* ekind,
139 const rvec* x,
140 const rvec* v,
141 const matrix box,
142 real vdwLambda,
143 const t_mdatoms* mdatoms,
144 t_nrnb* nrnb,
145 t_vcm* vcm,
146 gmx_wallcycle_t wcycle,
147 gmx_enerdata_t* enerd,
148 tensor force_vir,
149 tensor shake_vir,
150 tensor total_vir,
151 tensor pres,
152 rvec mu_tot,
153 gmx::Constraints* constr,
154 gmx::SimulationSignaller* signalCoordinator,
155 const matrix lastbox,
156 int* totalNumberOfBondedInteractions,
157 gmx_bool* bSumEkinhOld,
158 int flags);
160 #endif