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, 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.
50 /* Abstract type for stochastic dynamics */
51 typedef struct gmx_update *gmx_update_t;
53 /* Initialize the stochastic dynamics struct */
54 gmx_update_t init_update(t_inputrec *ir);
56 /* Store the random state from sd in state */
57 void get_stochd_state(gmx_update_t sd, t_state *state);
59 /* Set the random in sd from state */
60 void set_stochd_state(gmx_update_t sd, t_state *state);
62 /* Store the box at step step
63 * as a reference state for simulations with box deformation.
65 void set_deform_reference_box(gmx_update_t upd,
66 gmx_int64_t step, matrix box);
68 void update_tcouple(gmx_int64_t step,
71 gmx_ekindata_t *ekind,
76 void update_pcouple(FILE *fplog,
84 void update_coords(FILE *fplog,
86 t_inputrec *inputrec, /* input record and box stuff */
90 rvec *f, /* forces on home particles */
94 gmx_ekindata_t *ekind,
99 t_commrec *cr, /* these shouldn't be here -- need to think about it */
104 /* Return TRUE if OK, FALSE in case of Shake Error */
106 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, gmx_constr_t constr);
108 void update_constraints(FILE *fplog,
110 real *dvdlambda, /* FEP stuff */
111 t_inputrec *inputrec, /* input record and box stuff */
112 gmx_ekindata_t *ekind,
117 rvec force[], /* forces on home particles */
122 gmx_wallcycle_t wcycle,
129 /* Return TRUE if OK, FALSE in case of Shake Error */
131 void update_box(FILE *fplog,
133 t_inputrec *inputrec, /* input record and box stuff */
136 rvec force[], /* forces on home particles */
141 /* Return TRUE if OK, FALSE in case of Shake Error */
143 void calc_ke_part(t_state *state, t_grpopts *opts, t_mdatoms *md,
144 gmx_ekindata_t *ekind, t_nrnb *nrnb, gmx_bool bEkinAveVel, gmx_bool bSaveOld);
146 * Compute the partial kinetic energy for home particles;
147 * will be accumulated in the calling routine.
150 * Ekin = SUM(i) 0.5 m[i] v[i] (x) v[i]
152 * use v[i] = v[i] - u[i] when calculating temperature
154 * u must be accumulated already.
156 * Now also computes the contribution of the kinetic energy to the
163 init_ekinstate(ekinstate_t *ekinstate, const t_inputrec *ir);
166 update_ekinstate(ekinstate_t *ekinstate, gmx_ekindata_t *ekind);
169 restore_ekinstate_from_state(t_commrec *cr,
170 gmx_ekindata_t *ekind, ekinstate_t *ekinstate);
172 void berendsen_tcoupl(t_inputrec *ir, gmx_ekindata_t *ekind, real dt);
174 void andersen_tcoupl(t_inputrec *ir, gmx_int64_t step,
175 const t_commrec *cr, const t_mdatoms *md, t_state *state, real rate, const gmx_bool *randomize, const real *boltzfac);
177 void nosehoover_tcoupl(t_grpopts *opts, gmx_ekindata_t *ekind, real dt,
178 double xi[], double vxi[], t_extmass *MassQ);
180 t_state *init_bufstate(const t_state *template_state);
182 void destroy_bufstate(t_state *state);
184 void trotter_update(t_inputrec *ir, gmx_int64_t step, gmx_ekindata_t *ekind,
185 gmx_enerdata_t *enerd, t_state *state, tensor vir, t_mdatoms *md,
186 t_extmass *MassQ, int **trotter_seqlist, int trotter_seqno);
188 int **init_npt_vars(t_inputrec *ir, t_state *state, t_extmass *Mass, gmx_bool bTrotter);
190 real NPT_energy(t_inputrec *ir, t_state *state, t_extmass *MassQ);
191 /* computes all the pressure/tempertature control energy terms to get a conserved energy */
193 void NBaroT_trotter(t_grpopts *opts, real dt,
194 double xi[], double vxi[], real *veta, t_extmass *MassQ);
196 void vrescale_tcoupl(t_inputrec *ir, gmx_int64_t step,
197 gmx_ekindata_t *ekind, real dt,
198 double therm_integral[]);
199 /* Compute temperature scaling. For V-rescale it is done in update. */
201 real vrescale_energy(t_grpopts *opts, double therm_integral[]);
202 /* Returns the V-rescale contribution to the conserved energy */
204 void rescale_velocities(gmx_ekindata_t *ekind, t_mdatoms *mdatoms,
205 int start, int end, rvec v[]);
206 /* Rescale the velocities with the scaling factor in ekind */
208 void update_annealing_target_temp(t_grpopts *opts, real t);
209 /* Set reference temp for simulated annealing at time t*/
211 real calc_temp(real ekin, real nrdf);
212 /* Calculate the temperature */
214 real calc_pres(int ePBC, int nwall, matrix box, tensor ekin, tensor vir,
216 /* Calculate the pressure tensor, returns the scalar pressure.
217 * The unit of pressure is bar.
220 void parrinellorahman_pcoupl(FILE *fplog, gmx_int64_t step,
221 t_inputrec *ir, real dt, tensor pres,
222 tensor box, tensor box_rel, tensor boxv,
224 gmx_bool bFirstStep);
226 void berendsen_pcoupl(FILE *fplog, gmx_int64_t step,
227 t_inputrec *ir, real dt, tensor pres, matrix box,
231 void berendsen_pscale(t_inputrec *ir, matrix mu,
232 matrix box, matrix box_rel,
233 int start, int nr_atoms,
234 rvec x[], unsigned short cFREEZE[],
237 void correct_ekin(FILE *log, int start, int end, rvec v[],
238 rvec vcm, real mass[], real tmass, tensor ekin);
239 /* Correct ekin for vcm */
246 #endif /* _update_h */