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 * check out http://www.gromacs.org for more information.
7 * Copyright (c) 2012,2013, by the GROMACS development team, led by
8 * David van der Spoel, Berk Hess, Erik Lindahl, and including many
9 * others, as listed in the AUTHORS file in the top-level source
10 * directory and at http://www.gromacs.org.
12 * GROMACS is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public License
14 * as published by the Free Software Foundation; either version 2.1
15 * of the License, or (at your option) any later version.
17 * GROMACS is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Lesser General Public License for more details.
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with GROMACS; if not, see
24 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
25 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 * If you want to redistribute modifications to GROMACS, please
28 * consider that scientific software is very special. Version
29 * control is crucial - bugs must be traceable. We will be happy to
30 * consider code for inclusion in the official distribution, but
31 * derived work must not be called official GROMACS. Details are found
32 * in the README & COPYING files - if they are missing, get the
33 * official version at http://www.gromacs.org.
35 * To help us fund GROMACS development, we humbly ask that you cite
36 * the research papers on the package. Check out http://www.gromacs.org.
49 * The t_state struct should contain all the (possibly) non-static
50 * information required to define the state of the system.
51 * Currently the random seeds for SD and BD are missing.
54 /* for now, define the length of the NH chains here */
55 #define NHCHAINLENGTH 10
56 #define MAXLAMBDAS 1024
58 /* These enums are used in flags as (1<<est...).
59 * The order of these enums should not be changed,
60 * since that affects the checkpoint (.cpt) file format.
64 estBOX
, estBOX_REL
, estBOXV
, estPRES_PREV
, estNH_XI
, estTC_INT
,
65 estX
, estV
, estSDX
, estCGP
, estLD_RNG
, estLD_RNGI
,
66 estDISRE_INITF
, estDISRE_RM3TAV
,
67 estORIRE_INITF
, estORIRE_DTAV
,
68 estSVIR_PREV
, estNH_VXI
, estVETA
, estVOL0
, estNHPRES_XI
, estNHPRES_VXI
, estFVIR_PREV
,
69 estFEPSTATE
, estMC_RNG
, estMC_RNGI
,
73 #define EST_DISTR(e) (!(((e) >= estLAMBDA && (e) <= estTC_INT) || ((e) >= estSVIR_PREV && (e) <= estMC_RNGI)))
75 /* The names of the state entries, defined in src/gmxlib/checkpoint.c */
76 extern const char *est_names
[estNR
];
80 real disre_initf
; /* The scaling factor for initializing the time av. */
81 int ndisrepairs
; /* The number of distance restraints */
82 real
*disre_rm3tav
; /* The r^-3 time averaged pair distances */
83 real orire_initf
; /* The scaling factor for initializing the time av. */
84 int norire_Dtav
; /* The number of matrix element in dtav (npair*5) */
85 real
*orire_Dtav
; /* The time averaged orientation tensors */
88 /* Struct used for checkpointing only.
89 * This struct would not be required with unlimited precision.
90 * But because of limited precision, the COM motion removal implementation
91 * can cause the kinetic energy in the MD loop to differ by a few bits from
92 * the kinetic energy one would determine from state.v.
102 double *ekinscalef_nhc
;
103 double *ekinscaleh_nhc
;
109 /* energy history for delta_h histograms */
112 int nndh
; /* the number of energy difference lists */
113 int *ndh
; /* the number in each energy difference list */
114 real
**dh
; /* the energy difference lists */
116 double start_time
; /* the start time of these energy diff blocks */
117 double start_lambda
; /* lambda at start time */
119 gmx_bool start_lambda_set
; /* whether the lambda value is set. Here
120 For backward-compatibility. */
125 int nlambda
; /* total number of lambda states - for history*/
127 gmx_bool bEquil
; /* reached equilibration */
128 int *n_at_lam
; /* number of points observed at each lambda */
129 real
*wl_histo
; /* histogram for WL flatness determination */
130 real wl_delta
; /* current wang-landau delta */
132 real
*sum_weights
; /* weights of the states */
133 real
*sum_dg
; /* free energies of the states -- not actually used for weighting, but informational */
134 real
*sum_minvar
; /* corrections to weights for minimum variance */
135 real
*sum_variance
; /* variances of the states */
137 real
**accum_p
; /* accumulated bennett weights for n+1 */
138 real
**accum_m
; /* accumulated bennett weights for n-1 */
139 real
**accum_p2
; /* accumulated squared bennett weights for n+1 */
140 real
**accum_m2
; /* accumulated squared bennett weights for n-1 */
142 real
**Tij
; /* transition matrix */
143 real
**Tij_empirical
; /* Empirical transition matrix */
148 gmx_large_int_t nsteps
; /* The number of steps in the history */
149 gmx_large_int_t nsum
; /* The nr. of steps in the ener_ave and ener_sum */
150 double * ener_ave
; /* Energy term history sum to get fluctuations */
151 double * ener_sum
; /* Energy term history sum to get fluctuations */
152 int nener
; /* Number of energy terms in two previous arrays */
153 gmx_large_int_t nsteps_sim
; /* The number of steps in ener_sum_sim */
154 gmx_large_int_t nsum_sim
; /* The number of frames in ener_sum_sim */
155 double * ener_sum_sim
; /* Energy term history sum of the whole sim */
157 delta_h_history_t
*dht
; /* The BAR energy differences */
163 /* If one uses essential dynamics or flooding on a group of atoms from
164 * more than one molecule, we cannot make this group whole with
165 * do_pbc_first_mtop(). We assume that the ED group has the correct PBC
166 * representation at the beginning of the simulation and keep track
167 * of the shifts to always get it into that representation.
168 * For proper restarts from a checkpoint we store the positions of the
169 * reference group at the time of checkpoint writing */
170 gmx_bool bFromCpt
; /* Did we start from a checkpoint file? */
171 int nED
; /* No. of ED/Flooding data sets, if <1 no ED */
172 int *nref
; /* No. of atoms in i'th reference structure */
173 int *nav
; /* Same for average structure */
174 rvec
**old_sref
; /* Positions of the reference atoms
175 at the last time step (with correct PBC
177 rvec
**old_sref_p
; /* Pointer to these positions */
178 rvec
**old_sav
; /* Same for the average positions */
188 int nhchainlength
; /* number of nose-hoover chains */
191 int flags
; /* Flags telling which entries are present */
192 int fep_state
; /* indicates which of the alchemical states we are in */
193 real
*lambda
; /* lambda vector */
194 matrix box
; /* box vector coordinates */
195 matrix box_rel
; /* Relitaive box vectors to preserve shape */
196 matrix boxv
; /* box velocitites for Parrinello-Rahman pcoupl */
197 matrix pres_prev
; /* Pressure of the previous step for pcoupl */
198 matrix svir_prev
; /* Shake virial for previous step for pcoupl */
199 matrix fvir_prev
; /* Force virial of the previous step for pcoupl */
200 double *nosehoover_xi
; /* for Nose-Hoover tcoupl (ngtc) */
201 double *nosehoover_vxi
; /* for N-H tcoupl (ngtc) */
202 double *nhpres_xi
; /* for Nose-Hoover pcoupl for barostat */
203 double *nhpres_vxi
; /* for Nose-Hoover pcoupl for barostat */
204 double *therm_integral
; /* for N-H/V-rescale tcoupl (ngtc) */
205 real veta
; /* trotter based isotropic P-coupling */
206 real vol0
; /* initial volume,required for computing NPT conserverd quantity */
207 int nalloc
; /* Allocation size for x, v and sd_x when !=NULL*/
208 rvec
*x
; /* the coordinates (natoms) */
209 rvec
*v
; /* the velocities (natoms) */
210 rvec
*sd_X
; /* random part of the x update for stoch. dyn. */
211 rvec
*cg_p
; /* p vector for conjugate gradient minimization */
213 unsigned int *ld_rng
; /* RNG random state */
214 int *ld_rngi
; /* RNG index */
216 int nmcrng
; /* number of RNG states */
217 unsigned int *mc_rng
; /* lambda MC RNG random state */
218 int *mc_rngi
; /* lambda MC RNG index */
220 history_t hist
; /* Time history for restraints */
222 ekinstate_t ekinstate
; /* The state of the kinetic energy data */
224 energyhistory_t enerhist
; /* Energy history for statistics */
225 df_history_t dfhist
; /*Free energy history for free energy analysis */
226 edsamstate_t edsamstate
; /* Essential dynamics / flooding history */
228 int ddp_count
; /* The DD partitioning count for this state */
229 int ddp_count_cg_gl
; /* The DD part. count for index_gl */
230 int ncg_gl
; /* The number of local charge groups */
231 int *cg_gl
; /* The global cg number of the local cgs */
232 int cg_gl_nalloc
; /* Allocation size of cg_gl; */
237 double *Qinv
; /* inverse mass of thermostat -- computed from inputs, but a good place to store */
238 double *QPinv
; /* inverse mass of thermostat for barostat -- computed from inputs, but a good place to store */
239 double Winv
; /* Pressure mass inverse -- computed, not input, but a good place to store. Need to make a matrix later */
240 tensor Winvm
; /* inverse pressure mass tensor, computed */
259 #endif /* _state_h_ */