7d35fff357739ee74e4e84cd0ee863dadcabdcd8
[alexxy/gromacs.git] / include / update.h
1 /*
2  * $Id$
3  * 
4  *       This source code is part of
5  * 
6  *        G   R   O   M   A   C   S
7  * 
8  * GROningen MAchine for Chemical Simulations
9  * 
10  *               VERSION 2.0
11  * 
12  * Copyright (c) 1991-1999
13  * BIOSON Research Institute, Dept. of Biophysical Chemistry
14  * University of Groningen, The Netherlands
15  * 
16  * Please refer to:
17  * GROMACS: A message-passing parallel molecular dynamics implementation
18  * H.J.C. Berendsen, D. van der Spoel and R. van Drunen
19  * Comp. Phys. Comm. 91, 43-56 (1995)
20  * 
21  * Also check out our WWW page:
22  * http://md.chem.rug.nl/~gmx
23  * or e-mail to:
24  * gromacs@chem.rug.nl
25  * 
26  * And Hey:
27  * Green Red Orange Magenta Azure Cyan Skyblue
28  */
29
30 #ifndef _update_h
31 #define _update_h
32
33 static char *SRCID_update_h = "$Id$";
34
35 #ifdef HAVE_CONFIG_H
36 #include <config.h>
37 #endif
38
39 #ifdef HAVE_IDENT
40 #ident  "@(#) update.h 1.33 24 Jun 1996"
41 #endif /* HAVE_IDENT */
42
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
50 extern void update(int          natoms, /* number of atoms in simulation */
51                    int          start,
52                    int          homenr, /* number of home particles     */
53                    int          step,
54                    real         lambda, /* FEP scaling parameter */
55                    real         *dvdlambda, /* FEP stuff */
56                    t_parm       *parm,    /* input record and box stuff */
57                    real         SAfactor, /* simulated annealing factor   */
58                    t_mdatoms    *md,
59                    rvec         x[],    /* coordinates of home particles */
60                    t_graph      *graph, 
61                    rvec         force[],/* forces on home particles     */
62                    rvec         delta_f[],
63                    rvec         vold[], /* Old velocities                  */
64                    rvec         vt[],   /* velocities at whole steps */
65                    rvec         v[],    /* velocity at next halfstep    */
66                    t_topology   *top,
67                    t_groups     *grps,
68                    tensor       vir_part,
69                    t_commrec    *cr,
70                    t_nrnb       *nrnb,
71                    bool         bTYZ,
72                    bool         bDoUpdate,
73                    t_edsamyn    *edyn,
74                    t_pull       *pulldata,
75                    bool         bConstrain,
76                    bool         bNEMD);
77      
78 extern void calc_ke_part(bool bFirstStep,bool bSD,int start,int homenr,
79                          rvec vold[],rvec v[],rvec vt[],
80                          t_grpopts *opts,t_mdatoms *md,
81                          t_groups *grps,t_nrnb *nrnb,
82                          real lambda,real *dvdlambda);
83 /*
84  * Compute the partial kinetic energy for home particles;
85  * will be accumulated in the calling routine.
86  * The velocity a the whole step is obtained by averaging
87  * the velocities of minus and plus a half step,
88  * in case of Stochastic Dynamics a correction is applied.
89  * The tensor is
90  *
91  * Ekin = SUM(i) 0.5 m[i] v[i] (x) v[i]
92  *    
93  *     use v[i] = v[i] - u[i] when calculating temperature
94  *
95  * u must be accumulated already.
96  *
97  * Now also computes the contribution of the kinetic energy to the
98  * free energy
99  *
100  */
101
102 extern void calc_ke_part_visc(bool bFirstStep,int start,int homenr,
103                               matrix box,rvec x[],
104                               rvec vold[],rvec v[],rvec vt[],
105                               t_grpopts *opts,t_mdatoms *md,
106                               t_groups *grps,t_nrnb *nrnb,
107                               real lambda,real *dvdlambda);
108 /* The same as calc_ke_part, but for viscosity calculations.
109  * The cosine velocity profile is excluded from the kinetic energy.
110  * The new amplitude of the velocity profile is calculated for this
111  * node and stored in grps->cosacc.mvcos.
112  */
113
114 extern void init_sd_consts(int ngtc,real tau_t[],real dt);
115 /* Initialization of the SD constants (obviously). */
116
117 /* Routines from coupling.c to do with Temperature, Pressure and coupling
118  * algorithms.
119  */
120 extern real run_aver(real old,real cur,int step,int nmem);
121
122 extern void berendsen_tcoupl(t_grpopts *opts,t_groups *grps,
123                              real dt,real SAfactor);
124 extern void nosehoover_tcoupl(t_grpopts *opts,t_groups *grps,
125                               real dt,real SAfactor);
126 /* Compute temperature scaling. For Nose-Hoover it is done in update. */
127
128 extern real calc_temp(real ekin,real nrdf);
129 /* Calculate the temperature */
130
131 extern void calc_pres(int ePBC,matrix box,
132                       tensor ekin,tensor vir,tensor pres,real Elr);
133 /* Calculate the pressure. Unit of pressure is bar, If Elr != 0
134  * a long range correction based on Ewald/PPPM is made (see c-code)
135  */
136
137 extern void parinellorahman_pcoupl(t_inputrec *ir,int step,tensor pres,
138                                    tensor box,tensor boxv,tensor M);
139   
140 extern void berendsen_pcoupl(t_inputrec *ir,int step,tensor pres,
141                              matrix box,int start,int nr_atoms,
142                              rvec x[],unsigned short cFREEZE[],
143                              t_nrnb *nrnb,ivec nFreeze[]);
144
145 extern void correct_box(tensor box);
146                       
147 extern void correct_ekin(FILE *log,int start,int end,rvec v[],
148                          rvec vcm,real mass[],real tmass,tensor ekin);
149 /* Correct ekin for vcm */
150
151 #endif  /* _update_h */
152