Another quick bug fix.
[gromacs/rigid-bodies.git] / include / types / state.h
blob9588212f0d67031630a6125144c571f9895347a4
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 * GRoups of Organic Molecules in ACtion for Science
35 #ifndef _state_h_
36 #define _state_h_
38 #ifdef HAVE_CONFIG_H
39 #include <config.h>
40 #endif
43 * The t_state struct should contain all the (possibly) non-static
44 * information required to define the state of the system.
45 * Currently the random seeds for SD and BD are missing.
48 /* for now, define the number of NH chains here */
49 #define NNHCHAIN 5
51 /* These enums are used in flags as (1<<est...).
52 * The order of these enums should not be changed,
53 * since that affects the checkpoint (.cpt) file format.
55 enum { estLAMBDA,
56 estBOX, estBOX_REL, estBOXV, estVIR_PREV, estPRES_PREV,
57 estNH_XI, estNH_VXI, estTC_INT, estVETA, estVOL0,
58 estX, estV, estSDX, estCGP, estLD_RNG, estLD_RNGI,
59 estDISRE_INITF, estDISRE_RM3TAV,
60 estORIRE_INITF, estORIRE_DTAV,
61 estNR };
63 /* The names of the state entries, defined in src/gmxib/checkpoint.c */
64 extern const char *est_names[estNR];
66 typedef struct
68 real disre_initf; /* The scaling factor for initializing the time av. */
69 int ndisrepairs; /* The number of distance restraints */
70 real *disre_rm3tav; /* The r^-3 time averaged pair distances */
71 real orire_initf; /* The scaling factor for initializing the time av. */
72 int norire_Dtav; /* The number of matrix element in dtav (npair*5) */
73 real *orire_Dtav; /* The time averaged orientation tensors */
74 } history_t;
76 /* Struct used for checkpointing only.
77 * This struct would not be required with unlimited precision.
78 * But because of limited precision, the COM motion removal implementation
79 * can cause the kinetic energy in the MD loop to differ by a few bits from
80 * the kinetic energy one would determine from state.v.
82 typedef struct
84 bool bUpToDate;
85 int ekinh_n;
86 int ekin_n;
87 tensor * ekinh;
88 tensor * ekin;
89 tensor ekin_total;
90 real dekindl;
91 real mvcos;
92 } ekinstate_t;
94 typedef struct
96 gmx_large_int_t nsteps; /* The number of steps in the history */
97 gmx_large_int_t nsum; /* The nr. of steps in the ener_ave and ener_sum */
98 double * ener_ave; /* Energy term history sum to get fluctuations */
99 double * ener_sum; /* Energy term history sum to get fluctuations */
100 int nener; /* Number of energy terms in two previous arrays */
101 gmx_large_int_t nsteps_sim; /* The number of steps in ener_sum_sim */
102 gmx_large_int_t nsum_sim; /* The number of frames in ener_sum_sim */
103 double * ener_sum_sim; /* Energy term history sum of the whole sim */
105 energyhistory_t;
107 typedef struct
109 int natoms;
110 int ngtc;
111 int nrng;
112 int nrngi;
113 int flags; /* Flags telling which entries are present */
114 real lambda; /* the free energy switching parameter */
115 matrix box; /* box vector coordinates */
116 matrix box_rel; /* Relitaive box vectors to preserve shape */
117 matrix boxv; /* box velocitites for Parrinello-Rahman pcoupl */
118 matrix pres_prev; /* Pressure of the previous step for pcoupl */
119 matrix vir_prev; /* Pressure of the previous step for pcoupl */
120 double *nosehoover_xi; /* for Nose-Hoover tcoupl (ngtc) */
121 double *nosehoover_vxi; /* for N-H tcoupl (ngtc) */
122 double *therm_integral; /* for N-H/V-rescale tcoupl (ngtc) */
123 real veta; /* trotter based isotropic P-coupling */
124 real vol0; /* initial volume,required for computing NPT conserverd quantity */
125 int nalloc; /* Allocation size for x, v and sd_x when !=NULL*/
126 rvec *x; /* the coordinates (natoms) */
127 rvec *v; /* the velocities (natoms) */
128 rvec *sd_X; /* random part of the x update for stoch. dyn. */
129 rvec *cg_p; /* p vector for conjugate gradient minimization */
131 unsigned int *ld_rng; /* RNG random state */
132 int *ld_rngi; /* RNG index */
134 history_t hist; /* Time history for restraints */
136 ekinstate_t ekinstate; /* The state of the kinetic energy data */
138 energyhistory_t enerhist; /* Energy history for statistics */
140 int ddp_count; /* The DD partitioning count for this state */
141 int ddp_count_cg_gl; /* The DD part. count for index_gl */
142 int ncg_gl; /* The number of local charge groups */
143 int *cg_gl; /* The global cg number of the local cgs */
144 int cg_gl_nalloc; /* Allocation size of cg_gl; */
145 } t_state;
147 typedef struct
149 double *Qinv; /* inverse mass of thermostat -- computed from inputs, but a good place to store */
150 double Winv; /* Pressure mass inverse -- computed, not input, but a good place to store. Need to make a matrix later */
151 tensor Winvm; /* inverse pressure mass tensor, computed */
152 } t_extmass;
155 typedef struct
157 real veta;
158 double rscale;
159 double vscale;
160 double rvscale;
161 double alpha;
162 double *vscale_nhc;
163 } t_vetavars;
166 #endif /* _state_h_ */