*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2011,2012,2013, by the GROMACS development team, led by
+ * Copyright (c) 2011,2012,2013,2014, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include <math.h>
#include "repl_ex.h"
#include "network.h"
-#include "random.h"
+#include "gromacs/random/random.h"
#include "smalloc.h"
#include "physics.h"
#include "copyrite.h"
typedef struct gmx_repl_ex
{
- int repl;
- int nrepl;
- real temp;
- int type;
- real **q;
- gmx_bool bNPT;
- real *pres;
- int *ind;
- int *allswaps;
- int nst;
- int nex;
- int seed;
- int nattempt[2];
- real *prob_sum;
- int **nmoves;
- int *nexchange;
+ int repl;
+ int nrepl;
+ real temp;
+ int type;
+ real **q;
+ gmx_bool bNPT;
+ real *pres;
+ int *ind;
+ int *allswaps;
+ int nst;
+ int nex;
+ int seed;
+ int nattempt[2];
+ real *prob_sum;
+ int **nmoves;
+ int *nexchange;
+ gmx_rng_t rng;
/* these are helper arrays for replica exchange; allocated here so they
don't have to be allocated each time */
{
if (MASTERSIM(ms))
{
- re->seed = make_seed();
+ re->seed = (int)gmx_rng_make_seed();
}
else
{
}
fprintf(fplog, "\nReplica exchange interval: %d\n", re->nst);
fprintf(fplog, "\nReplica random seed: %d\n", re->seed);
+ re->rng = gmx_rng_init(re->seed);
re->nattempt[0] = 0;
re->nattempt[1] = 0;
gmx_bool bEpot = FALSE;
gmx_bool bDLambda = FALSE;
gmx_bool bVol = FALSE;
+ gmx_rng_t rng;
bMultiEx = (re->nex > 1); /* multiple exchanges at each state */
fprintf(fplog, "Replica exchange at step " "%"GMX_PRId64 " time %g\n", step, time);
probability of occurring (log p > -100) and only operate on those switches */
/* find out which state it is from, and what label that state currently has. Likely
more work that useful. */
- i0 = (int)(re->nrepl*rando(&(re->seed)));
- i1 = (int)(re->nrepl*rando(&(re->seed)));
+ i0 = (int)(re->nrepl*gmx_rng_uniform_real(re->rng));
+ i1 = (int)(re->nrepl*gmx_rng_uniform_real(re->rng));
if (i0 == i1)
{
i--;
prob[0] = exp(-delta);
}
/* roll a number to determine if accepted */
- bEx[0] = (rando(&(re->seed)) < prob[0]);
+ bEx[0] = (gmx_rng_uniform_real(re->rng) < prob[0]);
}
re->prob_sum[0] += prob[0];
prob[i] = exp(-delta);
}
/* roll a number to determine if accepted */
- bEx[i] = (rando(&(re->seed)) < prob[i]);
+ bEx[i] = (gmx_rng_uniform_real(re->rng) < prob[i]);
}
re->prob_sum[i] += prob[i];