Added selection examples.
[gromacs/qmmm-gamess-us.git] / include / update.h
blob128871fb187a9f29bd23e233c8395918dc12f2df
1 /*
2 *
3 * This source code is part of
4 *
5 * G R O M A C S
6 *
7 * GROningen MAchine for Chemical Simulations
8 *
9 * VERSION 3.2.0
10 * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
11 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
12 * Copyright (c) 2001-2004, The GROMACS development team,
13 * check out http://www.gromacs.org for more information.
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version 2
18 * of the License, or (at your option) any later version.
20 * If you want to redistribute modifications, please consider that
21 * scientific software is very special. Version control is crucial -
22 * bugs must be traceable. We will be happy to consider code for
23 * inclusion in the official distribution, but derived work must not
24 * be called official GROMACS. Details are found in the README & COPYING
25 * files - if they are missing, get the official version at www.gromacs.org.
27 * To help us fund GROMACS development, we humbly ask that you cite
28 * the papers on the package - you can find them in the top README file.
30 * For more info, check our website at http://www.gromacs.org
32 * And Hey:
33 * Gromacs Runs On Most of All Computer Systems
36 #ifndef _update_h
37 #define _update_h
39 #ifdef HAVE_CONFIG_H
40 #include <config.h>
41 #endif
43 #include "typedefs.h"
44 #include "mshift.h"
45 #include "tgroup.h"
46 #include "network.h"
47 #include "force.h"
48 #include "pull.h"
49 #include "gmx_random.h"
51 #ifdef __cplusplus
52 extern "C" {
53 #endif
55 /* Abstract type for stochastic dynamics */
56 typedef struct gmx_update *gmx_update_t;
58 /* Initialize the stochastic dynamics struct */
59 extern gmx_update_t init_update(FILE *fplog,t_inputrec *ir);
61 /* Store the random state from sd in state */
62 extern void get_stochd_state(gmx_update_t sd,t_state *state);
64 /* Set the random in sd from state */
65 extern 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 extern void set_deform_reference_box(gmx_update_t upd,
71 gmx_large_int_t step,matrix box);
73 extern void update_extended(FILE *fplog,
74 gmx_large_int_t step,
75 t_inputrec *inputrec,
76 t_mdatoms *md,
77 t_state *state,
78 gmx_ekindata_t *ekind,
79 matrix pcoupl_mu,
80 matrix M,
81 gmx_wallcycle_t wcycle,
82 gmx_update_t upd,
83 bool bInitStep,
84 bool bFirstHalf,
85 t_extmass *MassQ
87 /* Return TRUE if OK, FALSE in case of Shake Error */
89 extern void update_coords(FILE *fplog,
90 gmx_large_int_t step,
91 t_inputrec *inputrec, /* input record and box stuff */
92 t_mdatoms *md,
93 t_state *state,
94 rvec *f, /* forces on home particles */
95 bool bDoLR,
96 rvec *f_lr,
97 t_fcdata *fcd,
98 gmx_ekindata_t *ekind,
99 matrix M,
100 gmx_wallcycle_t wcycle,
101 gmx_update_t upd,
102 bool bInitStep,
103 int bUpdatePart,
104 t_commrec *cr, /* these shouldn't be here -- need to think about it */
105 t_nrnb *nrnb,
106 gmx_constr_t constr,
107 t_idef *idef);
109 /* Return TRUE if OK, FALSE in case of Shake Error */
111 extern void update_constraints(FILE *fplog,
112 gmx_large_int_t step,
113 real *dvdlambda, /* FEP stuff */
114 t_inputrec *inputrec, /* input record and box stuff */
115 gmx_ekindata_t *ekind,
116 t_mdatoms *md,
117 t_state *state,
118 t_graph *graph,
119 rvec force[], /* forces on home particles */
120 t_idef *idef,
121 tensor vir_part,
122 tensor vir,
123 t_commrec *cr,
124 t_nrnb *nrnb,
125 gmx_wallcycle_t wcycle,
126 gmx_update_t upd,
127 gmx_constr_t constr,
128 bool bInitStep,
129 bool bFirstHalf,
130 bool bCalcVir,
131 real vetanew);
133 /* Return TRUE if OK, FALSE in case of Shake Error */
135 extern void update_box(FILE *fplog,
136 gmx_large_int_t step,
137 t_inputrec *inputrec, /* input record and box stuff */
138 t_mdatoms *md,
139 t_state *state,
140 t_graph *graph,
141 rvec force[], /* forces on home particles */
142 matrix *scale_tot,
143 matrix pcoupl_mu,
144 t_nrnb *nrnb,
145 gmx_wallcycle_t wcycle,
146 gmx_update_t upd,
147 bool bInitStep,
148 bool bFirstHalf);
149 /* Return TRUE if OK, FALSE in case of Shake Error */
151 extern void calc_ke_part(t_state *state,t_grpopts *opts,t_mdatoms *md,
152 gmx_ekindata_t *ekind,t_nrnb *nrnb,bool bEkinAveVel, bool bSaveOld);
154 * Compute the partial kinetic energy for home particles;
155 * will be accumulated in the calling routine.
156 * The tensor is
158 * Ekin = SUM(i) 0.5 m[i] v[i] (x) v[i]
160 * use v[i] = v[i] - u[i] when calculating temperature
162 * u must be accumulated already.
164 * Now also computes the contribution of the kinetic energy to the
165 * free energy
169 extern void
170 init_ekinstate(ekinstate_t *ekinstate,t_inputrec *ir);
172 extern void
173 update_ekinstate(ekinstate_t *ekinstate,gmx_ekindata_t *ekind);
175 extern void
176 restore_ekinstate_from_state(t_commrec *cr,
177 gmx_ekindata_t *ekind,ekinstate_t *ekinstate);
179 extern void berendsen_tcoupl(t_grpopts *opts,gmx_ekindata_t *ekind,real dt);
181 extern void nosehoover_tcoupl(t_grpopts *opts,gmx_ekindata_t *ekind,real dt,
182 double xi[],double vxi[],t_extmass *MassQ);
184 extern t_state *init_bufstate(const t_state *template_state);
186 extern void destroy_bufstate(t_state *state);
188 extern void trotter_update(t_inputrec *ir,gmx_ekindata_t *ekind, gmx_enerdata_t *enerd,
189 t_state *state, tensor vir, t_mdatoms *md,
190 t_extmass *MassQ, int *trotter_seq);
192 extern int **init_npt_vars(t_inputrec *ir, t_state *state, t_extmass *Mass, bool bTrotter);
194 extern real NPT_energy(t_inputrec *ir, t_state *state, t_extmass *MassQ);
195 /* computes all the pressure/tempertature control energy terms to get a conserved energy */
197 extern void NBaroT_trotter(t_grpopts *opts, real dt,
198 double xi[],double vxi[],real *veta, t_extmass *MassQ);
200 extern void vrescale_tcoupl(t_grpopts *opts,gmx_ekindata_t *ekind,real dt,
201 double therm_integral[],
202 gmx_rng_t rng);
203 /* Compute temperature scaling. For V-rescale it is done in update. */
205 extern real vrescale_energy(t_grpopts *opts,double therm_integral[]);
206 /* Returns the V-rescale contribution to the conserved energy */
208 extern void update_annealing_target_temp(t_grpopts *opts,real t);
209 /* Set reference temp for simulated annealing at time t*/
211 extern real calc_temp(real ekin,real nrdf);
212 /* Calculate the temperature */
214 extern real calc_pres(int ePBC,int nwall,matrix box,
215 tensor ekin,tensor vir,tensor pres,real Elr);
216 /* Calculate the pressure tensor, returns the scalar pressure.
217 * The unit of pressure is bar, If Elr != 0
218 * a long range correction based on Ewald/PPPM is made (see c-code)
221 extern void parrinellorahman_pcoupl(FILE *fplog,gmx_large_int_t step,
222 t_inputrec *ir,real dt,tensor pres,
223 tensor box,tensor box_rel,tensor boxv,
224 tensor M,matrix mu,
225 bool bFirstStep);
227 extern void berendsen_pcoupl(FILE *fplog,gmx_large_int_t step,
228 t_inputrec *ir,real dt,tensor pres,matrix box,
229 matrix mu);
232 extern void berendsen_pscale(t_inputrec *ir,matrix mu,
233 matrix box,matrix box_rel,
234 int start,int nr_atoms,
235 rvec x[],unsigned short cFREEZE[],
236 t_nrnb *nrnb);
238 extern void correct_ekin(FILE *log,int start,int end,rvec v[],
239 rvec vcm,real mass[],real tmass,tensor ekin);
240 /* Correct ekin for vcm */
243 #ifdef __cplusplus
245 #endif
247 #endif /* _update_h */