Checks: clang-diagnostic-*,clang-analyzer-*,-clang-analyzer-security.insecureAPI.strcpy,
bugprone-*,misc-*,readability-*,performance-*,mpi-*,-misc-incorrect-roundings,
- -readability-inconsistent-declaration-parameter-name,-readability-implicit-bool-conversion,
+ -readability-inconsistent-declaration-parameter-name,
-readability-function-size,-readability-else-after-return,
modernize-use-nullptr,modernize-use-emplace,
modernize-make-unique,modernize-make-shared,
value: google
- key: modernize-make-shared.IncludeStyle
value: google
+ - key: readability-implicit-bool-conversion.AllowIntegerConditions
+ value: 1
+ - key: readability-implicit-bool-conversion.AllowPointerConditions
+ value: 1
"Cannot apply a modules in mid-frame");
module->dataStarted(data);
const bool bCheckMissing = bAllowMissing_
- && !(module->flags() & IAnalysisDataModule::efAllowMissing);
+ && ((module->flags() & IAnalysisDataModule::efAllowMissing) == 0);
for (int i = 0; i < data->frameCount(); ++i)
{
AnalysisDataFrameRef frame = data->getDataFrame(i);
int notCoveredHigh = notVisitedHigh - coverRadius;
for (int i = notVisitedLow; i <= notVisitedHigh; i++)
{
- covered[i] = (i > notCoveredLow) && (i < notCoveredHigh);
+ covered[i] = static_cast<int>((i > notCoveredLow) && (i < notCoveredHigh));
}
/* Find a new interval to set covering for. Make the notVisitedHigh of this interval the
for (int i = 0; i <= notVisitedHigh; i++)
{
/* For non-periodic boundaries notCoveredLow = -1 will impose no restriction. */
- covered[i] = (i > notCoveredLow) && (i < notCoveredHigh);
+ covered[i] = static_cast<int>((i > notCoveredLow) && (i < notCoveredHigh));
}
/* Upper end. Same as for lower end but in the other direction. */
for (int i = notVisitedLow; i <= numPoints - 1; i++)
{
/* For non-periodic boundaries notCoveredHigh = numPoints will impose no restriction. */
- covered[i] = (i > notCoveredLow) && (i < notCoveredHigh);
+ covered[i] = static_cast<int>((i > notCoveredLow) && (i < notCoveredHigh));
}
}
}
{
for (int n = 0; n < grid.axis(d).numPoints() && allPointsCovered; n++)
{
- allPointsCovered = checkDim[d].covered[n];
+ allPointsCovered = (checkDim[d].covered[n] != 0);
}
}
printStringNoNewline(inp, "Start the simulation by equilibrating histogram towards the target distribution: no or yes");
}
sprintf(opt, "%s-equilibrate-histogram", prefix);
- awhBiasParams->equilibrateHistogram = get_eeenum(inp, opt, yesno_names, wi);
+ awhBiasParams->equilibrateHistogram = (get_eeenum(inp, opt, yesno_names, wi) != 0);
if (awhBiasParams->equilibrateHistogram && awhBiasParams->eGrowth != eawhgrowthEXP_LINEAR)
{
sprintf(warningmsg, "Option %s will only have an effect for histogram growth type '%s'.",
printStringNoNewline(inp, "When true, biases with share-group>0 are shared between multiple simulations");
sprintf(opt, "%s-share-multisim", prefix);
- awhParams->shareBiasMultisim = get_eeenum(inp, opt, yesno_names, wi);
+ awhParams->shareBiasMultisim = (get_eeenum(inp, opt, yesno_names, wi) != 0);
printStringNoNewline(inp, "The number of independent AWH biases");
sprintf(opt, "%s-nbias", prefix);
fprintf(fplog, "\n\n");
}
- gmx_bool bInterCGVsites = count_intercg_vsites(mtop);
+ gmx_bool bInterCGVsites = count_intercg_vsites(mtop) != 0;
if (comm->bInterCGBondeds ||
bInterCGVsites ||
{
gmx_domdec_comm_t *comm = dd->comm;
- dd->bSendRecv2 = dd_getenv(fplog, "GMX_DD_USE_SENDRECV2", 0);
+ dd->bSendRecv2 = (dd_getenv(fplog, "GMX_DD_USE_SENDRECV2", 0) != 0);
comm->dlb_scale_lim = dd_getenv(fplog, "GMX_DLB_MAX_BOX_SCALING", 10);
comm->eFlop = dd_getenv(fplog, "GMX_DLB_BASED_ON_FLOPS", 0);
int recload = dd_getenv(fplog, "GMX_DD_RECORD_LOAD", 1);
/* Send the charges and/or c6/sigmas to our PME only node */
gmx_pme_send_parameters(cr,
fr->ic,
- mdatoms->nChargePerturbed, mdatoms->nTypePerturbed,
+ mdatoms->nChargePerturbed != 0, mdatoms->nTypePerturbed != 0,
mdatoms->chargeA, mdatoms->chargeB,
mdatoms->sqrt_c6A, mdatoms->sqrt_c6B,
mdatoms->sigmaA, mdatoms->sigmaB,
static gmx_bool dd_check_ftype(int ftype, gmx_bool bBCheck,
gmx_bool bConstr, gmx_bool bSettle)
{
- return (((interaction_function[ftype].flags & IF_BOND) &&
- !(interaction_function[ftype].flags & IF_VSITE) &&
- (bBCheck || !(interaction_function[ftype].flags & IF_LIMZERO))) ||
+ return ((((interaction_function[ftype].flags & IF_BOND) != 0u) &&
+ ((interaction_function[ftype].flags & IF_VSITE) == 0u) &&
+ (bBCheck || ((interaction_function[ftype].flags & IF_LIMZERO) == 0u))) ||
(bConstr && (ftype == F_CONSTR || ftype == F_CONSTRNC)) ||
(bSettle && ftype == F_SETTLE));
}
(bConstr && (ftype == F_CONSTR || ftype == F_CONSTRNC)) ||
(bSettle && ftype == F_SETTLE))
{
- bVSite = (interaction_function[ftype].flags & IF_VSITE);
+ bVSite = ((interaction_function[ftype].flags & IF_VSITE) != 0u);
nral = NRAL(ftype);
il = &il_mt[ftype];
for (i = 0; i < il->nr; i += 1+nral)
gmx_bool vpbc;
int nral1 = 0, ftv = 0;
- vpbc = ((interaction_function[ftype].flags & IF_VSITE) &&
+ vpbc = (((interaction_function[ftype].flags & IF_VSITE) != 0u) &&
vsite->vsite_pbc_loc != nullptr);
if (vpbc)
{
}
}
bUse = (bUse &&
- k_zero[XX] && k_zero[YY] && k_zero[ZZ]);
+ (k_zero[XX] != 0) && (k_zero[YY] != 0) && (k_zero[ZZ] != 0));
if (bRCheckMB)
{
int d;
}
// Positions are always present, so there's nothing to flag
- bool bV = state->flags & (1<<estV);
- bool bCGP = state->flags & (1<<estCGP);
+ bool bV = (state->flags & (1<<estV)) != 0;
+ bool bCGP = (state->flags & (1<<estCGP)) != 0;
DDBufferAccess<int> moveBuffer(comm->intBuffer, dd->globalAtomGroupIndices.size());
int *move = moveBuffer.buffer.data();
*/
bool bNeedDoEdsam(const t_edpar &edi)
{
- return edi.vecs.mon.neig
- || edi.vecs.linfix.neig
- || edi.vecs.linacc.neig
- || edi.vecs.radfix.neig
- || edi.vecs.radacc.neig
- || edi.vecs.radcon.neig;
+ return (edi.vecs.mon.neig != 0)
+ || (edi.vecs.linfix.neig != 0)
+ || (edi.vecs.linacc.neig != 0)
+ || (edi.vecs.radfix.neig != 0)
+ || (edi.vecs.radacc.neig != 0)
+ || (edi.vecs.radcon.neig != 0);
}
} // namespace
{
if (edtype == eEDedsam || edtype == eEDflood)
{
- return (edi->vecs.linfix.neig || edi->vecs.linacc.neig ||
- edi->vecs.radfix.neig || edi->vecs.radacc.neig ||
- edi->vecs.radcon.neig);
+ return static_cast<int>((edi->vecs.linfix.neig != 0) || (edi->vecs.linacc.neig != 0) ||
+ (edi->vecs.radfix.neig != 0) || (edi->vecs.radacc.neig != 0) ||
+ (edi->vecs.radcon.neig != 0));
}
return 0;
}
copy_mat(cnb.box, box);
*lambda_q = cnb.lambda_q;
*lambda_lj = cnb.lambda_lj;
- *bEnerVir = (cnb.flags & PP_PME_ENER_VIR);
+ *bEnerVir = ((cnb.flags & PP_PME_ENER_VIR) != 0u);
*step = cnb.step;
/* Receive the coordinates in place */
gmx_bool bFirst, bDoSplines;
int fep_state;
int fep_states_lj = pme->bFEP_lj ? 2 : 1;
- const gmx_bool bCalcEnerVir = flags & GMX_PME_CALC_ENER_VIR;
- const gmx_bool bBackFFT = flags & (GMX_PME_CALC_F | GMX_PME_CALC_POT);
- const gmx_bool bCalcF = flags & GMX_PME_CALC_F;
+ const gmx_bool bCalcEnerVir = (flags & GMX_PME_CALC_ENER_VIR) != 0;
+ const gmx_bool bBackFFT = (flags & (GMX_PME_CALC_F | GMX_PME_CALC_POT)) != 0;
+ const gmx_bool bCalcF = (flags & GMX_PME_CALC_F) != 0;
assert(pme->nnodes > 0);
assert(pme->nnodes == 1 || pme->ndecompdim > 0);
i = j;
j = k;
}
- while (k);
+ while (k != 0);
ncount += i-1;
}
(*pfft_setup)->p2 = fft5d_plan_3d(Nb, Mb, Kb, rcomm,
(flags|FFT5D_BACKWARD|FFT5D_NOMALLOC)^FFT5D_ORDER_YZ, complex_data, reinterpret_cast<t_complex**>(real_data), &buf1, &buf2, nthreads);
- return (*pfft_setup)->p1 != nullptr && (*pfft_setup)->p2 != nullptr;
+ return static_cast<int>((*pfft_setup)->p1 != nullptr && (*pfft_setup)->p2 != nullptr);
}
int thread,
gmx_wallcycle_t wcycle)
{
- if ((!(pfft_setup->p1->flags&FFT5D_REALCOMPLEX)) ^ (dir == GMX_FFT_FORWARD || dir == GMX_FFT_BACKWARD))
+ if (((pfft_setup->p1->flags&FFT5D_REALCOMPLEX) == 0) ^ (dir == GMX_FFT_FORWARD || dir == GMX_FFT_BACKWARD))
{
gmx_fatal(FARGS, "Invalid transform. Plan and execution don't match regarding reel/complex");
}
static int do_cpte_bool(XDR *xd, StatePart part, int ecpt, int sflags,
bool *b, FILE *list)
{
- int i = *b;
+ int i = static_cast<int>(*b);
int ret = do_cpte_int(xd, part, ecpt, sflags, &i, list);
- *b = i;
+ *b = (i != 0);
return ret;
}
{
cp_error();
}
- *bReadEkin = ((headerContents->flags_eks & (1<<eeksEKINH)) ||
- (headerContents->flags_eks & (1<<eeksEKINF)) ||
- (headerContents->flags_eks & (1<<eeksEKINO)) ||
- ((headerContents->flags_eks & (1<<eeksEKINSCALEF)) |
- (headerContents->flags_eks & (1<<eeksEKINSCALEH)) |
- (headerContents->flags_eks & (1<<eeksVSCALE))));
+ *bReadEkin = (((headerContents->flags_eks & (1<<eeksEKINH)) != 0) ||
+ ((headerContents->flags_eks & (1<<eeksEKINF)) != 0) ||
+ ((headerContents->flags_eks & (1<<eeksEKINO)) != 0) ||
+ (((headerContents->flags_eks & (1<<eeksEKINSCALEF)) |
+ (headerContents->flags_eks & (1<<eeksEKINSCALEH)) |
+ (headerContents->flags_eks & (1<<eeksVSCALE))) != 0));
if (headerContents->flags_enh && observablesHistory->energyHistory == nullptr)
{
fr->lambda = state.lambda[efptFEP];
fr->fep_state = state.fep_state;
fr->bAtoms = FALSE;
- fr->bX = (state.flags & (1<<estX));
+ fr->bX = ((state.flags & (1<<estX)) != 0);
if (fr->bX)
{
fr->x = makeRvecArray(state.x, state.natoms);
}
- fr->bV = (state.flags & (1<<estV));
+ fr->bV = ((state.flags & (1<<estV)) != 0);
if (fr->bV)
{
fr->v = makeRvecArray(state.v, state.natoms);
}
fr->bF = FALSE;
- fr->bBox = (state.flags & (1<<estBOX));
+ fr->bBox = ((state.flags & (1<<estBOX)) != 0);
if (fr->bBox)
{
copy_mat(state.box, fr->box);
fp = gmx_fio_fopen(fn, "r");
ret = fread(&dum, sizeof(dum), 1, fp);
- bEmpty = feof(fp);
+ bEmpty = (feof(fp) != 0);
gmx_fio_fclose(fp);
// bEmpty==TRUE but ret!=0 would likely be some strange I/O error, but at
bFinished = TRUE;
}
}
- while (!bFinished && fgets2(line, STRLEN, fp));
+ while (!bFinished && (fgets2(line, STRLEN, fp) != nullptr));
fr->natoms = natoms;
fprintf(out, "BOX\n");
fprintf(out, "%15.9f%15.9f%15.9f",
fr->box[XX][XX], fr->box[YY][YY], fr->box[ZZ][ZZ]);
- if (fr->box[XX][YY] || fr->box[XX][ZZ] || fr->box[YY][XX] ||
- fr->box[YY][ZZ] || fr->box[ZZ][XX] || fr->box[ZZ][YY])
+ if ((fr->box[XX][YY] != 0.0f) || (fr->box[XX][ZZ] != 0.0f) || (fr->box[YY][XX] != 0.0f) ||
+ (fr->box[YY][ZZ] != 0.0f) || (fr->box[ZZ][XX] != 0.0f) || (fr->box[ZZ][YY] != 0.0f))
{
fprintf(out, "%15.9f%15.9f%15.9f%15.9f%15.9f%15.9f",
fr->box[XX][YY], fr->box[XX][ZZ], fr->box[YY][XX],
{
ptr = (static_cast<rvec *>(item))[j];
}
- res = do_xdr(fio, ptr, 1, eioRVEC, desc, srcfile, line);
+ res = static_cast<bool_t>(do_xdr(fio, ptr, 1, eioRVEC, desc, srcfile, line));
}
break;
case eioIVEC:
{
int itmp = 0;
ret = do_xdr(fio, &itmp, 1, eioINT, desc, srcfile, line);
- *item = itmp;
+ *item = (itmp != 0);
}
else
{
- int itmp = *item;
+ int itmp = static_cast<int>(*item);
ret = do_xdr(fio, &itmp, 1, eioINT, desc, srcfile, line);
}
gmx_fio_unlock(fio);
{
int itmp = 0;
ret = ret && do_xdr(fio, &itmp, 1, eioINT, desc, srcfile, line);
- item[i] = itmp;
+ item[i] = (itmp != 0);
}
else
{
- int itmp = item[i];
+ int itmp = static_cast<int>(item[i]);
ret = ret && do_xdr(fio, &itmp, 1, eioINT, desc, srcfile, line);
}
}
static void write_hconf_box(FILE *out, const matrix box)
{
- if (box[XX][YY] || box[XX][ZZ] || box[YY][XX] || box[YY][ZZ] ||
- box[ZZ][XX] || box[ZZ][YY])
+ if ((box[XX][YY] != 0.0f) || (box[XX][ZZ] != 0.0f) || (box[YY][XX] != 0.0f) || (box[YY][ZZ] != 0.0f) ||
+ (box[ZZ][XX] != 0.0f) || (box[ZZ][YY] != 0.0f))
{
fprintf(out, "%10.5f%10.5f%10.5f%10.5f%10.5f%10.5f%10.5f%10.5f%10.5f\n",
box[XX][XX], box[YY][YY], box[ZZ][ZZ],
static_cast<unsigned int>(round(m.map[i].rgb.g*255)),
static_cast<unsigned int>(round(m.map[i].rgb.b*255)), m.map[i].desc);
}
- write_xpm_axis(out, "x", m.flags & MAT_SPATIAL_X, m.nx, m.axis_x);
- write_xpm_axis(out, "y", m.flags & MAT_SPATIAL_Y, m.ny, m.axis_y);
+ write_xpm_axis(out, "x", (m.flags & MAT_SPATIAL_X) != 0u, m.nx, m.axis_x);
+ write_xpm_axis(out, "y", (m.flags & MAT_SPATIAL_Y) != 0u, m.ny, m.axis_y);
for (j = m.ny-1; (j >= 0); j--)
{
if (j%(1+m.ny/100) == 0)
write_xpm_header(out, title.c_str(), legend.c_str(), label_x.c_str(), label_y.c_str(), FALSE);
write_xpm_map3(out, n_x, n_y, nlevels, lo, mid, hi, rlo, rmid, rhi);
- write_xpm_axis(out, "x", flags & MAT_SPATIAL_X, n_x, axis_x);
- write_xpm_axis(out, "y", flags & MAT_SPATIAL_Y, n_y, axis_y);
+ write_xpm_axis(out, "x", (flags & MAT_SPATIAL_X) != 0u, n_x, axis_x);
+ write_xpm_axis(out, "y", (flags & MAT_SPATIAL_Y) != 0u, n_y, axis_y);
write_xpm_data3(out, n_x, n_y, mat, lo, mid, hi, *nlevels);
}
write_xpm_header(out, title.c_str(), legend.c_str(), label_x.c_str(), label_y.c_str(), FALSE);
write_xpm_map_split(out, n_x, n_y, nlevel_top, lo_top, hi_top, rlo_top, rhi_top,
bDiscreteColor, nlevel_bot, lo_bot, hi_bot, rlo_bot, rhi_bot);
- write_xpm_axis(out, "x", flags & MAT_SPATIAL_X, n_x, axis_x);
- write_xpm_axis(out, "y", flags & MAT_SPATIAL_Y, n_y, axis_y);
+ write_xpm_axis(out, "x", (flags & MAT_SPATIAL_X) != 0u, n_x, axis_x);
+ write_xpm_axis(out, "y", (flags & MAT_SPATIAL_Y) != 0u, n_y, axis_y);
write_xpm_data_split(out, n_x, n_y, mat, lo_top, hi_top, *nlevel_top,
lo_bot, hi_bot, *nlevel_bot);
}
write_xpm_header(out, title.c_str(), legend.c_str(), label_x.c_str(), label_y.c_str(), FALSE);
write_xpm_map(out, n_x, n_y, nlevels, lo, hi, rlo, rhi);
- write_xpm_axis(out, "x", flags & MAT_SPATIAL_X, n_x, axis_x);
- write_xpm_axis(out, "y", flags & MAT_SPATIAL_Y, n_y, axis_y);
+ write_xpm_axis(out, "x", (flags & MAT_SPATIAL_X) != 0u, n_x, axis_x);
+ write_xpm_axis(out, "y", (flags & MAT_SPATIAL_Y) != 0u, n_y, axis_y);
write_xpm_data(out, n_x, n_y, mat, lo, hi, *nlevels);
}
gmx_residuetype_init(&rt);
fprintf(out, "TITLE %s\n", (title && title[0]) ? title : gmx::bromacs().c_str());
- if (box && ( norm2(box[XX]) || norm2(box[YY]) || norm2(box[ZZ]) ) )
+ if (box && ( (norm2(box[XX]) != 0.0f) || (norm2(box[YY]) != 0.0f) || (norm2(box[ZZ]) != 0.0f) ) )
{
gmx_write_pdb_box(out, ePBC, box);
}
std::strcpy(buf, nm);
trim(buf);
- return (buf[0] == 'M') && std::isdigit(buf[strlen(buf)-1]);
+ return (buf[0] == 'M') && (std::isdigit(buf[strlen(buf)-1]) != 0);
}
static void gmx_conect_addline(gmx_conect_t *con, char *line)
fr->step = 0;
step = std::strstr(title, " step= ");
- fr->bStep = (step && sscanf(step+7, "%" SCNd64, &fr->step) == 1);
+ fr->bStep = ((step != nullptr) && sscanf(step+7, "%" SCNd64, &fr->step) == 1);
dbl = 0.0;
time = std::strstr(title, " t= ");
- fr->bTime = (time && sscanf(time+4, "%lf", &dbl) == 1);
+ fr->bTime = ((time != nullptr) && sscanf(time+4, "%lf", &dbl) == 1);
fr->time = dbl;
if (na == 0)
}
initcount(status);
}
- bRet = read_next_xtc(status->fio, fr->natoms, &fr->step, &fr->time, fr->box,
- fr->x, &fr->prec, &bOK);
+ bRet = (read_next_xtc(status->fio, fr->natoms, &fr->step, &fr->time, fr->box,
+ fr->x, &fr->prec, &bOK) != 0);
fr->bPrec = (bRet && fr->prec > 0);
fr->bStep = bRet;
fr->bTime = bRet;
if (bRet)
{
- bMissingData = (((status->flags & TRX_NEED_X) && !fr->bX) ||
- ((status->flags & TRX_NEED_V) && !fr->bV) ||
- ((status->flags & TRX_NEED_F) && !fr->bF));
+ bMissingData = ((((status->flags & TRX_NEED_X) != 0) && !fr->bX) ||
+ (((status->flags & TRX_NEED_V) != 0) && !fr->bV) ||
+ (((status->flags & TRX_NEED_F) != 0) && !fr->bF));
bSkip = FALSE;
if (!bMissingData)
{
{
vmdplugin->api->read_timestep_metadata(vmdplugin->handle, metadata);
assert(metadata);
- vmdplugin->bV = metadata->has_velocities;
+ vmdplugin->bV = (metadata->has_velocities != 0);
if (vmdplugin->bV)
{
snew(fr->v, fr->natoms);
snew(*x, *natoms);
- *bOK = xtc_coord(xd, natoms, box, *x, prec, TRUE);
+ *bOK = (xtc_coord(xd, natoms, box, *x, prec, TRUE) != 0);
- return *bOK;
+ return static_cast<int>(*bOK);
}
int read_next_xtc(t_fileio* fio,
n, natoms);
}
- *bOK = xtc_coord(xd, &natoms, box, x, prec, TRUE);
+ *bOK = (xtc_coord(xd, &natoms, box, x, prec, TRUE) != 0);
- return *bOK;
+ return static_cast<int>(*bOK);
}
curp += len_remaining-1; /* overwrite the nul char in next iteration */
len_remaining = 1;
}
- while ((std::strchr(*ptr, '\n') == nullptr) && (!feof(fp)));
+ while ((std::strchr(*ptr, '\n') == nullptr) && (feof(fp) == 0));
if (*len + STRLEN >= maxlen)
{
OverlapFile = opt2fn_null("-over", NFILE, fnm);
InpMatFile = ftp2fn_null(efXPM, NFILE, fnm);
- bProj = ProjOnVecFile || TwoDPlotFile || ThreeDPlotFile
- || FilterFile || ExtremeFile;
+ bProj = (ProjOnVecFile != nullptr) || (TwoDPlotFile != nullptr) || (ThreeDPlotFile != nullptr)
+ || (FilterFile != nullptr) || (ExtremeFile != nullptr);
bFirstLastSet =
opt2parg_bSet("-first", NPA, pa) && opt2parg_bSet("-last", NPA, pa);
- bFirstToLast = CompFile || RmsfFile || ProjOnVecFile || FilterFile ||
- OverlapFile || ((ExtremeFile || InpMatFile) && bFirstLastSet);
- bVec2 = Vec2File || OverlapFile || InpMatFile;
- bM = RmsfFile || bProj;
- bTraj = ProjOnVecFile || FilterFile || (ExtremeFile && (max == 0))
- || TwoDPlotFile || ThreeDPlotFile;
+ bFirstToLast = (CompFile != nullptr) || (RmsfFile != nullptr) || (ProjOnVecFile != nullptr) || (FilterFile != nullptr) ||
+ (OverlapFile != nullptr) || (((ExtremeFile != nullptr) || (InpMatFile != nullptr)) && bFirstLastSet);
+ bVec2 = (Vec2File != nullptr) || (OverlapFile != nullptr) || (InpMatFile != nullptr);
+ bM = (RmsfFile != nullptr) || bProj;
+ bTraj = (ProjOnVecFile != nullptr) || (FilterFile != nullptr) || ((ExtremeFile != nullptr) && (max == 0))
+ || (TwoDPlotFile != nullptr) || (ThreeDPlotFile != nullptr);
bIndex = bM || bProj;
bTPS = ftp2bSet(efTPS, NFILE, fnm) || bM || bTraj ||
- FilterFile || (bIndex && indexfile);
- bCompare = Vec2File || Eig2File;
+ (FilterFile != nullptr) || (bIndex && (indexfile != nullptr));
+ bCompare = (Vec2File != nullptr) || (Eig2File != nullptr);
bPDB3D = fn2ftp(ThreeDPlotFile) == efPDB;
read_eigenvectors(VecFile, &natoms, &bFit1,
}
printf("SS%d %13.6e %12.6e %12.6e %6.3f %6.3f\n",
s+1, av[s], sig[s], error,
- sig[s] ? cum3/(sig[s]*sig[s]*sig[s]*std::sqrt(8/M_PI)) : 0,
- sig[s] ? cum4/(sig[s]*sig[s]*sig[s]*sig[s]*3)-1 : 0);
+ sig[s] != 0.0 ? cum3/(sig[s]*sig[s]*sig[s]*std::sqrt(8/M_PI)) : 0,
+ sig[s] != 0.0 ? cum4/(sig[s]*sig[s]*sig[s]*sig[s]*3)-1 : 0);
}
printf("\n");
- if (filtlen)
+ if (filtlen != 0.0f)
{
filter(filtlen, n, nset, val, dt);
}
{
for (j = i+1; j < n1; j++)
{
- mcpy[i][j] = jp_same(nnb, i, j, P);
+ mcpy[i][j] = static_cast<real>(jp_same(nnb, i, j, P));
}
}
do
{
for (j = i+1; j < n1; j++)
{
- if (mcpy[i][j])
+ if (mcpy[i][j] != 0.0f)
{
diff = c[j].clust - c[i].clust;
if (diff)
{
for (i1 = i2+1; (i1 < nf); i1++)
{
- if (rms->mat[i1][i2])
+ if (rms->mat[i1][i2] != 0.0f)
{
rms->mat[i1][i2] = rms->maxrms;
}
{
do_autocorr(corf, oenv, "Dipole Autocorrelation Function",
teller, gnx_tot, muall, dt,
- mode, std::strcmp(corrtype, "molsep"));
+ mode, std::strcmp(corrtype, "molsep") != 0);
}
}
}
fnArea = opt2fn_null("-a", NFILE, fnm);
fnTArea = opt2fn_null("-ta", NFILE, fnm);
fnAArea = opt2fn_null("-aa", NFILE, fnm);
- bDoAccSurf = (fnArea || fnTArea || fnAArea);
+ bDoAccSurf = ((fnArea != nullptr) || (fnTArea != nullptr) || (fnAArea != nullptr));
read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xp, nullptr, box, FALSE);
atoms = &(top.atoms);
trim(ptr);
}
}
- while (!bEOF && (ptr && (std::strlen(ptr) > 0)));
+ while (!bEOF && ((ptr != nullptr) && (std::strlen(ptr) > 0)));
}
}
for (j = 0; (j <= hbh->nframes); j++)
{
- ihb = is_hb(h[nh], j);
+ ihb = static_cast<int>(is_hb(h[nh], j));
if (debug && (ndump < 10))
{
fprintf(debug, "%5d %5d\n", j, ihb);
{
if (hbh->h[0])
{
- ihb = is_hb(hbh->h[0], j);
- idist = is_hb(hbh->g[0], j);
+ ihb = static_cast<int>(is_hb(hbh->h[0], j));
+ idist = static_cast<int>(is_hb(hbh->g[0], j));
bPrint = TRUE;
}
}
{
for (m = 0; (m < hb->maxhydro) && !ihb; m++)
{
- ihb = ihb || ((hbh->h[m]) && is_hb(hbh->h[m], j));
- idist = idist || ((hbh->g[m]) && is_hb(hbh->g[m], j));
+ ihb = static_cast<int>((ihb != 0) || (((hbh->h[m]) != nullptr) && is_hb(hbh->h[m], j)));
+ idist = static_cast<int>((idist != 0) || (((hbh->g[m]) != nullptr) && is_hb(hbh->g[m], j)));
}
/* This is not correct! */
/* What isn't correct? -Erik M */
{
if (j <= nf)
{
- ihb = is_hb(h[nh], j);
- idist = is_hb(g[nh], j);
+ ihb = static_cast<int>(is_hb(h[nh], j));
+ idist = static_cast<int>(is_hb(g[nh], j));
}
else
{
{
int nn0 = hb->hbmap[id][ia]->n0;
range_check(y, 0, mat.ny);
- mat.matrix[x+nn0][y] = is_hb(hb->hbmap[id][ia]->h[hh], x);
+ mat.matrix[x+nn0][y] = static_cast<t_matelmt>(is_hb(hb->hbmap[id][ia]->h[hh], x));
}
y++;
}
}
printf("Found %d atom%s in %d residues from group %s\n",
*nr, (*nr == 1) ? "" : "s", j1-j0, gname);
- return *nr;
+ return *nr != 0;
}
static gmx_bool comp_name(const char *name, const char *search)
{
if (parse_int(string, &sel_nr1))
{
- bRet = select_atomnumbers(string, atoms, sel_nr1, nr, index, gname);
+ bRet = (select_atomnumbers(string, atoms, sel_nr1, nr, index, gname) != 0);
}
else if (parse_names(string, &n_names, names))
{
- bRet = select_atomnames(atoms, n_names, names, nr, index, FALSE);
+ bRet = (select_atomnames(atoms, n_names, names, nr, index, FALSE) != 0);
make_gname(n_names, names, gname);
}
}
}
else
{
- bRet = select_atomnames(atoms, n_names, names, nr, index, TRUE);
+ bRet = (select_atomnames(atoms, n_names, names, nr, index, TRUE) != 0);
make_gname(n_names, names, gname);
}
}
if (check_have_atoms(atoms, ostring) &&
parse_int_char(string, &sel_nr1, &c))
{
- bRet = select_residueindices(string, atoms, sel_nr1, c, nr, index, gname);
+ bRet = (select_residueindices(string, atoms, sel_nr1, c, nr, index, gname) != 0);
}
}
else if ((*string)[0] == 'r')
{
if (parse_int_char(string, &sel_nr1, &c))
{
- bRet = select_residuenumbers(string, atoms, sel_nr1, c, nr, index, gname);
+ bRet = (select_residuenumbers(string, atoms, sel_nr1, c, nr, index, gname) != 0);
}
else if (parse_names(string, &n_names, names))
{
- bRet = select_residuenames(atoms, n_names, names, nr, index);
+ bRet = (select_residuenames(atoms, n_names, names, nr, index) != 0);
make_gname(n_names, names, gname);
}
}
if (check_have_atoms(atoms, ostring) &&
parse_names(string, &n_names, names))
{
- bRet = select_chainnames(atoms, n_names, names, nr, index);
+ bRet = (select_chainnames(atoms, n_names, names, nr, index) != 0);
sprintf(gname, "ch%s", names[0]);
for (i = 1; i < n_names; i++)
{
resind = atoms->atom[i].resind;
if ((resind != prev_resind) || (i == atoms->nr-1))
{
- if ((bDiff = std::strcmp(*atoms->resinfo[resind].name,
- *atoms->resinfo[start].name)) ||
+ if ((bDiff = (std::strcmp(*atoms->resinfo[resind].name,
+ *atoms->resinfo[start].name) != 0)) ||
(i == atoms->nr-1))
{
if (bDiff)
}
}
}
- if (hq)
+ if (hq != 0.0f)
{
for (j = 0; j < fac; j++)
{
break;
}
rvec_sub(newCom, com, shift);
- if (norm2(shift))
+ if (norm2(shift) != 0.0f)
{
if (debug)
{
}
bWriteFrame =
- ( ( !bTDump && !frindex && frame % skip_nr == 0 ) || bDumpFrame );
+ ( ( !bTDump && (frindex == nullptr) && frame % skip_nr == 0 ) || bDumpFrame );
if (bWriteFrame && (bDropUnder || bDropOver))
{
psr->linewidth = get_ereal(&inp, "linewidth", 1.0, wi);
setStringEntry(&inp, "titlefont", psr->titfont, "Helvetica");
psr->titfontsize = get_ereal(&inp, "titlefontsize", 20.0, wi);
- psr->legend = get_eenum(&inp, "legend", gmx_bools);
+ psr->legend = (get_eenum(&inp, "legend", gmx_bools) != 0);
setStringEntry(&inp, "legendfont", psr->legfont, psr->titfont);
setStringEntry(&inp, "legendlabel", psr->leglabel, "");
setStringEntry(&inp, "legend2label", psr->leg2label, psr->leglabel);
psr->X.major = get_ereal(&inp, "x-major", 1, wi);
psr->X.minor = get_ereal(&inp, "x-minor", 1, wi);
psr->X.offset = get_ereal(&inp, "x-firstmajor", 0.0, wi);
- psr->X.first = get_eenum(&inp, "x-majorat0", gmx_bools);
+ psr->X.first = (get_eenum(&inp, "x-majorat0", gmx_bools) != 0);
psr->X.majorticklen = get_ereal(&inp, "x-majorticklen", 8.0, wi);
psr->X.minorticklen = get_ereal(&inp, "x-minorticklen", 4.0, wi);
setStringEntry(&inp, "x-label", psr->X.label, "");
psr->Y.major = get_ereal(&inp, "y-major", psr->X.major, wi);
psr->Y.minor = get_ereal(&inp, "y-minor", psr->X.minor, wi);
psr->Y.offset = get_ereal(&inp, "y-firstmajor", psr->X.offset, wi);
- psr->Y.first = get_eenum(&inp, "y-majorat0", gmx_bools);
+ psr->Y.first = (get_eenum(&inp, "y-majorat0", gmx_bools) != 0);
psr->Y.majorticklen = get_ereal(&inp, "y-majorticklen", psr->X.majorticklen, wi);
psr->Y.minorticklen = get_ereal(&inp, "y-minorticklen", psr->X.minorticklen, wi);
setStringEntry(&inp, "y-label", psr->Y.label, psr->X.label);
std::strcpy(mat[0].legend, psr->leglabel);
}
- bTitle = bTitle && mat[nmat-1].title[0];
- bTitleOnce = bTitleOnce && mat[nmat-1].title[0];
+ bTitle = bTitle && (mat[nmat-1].title[0] != 0);
+ bTitleOnce = bTitleOnce && (mat[nmat-1].title[0] != 0);
psr->bTitle = bTitle;
psr->bTitleOnce = bTitleOnce;
psr->bYonce = bYonce;
xx = x0+x*psr->xboxsize;
ps_moveto(out, xx, y0);
y = 0;
- bMap1 = (!mat2 || (x < y || (x == y && bFirstDiag)));
+ bMap1 = ((mat2 == nullptr) || (x < y || (x == y && bFirstDiag)));
if ((bDiag) || (x != y))
{
col = mat[i].matrix[x][y];
}
for (nexty = 1; (nexty <= mat[i].ny); nexty++)
{
- bNextMap1 = (!mat2 || (x < nexty || (x == nexty && bFirstDiag)));
+ bNextMap1 = ((mat2 == nullptr) || (x < nexty || (x == nexty && bFirstDiag)));
/* TRUE: upper left -> map1 */
/* FALSE: lower right -> map2 */
if ((nexty == mat[i].ny) || (!bDiag && (x == nexty)))
sc_r_power = fr->sc_r_power;
sigma6_def = fr->sc_sigma6_def;
sigma6_min = fr->sc_sigma6_min;
- bDoForces = kernel_data->flags & GMX_NONBONDED_DO_FORCE;
- bDoShiftForces = kernel_data->flags & GMX_NONBONDED_DO_SHIFTFORCE;
- bDoPotential = kernel_data->flags & GMX_NONBONDED_DO_POTENTIAL;
+ bDoForces = ((kernel_data->flags & GMX_NONBONDED_DO_FORCE) != 0);
+ bDoShiftForces = ((kernel_data->flags & GMX_NONBONDED_DO_SHIFTFORCE) != 0);
+ bDoPotential = ((kernel_data->flags & GMX_NONBONDED_DO_POTENTIAL) != 0);
rcoulomb = ic->rcoulomb;
rvdw = ic->rvdw;
/* Ewald (not PME) table is special (icoul==enbcoulFEWALD) */
- do_tab = (icoul == GMX_NBKERNEL_ELEC_CUBICSPLINETABLE ||
- ivdw == GMX_NBKERNEL_VDW_CUBICSPLINETABLE);
+ do_tab = static_cast<int>(icoul == GMX_NBKERNEL_ELEC_CUBICSPLINETABLE ||
+ ivdw == GMX_NBKERNEL_VDW_CUBICSPLINETABLE);
if (do_tab)
{
tabscale = kernel_data->table_elec_vdw->scale;
bool found = FALSE;
for (i = 0; i < nvsiteconf && !found; i++)
{
- found = (!gmx_strcasecmp(vsiteconflist[i].atomtype, atomtype) && (vsiteconflist[i].nhydrogens == 2));
+ found = ((gmx_strcasecmp(vsiteconflist[i].atomtype, atomtype) == 0) && (vsiteconflist[i].nhydrogens == 2));
}
if (found)
{
bool found = FALSE;
for (i = 0; i < nvsiteconf && !found; i++)
{
- found = (!gmx_strcasecmp(vsiteconflist[i].atomtype, atom) &&
- !gmx_strcasecmp(vsiteconflist[i].nextheavytype, nextheavy));
+ found = ((gmx_strcasecmp(vsiteconflist[i].atomtype, atom) == 0) &&
+ (gmx_strcasecmp(vsiteconflist[i].nextheavytype, nextheavy) == 0));
}
if (found)
{
int j;
t_restp *rtpp;
- if (at->atom[atom].m)
+ if (at->atom[atom].m != 0.0f)
{
type = at->atom[atom].type;
}
int j;
t_restp *rtpp;
- if (at->atom[atom].m)
+ if (at->atom[atom].m != 0.0f)
{
mass = at->atom[atom].m;
}
static bool is_word_end(char c)
{
- return !(isalnum(c) || c == '_');
+ return !((isalnum(c) != 0) || c == '_');
}
static const char *strstrw(const char *buf, const char *word)
return eCPP_FILE_NOT_OPEN;
}
- bEOF = feof(handle->fp);
+ bEOF = (feof(handle->fp) != 0);
if (!bEOF)
{
/* Read the actual line now. */
/* Recheck EOF, since we could have been at the end before
* the fgets2 call, but we need to read past the end to know.
*/
- bEOF = feof(handle->fp);
+ bEOF = (feof(handle->fp) != 0);
if (!bEOF)
{
/* Something strange happened, fgets returned NULL,
atomsMatch = TRUE;
for (k = 0; k < natoms && atomsMatch; k++)
{
- atomsMatch = atomsMatch && !strcmp(b->a[k], blist[i].a[k]);
+ atomsMatch = atomsMatch && (strcmp(b->a[k], blist[i].a[k]) == 0);
}
/* Try reverse if forward match did not work */
if (!atomsMatch)
atomsMatch = TRUE;
for (k = 0; k < natoms && atomsMatch; k++)
{
- atomsMatch = atomsMatch && !strcmp(b->a[k], blist[i].a[natoms-1-k]);
+ atomsMatch = atomsMatch && (strcmp(b->a[k], blist[i].a[natoms-1-k]) == 0);
}
}
if (atomsMatch)
bFound = FALSE;
for (k = i0; k < i; k++)
{
- bFound = (bFound || !gmx_strcasecmp(*(at->atomname[k]), name));
+ bFound = (bFound || (gmx_strcasecmp(*(at->atomname[k]), name) == 0));
}
if (!bFound)
{
{
int i;
- check_restp_type("all dihedrals", r0->bKeepAllGeneratedDihedrals, r1->bKeepAllGeneratedDihedrals);
+ check_restp_type("all dihedrals", static_cast<int>(r0->bKeepAllGeneratedDihedrals), static_cast<int>(r1->bKeepAllGeneratedDihedrals));
check_restp_type("nrexcl", r0->nrexcl, r1->nrexcl);
- check_restp_type("HH14", r0->bGenerateHH14Interactions, r1->bGenerateHH14Interactions);
- check_restp_type("remove dihedrals", r0->bRemoveDihedralIfWithImproper, r1->bRemoveDihedralIfWithImproper);
+ check_restp_type("HH14", static_cast<int>(r0->bGenerateHH14Interactions), static_cast<int>(r1->bGenerateHH14Interactions));
+ check_restp_type("remove dihedrals", static_cast<int>(r0->bRemoveDihedralIfWithImproper), static_cast<int>(r1->bRemoveDihedralIfWithImproper));
for (i = 0; i < ebtsNR; i++)
{
expand->lmc_repeats = get_eint(inp, "lmc-repeats", 1, wi);
expand->gibbsdeltalam = get_eint(inp, "lmc-gibbsdelta", -1, wi);
expand->lmc_forced_nstart = get_eint(inp, "lmc-forced-nstart", 0, wi);
- expand->bSymmetrizedTMatrix = get_eeenum(inp, "symmetrized-transition-matrix", yesno_names, wi);
+ expand->bSymmetrizedTMatrix = (get_eeenum(inp, "symmetrized-transition-matrix", yesno_names, wi) != 0);
expand->nstTij = get_eint(inp, "nst-transition-matrix", -1, wi);
expand->minvarmin = get_eint(inp, "mininum-var-min", 100, wi); /*default is reasonable */
expand->c_range = get_eint(inp, "weight-c-range", 0, wi); /* default is just C=0 */
expand->wl_scale = get_ereal(inp, "wl-scale", 0.8, wi);
expand->wl_ratio = get_ereal(inp, "wl-ratio", 0.8, wi);
expand->init_wl_delta = get_ereal(inp, "init-wl-delta", 1.0, wi);
- expand->bWLoneovert = get_eeenum(inp, "wl-oneovert", yesno_names, wi);
+ expand->bWLoneovert = (get_eeenum(inp, "wl-oneovert", yesno_names, wi) != 0);
}
/*! \brief Return whether an end state with the given coupling-lambda
/* Implicit solvation is no longer supported, but we need grompp
to be able to refuse old .mdp files that would have built a tpr
to run it. Thus, only "no" is accepted. */
- ir->implicit_solvent = get_eeenum(&inp, "implicit-solvent", no_names, wi);
+ ir->implicit_solvent = (get_eeenum(&inp, "implicit-solvent", no_names, wi) != 0);
/* Coupling stuff */
printStringNewline(&inp, "OPTIONS FOR WEAK COUPLING ALGORITHMS");
ir->etc = get_eeenum(&inp, "tcoupl", etcoupl_names, wi);
ir->nsttcouple = get_eint(&inp, "nsttcouple", -1, wi);
ir->opts.nhchainlength = get_eint(&inp, "nh-chain-length", 10, wi);
- ir->bPrintNHChains = get_eeenum(&inp, "print-nose-hoover-chain-variables", yesno_names, wi);
+ ir->bPrintNHChains = (get_eeenum(&inp, "print-nose-hoover-chain-variables", yesno_names, wi) != 0);
printStringNoNewline(&inp, "Groups to couple separately");
setStringEntry(&inp, "tc-grps", is->tcgrps, nullptr);
printStringNoNewline(&inp, "Time constant (ps) and reference temperature (K)");
/* QMMM */
printStringNewline(&inp, "OPTIONS FOR QMMM calculations");
- ir->bQMMM = get_eeenum(&inp, "QMMM", yesno_names, wi);
+ ir->bQMMM = (get_eeenum(&inp, "QMMM", yesno_names, wi) != 0);
printStringNoNewline(&inp, "Groups treated Quantum Mechanically");
setStringEntry(&inp, "QMMM-grps", is->QMMM, nullptr);
printStringNoNewline(&inp, "QM method");
/* Startup run */
printStringNewline(&inp, "GENERATE VELOCITIES FOR STARTUP RUN");
- opts->bGenVel = get_eeenum(&inp, "gen-vel", yesno_names, wi);
+ opts->bGenVel = (get_eeenum(&inp, "gen-vel", yesno_names, wi) != 0);
opts->tempi = get_ereal(&inp, "gen-temp", 300.0, wi);
opts->seed = get_eint(&inp, "gen-seed", -1, wi);
printStringNoNewline(&inp, "Type of constraint algorithm");
ir->eConstrAlg = get_eeenum(&inp, "constraint-algorithm", econstr_names, wi);
printStringNoNewline(&inp, "Do not constrain the start configuration");
- ir->bContinuation = get_eeenum(&inp, "continuation", yesno_names, wi);
+ ir->bContinuation = (get_eeenum(&inp, "continuation", yesno_names, wi) != 0);
printStringNoNewline(&inp, "Use successive overrelaxation to reduce the number of shake iterations");
- ir->bShakeSOR = get_eeenum(&inp, "Shake-SOR", yesno_names, wi);
+ ir->bShakeSOR = (get_eeenum(&inp, "Shake-SOR", yesno_names, wi) != 0);
printStringNoNewline(&inp, "Relative tolerance of shake");
ir->shake_tol = get_ereal(&inp, "shake-tol", 0.0001, wi);
printStringNoNewline(&inp, "Highest order in the expansion of the constraint coupling matrix");
printStringNoNewline(&inp, "rotates over more degrees than");
ir->LincsWarnAngle = get_ereal(&inp, "lincs-warnangle", 30.0, wi);
printStringNoNewline(&inp, "Convert harmonic bonds to morse potentials");
- opts->bMorse = get_eeenum(&inp, "morse", yesno_names, wi);
+ opts->bMorse = (get_eeenum(&inp, "morse", yesno_names, wi) != 0);
/* Energy group exclusions */
printStringNewline(&inp, "ENERGY GROUP EXCLUSIONS");
/* COM pulling */
printStringNewline(&inp, "COM PULLING");
- ir->bPull = get_eeenum(&inp, "pull", yesno_names, wi);
+ ir->bPull = (get_eeenum(&inp, "pull", yesno_names, wi) != 0);
if (ir->bPull)
{
snew(ir->pull, 1);
/* AWH biasing
NOTE: needs COM pulling input */
printStringNewline(&inp, "AWH biasing");
- ir->bDoAwh = get_eeenum(&inp, "awh", yesno_names, wi);
+ ir->bDoAwh = (get_eeenum(&inp, "awh", yesno_names, wi) != 0);
if (ir->bDoAwh)
{
if (ir->bPull)
/* Enforced rotation */
printStringNewline(&inp, "ENFORCED ROTATION");
printStringNoNewline(&inp, "Enforced rotation: No or Yes");
- ir->bRot = get_eeenum(&inp, "rotation", yesno_names, wi);
+ ir->bRot = (get_eeenum(&inp, "rotation", yesno_names, wi) != 0);
if (ir->bRot)
{
snew(ir->rot, 1);
printStringNoNewline(&inp, "Force weighting of pairs in one distance restraint: Conservative or Equal");
ir->eDisreWeighting = get_eeenum(&inp, "disre-weighting", edisreweighting_names, wi);
printStringNoNewline(&inp, "Use sqrt of the time averaged times the instantaneous violation");
- ir->bDisreMixed = get_eeenum(&inp, "disre-mixed", yesno_names, wi);
+ ir->bDisreMixed = (get_eeenum(&inp, "disre-mixed", yesno_names, wi) != 0);
ir->dr_fc = get_ereal(&inp, "disre-fc", 1000.0, wi);
ir->dr_tau = get_ereal(&inp, "disre-tau", 0.0, wi);
printStringNoNewline(&inp, "Output frequency for pair distances to energy file");
ir->nstdisreout = get_eint(&inp, "nstdisreout", 100, wi);
printStringNoNewline(&inp, "Orientation restraints: No or Yes");
- opts->bOrire = get_eeenum(&inp, "orire", yesno_names, wi);
+ opts->bOrire = (get_eeenum(&inp, "orire", yesno_names, wi) != 0);
printStringNoNewline(&inp, "Orientation restraints force constant and tau for time averaging");
ir->orires_fc = get_ereal(&inp, "orire-fc", 0.0, wi);
ir->orires_tau = get_ereal(&inp, "orire-tau", 0.0, wi);
setStringEntry(&inp, "couple-moltype", is->couple_moltype, nullptr);
opts->couple_lam0 = get_eeenum(&inp, "couple-lambda0", couple_lam, wi);
opts->couple_lam1 = get_eeenum(&inp, "couple-lambda1", couple_lam, wi);
- opts->bCoupleIntra = get_eeenum(&inp, "couple-intramol", yesno_names, wi);
+ opts->bCoupleIntra = (get_eeenum(&inp, "couple-intramol", yesno_names, wi) != 0);
fep->init_lambda = get_ereal(&inp, "init-lambda", -1, wi); /* start with -1 so
we can recognize if
fep->sc_power = get_eint(&inp, "sc-power", 1, wi);
fep->sc_r_power = get_ereal(&inp, "sc-r-power", 6.0, wi);
fep->sc_sigma = get_ereal(&inp, "sc-sigma", 0.3, wi);
- fep->bScCoul = get_eeenum(&inp, "sc-coul", yesno_names, wi);
+ fep->bScCoul = (get_eeenum(&inp, "sc-coul", yesno_names, wi) != 0);
fep->dh_hist_size = get_eint(&inp, "dh_hist_size", 0, wi);
fep->dh_hist_spacing = get_ereal(&inp, "dh_hist_spacing", 0.1, wi);
fep->separate_dhdl_file = get_eeenum(&inp, "separate-dhdl-file", separate_dhdl_file_names, wi);
/* simulated tempering variables */
printStringNewline(&inp, "simulated tempering variables");
- ir->bSimTemp = get_eeenum(&inp, "simulated-tempering", yesno_names, wi);
+ ir->bSimTemp = (get_eeenum(&inp, "simulated-tempering", yesno_names, wi) != 0);
ir->simtempvals->eSimTempScale = get_eeenum(&inp, "simulated-tempering-scaling", esimtemp_names, wi);
ir->simtempvals->simtemp_low = get_ereal(&inp, "sim-temp-low", 300.0, wi);
ir->simtempvals->simtemp_high = get_ereal(&inp, "sim-temp-high", 300.0, wi);
setStringEntry(&inp, "split-group0", ir->swap->grp[eGrpSplit0].molname, nullptr);
setStringEntry(&inp, "split-group1", ir->swap->grp[eGrpSplit1].molname, nullptr);
printStringNoNewline(&inp, "Use center of mass of split groups (yes/no), otherwise center of geometry is used");
- ir->swap->massw_split[0] = get_eeenum(&inp, "massw-split0", yesno_names, wi);
- ir->swap->massw_split[1] = get_eeenum(&inp, "massw-split1", yesno_names, wi);
+ ir->swap->massw_split[0] = (get_eeenum(&inp, "massw-split0", yesno_names, wi) != 0);
+ ir->swap->massw_split[1] = (get_eeenum(&inp, "massw-split1", yesno_names, wi) != 0);
printStringNoNewline(&inp, "Name of solvent molecules");
setStringEntry(&inp, "solvent-group", ir->swap->grp[eGrpSolvent].molname, nullptr);
/* AdResS is no longer supported, but we need grompp to be able to
refuse to process old .mdp files that used it. */
- ir->bAdress = get_eeenum(&inp, "adress", no_names, wi);
+ ir->bAdress = (get_eeenum(&inp, "adress", no_names, wi) != 0);
/* User defined thingies */
printStringNewline(&inp, "User defined thingies");
{
for (j = 0; (j < DIM); j++, k++)
{
- ir->opts.nFreeze[i][j] = (gmx_strncasecmp(ptr1[k], "Y", 1) == 0);
+ ir->opts.nFreeze[i][j] = static_cast<int>(gmx_strncasecmp(ptr1[k], "Y", 1) == 0);
if (!ir->opts.nFreeze[i][j])
{
if (gmx_strncasecmp(ptr1[k], "N", 1) != 0)
printStringNoNewline(inp, "Cylinder radius for dynamic reaction force groups (nm)");
pull->cylinder_r = get_ereal(inp, "pull-cylinder-r", 1.5, wi);
pull->constr_tol = get_ereal(inp, "pull-constr-tol", 1E-6, wi);
- pull->bPrintCOM = get_eeenum(inp, "pull-print-com", yesno_names, wi);
- pull->bPrintRefValue = get_eeenum(inp, "pull-print-ref-value", yesno_names, wi);
- pull->bPrintComp = get_eeenum(inp, "pull-print-components", yesno_names, wi);
+ pull->bPrintCOM = (get_eeenum(inp, "pull-print-com", yesno_names, wi) != 0);
+ pull->bPrintRefValue = (get_eeenum(inp, "pull-print-ref-value", yesno_names, wi) != 0);
+ pull->bPrintComp = (get_eeenum(inp, "pull-print-components", yesno_names, wi) != 0);
pull->nstxout = get_eint(inp, "pull-nstxout", 50, wi);
pull->nstfout = get_eint(inp, "pull-nstfout", 50, wi);
printStringNoNewline(inp, "Number of pull groups");
sprintf(buf, "pull-coord%d-vec", coordNum);
setStringEntry(inp, buf, vec_buf, "0.0 0.0 0.0");
sprintf(buf, "pull-coord%d-start", coordNum);
- pcrd->bStart = get_eeenum(inp, buf, yesno_names, wi);
+ pcrd->bStart = (get_eeenum(inp, buf, yesno_names, wi) != 0);
sprintf(buf, "pull-coord%d-init", coordNum);
pcrd->init = get_ereal(inp, buf, 0.0, wi);
sprintf(buf, "pull-coord%d-rate", coordNum);
trim(buf);
}
}
- while (!feof(in) && strlen(buf) == 0);
+ while ((feof(in) == 0) && strlen(buf) == 0);
if (sscanf(buf, "%s%lf", name, &m) == 2)
{
rrtp[nrtp].resname, line);
}
}
- while (!feof(in) && !bNextResidue);
+ while ((feof(in) == 0) && !bNextResidue);
if (rrtp[nrtp].natom == 0)
{
D = D->prev;
}
- return (D != nullptr);
+ return static_cast<int>(D != nullptr);
}
int DS_Check_Order(DirStack *DS, directive d)
(pindex[atom].ftype == F_VSITE4FD ) ||
(pindex[atom].ftype == F_VSITE4FDN ) );
bThisOUT = ( (pindex[atom].ftype == F_VSITE3OUT) &&
- (interaction_function[cftype].flags & IF_CONSTRAINT) );
+ ((interaction_function[cftype].flags & IF_CONSTRAINT) != 0u) );
bAllFD = bAllFD && bThisFD;
if (bThisFD || bThisOUT)
{
trimString(std::string * s)
{
// heading
- s->erase(s->begin(), std::find_if(s->begin(), s->end(), [](char &c) -> bool { return !std::isspace(c); }));
+ s->erase(s->begin(), std::find_if(s->begin(), s->end(), [](char &c) -> bool { return std::isspace(c) == 0; }));
// trailing
- s->erase(std::find_if(s->rbegin(), s->rend(), [](char &c) -> bool { return !std::isspace(c); }).base(), s->end());
+ s->erase(std::find_if(s->rbegin(), s->rend(), [](char &c) -> bool { return std::isspace(c) == 0; }).base(), s->end());
}
// Check whether Hyper-threading is really possible to enable in the hardware,
// not just technically supported by this generation of processors
- if (features->count(CpuInfo::Feature::X86_Htt) && maxStdLevel >= 0x4)
+ if ((features->count(CpuInfo::Feature::X86_Htt) != 0u) && maxStdLevel >= 0x4)
{
executeX86CpuID(0x1, 0, &eax, &ebx, &ecx, &edx);
unsigned int maxLogicalCores = (ebx >> 16) & 0x0ff;
executeX86CpuID(0x1, 0, &eax, &ebx, &ecx, &edx);
int family = ((eax & 0x0ff00000) >> 20) + ((eax & 0x00000f00) >> 8);
executeX86CpuID(0x80000001, 0, &eax, &ebx, &ecx, &edx);
- bool haveExtendedTopology = (ecx & (1 << 22));
+ bool haveExtendedTopology = (ecx & (1 << 22)) != 0u;
// NOTE: Here we assume 1 thread per core, unless we have family >= 17h
layout.hwThreadBits = 0;
if (maxStdLevel >= 0x1)
{
executeX86CpuID(0x1, 0, &eax, &ebx, &ecx, &edx);
- haveX2Apic = (ecx & (1 << 21)) && maxStdLevel >= 0xb;
- haveApic = (edx & (1 << 9)) && maxExtLevel >= 0x80000008;
+ haveX2Apic = ((ecx & (1 << 21)) != 0u) && maxStdLevel >= 0xb;
+ haveApic = ((edx & (1 << 9)) != 0u) && maxExtLevel >= 0x80000008;
}
else
{
// testNames map above, and if it's a match return the vendor.
for (auto &l : { "vendor_id", "vendor", "manufacture", "model", "processor", "cpu" })
{
- if (cpuInfo.count(l))
+ if (cpuInfo.count(l) != 0u)
{
// there was a line with this left-hand side in /proc/cpuinfo
const std::string &s1 = cpuInfo.at(l);
std::set<CpuInfo::Feature> * features)
{
// Get brand string from 'cpu' label if present, otherwise 'Processor'
- if (cpuInfo.count("cpu"))
+ if (cpuInfo.count("cpu") != 0u)
{
*brand = cpuInfo.at("cpu");
}
- else if (cpuInfo.count("Processor"))
+ else if (cpuInfo.count("Processor") != 0u)
{
*brand = cpuInfo.at("Processor");
}
for (auto &l : { "model name", "model", "Processor", "cpu" })
{
- if (cpuInfo.count(l))
+ if (cpuInfo.count(l) != 0u)
{
std::string s1 = cpuInfo.at(l);
std::transform(s1.begin(), s1.end(), s1.begin(), ::tolower);
int * stepping,
std::set<CpuInfo::Feature> * features)
{
- if (cpuInfo.count("Processor"))
+ if (cpuInfo.count("Processor") != 0u)
{
*brand = cpuInfo.at("Processor");
}
- else if (cpuInfo.count("model name"))
+ else if (cpuInfo.count("model name") != 0u)
{
*brand = cpuInfo.at("model name");
}
- if (cpuInfo.count("CPU architecture"))
+ if (cpuInfo.count("CPU architecture") != 0u)
{
*family = std::strtol(cpuInfo.at("CPU architecture").c_str(), nullptr, 10);
// For some 64-bit CPUs it appears to say 'AArch64' instead
*family = 8; // fragile - no idea how a future ARMv9 will be represented in this case
}
}
- if (cpuInfo.count("CPU variant"))
+ if (cpuInfo.count("CPU variant") != 0u)
{
*model = std::strtol(cpuInfo.at("CPU variant").c_str(), nullptr, 16);
}
- if (cpuInfo.count("CPU revision"))
+ if (cpuInfo.count("CPU revision") != 0u)
{
*stepping = std::strtol(cpuInfo.at("CPU revision").c_str(), nullptr, 10);
}
- if (cpuInfo.count("Features"))
+ if (cpuInfo.count("Features") != 0u)
{
const std::string &s = cpuInfo.at("Features");
if (s.find("neon") != std::string::npos)
identifyAvx512FmaUnits()
{
static bool initialized = false;
- static int result = false;
+ static int result = 0;
if (!initialized)
{
fill_header(&header, IMD_HANDSHAKE, 1);
header.length = IMDVERSION; /* client wants unswapped version */
- return (imd_write_multiple(socket, reinterpret_cast<char *>(&header), HEADERSIZE) != HEADERSIZE);
+ return static_cast<int>(imd_write_multiple(socket, reinterpret_cast<char *>(&header), HEADERSIZE) != HEADERSIZE);
}
fill_header(reinterpret_cast<IMDHeader *>(buffer), IMD_ENERGIES, 1);
memcpy(buffer + HEADERSIZE, energies, sizeof(IMDEnergyBlock));
- return (imd_write_multiple(socket, buffer, recsize) != recsize);
+ return static_cast<int>(imd_write_multiple(socket, buffer, recsize) != recsize);
}
memcpy(buffer + HEADERSIZE + i * tuplesize, sendx, tuplesize);
}
- return (imd_write_multiple(socket, buffer, size) != size);
+ return static_cast<int>(imd_write_multiple(socket, buffer, size) != size);
}
ftype_is_bonded_potential(int ftype)
{
return
- (interaction_function[ftype].flags & IF_BOND) &&
+ ((interaction_function[ftype].flags & IF_BOND) != 0u) &&
!(ftype == F_CONNBONDS || ftype == F_POSRES || ftype == F_FBPOSRES);
}
const t_pbc *pbc_null;
bonded_threading_t *bt = fr->bondedThreading;
- bCalcEnerVir = (force_flags & (GMX_FORCE_VIRIAL | GMX_FORCE_ENERGY));
+ bCalcEnerVir = ((force_flags & (GMX_FORCE_VIRIAL | GMX_FORCE_ENERGY)) != 0);
if (fr->bMolPBC)
{
enerd->term, &enerd->grpp, dvdl,
bt,
bCalcEnerVir,
- force_flags & GMX_FORCE_DHDL);
+ (force_flags & GMX_FORCE_DHDL) != 0);
if (force_flags & GMX_FORCE_DHDL)
{
case F_LJ14:
bFreeEnergy =
(fr->efep != efepNO &&
- ((md->nPerturbed && (md->bPerturbed[ai] || md->bPerturbed[aj])) ||
+ (((md->nPerturbed != 0) && (md->bPerturbed[ai] || md->bPerturbed[aj])) ||
iparams[itype].lj14.c6A != iparams[itype].lj14.c6B ||
iparams[itype].lj14.c12A != iparams[itype].lj14.c12B));
qq = md->chargeA[ai]*md->chargeA[aj]*epsfac*fr->fudgeQQ;
case epctSURFACETENSION:
/* ir->ref_p[0/1] is the reference surface-tension times *
* the number of surfaces */
- if (ir->compress[ZZ][ZZ])
+ if (ir->compress[ZZ][ZZ] != 0.0f)
{
p_corr_z = dt/ir->tau_p*(ir->ref_p[ZZ][ZZ] - pres[ZZ][ZZ]);
}
md->sqrt_c6A, md->sqrt_c6B,
md->sigmaA, md->sigmaB,
md->sigma3A, md->sigma3B,
- md->nChargePerturbed || md->nTypePerturbed,
+ (md->nChargePerturbed != 0) || (md->nTypePerturbed != 0),
ir->cutoff_scheme != ecutsVERLET,
excl, x, box, mu_tot,
ir->ewald_geometry,
void free_gpu_resources(const t_forcerec *fr,
const gmx::PhysicalNodeCommunicator &physicalNodeCommunicator)
{
- bool isPPrankUsingGPU = fr && fr->nbv && fr->nbv->bUseGPU;
+ bool isPPrankUsingGPU = (fr != nullptr) && (fr->nbv != nullptr) && fr->nbv->bUseGPU;
/* stop the GPU profiler (only CUDA) */
stopGpuProfiler();
real prescorr, enercorr, dvdlcorr, dvdl_ekin;
/* translate CGLO flags to gmx_booleans */
- bStopCM = flags & CGLO_STOPCM;
- bGStat = flags & CGLO_GSTAT;
- bReadEkin = (flags & CGLO_READEKIN);
- bScaleEkin = (flags & CGLO_SCALEEKIN);
- bEner = flags & CGLO_ENERGY;
- bTemp = flags & CGLO_TEMPERATURE;
- bPres = (flags & CGLO_PRESSURE);
- bConstrain = (flags & CGLO_CONSTRAINT);
+ bStopCM = ((flags & CGLO_STOPCM) != 0);
+ bGStat = ((flags & CGLO_GSTAT) != 0);
+ bReadEkin = ((flags & CGLO_READEKIN) != 0);
+ bScaleEkin = ((flags & CGLO_SCALEEKIN) != 0);
+ bEner = ((flags & CGLO_ENERGY) != 0);
+ bTemp = ((flags & CGLO_TEMPERATURE) != 0);
+ bPres = ((flags & CGLO_PRESSURE) != 0);
+ bConstrain = ((flags & CGLO_CONSTRAINT) != 0);
/* we calculate a full state kinetic energy either with full-step velocity verlet
or half step where we need the pressure */
}
}
- md->bOrires = gmx_mtop_ftype_count(&mtop, F_ORIRES);
+ md->bOrires = (gmx_mtop_ftype_count(&mtop, F_ORIRES) != 0);
return mdAtoms;
}
{
"no", "yes", nullptr
};
- *bALLOW_ASYMMETRY = get_eeenum(&inp, "asymmetry", yesno_names, wi);
+ *bALLOW_ASYMMETRY = (get_eeenum(&inp, "asymmetry", yesno_names, wi) != 0);
check_warning_error(wi, FARGS);
{
ptr = getenv("GMX_USE_TREEREDUCE");
if (ptr != nullptr)
{
- nbat->bUseTreeReduce = strtol(ptr, nullptr, 10);
+ nbat->bUseTreeReduce = (strtol(ptr, nullptr, 10) != 0);
}
#if defined __MIC__
else if (nth > 8) /*on the CPU we currently don't benefit even at 32*/
if (c_gpuNumClusterPerCellY > 1)
{
/* Sort the atoms along y */
- sort_atoms(YY, (sub_z & 1), dd_zone,
+ sort_atoms(YY, (sub_z & 1) != 0, dd_zone,
nbs->a.data() + ash_z, na_z, x,
grid->c0[YY] + gridY*grid->cellSize[YY],
grid->invCellSize[YY], subdiv_z,
if (c_gpuNumClusterPerCellX > 1)
{
/* Sort the atoms along x */
- sort_atoms(XX, ((cz*c_gpuNumClusterPerCellY + sub_y) & 1), dd_zone,
+ sort_atoms(XX, ((cz*c_gpuNumClusterPerCellY + sub_y) & 1) != 0, dd_zone,
nbs->a.data() + ash_y, na_y, x,
grid->c0[XX] + gridX*grid->cellSize[XX],
grid->invCellSize[XX], subdiv_y,
clear_f(nbat, 0, f);
}
- bEner = (force_flags & GMX_FORCE_ENERGY);
+ bEner = ((force_flags & GMX_FORCE_ENERGY) != 0);
bEwald = EEL_FULL(iconst->eeltype);
if (bEwald)
* inner LJ + C for full-LJ + C
* inner LJ for full-LJ + no-C / half-LJ + no-C
*/
- do_LJ = (nbln->shift & NBNXN_CI_DO_LJ(0));
- do_coul = (nbln->shift & NBNXN_CI_DO_COUL(0));
- half_LJ = ((nbln->shift & NBNXN_CI_HALF_LJ(0)) || !do_LJ) && do_coul;
+ do_LJ = ((nbln->shift & NBNXN_CI_DO_LJ(0)) != 0);
+ do_coul = ((nbln->shift & NBNXN_CI_DO_COUL(0)) != 0);
+ half_LJ = (((nbln->shift & NBNXN_CI_HALF_LJ(0)) != 0) || !do_LJ) && do_coul;
#ifdef CALC_ENERGIES
#ifdef LJ_EWALD
* inner LJ + C for full-LJ + C
* inner LJ for full-LJ + no-C / half-LJ + no-C
*/
- do_LJ = (nbln->shift & NBNXN_CI_DO_LJ(0));
- do_coul = (nbln->shift & NBNXN_CI_DO_COUL(0));
- half_LJ = ((nbln->shift & NBNXN_CI_HALF_LJ(0)) || !do_LJ) && do_coul;
+ do_LJ = ((nbln->shift & NBNXN_CI_DO_LJ(0)) != 0);
+ do_coul = ((nbln->shift & NBNXN_CI_DO_COUL(0)) != 0);
+ half_LJ = (((nbln->shift & NBNXN_CI_HALF_LJ(0)) != 0) || !do_LJ) && do_coul;
#ifdef ENERGY_GROUPS
egps_i = nbat->energrp[ci];
* inner LJ + C for full-LJ + C
* inner LJ for full-LJ + no-C / half-LJ + no-C
*/
- do_LJ = (nbln->shift & NBNXN_CI_DO_LJ(0));
- do_coul = (nbln->shift & NBNXN_CI_DO_COUL(0));
- half_LJ = ((nbln->shift & NBNXN_CI_HALF_LJ(0)) || !do_LJ) && do_coul;
+ do_LJ = ((nbln->shift & NBNXN_CI_DO_LJ(0)) != 0);
+ do_coul = ((nbln->shift & NBNXN_CI_DO_COUL(0)) != 0);
+ half_LJ = (((nbln->shift & NBNXN_CI_HALF_LJ(0)) != 0) || !do_LJ) && do_coul;
#ifdef ENERGY_GROUPS
egps_i = nbat->energrp[ci];
nlist->gid[nri] = 0;
nlist->shift[nri] = nbl_ci->shift & NBNXN_CI_SHIFT;
- bFEP_i = gridi->fep[ci - gridi->cell0] & (1 << i);
+ bFEP_i = ((gridi->fep[ci - gridi->cell0] & (1 << i)) != 0u);
bFEP_i_all = bFEP_i_all && bFEP_i;
nlist->gid[nri] = 0;
nlist->shift[nri] = nbl_sci->shift & NBNXN_CI_SHIFT;
- bFEP_i = (gridi->fep[c_abs - gridi->cell0*c_gpuNumClusterPerCell] & (1 << i));
+ bFEP_i = ((gridi->fep[c_abs - gridi->cell0*c_gpuNumClusterPerCell] & (1 << i)) != 0u);
xi = nbat->x[ind_i*nbat->xstride+XX] + shx;
yi = nbat->x[ind_i*nbat->xstride+YY] + shy;
grid->cell_offset[i] = izones_x0[i];
size = izones_size[i];
- bDD = dd && (dd->nc[i] > 1);
+ bDD = (dd != nullptr) && (dd->nc[i] > 1);
if (!bDD)
{
bDDRect = FALSE;
/* With DD grid cell jumps only the first decomposition
* direction has uniform DD cell boundaries.
*/
- bDDRect = !(ddbox->tric_dir[i] ||
+ bDDRect = !((ddbox->tric_dir[i] != 0) ||
(dd_dlb_is_on(dd) && i != dd->dim[0]));
radd = rlist;
for (d = 0; d < DIM; d++)
{
shift0[d] = dd_zones->shift[zone][d];
- useall[d] = (shift0[d] == 0 || d >= grid->npbcdim);
+ useall[d] = static_cast<int>(shift0[d] == 0 || d >= grid->npbcdim);
/* Check if we need to do normal or optimized grid assignments.
* Normal is required for dims without DD or triclinic dims.
* DD edge cell on dims without pbc will be automatically
*/
matrix virial = { { 0 } };
spread_vsite_f(vsite, x, fDirectVir, nullptr,
- (flags & GMX_FORCE_VIRIAL), virial,
+ (flags & GMX_FORCE_VIRIAL) != 0, virial,
nrnb,
&top->idef, fr->ePBC, fr->bMolPBC, graph, box, cr, wcycle);
forceWithVirial->addVirialContribution(virial);
const gmx_edsam *ed,
gmx_bool bNS)
{
- const bool computeForces = (forceFlags & GMX_FORCE_FORCES);
+ const bool computeForces = (forceFlags & GMX_FORCE_FORCES) != 0;
/* NOTE: Currently all ForceProviders only provide forces.
* When they also provide energies, remove this conditional.
pmeFlags |= (flags & GMX_FORCE_FORCES) ? GMX_PME_CALC_F : 0;
pmeFlags |= (flags & GMX_FORCE_VIRIAL) ? GMX_PME_CALC_ENER_VIR : 0;
- pme_gpu_prepare_computation(pmedata, flags & GMX_FORCE_DYNAMICBOX, box, wcycle, pmeFlags);
+ pme_gpu_prepare_computation(pmedata, (flags & GMX_FORCE_DYNAMICBOX) != 0, box, wcycle, pmeFlags);
pme_gpu_launch_spread(pmedata, x, wcycle);
}
bNS = ((flags & GMX_FORCE_NS) != 0) && (!fr->bAllvsAll);
bFillGrid = (bNS && bStateChanged);
bCalcCGCM = (bFillGrid && !DOMAINDECOMP(cr));
- bDoForces = (flags & GMX_FORCE_FORCES);
+ bDoForces = ((flags & GMX_FORCE_FORCES) != 0);
bUseGPU = fr->nbv->bUseGPU;
bUseOrEmulGPU = bUseGPU || (fr->nbv->emulateGpu == EmulateGpuNonbonded::Yes);
}
}
- nbnxn_atomdata_copy_shiftvec(flags & GMX_FORCE_DYNAMICBOX,
+ nbnxn_atomdata_copy_shiftvec((flags & GMX_FORCE_DYNAMICBOX) != 0,
fr->shift_vec, nbv->nbat);
#if GMX_MPI
*/
gmx_pme_send_coordinates(cr, box, as_rvec_array(x.data()),
lambda[efptCOUL], lambda[efptVDW],
- (flags & (GMX_FORCE_VIRIAL | GMX_FORCE_ENERGY)),
+ (flags & (GMX_FORCE_VIRIAL | GMX_FORCE_ENERGY)) != 0,
step, wcycle);
}
#endif /* GMX_MPI */
}
/* forceWithVirial uses the local atom range only */
- gmx::ForceWithVirial forceWithVirial(forceRef, flags & GMX_FORCE_VIRIAL);
+ gmx::ForceWithVirial forceWithVirial(forceRef, (flags & GMX_FORCE_VIRIAL) != 0);
if (inputrec->bPull && pull_have_constraint(inputrec->pull_work))
{
/* Should we perform the long-range nonbonded evaluation inside the neighborsearching? */
bFillGrid = (bNS && bStateChanged);
bCalcCGCM = (bFillGrid && !DOMAINDECOMP(cr));
- bDoForces = (flags & GMX_FORCE_FORCES);
+ bDoForces = ((flags & GMX_FORCE_FORCES) != 0);
if (bStateChanged)
{
*/
gmx_pme_send_coordinates(cr, box, as_rvec_array(x.data()),
lambda[efptCOUL], lambda[efptVDW],
- (flags & (GMX_FORCE_VIRIAL | GMX_FORCE_ENERGY)),
+ (flags & (GMX_FORCE_VIRIAL | GMX_FORCE_ENERGY)) != 0,
step, wcycle);
}
#endif /* GMX_MPI */
}
/* forceWithVirial might need the full force atom range */
- gmx::ForceWithVirial forceWithVirial(forceRef, flags & GMX_FORCE_VIRIAL);
+ gmx::ForceWithVirial forceWithVirial(forceRef, (flags & GMX_FORCE_VIRIAL) != 0);
if (inputrec->bPull && pull_have_constraint(inputrec->pull_work))
{
int nener, j;
double nb;
gmx_bool bVV, bTemp, bEner, bPres, bConstrVir, bEkinAveVel, bReadEkin;
- bool checkNumberOfBondedInteractions = flags & CGLO_CHECK_NUMBER_OF_BONDED_INTERACTIONS;
+ bool checkNumberOfBondedInteractions = (flags & CGLO_CHECK_NUMBER_OF_BONDED_INTERACTIONS) != 0;
bVV = EI_VV(inputrec->eI);
- bTemp = flags & CGLO_TEMPERATURE;
- bEner = flags & CGLO_ENERGY;
- bPres = (flags & CGLO_PRESSURE);
- bConstrVir = (flags & CGLO_CONSTRAINT);
+ bTemp = ((flags & CGLO_TEMPERATURE) != 0);
+ bEner = ((flags & CGLO_ENERGY) != 0);
+ bPres = ((flags & CGLO_PRESSURE) != 0);
+ bConstrVir = ((flags & CGLO_CONSTRAINT) != 0);
bEkinAveVel = (inputrec->eI == eiVV || (inputrec->eI == eiVVAK && bPres));
- bReadEkin = (flags & CGLO_READEKIN);
+ bReadEkin = ((flags & CGLO_READEKIN) != 0);
rb = gs->rb;
itc0 = gs->itc0;
{
// TODO This implementation of ensemble orientation restraints is nasty because
// a user can't just do multi-sim with single-sim orientation restraints.
- bool usingEnsembleRestraints = (fcd->disres.nsystems > 1) || (ms && fcd->orires.nr);
- bool awhUsesMultiSim = (ir->bDoAwh && ir->awhParams->shareBiasMultisim && ms);
+ bool usingEnsembleRestraints = (fcd->disres.nsystems > 1) || ((ms != nullptr) && (fcd->orires.nr != 0));
+ bool awhUsesMultiSim = (ir->bDoAwh && ir->awhParams->shareBiasMultisim && (ms != nullptr));
// Replica exchange, ensemble restraints and AWH need all
// simulations to remain synchronized, so they need
if (bRerunMD && MASTER(cr))
{
- const bool constructVsites = (vsite && mdrunOptions.rerunConstructVsites);
+ const bool constructVsites = ((vsite != nullptr) && mdrunOptions.rerunConstructVsites);
if (constructVsites && DOMAINDECOMP(cr))
{
gmx_fatal(FARGS, "Vsite recalculation with -rerun is not implemented with domain decomposition, use a single rank");
* or at the last step (but not when we do not want confout),
* but never at the first step or with rerun.
*/
- bCPT = (((signals[eglsCHKPT].set && (bNS || ir->nstlist == 0)) ||
+ bCPT = ((((signals[eglsCHKPT].set != 0) && (bNS || ir->nstlist == 0)) ||
(bLastStep && mdrunOptions.writeConfout)) &&
step > ir->init_step && !bRerunMD);
if (bCPT)
* parallelization, but we can not really avoid it.
* But usually EM is not run at high parallelization.
*/
- int reductionBuffer = !validStep;
+ int reductionBuffer = static_cast<int>(!validStep);
gmx_sumi(1, &reductionBuffer, cr);
validStep = (reductionBuffer == 0);
}
}
for (m = 0; m < DIM; m++)
{
- frozen[3*i+m] = inputrec->opts.nFreeze[gf][m];
+ frozen[3*i+m] = (inputrec->opts.nFreeze[gf][m] != 0);
}
}
if (MASTER(cr))
{
fprintf(stderr, "\nwriting lowest energy coordinates.\n");
}
- write_em_traj(fplog, cr, outf, TRUE, inputrec->nstfout, ftp2fn(efSTO, nfile, fnm),
+ write_em_traj(fplog, cr, outf, TRUE, inputrec->nstfout != 0, ftp2fn(efSTO, nfile, fnm),
top_global, inputrec, count,
s_min, state_global, observablesHistory);
pmedata = gmx_pme_init(cr,
getNumPmeDomains(cr->dd),
inputrec,
- mtop.natoms, nChargePerturbed, nTypePerturbed,
+ mtop.natoms, nChargePerturbed != 0, nTypePerturbed != 0,
mdrunOptions.reproducible,
ewaldcoeff_q, ewaldcoeff_lj,
nthreads_pme,
copy_rvec(state_global->x[i], x_mol[i-a_tp0]);
/* Check if we need to print electrostatic energies */
bCharge |= (mdatoms->chargeA[i] != 0 ||
- (mdatoms->chargeB && mdatoms->chargeB[i] != 0));
+ ((mdatoms->chargeB != nullptr) && mdatoms->chargeB[i] != 0));
}
bRFExcl = (bCharge && EEL_RF(fr->ic->eeltype));
inline bool thisRankHasDuty(const t_commrec *cr, int duty)
{
GMX_ASSERT((duty == DUTY_PME) || (duty == DUTY_PP), "Invalid duty type");
- return (getThisRankDuties(cr) & duty);
+ return (getThisRankDuties(cr) & duty) != 0;
}
//! True if this is a simulation with more than 1 node
cmp_double(fp, "inputrec->awhParams->biastargetBetaScaling", biasIndex, bias1->targetBetaScaling, bias2->targetBetaScaling, ftol, abstol);
cmp_double(fp, "inputrec->awhParams->biastargetCutoff", biasIndex, bias1->targetCutoff, bias2->targetCutoff, ftol, abstol);
cmp_int(fp, "inputrec->awhParams->biaseGrowth", biasIndex, bias1->eGrowth, bias2->eGrowth);
- cmp_bool(fp, "inputrec->awhParams->biasbUserData", biasIndex, bias1->bUserData, bias2->bUserData);
+ cmp_bool(fp, "inputrec->awhParams->biasbUserData", biasIndex, bias1->bUserData != 0, bias2->bUserData != 0);
cmp_double(fp, "inputrec->awhParams->biaserror_initial", biasIndex, bias1->errorInitial, bias2->errorInitial, ftol, abstol);
cmp_int(fp, "inputrec->awhParams->biasShareGroup", biasIndex, bias1->shareGroup, bias2->shareGroup);
cmp_real(fp, "inputrec->ewald_rtol", -1, ir1->ewald_rtol, ir2->ewald_rtol, ftol, abstol);
cmp_int(fp, "inputrec->ewald_geometry", -1, ir1->ewald_geometry, ir2->ewald_geometry);
cmp_real(fp, "inputrec->epsilon_surface", -1, ir1->epsilon_surface, ir2->epsilon_surface, ftol, abstol);
- cmp_int(fp, "inputrec->bContinuation", -1, ir1->bContinuation, ir2->bContinuation);
- cmp_int(fp, "inputrec->bShakeSOR", -1, ir1->bShakeSOR, ir2->bShakeSOR);
+ cmp_int(fp, "inputrec->bContinuation", -1, static_cast<int>(ir1->bContinuation), static_cast<int>(ir2->bContinuation));
+ cmp_int(fp, "inputrec->bShakeSOR", -1, static_cast<int>(ir1->bShakeSOR), static_cast<int>(ir2->bShakeSOR));
cmp_int(fp, "inputrec->etc", -1, ir1->etc, ir2->etc);
- cmp_int(fp, "inputrec->bPrintNHChains", -1, ir1->bPrintNHChains, ir2->bPrintNHChains);
+ cmp_int(fp, "inputrec->bPrintNHChains", -1, static_cast<int>(ir1->bPrintNHChains), static_cast<int>(ir2->bPrintNHChains));
cmp_int(fp, "inputrec->epc", -1, ir1->epc, ir2->epc);
cmp_int(fp, "inputrec->epct", -1, ir1->epct, ir2->epct);
cmp_real(fp, "inputrec->tau_p", -1, ir1->tau_p, ir2->tau_p, ftol, abstol);
cmp_real(fp, "inputrec->shake_tol", -1, ir1->shake_tol, ir2->shake_tol, ftol, abstol);
cmp_int(fp, "inputrec->efep", -1, ir1->efep, ir2->efep);
cmp_fepvals(fp, ir1->fepvals, ir2->fepvals, ftol, abstol);
- cmp_int(fp, "inputrec->bSimTemp", -1, ir1->bSimTemp, ir2->bSimTemp);
+ cmp_int(fp, "inputrec->bSimTemp", -1, static_cast<int>(ir1->bSimTemp), static_cast<int>(ir2->bSimTemp));
if ((ir1->bSimTemp == ir2->bSimTemp) && (ir1->bSimTemp))
{
cmp_simtempvals(fp, ir1->simtempvals, ir2->simtempvals, std::min(ir1->fepvals->n_lambda, ir2->fepvals->n_lambda), ftol, abstol);
}
- cmp_int(fp, "inputrec->bExpanded", -1, ir1->bExpanded, ir2->bExpanded);
+ cmp_int(fp, "inputrec->bExpanded", -1, static_cast<int>(ir1->bExpanded), static_cast<int>(ir2->bExpanded));
if ((ir1->bExpanded == ir2->bExpanded) && (ir1->bExpanded))
{
cmp_expandedvals(fp, ir1->expandedvals, ir2->expandedvals, std::min(ir1->fepvals->n_lambda, ir2->fepvals->n_lambda), ftol, abstol);
cmp_int(fp, "inputrec->eDisre", -1, ir1->eDisre, ir2->eDisre);
cmp_real(fp, "inputrec->dr_fc", -1, ir1->dr_fc, ir2->dr_fc, ftol, abstol);
cmp_int(fp, "inputrec->eDisreWeighting", -1, ir1->eDisreWeighting, ir2->eDisreWeighting);
- cmp_int(fp, "inputrec->bDisreMixed", -1, ir1->bDisreMixed, ir2->bDisreMixed);
+ cmp_int(fp, "inputrec->bDisreMixed", -1, static_cast<int>(ir1->bDisreMixed), static_cast<int>(ir2->bDisreMixed));
cmp_int(fp, "inputrec->nstdisreout", -1, ir1->nstdisreout, ir2->nstdisreout);
cmp_real(fp, "inputrec->dr_tau", -1, ir1->dr_tau, ir2->dr_tau, ftol, abstol);
cmp_real(fp, "inputrec->orires_fc", -1, ir1->orires_fc, ir2->orires_fc, ftol, abstol);
zx = correct_box_elem(fplog, step, box, ZZ, XX);
yx = correct_box_elem(fplog, step, box, YY, XX);
- bCorrected = (zy || zx || yx);
+ bCorrected = ((zy != 0) || (zx != 0) || (yx != 0));
if (bCorrected && graph)
{
else if (ir->eI == eiBD)
{
real mbd;
- if (ir->bd_fric)
+ if (ir->bd_fric != 0.0f)
{
mbd = ir->bd_fric*ir->delta_t;
}
alloc_selection_data(sel, g->isize, false);
}
- bDoMinMax = (sel->cdata->flags & SEL_CDATA_DOMINMAX);
+ bDoMinMax = ((sel->cdata->flags & SEL_CDATA_DOMINMAX) != 0);
if (sel->type != SEL_SUBEXPR && bDoMinMax)
{
gmx_ana_index_deinit(sel->cdata->gmin);
{
if (item->child->cdata->flags & SEL_CDATA_COMMONSUBEXPR)
{
- bool bMinMax = item->child->cdata->flags & SEL_CDATA_DOMINMAX;
+ bool bMinMax = (item->child->cdata->flags & SEL_CDATA_DOMINMAX) != 0;
mark_subexpr_dynamic(item->child, false);
item->child->u.cgrp.isize = 0;
set_poscalc_maxindex(gmx_ana_poscalc_t *pc, gmx_ana_index_t *g, bool bBase)
{
const gmx_mtop_t *top = pc->coll->top_;
- gmx_ana_index_make_block(&pc->b, top, g, pc->itype, pc->flags & POS_COMPLWHOLE);
+ gmx_ana_index_make_block(&pc->b, top, g, pc->itype, (pc->flags & POS_COMPLWHOLE) != 0);
/* Set the type to POS_ATOM if the calculation in fact is such. */
if (pc->b.nr == pc->b.nra)
{
}
gmx::ArrayRef<const int> index = pc->coll->getFrameIndices(pc->b.nra, pc->b.a);
const gmx_mtop_t *top = pc->coll->top_;
- const bool bMass = pc->flags & POS_MASS;
+ const bool bMass = (pc->flags & POS_MASS) != 0;
switch (pc->type)
{
case POS_ATOM:
{
child = child->child->child;
}
- bDynamic_ = (child->child->flags & SEL_DYNAMIC);
+ bDynamic_ = ((child->child->flags & SEL_DYNAMIC) != 0);
}
}
initCoveredFraction(CFRAC_NONE);
continue;
}
if (startsWith(line, "help")
- && (line[4] == 0 || std::isspace(line[4])))
+ && (line[4] == 0 || (std::isspace(line[4]) != 0)))
{
printHelp(statusWriter, sc, line);
continue;
bool needsMasses = false;
if (u.expr.method != nullptr)
{
- needsTop = (u.expr.method->flags & SMETH_REQTOP);
- needsMasses = (u.expr.method->flags & SMETH_REQMASS);
+ needsTop = ((u.expr.method->flags & SMETH_REQTOP) != 0);
+ needsMasses = ((u.expr.method->flags & SMETH_REQMASS) != 0);
}
if (u.expr.pc != nullptr)
{
|| type == SEL_ROOT || type == SEL_SUBEXPR || type == SEL_SUBEXPRREF
// TODO: Consolidate.
|| type == SEL_MODIFIER
- || (type == SEL_EXPRESSION && (u.expr.method->flags & SMETH_ALLOW_UNSORTED));
+ || (type == SEL_EXPRESSION && ((u.expr.method->flags & SMETH_ALLOW_UNSORTED) != 0));
// TODO: For some complicated selections, this may result in the same
// index group reference being flagged as an error multiple times for the
continue;
}
/* Check that the name does not conflict with a method */
- if (symtab.findSymbol(param[i].name))
+ if (symtab.findSymbol(param[i].name) != nullptr)
{
report_param_error(fp, name, param[i].name, "error: name conflicts with another method or a keyword");
bOk = false;
static void set_pos_method_flags(gmx_ana_selmethod_t *method,
t_methoddata_pos *d)
{
- const bool forces = (d->flags != -1 && (d->flags & POS_FORCES));
+ const bool forces = (d->flags != -1 && ((d->flags & POS_FORCES) != 0));
switch (gmx::PositionCalculationCollection::requiredTopologyInfoForType(d->type, forces))
{
case gmx::PositionCalculationCollection::RequiredTopologyInfo::TopologyAndMasses:
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 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.
static inline float
maskAdd(float a, float b, float m)
{
- return a + (m ? b : 0.0f);
+ return a + (m != 0.0f ? b : 0.0f);
}
/*! \brief Multiply two float variables, masked version.
static inline float
maskzMul(float a, float b, float m)
{
- return m ? (a * b) : 0.0f;
+ return m != 0.0f ? (a * b) : 0.0f;
}
/*! \brief Float fused multiply-add, masked version.
static inline float
maskzFma(float a, float b, float c, float m)
{
- return m ? (a * b + c) : 0.0f;
+ return m != 0.0f ? (a * b + c) : 0.0f;
}
/*! \brief Float Floating-point abs().
static inline double
maskAdd(double a, double b, double m)
{
- return a + (m ? b : 0.0);
+ return a + (m != 0.0 ? b : 0.0);
}
/*! \brief Multiply two double variables, masked version.
static inline double
maskzMul(double a, double b, double m)
{
- return m ? (a * b) : 0.0;
+ return m != 0.0 ? (a * b) : 0.0;
}
/*! \brief double fused multiply-add, masked version.
static inline double
maskzFma(double a, double b, double c, double m)
{
- return m ? (a * b + c) : 0.0;
+ return m != 0.0 ? (a * b + c) : 0.0;
}
/*! \brief double doubleing-point abs().
while ((outlier == 0) && (stats->np_c < stats->np))
{
r = std::abs(stats->x[stats->np_c] - stats->y[stats->np_c]);
- outlier = (r > rmsd*level);
+ outlier = static_cast<int>(r > rmsd*level);
if (outlier)
{
if (nullptr != x)
for (int i = 0; (i < N); i++)
{
d2 += gmx::square(stats->x[i]-stats->y[i]);
- if ((stats->dy[i]) && (weight == elsqWEIGHT_Y))
+ if (((stats->dy[i]) != 0.0) && (weight == elsqWEIGHT_Y))
{
w = 1/gmx::square(stats->dy[i]);
}
t_forcetable *table;
snew(table, 1);
- b14only = (flags & GMX_MAKETABLES_14ONLY);
+ b14only = ((flags & GMX_MAKETABLES_14ONLY) != 0);
if (flags & GMX_MAKETABLES_FORCEUSER)
{
do
{
status = cpp_read_line(&handle, BUFLEN, buf);
- done = (status == eCPP_EOF);
+ done = static_cast<int>(status == eCPP_EOF);
if (!done)
{
if (status != eCPP_OK)
}
}
}
- while (!done);
+ while (done == 0);
status = cpp_close_file(&handle);
if (status != eCPP_OK)
{
pr_rvecs(stdout, indent, "x", x, natoms);
nframe++;
}
- while (read_next_xtc(xd, natoms, &step, &time, box, x, &prec, &bOK));
+ while (read_next_xtc(xd, natoms, &step, &time, box, x, &prec, &bOK) != 0);
if (!bOK)
{
fprintf(stderr, "\nWARNING: Incomplete frame at time %g\n", time);
indent = pr_blocka_title(fp, indent, title, block);
start = 0;
end = start;
- if ((ok = (block->index[start] == 0)) == 0)
+ if ((ok = static_cast<int>(block->index[start] == 0)) == 0)
{
fprintf(fp, "block->index[%d] should be 0\n", start);
}
bool found;
const char * p_oldtype;
- found = !gmx_residuetype_get_type(rt, newresname, &p_oldtype);
+ found = (gmx_residuetype_get_type(rt, newresname, &p_oldtype) == 0);
if (found && gmx_strcasecmp(p_oldtype, newrestype))
{
bool bFound = false;
for (int j = 0; j < n && !bFound; j++)
{
- bFound = !gmx_strcasecmp(p, my_typename[j]);
+ bFound = (gmx_strcasecmp(p, my_typename[j]) == 0);
}
if (!bFound)
{
bool
TrajectoryAnalysisSettings::hasFlag(unsigned long flag) const
{
- return impl_->flags & flag;
+ return (impl_->flags & flag) != 0u;
}
int n;
MPI_Initialized(&n);
- return n;
+ return n != 0;
#endif
}
/*! \brief Test if both bitmasks have no common bits enabled */
inline static bool bitmask_is_disjoint(gmx_bitmask_t a, gmx_bitmask_t b)
{
- return !(a & b);
+ return (a & b) == 0u;
}
/*! \brief Test if both bitmasks are equal */
/*! \brief Test if bitmask has no enabled bits */
inline static bool bitmask_is_zero(gmx_bitmask_t m)
{
- return !m;
+ return m == 0u;
}
/*! \brief Set all bits enabled in either mask and write into a */
bool r = true;
for (i = 0; i < BITMASK_ALEN; i++)
{
- r = r && !(a[i] & b[i]);
+ r = r && ((a[i] & b[i]) == 0u);
}
return r;
}
bool r = true;
for (i = 0; i < BITMASK_ALEN; i++)
{
- r = r && !m[i];
+ r = r && (m[i] == 0u);
}
return r;
}
return (ch1-ch2);
}
}
- while (ch1);
+ while (ch1 != 0);
return 0;
}
return (ch1-ch2);
}
}
- while (ch1 && (str1-stri1 < n) && (str2-stri2 < n));
+ while ((ch1 != 0) && (str1-stri1 < n) && (str2-stri2 < n));
return 0;
}
return (ch1-ch2);
}
}
- while (ch1);
+ while (ch1 != 0);
return 0;
}
}
n--;
}
- while (ch1 && n);
+ while ((ch1 != 0) && (n != 0));
return 0;
}
}
}
}
- while (buf[i]);
+ while (buf[i] != 0);
b2[i2] = '\0';
return b2;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2017, by the GROMACS development team, led by
+ * Copyright (c) 2015,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.
"fgets", errno);
}
*line = result;
- return !result.empty() || !std::feof(fp);
+ return !result.empty() || (std::feof(fp) == 0);
}
} // namespace
bool StandardInputStream::isInteractive() const
{
#ifdef HAVE_UNISTD_H
- return isatty(fileno(stdin));
+ return isatty(fileno(stdin)) != 0;
#else
return true;
#endif
//! Check whether a given character is a directory separator.
bool isDirSeparator(char chr)
{
- return std::strchr(cDirSeparators, chr);
+ return std::strchr(cDirSeparators, chr) != nullptr;
}
} // namespace
*/
bool isWordChar(char c)
{
- return std::isalnum(c) || c == '-' || c == '_';
+ return (std::isalnum(c) != 0) || c == '-' || c == '_';
}
/*! \brief