#include "txtdump.h"
#include "vec.h"
#include "network.h"
-#include "gromacs/random/random.h"
#include "checkpoint.h"
#include "main.h"
#include "string2.h"
static int do_cpt_state(XDR *xd, gmx_bool bRead,
int fflags, t_state *state,
- gmx_bool bReadRNG, FILE *list)
+ FILE *list)
{
int sflags;
- int **rng_p, **rngi_p;
int i;
int ret;
int nnht, nnhtp;
nnht = state->nhchainlength*state->ngtc;
nnhtp = state->nhchainlength*state->nnhpres;
- if (bReadRNG)
- {
- rng_p = (int **)&state->ld_rng;
- rngi_p = &state->ld_rngi;
- }
- else
- {
- /* Do not read the RNG data */
- rng_p = NULL;
- rngi_p = NULL;
- }
-
if (bRead) /* we need to allocate space for dfhist if we are reading */
{
init_df_history(&state->dfhist, state->dfhist.nlambda);
}
- /* We want the MC_RNG the same across all the notes for now -- lambda MC is global */
-
sflags = state->flags;
for (i = 0; (i < estNR && ret == 0); i++)
{
case estX: ret = do_cpte_rvecs(xd, cptpEST, i, sflags, state->natoms, &state->x, list); break;
case estV: ret = do_cpte_rvecs(xd, cptpEST, i, sflags, state->natoms, &state->v, list); break;
case estSDX: ret = do_cpte_rvecs(xd, cptpEST, i, sflags, state->natoms, &state->sd_X, list); break;
- case estLD_RNG: ret = do_cpte_ints(xd, cptpEST, i, sflags, state->nrng, rng_p, list); break;
- case estLD_RNGI: ret = do_cpte_ints(xd, cptpEST, i, sflags, state->nrngi, rngi_p, list); break;
- case estMC_RNG: ret = do_cpte_ints(xd, cptpEST, i, sflags, state->nmcrng, (int **)&state->mc_rng, list); break;
- case estMC_RNGI: ret = do_cpte_ints(xd, cptpEST, i, sflags, 1, &state->mc_rngi, list); break;
+ /* The RNG entries are no longer written,
+ * the next 4 lines are only for reading old files.
+ */
+ case estLD_RNG: ret = do_cpte_ints(xd, cptpEST, i, sflags, 0, NULL, list); break;
+ case estLD_RNGI: ret = do_cpte_ints(xd, cptpEST, i, sflags, 0, NULL, list); break;
+ case estMC_RNG: ret = do_cpte_ints(xd, cptpEST, i, sflags, 0, NULL, list); break;
+ case estMC_RNGI: ret = do_cpte_ints(xd, cptpEST, i, sflags, 0, NULL, list); break;
case estDISRE_INITF: ret = do_cpte_real (xd, cptpEST, i, sflags, &state->hist.disre_initf, list); break;
case estDISRE_RM3TAV: ret = do_cpte_n_reals(xd, cptpEST, i, sflags, &state->hist.ndisrepairs, &state->hist.disre_rm3tav, list); break;
case estORIRE_INITF: ret = do_cpte_real (xd, cptpEST, i, sflags, &state->hist.orire_initf, list); break;
sfree(bhost);
sfree(fprog);
- if ((do_cpt_state(gmx_fio_getxdr(fp), FALSE, state->flags, state, TRUE, NULL) < 0) ||
+ if ((do_cpt_state(gmx_fio_getxdr(fp), FALSE, state->flags, state, NULL) < 0) ||
(do_cpt_ekinstate(gmx_fio_getxdr(fp), flags_eks, &state->ekinstate, NULL) < 0) ||
(do_cpt_enerhist(gmx_fio_getxdr(fp), FALSE, flags_enh, &state->enerhist, NULL) < 0) ||
(do_cpt_df_hist(gmx_fio_getxdr(fp), flags_dfh, &state->dfhist, NULL) < 0) ||
static void read_checkpoint(const char *fn, FILE **pfplog,
t_commrec *cr, ivec dd_nc,
int eIntegrator, int *init_fep_state, gmx_int64_t *step, double *t,
- t_state *state, gmx_bool *bReadRNG, gmx_bool *bReadEkin,
+ t_state *state, gmx_bool *bReadEkin,
int *simulation_part,
gmx_bool bAppendOutputFiles, gmx_bool bForceAppend)
{
const char *int_warn =
"WARNING: The checkpoint file was generated with integrator %s,\n"
" while the simulation uses integrator %s\n\n";
- const char *sd_note =
- "NOTE: The checkpoint file was for %d nodes doing SD or BD,\n"
- " while the simulation uses %d SD or BD nodes,\n"
- " continuation will be exact, except for the random state\n\n";
#if !defined __native_client__ && !defined GMX_NATIVE_WINDOWS
fl.l_type = F_WRLCK;
nppnodes = -1;
}
- if ((EI_SD(eIntegrator) || eIntegrator == eiBD) && nppnodes > 0)
- {
- /* Correct the RNG state size for the number of PP nodes.
- * Such assignments should all be moved to one central function.
- */
- state->nrng = nppnodes*gmx_rng_n();
- state->nrngi = nppnodes;
- }
-
- *bReadRNG = TRUE;
if (fflags != state->flags)
{
}
else
{
- if ((EI_SD(eIntegrator) || eIntegrator == eiBD) &&
- nppnodes != nppnodes_f)
- {
- *bReadRNG = FALSE;
- if (MASTER(cr))
- {
- fprintf(stderr, sd_note, nppnodes_f, nppnodes);
- }
- if (fplog)
- {
- fprintf(fplog, sd_note, nppnodes_f, nppnodes);
- }
- }
if (MASTER(cr))
{
check_match(fplog, version, btime, buser, bhost, double_prec, fprog,
cr, nppnodes_f, npmenodes_f, dd_nc, dd_nc_f);
}
}
- ret = do_cpt_state(gmx_fio_getxdr(fp), TRUE, fflags, state, *bReadRNG, NULL);
+ ret = do_cpt_state(gmx_fio_getxdr(fp), TRUE, fflags, state, NULL);
*init_fep_state = state->fep_state; /* there should be a better way to do this than setting it here.
Investigate for 5.0. */
if (ret)
void load_checkpoint(const char *fn, FILE **fplog,
t_commrec *cr, ivec dd_nc,
t_inputrec *ir, t_state *state,
- gmx_bool *bReadRNG, gmx_bool *bReadEkin,
+ gmx_bool *bReadEkin,
gmx_bool bAppend, gmx_bool bForceAppend)
{
gmx_int64_t step;
/* Read the state from the checkpoint file */
read_checkpoint(fn, fplog,
cr, dd_nc,
- ir->eI, &(ir->fepvals->init_fep_state), &step, &t, state, bReadRNG, bReadEkin,
+ ir->eI, &(ir->fepvals->init_fep_state), &step, &t, state, bReadEkin,
&ir->simulation_part, bAppend, bForceAppend);
}
if (PAR(cr))
gmx_bcast(sizeof(cr->npmenodes), &cr->npmenodes, cr);
gmx_bcast(DIM*sizeof(dd_nc[0]), dd_nc, cr);
gmx_bcast(sizeof(step), &step, cr);
- gmx_bcast(sizeof(*bReadRNG), bReadRNG, cr);
gmx_bcast(sizeof(*bReadEkin), bReadEkin, cr);
}
ir->bContinuation = TRUE;
static void read_checkpoint_data(t_fileio *fp, int *simulation_part,
gmx_int64_t *step, double *t, t_state *state,
- gmx_bool bReadRNG,
int *nfiles, gmx_file_position_t **outputfiles)
{
int file_version;
&(state->dfhist.nlambda), &state->flags, &flags_eks, &flags_enh, &flags_dfh,
&state->edsamstate.nED, &state->swapstate.eSwapCoords, NULL);
ret =
- do_cpt_state(gmx_fio_getxdr(fp), TRUE, state->flags, state, bReadRNG, NULL);
+ do_cpt_state(gmx_fio_getxdr(fp), TRUE, state->flags, state, NULL);
if (ret)
{
cp_error();
t_fileio *fp;
fp = gmx_fio_open(fn, "r");
- read_checkpoint_data(fp, simulation_part, step, t, state, FALSE, NULL, NULL);
+ read_checkpoint_data(fp, simulation_part, step, t, state, NULL, NULL);
if (gmx_fio_close(fp) != 0)
{
gmx_file("Cannot read/write checkpoint; corrupt file, or maybe you are out of disk space?");
init_state(&state, 0, 0, 0, 0, 0);
- read_checkpoint_data(fp, &simulation_part, &step, &t, &state, FALSE, NULL, NULL);
+ read_checkpoint_data(fp, &simulation_part, &step, &t, &state, NULL, NULL);
fr->natoms = state.natoms;
fr->bTitle = FALSE;
&(state.dfhist.nlambda), &state.flags,
&flags_eks, &flags_enh, &flags_dfh, &state.edsamstate.nED,
&state.swapstate.eSwapCoords, out);
- ret = do_cpt_state(gmx_fio_getxdr(fp), TRUE, state.flags, &state, TRUE, out);
+ ret = do_cpt_state(gmx_fio_getxdr(fp), TRUE, state.flags, &state, out);
if (ret)
{
cp_error();
{
init_state(&state, 0, 0, 0, 0, 0);
- read_checkpoint_data(fp, simulation_part, &step, &t, &state, FALSE,
+ read_checkpoint_data(fp, simulation_part, &step, &t, &state,
&nfiles, &outputfiles);
if (gmx_fio_close(fp) != 0)
{