readability-implicit-bool-conversion 2/2
authorRoland Schulz <roland.schulz@intel.com>
Wed, 15 Aug 2018 18:33:02 +0000 (11:33 -0700)
committerMark Abraham <mark.j.abraham@gmail.com>
Sat, 18 Aug 2018 19:13:24 +0000 (21:13 +0200)
automatic changes

Change-Id: I05a9c95a129dec179291e875be411b4a8e1d0522

93 files changed:
src/.clang-tidy
src/gromacs/analysisdata/datamodulemanager.cpp
src/gromacs/awh/biasstate.cpp
src/gromacs/awh/read-params.cpp
src/gromacs/domdec/domdec.cpp
src/gromacs/domdec/domdec_topology.cpp
src/gromacs/domdec/redistribute.cpp
src/gromacs/essentialdynamics/edsam.cpp
src/gromacs/ewald/pme-only.cpp
src/gromacs/ewald/pme.cpp
src/gromacs/fft/fft.cpp
src/gromacs/fft/parallel_3dfft.cpp
src/gromacs/fileio/checkpoint.cpp
src/gromacs/fileio/enxio.cpp
src/gromacs/fileio/g96io.cpp
src/gromacs/fileio/gmxfio-xdr.cpp
src/gromacs/fileio/groio.cpp
src/gromacs/fileio/matio.cpp
src/gromacs/fileio/pdbio.cpp
src/gromacs/fileio/trxio.cpp
src/gromacs/fileio/vmdio.cpp
src/gromacs/fileio/xtcio.cpp
src/gromacs/fileio/xvgr.cpp
src/gromacs/gmxana/gmx_anaeig.cpp
src/gromacs/gmxana/gmx_analyze.cpp
src/gromacs/gmxana/gmx_cluster.cpp
src/gromacs/gmxana/gmx_dipoles.cpp
src/gromacs/gmxana/gmx_do_dssp.cpp
src/gromacs/gmxana/gmx_energy.cpp
src/gromacs/gmxana/gmx_hbond.cpp
src/gromacs/gmxana/gmx_make_ndx.cpp
src/gromacs/gmxana/gmx_mk_angndx.cpp
src/gromacs/gmxana/gmx_trjconv.cpp
src/gromacs/gmxana/gmx_xpm2ps.cpp
src/gromacs/gmxlib/nonbonded/nb_free_energy.cpp
src/gromacs/gmxpreprocess/gen_vsite.cpp
src/gromacs/gmxpreprocess/gmxcpp.cpp
src/gromacs/gmxpreprocess/hackblock.cpp
src/gromacs/gmxpreprocess/pdb2top.cpp
src/gromacs/gmxpreprocess/readir.cpp
src/gromacs/gmxpreprocess/readpull.cpp
src/gromacs/gmxpreprocess/resall.cpp
src/gromacs/gmxpreprocess/topdirs.cpp
src/gromacs/gmxpreprocess/vsite_parm.cpp
src/gromacs/hardware/cpuinfo.cpp
src/gromacs/hardware/identifyavx512fmaunits.cpp
src/gromacs/imd/imd.cpp
src/gromacs/listed-forces/listed-forces.cpp
src/gromacs/listed-forces/pairs.cpp
src/gromacs/mdlib/coupling.cpp
src/gromacs/mdlib/force.cpp
src/gromacs/mdlib/forcerec.cpp
src/gromacs/mdlib/md_support.cpp
src/gromacs/mdlib/mdatoms.cpp
src/gromacs/mdlib/membed.cpp
src/gromacs/mdlib/nbnxn_atomdata.cpp
src/gromacs/mdlib/nbnxn_grid.cpp
src/gromacs/mdlib/nbnxn_kernels/nbnxn_kernel_gpu_ref.cpp
src/gromacs/mdlib/nbnxn_kernels/nbnxn_kernel_ref_outer.h
src/gromacs/mdlib/nbnxn_kernels/simd_2xnn/nbnxn_kernel_simd_2xnn_outer.h
src/gromacs/mdlib/nbnxn_kernels/simd_4xn/nbnxn_kernel_simd_4xn_outer.h
src/gromacs/mdlib/nbnxn_search.cpp
src/gromacs/mdlib/nsgrid.cpp
src/gromacs/mdlib/sim_util.cpp
src/gromacs/mdlib/stat.cpp
src/gromacs/mdrun/md.cpp
src/gromacs/mdrun/minimize.cpp
src/gromacs/mdrun/runner.cpp
src/gromacs/mdrun/tpi.cpp
src/gromacs/mdtypes/commrec.h
src/gromacs/mdtypes/inputrec.cpp
src/gromacs/pbcutil/pbc.cpp
src/gromacs/pulling/pull.cpp
src/gromacs/selection/compiler.cpp
src/gromacs/selection/poscalc.cpp
src/gromacs/selection/selection.cpp
src/gromacs/selection/selectioncollection.cpp
src/gromacs/selection/selelem.cpp
src/gromacs/selection/selmethod.cpp
src/gromacs/selection/sm_position.cpp
src/gromacs/simd/scalar/scalar.h
src/gromacs/statistics/statistics.cpp
src/gromacs/tables/forcetable.cpp
src/gromacs/tools/dump.cpp
src/gromacs/topology/block.cpp
src/gromacs/topology/residuetypes.cpp
src/gromacs/trajectoryanalysis/analysissettings.cpp
src/gromacs/utility/basenetwork.cpp
src/gromacs/utility/bitmask.h
src/gromacs/utility/cstringutil.cpp
src/gromacs/utility/filestream.cpp
src/gromacs/utility/path.cpp
src/gromacs/utility/stringutil.cpp

index 95f603173a96b9870120b85a58636384b23b83d1..c74d0c1ca887cc39aad500a48541e38a07a23705 100644 (file)
@@ -1,6 +1,6 @@
 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,
@@ -22,3 +22,7 @@ CheckOptions:
     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
index da23cb32df72d16358099751d5d515443344c042..173c2a712a3a8c00ceb7cfb02a8949588659cd39 100644 (file)
@@ -233,7 +233,7 @@ AnalysisDataModuleManager::Impl::presentData(AbstractAnalysisData *data,
                        "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);
index 633f045c746233132cf332847116c76033496223..4bf7bf3263122fa654f4613b9013b6750a17a08b 100644 (file)
@@ -824,7 +824,7 @@ void labelCoveredPoints(const std::vector<bool> &visited,
                 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
@@ -862,7 +862,7 @@ void labelCoveredPoints(const std::vector<bool> &visited,
         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. */
@@ -875,7 +875,7 @@ void labelCoveredPoints(const std::vector<bool> &visited,
         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));
         }
     }
 }
@@ -982,7 +982,7 @@ bool BiasState::isSamplingRegionCovered(const BiasParams             &params,
     {
         for (int n = 0; n < grid.axis(d).numPoints() && allPointsCovered; n++)
         {
-            allPointsCovered = checkDim[d].covered[n];
+            allPointsCovered = (checkDim[d].covered[n] != 0);
         }
     }
 
index 45ece6574b4079ad5f39a1126e264978713297fa..63e4fc0696d0e10227df365d6051ea3f3b4d91ab 100644 (file)
@@ -286,7 +286,7 @@ static void read_bias_params(std::vector<t_inpfile> *inp, AwhBiasParams *awhBias
         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'.",
@@ -527,7 +527,7 @@ AwhParams *readAndCheckAwhParams(std::vector<t_inpfile> *inp, const t_inputrec *
 
     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);
index de012d0b26e95c7db27b16dbbb311fa011e325a9..9008b57e073ce157144c52d41a09fe505d22ec9f 100644 (file)
@@ -4097,7 +4097,7 @@ static void print_dd_settings(FILE *fplog, gmx_domdec_t *dd,
         fprintf(fplog, "\n\n");
     }
 
-    gmx_bool bInterCGVsites = count_intercg_vsites(mtop);
+    gmx_bool bInterCGVsites = count_intercg_vsites(mtop) != 0;
 
     if (comm->bInterCGBondeds ||
         bInterCGVsites ||
@@ -4337,7 +4337,7 @@ static void set_dd_envvar_options(FILE *fplog, gmx_domdec_t *dd, int rank_mysim)
 {
     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);
@@ -6785,7 +6785,7 @@ void dd_partition_system(FILE                *fplog,
         /* 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,
index 79b9d00790db8501e7f8bfc68be1622beaca2a53..1e8f4639ab732bbe821c6149890ffe98cd684a56 100644 (file)
@@ -156,9 +156,9 @@ static int nral_rt(int ftype)
 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));
 }
@@ -527,7 +527,7 @@ static int low_make_reverse_ilist(const t_ilist *il_mt, const t_atom *atom,
             (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)
@@ -1193,7 +1193,7 @@ static void combine_idef(t_idef *dest, const thread_work_t *src, int nsrc,
             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)
             {
@@ -1472,7 +1472,7 @@ check_assign_interactions_atom(int i, int i_gl,
                     }
                 }
                 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;
index 9a25296ffd62ead663136e818f960579f735b50f..1e91a08fd64ef6741bbbf8b6186191dee81d40d6 100644 (file)
@@ -533,8 +533,8 @@ void dd_redistribute_cg(FILE *fplog, int64_t step,
     }
 
     // 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();
index 3b35f9a00e743420351cc4a6202e11c1b78fd006..6ac2c9b9b5aab738d1d8929b816b880d9b4e0ea2 100644 (file)
@@ -286,12 +286,12 @@ namespace
  */
 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
 
@@ -2281,9 +2281,9 @@ static int ed_constraints(int edtype, t_edpar *edi)
 {
     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;
 }
index 84d49269ddc1473c0fad516325dfcd15d1cef01c..bec9a2e44eac8a4c74e8e1091dcc8254f74132f3 100644 (file)
@@ -409,7 +409,7 @@ static int gmx_pme_recv_coeffs_coords(gmx_pme_pp        *pme_pp,
             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 */
index f4433a432ed239abda962762c003e6e2ed224340..e1a2b5aeb964be71b6abdc127c723b911c85ca65 100644 (file)
@@ -1130,9 +1130,9 @@ int gmx_pme_do(struct gmx_pme_t *pme,
     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);
index 3769247de4cb73e313eaa652141c65a4420a9f39..2c799ca2ff54d1a41add1eba7bf6b67bb115a7f7 100644 (file)
@@ -255,7 +255,7 @@ int gmx_fft_transpose_2d(t_complex *          in_data,
             i = j;
             j = k;
         }
-        while (k);
+        while (k != 0);
         ncount += i-1;
     }
 
index ed904312e682555c0209287a1142de4ef4ace9b0..e05e7bf18dc8e729d164a2fd10f7e3cae06d6392 100644 (file)
@@ -88,7 +88,7 @@ gmx_parallel_3dfft_init   (gmx_parallel_3dfft_t           *    pfft_setup,
     (*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);
 }
 
 
@@ -169,7 +169,7 @@ gmx_parallel_3dfft_execute(gmx_parallel_3dfft_t    pfft_setup,
                            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");
     }
index ecf02b9a346daa3fa637d4cfb30d46752ce6e87d..a0482fbd28b33bf61bbde19d964c00f38546e0ac 100644 (file)
@@ -742,9 +742,9 @@ static int do_cpte_int(XDR *xd, StatePart part, int ecpt, int sflags,
 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;
 }
 
@@ -2272,12 +2272,12 @@ static void read_checkpoint(const char *fn, FILE **pfplog,
     {
         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)
     {
@@ -2653,18 +2653,18 @@ void read_checkpoint_trxframe(t_fileio *fp, t_trxframe *fr)
     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);
index e8d4e33f738df0d9923c7f31979ef0f4ee05426c..78aaf2ae18cc5215e14de805e68c07a6d74e0094 100644 (file)
@@ -785,7 +785,7 @@ empty_file(const char *fn)
 
     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
index 9773d3ef2103ada108d960b30ef2ca1e045bfd90..763db57a1bdbbbdab783811412f57452bcfc97d9 100644 (file)
@@ -343,7 +343,7 @@ int read_g96_conf(FILE *fp, const char *infile, char **name, t_trxframe *fr,
             bFinished = TRUE;
         }
     }
-    while (!bFinished && fgets2(line, STRLEN, fp));
+    while (!bFinished && (fgets2(line, STRLEN, fp) != nullptr));
 
     fr->natoms = natoms;
 
@@ -460,8 +460,8 @@ void write_g96_conf(FILE *out, const char *title, const t_trxframe *fr,
         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],
index 88d4bd61a7c9c2c7c7231c0a12ec1dfa1b525e5f..55ec1f001e7ad7d3a02eba5c5cc100d50e23a89c 100644 (file)
@@ -273,7 +273,7 @@ static gmx_bool do_xdr(t_fileio *fio, void *item, int nitem, int eio,
                 {
                     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:
@@ -406,11 +406,11 @@ gmx_bool gmx_fio_doe_gmx_bool(t_fileio *fio, gmx_bool *item,
     {
         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);
@@ -554,11 +554,11 @@ gmx_bool gmx_fio_ndoe_gmx_bool(t_fileio *fio, gmx_bool *item, int n,
         {
             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);
         }
     }
index 8038330369f3f0f434f1ad80583f722b48d0e931..5ee1805b3945dc17f4aa4a3f8f12539ed4e1c925 100644 (file)
@@ -436,8 +436,8 @@ static const char *get_hconf_format(bool haveVelocities)
 
 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],
index 1e824a4a5dc1311ce6972b2e894c819ccd922a53..3ff68286e9f1d13a4fe0feca0da40eb03f4b221b 100644 (file)
@@ -1049,8 +1049,8 @@ void write_xpm_m(FILE *out, t_matrix m)
                 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)
@@ -1102,8 +1102,8 @@ void write_xpm3(FILE *out, unsigned int flags,
 
     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);
 }
 
@@ -1138,8 +1138,8 @@ void write_xpm_split(FILE *out, unsigned int flags,
     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);
 }
@@ -1174,7 +1174,7 @@ void write_xpm(FILE *out, unsigned int flags,
 
     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);
 }
index 9b79e6385f2d15f152f65f31be15e159649de835..aa070856c64c43f172127cfd4e5bb1b77e6518ee 100644 (file)
@@ -327,7 +327,7 @@ void write_pdbfile_indexed(FILE *out, const char *title,
     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);
     }
@@ -810,7 +810,7 @@ gmx_bool is_dummymass(const char *nm)
     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)
index d7e37cdd4e6ed7e29713210fa7d46b765adccb35..f69f6dbc2e5d6446f99f0919de3cc411b70f0690 100644 (file)
@@ -763,11 +763,11 @@ static gmx_bool pdb_next_x(t_trxstatus *status, FILE *fp, t_trxframe *fr)
 
     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)
@@ -852,8 +852,8 @@ bool read_next_frame(const gmx_output_env_t *oenv, t_trxstatus *status, t_trxfra
                     }
                     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;
@@ -888,9 +888,9 @@ bool read_next_frame(const gmx_output_env_t *oenv, t_trxstatus *status, t_trxfra
 
         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)
             {
index 64e23e524707c75137d18c3ce9e3b1a57c012407..c385701505869c618083b5fa6bcf6fde350acffd 100644 (file)
@@ -435,7 +435,7 @@ int read_first_vmd_frame(const char *fn, gmx_vmdplugin_t **vmdpluginp, t_trxfram
     {
         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);
index 13c3365a9d9dd9ca4ef4d0c8552e8c90f8419ed4..bd705f2b765609fca9cea9d979ee021d785931ab 100644 (file)
@@ -255,9 +255,9 @@ int read_first_xtc(t_fileio *fio, int *natoms, int64_t *step, real *time,
 
     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,
@@ -286,7 +286,7 @@ 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);
 }
index 52e1b7a395d88b2687ea69681047b85c1f0b1618..fdd7a573f66549ec9876a60e214845ea38df04d6 100644 (file)
@@ -493,7 +493,7 @@ static char *fgets3(FILE *fp, char **ptr, int *len, int maxlen)
         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)
     {
index 7f12ca971afc7f42b40d672c052afb656d6868d5..1d213722f7ae3fd115895e54cf846a58da120a9c 100644 (file)
@@ -1091,20 +1091,20 @@ int gmx_anaeig(int argc, char *argv[])
     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,
index b4f8ba3640d350cc27440d1b140570de418e9c65..d76bc83f6c37eb42e6d8e13d0fd23c5b21e233ac 100644 (file)
@@ -1240,12 +1240,12 @@ int gmx_analyze(int argc, char *argv[])
         }
         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);
     }
index 20df5cf59224e6510c8baad03505a88213f7fda8..4d460c0d1e2c8e2f8ea1499b174add7af11cd1da 100644 (file)
@@ -557,7 +557,7 @@ static void jarvis_patrick(int n1, real **mat, int M, int P,
     {
         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
@@ -568,7 +568,7 @@ static void jarvis_patrick(int n1, real **mat, int M, int P,
         {
             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)
@@ -1911,7 +1911,7 @@ int gmx_cluster(int argc, char *argv[])
         {
             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;
                 }
index b6ac920a9047d17e143a714d38eb91bd211506cb..302818b18ee0db7d26e34bc81e09114497ec77bc 100644 (file)
@@ -1400,7 +1400,7 @@ static void do_dip(const t_topology *top, int ePBC, real volume,
             {
                 do_autocorr(corf, oenv, "Dipole Autocorrelation Function",
                             teller, gnx_tot, muall, dt,
-                            mode, std::strcmp(corrtype, "molsep"));
+                            mode, std::strcmp(corrtype, "molsep") != 0);
             }
         }
     }
index a1e9c2a63cca2d42fb0959a13e3283a4d6c762e5..cdf208521243115a37a2385aed0d82e0453d6c6b 100644 (file)
@@ -536,7 +536,7 @@ int gmx_do_dssp(int argc, char *argv[])
     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);
index 6dc4c6ea4fe1825c3fc75bc0c0c3c2019f00e326..03312ef4825b056170bad89798be34ed73696b08 100644 (file)
@@ -276,7 +276,7 @@ static int *select_by_name(int nre, gmx_enxnm_t *nm, int *nset)
                     trim(ptr);
                 }
             }
-            while (!bEOF && (ptr && (std::strlen(ptr) > 0)));
+            while (!bEOF && ((ptr != nullptr) && (std::strlen(ptr) > 0)));
         }
     }
 
index b2bf4057c5e6d102238e402766dc9e1fe0d74148..066921f858e585f9e792f938ce402acfc1133de0 100644 (file)
@@ -1565,7 +1565,7 @@ static void do_hblife(const char *fn, t_hbdata *hb, gmx_bool bMerge, gmx_bool bC
 
                     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);
@@ -1657,8 +1657,8 @@ static void dump_ac(t_hbdata *hb, gmx_bool oneHB, int nDump)
                 {
                     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;
                     }
                 }
@@ -1666,8 +1666,8 @@ static void dump_ac(t_hbdata *hb, gmx_bool oneHB, int nDump)
                 {
                     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 */
@@ -2049,8 +2049,8 @@ static void do_hbac(const char *fn, t_hbdata *hb,
                     {
                         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
                         {
@@ -3347,7 +3347,7 @@ int gmx_hbond(int argc, char *argv[])
                                     {
                                         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++;
                                 }
index a70bbd49401d56487ab9b9ae49ca79b0feac8c8a..a127313153f81bcc8c34fd8c19c287125c841fab 100644 (file)
@@ -538,7 +538,7 @@ static gmx_bool atoms_from_residuenumbers(const t_atoms *atoms, int group, t_blo
     }
     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)
@@ -997,11 +997,11 @@ static gmx_bool parse_entry(char **string, int natoms, const t_atoms *atoms,
         {
             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);
             }
         }
@@ -1018,7 +1018,7 @@ static gmx_bool parse_entry(char **string, int natoms, const t_atoms *atoms,
             }
             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);
             }
         }
@@ -1041,7 +1041,7 @@ static gmx_bool parse_entry(char **string, int natoms, const t_atoms *atoms,
         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')
@@ -1051,11 +1051,11 @@ static gmx_bool parse_entry(char **string, int natoms, const t_atoms *atoms,
         {
             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);
             }
         }
@@ -1066,7 +1066,7 @@ static gmx_bool parse_entry(char **string, int natoms, const t_atoms *atoms,
         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++)
             {
@@ -1127,8 +1127,8 @@ static void list_residues(const t_atoms *atoms)
         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)
index f9dee1e3e318ef56008299e303ee13c617957dd9..eee7ec8bbd85c17836f9ddb283cbb7d5b87927cb 100644 (file)
@@ -177,7 +177,7 @@ static void fill_ang(int nft, const int *ft, int fac,
                     }
                 }
             }
-            if (hq)
+            if (hq != 0.0f)
             {
                 for (j = 0; j < fac; j++)
                 {
index ebce1d37e643fc9c03dae9b844aa9f2a7b649941..9c053248b73f5d9814e6f6c54bb49678fe4fbc78 100644 (file)
@@ -374,7 +374,7 @@ static void put_residue_com_in_box(int unitcell_enum, int ecenter,
                     break;
             }
             rvec_sub(newCom, com, shift);
-            if (norm2(shift))
+            if (norm2(shift) != 0.0f)
             {
                 if (debug)
                 {
@@ -1576,7 +1576,7 @@ int gmx_trjconv(int argc, char *argv[])
                 }
 
                 bWriteFrame =
-                    ( ( !bTDump && !frindex && frame % skip_nr == 0 ) || bDumpFrame );
+                    ( ( !bTDump && (frindex == nullptr) && frame % skip_nr == 0 ) || bDumpFrame );
 
                 if (bWriteFrame && (bDropUnder || bDropOver))
                 {
index 5c04390a80b32b232d429183d88ec1ef14fac010..f3e96a68aedfd362ec257ae5a550d6038972ec3e 100644 (file)
@@ -137,7 +137,7 @@ static void get_params(const char *mpin, const char *mpout, t_psrec *psr)
     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);
@@ -154,7 +154,7 @@ static void get_params(const char *mpin, const char *mpout, t_psrec *psr)
     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,        "");
@@ -166,7 +166,7 @@ static void get_params(const char *mpin, const char *mpout, t_psrec *psr)
     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);
@@ -888,8 +888,8 @@ static void ps_mat(const char *outf, int nmat, t_matrix mat[], t_matrix mat2[],
         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;
@@ -951,7 +951,7 @@ static void ps_mat(const char *outf, int nmat, t_matrix mat[], t_matrix mat2[],
             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];
@@ -962,7 +962,7 @@ static void ps_mat(const char *outf, int nmat, t_matrix mat[], t_matrix mat2[],
             }
             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)))
index a3d5a87268302c86c1fa6243937c8a8518bb30f2..0259e3c58e00fb0b3c6d9a3438d438b76df187f2 100644 (file)
@@ -177,9 +177,9 @@ gmx_nb_free_energy_kernel(const t_nblist * gmx_restrict    nlist,
     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;
@@ -333,8 +333,8 @@ gmx_nb_free_energy_kernel(const t_nblist * gmx_restrict    nlist,
 
     /* 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;
index 77f7cd2839222dfd7a2a077b0fd43370da628e8a..2052274fe56089575301dd2d77f0f19b889b6874 100644 (file)
@@ -331,7 +331,7 @@ static int nitrogen_is_planar(t_vsiteconf vsiteconflist[], int nvsiteconf, char
     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)
     {
@@ -352,8 +352,8 @@ static char *get_dummymass_name(t_vsiteconf vsiteconflist[], int nvsiteconf, cha
     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)
     {
@@ -520,7 +520,7 @@ static int get_atype(int atom, t_atoms *at, int nrtp, t_restp rtp[],
     int      j;
     t_restp *rtpp;
 
-    if (at->atom[atom].m)
+    if (at->atom[atom].m != 0.0f)
     {
         type = at->atom[atom].type;
     }
@@ -558,7 +558,7 @@ static real get_amass(int atom, t_atoms *at, int nrtp, t_restp rtp[],
     int      j;
     t_restp *rtpp;
 
-    if (at->atom[atom].m)
+    if (at->atom[atom].m != 0.0f)
     {
         mass = at->atom[atom].m;
     }
index 3ce10af03452aa33e6ba2c5cf8289a6ca58633fc..5012aaaafb854bb446821be0912637c281c4f350 100644 (file)
@@ -86,7 +86,7 @@ typedef struct gmx_cpp {
 
 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)
@@ -582,7 +582,7 @@ int cpp_read_line(gmx_cpp_t *handlep, int n, char buf[])
         return eCPP_FILE_NOT_OPEN;
     }
 
-    bEOF = feof(handle->fp);
+    bEOF = (feof(handle->fp) != 0);
     if (!bEOF)
     {
         /* Read the actual line now. */
@@ -591,7 +591,7 @@ int cpp_read_line(gmx_cpp_t *handlep, int n, char buf[])
             /* 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,
index 9293a66eb0495b6d2e11b78fe716dbfd0f4add4a..7a300f1775292492726e6a193ed15a762e7b78c8 100644 (file)
@@ -212,7 +212,7 @@ rbonded_find_atoms_in_list(t_rbonded *b, t_rbonded blist[], int nlist, int natom
         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)
@@ -220,7 +220,7 @@ rbonded_find_atoms_in_list(t_rbonded *b, t_rbonded blist[], int nlist, int natom
             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)
index f0dc2ceeb3ae466fa9edde41cea7db2b9d945b64..d9175be77478dec70adff6130de442551df7310a 100644 (file)
@@ -95,7 +95,7 @@ static int missing_atoms(t_restp *rp, int resind, t_atoms *at, int i0, int i)
         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)
         {
@@ -937,10 +937,10 @@ static void check_restp_types(t_restp *r0, t_restp *r1)
 {
     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++)
     {
index 3387f60fda17d60f852a976c85889d984b096765..131b45c5032a0632e9c6e3c6be33851bcc0898af 100644 (file)
@@ -1680,14 +1680,14 @@ static void read_expandedparams(std::vector<t_inpfile> *inp,
     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
@@ -1947,7 +1947,7 @@ void get_ir(const char *mdparin, const char *mdparout,
     /* 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");
@@ -1955,7 +1955,7 @@ void get_ir(const char *mdparin, const char *mdparout,
     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)");
@@ -1974,7 +1974,7 @@ void get_ir(const char *mdparin, const char *mdparout,
 
     /* 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");
@@ -2011,7 +2011,7 @@ void get_ir(const char *mdparin, const char *mdparout,
 
     /* 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);
 
@@ -2021,9 +2021,9 @@ void get_ir(const char *mdparin, const char *mdparout,
     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");
@@ -2036,7 +2036,7 @@ void get_ir(const char *mdparin, const char *mdparout,
     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");
@@ -2055,7 +2055,7 @@ void get_ir(const char *mdparin, const char *mdparout,
 
     /* 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);
@@ -2065,7 +2065,7 @@ void get_ir(const char *mdparin, const char *mdparout,
     /* 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)
@@ -2081,7 +2081,7 @@ void get_ir(const char *mdparin, const char *mdparout,
     /* 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);
@@ -2105,13 +2105,13 @@ void get_ir(const char *mdparin, const char *mdparout,
     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);
@@ -2125,7 +2125,7 @@ void get_ir(const char *mdparin, const char *mdparout,
     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
@@ -2147,7 +2147,7 @@ void get_ir(const char *mdparin, const char *mdparout,
     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);
@@ -2166,7 +2166,7 @@ void get_ir(const char *mdparin, const char *mdparout,
 
     /* 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);
@@ -2227,8 +2227,8 @@ void get_ir(const char *mdparin, const char *mdparout,
         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);
@@ -2279,7 +2279,7 @@ void get_ir(const char *mdparin, const char *mdparout,
 
     /* 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");
@@ -3531,7 +3531,7 @@ void do_index(const char* mdparin, const char *ndx,
     {
         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)
index 32120e5ccf4330a9408ca3912e4e8fbb153ab1b7..adcbe93d170d8fb4d12a2f42e175c537202a6bf3 100644 (file)
@@ -281,9 +281,9 @@ char **read_pullparams(std::vector<t_inpfile> *inp,
     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");
@@ -380,7 +380,7 @@ char **read_pullparams(std::vector<t_inpfile> *inp,
         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);
index 05263a9d2049e2430caaa79e648a446e023d9e9e..00af8b42774724d1ce01b3435a8733d82cd07a0e 100644 (file)
@@ -85,7 +85,7 @@ gpp_atomtype_t read_atype(const char *ffdir, t_symtab *tab)
                     trim(buf);
                 }
             }
-            while (!feof(in) && strlen(buf) == 0);
+            while ((feof(in) == 0) && strlen(buf) == 0);
 
             if (sscanf(buf, "%s%lf", name, &m) == 2)
             {
@@ -471,7 +471,7 @@ void read_resall(char *rrdb, int *nrtpptr, t_restp **rtp,
                           rrtp[nrtp].resname, line);
             }
         }
-        while (!feof(in) && !bNextResidue);
+        while ((feof(in) == 0) && !bNextResidue);
 
         if (rrtp[nrtp].natom == 0)
         {
index 90d9c5d8a0963b1fda93e930058a27da2bc4b77d..14b15bee590e693ac96e31cd89bc3cd4ad2f6749 100644 (file)
@@ -442,7 +442,7 @@ int DS_Search(DirStack *DS, directive d)
         D = D->prev;
     }
 
-    return (D != nullptr);
+    return static_cast<int>(D != nullptr);
 }
 
 int DS_Check_Order(DirStack *DS, directive d)
index ae5062496dd6772fdce24da4c5185496a564e31d..b441ed1a9acd2007794be48aac508afa5e5c0c85 100644 (file)
@@ -1003,7 +1003,7 @@ static void clean_vsite_bonds(t_params *plist, t_pindex pindex[],
                             (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)
                 {
index ee9955457a9508cca9dca7c925e594762c362b60..644b16d562de223955340ee42aa8451288f9df95 100644 (file)
@@ -123,9 +123,9 @@ void
 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());
 }
 
 
@@ -344,7 +344,7 @@ detectX86Features(std::string *                  brand,
 
     // 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;
@@ -534,7 +534,7 @@ detectAmdApicIdLayout(unsigned int maxExtLevel)
     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;
@@ -599,8 +599,8 @@ detectX86LogicalProcessors()
     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
     {
@@ -753,7 +753,7 @@ detectProcCpuInfoVendor(const std::map<std::string, std::string> &cpuInfo)
     // 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);
@@ -791,11 +791,11 @@ detectProcCpuInfoIbm(const std::map<std::string, std::string> &cpuInfo,
                      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");
     }
@@ -808,7 +808,7 @@ detectProcCpuInfoIbm(const std::map<std::string, std::string> &cpuInfo,
 
     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);
@@ -847,16 +847,16 @@ detectProcCpuInfoArm(const std::map<std::string, std::string>   &cpuInfo,
                      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
@@ -865,16 +865,16 @@ detectProcCpuInfoArm(const std::map<std::string, std::string>   &cpuInfo,
             *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)
index 045d6ce6fdb447b4a344ef9b7f01c39f6e837dd5..8eabb5784fe2fdc50ad3540c8c15ab939c0f756c 100644 (file)
@@ -260,7 +260,7 @@ int
 identifyAvx512FmaUnits()
 {
     static bool initialized = false;
-    static int  result      = false;
+    static int  result      = 0;
 
     if (!initialized)
     {
index 3656dd839165f18edd9ce433e5826a18d25fe937..771537f737efc46f6edeac7d4f9af45e92bde972 100644 (file)
@@ -335,7 +335,7 @@ static int imd_handshake(IMDSocket *socket)
     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);
 }
 
 
@@ -349,7 +349,7 @@ static int imd_send_energies(IMDSocket *socket, const IMDEnergyBlock *energies,
     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);
 }
 
 
@@ -459,7 +459,7 @@ static int imd_send_rvecs(IMDSocket *socket, int nat, rvec *x, char *buffer)
         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);
 }
 
 
index 50aaa3ddbbbbe3d52822950190840982b9e250b4..598abb12d6a7076ef9bc17c77205a2baacb0d5c9 100644 (file)
@@ -407,7 +407,7 @@ gmx_bool
 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);
 }
 
@@ -501,7 +501,7 @@ void calc_listed(const t_commrec             *cr,
     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)
     {
@@ -579,7 +579,7 @@ void calc_listed(const t_commrec             *cr,
                              enerd->term, &enerd->grpp, dvdl,
                              bt,
                              bCalcEnerVir,
-                             force_flags & GMX_FORCE_DHDL);
+                             (force_flags & GMX_FORCE_DHDL) != 0);
 
         if (force_flags & GMX_FORCE_DHDL)
         {
index ee35355118ca8b6cbe2a7efe7cfb8dd1d75cbaac..c48d05afe724132b2cfa31c61ff9c766eebd161f 100644 (file)
@@ -431,7 +431,7 @@ do_pairs_general(int ftype, int nbonds,
             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;
index 89c8cf2fb5ec7956af3eeffef64a22268a514b7b..8d9313a8b3247d53cec06e14da64b0d3ffa2d826 100644 (file)
@@ -606,7 +606,7 @@ void berendsen_pcoupl(FILE *fplog, int64_t step,
         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]);
             }
index 90b9b6c6ed0b7f75d6da83f853389e82fc4bfe15..f404d1b9701b8934c11646c2ad48545cca8b1a52 100644 (file)
@@ -402,7 +402,7 @@ void do_force_lowlevel(t_forcerec           *fr,
                                            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,
index 9c85e0ba56a35d71af0154a5a55aacd9c26bdeb8..c60efe0d21fb90160f7579d274338f970ec4f431 100644 (file)
@@ -3098,7 +3098,7 @@ void init_forcerec(FILE                             *fp,
 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();
index 557e5cb014a289c4519e13645de23d26dda9f5a9..1c5cde66e051710ae4dc940e4a10cad6706b7dba 100644 (file)
@@ -167,14 +167,14 @@ void compute_globals(FILE *fplog, gmx_global_stat *gstat, t_commrec *cr, t_input
     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 */
index d0d2c82d674966fac0e2b2499b3952f1f2f113d6..9da866eb566bd2d2ea44332db72c1a02ec7b2879 100644 (file)
@@ -193,7 +193,7 @@ makeMDAtoms(FILE *fp, const gmx_mtop_t &mtop, const t_inputrec &ir,
         }
     }
 
-    md->bOrires = gmx_mtop_ftype_count(&mtop, F_ORIRES);
+    md->bOrires = (gmx_mtop_ftype_count(&mtop, F_ORIRES) != 0);
 
     return mdAtoms;
 }
index 02252b17e9d2b895efa78c6c67c809a486a9185c..70a2132969e03b1b64c18fa4897515c8418f4e2f 100644 (file)
@@ -237,7 +237,7 @@ static void get_input(const char *membed_input, real *xy_fac, real *xy_max, real
     {
         "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);
     {
index 5cffe634fdbc97b643df33d7be73736a5676f21c..08eab170922cae82a95e5e398e27708dfdf48fa3 100644 (file)
@@ -750,7 +750,7 @@ void nbnxn_atomdata_init(const gmx::MDLogger &mdlog,
     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*/
index 915bdb802bc618b415cb8d36331d5b625de05f3e..3e055bd7d6ab16a65f48cfbc4b0af76c0b90e78f 100644 (file)
@@ -1055,7 +1055,7 @@ static void sort_columns_supersub(nbnxn_search *nbs,
             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,
@@ -1070,7 +1070,7 @@ static void sort_columns_supersub(nbnxn_search *nbs,
                 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,
index 11353d4720749f586a17022bdd9bf47ee1afa6ae..eb170467be6959f0ec7d1b79b5573741e1a31722 100644 (file)
@@ -120,7 +120,7 @@ nbnxn_kernel_gpu_ref(const nbnxn_pairlist_t     *nbl,
         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)
index 323aa139f55b564c65eb33963e2a024070a4b797..c2c5fcaa2c63c9ef0d5825eaeb56692eab9a20e9 100644 (file)
@@ -249,9 +249,9 @@ NBK_FUNC_NAME(_VgrpF) // NOLINT(misc-definitions-in-headers)
          * 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
index 1d0aa52aa05600a00d35e426dd4ef65714bbaddb..f08be441056a01f5c82694f1e87d858663cc05a3 100644 (file)
          * 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];
index 9447cf848ee9aad55dbf614431f7c74d10ede788..a96797a060e586ff81cc27101bc89a3c6f2a3b85 100644 (file)
          * 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];
index 08539dcbeb24fe52543af30e9b876cb7f0206567..bc2ee37f55abc9acbc51118b42de65c57a1f013a 100644 (file)
@@ -1748,7 +1748,7 @@ static void make_fep_list(const nbnxn_search     *nbs,
             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;
 
@@ -1949,7 +1949,7 @@ static void make_fep_list_supersub(const nbnxn_search     *nbs,
                 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;
index 0712e27f63d0c55279b624ddea6e4f903feb4e03..4c8df50a1cac39fdd72de199ac26f41f599ee79c 100644 (file)
@@ -237,7 +237,7 @@ static void set_grid_sizes(matrix box, rvec izones_x0, rvec izones_x1, real rlis
         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;
@@ -247,7 +247,7 @@ static void set_grid_sizes(matrix box, rvec izones_x0, rvec izones_x1, real rlis
             /* 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;
@@ -726,7 +726,7 @@ void fill_grid(gmx_domdec_zones_t *dd_zones,
             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
index 48db5570e06d6c1124cac9aa2615a62662105c82..fec5890fe5f110bdf753488e70e072c8e4d27a99 100644 (file)
@@ -395,7 +395,7 @@ static void post_process_forces(const t_commrec           *cr,
              */
             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);
@@ -842,7 +842,7 @@ computeSpecialForces(FILE                          *fplog,
                      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.
@@ -917,7 +917,7 @@ static inline void launchPmeGpuSpread(gmx_pme_t      *pmedata,
     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);
 }
 
@@ -1088,7 +1088,7 @@ static void do_force_cutsVERLET(FILE *fplog,
     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);
 
@@ -1163,7 +1163,7 @@ static void do_force_cutsVERLET(FILE *fplog,
         }
     }
 
-    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
@@ -1176,7 +1176,7 @@ static void do_force_cutsVERLET(FILE *fplog,
          */
         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 */
@@ -1450,7 +1450,7 @@ static void do_force_cutsVERLET(FILE *fplog,
     }
 
     /* 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))
     {
@@ -1805,7 +1805,7 @@ static void do_force_cutsGROUP(FILE *fplog,
     /* 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)
     {
@@ -1865,7 +1865,7 @@ static void do_force_cutsGROUP(FILE *fplog,
          */
         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 */
@@ -1975,7 +1975,7 @@ static void do_force_cutsGROUP(FILE *fplog,
     }
 
     /* 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))
     {
index 5179ffd0d9edc625b2bca9e196f97f84f880dfcb..4a118743c5397544e47bb2e503247ef5c53553ad 100644 (file)
@@ -157,15 +157,15 @@ void global_stat(gmx_global_stat_t gs,
     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;
index 9a7670ae77f9c1f10142b7be6996be0fb226a11b..3702b59561330a150192813795b5c9911f2e9237 100644 (file)
@@ -818,8 +818,8 @@ void gmx::Integrator::do_md()
     {
         // 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
@@ -941,7 +941,7 @@ void gmx::Integrator::do_md()
 
         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");
@@ -1050,7 +1050,7 @@ void gmx::Integrator::do_md()
          * 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)
index 91a5dd4197a08235bab14e58a9afe73c79146a5b..f80e2934bec80f5ba61c9f30b774ddbdfa409379 100644 (file)
@@ -701,7 +701,7 @@ static bool do_em_step(const t_commrec *cr,
              * 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);
         }
@@ -1765,7 +1765,7 @@ Integrator::do_lbfgs()
         }
         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))
@@ -2599,7 +2599,7 @@ Integrator::do_steep()
     {
         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);
 
index 4cf190406a8cd5bbbacd6dc53a01843d4b542e69..5f19274056ce3948553650aaa72abd65bf614a30 100644 (file)
@@ -1229,7 +1229,7 @@ int Mdrunner::mdrunner()
                 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,
index 575c362654c02298857554d2084004910d88b92f..1bdbdfa98e852dadf9583aca4ea68739649b73be 100644 (file)
@@ -289,7 +289,7 @@ Integrator::do_tpi()
         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));
 
index 768cc78237cabe0b29e6487a4da031f1d34229f4..d9617c0012069665db8d990629d27d4f4d406787 100644 (file)
@@ -144,7 +144,7 @@ inline int getThisRankDuties(const t_commrec *cr)
 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
index 9b6434d9c6e50967d8f21a1b6e36806c4015c290..ffb31c601110a82dfcf9fb02bdc9461dc3d9ca84 100644 (file)
@@ -1151,7 +1151,7 @@ static void cmp_awhBiasParams(FILE *fp, const gmx::AwhBiasParams *bias1, const g
     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);
 
@@ -1296,10 +1296,10 @@ void cmp_inputrec(FILE *fp, const t_inputrec *ir1, const t_inputrec *ir2, real f
     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);
@@ -1330,12 +1330,12 @@ void cmp_inputrec(FILE *fp, const t_inputrec *ir1, const t_inputrec *ir2, real f
     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);
@@ -1363,7 +1363,7 @@ void cmp_inputrec(FILE *fp, const t_inputrec *ir1, const t_inputrec *ir2, real f
     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);
index 9f0de9e7e8785a938c932425d01d94c6689ee63a..f6547f81ade248087bbfb66c688e7f31542669e6 100644 (file)
@@ -298,7 +298,7 @@ gmx_bool correct_box(FILE *fplog, int step, tensor box, t_graph *graph)
     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)
     {
index 4e3acbb65b6978c22aa2932715f5061d612cd40e..8b759cacaa9a3bcf95c2a8f19113172f00991518 100644 (file)
@@ -2016,7 +2016,7 @@ static void init_pull_group_index(FILE *fplog, const t_commrec *cr,
         else if (ir->eI == eiBD)
         {
             real mbd;
-            if (ir->bd_fric)
+            if (ir->bd_fric != 0.0f)
             {
                 mbd = ir->bd_fric*ir->delta_t;
             }
index 87d3252881072d6029366f2845d82e9af574ecc2..4bfc66c2dbe60024fb03927432ab0b7e6c712616 100644 (file)
@@ -2114,7 +2114,7 @@ analyze_static(gmx_sel_evaluate_t                *data,
         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);
@@ -2845,7 +2845,7 @@ SelectionCompiler::compile(SelectionCollection *coll)
     {
         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;
index cedaf05459a1cf59ef1b5037b79877d6042884e4..ac877206d3b89ef542061012d31143505dff12a1 100644 (file)
@@ -737,7 +737,7 @@ static void
 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)
     {
@@ -1332,7 +1332,7 @@ gmx_ana_poscalc_update(gmx_ana_poscalc_t *pc, gmx_ana_pos_t *p,
         }
         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:
index c8102a22c605991de5c9ff3c058ac59b3f0f6890..b33ba94c268596e5f452e483c3fe93bbaada69ab 100644 (file)
@@ -114,7 +114,7 @@ SelectionData::SelectionData(SelectionTreeElement *elem,
             {
                 child = child->child->child;
             }
-            bDynamic_ = (child->child->flags & SEL_DYNAMIC);
+            bDynamic_ = ((child->child->flags & SEL_DYNAMIC) != 0);
         }
     }
     initCoveredFraction(CFRAC_NONE);
index de4e8416aa106118afd5f7d4bd63b0248a3fea70..6b96478b87f895327060d9279e62857bd33d914f 100644 (file)
@@ -359,7 +359,7 @@ SelectionList runParser(yyscan_t scanner, TextInputStream *inputStream,
                         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;
index 31144608fb042bd95ed8ebb0a886e1526385e416..5c998412ee7c6778eda248d48a5fe989ff847c0b 100644 (file)
@@ -335,8 +335,8 @@ SelectionTreeElement::requiredTopologyProperties() const
         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)
         {
@@ -372,7 +372,7 @@ void SelectionTreeElement::checkUnsortedAtoms(
             || 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
index 17bc002e47f546ecfef732459d730d463a4a2fed..6ac6d36ad1e7fefe64a0215d4427c464f258c3f7 100644 (file)
@@ -285,7 +285,7 @@ check_params(FILE *fp, const char *name, int nparams, gmx_ana_selparam_t param[]
             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;
index e78d79b5421e36a0d7aa2c74439a1cd1f0b5bb04..569957c7005012089ed7f087de10cf5af38a2505 100644 (file)
@@ -249,7 +249,7 @@ _gmx_selelem_is_default_kwpos(const gmx::SelectionTreeElement &sel)
 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:
index 5dd372c3baa44ac77294669109f028f4a382b70b..c9a5c6522005a0ac260ccff4862081b8742d9828 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * 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.
@@ -183,7 +183,7 @@ fnms(float a, float b, float c)
 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.
@@ -200,7 +200,7 @@ maskAdd(float a, float b, float m)
 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.
@@ -218,7 +218,7 @@ maskzMul(float a, float b, float m)
 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().
@@ -600,7 +600,7 @@ fnms(double a, double b, double c)
 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.
@@ -617,7 +617,7 @@ maskAdd(double a, double b, double m)
 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.
@@ -635,7 +635,7 @@ maskzMul(double a, double b, double m)
 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().
index 9bf546a5d4ad1731ea2c374bd338bbdae73695df..709759543018f649822bd369d4b696da29d0fbc1 100644 (file)
@@ -140,7 +140,7 @@ int gmx_stats_get_point(gmx_stats_t gstats, real *x, real *y,
     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)
@@ -214,7 +214,7 @@ static int gmx_stats_compute(gmx_stats *stats, int weight)
         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]);
             }
index d62720a7a18ec6fd694d4cebc117124463fa7114..1b0ecc2dfd2125b3c4f9233ac10f2d5148d9b445 100644 (file)
@@ -1323,7 +1323,7 @@ t_forcetable *make_tables(FILE *out,
     t_forcetable   *table;
 
     snew(table, 1);
-    b14only = (flags & GMX_MAKETABLES_14ONLY);
+    b14only = ((flags & GMX_MAKETABLES_14ONLY) != 0);
 
     if (flags & GMX_MAKETABLES_FORCEUSER)
     {
index 546807b7c0c218f9c62800af9439fb931898b169..421b5da38a6b60f84bb4b2b1672008b5d4e761fa 100644 (file)
@@ -192,7 +192,7 @@ static void list_top(const char *fn)
     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)
@@ -205,7 +205,7 @@ static void list_top(const char *fn)
             }
         }
     }
-    while (!done);
+    while (done == 0);
     status = cpp_close_file(&handle);
     if (status != eCPP_OK)
     {
@@ -307,7 +307,7 @@ static void list_xtc(const char *fn)
         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);
index 1c0c9c422fd4a406cfc816ca0b541ed43a59fd35..7cfe77a12780055530bc7467dc81e0ae101b8594 100644 (file)
@@ -267,7 +267,7 @@ void pr_blocka(FILE *fp, int indent, const char *title, const t_blocka *block, g
         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);
         }
index 349d3cbf0ccb388b0df26bf731d31795f4a93c72..992af1b1e3877d9c6d71adf3f1337a86d358b485 100644 (file)
@@ -132,7 +132,7 @@ gmx_residuetype_add(gmx_residuetype_t *rt, const char *newresname, const char *n
     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))
     {
@@ -174,7 +174,7 @@ gmx_residuetype_get_alltypes(gmx_residuetype_t   *rt,
             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)
             {
index 3f6b2f8f7e10d2013572a3ddc18ebce1f5d1b5ad..165c01097618115d3491b30bf0e3cb65b2994107 100644 (file)
@@ -101,7 +101,7 @@ TrajectoryAnalysisSettings::flags() const
 bool
 TrajectoryAnalysisSettings::hasFlag(unsigned long flag) const
 {
-    return impl_->flags & flag;
+    return (impl_->flags & flag) != 0u;
 }
 
 
index 03d400755f34b3cf387c8676b8c3c51de98884b9..12e718e0baf5475a322b148a660a52c303ab0cdf 100644 (file)
@@ -57,7 +57,7 @@ bool gmx_mpi_initialized()
     int n;
     MPI_Initialized(&n);
 
-    return n;
+    return n != 0;
 #endif
 }
 
index 4be28dfe65174fe4525bd6e27fa00932b8574022..8182d7269200c2c526c38ea474c8d070a189822c 100644 (file)
@@ -101,7 +101,7 @@ inline static bool bitmask_is_set(gmx_bitmask_t m, int b)
 /*! \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 */
@@ -113,7 +113,7 @@ inline static bool bitmask_is_equal(gmx_bitmask_t a, gmx_bitmask_t b)
 /*! \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 */
@@ -159,7 +159,7 @@ inline static bool bitmask_is_disjoint(gmx_bitmask_t a, gmx_bitmask_t b)
     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;
 }
@@ -181,7 +181,7 @@ inline static bool bitmask_is_zero(gmx_bitmask_t m)
     bool     r = true;
     for (i = 0; i < BITMASK_ALEN; i++)
     {
-        r = r && !m[i];
+        r = r && (m[i] == 0u);
     }
     return r;
 }
index 5a5b66d78e8445c0e697b70892e7762d08a084c1..e9deb399b0d71552b8ffe5e8a822bb71a2b606fe 100644 (file)
@@ -201,7 +201,7 @@ int gmx_strcasecmp_min(const char *str1, const char *str2)
             return (ch1-ch2);
         }
     }
-    while (ch1);
+    while (ch1 != 0);
     return 0;
 }
 
@@ -230,7 +230,7 @@ int gmx_strncasecmp_min(const char *str1, const char *str2, int n)
             return (ch1-ch2);
         }
     }
-    while (ch1 && (str1-stri1 < n) && (str2-stri2 < n));
+    while ((ch1 != 0) && (str1-stri1 < n) && (str2-stri2 < n));
     return 0;
 }
 
@@ -247,7 +247,7 @@ int gmx_strcasecmp(const char *str1, const char *str2)
             return (ch1-ch2);
         }
     }
-    while (ch1);
+    while (ch1 != 0);
     return 0;
 }
 
@@ -270,7 +270,7 @@ int gmx_strncasecmp(const char *str1, const char *str2, int n)
         }
         n--;
     }
-    while (ch1 && n);
+    while ((ch1 != 0) && (n != 0));
     return 0;
 }
 
@@ -497,7 +497,7 @@ char *wrap_lines(const char *buf, int line_width, int indent, gmx_bool bIndentFi
             }
         }
     }
-    while (buf[i]);
+    while (buf[i] != 0);
     b2[i2] = '\0';
 
     return b2;
index b24f687b27a50b7546a37973ca6806ef1e7d72c3..94b5543a4fb4afb7b7d6490e665636d46b181e25 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * 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.
@@ -85,7 +85,7 @@ bool readLineImpl(FILE *fp, std::string *line)
                              "fgets", errno);
     }
     *line = result;
-    return !result.empty() || !std::feof(fp);
+    return !result.empty() || (std::feof(fp) == 0);
 }
 
 }   // namespace
@@ -166,7 +166,7 @@ using internal::FileStreamImpl;
 bool StandardInputStream::isInteractive() const
 {
 #ifdef HAVE_UNISTD_H
-    return isatty(fileno(stdin));
+    return isatty(fileno(stdin)) != 0;
 #else
     return true;
 #endif
index 9338d3e7c99402da49c76145ecf7e3beb5a238b1..d9bde1c1f8532edf75d144046207adac314d9d28 100644 (file)
@@ -94,7 +94,7 @@ const char cPathSeparator = ':';
 //! 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
index 4f26420267b007a95e7e4df1c0554b8a3ce21019..ad0f963bf39cd9f966a309770583e68f5014914b 100644 (file)
@@ -239,7 +239,7 @@ namespace
  */
 bool isWordChar(char c)
 {
-    return std::isalnum(c) || c == '-' || c == '_';
+    return (std::isalnum(c) != 0) || c == '-' || c == '_';
 }
 
 /*! \brief