Removed include of types/ifunc.h from typedefs.h
[gromacs.git] / src / gromacs / legacyheaders / update.h
blob04c199f4a7b94e6840307ab693c19a9592de3e8b
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, 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.
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.
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.
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.
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.
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.
38 #ifndef _update_h
39 #define _update_h
41 #include "gromacs/legacyheaders/network.h"
42 #include "gromacs/legacyheaders/tgroup.h"
43 #include "gromacs/legacyheaders/typedefs.h"
44 #include "gromacs/timing/wallcycle.h"
46 struct gmx_constr;
47 struct t_fcdata;
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
53 struct t_graph;
55 /* Abstract type for stochastic dynamics */
56 typedef struct gmx_update *gmx_update_t;
58 /* Initialize the stochastic dynamics struct */
59 gmx_update_t init_update(t_inputrec *ir);
61 /* Store the random state from sd in state */
62 void get_stochd_state(gmx_update_t sd, t_state *state);
64 /* Set the random in sd from state */
65 void set_stochd_state(gmx_update_t sd, t_state *state);
67 /* Store the box at step step
68 * as a reference state for simulations with box deformation.
70 void set_deform_reference_box(gmx_update_t upd,
71 gmx_int64_t step, matrix box);
73 void update_tcouple(gmx_int64_t step,
74 t_inputrec *inputrec,
75 t_state *state,
76 gmx_ekindata_t *ekind,
77 t_extmass *MassQ,
78 t_mdatoms *md
81 void update_pcouple(FILE *fplog,
82 gmx_int64_t step,
83 t_inputrec *inputrec,
84 t_state *state,
85 matrix pcoupl_mu,
86 matrix M,
87 gmx_bool bInitStep);
89 void update_coords(FILE *fplog,
90 gmx_int64_t step,
91 t_inputrec *inputrec, /* input record and box stuff */
92 t_mdatoms *md,
93 t_state *state,
94 gmx_bool bMolPBC,
95 rvec *f, /* forces on home particles */
96 gmx_bool bDoLR,
97 rvec *f_lr,
98 tensor *vir_lr_constr,
99 t_fcdata *fcd,
100 gmx_ekindata_t *ekind,
101 matrix M,
102 gmx_update_t upd,
103 gmx_bool bInitStep,
104 int bUpdatePart,
105 t_commrec *cr, /* these shouldn't be here -- need to think about it */
106 t_nrnb *nrnb,
107 struct gmx_constr *constr,
108 t_idef *idef);
110 /* Return TRUE if OK, FALSE in case of Shake Error */
112 extern gmx_bool update_randomize_velocities(t_inputrec *ir, gmx_int64_t step, const t_commrec *cr, t_mdatoms *md, t_state *state, gmx_update_t upd, struct gmx_constr *constr);
114 void update_constraints(FILE *fplog,
115 gmx_int64_t step,
116 real *dvdlambda, /* FEP stuff */
117 t_inputrec *inputrec, /* input record and box stuff */
118 t_mdatoms *md,
119 t_state *state,
120 gmx_bool bMolPBC,
121 struct t_graph *graph,
122 rvec force[], /* forces on home particles */
123 t_idef *idef,
124 tensor vir_part,
125 t_commrec *cr,
126 t_nrnb *nrnb,
127 gmx_wallcycle_t wcycle,
128 gmx_update_t upd,
129 struct gmx_constr *constr,
130 gmx_bool bFirstHalf,
131 gmx_bool bCalcVir);
133 /* Return TRUE if OK, FALSE in case of Shake Error */
135 void update_box(FILE *fplog,
136 gmx_int64_t step,
137 t_inputrec *inputrec, /* input record and box stuff */
138 t_mdatoms *md,
139 t_state *state,
140 rvec force[], /* forces on home particles */
141 matrix pcoupl_mu,
142 t_nrnb *nrnb,
143 gmx_update_t upd);
144 /* Return TRUE if OK, FALSE in case of Shake Error */
146 void calc_ke_part(t_state *state, t_grpopts *opts, t_mdatoms *md,
147 gmx_ekindata_t *ekind, t_nrnb *nrnb, gmx_bool bEkinAveVel);
149 * Compute the partial kinetic energy for home particles;
150 * will be accumulated in the calling routine.
151 * The tensor is
153 * Ekin = SUM(i) 0.5 m[i] v[i] (x) v[i]
155 * use v[i] = v[i] - u[i] when calculating temperature
157 * u must be accumulated already.
159 * Now also computes the contribution of the kinetic energy to the
160 * free energy
165 void
166 init_ekinstate(ekinstate_t *ekinstate, const t_inputrec *ir);
168 void
169 update_ekinstate(ekinstate_t *ekinstate, gmx_ekindata_t *ekind);
171 void
172 restore_ekinstate_from_state(t_commrec *cr,
173 gmx_ekindata_t *ekind, ekinstate_t *ekinstate);
175 void berendsen_tcoupl(t_inputrec *ir, gmx_ekindata_t *ekind, real dt);
177 void andersen_tcoupl(t_inputrec *ir, gmx_int64_t step,
178 const t_commrec *cr, const t_mdatoms *md, t_state *state, real rate, const gmx_bool *randomize, const real *boltzfac);
180 void nosehoover_tcoupl(t_grpopts *opts, gmx_ekindata_t *ekind, real dt,
181 double xi[], double vxi[], t_extmass *MassQ);
183 t_state *init_bufstate(const t_state *template_state);
185 void destroy_bufstate(t_state *state);
187 void trotter_update(t_inputrec *ir, gmx_int64_t step, gmx_ekindata_t *ekind,
188 gmx_enerdata_t *enerd, t_state *state, tensor vir, t_mdatoms *md,
189 t_extmass *MassQ, int **trotter_seqlist, int trotter_seqno);
191 int **init_npt_vars(t_inputrec *ir, t_state *state, t_extmass *Mass, gmx_bool bTrotter);
193 real NPT_energy(t_inputrec *ir, t_state *state, t_extmass *MassQ);
194 /* computes all the pressure/tempertature control energy terms to get a conserved energy */
196 void NBaroT_trotter(t_grpopts *opts, real dt,
197 double xi[], double vxi[], real *veta, t_extmass *MassQ);
199 void vrescale_tcoupl(t_inputrec *ir, gmx_int64_t step,
200 gmx_ekindata_t *ekind, real dt,
201 double therm_integral[]);
202 /* Compute temperature scaling. For V-rescale it is done in update. */
204 real vrescale_energy(t_grpopts *opts, double therm_integral[]);
205 /* Returns the V-rescale contribution to the conserved energy */
207 void rescale_velocities(gmx_ekindata_t *ekind, t_mdatoms *mdatoms,
208 int start, int end, rvec v[]);
209 /* Rescale the velocities with the scaling factor in ekind */
211 void update_annealing_target_temp(t_grpopts *opts, real t);
212 /* Set reference temp for simulated annealing at time t*/
214 real calc_temp(real ekin, real nrdf);
215 /* Calculate the temperature */
217 real calc_pres(int ePBC, int nwall, matrix box, tensor ekin, tensor vir,
218 tensor pres);
219 /* Calculate the pressure tensor, returns the scalar pressure.
220 * The unit of pressure is bar.
223 void parrinellorahman_pcoupl(FILE *fplog, gmx_int64_t step,
224 t_inputrec *ir, real dt, tensor pres,
225 tensor box, tensor box_rel, tensor boxv,
226 tensor M, matrix mu,
227 gmx_bool bFirstStep);
229 void berendsen_pcoupl(FILE *fplog, gmx_int64_t step,
230 t_inputrec *ir, real dt, tensor pres, matrix box,
231 matrix mu);
234 void berendsen_pscale(t_inputrec *ir, matrix mu,
235 matrix box, matrix box_rel,
236 int start, int nr_atoms,
237 rvec x[], unsigned short cFREEZE[],
238 t_nrnb *nrnb);
240 void correct_ekin(FILE *log, int start, int end, rvec v[],
241 rvec vcm, real mass[], real tmass, tensor ekin);
242 /* Correct ekin for vcm */
245 #ifdef __cplusplus
247 #endif
249 #endif /* _update_h */