static void make_pp_communicator(FILE *fplog,
gmx_domdec_t *dd,
t_commrec gmx_unused *cr,
- int gmx_unused reorder)
+ bool gmx_unused reorder)
{
#if GMX_MPI
gmx_domdec_comm_t *comm;
{
periods[i] = TRUE;
}
- MPI_Cart_create(cr->mpi_comm_mygroup, DIM, dd->nc, periods, reorder,
+ MPI_Cart_create(cr->mpi_comm_mygroup, DIM, dd->nc, periods, static_cast<int>(reorder),
&comm_cart);
/* We overwrite the old communicator with the new cartesian one */
cr->mpi_comm_mygroup = comm_cart;
static void split_communicator(FILE *fplog, t_commrec *cr, gmx_domdec_t *dd,
DdRankOrder gmx_unused rankOrder,
- int gmx_unused reorder)
+ bool gmx_unused reorder)
{
gmx_domdec_comm_t *comm;
int i;
{
periods[i] = TRUE;
}
- MPI_Cart_create(cr->mpi_comm_mysim, DIM, comm->ntot, periods, reorder,
+ MPI_Cart_create(cr->mpi_comm_mysim, DIM, comm->ntot, periods, static_cast<int>(reorder),
&comm_cart);
MPI_Comm_rank(comm_cart, &rank);
if (MASTER(cr) && rank != 0)
gmx_domdec_t *dd, DdRankOrder ddRankOrder)
{
gmx_domdec_comm_t *comm;
- int CartReorder;
+ bool CartReorder;
comm = dd->comm;
* Real reordering is only supported on very few architectures,
* Blue Gene is one of them.
*/
- CartReorder = (getenv("GMX_NO_CART_REORDER") == nullptr);
+ CartReorder = getenv("GMX_NO_CART_REORDER") == nullptr;
if (cr->npmenodes > 0)
{
{
dd->comm->bCheckWhetherToTurnDlbOn = bValue;
- if (bValue == TRUE)
+ if (bValue)
{
/* Store the DD partitioning count, so we can ignore cycle counts
* over the next nstlist steps, which are often slower.
/* Project fitted structure onto supbspace -> store in edi->flood.vecs.xproj */
project_to_eigvectors(buf->xcoll, &edi->flood.vecs, *edi);
- if (FALSE == edi->flood.bConstForce)
+ if (!edi->flood.bConstForce)
{
/* Compute Vfl(x) from flood.xproj */
edi->flood.Vfl = flood_energy(edi, step);
return idum;
}
+static bool read_checked_edbool(FILE *file, const char *label)
+{
+ return read_checked_edint(file, label) != 0;
+}
static int read_edint(FILE *file, bool *bEOF)
{
}
/* Done checking. For the rest we blindly trust the input */
- edi->fitmas = read_checked_edint(in, "FITMAS");
- edi->pcamas = read_checked_edint(in, "ANALYSIS_MAS");
+ edi->fitmas = read_checked_edbool(in, "FITMAS");
+ edi->pcamas = read_checked_edbool(in, "ANALYSIS_MAS");
edi->outfrq = read_checked_edint(in, "OUTFRQ");
edi->maxedsteps = read_checked_edint(in, "MAXLEN");
edi->slope = read_checked_edreal(in, "SLOPECRIT");
edi->flood.constEfl = read_checked_edreal(in, "EFL_NULL");
edi->flood.alpha2 = read_checked_edreal(in, "ALPHA2");
edi->flood.kT = read_checked_edreal(in, "KT");
- edi->flood.bHarmonic = read_checked_edint(in, "HARMONIC");
+ edi->flood.bHarmonic = read_checked_edbool(in, "HARMONIC");
if (hasConstForceFlooding)
{
- edi->flood.bConstForce = read_checked_edint(in, "CONST_FORCE_FLOODING");
+ edi->flood.bConstForce = read_checked_edbool(in, "CONST_FORCE_FLOODING");
}
else
{
}
/* process structure that will serve as origin of expansion circle */
- if ( (eEDflood == ed->eEDtype) && (FALSE == edi->flood.bConstForce) )
+ if (eEDflood == ed->eEDtype && !edi->flood.bConstForce)
{
fprintf(stderr, "ED: Setting center of flooding potential (0 = average structure)\n");
}
rad_project(*edi, &edi->sori.x[avindex], &edi->vecs.radacc);
rad_project(*edi, &edi->sori.x[avindex], &edi->vecs.radfix);
- if ( (eEDflood == ed->eEDtype) && (FALSE == edi->flood.bConstForce) )
+ if (eEDflood == ed->eEDtype && !edi->flood.bConstForce)
{
fprintf(stderr, "ED: The ORIGIN structure will define the flooding potential center.\n");
/* Set center of flooding potential to the ORIGIN structure */
{
rad_project(*edi, xstart, &edi->vecs.radacc);
rad_project(*edi, xstart, &edi->vecs.radfix);
- if ( (eEDflood == ed->eEDtype) && (FALSE == edi->flood.bConstForce) )
+ if (eEDflood == ed->eEDtype && !edi->flood.bConstForce)
{
if (edi->flood.bHarmonic)
{
}
}
/* For convenience, output the center of the flooding potential for the eigenvectors */
- if ( (eEDflood == ed->eEDtype) && (FALSE == edi->flood.bConstForce) )
+ if (eEDflood == ed->eEDtype && !edi->flood.bConstForce)
{
for (i = 0; i < edi->flood.vecs.neig; i++)
{
int dest, src;
MPI_Status stat;
- if (bBackward == FALSE)
+ if (!bBackward)
{
dest = atc->node_dest[shift];
src = atc->node_src[shift];
int nx,
int ny)
{
- int i, j, k, im, n, ncount, done1, done2;
+ int i, j, k, im, n, ncount;
+ bool done1, done2;
int i1, i1c, i2, i2c, kmi, max;
t_complex tmp1, tmp2, tmp3;
i = 1;
im = ny;
- done1 = 0;
+ done1 = false;
do
{
i1 = i;
tmp2.re = data[i1c].re;
tmp2.im = data[i1c].im;
- done2 = 0;
+ done2 = false;
do
{
i2 = ny*i1-k*(i1/nx);
ncount += 2;
if (i2 == i)
{
- done2 = 1;
+ done2 = true;
}
else if (i2 == kmi)
{
tmp1.im = tmp2.im;
tmp2.re = tmp3.re;
tmp2.im = tmp3.im;
- done2 = 1;
+ done2 = true;
}
else
{
if (ncount >= n)
{
- done1 = 1;
+ done1 = true;
}
else
{
- done2 = 0;
+ done2 = false;
do
{
max = k-i;
}
if (i2 == i)
{
- done2 = 1;
+ done2 = true;
}
}
else if (!move[i])
{
- done2 = 1;
+ done2 = true;
}
}
}
fft5d_plan fft5d_plan_3d(int NG, int MG, int KG, MPI_Comm comm[2], int flags, t_complex** rlin, t_complex** rlout, t_complex** rlout2, t_complex** rlout3, int nthreads, gmx::PinningPolicy realGridAllocationPinningPolicy)
{
- int P[2], bMaster, prank[2], i, t;
+ int P[2], prank[2], i, t;
+ bool bMaster;
int rNG, rMG, rKG;
int *N0 = nullptr, *N1 = nullptr, *M0 = nullptr, *M1 = nullptr, *K0 = nullptr, *K1 = nullptr, *oN0 = nullptr, *oN1 = nullptr, *oM0 = nullptr, *oM1 = nullptr, *oK0 = nullptr, *oK1 = nullptr;
int N[3], M[3], K[3], pN[3], pM[3], pK[3], oM[3], oK[3], *iNin[3] = {nullptr}, *oNin[3] = {nullptr}, *iNout[3] = {nullptr}, *oNout[3] = {nullptr};
prank[1] = 0;
}
- bMaster = (prank[0] == 0 && prank[1] == 0);
+ bMaster = prank[0] == 0 && prank[1] == 0;
if (debug)
void * in_data,
void * out_data)
{
- int aligned = (((size_t(in_data) | size_t(out_data)) & 0xf) == 0);
- int inplace = (in_data == out_data);
- int isforward = (dir == GMX_FFT_FORWARD);
+ bool aligned = (((size_t(in_data) | size_t(out_data)) & 0xf) == 0);
+ bool inplace = (in_data == out_data);
+ bool isforward = (dir == GMX_FFT_FORWARD);
/* Some checks */
if ( (fft->real_transform == 1) || (fft->ndim != 1) ||
void * in_data,
void * out_data)
{
- int aligned = (((size_t(in_data) | size_t(out_data)) & 0xf) == 0);
- int inplace = (in_data == out_data);
- int isforward = (dir == GMX_FFT_REAL_TO_COMPLEX);
+ bool aligned = (((size_t(in_data) | size_t(out_data)) & 0xf) == 0);
+ bool inplace = (in_data == out_data);
+ bool isforward = (dir == GMX_FFT_REAL_TO_COMPLEX);
/* Some checks */
if ( (fft->real_transform != 1) || (fft->ndim != 1) ||
void * in_data,
void * out_data)
{
- int aligned = (((size_t(in_data) | size_t(out_data)) & 0xf) == 0);
- int inplace = (in_data == out_data);
- int isforward = (dir == GMX_FFT_REAL_TO_COMPLEX);
+ bool aligned = (((size_t(in_data) | size_t(out_data)) & 0xf) == 0);
+ bool inplace = (in_data == out_data);
+ bool isforward = (dir == GMX_FFT_REAL_TO_COMPLEX);
/* Some checks */
if ( (fft->real_transform != 1) || (fft->ndim != 2) ||
}
}
+static void do_cpt_bool_err(XDR *xd, const char *desc, bool *b, FILE *list)
+{
+ int i = static_cast<int>(*b);
+
+ if (do_cpt_int(xd, desc, &i, list) < 0)
+ {
+ cp_error();
+ }
+
+ *b = (i != 0);
+}
+
static void do_cpt_step_err(XDR *xd, const char *desc, int64_t *i, FILE *list)
{
char buf[STEPSTRSIZE];
switch (i)
{
case eawhhIN_INITIAL:
- do_cpt_int_err(xd, eawhh_names[i], &state->in_initial, list); break;
+ do_cpt_bool_err(xd, eawhh_names[i], &state->in_initial, list); break;
case eawhhEQUILIBRATEHISTOGRAM:
- do_cpt_int_err(xd, eawhh_names[i], &state->equilibrateHistogram, list); break;
+ do_cpt_bool_err(xd, eawhh_names[i], &state->equilibrateHistogram, list); break;
case eawhhHISTSIZE:
do_cpt_double_err(xd, eawhh_names[i], &state->histSize, list); break;
case eawhhNPOINTS:
static gmx_bool gmx_one_before_eof(FILE *fp)
{
char data[4];
- gmx_bool beof;
+ gmx_bool beof = fread(data, 1, 1, fp) != 1;
- if ((beof = fread(data, 1, 1, fp)) == 1)
+ if (!beof)
{
gmx_fseek(fp, -1, SEEK_CUR);
}
- return !beof;
+ return beof;
}
gmx_bool gro_next_x_or_v(FILE *status, t_trxframe *fr)
if (file_version >= 74)
{
gmx_fio_do_gmx_bool(fio, ir->bRot);
- if (ir->bRot == TRUE)
+ if (ir->bRot)
{
if (bRead)
{
if (file_version >= tpxv_InteractiveMolecularDynamics)
{
gmx_fio_do_gmx_bool(fio, ir->bIMD);
- if (TRUE == ir->bIMD)
+ if (ir->bIMD)
{
if (bRead)
{
gmx_fio_do_int(fio, tpx->fep_state);
}
gmx_fio_do_real(fio, tpx->lambda);
- gmx_fio_do_int(fio, tpx->bIr);
- gmx_fio_do_int(fio, tpx->bTop);
- gmx_fio_do_int(fio, tpx->bX);
- gmx_fio_do_int(fio, tpx->bV);
- gmx_fio_do_int(fio, tpx->bF);
- gmx_fio_do_int(fio, tpx->bBox);
+ gmx_fio_do_gmx_bool(fio, tpx->bIr);
+ gmx_fio_do_gmx_bool(fio, tpx->bTop);
+ gmx_fio_do_gmx_bool(fio, tpx->bX);
+ gmx_fio_do_gmx_bool(fio, tpx->bV);
+ gmx_fio_do_gmx_bool(fio, tpx->bF);
+ gmx_fio_do_gmx_bool(fio, tpx->bBox);
if ((fileGeneration > tpx_generation))
{
tpx.ngtc = state->ngtc;
tpx.fep_state = state->fep_state;
tpx.lambda = state->lambda[efptFEP];
- tpx.bIr = (ir != nullptr);
- tpx.bTop = (mtop != nullptr);
- tpx.bX = (state->flags & (1 << estX));
- tpx.bV = (state->flags & (1 << estV));
+ tpx.bIr = ir != nullptr;
+ tpx.bTop = mtop != nullptr;
+ tpx.bX = (state->flags & (1 << estX)) != 0;
+ tpx.bV = (state->flags & (1 << estV)) != 0;
tpx.bF = FALSE;
tpx.bBox = TRUE;
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017,2018, 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.
struct t_tpxheader
{
- int bIr; /* Non zero if input_rec is present */
- int bBox; /* Non zero if a box is present */
- int bTop; /* Non zero if a topology is present */
- int bX; /* Non zero if coordinates are present */
- int bV; /* Non zero if velocities are present */
- int bF; /* Non zero if forces are present (no longer
+ bool bIr; /* Non zero if input_rec is present */
+ bool bBox; /* Non zero if a box is present */
+ bool bTop; /* Non zero if a topology is present */
+ bool bX; /* Non zero if coordinates are present */
+ bool bV; /* Non zero if velocities are present */
+ bool bF; /* Non zero if forces are present (no longer
supported, but retained so old .tpr can be read) */
int natoms; /* The total number of atoms */
do
{
sprintf(name, "%s_%d.pdb", buf, i+1);
- if ((bExist = gmx_fexist(name)) == TRUE)
+ if ((bExist = gmx_fexist(name)))
{
pdbf[i] = read_pdbf(name);
pdbf[i]->index = i+1;
{
return (a->dhdl >= 0) ? 1 : -1;
}
- return a->dhdl > b->dhdl;
+ return 0;
}
/* neither has an index, so we can only sort on the lambda components,
fprintf(fp, "%10g %10g\n", phi, psi);
if (bViol)
{
- fprintf(gp, "%d\n", int{(bAllowed(dih[Phi][j], RAD2DEG*dih[Psi][j]) == FALSE)} );
+ fprintf(gp, "%d\n", static_cast<int>(!bAllowed(dih[Phi][j], RAD2DEG*dih[Psi][j])) );
}
if (bOm)
{
* Will do some more testing before removing the function entirely.
* - Erik Marklund, MAY 10 2010 */
static void do_merge(t_hbdata *hb, int ntmp,
- unsigned int htmp[], unsigned int gtmp[],
+ bool htmp[], bool gtmp[],
t_hbond *hb0, t_hbond *hb1)
{
/* Here we need to make sure we're treating periodicity in
/* Initiate tmp arrays */
for (m = 0; (m < ntmp); m++)
{
- htmp[m] = 0;
- gtmp[m] = 0;
+ htmp[m] = false;
+ gtmp[m] = false;
}
/* Fill tmp arrays with values due to first HB */
/* Once again '<' had to be replaced with '<='
static void merge_hb(t_hbdata *hb, gmx_bool bTwo, gmx_bool bContact)
{
int i, inrnew, indnew, j, ii, jj, id, ia, ntmp;
- unsigned int *htmp, *gtmp;
+ bool *htmp, *gtmp;
t_hbond *hb0, *hb1;
inrnew = hb->nrhb;
t_rgb hbrgb [HB_NR] = { {1, 1, 1}, {1, 0, 0}, {0, 0, 1}, {1, 0, 1} };
t_trxstatus *status;
- int trrStatus = 1;
+ bool trrStatus = true;
t_topology top;
t_pargs *ppa;
int npargs, natoms, nframes = 0, shatom;
beginfit, endfit);
nat_trx =
- corr_loop(msd, trx_file, top, ePBC, mol_file ? gnx[0] : false, gnx, index,
+ corr_loop(msd, trx_file, top, ePBC, mol_file ? gnx[0] != 0 : false, gnx, index,
(mol_file != nullptr) ? calc1_mol : (bMW ? calc1_mw : calc1_norm),
bTen, gnx_com, index_com, dt, t_pdb,
pdb_file ? &x : nullptr, box, oenv);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017,2018, 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.
/* Compute crossproducts for all vectors, if triplets.
* else, just get the vectors in case of doublets.
*/
- if (bVec == FALSE)
+ if (!bVec)
{
for (i = 0; (i < nvec); i++)
{
if (bSetBox)
{
/* generate new box */
- if (fr.bBox == FALSE)
+ if (!fr.bBox)
{
clear_mat(fr.box);
}
}
else
{
- if (fr.bBox == FALSE)
+ if (!fr.bBox)
{
gmx_fatal(FARGS, "Cannot preserve a box that does not exist.\n");
}
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 */
+ bool bScaleRvdw, /* Scale rvdw along with rcoulomb */
const int *ntprs, /* No. of TPRs to write, each with a different
rcoulomb and fourierspacing */
t_inputinfo *info, /* Contains information about mdp file options */
sprintf(strbuf, "-deffnm %s ", deffnm);
add_to_string(cmd_args_launch, strbuf);
}
- if (FALSE == bAppendFiles)
+ if (!bAppendFiles)
{
add_to_string(cmd_args_launch, "-noappend ");
}
contrib1 = profile[k]*std::exp(-U/(BOLTZ*opt->Temperature));
contrib2 = window[i].N[j]*std::exp(-U/(BOLTZ*opt->Temperature) + window[i].z[j]);
window[i].bContrib[j][k] = (contrib1 > wham_contrib_lim || contrib2 > wham_contrib_lim);
- bAnyContrib = (bAnyContrib | window[i].bContrib[j][k]);
+ bAnyContrib = bAnyContrib || window[i].bContrib[j][k];
if (window[i].bContrib[j][k])
{
nContrib++;
snew(nColCOMCrd, header->npullcrds);
snew(nColRefCrd, header->npullcrds);
- if (opt->bPullx == FALSE)
+ if (!opt->bPullx)
{
/* pullf reading: simply one column per coordinate */
for (g = 0; g < header->npullcrds; g++)
all pull groups from header (tpr file) may be used in window variable */
for (g = 0, gUsed = 0; g < header->npullcrds; ++g)
{
- if (coordsel && (coordsel->bUse[g] == FALSE))
+ if (coordsel && !coordsel->bUse[g])
{
continue;
}
for (g = 0; g < header->npullcrds; ++g)
{
/* was this group selected for application in WHAM? */
- if (coordsel && (coordsel->bUse[g] == FALSE))
+ if (coordsel && !coordsel->bUse[g])
{
continue;
}
static void checkReactionCoordinateCovered(t_UmbrellaWindow *window, int nwins,
t_UmbrellaOptions *opt)
{
- int i, ig, j, bins = opt->bins, bBoundary;
+ int i, ig, j, bins = opt->bins;
+ bool bBoundary;
real avcount = 0, z, relcount, *count;
snew(count, opt->bins);
{
relcount = count[j]/avcount;
z = (j+0.5)*opt->dz+opt->min;
- bBoundary = ( j<bins/20 || (bins-j)>bins/20 );
+ bBoundary = j<bins/20 || (bins-j)>bins/20;
/* check for bins with no data */
if (count[j] == 0)
{
{
gmx_fatal(FARGS, "mcover should be -1 or (0,1]");
}
- else if ((mcover < 0)&(mcover != -1))
+ else if ((mcover < 0) && (mcover != -1))
{
gmx_fatal(FARGS, "mcover should be -1 or (0,1]");
}
{
tMPI_Thread_mutex_lock(&nonbonded_setup_mutex);
/* Here we are guaranteed only one thread made it. */
- if (nonbonded_setup_done == FALSE)
+ if (!nonbonded_setup_done)
{
- if (bGenericKernelOnly == FALSE)
+ if (!bGenericKernelOnly)
{
/* Add the generic kernels to the structure stored statically in nb_kernel.c */
nb_kernel_list_add_kernels(kernellist_c, kernellist_c_size);
- if (!(fr != nullptr && fr->use_simd_kernels == FALSE))
+ if (!(fr != nullptr && !fr->use_simd_kernels))
{
/* Add interaction-specific kernels for different architectures */
/* Single precision */
int narch = asize(arch_and_padding);
int i;
- if (nonbonded_setup_done == FALSE)
+ if (!nonbonded_setup_done)
{
/* We typically call this setup routine before starting timers,
* but if that has not been done for whatever reason we do it now.
* zero parameters (e.g. an index to a Cmap interaction, or LJ parameters), but
* we use it for angles and torsions that are typically generated automatically.
*/
- all_param_zero = (all_param_zero == TRUE) && fabs(old[j]) < GMX_REAL_MIN;
+ all_param_zero = all_param_zero && fabs(old[j]) < GMX_REAL_MIN;
}
- if (all_param_zero == TRUE)
+ if (all_param_zero)
{
if (IS_ANGLE(ftype) || IS_RESTRAINT_TYPE(ftype) || ftype == F_IDIHS ||
ftype == F_PDIHS || ftype == F_PIDIHS || ftype == F_RBDIHS || ftype == F_FOURDIHS)
hbang = &hb[i].rb[ebtsANGLES];
for (j = 0; j < hbang->nb; j++)
{
- if (hbang->b[j].match == TRUE)
+ if (hbang->b[j].match)
{
/* We already used this entry, continue to the next */
continue;
hbdih = &hb[i].rb[ebtsPDIHS];
for (j = 0; j < hbdih->nb; j++)
{
- if (hbdih->b[j].match == TRUE)
+ if (hbdih->b[j].match)
{
/* We already used this entry, continue to the next */
continue;
}
if (found)
{
- res = (vsiteconflist[i-1].isplanar == TRUE);
+ res = static_cast<int>(vsiteconflist[i-1].isplanar);
}
else
{
unsigned int i1;
char *inc_fn, *name;
const char *ptr;
- int bIfdef, bIfndef;
+ bool bIfdef, bIfndef;
/* #ifdef or ifndef statement */
- bIfdef = (strcmp(dname, "ifdef") == 0);
- bIfndef = (strcmp(dname, "ifndef") == 0);
+ bIfdef = strcmp(dname, "ifdef") == 0;
+ bIfndef = strcmp(dname, "ifndef") == 0;
if (bIfdef || bIfndef)
{
GMX_RELEASE_ASSERT(dval, "#ifdef/#ifndef requires an argument");
static void
sort_and_purge_nnb(t_nextnb *nnb)
{
- int i, j, k, m, n, cnt, found, prev, idx;
+ int i, j, k, m, n, cnt, prev, idx;
+ bool found;
for (i = 0; (i < nnb->nr); i++)
{
{
idx = nnb->a[i][n][j];
- found = 0;
+ found = false;
for (m = 0; m < n && !found; m++)
{
for (k = 0; k < nnb->nrexcl[i][m] && !found; k++)
{
- found = (idx == nnb->a[i][m][k]);
+ found = idx == nnb->a[i][m][k];
}
}
warning_note(wi, warn_buf);
}
}
- if (opts->bOrire == FALSE)
+ if (!opts->bOrire)
{
i = rm_interactions(F_ORIRES, nrmols, molinfo);
if (i > 0)
fprintf(stderr, "double-checking input for internal consistency...\n");
}
{
- int bHasNormalConstraints = 0 < (nint_ftype(sys, molinfo, F_CONSTR) +
- nint_ftype(sys, molinfo, F_CONSTRNC));
- int bHasAnyConstraints = bHasNormalConstraints || 0 < nint_ftype(sys, molinfo, F_SETTLE);
+ bool bHasNormalConstraints = 0 < (nint_ftype(sys, molinfo, F_CONSTR) +
+ nint_ftype(sys, molinfo, F_CONSTRNC));
+ bool bHasAnyConstraints = bHasNormalConstraints || 0 < nint_ftype(sys, molinfo, F_SETTLE);
double_check(ir, state->box,
bHasNormalConstraints,
bHasAnyConstraints,
gmx_fatal(FARGS, "Position restraint atom index (%d) in moltype '%s' is larger than number of atoms in %s (%d).\n",
ai+1, *molinfo[molb.type].name, fn, natoms);
}
- if (rc_scaling == erscCOM && hadAtom[ai] == FALSE)
+ if (rc_scaling == erscCOM && !hadAtom[ai])
{
/* Determine the center of mass of the posres reference coordinates */
for (j = 0; j < npbcdim; j++)
done_nnb(&nnb);
/* Make CMAP */
- if (TRUE == bCmap)
+ if (bCmap)
{
gen_cmap(&(plist[F_CMAP]), restp, atoms);
if (plist[F_CMAP].nr > 0)
print_sums(atoms, FALSE);
- if (FALSE == bChargeGroups)
+ if (!bChargeGroups)
{
scrub_charge_groups(cgnr, atoms->nr);
}
ir->ns_type = get_eeenum(&inp, "ns-type", ens_names, wi);
printStringNoNewline(&inp, "Periodic boundary conditions: xyz, no, xy");
ir->ePBC = get_eeenum(&inp, "pbc", epbc_names, wi);
- ir->bPeriodicMols = get_eeenum(&inp, "periodic-molecules", yesno_names, wi);
+ ir->bPeriodicMols = get_eeenum(&inp, "periodic-molecules", yesno_names, wi) != 0;
printStringNoNewline(&inp, "Allowed energy error due to the Verlet buffer in kJ/mol/ps per atom,");
printStringNoNewline(&inp, "a value of -1 means: use rlist");
ir->verletbuf_tol = get_ereal(&inp, "verlet-buffer-tolerance", 0.005, wi);
bCanDoLBRules = gmx_within_tol(c6_LB, c6, tol);
}
- if (FALSE == bCanDoLBRules)
+ if (!bCanDoLBRules)
{
*bC6ParametersWorkWithLBRules = FALSE;
}
bCanDoGeometricRules = gmx_within_tol(c6_geometric, c6, tol);
- if (FALSE == bCanDoGeometricRules)
+ if (!bCanDoGeometricRules)
{
*bC6ParametersWorkWithGeometricRules = FALSE;
}
&bLBRulesPossible);
if (ir->ljpme_combination_rule == eljpmeLB)
{
- if (FALSE == bC6ParametersWorkWithLBRules || FALSE == bLBRulesPossible)
+ if (!bC6ParametersWorkWithLBRules || !bLBRulesPossible)
{
warning(wi, "You are using arithmetic-geometric combination rules "
"in LJ-PME, but your non-bonded C6 parameters do not "
}
else
{
- if (FALSE == bC6ParametersWorkWithGeometricRules)
+ if (!bC6ParametersWorkWithGeometricRules)
{
if (ir->eDispCorr != edispcNO)
{
rtp[0].rb[1].type,
rtp[0].rb[2].type,
rtp[0].rb[3].type,
- int{rtp[0].bKeepAllGeneratedDihedrals},
+ static_cast<int>(rtp[0].bKeepAllGeneratedDihedrals),
rtp[0].nrexcl,
- int{rtp[0].bGenerateHH14Interactions},
- int{rtp[0].bRemoveDihedralIfWithImproper});
+ static_cast<int>(rtp[0].bGenerateHH14Interactions),
+ static_cast<int>(rtp[0].bRemoveDihedralIfWithImproper));
}
void print_resall(FILE *out, int nrtp, t_restp rtp[],
int lastcg = -1;
int dcatt = -1, nmol_couple;
/* File handling variables */
- int status, done;
+ int status;
+ bool done;
gmx_cpp_t handle;
char *tmp_line = nullptr;
char warn_buf[STRLEN];
}
}
- if (bFound == TRUE)
+ if (bFound)
{
int j;
return cycles;
}
-int
+bool
checkDualAvx512FmaUnits()
{
uint64_t timeFmaAndShuf = 1e9; // Large value
timeFmaOnly = std::min(timeFmaOnly, timeFmaOnlyLoop(1000) );
}
- return (timeFmaAndShuf > 1.5 * timeFmaOnly);
+ return timeFmaAndShuf > 1.5 * timeFmaOnly;
}
#endif // GMX_X86_GCC_INLINE_ASM && SIMD_AVX_512_CXX_SUPPORTED
/* We will allow IMD sessions only if explicitly enabled in the .tpr file */
- if (FALSE == ir->bIMD)
+ if (!ir->bIMD)
{
return;
}
c12 *= 12.0;
/* Do we need to apply full periodic boundary conditions? */
- if (fr->bMolPBC == TRUE)
+ if (fr->bMolPBC)
{
fshift_index = pbc_dx_aiuc(pbc, x[ai], x[aj], dx);
}
{
/* This check isn't race free. But it doesn't matter because if a race occurs the only
* disadvantage is that the warning is printed twice */
- if (warned_rlimit == FALSE)
+ if (!warned_rlimit)
{
warning_rlimit(x, ai, aj, global_atom_index, sqrt(r2), fr->pairsTable->r);
warned_rlimit = TRUE;
}
if (dr2 > 0.0 &&
- ( (dr2 > rfb2 && bInvert == FALSE ) || (dr2 < rfb2 && bInvert == TRUE ) )
+ ( (dr2 > rfb2 && !bInvert ) || (dr2 < rfb2 && bInvert ) )
)
{
dr = std::sqrt(dr2);
/* spherical flat-bottom posres */
dr2 = norm2(dx);
if (dr2 > 0.0 &&
- ( (dr2 > rfb2 && bInvert == FALSE ) || (dr2 < rfb2 && bInvert == TRUE ) )
+ ( (dr2 > rfb2 && !bInvert ) || (dr2 < rfb2 && bInvert ) )
)
{
dr = std::sqrt(dr2);
/* 1D flat-bottom potential */
fbdim = pr->fbposres.geom - efbposresX;
dr = dx[fbdim];
- if ( ( dr > rfb && bInvert == FALSE ) || ( 0 < dr && dr < rfb && bInvert == TRUE ) )
+ if ( ( dr > rfb && !bInvert ) || ( 0 < dr && dr < rfb && bInvert ) )
{
v = 0.5*kk*gmx::square(dr - rfb);
fm[fbdim] = -kk*(dr - rfb);
}
- else if ( (dr < (-rfb) && bInvert == FALSE ) || ( (-rfb) < dr && dr < 0 && bInvert == TRUE ))
+ else if ( (dr < (-rfb) && !bInvert ) || ( (-rfb) < dr && dr < 0 && bInvert ))
{
v = 0.5*kk*gmx::square(dr + rfb);
fm[fbdim] = -kk*(dr + rfb);
return fabs(f1-f2) <= tol*0.5*(fabs(f1)+fabs(f2));
}
-int
+bool
gmx_numzero(double a)
{
return gmx_within_tol(a, 0.0, GMX_REAL_MIN/GMX_REAL_EPS);
*
* \return 1 if 'almost' numerically zero, 0 otherwise.
*/
-int
+bool
gmx_numzero(double a);
/*! \brief Multiply two large ints
}
/* Check that types & charges match for all atoms in molecule */
- for (j = 0; j < nj && match == TRUE; j++)
+ for (j = 0; j < nj && match; j++)
{
if (tmp_vdwtype[j] != solvent_parameters[k].vdwtype[j])
{
match = FALSE;
}
}
- if (match == TRUE)
+ if (match)
{
/* Congratulations! We have a matched solvent.
* Flag it with this type for later processing.
/* Go through all other tpes and see if any have non-zero
* VdW parameters when combined with this one.
*/
- for (k = 0; k < fr->ntype && (has_vdw[j] == FALSE); k++)
+ for (k = 0; k < fr->ntype && (!has_vdw[j]); k++)
{
/* We already checked that the atoms weren't perturbed,
* so we only need to check state A now.
* the charges on atom 2 & 3 should be the same, and only
* atom 1 might have VdW.
*/
- if (has_vdw[1] == FALSE &&
- has_vdw[2] == FALSE &&
+ if (!has_vdw[1] &&
+ !has_vdw[2] &&
tmp_charge[0] != 0 &&
tmp_charge[1] != 0 &&
tmp_charge[2] == tmp_charge[1])
* For this we require thatn atoms 2,3,4 have charge, but not atom 1.
* Only atom 1 mght have VdW.
*/
- if (has_vdw[1] == FALSE &&
- has_vdw[2] == FALSE &&
- has_vdw[3] == FALSE &&
+ if (!has_vdw[1] &&
+ !has_vdw[2] &&
+ !has_vdw[3] &&
tmp_charge[0] == 0 &&
tmp_charge[1] != 0 &&
tmp_charge[2] == tmp_charge[1] &&
bGenericKernelOnly = TRUE;
}
- if (bGenericKernelOnly == TRUE)
+ if (bGenericKernelOnly)
{
bNoSolvOpt = TRUE;
}
*/
if (fr->nbkernel_elec_modifier == eintmodPOTSWITCH &&
fr->nbkernel_vdw_modifier == eintmodPOTSWITCH &&
- bGenericKernelOnly == FALSE)
+ !bGenericKernelOnly)
{
if ((ic->rcoulomb_switch != ic->rvdw_switch) || (ic->rcoulomb != ic->rvdw))
{
fr->nbkernel_elec_modifier == eintmodEXACTCUTOFF &&
(fr->nbkernel_vdw_modifier == eintmodPOTSWITCH || fr->nbkernel_vdw_modifier == eintmodPOTSHIFT))))
{
- if ((ic->rcoulomb != ic->rvdw) && (bGenericKernelOnly == FALSE))
+ if ((ic->rcoulomb != ic->rvdw) && (!bGenericKernelOnly))
{
fr->bcoultab = TRUE;
}
gmx::boolToString(fr->bvdwtab));
}
- if (fr->bvdwtab == TRUE)
+ if (fr->bvdwtab)
{
fr->nbkernel_vdw_interaction = GMX_NBKERNEL_VDW_CUBICSPLINETABLE;
fr->nbkernel_vdw_modifier = eintmodNONE;
}
- if (fr->bcoultab == TRUE)
+ if (fr->bcoultab)
{
fr->nbkernel_elec_interaction = GMX_NBKERNEL_ELEC_CUBICSPLINETABLE;
fr->nbkernel_elec_modifier = eintmodNONE;
if (debug && bPLINCS)
{
fprintf(debug, "PLINCS communication before each iteration: %d\n",
- int{li->bCommIter});
+ static_cast<int>(li->bCommIter));
}
/* LINCS can run on any number of threads.
static void check_assign_connected(Lincs *li,
const t_iatom *iatom,
const t_idef &idef,
- int bDynamics,
+ bool bDynamics,
int a1, int a2,
const t_blocka *at2con)
{
static void check_assign_triangle(Lincs *li,
const t_iatom *iatom,
const t_idef &idef,
- int bDynamics,
+ bool bDynamics,
int constraint_index,
int a1, int a2,
const t_blocka *at2con)
}
}
- if (bNEW == TRUE)
+ if (bNEW)
{
tlist->index[nr] = type;
nr++;
natom = mtop->moltype[type].atoms.nr;
nmol = mtop->molblock[i].nmol;
- for (j = 0; j < natom*nmol && bRM[type] == TRUE; j++)
+ for (j = 0; j < natom*nmol && bRM[type]; j++)
{
/*loop over atoms in the block*/
at = j+atom1; /*atom index = block index + offset*/
bINS = FALSE;
- for (m = 0; (m < ins_at->nr) && (bINS == FALSE); m++)
+ for (m = 0; (m < ins_at->nr) && (!bINS); m++)
{
/*loop over atoms in insertion index group to determine if we're inserting one*/
if (at == ins_at->index[m])
/* Skip this charge group if it is not a QM atom while making a
* QM/MM neighbourlist
*/
- if (md->bQM[i0] == FALSE)
+ if (!md->bQM[i0])
{
continue; /* MM particle, go to next particle */
}
float cycles_pme, cycles_wait_gpu;
nonbonded_verlet_t *nbv = fr->nbv;
- bStateChanged = (flags & GMX_FORCE_STATECHANGED);
- bNS = (flags & GMX_FORCE_NS) && (fr->bAllvsAll == FALSE);
+ bStateChanged = ((flags & GMX_FORCE_STATECHANGED) != 0);
+ bNS = ((flags & GMX_FORCE_NS) != 0) && (!fr->bAllvsAll);
bFillGrid = (bNS && bStateChanged);
bCalcCGCM = (bFillGrid && !DOMAINDECOMP(cr));
bDoForces = (flags & GMX_FORCE_FORCES);
cg1--;
}
- bStateChanged = (flags & GMX_FORCE_STATECHANGED);
- bNS = (flags & GMX_FORCE_NS) && (fr->bAllvsAll == FALSE);
+ bStateChanged = ((flags & GMX_FORCE_STATECHANGED) != 0);
+ bNS = ((flags & GMX_FORCE_NS) != 0) && (!fr->bAllvsAll);
/* Should we perform the long-range nonbonded evaluation inside the neighborsearching? */
bFillGrid = (bNS && bStateChanged);
bCalcCGCM = (bFillGrid && !DOMAINDECOMP(cr));
/* this function works, but could probably use a logic rewrite to keep all the different
types of efep straight. */
- if ((ir->efep == efepNO) && (ir->bSimTemp == FALSE))
+ if ((ir->efep == efepNO) && (!ir->bSimTemp))
{
return;
}
gmx_bool bSumEkinhOld, int flags);
/* All-reduce energy-like quantities over cr->mpi_comm_mysim */
-int do_per_step(int64_t step, int64_t nstep);
+bool do_per_step(int64_t step, int64_t nstep);
/* Return TRUE if io should be done */
/* ROUTINES from sim_util.c */
}
}
-int do_per_step(int64_t step, int64_t nstep)
+bool do_per_step(int64_t step, int64_t nstep)
{
if (nstep != 0)
{
- return ((step % nstep) == 0);
+ return (step % nstep) == 0;
}
else
{
- return 0;
+ return false;
}
}
if (debug && vsite->nthreads > 1)
{
fprintf(debug, "virtual site useInterdependentTask %d, nuse:\n",
- int{vsite->tData[0]->useInterdependentTask});
+ static_cast<int>(vsite->tData[0]->useInterdependentTask));
for (int th = 0; th < vsite->nthreads + 1; th++)
{
fprintf(debug, " %4d", vsite->tData[th]->idTask.nuse);
int umbrellaGridpoint; /**< Index for the current umbrella reference coordinate point (for umbrella potential type) */
int origin_index_updatelist; /**< Point index of the origin of the subgrid that has been touched since last update. */
int end_index_updatelist; /**< Point index of the end of the subgrid that has been touched since last update. */
- int in_initial; /**< True if in the intial stage. */
- int equilibrateHistogram; /**< True if histogram needs equilibration. */
+ bool in_initial; /**< True if in the intial stage. */
+ bool equilibrateHistogram; /**< True if histogram needs equilibration. */
double histSize; /**< Size of reference weight histogram. */
double logScaledSampleWeight; /**< The log of the current sample weight, scaled because of the histogram rescaling. */
double maxLogScaledSampleWeight; /**< Maximum sample weight obtained for previous (smaller) histogram sizes. */
AwhBiasStateHistory() : umbrellaGridpoint(0),
origin_index_updatelist(0),
end_index_updatelist(0),
- in_initial(0),
- equilibrateHistogram(0),
+ in_initial(false),
+ equilibrateHistogram(false),
histSize(0),
logScaledSampleWeight(0),
maxLogScaledSampleWeight(0),
cmp_int64(fp, "inputrec->init_step", ir1->init_step, ir2->init_step);
cmp_int(fp, "inputrec->simulation_part", -1, ir1->simulation_part, ir2->simulation_part);
cmp_int(fp, "inputrec->ePBC", -1, ir1->ePBC, ir2->ePBC);
- cmp_int(fp, "inputrec->bPeriodicMols", -1, ir1->bPeriodicMols, ir2->bPeriodicMols);
+ cmp_bool(fp, "inputrec->bPeriodicMols", -1, ir1->bPeriodicMols, ir2->bPeriodicMols);
cmp_int(fp, "inputrec->cutoff_scheme", -1, ir1->cutoff_scheme, ir2->cutoff_scheme);
cmp_int(fp, "inputrec->ns_type", -1, ir1->ns_type, ir2->ns_type);
cmp_int(fp, "inputrec->nstlist", -1, ir1->nstlist, ir2->nstlist);
//! Type of periodic boundary conditions
int ePBC;
//! Periodic molecules
- int bPeriodicMols;
+ bool bPeriodicMols;
//! Continuation run: starting state is correct (ie. constrained)
gmx_bool bContinuation;
//! Temperature coupling
for (int j = eGrpSplit0; j <= eGrpSplit1; j++)
{
g = &(s->group[j]);
- if (TRUE == sc->massw_split[j])
+ if (sc->massw_split[j])
{
/* Save the split group masses if mass-weighting is requested */
snew(g->m, g->atomset.numAtomsGlobal());
{
int *a;
int i;
- int res;
+ bool res;
snew(a, atoms->nr);
*nra = 0;
for (i = 0; (i < atoms->nr); i++)
{
- res = !gmx_strcasecmp(restype[atoms->atom[i].resind], typestring);
- if (bMatch == FALSE)
+ res = gmx_strcasecmp(restype[atoms->atom[i].resind], typestring) == 0;
+ if (!bMatch)
{
res = !res;
}
char ** p_typename;
int iwater, iion;
int nwater, nion;
- int found;
+ bool found;
if (bVerb)
{
/* Note that this does not lead to a N*N loop, but N*K, where
* K is the number of residue _types_, which is small and independent of N.
*/
- found = 0;
+ found = false;
for (k = 0; k < ntypes && !found; k++)
{
- found = !strcmp(restype[i], p_typename[k]);
+ found = strcmp(restype[i], p_typename[k]) == 0;
}
if (!found)
{
int
gmx_residuetype_add(gmx_residuetype_t *rt, const char *newresname, const char *newrestype)
{
- int found;
+ bool found;
const char * p_oldtype;
found = !gmx_residuetype_get_type(rt, newresname, &p_oldtype);
newresname, p_oldtype, newrestype);
}
- if (found == 0)
+ if (!found)
{
srenew(rt->resname, rt->n+1);
srenew(rt->restype, rt->n+1);
// Lookup the Van der Waals radius of this atom
int resnr = atoms->atom[i].resind;
- if (TRUE == gmx_atomprop_query(aps, epropVDW,
- *(atoms->resinfo[resnr].name),
- *(atoms->atomname[i]),
- &value))
+ if (gmx_atomprop_query(aps, epropVDW,
+ *(atoms->resinfo[resnr].name),
+ *(atoms->atomname[i]),
+ &value))
{
vdw_radius_.push_back(value);
if (value > cutoff_)