\gromacs{} can be compiled for any distribution of Linux, Mac OS X,
Windows (native, Cygwin or MinGW), BlueGene, Cray and many other
architectures. Technically, it can be compiled on any platform with
-an ANSI C89 compiler, an ISO C++98 compiler, and supporting libraries,
+an ANSI C99 compiler, an ISO C++98 compiler, and supporting libraries,
such as the GNU C library. However, \gromacs{} also comes with many
hardware-specific extensions to provide very high performance on those
platforms, and to enable these we have slightly more specific
requirements since old compilers do not support new features, or they
-can be buggy.
+can be buggy. Not all of the C99 standard is required and some C89
+compilers (including Microsoft Visual C) will also be able to compile
+Gromacs.
\subsection{Compiler}
}
/* Same as above, but for large integer values */
-static gmx_large_int_t istepscan(int argc, char *argv[], int *i)
+static gmx_int64_t istepscan(int argc, char *argv[], int *i)
{
const char *const arg = argv[*i];
if (argc <= (*i)+1)
}
const char *const value = argv[++(*i)];
char *endptr;
- gmx_large_int_t var = str_to_large_int_t(value, &endptr);
+ gmx_int64_t var = str_to_int64_t(value, &endptr);
if (*value == '\0' || *endptr != '\0')
{
usage("an integer", arg);
{
void *v; /* This is a nasty workaround, to be able to use initialized */
int *i; /* arrays */
- gmx_large_int_t *is;
+ gmx_int64_t *is;
real *r;
const char **c; /* Must be pointer to string (when type == etSTR) */
/* or null terminated list of enums (when type == etENUM) */
sprintf(buf, "%-d", *(pa->u.i));
break;
case etGMX_LARGE_INT:
- sprintf(buf, gmx_large_int_pfmt, *(pa->u.is));
+ sprintf(buf, "%" GMX_PRId64, *(pa->u.is));
break;
case etTIME:
case etREAL:
float* fval;
double* dval;
int* ival;
- gmx_large_int_t* lval;
+ gmx_int64_t* lval;
unsigned char* cval;
char** sval;
/* The frames that are read/written */
typedef struct {
double t; /* Timestamp of this frame */
- gmx_large_int_t step; /* MD step */
- gmx_large_int_t nsteps; /* The number of steps between frames */
+ gmx_int64_t step; /* MD step */
+ gmx_int64_t nsteps; /* The number of steps between frames */
double dt; /* The MD time step */
int nsum; /* The number of terms for the sums in ener */
int nre; /* Number of energies */
typedef __int64 gmx_off_t;
# define SIZEOF_GMX_OFF_T 8
#else
-/* Almost certainly 64 bits, and guaranteed to be available */
-typedef gmx_large_int_t gmx_off_t;
-# define SIZEOF_GMX_OFF_T SIZEOF_GMX_LARGE_INT
+typedef gmx_int64_t gmx_off_t;
+# define SIZEOF_GMX_OFF_T 8
#endif
const char *desc, const char *srcfile, int line);
gmx_bool gmx_fio_reade_int(t_fileio *fio, int *item,
const char *desc, const char *srcfile, int line);
-gmx_bool gmx_fio_reade_gmx_large_int(t_fileio *fio, gmx_large_int_t *item,
+gmx_bool gmx_fio_reade_gmx_large_int(t_fileio *fio, gmx_int64_t *item,
const char *desc, const char *srcfile, int line);
gmx_bool gmx_fio_reade_uchar(t_fileio *fio, unsigned char *item,
const char *desc, const char *srcfile, int line);
const char *desc, const char *srcfile, int line);
gmx_bool gmx_fio_writee_int(t_fileio *fio, int item,
const char *desc, const char *srcfile, int line);
-gmx_bool gmx_fio_writee_gmx_large_int(t_fileio *fio, gmx_large_int_t item,
+gmx_bool gmx_fio_writee_gmx_large_int(t_fileio *fio, gmx_int64_t item,
const char *desc, const char *srcfile, int line);
gmx_bool gmx_fio_writee_uchar(t_fileio *fio, unsigned char item,
const char *desc, const char *srcfile, int line);
const char *desc, const char *srcfile, int line);
gmx_bool gmx_fio_doe_int(t_fileio *fio, int *item,
const char *desc, const char *srcfile, int line);
-gmx_bool gmx_fio_doe_gmx_large_int(t_fileio *fio, gmx_large_int_t *item,
+gmx_bool gmx_fio_doe_gmx_large_int(t_fileio *fio, gmx_int64_t *item,
const char *desc, const char *srcfile, int line);
gmx_bool gmx_fio_doe_uchar(t_fileio *fio, unsigned char *item,
const char *desc, const char *srcfile, int line);
const char *desc, const char *srcfile, int line);
gmx_bool gmx_fio_nreade_int(t_fileio *fio, int *item, int n,
const char *desc, const char *srcfile, int line);
-gmx_bool gmx_fio_nreade_gmx_large_int(t_fileio *fio, gmx_large_int_t *item, int n,
+gmx_bool gmx_fio_nreade_gmx_large_int(t_fileio *fio, gmx_int64_t *item, int n,
const char *desc, const char *srcfile,
int line);
gmx_bool gmx_fio_nreade_uchar(t_fileio *fio, unsigned char *item, int n,
gmx_bool gmx_fio_nwritee_int(t_fileio *fio, const int *item, int n,
const char *desc, const char *srcfile, int line);
gmx_bool gmx_fio_nwritee_gmx_large_int(t_fileio *fio,
- const gmx_large_int_t *item, int n,
+ const gmx_int64_t *item, int n,
const char *desc, const char *srcfile,
int line);
gmx_bool gmx_fio_nwritee_uchar(t_fileio *fio, const unsigned char *item, int n,
const char *desc, const char *srcfile, int line);
gmx_bool gmx_fio_ndoe_int(t_fileio *fio, int *item, int n,
const char *desc, const char *srcfile, int line);
-gmx_bool gmx_fio_ndoe_gmx_large_int(t_fileio *fio, gmx_large_int_t *item, int n,
+gmx_bool gmx_fio_ndoe_gmx_large_int(t_fileio *fio, gmx_int64_t *item, int n,
const char *desc, const char *srcfile,
int line);
gmx_bool gmx_fio_ndoe_uchar(t_fileio *fio, unsigned char *item, int n,
buf));
break;
case eioGMX_LARGE_INT:
- sprintf(strbuf, "%s%s%s", "%", gmx_large_int_fmt, "\n");
- res = fprintf(fp, strbuf, *((gmx_large_int_t *) item),
+ sprintf(strbuf, "%s%s%s", "%", GMX_PRId64, "\n");
+ res = fprintf(fp, strbuf, *((gmx_int64_t *) item),
gmx_fio_dbgstr(fio, desc, buf));
break;
case eioUCHAR:
{
FILE *fp = fio->fp;
int i, m, res = 0, *iptr, ix;
- gmx_large_int_t s;
+ gmx_int64_t s;
double d, x;
real *ptr;
unsigned char uc, *ucptr;
break;
case eioGMX_LARGE_INT:
res = sscanf(next_item(fp, ni_buf, NEXT_ITEM_BUF_LEN),
- gmx_large_int_pfmt, &s);
+ "%"GMX_SCNd64, &s);
if (item)
{
- *((gmx_large_int_t *) item) = s;
+ *((gmx_int64_t *) item) = s;
}
break;
case eioUCHAR:
size = sizeof(int);
break;
case eioGMX_LARGE_INT:
- size = sizeof(gmx_large_int_t);
+ size = sizeof(gmx_int64_t);
break;
case eioUCHAR:
size = sizeof(unsigned char);
size = sizeof(int);
break;
case eioGMX_LARGE_INT:
- size = sizeof(gmx_large_int_t);
+ size = sizeof(gmx_int64_t);
break;
case eioUCHAR:
size = sizeof(unsigned char);
return ret;
}
-gmx_bool gmx_fio_reade_gmx_large_int(t_fileio *fio, gmx_large_int_t *item,
+gmx_bool gmx_fio_reade_gmx_large_int(t_fileio *fio, gmx_int64_t *item,
const char *desc, const char *srcfile, int line)
{
gmx_bool ret;
return ret;
}
-gmx_bool gmx_fio_writee_gmx_large_int(t_fileio *fio, gmx_large_int_t item,
+gmx_bool gmx_fio_writee_gmx_large_int(t_fileio *fio, gmx_int64_t item,
const char *desc, const char *srcfile, int line)
{
gmx_bool ret;
return ret;
}
-gmx_bool gmx_fio_doe_gmx_large_int(t_fileio *fio, gmx_large_int_t *item,
+gmx_bool gmx_fio_doe_gmx_large_int(t_fileio *fio, gmx_int64_t *item,
const char *desc, const char *srcfile, int line)
{
gmx_bool ret;
return ret;
}
-gmx_bool gmx_fio_nreade_gmx_large_int(t_fileio *fio, gmx_large_int_t *item, int n,
+gmx_bool gmx_fio_nreade_gmx_large_int(t_fileio *fio, gmx_int64_t *item, int n,
const char *desc, const char *srcfile, int line)
{
gmx_bool ret = TRUE;
}
gmx_bool gmx_fio_nwritee_gmx_large_int(t_fileio *fio,
- const gmx_large_int_t *item, int n,
+ const gmx_int64_t *item, int n,
const char *desc, const char *srcfile, int line)
{
gmx_bool ret = TRUE;
-gmx_bool gmx_fio_ndoe_gmx_large_int(t_fileio *fio, gmx_large_int_t *item, int n,
+gmx_bool gmx_fio_ndoe_gmx_large_int(t_fileio *fio, gmx_int64_t *item, int n,
const char *desc, const char *srcfile, int line)
{
gmx_bool ret = TRUE;
float fvec[DIM];
double dvec[DIM];
int j, m, *iptr, idum;
- gmx_large_int_t sdum;
+ gmx_int64_t sdum;
real *ptr;
unsigned short us;
double d = 0;
}
break;
case eioGMX_LARGE_INT:
- /* do_xdr will not generate a warning when a 64bit gmx_large_int_t
- * value that is out of 32bit range is read into a 32bit gmx_large_int_t.
- */
if (item && !fio->bRead)
{
- sdum = *(gmx_large_int_t *) item;
+ sdum = *(gmx_int64_t *) item;
}
res = xdr_gmx_large_int(fio->xdr, &sdum);
if (item)
{
- *(gmx_large_int_t *) item = sdum;
+ *(gmx_int64_t *) item = sdum;
}
break;
case eioUCHAR:
t_commrec *cr,
int nfile,
const t_filenm fnm[],
- gmx_large_int_t step,
- gmx_large_int_t step_rel,
+ gmx_int64_t step,
+ gmx_int64_t step_rel,
double t,
t_inputrec *ir,
t_state *state,
t_commrec *cr,
int nfile,
const t_filenm fnm[],
- gmx_large_int_t step,
- gmx_large_int_t step_rel,
+ gmx_int64_t step,
+ gmx_int64_t step_rel,
double t,
t_inputrec *ir,
t_state *state,
gmx_mdoutf_t *of,
int mdof_flags,
gmx_mtop_t *top_global,
- gmx_large_int_t step, double t,
+ gmx_int64_t step, double t,
t_state *state_local, t_state *state_global,
rvec *f_local, rvec *f_global,
int *n_xtc, rvec **x_xtc);
gmx_mdoutf_t *of,
int mdof_flags,
gmx_mtop_t *top_global,
- gmx_large_int_t step, double t,
+ gmx_int64_t step, double t,
t_state *state_local, t_state *state_global,
rvec *f_local, rvec *f_global,
int *n_xtc, rvec **x_xtc)
#endif
}
-int xdr_gmx_large_int(XDR *xdrs, gmx_large_int_t *i)
+int xdr_gmx_large_int(XDR *xdrs, gmx_int64_t *i)
{
/* This routine stores values compatible with xdr_int64_t */
int imaj, imin;
int ret;
-#if ((defined SIZEOF_GMX_LARGE_INT) && SIZEOF_GMX_LARGE_INT == 8)
- static const gmx_large_int_t two_p32_m1 = 0xFFFFFFFF;
- gmx_large_int_t imaj64, imin64;
+ static const gmx_int64_t two_p32_m1 = 0xFFFFFFFF;
+ gmx_int64_t imaj64, imin64;
imaj64 = ((*i)>>32) & two_p32_m1;
imin64 = (*i) & two_p32_m1;
imaj = (int)imaj64;
imin = (int)imin64;
-#else
- /* Our code has 4 bytes, but we should make sure that this value
- * will be correctly read by 8 byte code.
- */
- if (*i >= 0)
- {
- imaj = 0;
- }
- else
- {
- imaj = -1;
- }
- imin = *i;
-#endif
- ret = xdr_int(xdrs, &imaj);
- ret = xdr_int(xdrs, &imin);
+ ret = xdr_int(xdrs, &imaj);
+ ret = xdr_int(xdrs, &imin);
-#if ((defined SIZEOF_GMX_LARGE_INT) && SIZEOF_GMX_LARGE_INT == 8)
- *i = (((gmx_large_int_t)imaj << 32) | ((gmx_large_int_t)imin & two_p32_m1));
-#else
- *i = imin;
-
- if (warn != NULL && (imaj < -1 || imaj > 0))
- {
- fprintf(stderr, "\nWARNING during %s:\n", warn);
- fprintf(stderr, "a step value written by code supporting 64bit integers is read by code that only supports 32bit integers, out of range step value has been converted to %d\n\n", *i);
- }
-#endif
+ *i = (((gmx_int64_t)imaj << 32) | ((gmx_int64_t)imin & two_p32_m1));
return ret;
}
int xdr3drcoord(XDR *xdrs, real *fp, int *size, real *precision);
-int xdr_gmx_large_int(XDR *xdrs, gmx_large_int_t *i);
-/* Read or write a gmx_large_int_t value.
- * 32bit code reading a 64bit gmx_large_int_t value from xdrs could
- * lead to values out of int range.
+int xdr_gmx_large_int(XDR *xdrs, gmx_int64_t *i);
+/* Read or write a gmx_int64_t value.
* When warn!=NULL a warning will be written to stderr
* when a value does not fit,
* the first line is:
unsigned int *bin[2]; /* the (forward + reverse) histogram values */
double dx[2]; /* the histogram spacing. The reverse
dx is the negative of the forward dx.*/
- gmx_large_int_t x0[2]; /* the (forward + reverse) histogram start
- point(s) as int */
+ gmx_int64_t x0[2]; /* the (forward + reverse) histogram start
+ point(s) as int */
int nbin[2]; /* the (forward+reverse) number of bins */
- gmx_large_int_t sum; /* the total number of counts. Must be
- the same for forward + reverse. */
+ gmx_int64_t sum; /* the total number of counts. Must be
+ the same for forward + reverse. */
int nhist; /* number of hist datas (forward or reverse) */
double start_time, delta_time; /* start time, end time of histogram */
size_t ndu_alloc, nt_alloc; /* pre-allocated sizes */
hist_t *hist_alloc; /* allocated hist */
- gmx_large_int_t ntot; /* total number of samples */
+ gmx_int64_t ntot; /* total number of samples */
const char *filename; /* the file name this sample comes from */
} samples_t;
sample_range_t *r; /* the sample ranges */
int nsamples_alloc; /* number of allocated samples */
- gmx_large_int_t ntot; /* total number of samples in the ranges of
- this collection */
+ gmx_int64_t ntot; /* total number of samples in the ranges of
+ this collection */
struct sample_coll_t *next, *prev; /* next and previous in the list */
} sample_coll_t;
int j;
int hist_start, hist_end;
- gmx_large_int_t ntot_start;
- gmx_large_int_t ntot_end;
- gmx_large_int_t ntot_so_far;
+ gmx_int64_t ntot_start;
+ gmx_int64_t ntot_end;
+ gmx_int64_t ntot_so_far;
*sc = *sc_orig; /* just copy all fields */
/* now fix start and end fields */
/* the casts avoid possible overflows */
- ntot_start = (gmx_large_int_t)(sc_orig->ntot*(double)i/(double)ni);
- ntot_end = (gmx_large_int_t)(sc_orig->ntot*(double)(i+1)/(double)ni);
+ ntot_start = (gmx_int64_t)(sc_orig->ntot*(double)i/(double)ni);
+ ntot_end = (gmx_int64_t)(sc_orig->ntot*(double)(i+1)/(double)ni);
ntot_so_far = 0;
for (j = 0; j < sc->nsamples; j++)
{
- gmx_large_int_t ntot_add;
- gmx_large_int_t new_start, new_end;
+ gmx_int64_t ntot_add;
+ gmx_int64_t new_start, new_end;
if (sc->r[j].use)
{
for (i = 0; i < nhist; i++)
{
int nbin;
- gmx_large_int_t sum = 0;
+ gmx_int64_t sum = 0;
for (j = 0; j < s->hist->nbin[i]; j++)
{
FILE *fp, *log;
int nf, i, i1, i2, j;
- gmx_large_int_t nrms = 0;
+ gmx_int64_t nrms = 0;
matrix box;
rvec *xtps, *usextps, *x1, **xx = NULL;
else /* !bReadMat */
{
rms = init_mat(nf, method == m_diagonalize);
- nrms = ((gmx_large_int_t)nf*((gmx_large_int_t)nf-1))/2;
+ nrms = ((gmx_int64_t)nf*((gmx_int64_t)nf-1))/2;
if (!bRMSdist)
{
fprintf(stderr, "Computing %dx%d RMS deviation matrix\n", nf, nf);
rmsd = rmsdev(isize, mass, xx[i2], x1);
set_mat_entry(rms, i1, i2, rmsd);
}
- nrms -= (gmx_large_int_t) (nf-i1-1);
- fprintf(stderr, "\r# RMSD calculations left: " gmx_large_int_pfmt " ", nrms);
+ nrms -= (gmx_int64_t) (nf-i1-1);
+ fprintf(stderr, "\r# RMSD calculations left: " "%"GMX_PRId64 " ", nrms);
}
sfree(x1);
}
set_mat_entry(rms, i1, i2, rms_dist(isize, d1, d2));
}
nrms -= (nf-i1-1);
- fprintf(stderr, "\r# RMSD calculations left: " gmx_large_int_pfmt " ", nrms);
+ fprintf(stderr, "\r# RMSD calculations left: " "%"GMX_PRId64 " ", nrms);
}
/* Clean up work arrays */
for (i = 0; (i < isize); i++)
real min, max, *axis;
int ntopatoms, step;
int natoms, nat, count, nframes0, nframes, nlevels;
- gmx_large_int_t ndim, i, j, k, l;
+ gmx_int64_t ndim, i, j, k, l;
int WriteXref;
const char *fitfile, *trxfile, *ndxfile;
const char *eigvalfile, *eigvecfile, *averfile, *logfile;
snew(x, natoms);
snew(xav, natoms);
ndim = natoms*DIM;
- if (sqrt(GMX_LARGE_INT_MAX) < ndim)
+ if (sqrt(GMX_INT64_MAX) < ndim)
{
gmx_fatal(FARGS, "Number of degrees of freedoms to large for matrix.\n");
}
}
}
-static void update_ee(t_energy *lastee, gmx_large_int_t laststep,
- t_energy *startee, gmx_large_int_t startstep,
+static void update_ee(t_energy *lastee, gmx_int64_t laststep,
+ t_energy *startee, gmx_int64_t startstep,
t_energy *ee, int step,
t_energy *outee, int nre)
{
*/
if (startstep > 0)
{
- gmx_large_int_t q = laststep+step;
- gmx_large_int_t p = startstep+1;
+ gmx_int64_t q = laststep+step;
+ gmx_int64_t p = startstep+1;
prestart_esum = startee[i].esum-startee[i].e;
sigmacorr = prestart_esum-(p-1)*startee[i].e;
prestart_sigma = startee[i].eav-
}
static void update_ee_sum(int nre,
- gmx_large_int_t *ee_sum_step,
- gmx_large_int_t *ee_sum_nsteps,
- gmx_large_int_t *ee_sum_nsum,
+ gmx_int64_t *ee_sum_step,
+ gmx_int64_t *ee_sum_nsteps,
+ gmx_int64_t *ee_sum_nsum,
t_energy *ee_sum,
t_enxframe *fr, int out_step)
{
- gmx_large_int_t nsteps, nsum, fr_nsum;
+ gmx_int64_t nsteps, nsum, fr_nsum;
int i;
nsteps = *ee_sum_nsteps;
gmx_enxnm_t *enm = NULL;
#endif
t_enxframe *fr, *fro;
- gmx_large_int_t ee_sum_step = 0, ee_sum_nsteps, ee_sum_nsum;
+ gmx_int64_t ee_sum_step = 0, ee_sum_nsteps, ee_sum_nsum;
t_energy *ee_sum;
- gmx_large_int_t lastfilestep, laststep, startstep, startstep_file = 0;
+ gmx_int64_t lastfilestep, laststep, startstep, startstep_file = 0;
int noutfr;
int nre, nremax, this_nre, nfile, f, i, j, kkk, nset, *set = NULL;
double last_t;
}
else
{
- fro->nsum = gmx_large_int_to_int(ee_sum_nsum,
- "energy average summation");
+ fro->nsum = gmx_int64_to_int(ee_sum_nsum,
+ "energy average summation");
/* Copy the energy sums */
for (i = 0; i < nre; i++)
{
} enerdat_t;
typedef struct {
- gmx_large_int_t nsteps;
- gmx_large_int_t npoints;
+ gmx_int64_t nsteps;
+ gmx_int64_t npoints;
int nframes;
int *step;
int *steps;
}
typedef struct {
- gmx_large_int_t np;
+ gmx_int64_t np;
double sum;
double sav;
double sav2;
typedef struct {
int b;
ee_sum_t sum;
- gmx_large_int_t nst;
- gmx_large_int_t nst_min;
+ gmx_int64_t nst;
+ gmx_int64_t nst_min;
} ener_ee_t;
static void clear_ee_sum(ee_sum_t *ees)
{
int nb, i, f, nee;
double sum, sum2, sump, see2;
- gmx_large_int_t steps, np, p, bound_nb;
+ gmx_int64_t steps, np, p, bound_nb;
enerdat_t *ed;
exactsum_t *es;
gmx_bool bAllZero;
static void analyse_ener(gmx_bool bCorr, const char *corrfn,
gmx_bool bFee, gmx_bool bSum, gmx_bool bFluct,
gmx_bool bVisco, const char *visfn, int nmol,
- gmx_large_int_t start_step, double start_t,
- gmx_large_int_t step, double t,
+ gmx_int64_t start_step, double start_t,
+ gmx_int64_t step, double t,
double time[], real reftemp,
enerdata_t *edat,
int nset, int set[], gmx_bool *bIsEner,
real xxx, integral, intBulk, Temp = 0, Pres = 0;
real sfrac, oldfrac, diffsum, diffav, fstep, pr_aver, pr_stddev, pr_errest;
double beta = 0, expE, expEtot, *fee = NULL;
- gmx_large_int_t nsteps;
+ gmx_int64_t nsteps;
int nexact, nnotexact;
double x1m, x1mk;
int i, j, k, nout;
/* write the data */
if (nblock_hist > 0)
{
- gmx_large_int_t sum = 0;
+ gmx_int64_t sum = 0;
/* histograms */
for (i = 0; i < fr->nblock; i++)
{
if (blk->id == enxDHHIST)
{
double foreign_lambda, dx;
- gmx_large_int_t x0;
+ gmx_int64_t x0;
int nhist, derivative;
/* check the block types etc. */
int cur = 0;
#define NEXT (1-cur)
int nre, teller, teller_disre, nfr;
- gmx_large_int_t start_step;
+ gmx_int64_t start_step;
int nor = 0, nex = 0, norfr = 0, enx_i = 0;
real start_t;
real *bounds = NULL, *violaver = NULL, *oobs = NULL, *orient = NULL, *odrms = NULL;
int i, ei, nw;
real rmin2;
rvec dx;
- gmx_large_int_t maxrand;
+ gmx_int64_t maxrand;
ei = -1;
nw = *nwater;
typedef struct
{
- gmx_large_int_t orig_sim_steps; /* Number of steps to be done in the real simulation */
+ gmx_int64_t orig_sim_steps; /* Number of steps to be done in the real simulation */
int n_entries; /* Number of entries in arrays */
real volume; /* The volume of the box */
matrix recipbox; /* The reciprocal box */
return (ibox[2]*(ibox[1]*x+y)+z);
}
-static gmx_large_int_t indexn(int ndim, const int *ibox, const int *nxyz)
+static gmx_int64_t indexn(int ndim, const int *ibox, const int *nxyz)
{
- gmx_large_int_t d, dd;
+ gmx_int64_t d, dd;
int k, kk;
/* Compute index in 1-D array */
}
typedef struct {
- gmx_large_int_t index;
+ gmx_int64_t index;
real ener;
} t_minimum;
void print_minimum(FILE *fp, int num, const t_minimum *min)
{
fprintf(fp,
- "Minimum %d at index " gmx_large_int_pfmt " energy %10.3f\n",
+ "Minimum %d at index " "%"GMX_PRId64 " energy %10.3f\n",
num, min->index, min->ener);
}
double *av, *sig, cum1, cum2, cum3, cum4, db;
const char *fn_ge, *fn_ene;
output_env_t oenv;
- gmx_large_int_t num_grid_points;
+ gmx_int64_t num_grid_points;
t_filenm fnm[] = {
{ efXVG, "-f", "graph", ffREAD },
num_grid_points = ibox[0];
for (i = 1; i < nset; i++)
{
- gmx_large_int_t result;
+ gmx_int64_t result;
if (!check_int_multiply_for_overflow(num_grid_points, ibox[i], &result))
{
gmx_fatal(FARGS,
- "The number of dimensions and grid points is too large for this tool\n"
- "to handle with what it knows about the architecture upon which it\n"
- "is running. Use a different machine or consult the GROMACS mailing list.");
+ "The number of dimensions and grid points is too large for this tool.\n");
}
num_grid_points = result;
}
- /* The number of grid points fits in a gmx_large_int_t. */
+ /* The number of grid points fits in a gmx_int64_t. */
do_sham(opt2fn("-dist", NFILE, fnm), opt2fn("-bin", NFILE, fnm),
opt2fn("-lp", NFILE, fnm),
typedef struct
{
int nr_inputfiles; /* The number of tpr and mdp input files */
- gmx_large_int_t orig_sim_steps; /* Number of steps to be done in the real simulation */
- gmx_large_int_t orig_init_step; /* Init step for the real simulation */
+ gmx_int64_t orig_sim_steps; /* Number of steps to be done in the real simulation */
+ gmx_int64_t orig_init_step; /* Init step for the real simulation */
real *rcoulomb; /* The coulomb radii [0...nr_inputfiles] */
real *rvdw; /* The vdW radii */
real *rlist; /* Neighbourlist cutoff radius */
};
static int parse_logfile(const char *logfile, const char *errfile,
- t_perf *perfdata, int test_nr, int presteps, gmx_large_int_t cpt_steps,
+ t_perf *perfdata, int test_nr, int presteps, gmx_int64_t cpt_steps,
int nnodes)
{
FILE *fp;
float dum1, dum2, dum3, dum4;
int ndum;
int npme;
- gmx_large_int_t resetsteps = -1;
+ gmx_int64_t resetsteps = -1;
gmx_bool bFoundResetStr = FALSE;
gmx_bool bResetChecked = FALSE;
{
if (strstr(line, matchstrcr) != NULL)
{
- sprintf(dumstring, "step %s", gmx_large_int_pfmt);
+ sprintf(dumstring, "step %s", "%"GMX_SCNd64);
sscanf(line, dumstring, &resetsteps);
bFoundResetStr = TRUE;
if (resetsteps == presteps+cpt_steps)
}
else
{
- sprintf(dumstring, gmx_large_int_pfmt, resetsteps);
- sprintf(dumstring2, gmx_large_int_pfmt, presteps+cpt_steps);
+ sprintf(dumstring, "%"GMX_PRId64, resetsteps);
+ sprintf(dumstring2, "%"GMX_PRId64, presteps+cpt_steps);
fprintf(stderr, "WARNING: Time step counters were reset at step %s,\n"
" though they were supposed to be reset at step %s!\n",
dumstring, dumstring2);
static void modify_PMEsettings(
- gmx_large_int_t simsteps, /* Set this value as number of time steps */
- gmx_large_int_t init_step, /* Set this value as init_step */
+ gmx_int64_t simsteps, /* Set this value as number of time steps */
+ gmx_int64_t init_step, /* Set this value as init_step */
const char *fn_best_tpr, /* tpr file with the best performance */
const char *fn_sim_tpr) /* name of tpr file to be launched */
{
ir->init_step = init_step;
/* Write the tpr file which will be launched */
- sprintf(buf, "Writing optimized simulation file %s with nsteps=%s.\n", fn_sim_tpr, gmx_large_int_pfmt);
+ sprintf(buf, "Writing optimized simulation file %s with nsteps=%s.\n", fn_sim_tpr, "%"GMX_PRId64);
fprintf(stdout, buf, ir->nsteps);
fflush(stdout);
write_tpx_state(fn_sim_tpr, ir, &state, &mtop);
static void make_benchmark_tprs(
const char *fn_sim_tpr, /* READ : User-provided tpr file */
char *fn_bench_tprs[], /* WRITE: Names of benchmark tpr files */
- gmx_large_int_t benchsteps, /* Number of time steps for benchmark runs */
- gmx_large_int_t statesteps, /* Step counter in checkpoint file */
+ gmx_int64_t benchsteps, /* Number of time steps for benchmark runs */
+ gmx_int64_t statesteps, /* Step counter in checkpoint file */
real rmin, /* Minimal Coulomb radius */
real rmax, /* Maximal Coulomb radius */
real bScaleRvdw, /* Scale rvdw along with rcoulomb */
sprintf(buf, "Making benchmark tpr file%s with %s time step%s",
- *ntprs > 1 ? "s" : "", gmx_large_int_pfmt, benchsteps > 1 ? "s" : "");
+ *ntprs > 1 ? "s" : "", "%"GMX_PRId64, benchsteps > 1 ? "s" : "");
fprintf(stdout, buf, benchsteps);
if (statesteps > 0)
{
- sprintf(buf, " (adding %s steps from checkpoint file)", gmx_large_int_pfmt);
+ sprintf(buf, " (adding %s steps from checkpoint file)", "%"GMX_PRId64);
fprintf(stdout, buf, statesteps);
benchsteps += statesteps;
}
sprintf(buf, "_bench%.2d.tpr", j);
strcat(fn_bench_tprs[j], buf);
fprintf(stdout, "Writing benchmark tpr %s with nsteps=", fn_bench_tprs[j]);
- fprintf(stdout, gmx_large_int_pfmt, ir->nsteps);
+ fprintf(stdout, "%"GMX_PRId64, ir->nsteps);
if (j > 0)
{
fprintf(stdout, ", scaling factor %f\n", fac);
const t_filenm *fnm, /* List of filenames from command line */
int nfile, /* Number of files specified on the cmdl. */
int presteps, /* DLB equilibration steps, is checked */
- gmx_large_int_t cpt_steps) /* Time step counter in the checkpoint */
+ gmx_int64_t cpt_steps) /* Time step counter in the checkpoint */
{
int i, nr, k, ret, count = 0, totaltests;
int *nPMEnodes = NULL;
real maxPMEfraction,
real minPMEfraction,
int npme_fixed,
- gmx_large_int_t bench_nsteps,
+ gmx_int64_t bench_nsteps,
const t_filenm *fnm,
int nfile,
int sim_part,
if (bench_nsteps > 10000 || bench_nsteps < 100)
{
fprintf(stderr, "WARNING: steps=");
- fprintf(stderr, gmx_large_int_pfmt, bench_nsteps);
+ fprintf(stderr, "%"GMX_PRId64, bench_nsteps);
fprintf(stderr, ". Are you sure you want to perform so %s steps for each benchmark?\n", (bench_nsteps < 100) ? "few" : "many");
}
real rmin = 0.0, rmax = 0.0; /* min and max value for rcoulomb if scaling is requested */
real rcoulomb = -1.0; /* Coulomb radius as set in .tpr file */
gmx_bool bScaleRvdw = TRUE;
- gmx_large_int_t bench_nsteps = BENCHSTEPS;
- gmx_large_int_t new_sim_nsteps = -1; /* -1 indicates: not set by the user */
- gmx_large_int_t cpt_steps = 0; /* Step counter in .cpt input file */
+ gmx_int64_t bench_nsteps = BENCHSTEPS;
+ gmx_int64_t new_sim_nsteps = -1; /* -1 indicates: not set by the user */
+ gmx_int64_t cpt_steps = 0; /* Step counter in .cpt input file */
int presteps = 100; /* Do a full cycle reset after presteps steps */
gmx_bool bOverwrite = FALSE, bKeepTPR;
gmx_bool bLaunch = FALSE;
fprintf(fp, "The mdrun command is : %s\n", cmd_mdrun);
fprintf(fp, "mdrun args benchmarks : %s\n", cmd_args_bench);
fprintf(fp, "Benchmark steps : ");
- fprintf(fp, gmx_large_int_pfmt, bench_nsteps);
+ fprintf(fp, "%"GMX_PRId64, bench_nsteps);
fprintf(fp, "\n");
fprintf(fp, "dlb equilibration steps : %d\n", presteps);
if (sim_part > 1)
{
fprintf(fp, "Checkpoint time step : ");
- fprintf(fp, gmx_large_int_pfmt, cpt_steps);
+ fprintf(fp, "%"GMX_PRId64, cpt_steps);
fprintf(fp, "\n");
}
fprintf(fp, "mdrun args at launchtime: %s\n", cmd_args_launch);
{
bOverwrite = TRUE;
fprintf(stderr, "Note: Simulation input file %s will have ", opt2fn("-so", NFILE, fnm));
- fprintf(stderr, gmx_large_int_pfmt, new_sim_nsteps+cpt_steps);
+ fprintf(stderr, "%"GMX_PRId64, new_sim_nsteps+cpt_steps);
fprintf(stderr, " steps.\n");
fprintf(fp, "Simulation steps : ");
- fprintf(fp, gmx_large_int_pfmt, new_sim_nsteps);
+ fprintf(fp, "%"GMX_PRId64, new_sim_nsteps);
fprintf(fp, "\n");
}
if (repeats > 1)
int nthreads;
gmx_rng_t *trng = NULL;
#endif
- gmx_large_int_t mc = 0, max;
+ gmx_int64_t mc = 0, max;
gmx_rng_t rng = NULL;
/* allocate memory for pr */
/* Special case for setting automaticaly number of mc iterations to 1% of total number of direct iterations */
if (mcover == -1)
{
- max = (gmx_large_int_t)floor(0.5*0.01*isize*(isize-1));
+ max = (gmx_int64_t)floor(0.5*0.01*isize*(isize-1));
}
else
{
- max = (gmx_large_int_t)floor(0.5*mcover*isize*(isize-1));
+ max = (gmx_int64_t)floor(0.5*mcover*isize*(isize-1));
}
rng = gmx_rng_init(seed);
#ifdef GMX_OPENMP
pdihs_noener_simd
#endif
(nbn, idef->il[ftype].iatoms+nb0,
- idef->iparams,
- (const rvec*)x, f,
- pbc, g, lambda[efptFTYPE], md, fcd,
- global_atom_index);
+ idef->iparams,
+ (const rvec*)x, f,
+ pbc, g, lambda[efptFTYPE], md, fcd,
+ global_atom_index);
v = 0;
}
else
{
v = do_nonbonded_listed(ftype, nbn, iatoms+nb0, idef->iparams, (const rvec*)x, f, fshift,
pbc, g, lambda, dvdl, md, fr, grpp, global_atom_index);
-
+
if (bPrintSepPot)
{
fprintf(fplog, " %-5s + %-15s #%4d dVdl %12.5e\n",
t_fcdata *fcd, int *global_atom_index,
t_atomtypes gmx_unused *atype, gmx_genborn_t gmx_unused *born,
int force_flags,
- gmx_bool bPrintSepPot, gmx_large_int_t step)
+ gmx_bool bPrintSepPot, gmx_int64_t step)
{
gmx_bool bCalcEnerVir;
int i;
real dvdl_dum[efptNR];
rvec *f, *fshift;
const t_pbc *pbc_null;
- t_idef idef_fe;
+ t_idef idef_fe;
if (fr->bMolPBC)
{
}
}
-static void do_cpt_step_err(XDR *xd, const char *desc, gmx_large_int_t *i, FILE *list)
+static void do_cpt_step_err(XDR *xd, const char *desc, gmx_int64_t *i, FILE *list)
{
bool_t res = 0;
char buf[STEPSTRSIZE];
int *double_prec,
char **fprog, char **ftime,
int *eIntegrator, int *simulation_part,
- gmx_large_int_t *step, double *t,
+ gmx_int64_t *step, double *t,
int *nnodes, int *dd_nc, int *npme,
int *natoms, int *ngtc, int *nnhpres, int *nhchainlength,
int *nlambda, int *flags_state,
if (bRead) /* we need to allocate space for dfhist if we are reading */
{
- init_df_history(&state->dfhist,state->dfhist.nlambda);
+ 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 */
FILE *fplog, t_commrec *cr,
int eIntegrator, int simulation_part,
gmx_bool bExpanded, int elamstats,
- gmx_large_int_t step, double t, t_state *state)
+ gmx_int64_t step, double t, t_state *state)
{
t_fileio *fp;
int file_version;
static void read_checkpoint(const char *fn, FILE **pfplog,
t_commrec *cr, gmx_bool bPartDecomp, ivec dd_nc,
- int eIntegrator, int *init_fep_state, gmx_large_int_t *step, double *t,
+ int eIntegrator, int *init_fep_state, gmx_int64_t *step, double *t,
t_state *state, gmx_bool *bReadRNG, gmx_bool *bReadEkin,
int *simulation_part,
gmx_bool bAppendOutputFiles, gmx_bool bForceAppend)
gmx_bool *bReadRNG, gmx_bool *bReadEkin,
gmx_bool bAppend, gmx_bool bForceAppend)
{
- gmx_large_int_t step;
+ gmx_int64_t step;
double t;
if (SIMMASTER(cr))
}
static void read_checkpoint_data(t_fileio *fp, int *simulation_part,
- gmx_large_int_t *step, double *t, t_state *state,
+ gmx_int64_t *step, double *t, t_state *state,
gmx_bool bReadRNG,
int *nfiles, gmx_file_position_t **outputfiles)
{
void
read_checkpoint_state(const char *fn, int *simulation_part,
- gmx_large_int_t *step, double *t, t_state *state)
+ gmx_int64_t *step, double *t, t_state *state)
{
t_fileio *fp;
* this will all go away for 5.0. */
t_state state;
int simulation_part;
- gmx_large_int_t step;
+ gmx_int64_t step;
double t;
init_state(&state, 0, 0, 0, 0, 0);
fr->natoms = state.natoms;
fr->bTitle = FALSE;
fr->bStep = TRUE;
- fr->step = gmx_large_int_to_int(step,
- "conversion of checkpoint to trajectory");
+ fr->step = gmx_int64_to_int(step,
+ "conversion of checkpoint to trajectory");
fr->bTime = TRUE;
fr->time = t;
fr->bLambda = TRUE;
char *version, *btime, *buser, *bhost, *fprog, *ftime;
int double_prec;
int eIntegrator, simulation_part, nppnodes, npme;
- gmx_large_int_t step;
+ gmx_int64_t step;
double t;
ivec dd_nc;
t_state state;
/* This routine cannot print tons of data, since it is called before the log file is opened. */
gmx_bool read_checkpoint_simulation_part(const char *filename, int *simulation_part,
- gmx_large_int_t *cpt_step, t_commrec *cr,
+ gmx_int64_t *cpt_step, t_commrec *cr,
gmx_bool bAppendReq,
int nfile, const t_filenm fnm[],
const char *part_suffix, gmx_bool *bAddPart)
{
t_fileio *fp;
- gmx_large_int_t step = 0;
+ gmx_int64_t step = 0;
double t;
/* This next line is nasty because the sub-structures of t_state
* cannot be assumed to be zeroed (or even initialized in ways the
}
void check_multi_large_int(FILE *log, const gmx_multisim_t *ms,
- gmx_large_int_t val, const char *name,
+ gmx_int64_t val, const char *name,
gmx_bool bQuiet)
{
- gmx_large_int_t *ibuf;
+ gmx_int64_t *ibuf;
int p;
gmx_bool bCompatible;
char strbuf[255];
/* first make the format string */
snprintf(strbuf, 255, " subsystem %%d: %s\n",
- gmx_large_int_pfmt);
+ "%" GMX_PRId64);
fprintf(log, strbuf, p, ibuf[p]);
}
}
}
gmx_bool
-check_int_multiply_for_overflow(gmx_large_int_t a,
- gmx_large_int_t b,
- gmx_large_int_t *result)
+check_int_multiply_for_overflow(gmx_int64_t a,
+ gmx_int64_t b,
+ gmx_int64_t *result)
{
- gmx_large_int_t sign = 1;
+ gmx_int64_t sign = 1;
if ((0 == a) || (0 == b))
{
*result = 0;
b = -b;
sign = -sign;
}
- if (GMX_LARGE_INT_MAX / b < a)
+ if (GMX_INT64_MAX / b < a)
{
- *result = (sign > 0) ? GMX_LARGE_INT_MAX : GMX_LARGE_INT_MIN;
+ *result = (sign > 0) ? GMX_INT64_MAX : GMX_INT64_MIN;
return FALSE;
}
*result = sign * a * b;
#endif
}
-void gmx_sumli(int gmx_unused nr, gmx_large_int_t gmx_unused r[], const t_commrec gmx_unused *cr)
+void gmx_sumli(int gmx_unused nr, gmx_int64_t gmx_unused r[], const t_commrec gmx_unused *cr)
{
#ifndef GMX_MPI
gmx_call("gmx_sumli");
/* Use two step summing */
if (cr->nc.rank_intra == 0)
{
- MPI_Reduce(MPI_IN_PLACE, r, nr, GMX_MPI_LARGE_INT, MPI_SUM, 0,
+ MPI_Reduce(MPI_IN_PLACE, r, nr, MPI_INT64_T, MPI_SUM, 0,
cr->nc.comm_intra);
/* Sum with the buffers reversed */
- MPI_Allreduce(MPI_IN_PLACE, r, nr, GMX_MPI_LARGE_INT, MPI_SUM,
+ MPI_Allreduce(MPI_IN_PLACE, r, nr, MPI_INT64_T, MPI_SUM,
cr->nc.comm_inter);
}
else
{
/* This is here because of the silly MPI specification
that MPI_IN_PLACE should be put in sendbuf instead of recvbuf */
- MPI_Reduce(r, NULL, nr, GMX_MPI_LARGE_INT, MPI_SUM, 0, cr->nc.comm_intra);
+ MPI_Reduce(r, NULL, nr, MPI_INT64_T, MPI_SUM, 0, cr->nc.comm_intra);
}
- MPI_Bcast(r, nr, GMX_MPI_LARGE_INT, 0, cr->nc.comm_intra);
+ MPI_Bcast(r, nr, MPI_INT64_T, 0, cr->nc.comm_intra);
}
else
{
- MPI_Allreduce(MPI_IN_PLACE, r, nr, GMX_MPI_LARGE_INT, MPI_SUM, cr->mpi_comm_mygroup);
+ MPI_Allreduce(MPI_IN_PLACE, r, nr, MPI_INT64_T, MPI_SUM, cr->mpi_comm_mygroup);
}
#else
int i;
if (cr->nc.bUse)
{
/* Use two step summing */
- MPI_Allreduce(r, cr->mpb->libuf, nr, GMX_MPI_LARGE_INT, MPI_SUM,
+ MPI_Allreduce(r, cr->mpb->libuf, nr, MPI_INT64_T, MPI_SUM,
cr->nc.comm_intra);
if (cr->nc.rank_intra == 0)
{
/* Sum with the buffers reversed */
- MPI_Allreduce(cr->mpb->libuf, r, nr, GMX_MPI_LARGE_INT, MPI_SUM,
+ MPI_Allreduce(cr->mpb->libuf, r, nr, MPI_INT64_T, MPI_SUM,
cr->nc.comm_inter);
}
- MPI_Bcast(r, nr, GMX_MPI_LARGE_INT, 0, cr->nc.comm_intra);
+ MPI_Bcast(r, nr, MPI_INT64_T, 0, cr->nc.comm_intra);
}
else
{
- MPI_Allreduce(r, cr->mpb->libuf, nr, GMX_MPI_LARGE_INT, MPI_SUM,
+ MPI_Allreduce(r, cr->mpb->libuf, nr, MPI_INT64_T, MPI_SUM,
cr->mpi_comm_mygroup);
for (i = 0; i < nr; i++)
{
#endif
}
-void gmx_sumli_sim(int gmx_unused nr, gmx_large_int_t gmx_unused r[], const gmx_multisim_t gmx_unused *ms)
+void gmx_sumli_sim(int gmx_unused nr, gmx_int64_t gmx_unused r[], const gmx_multisim_t gmx_unused *ms)
{
#ifndef GMX_MPI
gmx_call("gmx_sumli_sim");
#else
#if defined(MPI_IN_PLACE_EXISTS)
- MPI_Allreduce(MPI_IN_PLACE, r, nr, GMX_MPI_LARGE_INT, MPI_SUM,
+ MPI_Allreduce(MPI_IN_PLACE, r, nr, MPI_INT64_T, MPI_SUM,
ms->mpi_comm_masters);
#else
/* this is thread-unsafe, but it will do for now: */
ms->mpb->libuf_alloc = nr;
srenew(ms->mpb->libuf, ms->mpb->libuf_alloc);
}
- MPI_Allreduce(r, ms->mpb->libuf, nr, GMX_MPI_LARGE_INT, MPI_SUM,
+ MPI_Allreduce(r, ms->mpb->libuf, nr, MPI_INT64_T, MPI_SUM,
ms->mpi_comm_masters);
for (i = 0; i < nr; i++)
{
}
void print_perf(FILE *out, double time_per_thread, double time_per_node,
- gmx_large_int_t nsteps, real delta_t,
+ gmx_int64_t nsteps, real delta_t,
double nbfs, double mflop)
{
real wallclocktime;
}
}
-gmx_large_int_t get_egmx_large_int(int *ninp, t_inpfile **inp,
- const char *name, gmx_large_int_t def,
- warninp_t wi)
+gmx_int64_t get_eint64(int *ninp, t_inpfile **inp,
+ const char *name, gmx_int64_t def,
+ warninp_t wi)
{
char buf[32], *ptr, warn_buf[STRLEN];
int ii;
- gmx_large_int_t ret;
+ gmx_int64_t ret;
ii = get_einp(ninp, inp, name);
if (ii == -1)
{
- sprintf(buf, gmx_large_int_pfmt, def);
+ sprintf(buf, "%"GMX_PRId64, def);
(*inp)[(*ninp)-1].value = strdup(buf);
return def;
}
else
{
- ret = str_to_large_int_t((*inp)[ii].value, &ptr);
+ ret = str_to_int64_t((*inp)[ii].value, &ptr);
if (ptr == (*inp)[ii].value)
{
sprintf(warn_buf, "Right hand side '%s' for parameter '%s' in parameter file is not an integer value\n", (*inp)[ii].value, (*inp)[ii].name);
}
#endif
-static char *gmx_large_int_str(gmx_large_int_t i, char *buf)
+static char *gmx_large_int_str(gmx_int64_t i, char *buf)
{
- sprintf(buf, gmx_large_int_pfmt, i);
+ sprintf(buf, "%"GMX_PRId64, i);
return buf;
}
gmx_fatal(errno, __FILE__, __LINE__,
"Not enough memory. Failed to malloc %s bytes for %s\n"
"(called from file %s, line %d)",
- gmx_large_int_str((gmx_large_int_t)size, cbuf),
+ gmx_large_int_str((gmx_int64_t)size, cbuf),
name, file, line);
}
(void) memset(p, 0, size);
if ((p = malloc((size_t)nelem*(size_t)elsize)) == NULL)
{
gmx_fatal(errno, __FILE__, __LINE__,
- "Not enough memory. Failed to calloc %"gmx_large_int_fmt
- " elements of size %"gmx_large_int_fmt
+ "Not enough memory. Failed to calloc %"GMX_PRId64
+ " elements of size %"GMX_PRId64
" for %s\n(called from file %s, line %d)",
- (gmx_large_int_t)nelem, (gmx_large_int_t)elsize,
+ (gmx_int64_t)nelem, (gmx_int64_t)elsize,
name, file, line);
}
memset(p, 0, (size_t) (nelem * elsize));
if ((p = calloc((size_t)nelem, (size_t)elsize)) == NULL)
{
gmx_fatal(errno, __FILE__, __LINE__,
- "Not enough memory. Failed to calloc %"gmx_large_int_fmt
- " elements of size %"gmx_large_int_fmt
+ "Not enough memory. Failed to calloc %"GMX_PRId64
+ " elements of size %"GMX_PRId64
" for %s\n(called from file %s, line %d)",
- (gmx_large_int_t)nelem, (gmx_large_int_t)elsize, name, file, line);
+ (gmx_int64_t)nelem, (gmx_int64_t)elsize, name, file, line);
}
#endif
}
gmx_fatal(errno, __FILE__, __LINE__,
"Not enough memory. Failed to realloc %s bytes for %s, %s=%x\n"
"(called from file %s, line %d)",
- gmx_large_int_str((gmx_large_int_t)size, cbuf),
+ gmx_large_int_str((gmx_int64_t)size, cbuf),
name, name, ptr, file, line);
}
#ifdef DEBUG
}
-gmx_large_int_t
-str_to_large_int_t(const char *str, char **endptr)
+gmx_int64_t
+str_to_int64_t(const char *str, char **endptr)
{
int sign = 1;
- gmx_large_int_t val = 0;
+ gmx_int64_t val = 0;
char ch;
const char *p;
#define INTTYPE 1
#include "tmpi_ops.h"
+#ifdef _MSC_VER
+#define TYPE __int64
+#else
+#define TYPE int64_t
+#endif
+#define TYPENM INT64_T
+#define INTTYPE 1
+#include "tmpi_ops.h"
+
/* These are the fundamental data types. They exist as global variables */
tmpi_dt tmpi_char = {sizeof(char), oplist_CHAR, 0, NULL, TRUE};
tmpi_dt tmpi_l_double = {sizeof(long double), oplist_L_DOUBLE, 0, NULL, TRUE};
tmpi_dt tmpi_byte = {sizeof(char), oplist_CHAR, 0, NULL, TRUE};
tmpi_dt tmpi_pointer = {sizeof(void*), NULL, 0, NULL, TRUE};
-
+tmpi_dt tmpi_int64_t = {8, oplist_INT64_T, 0, NULL, TRUE};
/* the variable types as they are referred to from MPI */
const tMPI_Datatype TMPI_POINTER = &tmpi_pointer;
+const tMPI_Datatype TMPI_INT64_T = &tmpi_int64_t;
fprintf(fp, "%-20s = %d\n", title, i);
}
-static void pr_gmx_large_int(FILE *fp, int indent, const char *title, gmx_large_int_t i)
+static void pr_gmx_large_int(FILE *fp, int indent, const char *title, gmx_int64_t i)
{
char buf[STEPSTRSIZE];
-static gmx_bool bOverAllocDD = FALSE;
+static gmx_bool bOverAllocDD = FALSE;
static tMPI_Thread_mutex_t over_alloc_mutex = TMPI_THREAD_MUTEX_INITIALIZER;
}
}
-int gmx_large_int_to_int(gmx_large_int_t step, const char *warn)
+int gmx_int64_to_int(gmx_int64_t step, const char *warn)
{
int i;
{
fprintf(stderr, "\nWARNING during %s:\n", warn);
fprintf(stderr, "step value ");
- fprintf(stderr, gmx_large_int_pfmt, step);
+ fprintf(stderr, "%"GMX_PRId64, step);
fprintf(stderr, " does not fit in int, converted to %d\n\n", i);
}
return i;
}
-char *gmx_step_str(gmx_large_int_t i, char *buf)
+char *gmx_step_str(gmx_int64_t i, char *buf)
{
- sprintf(buf, gmx_large_int_pfmt, i);
+ sprintf(buf, "%"GMX_PRId64, i);
return buf;
}
static void zero_history(history_t *hist)
{
- hist->disre_initf = 0;
- hist->ndisrepairs = 0;
+ hist->disre_initf = 0;
+ hist->ndisrepairs = 0;
hist->disre_rm3tav = NULL;
- hist->orire_initf = 0;
- hist->norire_Dtav = 0;
- hist->orire_Dtav = NULL;
+ hist->orire_initf = 0;
+ hist->norire_Dtav = 0;
+ hist->orire_Dtav = NULL;
}
static void zero_ekinstate(ekinstate_t *eks)
zero_history(&state->hist);
zero_ekinstate(&state->ekinstate);
init_energyhistory(&state->enerhist);
- init_df_history(&state->dfhist,nlambda);
+ init_df_history(&state->dfhist, nlambda);
state->ddp_count = 0;
state->ddp_count_cg_gl = 0;
state->cg_gl = NULL;
/* Currently, there should not be any difference in nlambda between the two,
but this is included for completeness for potential later functionality */
- df_dest->nlambda = df_source->nlambda;
- df_dest->bEquil = df_source->bEquil;
+ df_dest->nlambda = df_source->nlambda;
+ df_dest->bEquil = df_source->bEquil;
df_dest->wl_delta = df_source->wl_delta;
for (i = 0; i < df_dest->nlambda; i++)
{
for (j = 0; j < df_dest->nlambda; j++)
{
- df_dest->accum_p[i][j] = df_source->accum_p[i][j];
- df_dest->accum_m[i][j] = df_source->accum_m[i][j];
- df_dest->accum_p2[i][j] = df_source->accum_p2[i][j];
- df_dest->accum_m2[i][j] = df_source->accum_m2[i][j];
+ df_dest->accum_p[i][j] = df_source->accum_p[i][j];
+ df_dest->accum_m[i][j] = df_source->accum_m[i][j];
+ df_dest->accum_p2[i][j] = df_source->accum_p2[i][j];
+ df_dest->accum_m2[i][j] = df_source->accum_m2[i][j];
df_dest->Tij[i][j] = df_source->Tij[i][j];
df_dest->Tij_empirical[i][j] = df_source->Tij_empirical[i][j];
}
sfree(dfhist->sum_minvar);
sfree(dfhist->sum_variance);
- for (i=0;i<dfhist->nlambda;i++)
+ for (i = 0; i < dfhist->nlambda; i++)
{
sfree(dfhist->Tij[i]);
sfree(dfhist->Tij_empirical[i]);
t_fcdata *fcd, int *ddgatindex,
t_atomtypes *atype, gmx_genborn_t *born,
int force_flags,
- gmx_bool bPrintSepPot, gmx_large_int_t step);
+ gmx_bool bPrintSepPot, gmx_int64_t step);
/*
* The function calc_bonds() calculates all bonded force interactions.
* The "bonds" are specified as follows:
FILE *fplog, t_commrec *cr,
int eIntegrator, int simulation_part,
gmx_bool bExpanded, int elamstats,
- gmx_large_int_t step, double t,
+ gmx_int64_t step, double t,
t_state *state);
/* Loads a checkpoint from fn for run continuation.
* number of nodes was read.
*/
void read_checkpoint_state(const char *fn, int *simulation_part,
- gmx_large_int_t *step, double *t, t_state *state);
+ gmx_int64_t *step, double *t, t_state *state);
/* Read everything that can be stored in t_trxframe from a checkpoint file */
void read_checkpoint_trxframe(t_fileio *fp, t_trxframe *fr);
* needs to be added to the output file name.
*/
gmx_bool read_checkpoint_simulation_part(const char *filename, int *simulation_part,
- gmx_large_int_t *step, t_commrec *cr,
+ gmx_int64_t *step, t_commrec *cr,
gmx_bool bAppendReq,
int nfile, const t_filenm fnm[],
const char *part_suffix, gmx_bool *bAddPart);
t_inputrec *ir,
gmx_ekindata_t *ekind,
t_commrec *cr,
- gmx_large_int_t step, int delta_step,
+ gmx_int64_t step, int delta_step,
t_mdatoms *md,
rvec *x, rvec *xprime, rvec *min_proj,
gmx_bool bMolPBC, matrix box,
gmx_bool
constrain_lincs(FILE *log, gmx_bool bLog, gmx_bool bEner,
t_inputrec *ir,
- gmx_large_int_t step,
+ gmx_int64_t step,
gmx_lincsdata_t lincsd, t_mdatoms *md,
t_commrec *cr,
rvec *x, rvec *xprime, rvec *min_proj,
/* Sum the contributions to a real for each atom over the neighboring cells. */
void dd_partition_system(FILE *fplog,
- gmx_large_int_t step,
+ gmx_int64_t step,
t_commrec *cr,
gmx_bool bMasterState,
int nstglobalcomm,
gmx_bool bBCheck,
real *r_2b, real *r_mb);
-void write_dd_pdb(const char *fn, gmx_large_int_t step, const char *title,
+void write_dd_pdb(const char *fn, gmx_int64_t step, const char *title,
gmx_mtop_t *mtop,
t_commrec *cr,
int natoms, rvec x[], matrix box);
typedef struct {
int nener;
gmx_enxnm_t *enm;
- gmx_large_int_t nsteps;
- gmx_large_int_t nsum;
+ gmx_int64_t nsteps;
+ gmx_int64_t nsum;
t_energy *e;
- gmx_large_int_t nsteps_sim;
- gmx_large_int_t nsum_sim;
+ gmx_int64_t nsteps_sim;
+ gmx_int64_t nsum_sim;
t_energy *e_sim;
} t_ebin;
extern "C" {
#endif
-void do_edsam(t_inputrec *ir, gmx_large_int_t step,
+void do_edsam(t_inputrec *ir, gmx_int64_t step,
t_commrec *cr, rvec xs[], rvec v[], matrix box, gmx_edsam_t ed);
/* Essential dynamics constraints, called from constrain() */
* Should be called at every domain decomposition. */
void do_flood(t_commrec *cr, t_inputrec *ir, rvec x[], rvec force[], gmx_edsam_t ed,
- matrix box, gmx_large_int_t step, gmx_bool bNS);
+ matrix box, gmx_int64_t step, gmx_bool bNS);
/* Flooding - called from do_force() */
#ifdef __cplusplus
extern void do_force(FILE *log, t_commrec *cr,
t_inputrec *inputrec,
- gmx_large_int_t step, t_nrnb *nrnb, gmx_wallcycle_t wcycle,
+ gmx_int64_t step, t_nrnb *nrnb, gmx_wallcycle_t wcycle,
gmx_localtop_t *top,
gmx_groups_t *groups,
matrix box, rvec x[], history_t *hist,
/* Call the neighborsearcher */
extern void do_force_lowlevel(FILE *fplog,
- gmx_large_int_t step,
+ gmx_int64_t step,
t_forcerec *fr,
t_inputrec *ir,
t_idef *idef,
int val, const char *name,
gmx_bool bQuiet);
void check_multi_large_int(FILE *log, const gmx_multisim_t *ms,
- gmx_large_int_t val, const char *name,
+ gmx_int64_t val, const char *name,
gmx_bool bQuiet);
/* Check if val is the same on all processors for a mdrun -multi run
* The string name is used to print to the log file and in a fatal error
* Returns true when overflow did not occur.
*/
gmx_bool
-check_int_multiply_for_overflow(gmx_large_int_t a,
- gmx_large_int_t b,
- gmx_large_int_t *result);
+check_int_multiply_for_overflow(gmx_int64_t a,
+ gmx_int64_t b,
+ gmx_int64_t *result);
static int gmx_greatest_common_divisor(int p, int q)
{
while (q != 0)
{
tmp = q;
- q = p % q;
- p = tmp;
+ q = p % q;
+ p = tmp;
}
return p;
}
/* check which of the multisim simulations has the shortest number of
steps and return that number of nsteps */
-gmx_large_int_t get_multisim_nsteps(const t_commrec *cr,
- gmx_large_int_t nsteps);
+gmx_int64_t get_multisim_nsteps(const t_commrec *cr,
+ gmx_int64_t nsteps);
void rerun_parallel_comm(t_commrec *cr, t_trxframe *fr,
gmx_bool *bNotLastFrame);
t_extmass *MassQ);
/* set the lambda values at each step of mdrun when they change */
-void set_current_lambdas(gmx_large_int_t step, t_lambda *fepvals, gmx_bool bRerunMD,
+void set_current_lambdas(gmx_int64_t step, t_lambda *fepvals, gmx_bool bRerunMD,
t_trxframe *rerun_fr, t_state *state_global, t_state *state, double lam0[]);
int multisim_min(const gmx_multisim_t *ms, int nmin, int n);
void upd_mdebin_step(t_mdebin *md);
/* Updates only the step count in md */
-void print_ebin_header(FILE *log, gmx_large_int_t steps, double time, real lamb);
+void print_ebin_header(FILE *log, gmx_int64_t steps, double time, real lamb);
void print_ebin(ener_file_t fp_ene, gmx_bool bEne, gmx_bool bDR, gmx_bool bOR,
FILE *log,
- gmx_large_int_t step, double time,
+ gmx_int64_t step, double time,
int mode, gmx_bool bCompact,
t_mdebin *md, t_fcdata *fcd,
gmx_groups_t *groups, t_grpopts *opts);
* used in runner.c and md.c.
* (These variables should be stored in the tpx file.)
*/
-extern gmx_large_int_t deform_init_init_step_tpx;
+extern gmx_int64_t deform_init_init_step_tpx;
extern matrix deform_init_box_tpx;
extern tMPI_Thread_mutex_t deform_init_box_mutex;
int ExpandedEnsembleDynamics(FILE *log, t_inputrec *ir, gmx_enerdata_t *enerd,
t_state *state, t_extmass *MassQ, int fep_state, df_history_t *dfhist,
- gmx_large_int_t step, gmx_rng_t mcrng,
+ gmx_int64_t step, gmx_rng_t mcrng,
rvec *v, t_mdatoms *mdatoms);
void PrintFreeEnergyInfoToFile(FILE *outfile, t_lambda *fep, t_expanded *expand, t_simtemp *simtemp, df_history_t *dfhist,
- int fep_state, int frequency, gmx_large_int_t step);
+ int fep_state, int frequency, gmx_int64_t step);
void get_mc_state(gmx_rng_t rng, t_state *state);
real rdd, real rconstr, const char *dddlb_opt, real dlb_scale,
const char *ddcsx, const char *ddcsy, const char *ddcsz,
const char *nbpu_opt, int nstlist_cmdline,
- gmx_large_int_t nsteps_cmdline, int nstepout, int resetstep,
+ gmx_int64_t nsteps_cmdline, int nstepout, int resetstep,
int nmultisim, int repl_ex_nst, int repl_ex_nex,
int repl_ex_seed, real pforce, real cpt_period, real max_hours,
const char *deviceOptions, unsigned long Flags);
void gmx_sumi(int nr, int r[], const t_commrec *cr);
/* Calculate the global sum of an array of ints */
-void gmx_sumli(int nr, gmx_large_int_t r[], const t_commrec *cr);
+void gmx_sumli(int nr, gmx_int64_t r[], const t_commrec *cr);
/* Calculate the global sum of an array of large ints */
void gmx_sumf(int nr, float r[], const t_commrec *cr);
void gmx_sumi_sim(int nr, int r[], const gmx_multisim_t *ms);
/* Calculate the sum over the simulations of an array of ints */
-void gmx_sumli_sim(int nr, gmx_large_int_t r[], const gmx_multisim_t *ms);
+void gmx_sumli_sim(int nr, gmx_int64_t r[], const gmx_multisim_t *ms);
/* Calculate the sum over the simulations of an array of large ints */
void gmx_sumf_sim(int nr, float r[], const gmx_multisim_t *ms);
*/
void print_perf(FILE *out, double nodetime, double realtime,
- gmx_large_int_t nsteps, real delta_t,
+ gmx_int64_t nsteps, real delta_t,
double nbfs, double mflop);
/* Prints the performance, nbfs and mflop come from print_flop */
gmx_bool bFreeEnergy_q, gmx_bool bFreeEnergy_lj,
real lambda_q, real lambda_lj,
gmx_bool bEnerVir, int pme_flags,
- gmx_large_int_t step);
+ gmx_int64_t step);
/* Send the coordinates to our PME-only node and request a PME calculation */
void gmx_pme_send_finish(t_commrec *cr);
void gmx_pme_send_switchgrid(t_commrec *cr, ivec grid_size, real ewaldcoeff_q, real ewaldcoeff_lj);
/* Tell our PME-only node to switch to a new grid size */
-void gmx_pme_send_resetcounters(t_commrec *cr, gmx_large_int_t step);
+void gmx_pme_send_resetcounters(t_commrec *cr, gmx_int64_t step);
/* Tell our PME-only node to reset all cycle and flop counters */
void gmx_pme_receive_f(t_commrec *cr,
gmx_bool *bFreeEnergy_q, gmx_bool *bFreeEnergy_lj,
real *lambda_q, real *lambda_lj,
gmx_bool *bEnerVir, int *pme_flags,
- gmx_large_int_t *step,
+ gmx_int64_t *step,
ivec grid_size, real *ewaldcoeff_q, real *ewaldcoeff_lj);
;
/* With return value:
void finish_pull(t_pull *pull);
/* Print the pull output (x and/or f) */
-void pull_print_output(t_pull *pull, gmx_large_int_t step, double time);
+void pull_print_output(t_pull *pull, gmx_int64_t step, double time);
/* In pullutil.c */
* local arrays have to be updated (masses, shifts)
*/
extern void do_rotation(t_commrec *cr, t_inputrec *ir, matrix box, rvec x[], real t,
- gmx_large_int_t step, gmx_wallcycle_t wcycle, gmx_bool bNS);
+ gmx_int64_t step, gmx_wallcycle_t wcycle, gmx_bool bNS);
/*! \brief Add the enforced rotation forces to the official force array.
* \param step The time step, used for output.
* \param t Time, used for output.
*/
-extern real add_rot_forces(t_rot *rot, rvec f[], t_commrec *cr, gmx_large_int_t step, real t);
+extern real add_rot_forces(t_rot *rot, rvec f[], t_commrec *cr, gmx_int64_t step, real t);
/*! \brief Close the enforced rotation output files.
int get_eint(int *ninp, t_inpfile **inp, const char *name, int def,
warninp_t wi);
-gmx_large_int_t get_egmx_large_int(int *ninp, t_inpfile **inp,
- const char *name, gmx_large_int_t def,
- warninp_t);
+gmx_int64_t get_eint64(int *ninp, t_inpfile **inp,
+ const char *name, gmx_int64_t def,
+ warninp_t);
double get_ereal(int *ninp, t_inpfile **inp, const char *name, double def,
warninp_t wi);
#define STYPE(name, var, def) if ((tmp = get_estr(&ninp, &inp, name, def)) != NULL) strcpy(var, tmp)
#define STYPENC(name, def) get_estr(&ninp, &inp, name, def)
#define ITYPE(name, var, def) var = get_eint(&ninp, &inp, name, def, wi)
-#define STEPTYPE(name, var, def) var = get_egmx_large_int(&ninp, &inp, name, def, wi)
+#define STEPTYPE(name, var, def) var = get_eint64(&ninp, &inp, name, def, wi)
#define RTYPE(name, var, def) var = get_ereal(&ninp, &inp, name, def, wi)
#define ETYPE(name, var, defs) var = get_eenum(&ninp, &inp, name, defs)
#define EETYPE(name, var, defs) var = get_eeenum(&ninp, &inp, name, defs, wi)
/* Optimize shell positions */
int relax_shell_flexcon(FILE *log, t_commrec *cr, gmx_bool bVerbose,
- gmx_large_int_t mdstep, t_inputrec *inputrec,
+ gmx_int64_t mdstep, t_inputrec *inputrec,
gmx_bool bDoNS, int force_flags,
gmx_localtop_t *top,
gmx_constr_t constr,
gmx_bool bSumEkinhOld, int flags);
/* Communicate statistics over cr->mpi_comm_mysim */
-int do_per_step(gmx_large_int_t step, gmx_large_int_t nstep);
+int do_per_step(gmx_int64_t step, gmx_int64_t nstep);
/* Return TRUE if io should be done */
/* ROUTINES from sim_util.c */
void print_time(FILE *out, gmx_walltime_accounting_t walltime_accounting,
- gmx_large_int_t step, t_inputrec *ir, t_commrec *cr);
+ gmx_int64_t step, t_inputrec *ir, t_commrec *cr);
void print_date_and_time(FILE *log, int pid, const char *title,
const gmx_walltime_accounting_t walltime_accounting);
void calc_enervirdiff(FILE *fplog, int eDispCorr, t_forcerec *fr);
void calc_dispcorr(FILE *fplog, t_inputrec *ir, t_forcerec *fr,
- gmx_large_int_t step, int natoms,
+ gmx_int64_t step, int natoms,
matrix box, real lambda, tensor pres, tensor virial,
real *prescorr, real *enercorr, real *dvdlcorr);
char **split(char sep, const char *str);
/*! \brief
- * Convert a string to gmx_large_int_t.
+ * Convert a string to gmx_int64_t.
*
* This method works as the standard library function strtol(), except that it
* does not support different bases.
* - If an overflow occurs, returns zero and \p *endptr will equal \p str.
* errno is still set to ERANGE.
*/
-gmx_large_int_t str_to_large_int_t(const char *str, char **endptr);
+gmx_int64_t str_to_int64_t(const char *str, char **endptr);
#ifdef GMX_NATIVE_WINDOWS
#define snprintf _snprintf
#define MPI_LONG_DOUBLE TMPI_LONG_DOUBLE
#define MPI_WCHAR TMPI_WCHAR
#define MPI_BYTE TMPI_BYTE
-
+#define MPI_INT64_T TMPI_INT64_T
#define MPI_SUCCESS TMPI_SUCCESS
extern const tMPI_Datatype TMPI_POINTER; /**< pointer (thread_mpi
specific) */
+TMPI_EXPORT
+extern const tMPI_Datatype TMPI_INT64_T; /**< int64_t */
+
/*! \} */
/* Over allocation for large data types: complex structs */
#define over_alloc_large(n) (int)(OVER_ALLOC_FAC*(n) + 1000)
-int gmx_large_int_to_int(gmx_large_int_t step, const char *warn);
-/* Convert a gmx_large_int_t value to int.
+int gmx_int64_to_int(gmx_int64_t step, const char *warn);
+/* Convert a gmx_int64_t value to int.
* If warn!=NULL a warning message will be written
* to stderr when step does not fit in an int,
* the first line is:
#define STEPSTRSIZE 22
-char *gmx_step_str(gmx_large_int_t i, char *buf);
-/* Prints a gmx_large_int_t value in buf and returns the pointer to buf.
+char *gmx_step_str(gmx_int64_t i, char *buf);
+/* Prints a gmx_int64_t value in buf and returns the pointer to buf.
* buf should be large enough to contain i: STEPSTRSIZE (22) chars.
- * When multiple gmx_large_int_t values are printed in the same printf call,
+ * When multiple gmx_int64_t values are printed in the same printf call,
* be sure to call gmx_step_str with different buffers.
*/
int *ibuf; /* for ints */
int ibuf_alloc;
- gmx_large_int_t *libuf;
+ gmx_int64_t *libuf;
int libuf_alloc;
float *fbuf; /* for floats */
gmx_domdec_comm_p_t comm;
/* The partioning count, to keep track of the state */
- gmx_large_int_t ddp_count;
+ gmx_int64_t ddp_count;
/* gmx_pme_recv_f buffer */
typedef struct {
int eI; /* Integration method */
- gmx_large_int_t nsteps; /* number of steps to be taken */
+ gmx_int64_t nsteps; /* number of steps to be taken */
int simulation_part; /* Used in checkpointing to separate chunks */
- gmx_large_int_t init_step; /* start at a stepcount >0 (used w. tpbconv) */
+ gmx_int64_t init_step; /* start at a stepcount >0 (used w. tpbconv) */
int nstcalcenergy; /* frequency of energy calc. and T/P coupl. upd. */
int cutoff_scheme; /* group or verlet cutoffs */
int ns_type; /* which ns method should we use? */
typedef struct {
gmx_bool bGStatEveryStep;
- gmx_large_int_t step_ns;
- gmx_large_int_t step_nscheck;
- gmx_large_int_t nns;
+ gmx_int64_t step_ns;
+ gmx_int64_t step_nscheck;
+ gmx_int64_t nns;
matrix scale_tot;
int nabnsb;
double s1;
double lt_runav2;
} gmx_nlheur_t;
-void reset_nlistheuristics(gmx_nlheur_t *nlh, gmx_large_int_t step);
+void reset_nlistheuristics(gmx_nlheur_t *nlh, gmx_int64_t step);
void init_nlistheuristics(gmx_nlheur_t *nlh,
- gmx_bool bGStatEveryStep, gmx_large_int_t step);
+ gmx_bool bGStatEveryStep, gmx_int64_t step);
-void update_nliststatistics(gmx_nlheur_t *nlh, gmx_large_int_t step);
+void update_nliststatistics(gmx_nlheur_t *nlh, gmx_int64_t step);
-void set_nlistheuristics(gmx_nlheur_t *nlh, gmx_bool bReset, gmx_large_int_t step);
+void set_nlistheuristics(gmx_nlheur_t *nlh, gmx_bool bReset, gmx_int64_t step);
#ifdef __cplusplus
}
/* Information about integer data type sizes */
#include <limits.h>
+#define __STDC_LIMIT_MACROS
+#include <stdint.h>
+#ifndef _MSC_VER
+#define __STDC_FORMAT_MACROS
+#include <inttypes.h>
+#endif
#ifdef __cplusplus
extern "C" {
typedef int imatrix[DIM][DIM];
+#ifdef _MSC_VER
+typedef __int32 gmx_int32_t;
+#define GMX_PRId32 "I32d"
+#define GMX_SCNd32 "I32d"
-/* For the step count type gmx_large_int_t we aim for 8 bytes (64bit),
- * but we might only be able to get 4 bytes (32bit).
- *
- * We first try to find a type without reyling on any SIZEOF_XXX defines.
- *
- * Avoid using "long int" if we can. This type is really dangerous,
- * since the width frequently depends on compiler options, and they
- * might not be set correctly when (buggy) Cmake is detecting things.
- * Instead, start by looking for "long long", and just go down if we
- * have to (rarely on new systems). /EL 20100810
- */
-#if ( (defined SIZEOF_LONG_LONG_INT && SIZEOF_LONG_LONG_INT == 8) || (defined LLONG_MAX && LLONG_MAX == 9223372036854775807LL) )
-
-/* Long long int is 64 bit */
-typedef long long int gmx_large_int_t;
-#define gmx_large_int_fmt "lld"
-#define gmx_large_int_pfmt "%lld"
-#define SIZEOF_GMX_LARGE_INT 8
-#define GMX_LARGE_INT_MAX 9223372036854775807LL
-#define GMX_LARGE_INT_MIN (-GMX_LARGE_INT_MAX - 1LL)
-#define GMX_MPI_LARGE_INT MPI_LONG_LONG_INT
-
-#elif ( (defined SIZEOF_LONG_INT && SIZEOF_LONG_INT == 8) || (defined LONG_MAX && LONG_MAX == 9223372036854775807L) )
-
-/* Long int is 64 bit */
-typedef long int gmx_large_int_t;
-#define gmx_large_int_fmt "ld"
-#define gmx_large_int_pfmt "%ld"
-#define SIZEOF_GMX_LARGE_INT 8
-#define GMX_LARGE_INT_MAX 9223372036854775807LL
-#define GMX_LARGE_INT_MIN (-GMX_LARGE_INT_MAX - 1LL)
-#define GMX_MPI_LARGE_INT MPI_LONG_INT
-
-#elif ( (defined SIZEOF_INT && SIZEOF_INT == 8) || (defined INT_MAX && INT_MAX == 9223372036854775807L) )
-
-/* int is 64 bit */
-typedef int gmx_large_int_t;
-#define gmx_large_int_fmt "d"
-#define gmx_large_int_pfmt "%d"
-#define SIZEOF_GMX_LARGE_INT 8
-#define GMX_LARGE_INT_MAX 9223372036854775807LL
-#define GMX_LARGE_INT_MIN (-GMX_LARGE_INT_MAX - 1LL)
-#define GMX_MPI_LARGE_INT MPI_INT
-
-#elif ( (defined INT_MAX && INT_MAX == 2147483647) || (defined SIZEOF_INT && SIZEOF_INT == 4) )
-
-/* None of the above worked, try a 32 bit integer */
-typedef int gmx_large_int_t;
-#define gmx_large_int_fmt "d"
-#define gmx_large_int_pfmt "%d"
-#define SIZEOF_GMX_LARGE_INT 4
-#define GMX_LARGE_INT_MAX 2147483647
-#define GMX_LARGE_INT_MIN (-GMX_LARGE_INT_MAX - 1)
-#define GMX_MPI_LARGE_INT MPI_INT
+typedef __int64 gmx_int64_t;
+#define GMX_PRId64 "I64d"
+#define GMX_SCNd64 "I64d"
+
+typedef unsigned __int32 gmx_uint32_t;
+#define GMX_PRIu32 "U32d"
+#define GMX_SCNu32 "U32d"
+typedef unsigned __int64 gmx_uint64_t;
+#define GMX_PRIu64 "U64d"
+#define GMX_SCNu64 "U64d"
#else
+typedef int32_t gmx_int32_t;
+#define GMX_PRId32 PRId32
+#define GMX_SCNd32 SCNd32
-#error "Cannot find any 32 or 64 bit integer data type. Please extend the gromacs simple.h file!"
+typedef int64_t gmx_int64_t;
+#define GMX_PRId64 PRId64
+#define GMX_SCNd64 SCNd64
+typedef uint32_t gmx_uint32_t;
+#define GMX_PRIu32 PRIu32
+#define GMX_SCNu32 SCNu32
+
+typedef uint64_t gmx_uint64_t;
+#define GMX_PRIu64 PRIu64
+#define GMX_SCNu64 SCNu64
#endif
+#define GMX_INT32_MAX INT32_MAX
+#define GMX_INT32_MIN INT32_MIN
+
+#define GMX_INT64_MAX INT64_MAX
+#define GMX_INT64_MIN INT64_MIN
+
+#define GMX_UINT32_MAX UINT32_MAX
+#define GMX_UINT32_MIN UINT32_MIN
+
+#define GMX_UINT64_MAX UINT64_MAX
+#define GMX_UINT64_MIN UINT64_MIN
#ifndef gmx_inline
/* config.h tests for inline definitions and should work on a much wider range
typedef struct
{
- gmx_large_int_t nsteps; /* The number of steps in the history */
- gmx_large_int_t nsum; /* The nr. of steps in the ener_ave and ener_sum */
+ gmx_int64_t nsteps; /* The number of steps in the history */
+ gmx_int64_t nsum; /* The nr. of steps in the ener_ave and ener_sum */
double * ener_ave; /* Energy term history sum to get fluctuations */
double * ener_sum; /* Energy term history sum to get fluctuations */
int nener; /* Number of energy terms in two previous arrays */
- gmx_large_int_t nsteps_sim; /* The number of steps in ener_sum_sim */
- gmx_large_int_t nsum_sim; /* The number of frames in ener_sum_sim */
+ gmx_int64_t nsteps_sim; /* The number of steps in ener_sum_sim */
+ gmx_int64_t nsum_sim; /* The number of frames in ener_sum_sim */
double * ener_sum_sim; /* Energy term history sum of the whole sim */
delta_h_history_t *dht; /* The BAR energy differences */
* as a reference state for simulations with box deformation.
*/
void set_deform_reference_box(gmx_update_t upd,
- gmx_large_int_t step, matrix box);
+ gmx_int64_t step, matrix box);
-void update_tcouple(gmx_large_int_t step,
+void update_tcouple(gmx_int64_t step,
t_inputrec *inputrec,
t_state *state,
gmx_ekindata_t *ekind,
);
void update_pcouple(FILE *fplog,
- gmx_large_int_t step,
+ gmx_int64_t step,
t_inputrec *inputrec,
t_state *state,
matrix pcoupl_mu,
gmx_bool bInitStep);
void update_coords(FILE *fplog,
- gmx_large_int_t step,
+ gmx_int64_t step,
t_inputrec *inputrec, /* input record and box stuff */
t_mdatoms *md,
t_state *state,
/* Return TRUE if OK, FALSE in case of Shake Error */
-extern gmx_bool update_randomize_velocities(t_inputrec *ir, gmx_large_int_t step, t_mdatoms *md, t_state *state, gmx_update_t upd, t_idef *idef, gmx_constr_t constr);
+extern gmx_bool update_randomize_velocities(t_inputrec *ir, gmx_int64_t step, t_mdatoms *md, t_state *state, gmx_update_t upd, t_idef *idef, gmx_constr_t constr);
void update_constraints(FILE *fplog,
- gmx_large_int_t step,
+ gmx_int64_t step,
real *dvdlambda, /* FEP stuff */
t_inputrec *inputrec, /* input record and box stuff */
gmx_ekindata_t *ekind,
/* Return TRUE if OK, FALSE in case of Shake Error */
void update_box(FILE *fplog,
- gmx_large_int_t step,
+ gmx_int64_t step,
t_inputrec *inputrec, /* input record and box stuff */
t_mdatoms *md,
t_state *state,
void destroy_bufstate(t_state *state);
-void trotter_update(t_inputrec *ir, gmx_large_int_t step, gmx_ekindata_t *ekind,
+void trotter_update(t_inputrec *ir, gmx_int64_t step, gmx_ekindata_t *ekind,
gmx_enerdata_t *enerd, t_state *state, tensor vir, t_mdatoms *md,
t_extmass *MassQ, int **trotter_seqlist, int trotter_seqno);
* The unit of pressure is bar.
*/
-void parrinellorahman_pcoupl(FILE *fplog, gmx_large_int_t step,
+void parrinellorahman_pcoupl(FILE *fplog, gmx_int64_t step,
t_inputrec *ir, real dt, tensor pres,
tensor box, tensor box_rel, tensor boxv,
tensor M, matrix mu,
gmx_bool bFirstStep);
-void berendsen_pcoupl(FILE *fplog, gmx_large_int_t step,
+void berendsen_pcoupl(FILE *fplog, gmx_int64_t step,
t_inputrec *ir, real dt, tensor pres, matrix box,
matrix mu);
gmx_bool constrain_lincs(FILE *fplog, gmx_bool bLog, gmx_bool bEner,
t_inputrec *ir,
- gmx_large_int_t step,
+ gmx_int64_t step,
struct gmx_lincsdata *lincsd, t_mdatoms *md,
t_commrec *cr,
rvec *x, rvec *xprime, rvec *min_proj,
gmx_fio_fclose(out);
}
-static void dump_confs(FILE *fplog, gmx_large_int_t step, gmx_mtop_t *mtop,
+static void dump_confs(FILE *fplog, gmx_int64_t step, gmx_mtop_t *mtop,
int start, int homenr, t_commrec *cr,
rvec x[], rvec xprime[], matrix box)
{
struct gmx_constr *constr,
t_idef *idef, t_inputrec *ir, gmx_ekindata_t *ekind,
t_commrec *cr,
- gmx_large_int_t step, int delta_step,
+ gmx_int64_t step, int delta_step,
t_mdatoms *md,
rvec *x, rvec *xprime, rvec *min_proj,
gmx_bool bMolPBC, matrix box,
{
char buf[256];
sprintf(buf,
- "\nstep " gmx_large_int_pfmt ": Water molecule starting at atom %d can not be "
+ "\nstep " "%"GMX_PRId64 ": Water molecule starting at atom %d can not be "
"settled.\nCheck for bad contacts and/or reduce the timestep if appropriate.\n",
step, ddglatnr(cr->dd, settle->iatoms[settle_error*(1+NRAL(F_SETTLE))+1]));
if (fplog)
}
}
-void parrinellorahman_pcoupl(FILE *fplog, gmx_large_int_t step,
+void parrinellorahman_pcoupl(FILE *fplog, gmx_int64_t step,
t_inputrec *ir, real dt, tensor pres,
tensor box, tensor box_rel, tensor boxv,
tensor M, matrix mu, gmx_bool bFirstStep)
mmul_ur0(invbox, t1, mu);
}
-void berendsen_pcoupl(FILE *fplog, gmx_large_int_t step,
+void berendsen_pcoupl(FILE *fplog, gmx_int64_t step,
t_inputrec *ir, real dt, tensor pres, matrix box,
matrix mu)
{
sfree(state);
}
-void trotter_update(t_inputrec *ir, gmx_large_int_t step, gmx_ekindata_t *ekind,
+void trotter_update(t_inputrec *ir, gmx_int64_t step, gmx_ekindata_t *ekind,
gmx_enerdata_t *enerd, t_state *state,
tensor vir, t_mdatoms *md,
t_extmass *MassQ, int **trotter_seqlist, int trotter_seqno)
int n, i, j, d, ntgrp, ngtc, gc = 0;
t_grp_tcstat *tcstat;
t_grpopts *opts;
- gmx_large_int_t step_eff;
+ gmx_int64_t step_eff;
real ecorr, pcorr, dvdlcorr;
real bmass, qmass, reft, kT, dt, nd;
tensor dumpres, dumvir;
double load_pme;
/* The last partition step */
- gmx_large_int_t partition_step;
+ gmx_int64_t partition_step;
/* Debugging */
int nstDDDump;
return c;
}
-static void write_dd_grid_pdb(const char *fn, gmx_large_int_t step,
+static void write_dd_grid_pdb(const char *fn, gmx_int64_t step,
gmx_domdec_t *dd, matrix box, gmx_ddbox_t *ddbox)
{
rvec grid_s[2], *grid_r = NULL, cx, r;
}
}
-void write_dd_pdb(const char *fn, gmx_large_int_t step, const char *title,
+void write_dd_pdb(const char *fn, gmx_int64_t step, const char *title,
gmx_mtop_t *mtop, t_commrec *cr,
int natoms, rvec x[], matrix box)
{
return grid_jump_limit;
}
-static gmx_bool check_grid_jump(gmx_large_int_t step,
+static gmx_bool check_grid_jump(gmx_int64_t step,
gmx_domdec_t *dd,
real cutoff,
gmx_ddbox_t *ddbox,
static void dd_cell_sizes_dlb_root_enforce_limits(gmx_domdec_t *dd,
int d, int dim, gmx_domdec_root_t *root,
gmx_ddbox_t *ddbox,
- gmx_bool bUniform, gmx_large_int_t step, real cellsize_limit_f, int range[])
+ gmx_bool bUniform, gmx_int64_t step, real cellsize_limit_f, int range[])
{
gmx_domdec_comm_t *comm;
int ncd, i, j, nmin, nmin_old;
static void set_dd_cell_sizes_dlb_root(gmx_domdec_t *dd,
int d, int dim, gmx_domdec_root_t *root,
gmx_ddbox_t *ddbox, gmx_bool bDynamicBox,
- gmx_bool bUniform, gmx_large_int_t step)
+ gmx_bool bUniform, gmx_int64_t step)
{
gmx_domdec_comm_t *comm;
int ncd, d1, i, j, pos;
static void set_dd_cell_sizes_dlb_change(gmx_domdec_t *dd,
gmx_ddbox_t *ddbox, gmx_bool bDynamicBox,
- gmx_bool bUniform, gmx_large_int_t step)
+ gmx_bool bUniform, gmx_int64_t step)
{
gmx_domdec_comm_t *comm;
int d, dim, d1;
static void set_dd_cell_sizes_dlb(gmx_domdec_t *dd,
gmx_ddbox_t *ddbox, gmx_bool bDynamicBox,
- gmx_bool bUniform, gmx_bool bDoDLB, gmx_large_int_t step,
+ gmx_bool bUniform, gmx_bool bDoDLB, gmx_int64_t step,
gmx_wallcycle_t wcycle)
{
gmx_domdec_comm_t *comm;
static void set_dd_cell_sizes(gmx_domdec_t *dd,
gmx_ddbox_t *ddbox, gmx_bool bDynamicBox,
- gmx_bool bUniform, gmx_bool bDoDLB, gmx_large_int_t step,
+ gmx_bool bUniform, gmx_bool bDoDLB, gmx_int64_t step,
gmx_wallcycle_t wcycle)
{
gmx_domdec_comm_t *comm;
static void comm_dd_ns_cell_sizes(gmx_domdec_t *dd,
gmx_ddbox_t *ddbox,
rvec cell_ns_x0, rvec cell_ns_x1,
- gmx_large_int_t step)
+ gmx_int64_t step)
{
gmx_domdec_comm_t *comm;
int dim_ind, dim;
}
}
-static void distribute_cg(FILE *fplog, gmx_large_int_t step,
+static void distribute_cg(FILE *fplog, gmx_int64_t step,
matrix box, ivec tric_dir, t_block *cgs, rvec pos[],
gmx_domdec_t *dd)
{
}
}
-static void get_cg_distribution(FILE *fplog, gmx_large_int_t step, gmx_domdec_t *dd,
+static void get_cg_distribution(FILE *fplog, gmx_int64_t step, gmx_domdec_t *dd,
t_block *cgs, matrix box, gmx_ddbox_t *ddbox,
rvec pos[])
{
static void print_cg_move(FILE *fplog,
gmx_domdec_t *dd,
- gmx_large_int_t step, int cg, int dim, int dir,
+ gmx_int64_t step, int cg, int dim, int dir,
gmx_bool bHaveLimitdAndCMOld, real limitd,
rvec cm_old, rvec cm_new, real pos_d)
{
static void cg_move_error(FILE *fplog,
gmx_domdec_t *dd,
- gmx_large_int_t step, int cg, int dim, int dir,
+ gmx_int64_t step, int cg, int dim, int dir,
gmx_bool bHaveLimitdAndCMOld, real limitd,
rvec cm_old, rvec cm_new, real pos_d)
{
return comm->moved;
}
-static void calc_cg_move(FILE *fplog, gmx_large_int_t step,
+static void calc_cg_move(FILE *fplog, gmx_int64_t step,
gmx_domdec_t *dd,
t_state *state,
ivec tric_dir, matrix tcm,
}
}
-static void dd_redistribute_cg(FILE *fplog, gmx_large_int_t step,
+static void dd_redistribute_cg(FILE *fplog, gmx_int64_t step,
gmx_domdec_t *dd, ivec tric_dir,
t_state *state, rvec **f,
t_forcerec *fr,
}
}
-static void dd_print_load(FILE *fplog, gmx_domdec_t *dd, gmx_large_int_t step)
+static void dd_print_load(FILE *fplog, gmx_domdec_t *dd, gmx_int64_t step)
{
int flags, d;
char buf[22];
}
-static void turn_on_dlb(FILE *fplog, t_commrec *cr, gmx_large_int_t step)
+static void turn_on_dlb(FILE *fplog, t_commrec *cr, gmx_int64_t step)
{
gmx_domdec_t *dd;
gmx_domdec_comm_t *comm;
}
void dd_partition_system(FILE *fplog,
- gmx_large_int_t step,
+ gmx_int64_t step,
t_commrec *cr,
gmx_bool bMasterState,
int nstglobalcomm,
gmx_domdec_comm_t *comm;
gmx_ddbox_t ddbox = {0};
t_block *cgs_gl;
- gmx_large_int_t step_pcoupl;
+ gmx_int64_t step_pcoupl;
rvec cell_ns_x0, cell_ns_x1;
int i, j, n, ncgindex_set, ncg_home_old = -1, ncg_moved, nat_f_novirsum;
gmx_bool bBoxChanged, bNStGlobalComm, bDoDLB, bCheckDLB, bTurnOnDLB, bLogLoad;
real cellsize_limit, real cutoff_dd,
gmx_bool bInterCGBondeds)
{
- gmx_large_int_t nnodes_div, ldiv;
+ gmx_int64_t nnodes_div, ldiv;
real limit;
if (MASTER(cr))
/* From flood.xproj compute the Vfl(x) at this point */
-static real flood_energy(t_edpar *edi, gmx_large_int_t step)
+static real flood_energy(t_edpar *edi, gmx_int64_t step)
{
/* compute flooding energy Vfl
Vfl = Efl * exp( - \frac {kT} {2Efl alpha^2} * sum_i { \lambda_i c_i^2 } )
rvec x[],
rvec force[],
t_edpar *edi,
- gmx_large_int_t step,
+ gmx_int64_t step,
matrix box,
t_commrec *cr,
gmx_bool bNS) /* Are we in a neighbor searching step? */
rvec force[], /* forcefield forces, to these the flooding forces are added */
gmx_edsam_t ed, /* ed data structure contains all ED and flooding groups */
matrix box, /* the box */
- gmx_large_int_t step, /* The relative time step since ir->init_step is already subtracted */
+ gmx_int64_t step, /* The relative time step since ir->init_step is already subtracted */
gmx_bool bNS) /* Are we in a neighbor searching step? */
{
t_edpar *edi;
}
-static void do_linfix(rvec *xcoll, t_edpar *edi, gmx_large_int_t step)
+static void do_linfix(rvec *xcoll, t_edpar *edi, gmx_int64_t step)
{
int i, j;
real proj, add;
}
-static void ed_apply_constraints(rvec *xcoll, t_edpar *edi, gmx_large_int_t step)
+static void ed_apply_constraints(rvec *xcoll, t_edpar *edi, gmx_int64_t step)
{
int i;
void do_edsam(t_inputrec *ir,
- gmx_large_int_t step,
+ gmx_int64_t step,
t_commrec *cr,
rvec xs[], /* The local current positions on this processor */
rvec v[], /* The velocities */
*mcrng = gmx_rng_init(ir->expandedvals->lmc_seed);
if (!bStateFromCP)
{
- init_df_history_weights(dfhist,ir->expandedvals,ir->fepvals->n_lambda);
+ init_df_history_weights(dfhist, ir->expandedvals, ir->fepvals->n_lambda);
}
}
return bIfFlat;
}
-static gmx_bool CheckIfDoneEquilibrating(int nlim, t_expanded *expand, df_history_t *dfhist, gmx_large_int_t step)
+static gmx_bool CheckIfDoneEquilibrating(int nlim, t_expanded *expand, df_history_t *dfhist, gmx_int64_t step)
{
int i, totalsamples;
}
static gmx_bool UpdateWeights(int nlim, t_expanded *expand, df_history_t *dfhist,
- int fep_state, real *scaled_lamee, real *weighted_lamee, gmx_large_int_t step)
+ int fep_state, real *scaled_lamee, real *weighted_lamee, gmx_int64_t step)
{
real maxdiff = 0.000000001;
gmx_bool bSufficientSamples;
real clam_varm, clam_varp, clam_weightsm, clam_weightsp, clam_minvar;
real *lam_weights, *lam_minvar_corr, *lam_variance, *lam_dg;
double *p_k;
- double pks = 0;
+ double pks = 0;
real *numweighted_lamee, *logfrac;
int *nonzero;
real chi_m1_0, chi_p1_0, chi_m2_0, chi_p2_0, chi_p1_m1, chi_p2_m1, chi_m1_p1, chi_m2_p1;
if (lamnew > maxfep)
{
/* it's possible some rounding is failing */
- if (gmx_within_tol(remainder[fep_state],0,50*GMX_DOUBLE_EPS))
+ if (gmx_within_tol(remainder[fep_state], 0, 50*GMX_DOUBLE_EPS))
{
/* numerical rounding error -- no state other than the original has weight */
lamnew = fep_state;
/* print out the weights to the log, along with current state */
extern void PrintFreeEnergyInfoToFile(FILE *outfile, t_lambda *fep, t_expanded *expand, t_simtemp *simtemp, df_history_t *dfhist,
- int fep_state, int frequency, gmx_large_int_t step)
+ int fep_state, int frequency, gmx_int64_t step)
{
int nlim, i, ifep, jfep;
real dw, dg, dv, dm, Tprint;
extern int ExpandedEnsembleDynamics(FILE *log, t_inputrec *ir, gmx_enerdata_t *enerd,
t_state *state, t_extmass *MassQ, int fep_state, df_history_t *dfhist,
- gmx_large_int_t step, gmx_rng_t mcrng,
+ gmx_int64_t step, gmx_rng_t mcrng,
rvec *v, t_mdatoms *mdatoms)
/* Note that the state variable is only needed for simulated tempering, not
Hamiltonian expanded ensemble. May be able to remove it after integrator refactoring. */
fprintf(fplog, " %-30s V %12.5e dVdl %12.5e\n", s, v, dvdlambda);
}
-void do_force_lowlevel(FILE *fplog, gmx_large_int_t step,
+void do_force_lowlevel(FILE *fplog, gmx_int64_t step,
t_forcerec *fr, t_inputrec *ir,
t_idef *idef, t_commrec *cr,
t_nrnb *nrnb, gmx_wallcycle_t wcycle,
/* check which of the multisim simulations has the shortest number of
steps and return that number of nsteps */
-gmx_large_int_t get_multisim_nsteps(const t_commrec *cr,
- gmx_large_int_t nsteps)
+gmx_int64_t get_multisim_nsteps(const t_commrec *cr,
+ gmx_int64_t nsteps)
{
- gmx_large_int_t steps_out;
+ gmx_int64_t steps_out;
- if MASTER(cr)
+ if (MASTER(cr))
{
- gmx_large_int_t *buf;
+ gmx_int64_t *buf;
int s;
snew(buf, cr->ms->nsim);
if (steps_out >= 0 && steps_out < nsteps)
{
char strbuf[255];
- snprintf(strbuf, 255, "Will stop simulation %%d after %s steps (another simulation will end then).\n", gmx_large_int_pfmt);
+ snprintf(strbuf, 255, "Will stop simulation %%d after %s steps (another simulation will end then).\n", "%"GMX_PRId64);
fprintf(stderr, strbuf, cr->ms->sim, steps_out);
}
}
/* broadcast to non-masters */
- gmx_bcast(sizeof(gmx_large_int_t), &steps_out, cr);
+ gmx_bcast(sizeof(gmx_int64_t), &steps_out, cr);
return steps_out;
}
}
}
-void set_current_lambdas(gmx_large_int_t step, t_lambda *fepvals, gmx_bool bRerunMD,
+void set_current_lambdas(gmx_int64_t step, t_lambda *fepvals, gmx_bool bRerunMD,
t_trxframe *rerun_fr, t_state *state_global, t_state *state, double lam0[])
/* find the current lambdas. If rerunning, we either read in a state, or a lambda value,
requiring different logic. */
{
if (rerun_fr->bLambda)
{
- if (fepvals->delta_lambda==0)
+ if (fepvals->delta_lambda == 0)
{
state_global->lambda[efptFEP] = rerun_fr->lambda;
for (i = 0; i < efptNR; i++)
}
else
{
- if (state->fep_state > 0) {
+ if (state->fep_state > 0)
+ {
state_global->fep_state = state->fep_state; /* state->fep is the one updated by bExpanded */
for (i = 0; i < efptNR; i++)
{
fprintf(log, "\n");
}
-void print_ebin_header(FILE *log, gmx_large_int_t steps, double time, real lambda)
+void print_ebin_header(FILE *log, gmx_int64_t steps, double time, real lambda)
{
char buf[22];
void print_ebin(ener_file_t fp_ene, gmx_bool bEne, gmx_bool bDR, gmx_bool bOR,
FILE *log,
- gmx_large_int_t step, double time,
+ gmx_int64_t step, double time,
int mode, gmx_bool bCompact,
t_mdebin *md, t_fcdata *fcd,
gmx_groups_t *groups, t_grpopts *opts)
Get this start value in number of histogram dxs from zero,
as an integer.*/
- dh->x0[hi] = (gmx_large_int_t)floor(min_dh/dx);
+ dh->x0[hi] = (gmx_int64_t)floor(min_dh/dx);
min_dh_hist = (dh->x0[hi])*dx;
max_dh_hist = (dh->x0[hi] + dh->nbins + 1)*dx;
double dx; /* the histogram spacing in kJ/mol. This is the
same for the two histograms? */
unsigned int nbins; /* the number of bins in the histograms*/
- gmx_large_int_t x0[2]; /* the starting point in units of spacing
- of the histogram */
+ gmx_int64_t x0[2]; /* the starting point in units of spacing
+ of the histogram */
unsigned int maxbin[2]; /* highest bin number with data */
int type; /* the block type according to dhbtDH, etc. */
int nlambda; /* length of the lambda vector */
gmx_bool written; /* whether this data has already been written out */
- gmx_large_int_t subblock_meta_l[5]; /* metadata for an mdebin subblock for
- I/O: for histogram counts, etc.*/
+ gmx_int64_t subblock_meta_l[5]; /* metadata for an mdebin subblock for
+ I/O: for histogram counts, etc.*/
double *subblock_meta_d; /* metadata subblock for I/O, used for
communicating doubles (i.e. the lambda
vector) */
static void print_converged(FILE *fp, const char *alg, real ftol,
- gmx_large_int_t count, gmx_bool bDone, gmx_large_int_t nsteps,
+ gmx_int64_t count, gmx_bool bDone, gmx_int64_t nsteps,
real epot, real fmax, int nfmax, real fnorm)
{
char buf[STEPSTRSIZE];
gmx_mdoutf_t *outf,
gmx_bool bX, gmx_bool bF, const char *confout,
gmx_mtop_t *top_global,
- t_inputrec *ir, gmx_large_int_t step,
+ t_inputrec *ir, gmx_int64_t step,
em_state_t *state,
t_state *state_global, rvec *f_global)
{
em_state_t *ems1, real a, rvec *f, em_state_t *ems2,
gmx_constr_t constr, gmx_localtop_t *top,
t_nrnb *nrnb, gmx_wallcycle_t wcycle,
- gmx_large_int_t count)
+ gmx_int64_t count)
{
t_state *s1, *s2;
t_graph *graph, t_mdatoms *mdatoms,
t_forcerec *fr, rvec mu_tot,
gmx_enerdata_t *enerd, tensor vir, tensor pres,
- gmx_large_int_t count, gmx_bool bFirst)
+ gmx_int64_t count, gmx_bool bFirst)
{
real t;
gmx_bool bNS;
rvec mu_tot;
rvec *fneg, *dfdx;
gmx_bool bSparse; /* use sparse matrix storage format */
- size_t sz=0;
+ size_t sz = 0;
gmx_sparsematrix_t * sparse_matrix = NULL;
real * full_matrix = NULL;
em_state_t * state_work;
#include "gmx_fatal.h"
#include "vec.h"
-void reset_nlistheuristics(gmx_nlheur_t *nlh, gmx_large_int_t step)
+void reset_nlistheuristics(gmx_nlheur_t *nlh, gmx_int64_t step)
{
nlh->lt_runav = 0;
nlh->lt_runav2 = 0;
}
void init_nlistheuristics(gmx_nlheur_t *nlh,
- gmx_bool bGStatEveryStep, gmx_large_int_t step)
+ gmx_bool bGStatEveryStep, gmx_int64_t step)
{
nlh->bGStatEveryStep = bGStatEveryStep;
nlh->nns = 0;
reset_nlistheuristics(nlh, step);
}
-void update_nliststatistics(gmx_nlheur_t *nlh, gmx_large_int_t step)
+void update_nliststatistics(gmx_nlheur_t *nlh, gmx_int64_t step)
{
- gmx_large_int_t nl_lt;
+ gmx_int64_t nl_lt;
char sbuf[STEPSTRSIZE], sbuf2[STEPSTRSIZE];
/* Determine the neighbor list life time */
}
}
-void set_nlistheuristics(gmx_nlheur_t *nlh, gmx_bool bReset, gmx_large_int_t step)
+void set_nlistheuristics(gmx_nlheur_t *nlh, gmx_bool bReset, gmx_int64_t step)
{
int d;
static void reset_pmeonly_counters(gmx_wallcycle_t wcycle,
gmx_walltime_accounting_t walltime_accounting,
t_nrnb *nrnb, t_inputrec *ir,
- gmx_large_int_t step)
+ gmx_int64_t step)
{
/* Reset all the counters related to performance over the run */
wallcycle_stop(wcycle, ewcRUN);
int count;
gmx_bool bEnerVir;
int pme_flags;
- gmx_large_int_t step, step_rel;
+ gmx_int64_t step, step_rel;
ivec grid_switch;
/* This data will only use with PME tuning, i.e. switching PME grids */
real lambda_q;
real lambda_lj;
int flags;
- gmx_large_int_t step;
+ gmx_int64_t step;
ivec grid_size; /* For PME grid tuning */
real ewaldcoeff_q; /* For PME grid tuning */
real ewaldcoeff_lj;
matrix box, rvec gmx_unused *x,
real lambda_q, real lambda_lj,
int maxshift_x, int maxshift_y,
- gmx_large_int_t step)
+ gmx_int64_t step)
{
gmx_domdec_t *dd;
gmx_pme_comm_n_box_t *cnb;
gmx_bool bFreeEnergy_q, gmx_bool bFreeEnergy_lj,
real lambda_q, real lambda_lj,
gmx_bool bEnerVir, int pme_flags,
- gmx_large_int_t step)
+ gmx_int64_t step)
{
int flags;
#endif
}
-void gmx_pme_send_resetcounters(t_commrec gmx_unused *cr, gmx_large_int_t gmx_unused step)
+void gmx_pme_send_resetcounters(t_commrec gmx_unused *cr, gmx_int64_t gmx_unused step)
{
#ifdef GMX_MPI
gmx_pme_comm_n_box_t cnb;
real gmx_unused *lambda_lj,
gmx_bool gmx_unused *bEnerVir,
int *pme_flags,
- gmx_large_int_t gmx_unused *step,
+ gmx_int64_t gmx_unused *step,
ivec gmx_unused grid_size,
real gmx_unused *ewaldcoeff_q,
real gmx_unused *ewaldcoeff_lj)
}
else
{
- pull_print_group_x(out, pull->dim, &pull->group[pcrd->group[0]]);
+ pull_print_group_x(out, pull->dim, &pull->group[pcrd->group[0]]);
}
}
pull_print_coord_dr(out, pull->dim, pcrd);
fprintf(out, "\n");
}
-void pull_print_output(t_pull *pull, gmx_large_int_t step, double time)
+void pull_print_output(t_pull *pull, gmx_int64_t step, double time)
{
if ((pull->nstxout != 0) && (step % pull->nstxout == 0))
{
const t_pbc *pbc, double t,
dvec dr, double *dev)
{
- static gmx_bool bWarned = FALSE; /* TODO: this should be fixed for thread-safety,
- but is fairly benign */
+ static gmx_bool bWarned = FALSE; /* TODO: this should be fixed for thread-safety,
+ but is fairly benign */
const t_pull_coord *pcrd;
int m;
double ref, drs, inpr;
double dt, double t)
{
- dvec *r_ij; /* x[i] com of i in prev. step. Obeys constr. -> r_ij[i] */
- dvec unc_ij; /* xp[i] com of i this step, before constr. -> unc_ij */
- dvec *rnew; /* current 'new' positions of the groups */
- double *dr_tot; /* the total update of the coords */
- double ref;
- dvec vec;
- double d0, inpr;
- double lambda, rm, mass, invdt = 0;
- gmx_bool bConverged_all, bConverged = FALSE;
- int niter = 0, g, c, ii, j, m, max_iter = 100;
- double a;
- dvec f; /* the pull force */
- dvec tmp, tmp3;
+ dvec *r_ij; /* x[i] com of i in prev. step. Obeys constr. -> r_ij[i] */
+ dvec unc_ij; /* xp[i] com of i this step, before constr. -> unc_ij */
+ dvec *rnew; /* current 'new' positions of the groups */
+ double *dr_tot; /* the total update of the coords */
+ double ref;
+ dvec vec;
+ double d0, inpr;
+ double lambda, rm, mass, invdt = 0;
+ gmx_bool bConverged_all, bConverged = FALSE;
+ int niter = 0, g, c, ii, j, m, max_iter = 100;
+ double a;
+ dvec f; /* the pull force */
+ dvec tmp, tmp3;
t_pull_group *pdyna, *pgrp0, *pgrp1;
t_pull_coord *pcrd;
bAbs = TRUE;
}
}
-
+
fprintf(fplog, "\nWill apply %s COM pulling in geometry '%s'\n",
EPULLTYPE(ir->ePull), EPULLGEOM(pull->eGeom));
fprintf(fplog, "with %d pull coordinate%s and %d group%s\n",
/* Reduce potential angle fit data for this group at this time step? */
-static gmx_inline gmx_bool bPotAngle(t_rot *rot, t_rotgrp *rotg, gmx_large_int_t step)
+static gmx_inline gmx_bool bPotAngle(t_rot *rot, t_rotgrp *rotg, gmx_int64_t step)
{
return ( (erotgFitPOT == rotg->eFittype) && (do_per_step(step, rot->nstsout) || do_per_step(step, rot->nstrout)) );
}
/* Reduce slab torqe data for this group at this time step? */
-static gmx_inline gmx_bool bSlabTau(t_rot *rot, t_rotgrp *rotg, gmx_large_int_t step)
+static gmx_inline gmx_bool bSlabTau(t_rot *rot, t_rotgrp *rotg, gmx_int64_t step)
{
return ( (ISFLEX(rotg)) && do_per_step(step, rot->nstsout) );
}
/* Output rotation energy, torques, etc. for each rotation group */
-static void reduce_output(t_commrec *cr, t_rot *rot, real t, gmx_large_int_t step)
+static void reduce_output(t_commrec *cr, t_rot *rot, real t, gmx_int64_t step)
{
int g, i, islab, nslabs = 0;
int count; /* MPI element counter */
/* Add the forces from enforced rotation potential to the local forces.
* Should be called after the SR forces have been evaluated */
-extern real add_rot_forces(t_rot *rot, rvec f[], t_commrec *cr, gmx_large_int_t step, real t)
+extern real add_rot_forces(t_rot *rot, rvec f[], t_commrec *cr, gmx_int64_t step, real t)
{
int g, l, ii;
t_rotgrp *rotg;
/* Subtract the slab center from xj */
rvec_sub(xj, xcn, tmpvec2); /* tmpvec2 = xj - xcn */
-
+
/* In rare cases, when an atom position coincides with a slab center
- * (tmpvec2 == 0) we cannot compute the vector product for sjn.
- * However, since the atom is located directly on the pivot, this
- * slab's contribution to the force on that atom will be zero
+ * (tmpvec2 == 0) we cannot compute the vector product for sjn.
+ * However, since the atom is located directly on the pivot, this
+ * slab's contribution to the force on that atom will be zero
* anyway. Therefore, we directly move on to the next slab. */
- if ( 0 == norm(tmpvec2) )
+ if (0 == norm(tmpvec2) )
{
continue;
}
rvec_sub(xj, xcn, xj_xcn); /* xj_xcn = xj - xcn */
/* In rare cases, when an atom position coincides with a slab center
- * (xj_xcn == 0) we cannot compute the vector product for qjn.
- * However, since the atom is located directly on the pivot, this
- * slab's contribution to the force on that atom will be zero
+ * (xj_xcn == 0) we cannot compute the vector product for qjn.
+ * However, since the atom is located directly on the pivot, this
+ * slab's contribution to the force on that atom will be zero
* anyway. Therefore, we directly move on to the next slab. */
- if ( 0 == norm(xj_xcn) )
+ if (0 == norm(xj_xcn) )
{
continue;
}
}
#endif
}
-
+
if (bColl)
{
- /* Save the original (whole) set of positions in xc_old such that at later
+ /* Save the original (whole) set of positions in xc_old such that at later
* steps the rotation group can always be made whole again. If the simulation is
* restarted, we compute the starting reference positions (given the time)
* and assume that the correct PBC image of each position is the one nearest
{
ii = rotg->ind[i];
- /* Subtract pivot, rotate, and add pivot again. This will yield the
+ /* Subtract pivot, rotate, and add pivot again. This will yield the
* reference position for time t */
rvec_sub(rotg->x_ref[i], erg->xc_ref_center, coord);
mvmul(erg->rotmat, coord, xref);
matrix box,
rvec x[],
real t,
- gmx_large_int_t step,
+ gmx_int64_t step,
gmx_wallcycle_t wcycle,
gmx_bool bNS)
{
}
}
-static void print_epot(FILE *fp, gmx_large_int_t mdstep, int count, real epot, real df,
+static void print_epot(FILE *fp, gmx_int64_t mdstep, int count, real epot, real df,
int ndir, real sf_dir)
{
char buf[22];
static void init_adir(FILE *log, gmx_shellfc_t shfc,
gmx_constr_t constr, t_idef *idef, t_inputrec *ir,
t_commrec *cr, int dd_ac1,
- gmx_large_int_t step, t_mdatoms *md, int start, int end,
+ gmx_int64_t step, t_mdatoms *md, int start, int end,
rvec *x_old, rvec *x_init, rvec *x,
rvec *f, rvec *acc_dir,
gmx_bool bMolPBC, matrix box,
}
int relax_shell_flexcon(FILE *fplog, t_commrec *cr, gmx_bool bVerbose,
- gmx_large_int_t mdstep, t_inputrec *inputrec,
+ gmx_int64_t mdstep, t_inputrec *inputrec,
gmx_bool bDoNS, int force_flags,
gmx_localtop_t *top,
gmx_constr_t constr,
void print_time(FILE *out,
gmx_walltime_accounting_t walltime_accounting,
- gmx_large_int_t step,
+ gmx_int64_t step,
t_inputrec *ir,
t_commrec gmx_unused *cr)
{
}
static void print_large_forces(FILE *fp, t_mdatoms *md, t_commrec *cr,
- gmx_large_int_t step, real pforce, rvec *x, rvec *f)
+ gmx_int64_t step, real pforce, rvec *x, rvec *f)
{
int i;
real pf2, fn2;
}
static void post_process_forces(t_commrec *cr,
- gmx_large_int_t step,
+ gmx_int64_t step,
t_nrnb *nrnb, gmx_wallcycle_t wcycle,
gmx_localtop_t *top,
matrix box, rvec x[],
void do_force_cutsVERLET(FILE *fplog, t_commrec *cr,
t_inputrec *inputrec,
- gmx_large_int_t step, t_nrnb *nrnb, gmx_wallcycle_t wcycle,
+ gmx_int64_t step, t_nrnb *nrnb, gmx_wallcycle_t wcycle,
gmx_localtop_t *top,
gmx_groups_t gmx_unused *groups,
matrix box, rvec x[], history_t *hist,
void do_force_cutsGROUP(FILE *fplog, t_commrec *cr,
t_inputrec *inputrec,
- gmx_large_int_t step, t_nrnb *nrnb, gmx_wallcycle_t wcycle,
+ gmx_int64_t step, t_nrnb *nrnb, gmx_wallcycle_t wcycle,
gmx_localtop_t *top,
gmx_groups_t *groups,
matrix box, rvec x[], history_t *hist,
void do_force(FILE *fplog, t_commrec *cr,
t_inputrec *inputrec,
- gmx_large_int_t step, t_nrnb *nrnb, gmx_wallcycle_t wcycle,
+ gmx_int64_t step, t_nrnb *nrnb, gmx_wallcycle_t wcycle,
gmx_localtop_t *top,
gmx_groups_t *groups,
matrix box, rvec x[], history_t *hist,
t_forcerec *fr, gmx_localtop_t *top)
{
int i, m, start, end;
- gmx_large_int_t step;
+ gmx_int64_t step;
real dt = ir->delta_t;
real dvdl_dum;
rvec *savex;
}
void calc_dispcorr(FILE *fplog, t_inputrec *ir, t_forcerec *fr,
- gmx_large_int_t step, int natoms,
+ gmx_int64_t step, int natoms,
matrix box, real lambda, tensor pres, tensor virial,
real *prescorr, real *enercorr, real *dvdlcorr)
{
where();
}
-int do_per_step(gmx_large_int_t step, gmx_large_int_t nstep)
+int do_per_step(gmx_int64_t step, gmx_int64_t nstep)
{
if (nstep != 0)
{
return 0;
}
}
-
gmx_bool randatom_list_init;
/* Variables for the deform algorithm */
- gmx_large_int_t deformref_step;
+ gmx_int64_t deformref_step;
matrix deformref_box;
} t_gmx_update;
}
}
-void set_deform_reference_box(gmx_update_t upd, gmx_large_int_t step, matrix box)
+void set_deform_reference_box(gmx_update_t upd, gmx_int64_t step, matrix box)
{
upd->deformref_step = step;
copy_mat(box, upd->deformref_box);
static void deform(gmx_update_t upd,
int start, int homenr, rvec x[], matrix box, matrix *scale_tot,
- const t_inputrec *ir, gmx_large_int_t step)
+ const t_inputrec *ir, gmx_int64_t step)
{
matrix bnew, invbox, mu;
real elapsed_time;
gmx_constr_t constr,
t_inputrec *ir, t_mdatoms *md, t_idef *idef,
t_commrec *cr,
- gmx_large_int_t step,
+ gmx_int64_t step,
t_state *state, gmx_bool bMolPBC,
int start, int nrend,
rvec f[], rvec f_lr[],
}
}
-void update_tcouple(gmx_large_int_t step,
+void update_tcouple(gmx_int64_t step,
t_inputrec *inputrec,
t_state *state,
gmx_ekindata_t *ekind,
}
void update_pcouple(FILE *fplog,
- gmx_large_int_t step,
+ gmx_int64_t step,
t_inputrec *inputrec,
t_state *state,
matrix pcoupl_mu,
}
void update_constraints(FILE *fplog,
- gmx_large_int_t step,
+ gmx_int64_t step,
real *dvdlambda, /* the contribution to be added to the bonded interactions */
t_inputrec *inputrec, /* input record and box stuff */
gmx_ekindata_t *ekind,
}
void update_box(FILE *fplog,
- gmx_large_int_t step,
+ gmx_int64_t step,
t_inputrec *inputrec, /* input record and box stuff */
t_mdatoms *md,
t_state *state,
}
void update_coords(FILE *fplog,
- gmx_large_int_t step,
+ gmx_int64_t step,
t_inputrec *inputrec, /* input record and box stuff */
t_mdatoms *md,
t_state *state,
mv[XX], mv[YY], mv[ZZ]);
}
-extern gmx_bool update_randomize_velocities(t_inputrec *ir, gmx_large_int_t step, t_mdatoms *md, t_state *state, gmx_update_t upd, t_idef *idef, gmx_constr_t constr)
+extern gmx_bool update_randomize_velocities(t_inputrec *ir, gmx_int64_t step, t_mdatoms *md, t_state *state, gmx_update_t upd, t_idef *idef, gmx_constr_t constr)
{
int i;
#line 2 "scanner.cpp"
+#line 50 "scanner.l"
+// Required before flex definitions, since it includes <stdint.h>.
+// Otherwise, compilers not strictly C99 get macro redefinition errors,
+// since flex defines INT64_MAX etc. in such cases.
+#include "gromacs/legacyheaders/types/simple.h"
+
-#line 4 "scanner.cpp"
+
+#line 11 "scanner.cpp"
#define YY_INT_ALIGNED short int
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013, 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.
*
* \ingroup module_selection
*/
-#line 50 "scanner.l"
+
+#line 56 "scanner.l"
#include "gromacs/legacyheaders/string2.h"
#include "parser.h"
#include "scanner.h"
#include "scanner_internal.h"
-/* This macro is here to make the actions a bit shorter, since nearly every
- * action needs this call. */
+// This macro makes the actions a bit shorter, since nearly every action needs
+// this call.
#define ADD_TOKEN _gmx_sel_lexer_add_token(yytext, yyleng, state)
#define YY_NO_UNISTD_H 1
-#line 564 "scanner.cpp"
+#line 572 "scanner.cpp"
#define INITIAL 0
#define matchof 1
register int yy_act;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-#line 85 "scanner.l"
+#line 91 "scanner.l"
}
-#line 827 "scanner.cpp"
+#line 835 "scanner.cpp"
if ( !yyg->yy_init )
{
case 1:
YY_RULE_SETUP
-#line 118 "scanner.l"
+#line 124 "scanner.l"
YY_BREAK
case 2:
YY_RULE_SETUP
-#line 119 "scanner.l"
+#line 125 "scanner.l"
{ yylval->i = strtol(yytext, NULL, 10); ADD_TOKEN; return TOK_INT; }
YY_BREAK
case 3:
YY_RULE_SETUP
-#line 120 "scanner.l"
+#line 126 "scanner.l"
{ yylval->r = strtod(yytext, NULL); ADD_TOKEN; return TOK_REAL; }
YY_BREAK
case 4:
YY_RULE_SETUP
-#line 121 "scanner.l"
+#line 127 "scanner.l"
{ yylval->str = gmx_strndup(yytext+1, yyleng-2); ADD_TOKEN; return STR; }
YY_BREAK
case 5:
/* rule 5 can match eol */
YY_RULE_SETUP
-#line 123 "scanner.l"
+#line 129 "scanner.l"
{ _gmx_sel_lexer_add_token(" ", 1, state); }
YY_BREAK
case 6:
/* rule 6 can match eol */
YY_RULE_SETUP
-#line 124 "scanner.l"
+#line 130 "scanner.l"
{
if (yytext[0] == ';' || state->bInteractive)
{
}
YY_BREAK
case YY_STATE_EOF(cmdstart):
-#line 137 "scanner.l"
+#line 143 "scanner.l"
{ state->bCmdStart = true; yyterminate(); }
YY_BREAK
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(matchof):
case YY_STATE_EOF(matchbool):
case YY_STATE_EOF(help):
-#line 138 "scanner.l"
+#line 144 "scanner.l"
{ state->bCmdStart = true; return CMD_SEP; }
YY_BREAK
case 7:
YY_RULE_SETUP
-#line 140 "scanner.l"
+#line 146 "scanner.l"
{ if (YYSTATE == cmdstart) { BEGIN(help); } return HELP; }
YY_BREAK
case 8:
YY_RULE_SETUP
-#line 142 "scanner.l"
+#line 148 "scanner.l"
YY_BREAK
case 9:
YY_RULE_SETUP
-#line 143 "scanner.l"
+#line 149 "scanner.l"
{ yylval->str = gmx_strndup(yytext, yyleng); return HELP_TOPIC; }
YY_BREAK
case 10:
/* rule 10 can match eol */
YY_RULE_SETUP
-#line 144 "scanner.l"
+#line 150 "scanner.l"
{ state->bCmdStart = true; return CMD_SEP; }
YY_BREAK
case 11:
YY_RULE_SETUP
-#line 145 "scanner.l"
+#line 151 "scanner.l"
{ return INVALID; }
YY_BREAK
case 12:
YY_RULE_SETUP
-#line 149 "scanner.l"
+#line 155 "scanner.l"
{ ADD_TOKEN; yylval->i = 1; return TOK_INT; }
YY_BREAK
case 13:
YY_RULE_SETUP
-#line 150 "scanner.l"
+#line 156 "scanner.l"
{ ADD_TOKEN; yylval->i = 0; return TOK_INT; }
YY_BREAK
case 14:
YY_RULE_SETUP
-#line 152 "scanner.l"
+#line 158 "scanner.l"
{ ADD_TOKEN; return GROUP; }
YY_BREAK
case 15:
YY_RULE_SETUP
-#line 153 "scanner.l"
+#line 159 "scanner.l"
{ ADD_TOKEN; return TO; }
YY_BREAK
case 16:
YY_RULE_SETUP
-#line 154 "scanner.l"
+#line 160 "scanner.l"
{ ADD_TOKEN; BEGIN(0); return OF; }
YY_BREAK
case 17:
YY_RULE_SETUP
-#line 155 "scanner.l"
+#line 161 "scanner.l"
{ ADD_TOKEN; return AND; }
YY_BREAK
case 18:
YY_RULE_SETUP
-#line 156 "scanner.l"
+#line 162 "scanner.l"
{ ADD_TOKEN; return OR; }
YY_BREAK
case 19:
YY_RULE_SETUP
-#line 157 "scanner.l"
+#line 163 "scanner.l"
{ ADD_TOKEN; return XOR; }
YY_BREAK
case 20:
YY_RULE_SETUP
-#line 158 "scanner.l"
+#line 164 "scanner.l"
{ ADD_TOKEN; return NOT; }
YY_BREAK
case 21:
YY_RULE_SETUP
-#line 159 "scanner.l"
+#line 165 "scanner.l"
{ yylval->str = gmx_strndup(yytext, yyleng); ADD_TOKEN; return CMP_OP; }
YY_BREAK
case 22:
YY_RULE_SETUP
-#line 161 "scanner.l"
+#line 167 "scanner.l"
{ return _gmx_sel_lexer_process_identifier(yylval, yytext, yyleng, state); }
YY_BREAK
case 23:
YY_RULE_SETUP
-#line 163 "scanner.l"
+#line 169 "scanner.l"
{ _gmx_sel_lexer_add_token(" ", 1, state); }
YY_BREAK
case 24:
YY_RULE_SETUP
-#line 164 "scanner.l"
+#line 170 "scanner.l"
{ yylval->str = gmx_strndup(yytext, yyleng); ADD_TOKEN; return STR; }
YY_BREAK
case 25:
YY_RULE_SETUP
-#line 165 "scanner.l"
+#line 171 "scanner.l"
{ ADD_TOKEN; return yytext[0]; }
YY_BREAK
case 26:
YY_RULE_SETUP
-#line 166 "scanner.l"
+#line 172 "scanner.l"
YY_FATAL_ERROR( "flex scanner jammed" );
YY_BREAK
-#line 1065 "scanner.cpp"
+#line 1073 "scanner.cpp"
case YY_END_OF_BUFFER:
{
#define YYTABLES_NAME "yytables"
-#line 166 "scanner.l"
+#line 172 "scanner.l"
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013, 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.
*
* \ingroup module_selection
*/
+%top{
+// Required before flex definitions, since it includes <stdint.h>.
+// Otherwise, compilers not strictly C99 get macro redefinition errors,
+// since flex defines INT32_MAX etc. in such cases.
+#include "gromacs/legacyheaders/types/simple.h"
+}
%{
#include "gromacs/legacyheaders/string2.h"
#include "scanner.h"
#include "scanner_internal.h"
-/* This macro is here to make the actions a bit shorter, since nearly every
- * action needs this call. */
+// This macro makes the actions a bit shorter, since nearly every action needs
+// this call.
#define ADD_TOKEN _gmx_sel_lexer_add_token(yytext, yyleng, state)
%}
#define _gmx_sel_yyIN_HEADER 1
#line 6 "scanner_flex.h"
+#line 50 "scanner.l"
+// Required before flex definitions, since it includes <stdint.h>.
+// Otherwise, compilers not strictly C99 get macro redefinition errors,
+// since flex defines INT64_MAX etc. in such cases.
+#include "gromacs/legacyheaders/types/simple.h"
-#line 8 "scanner_flex.h"
+
+
+#line 15 "scanner_flex.h"
#define YY_INT_ALIGNED short int
#undef YY_DECL
#endif
-#line 166 "scanner.l"
+#line 172 "scanner.l"
-#line 340 "scanner_flex.h"
+#line 347 "scanner_flex.h"
#undef _gmx_sel_yyIN_HEADER
#endif /* _gmx_sel_yyHEADER_H */
#endif
int ewc_prev;
gmx_cycles_t cycle_prev;
- gmx_large_int_t reset_counters;
+ gmx_int64_t reset_counters;
#ifdef GMX_MPI
MPI_Comm mpi_comm_mygroup;
#endif
}
}
-extern gmx_large_int_t wcycle_get_reset_counters(gmx_wallcycle_t wc)
+extern gmx_int64_t wcycle_get_reset_counters(gmx_wallcycle_t wc)
{
if (wc == NULL)
{
return wc->reset_counters;
}
-extern void wcycle_set_reset_counters(gmx_wallcycle_t wc, gmx_large_int_t reset_counters)
+extern void wcycle_set_reset_counters(gmx_wallcycle_t wc, gmx_int64_t reset_counters)
{
if (wc == NULL)
{
gmx_wallcycle_t wc, wallclock_gpu_t *gpu_t);
/* Print the cycle and time accounting */
-gmx_large_int_t wcycle_get_reset_counters(gmx_wallcycle_t wc);
+gmx_int64_t wcycle_get_reset_counters(gmx_wallcycle_t wc);
/* Return reset_counters from wc struct */
-void wcycle_set_reset_counters(gmx_wallcycle_t wc, gmx_large_int_t reset_counters);
+void wcycle_set_reset_counters(gmx_wallcycle_t wc, gmx_int64_t reset_counters);
/* Set reset_counters */
void wallcycle_sub_start(gmx_wallcycle_t wc, int ewcs);
* with respect to parallelism implementation. */
int numOpenMPThreads;
//! Set by integrators to report the amount of work they did
- gmx_large_int_t nsteps_done;
+ gmx_int64_t nsteps_done;
} t_gmx_walltime_accounting;
/*! \brief Calls system timing routines (e.g. clock_gettime) to get
void
walltime_accounting_set_nsteps_done(gmx_walltime_accounting_t walltime_accounting,
- gmx_large_int_t nsteps_done)
+ gmx_int64_t nsteps_done)
{
walltime_accounting->nsteps_done = nsteps_done;
}
* TODO consider whether this should get done in walltime_accounting_end */
void
walltime_accounting_set_nsteps_done(gmx_walltime_accounting_t walltime_accounting,
- gmx_large_int_t nsteps_done);
+ gmx_int64_t nsteps_done);
/*! \brief Calls system timing routines (e.g. clock_gettime) to get the
* (fractional) number of seconds elapsed since the epoch.
}
}
-static void cmp_gmx_large_int(FILE *fp, const char *s, gmx_large_int_t i1, gmx_large_int_t i2)
+static void cmp_gmx_large_int(FILE *fp, const char *s, gmx_int64_t i1, gmx_int64_t i2)
{
if (i1 != i2)
{
fprintf(fp, "%s (", s);
- fprintf(fp, gmx_large_int_pfmt, i1);
+ fprintf(fp, "%"GMX_PRId64, i1);
fprintf(fp, " - ");
- fprintf(fp, gmx_large_int_pfmt, i2);
+ fprintf(fp, "%"GMX_PRId64, i2);
fprintf(fp, ")\n");
}
}
ener_file_t fp_ener = NULL;
t_trnheader head;
int i;
- gmx_large_int_t nsteps_req, run_step, frame;
+ gmx_int64_t nsteps_req, run_step, frame;
double run_t, state_t;
gmx_bool bOK, bNsteps, bExtend, bUntil, bTime, bTraj;
gmx_bool bFrame, bUse, bSel, bNeedEner, bReadEner, bScanEner, bFepState;
return 0;
}
- /* Convert int to gmx_large_int_t */
+ /* Convert int to gmx_int64_t */
nsteps_req = nsteps_req_int;
bNsteps = opt2parg_bSet("-nsteps", asize(pa), pa);
bExtend = opt2parg_bSet("-extend", asize(pa), pa);
if (bFrame || !bOK)
{
sprintf(buf, "\r%s %s frame %s%s: step %s%s time %s",
- "%s", "%s", "%6", gmx_large_int_fmt, "%6", gmx_large_int_fmt, " %8.3f");
+ "%s", "%s", "%6", GMX_PRId64, "%6", GMX_PRId64, " %8.3f");
fprintf(stderr, buf,
bUse ? "Read " : "Skipped", ftp2ext(fn2ftp(frame_fn)),
frame, head.step, head.t);
/* Determine total number of steps remaining */
if (bExtend)
{
- ir->nsteps = ir->nsteps - (run_step - ir->init_step) + (gmx_large_int_t)(extend_t/ir->delta_t + 0.5);
+ ir->nsteps = ir->nsteps - (run_step - ir->init_step) + (gmx_int64_t)(extend_t/ir->delta_t + 0.5);
printf("Extending remaining runtime of by %g ps (now %s steps)\n",
extend_t, gmx_step_str(ir->nsteps, buf));
}
gmx_step_str(ir->nsteps, buf),
gmx_step_str(run_step, buf2),
run_t, until_t);
- ir->nsteps = (gmx_large_int_t)((until_t - run_t)/ir->delta_t + 0.5);
+ ir->nsteps = (gmx_int64_t)((until_t - run_t)/ir->delta_t + 0.5);
printf("Extending remaining runtime until %g ps (now %s steps)\n",
until_t, gmx_step_str(ir->nsteps, buf));
}
}
state_t = ir->init_t + ir->init_step*ir->delta_t;
- sprintf(buf, "Writing statusfile with starting step %s%s and length %s%s steps...\n", "%10", gmx_large_int_fmt, "%10", gmx_large_int_fmt);
+ sprintf(buf, "Writing statusfile with starting step %s%s and length %s%s steps...\n", "%10", GMX_PRId64, "%10", GMX_PRId64);
fprintf(stderr, buf, ir->init_step, ir->nsteps);
fprintf(stderr, " time %10.3f and length %10.3f ps\n",
state_t, ir->nsteps*ir->delta_t);
#endif
static void reset_all_counters(FILE *fplog, t_commrec *cr,
- gmx_large_int_t step,
- gmx_large_int_t *step_rel, t_inputrec *ir,
+ gmx_int64_t step,
+ gmx_int64_t *step_rel, t_inputrec *ir,
gmx_wallcycle_t wcycle, t_nrnb *nrnb,
gmx_walltime_accounting_t walltime_accounting,
nbnxn_cuda_ptr_t cu_nbv)
gmx_walltime_accounting_t walltime_accounting)
{
gmx_mdoutf_t *outf;
- gmx_large_int_t step, step_rel;
+ gmx_int64_t step, step_rel;
double elapsed_time;
double t, t0, lam0[efptNR];
gmx_bool bGStatEveryStep, bGStat, bCalcVir, bCalcEner;
char sbuf[STEPSTRSIZE], sbuf2[STEPSTRSIZE];
int handled_stop_condition = gmx_stop_cond_none; /* compare to get_stop_condition*/
gmx_iterate_t iterate;
- gmx_large_int_t multisim_nsteps = -1; /* number of steps to do before first multisim
- simulation stops. If equal to zero, don't
- communicate any more between multisims.*/
+ gmx_int64_t multisim_nsteps = -1; /* number of steps to do before first multisim
+ simulation stops. If equal to zero, don't
+ communicate any more between multisims.*/
/* PME load balancing data for GPU kernels */
pme_load_balancing_t pme_loadbal = NULL;
double cycles_pmes;
int repl_ex_nex = 0;
int nstepout = 100;
int resetstep = -1;
- gmx_large_int_t nsteps = -2; /* the value -2 means that the mdp option will be used */
+ gmx_int64_t nsteps = -2; /* the value -2 means that the mdp option will be used */
rvec realddxyz = {0, 0, 0};
const char *ddno_opt[ddnoNR+1] =
}
static void print_loadbal_limited(FILE *fp_err, FILE *fp_log,
- gmx_large_int_t step,
+ gmx_int64_t step,
pme_load_balancing_t pme_lb)
{
char buf[STRLEN], sbuf[22];
interaction_const_t *ic,
nonbonded_verlet_t *nbv,
gmx_pme_t *pmedata,
- gmx_large_int_t step)
+ gmx_int64_t step)
{
gmx_bool OK;
pme_setup_t *set;
interaction_const_t *ic,
nonbonded_verlet_t *nbv,
gmx_pme_t *pmedata,
- gmx_large_int_t step);
+ gmx_int64_t step);
/* Restart the PME load balancing discarding all timings gathered up till now */
void restart_pme_loadbal(pme_load_balancing_t pme_lb, int n);
struct gmx_repl_ex *re,
gmx_enerdata_t *enerd,
real vol,
- gmx_large_int_t step,
+ gmx_int64_t step,
real time)
{
int m, i, j, a, b, ap, bp, i0, i1, tmp;
gmx_bool bVol = FALSE;
bMultiEx = (re->nex > 1); /* multiple exchanges at each state */
- fprintf(fplog, "Replica exchange at step " gmx_large_int_pfmt " time %g\n", step, time);
+ fprintf(fplog, "Replica exchange at step " "%"GMX_PRId64 " time %g\n", step, time);
if (re->bNPT)
{
gmx_bool replica_exchange(FILE *fplog, const t_commrec *cr, struct gmx_repl_ex *re,
t_state *state, gmx_enerdata_t *enerd,
- t_state *state_local, gmx_large_int_t step, real time)
+ t_state *state_local, gmx_int64_t step, real time)
{
int i, j;
int replica_id = 0;
gmx_repl_ex_t re,
t_state *state, gmx_enerdata_t *enerd,
t_state *state_local,
- gmx_large_int_t step, real time);
+ gmx_int64_t step, real time);
/* Attempts replica exchange, should be called on all nodes.
* Returns TRUE if this state has been exchanged.
* When running each replica in parallel,
/* The array should match the eI array in include/types/enums.h */
const gmx_intp_t integrator[eiNR] = { {do_md}, {do_steep}, {do_cg}, {do_md}, {do_md}, {do_nm}, {do_lbfgs}, {do_tpi}, {do_tpi}, {do_md}, {do_md}, {do_md}};
-gmx_large_int_t deform_init_init_step_tpx;
+gmx_int64_t deform_init_init_step_tpx;
matrix deform_init_box_tpx;
tMPI_Thread_mutex_t deform_init_box_mutex = TMPI_THREAD_MUTEX_INITIALIZER;
const char *ddcsz;
const char *nbpu_opt;
int nstlist_cmdline;
- gmx_large_int_t nsteps_cmdline;
+ gmx_int64_t nsteps_cmdline;
int nstepout;
int resetstep;
int nmultisim;
const char *dddlb_opt, real dlb_scale,
const char *ddcsx, const char *ddcsy, const char *ddcsz,
const char *nbpu_opt, int nstlist_cmdline,
- gmx_large_int_t nsteps_cmdline,
+ gmx_int64_t nsteps_cmdline,
int nstepout, int resetstep,
int nmultisim, int repl_ex_nst, int repl_ex_nex, int repl_ex_seed,
real pforce, real cpt_period, real max_hours,
/* fill the data structure to pass as void pointer to thread start fn */
/* hw_opt contains pointers, which should all be NULL at this stage */
- mda->hw_opt = *hw_opt;
- mda->fplog = fplog;
- mda->cr = cr;
- mda->nfile = nfile;
- mda->fnm = fnmn;
- mda->oenv = oenv;
- mda->bVerbose = bVerbose;
- mda->bCompact = bCompact;
- mda->nstglobalcomm = nstglobalcomm;
- mda->ddxyz[XX] = ddxyz[XX];
- mda->ddxyz[YY] = ddxyz[YY];
- mda->ddxyz[ZZ] = ddxyz[ZZ];
- mda->dd_node_order = dd_node_order;
- mda->rdd = rdd;
- mda->rconstr = rconstr;
- mda->dddlb_opt = dddlb_opt;
- mda->dlb_scale = dlb_scale;
- mda->ddcsx = ddcsx;
- mda->ddcsy = ddcsy;
- mda->ddcsz = ddcsz;
- mda->nbpu_opt = nbpu_opt;
- mda->nstlist_cmdline= nstlist_cmdline;
- mda->nsteps_cmdline = nsteps_cmdline;
- mda->nstepout = nstepout;
- mda->resetstep = resetstep;
- mda->nmultisim = nmultisim;
- mda->repl_ex_nst = repl_ex_nst;
- mda->repl_ex_nex = repl_ex_nex;
- mda->repl_ex_seed = repl_ex_seed;
- mda->pforce = pforce;
- mda->cpt_period = cpt_period;
- mda->max_hours = max_hours;
- mda->deviceOptions = deviceOptions;
- mda->Flags = Flags;
+ mda->hw_opt = *hw_opt;
+ mda->fplog = fplog;
+ mda->cr = cr;
+ mda->nfile = nfile;
+ mda->fnm = fnmn;
+ mda->oenv = oenv;
+ mda->bVerbose = bVerbose;
+ mda->bCompact = bCompact;
+ mda->nstglobalcomm = nstglobalcomm;
+ mda->ddxyz[XX] = ddxyz[XX];
+ mda->ddxyz[YY] = ddxyz[YY];
+ mda->ddxyz[ZZ] = ddxyz[ZZ];
+ mda->dd_node_order = dd_node_order;
+ mda->rdd = rdd;
+ mda->rconstr = rconstr;
+ mda->dddlb_opt = dddlb_opt;
+ mda->dlb_scale = dlb_scale;
+ mda->ddcsx = ddcsx;
+ mda->ddcsy = ddcsy;
+ mda->ddcsz = ddcsz;
+ mda->nbpu_opt = nbpu_opt;
+ mda->nstlist_cmdline = nstlist_cmdline;
+ mda->nsteps_cmdline = nsteps_cmdline;
+ mda->nstepout = nstepout;
+ mda->resetstep = resetstep;
+ mda->nmultisim = nmultisim;
+ mda->repl_ex_nst = repl_ex_nst;
+ mda->repl_ex_nex = repl_ex_nex;
+ mda->repl_ex_seed = repl_ex_seed;
+ mda->pforce = pforce;
+ mda->cpt_period = cpt_period;
+ mda->max_hours = max_hours;
+ mda->deviceOptions = deviceOptions;
+ mda->Flags = Flags;
/* now spawn new threads that start mdrunner_start_fn(), while
the main thread returns, we set thread affinity later */
*/
static const int nbnxn_reference_nstlist = 10;
/* The values to try when switching */
-const int nstlist_try[] = { 20, 25, 40 };
+const int nstlist_try[] = { 20, 25, 40 };
#define NNSTL sizeof(nstlist_try)/sizeof(nstlist_try[0])
/* Increase nstlist until the non-bonded cost increases more than listfac_ok,
* but never more than listfac_max.
}
else
{
- ir->verletbuf_tol = -1;
+ ir->verletbuf_tol = -1;
ir->rlist = 1.05*max(ir->rvdw, ir->rcoulomb);
}
/* Override the value in inputrec with value passed on the command line (if any) */
static void override_nsteps_cmdline(FILE *fplog,
- gmx_large_int_t nsteps_cmdline,
+ gmx_int64_t nsteps_cmdline,
t_inputrec *ir,
const t_commrec *cr)
{
const char *dddlb_opt, real dlb_scale,
const char *ddcsx, const char *ddcsy, const char *ddcsz,
const char *nbpu_opt, int nstlist_cmdline,
- gmx_large_int_t nsteps_cmdline, int nstepout, int resetstep,
+ gmx_int64_t nsteps_cmdline, int nstepout, int resetstep,
int gmx_unused nmultisim, int repl_ex_nst, int repl_ex_nex,
int repl_ex_seed, real pforce, real cpt_period, real max_hours,
const char *deviceOptions, unsigned long Flags)
int list;
gmx_walltime_accounting_t walltime_accounting = NULL;
int rc;
- gmx_large_int_t reset_counters;
+ gmx_int64_t reset_counters;
gmx_edsam_t ed = NULL;
t_commrec *cr_old = cr;
int nthreads_pme = 1;