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.
48 * The t_state struct should contain all the (possibly) non-static
49 * information required to define the state of the system.
50 * Currently the random seeds for SD and BD are missing.
53 /* These enums are used in flags as (1<<est...).
54 * The order of these enums should not be changed,
55 * since that affects the checkpoint (.cpt) file format.
59 estBOX, estBOX_REL, estBOXV, estPRES_PREV, estNH_XI, estTC_INT,
60 estX, estV, estSDX, estCGP, estLD_RNG, estLD_RNGI,
61 estDISRE_INITF, estDISRE_RM3TAV,
62 estORIRE_INITF, estORIRE_DTAV,
63 estSVIR_PREV, estNH_VXI, estVETA, estVOL0, estNHPRES_XI, estNHPRES_VXI, estFVIR_PREV,
64 estFEPSTATE, estMC_RNG, estMC_RNGI,
68 #define EST_DISTR(e) (!(((e) >= estLAMBDA && (e) <= estTC_INT) || ((e) >= estSVIR_PREV && (e) <= estMC_RNGI)))
70 /* The names of the state entries, defined in src/gmxlib/checkpoint.c */
71 extern const char *est_names[estNR];
75 real disre_initf; /* The scaling factor for initializing the time av. */
76 int ndisrepairs; /* The number of distance restraints */
77 real *disre_rm3tav; /* The r^-3 time averaged pair distances */
78 real orire_initf; /* The scaling factor for initializing the time av. */
79 int norire_Dtav; /* The number of matrix element in dtav (npair*5) */
80 real *orire_Dtav; /* The time averaged orientation tensors */
83 /* Struct used for checkpointing only.
84 * This struct would not be required with unlimited precision.
85 * But because of limited precision, the COM motion removal implementation
86 * can cause the kinetic energy in the MD loop to differ by a few bits from
87 * the kinetic energy one would determine from state.v.
97 double *ekinscalef_nhc;
98 double *ekinscaleh_nhc;
104 /* energy history for delta_h histograms */
107 int nndh; /* the number of energy difference lists */
108 int *ndh; /* the number in each energy difference list */
109 real **dh; /* the energy difference lists */
111 double start_time; /* the start time of these energy diff blocks */
112 double start_lambda; /* lambda at start time */
114 gmx_bool start_lambda_set; /* whether the lambda value is set. Here
115 For backward-compatibility. */
120 int nlambda; /* total number of lambda states - for history*/
122 gmx_bool bEquil; /* Have we reached equilibration */
123 int *n_at_lam; /* number of points observed at each lambda */
124 real *wl_histo; /* histogram for WL flatness determination */
125 real wl_delta; /* current wang-landau delta */
127 real *sum_weights; /* weights of the states */
128 real *sum_dg; /* free energies of the states -- not actually used for weighting, but informational */
129 real *sum_minvar; /* corrections to weights for minimum variance */
130 real *sum_variance; /* variances of the states */
132 real **accum_p; /* accumulated bennett weights for n+1 */
133 real **accum_m; /* accumulated bennett weights for n-1 */
134 real **accum_p2; /* accumulated squared bennett weights for n+1 */
135 real **accum_m2; /* accumulated squared bennett weights for n-1 */
137 real **Tij; /* transition matrix */
138 real **Tij_empirical; /* Empirical transition matrix */
144 gmx_int64_t nsteps; /* The number of steps in the history */
145 gmx_int64_t nsum; /* The nr. of steps in the ener_ave and ener_sum */
146 double * ener_ave; /* Energy term history sum to get fluctuations */
147 double * ener_sum; /* Energy term history sum to get fluctuations */
148 int nener; /* Number of energy terms in two previous arrays */
149 gmx_int64_t nsteps_sim; /* The number of steps in ener_sum_sim */
150 gmx_int64_t nsum_sim; /* The number of frames in ener_sum_sim */
151 double * ener_sum_sim; /* Energy term history sum of the whole sim */
153 delta_h_history_t *dht; /* The BAR energy differences */
159 /* If one uses essential dynamics or flooding on a group of atoms from
160 * more than one molecule, we cannot make this group whole with
161 * do_pbc_first_mtop(). We assume that the ED group has the correct PBC
162 * representation at the beginning of the simulation and keep track
163 * of the shifts to always get it into that representation.
164 * For proper restarts from a checkpoint we store the positions of the
165 * reference group at the time of checkpoint writing */
166 gmx_bool bFromCpt; /* Did we start from a checkpoint file? */
167 int nED; /* No. of ED/Flooding data sets, if <1 no ED */
168 int *nref; /* No. of atoms in i'th reference structure */
169 int *nav; /* Same for average structure */
170 rvec **old_sref; /* Positions of the reference atoms
171 at the last time step (with correct PBC
173 rvec **old_sref_p; /* Pointer to these positions */
174 rvec **old_sav; /* Same for the average positions */
182 int eSwapCoords; /* Swapping along x, y, or z-direction? */
183 int nat_req[eCompNR][eIonNR]; /* Requested ion numbers per type an comp. */
184 int *nat_req_p[eCompNR][eIonNR]; /* Pointer to this data (for .cpt writing) */
185 int nAverage; /* Use average over this many swap attempt
186 steps when determining the ion counts */
187 int inflow_netto[eCompNR][eIonNR]; /* Flux determined from the # of swaps */
188 int *inflow_netto_p[eCompNR][eIonNR]; /* Pointer to this data */
189 int *nat_past[eCompNR][eIonNR]; /* Array with nAverage entries for history */
190 int *nat_past_p[eCompNR][eIonNR]; /* Pointer points to the first entry only */
192 /* Channel flux detection, this is counting only and has no influence on whether swaps
193 * are performed or not: */
194 int fluxfromAtoB[eCompNR][eIonNR]; /* Flux determined from the split cylinders */
195 int *fluxfromAtoB_p[eCompNR][eIonNR]; /* Pointer to this data */
196 int *fluxleak; /* Flux not going through any channel */
197 int nions; /* Size of the following arrays */
198 unsigned char *comp_from; /* Ion came from which compartment? */
199 unsigned char *channel_label; /* Through which channel did this ion pass? */
201 /* To also make multimeric channel proteins whole, we save the last whole configuration of
202 * the channels in the checkpoint file. If we have no checkpoint file, we assume that the
203 * starting configuration hast the correct PBC representation after making the individual
205 gmx_bool bFromCpt; /* Did we started from a checkpoint file? */
206 int nat[eChanNR]; /* Size of xc_old_whole, i.e. the number of
207 atoms in each channel */
208 rvec *xc_old_whole[eChanNR]; /* Last known whole positions of the two
209 channels (important for multimeric ch.!) */
210 rvec **xc_old_whole_p[eChanNR]; /* Pointer to these positions */
220 int nhchainlength; /* number of nose-hoover chains */
223 int flags; /* Flags telling which entries are present */
224 int fep_state; /* indicates which of the alchemical states we are in */
225 real *lambda; /* lambda vector */
226 matrix box; /* box vector coordinates */
227 matrix box_rel; /* Relitaive box vectors to preserve shape */
228 matrix boxv; /* box velocitites for Parrinello-Rahman pcoupl */
229 matrix pres_prev; /* Pressure of the previous step for pcoupl */
230 matrix svir_prev; /* Shake virial for previous step for pcoupl */
231 matrix fvir_prev; /* Force virial of the previous step for pcoupl */
232 double *nosehoover_xi; /* for Nose-Hoover tcoupl (ngtc) */
233 double *nosehoover_vxi; /* for N-H tcoupl (ngtc) */
234 double *nhpres_xi; /* for Nose-Hoover pcoupl for barostat */
235 double *nhpres_vxi; /* for Nose-Hoover pcoupl for barostat */
236 double *therm_integral; /* for N-H/V-rescale tcoupl (ngtc) */
237 real veta; /* trotter based isotropic P-coupling */
238 real vol0; /* initial volume,required for computing NPT conserverd quantity */
239 int nalloc; /* Allocation size for x, v and sd_x when !=NULL*/
240 rvec *x; /* the coordinates (natoms) */
241 rvec *v; /* the velocities (natoms) */
242 rvec *sd_X; /* random part of the x update for stoch. dyn. */
243 rvec *cg_p; /* p vector for conjugate gradient minimization */
245 unsigned int *ld_rng; /* RNG random state */
246 int *ld_rngi; /* RNG index */
248 int nmcrng; /* number of RNG states */
249 unsigned int *mc_rng; /* lambda MC RNG random state */
250 int *mc_rngi; /* lambda MC RNG index */
252 history_t hist; /* Time history for restraints */
254 ekinstate_t ekinstate; /* The state of the kinetic energy data */
256 energyhistory_t enerhist; /* Energy history for statistics */
257 swapstate_t swapstate; /* Position swapping */
258 df_history_t dfhist; /*Free energy history for free energy analysis */
259 edsamstate_t edsamstate; /* Essential dynamics / flooding history */
261 int ddp_count; /* The DD partitioning count for this state */
262 int ddp_count_cg_gl; /* The DD part. count for index_gl */
263 int ncg_gl; /* The number of local charge groups */
264 int *cg_gl; /* The global cg number of the local cgs */
265 int cg_gl_nalloc; /* Allocation size of cg_gl; */
270 double *Qinv; /* inverse mass of thermostat -- computed from inputs, but a good place to store */
271 double *QPinv; /* inverse mass of thermostat for barostat -- computed from inputs, but a good place to store */
272 double Winv; /* Pressure mass inverse -- computed, not input, but a good place to store. Need to make a matrix later */
273 tensor Winvm; /* inverse pressure mass tensor, computed */
292 #endif /* _state_h_ */