clang-tidy: add modernize nullptr & emplace
authorRoland Schulz <roland.schulz@intel.com>
Mon, 14 May 2018 09:14:51 +0000 (02:14 -0700)
committerMark Abraham <mark.j.abraham@gmail.com>
Fri, 29 Jun 2018 14:35:12 +0000 (16:35 +0200)
Move selection/scanner.cpp and parser.cpp into
libgromacs_generated to exclude it from clang-tidy.

All files had been automatically fixed previously.
Changes are new occurrences of old pattern.

Change-Id: I46df2622b555af83e03cc79077d3510168ffc6d4

33 files changed:
src/gromacs/CMakeLists.txt
src/gromacs/analysisdata/datastorage.cpp
src/gromacs/awh/awh.cpp
src/gromacs/awh/biaswriter.cpp
src/gromacs/awh/correlationtensor.cpp
src/gromacs/awh/grid.cpp
src/gromacs/awh/read-params.cpp
src/gromacs/domdec/domdec.cpp
src/gromacs/essentialdynamics/edsam.cpp
src/gromacs/ewald/pme.cpp
src/gromacs/fileio/checkpoint.cpp
src/gromacs/fileio/gmxfio.cpp
src/gromacs/fileio/oenv.cpp
src/gromacs/fileio/readinp.cpp
src/gromacs/gmxana/gmx_angle.cpp
src/gromacs/gmxana/gmx_nmr.cpp
src/gromacs/gmxlib/nonbonded/nb_kernel_c/nb_kernel_allvsall.cpp
src/gromacs/gmxpreprocess/grompp.cpp
src/gromacs/gmxpreprocess/readir.cpp
src/gromacs/gmxpreprocess/toputil.cpp
src/gromacs/gmxpreprocess/vsite_parm.cpp
src/gromacs/gmxpreprocess/x2top.cpp
src/gromacs/listed-forces/disre.cpp
src/gromacs/mdlib/calc_verletbuf.cpp
src/gromacs/mdlib/constr.cpp
src/gromacs/mdlib/forcerec.cpp
src/gromacs/mdlib/mdsetup.cpp
src/gromacs/mdlib/nbnxn_tuning.cpp
src/gromacs/pulling/pull.cpp
src/gromacs/pulling/pullutil.cpp
src/gromacs/selection/compiler.cpp
src/gromacs/selection/selection.cpp
src/gromacs/topology/index.cpp

index 35ee6657cf192a25b37efe279da5d2b88651face..188309aa70fa9f747a07379ea3f3057ac9d6ec9c 100644 (file)
@@ -287,7 +287,8 @@ if (GMX_CLANG_TIDY)
        -misc-misplaced-const,\
        -misc-incorrect-roundings,-misc-macro-parentheses,-readability-function-size,-readability-else-after-return,\
        -readability-inconsistent-declaration-parameter-name,-misc-throw-by-value-catch-by-reference,\
-       -readability-non-const-parameter,-readability-implicit-bool-conversion;-warnings-as-errors=*;-fix")
+       -readability-non-const-parameter,-readability-implicit-bool-conversion,\
+       modernize-use-nullptr,modernize-use-emplace;-warnings-as-errors=*;-fix")
 endif()
 
 gmx_write_installed_header_list()
index 3c17937d9b228717ba64689433509eaa1633c462..d70f095258d64576e5e8ff0a678a0e80acd79876 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -406,7 +406,7 @@ AnalysisDataStorageImpl::AnalysisDataStorageImpl()
 bool
 AnalysisDataStorageImpl::isMultipoint() const
 {
-    GMX_ASSERT(data_ != NULL, "isMultipoint() called too early");
+    GMX_ASSERT(data_ != nullptr, "isMultipoint() called too early");
     return data_->isMultipoint();
 }
 
index e03bea12084354c01e9f46733073ef07d38800d4..a2425ddb8d028139a535feba240450264d4ee158 100644 (file)
@@ -164,7 +164,7 @@ Awh::Awh(FILE                 *fplog,
             GMX_RELEASE_ASSERT(awhDimParams.eCoordProvider == eawhcoordproviderPULL, "Currently only the pull code is supported as coordinate provider");
             const t_pull_coord &pullCoord         = inputRecord.pull->coord[awhDimParams.coordIndex];
             double              conversionFactor  = pull_coordinate_is_angletype(&pullCoord) ? DEG2RAD : 1;
-            dimParams.push_back(DimParams(conversionFactor, awhDimParams.forceConstant, beta));
+            dimParams.emplace_back(conversionFactor, awhDimParams.forceConstant, beta);
 
             pullCoordIndex.push_back(awhDimParams.coordIndex);
         }
index 3ff903819dab76d2f9dfa42b43e0b6eb103d3080..56858192b655e294d14780dbdf3bf94c0f53c657 100644 (file)
@@ -184,9 +184,9 @@ BiasWriter::BiasWriter(const Bias &bias)
         }
         for (int b = 0; b < outputTypeNumBlock[outputType]; b++)
         {
-            block_.push_back(AwhEnergyBlock(numPoints,
-                                            pair.second,
-                                            getNormalizationValue(outputType, bias, b)));
+            block_.emplace_back(numPoints,
+                                pair.second,
+                                getNormalizationValue(outputType, bias, b));
         }
     }
 }
index e06abf4c870c1cc669ad15abaf50fcf109ca6f58..f847e57a15454e12ab327382b084ccca51778baf 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2017,2018, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -283,7 +283,7 @@ CorrelationTensor::CorrelationTensor(int    numDim,
 
     for (int n = 0; n < numBlockData; n++)
     {
-        blockDataList_.push_back(CorrelationBlockData(numDim, scaling*blockLengthInit));
+        blockDataList_.emplace_back(numDim, scaling*blockLengthInit);
         scaling <<= 1; /* Double block length */
     }
 }
index 44eef27c966cac32d51d2699b8e71ab17ef2b15f..6af38a2cc7c25759fe936203fb352ce89d958b07 100644 (file)
@@ -738,7 +738,7 @@ Grid::Grid(const std::vector<DimParams> &dimParams,
         period[d]     = dimParams[d].scaleUserInputToInternal(awhDimParams[d].period);
         static_assert(c_numPointsPerSigma >= 1.0, "The number of points per sigma should be at least 1.0 to get a uniformly covering the reaction using Gaussians");
         double pointDensity = std::sqrt(dimParams[d].betak)*c_numPointsPerSigma;
-        axis_.push_back(GridAxis(origin, end, period[d], pointDensity));
+        axis_.emplace_back(origin, end, period[d], pointDensity);
         numPoints *= axis_[d].numPoints();
     }
 
@@ -809,8 +809,8 @@ void mapGridToDataGrid(std::vector<int>    *gridpointToDatapoint,
     /* The data grid has the data that was read and the properties of the AWH grid */
     for (int d = 0; d < grid.numDimensions(); d++)
     {
-        axis_.push_back(GridAxis(data[d][0], data[d][numDataPoints - 1],
-                                 grid.axis(d).period(), numPoints[d]));
+        axis_.emplace_back(data[d][0], data[d][numDataPoints - 1],
+                           grid.axis(d).period(), numPoints[d]);
     }
 
     /* Map each grid point to a data point. No interpolation, just pick the nearest one.
index b9b33f933540d21b7f0737ff2e96f31e5fb5a377..3b07f6cb179dad109bcb05002b1286c3ca937b87 100644 (file)
@@ -743,7 +743,7 @@ void setStateDependentAwhParams(AwhParams *awhParams,
      * when read_awhParams is called (in get ir).
      * It is known first after do_index has been called in grompp.cpp.
      */
-    if (inputrecGroupOptions->ref_t == NULL ||
+    if (inputrecGroupOptions->ref_t == nullptr ||
         inputrecGroupOptions->ref_t[0] <= 0)
     {
         gmx_fatal(FARGS, "AWH biasing is only supported for temperatures > 0");
index a5b29edc469b458a61e69464a81e87701fa6f81b..db206d8e85586b4d1f39047c73caf727133ec436 100644 (file)
@@ -537,7 +537,7 @@ void dd_move_f(gmx_domdec_t             *dd,
             {
                 /* fshift should always be defined if this function is
                  * called when bShiftForcesNeedPbc is true */
-                assert(NULL != fshift);
+                assert(nullptr != fshift);
                 for (int g : ind.index)
                 {
                     for (int j : atomGrouping.block(g))
index 280ee16ba4d9301215e7034a95d1edb9b6c474e8..05e6560540ac3ccc01fb0bb661cc516d4125b8b6 100644 (file)
@@ -2647,7 +2647,7 @@ gmx_edsam_t init_edsam(
         }
         /* Reset pointer to first ED data set which contains the actual ED data */
         edi = ed->edpar;
-        GMX_ASSERT(NULL != edi,
+        GMX_ASSERT(nullptr != edi,
                    "The pointer to the essential dynamics parameters is undefined");
 
         nED = EDstate->nED;
index 5fb9c666fbbfa4c087da9488af7a5fd909bc2eda..1f5691f7fb2894207a5e27066bbaea4855260349 100644 (file)
@@ -146,11 +146,11 @@ bool pme_gpu_supports_build(std::string *error)
     std::list<std::string> errorReasons;
     if (GMX_DOUBLE)
     {
-        errorReasons.push_back("double precision");
+        errorReasons.emplace_back("double precision");
     }
     if (GMX_GPU != GMX_GPU_CUDA)
     {
-        errorReasons.push_back("non-CUDA build of GROMACS");
+        errorReasons.emplace_back("non-CUDA build of GROMACS");
     }
     return addMessageIfNotSupported(errorReasons, error);
 }
@@ -160,27 +160,27 @@ bool pme_gpu_supports_input(const t_inputrec *ir, std::string *error)
     std::list<std::string> errorReasons;
     if (!EEL_PME(ir->coulombtype))
     {
-        errorReasons.push_back("systems that do not use PME for electrostatics");
+        errorReasons.emplace_back("systems that do not use PME for electrostatics");
     }
     if (ir->pme_order != 4)
     {
-        errorReasons.push_back("interpolation orders other than 4");
+        errorReasons.emplace_back("interpolation orders other than 4");
     }
     if (ir->efep != efepNO)
     {
-        errorReasons.push_back("free energy calculations (multiple grids)");
+        errorReasons.emplace_back("free energy calculations (multiple grids)");
     }
     if (EVDW_PME(ir->vdwtype))
     {
-        errorReasons.push_back("Lennard-Jones PME");
+        errorReasons.emplace_back("Lennard-Jones PME");
     }
     if (ir->cutoff_scheme == ecutsGROUP)
     {
-        errorReasons.push_back("group cutoff scheme");
+        errorReasons.emplace_back("group cutoff scheme");
     }
     if (EI_TPI(ir->eI))
     {
-        errorReasons.push_back("test particle insertion");
+        errorReasons.emplace_back("test particle insertion");
     }
     return addMessageIfNotSupported(errorReasons, error);
 }
@@ -199,27 +199,27 @@ static bool pme_gpu_check_restrictions(const gmx_pme_t *pme, std::string *error)
     std::list<std::string> errorReasons;
     if (pme->nnodes != 1)
     {
-        errorReasons.push_back("PME decomposition");
+        errorReasons.emplace_back("PME decomposition");
     }
     if (pme->pme_order != 4)
     {
-        errorReasons.push_back("interpolation orders other than 4");
+        errorReasons.emplace_back("interpolation orders other than 4");
     }
     if (pme->bFEP)
     {
-        errorReasons.push_back("free energy calculations (multiple grids)");
+        errorReasons.emplace_back("free energy calculations (multiple grids)");
     }
     if (pme->doLJ)
     {
-        errorReasons.push_back("Lennard-Jones PME");
+        errorReasons.emplace_back("Lennard-Jones PME");
     }
     if (GMX_DOUBLE)
     {
-        errorReasons.push_back("double precision");
+        errorReasons.emplace_back("double precision");
     }
     if (GMX_GPU != GMX_GPU_CUDA)
     {
-        errorReasons.push_back("non-CUDA build of GROMACS");
+        errorReasons.emplace_back("non-CUDA build of GROMACS");
     }
 
     return addMessageIfNotSupported(errorReasons, error);
index eda2ab57b139b4010a2793351fd1947fc68f426a..80d3e4762eb61bb83671c90318df93ac52308ff7 100644 (file)
@@ -1938,7 +1938,7 @@ void write_checkpoint(const char *fn, gmx_bool bNumberAndKeep,
         (do_cpt_enerhist(gmx_fio_getxdr(fp), FALSE, flags_enh, enerhist, nullptr) < 0)  ||
         (do_cpt_df_hist(gmx_fio_getxdr(fp), flags_dfh, nlambda, &state->dfhist, nullptr) < 0)  ||
         (do_cpt_EDstate(gmx_fio_getxdr(fp), FALSE, nED, edsamhist, nullptr) < 0)      ||
-        (do_cpt_awh(gmx_fio_getxdr(fp), FALSE, flags_awhh, state->awhHistory.get(), NULL) < 0) ||
+        (do_cpt_awh(gmx_fio_getxdr(fp), FALSE, flags_awhh, state->awhHistory.get(), nullptr) < 0) ||
         (do_cpt_swapstate(gmx_fio_getxdr(fp), FALSE, eSwapCoords, swaphist, nullptr) < 0) ||
         (do_cpt_files(gmx_fio_getxdr(fp), FALSE, &outputfiles, nullptr,
                       headerContents.file_version) < 0))
@@ -2309,7 +2309,7 @@ static void read_checkpoint(const char *fn, FILE **pfplog,
         state->awhHistory = std::shared_ptr<gmx::AwhHistory>(new gmx::AwhHistory());
     }
     ret = do_cpt_awh(gmx_fio_getxdr(fp), TRUE,
-                     headerContents->flags_awhh, state->awhHistory.get(), NULL);
+                     headerContents->flags_awhh, state->awhHistory.get(), nullptr);
     if (ret)
     {
         cp_error();
@@ -2597,7 +2597,7 @@ static void read_checkpoint_data(t_fileio *fp, int *simulation_part,
     }
 
     ret = do_cpt_awh(gmx_fio_getxdr(fp), TRUE,
-                     headerContents.flags_awhh, state->awhHistory.get(), NULL);
+                     headerContents.flags_awhh, state->awhHistory.get(), nullptr);
     if (ret)
     {
         cp_error();
index 62f59a48701be0e2fc44cca57517d658c780ac4a..d92e5e8f8da5f1c78bf1e07f08c005974fb6d7d1 100644 (file)
@@ -587,7 +587,7 @@ std::vector<gmx_file_position_t> gmx_fio_get_output_file_positions()
            we call this routine... */
         if (!cur->bRead && cur->iFTP != efCPT)
         {
-            outputfiles.push_back(gmx_file_position_t {});
+            outputfiles.emplace_back();
 
             std::strncpy(outputfiles.back().filename, cur->fn, STRLEN - 1);
 
index 745ea6c9fd27d213287bbad7ca1eb7566d7ddf05..4a97f07abf575a5f2b44b6001884257b7229aeac 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -107,7 +107,7 @@ void output_env_init(gmx_output_env_t **oenvp,
         oenv->xvg_format  = xvg_format;
         oenv->verbosity   = verbosity;
         const char *env = getenv("GMX_TRAJECTORY_IO_VERBOSITY");
-        oenv->trajectory_io_verbosity = (env != nullptr ? strtol(env, NULL, 10) : 1);
+        oenv->trajectory_io_verbosity = (env != nullptr ? strtol(env, nullptr, 10) : 1);
 
     }
     GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR;
index b3d26d43124ba0f42bfb0e443cd9a13fd7a3e4b9..619a84d1f7738b88e8729e56b18b4e9f6c0c3e87 100644 (file)
@@ -130,8 +130,8 @@ read_inpfile(gmx::TextInputStream *stream, const char *fn,
         if (found_index == -1)
         {
             /* add a new item */
-            inp.push_back(t_inpfile(0, 1, false, false, false,
-                                    tokens[0], tokens[1]));
+            inp.emplace_back(0, 1, false, false, false,
+                             tokens[0], tokens[1]);
         }
         else
         {
@@ -316,8 +316,8 @@ static int get_einp(std::vector<t_inpfile> *inp, const char *name)
     if (i == -1)
     {
         notfound = true;
-        inpRef.push_back(t_inpfile(0, 0, false, true, false,
-                                   name, ""));
+        inpRef.emplace_back(0, 0, false, true, false,
+                            name, "");
         i = inpRef.size() - 1;
         if (inpRef.size()  == 1)
         {
@@ -520,7 +520,7 @@ printStringNewline(std::vector<t_inpfile> *inp, const char *line)
 {
     std::string tmp("\n; ");
     tmp.append(line);
-    get_estr(inp, tmp.c_str(), NULL);
+    get_estr(inp, tmp.c_str(), nullptr);
 }
 
 void
@@ -528,7 +528,7 @@ printStringNoNewline(std::vector<t_inpfile> *inp, const char *line)
 {
     std::string tmp("; ");
     tmp.append(line);
-    get_estr(inp, tmp.c_str(), NULL);
+    get_estr(inp, tmp.c_str(), nullptr);
 }
 void
 setStringEntry(std::vector<t_inpfile> *inp, const char *name, char *newName, const char *def)
index 295b9be41b9229d40bfcaccea537fea4f270d53e..c1f2370c1b2ff342f7ae6072552c4e5d32208d50 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -91,7 +91,7 @@ static void dump_dih_trr(int nframes, int nangles, real **dih, const char *fn,
                 // know that dih[j][i] is always valid. Since it occurs in the innermost
                 // loop over angles and will only trigger on coding errors, we
                 // only enable it for debug builds.
-                GMX_ASSERT(dih != NULL && dih[j] != NULL, "Incorrect dihedral array data");
+                GMX_ASSERT(dih != nullptr && dih[j] != nullptr, "Incorrect dihedral array data");
                 x[k][l] = (m == 0) ? std::cos(dih[j][i]) : std::sin(dih[j][i]);
                 l++;
                 if (l == DIM)
index f09415228ab6a30e2071f8e1eb4d1fc1193a4de6..28fe1de444bc3f6f21986234f02fda7467498953 100644 (file)
@@ -423,7 +423,7 @@ int gmx_nmr(int argc, char *argv[])
         "Instantaneous"
     };
 
-    FILE              /* *out     = NULL,*/ *out_disre = NULL, *fp_pairs = NULL, *fort = NULL, *fodt = NULL, *foten = NULL;
+    FILE              /* *out     = NULL,*/ *out_disre = nullptr, *fp_pairs = nullptr, *fort = nullptr, *fodt = nullptr, *foten = nullptr;
     ener_file_t        fp;
     int                timecheck = 0;
     gmx_mtop_t         mtop;
@@ -432,13 +432,13 @@ int gmx_nmr(int argc, char *argv[])
     t_enxframe         fr;
     int                nre, teller, teller_disre;
     int                nor     = 0, nex = 0, norfr = 0, enx_i = 0;
-    real              *bounds  = NULL, *violaver = NULL, *oobs = NULL, *orient = NULL, *odrms = NULL;
-    int               *index   = NULL, *pair = NULL, norsel = 0, *orsel = NULL, *or_label = NULL;
+    real              *bounds  = nullptr, *violaver = nullptr, *oobs = nullptr, *orient = nullptr, *odrms = nullptr;
+    int               *index   = nullptr, *pair = nullptr, norsel = 0, *orsel = nullptr, *or_label = nullptr;
     int                nbounds = 0, npairs;
     gmx_bool           bDisRe, bDRAll, bORA, bORT, bODA, bODR, bODT, bORIRE, bOTEN;
     gmx_bool           bCont;
     double             sumaver, sumt;
-    int               *set     = NULL, i, j, k, nset, sss;
+    int               *set     = nullptr, i, j, k, nset, sss;
     char             **pairleg, **odtleg, **otenleg;
     char             **leg = nullptr;
     const char        *anm_j, *anm_k, *resnm_j, *resnm_k;
index 6e96ce61f7a18aba29b758459fdef988f3190ad1..f20c65f6f669405eeaf7db2d1710c48cfa4eef95 100644 (file)
@@ -286,7 +286,7 @@ nb_kernel_allvsall(t_nblist gmx_unused *     nlist,
     Vc                  = kernel_data->energygrp_elec;
     Vvdw                = kernel_data->energygrp_vdw;
 
-    if (aadata == NULL)
+    if (aadata == nullptr)
     {
         setup_aadata(&aadata, excl, natoms, type, fr->ntype, fr->nbfp);
         fr->AllvsAll_work  = aadata;
index abebccec3c011a96d0621ffd69df144e6f60e244..619efe5466dcc0688ad331656592f1da8f10a7d7 100644 (file)
@@ -600,7 +600,7 @@ new_status(const char *topfile, const char *topppfile, const char *confin,
      * a priori if the number of atoms in confin matches what we expect.
      */
     state->flags |= (1 << estX);
-    if (v != NULL)
+    if (v != nullptr)
     {
         state->flags |= (1 << estV);
     }
index 2b699a101a45f8281f0f8f0135b43022b2f9fd7a..3d1daed5d5b2f498bd6d88ffd1475ce70c4321dc 100644 (file)
@@ -1780,41 +1780,41 @@ void get_ir(const char *mdparin, const char *mdparout,
     }
 
     /* ignore the following deprecated commands */
-    replace_inp_entry(inp, "title", NULL);
-    replace_inp_entry(inp, "cpp", NULL);
-    replace_inp_entry(inp, "domain-decomposition", NULL);
-    replace_inp_entry(inp, "andersen-seed", NULL);
-    replace_inp_entry(inp, "dihre", NULL);
-    replace_inp_entry(inp, "dihre-fc", NULL);
-    replace_inp_entry(inp, "dihre-tau", NULL);
-    replace_inp_entry(inp, "nstdihreout", NULL);
-    replace_inp_entry(inp, "nstcheckpoint", NULL);
-    replace_inp_entry(inp, "optimize-fft", NULL);
-    replace_inp_entry(inp, "adress_type", NULL);
-    replace_inp_entry(inp, "adress_const_wf", NULL);
-    replace_inp_entry(inp, "adress_ex_width", NULL);
-    replace_inp_entry(inp, "adress_hy_width", NULL);
-    replace_inp_entry(inp, "adress_ex_forcecap", NULL);
-    replace_inp_entry(inp, "adress_interface_correction", NULL);
-    replace_inp_entry(inp, "adress_site", NULL);
-    replace_inp_entry(inp, "adress_reference_coords", NULL);
-    replace_inp_entry(inp, "adress_tf_grp_names", NULL);
-    replace_inp_entry(inp, "adress_cg_grp_names", NULL);
-    replace_inp_entry(inp, "adress_do_hybridpairs", NULL);
-    replace_inp_entry(inp, "rlistlong", NULL);
-    replace_inp_entry(inp, "nstcalclr", NULL);
-    replace_inp_entry(inp, "pull-print-com2", NULL);
-    replace_inp_entry(inp, "gb-algorithm", NULL);
-    replace_inp_entry(inp, "nstgbradii", NULL);
-    replace_inp_entry(inp, "rgbradii", NULL);
-    replace_inp_entry(inp, "gb-epsilon-solvent", NULL);
-    replace_inp_entry(inp, "gb-saltconc", NULL);
-    replace_inp_entry(inp, "gb-obc-alpha", NULL);
-    replace_inp_entry(inp, "gb-obc-beta", NULL);
-    replace_inp_entry(inp, "gb-obc-gamma", NULL);
-    replace_inp_entry(inp, "gb-dielectric-offset", NULL);
-    replace_inp_entry(inp, "sa-algorithm", NULL);
-    replace_inp_entry(inp, "sa-surface-tension", NULL);
+    replace_inp_entry(inp, "title", nullptr);
+    replace_inp_entry(inp, "cpp", nullptr);
+    replace_inp_entry(inp, "domain-decomposition", nullptr);
+    replace_inp_entry(inp, "andersen-seed", nullptr);
+    replace_inp_entry(inp, "dihre", nullptr);
+    replace_inp_entry(inp, "dihre-fc", nullptr);
+    replace_inp_entry(inp, "dihre-tau", nullptr);
+    replace_inp_entry(inp, "nstdihreout", nullptr);
+    replace_inp_entry(inp, "nstcheckpoint", nullptr);
+    replace_inp_entry(inp, "optimize-fft", nullptr);
+    replace_inp_entry(inp, "adress_type", nullptr);
+    replace_inp_entry(inp, "adress_const_wf", nullptr);
+    replace_inp_entry(inp, "adress_ex_width", nullptr);
+    replace_inp_entry(inp, "adress_hy_width", nullptr);
+    replace_inp_entry(inp, "adress_ex_forcecap", nullptr);
+    replace_inp_entry(inp, "adress_interface_correction", nullptr);
+    replace_inp_entry(inp, "adress_site", nullptr);
+    replace_inp_entry(inp, "adress_reference_coords", nullptr);
+    replace_inp_entry(inp, "adress_tf_grp_names", nullptr);
+    replace_inp_entry(inp, "adress_cg_grp_names", nullptr);
+    replace_inp_entry(inp, "adress_do_hybridpairs", nullptr);
+    replace_inp_entry(inp, "rlistlong", nullptr);
+    replace_inp_entry(inp, "nstcalclr", nullptr);
+    replace_inp_entry(inp, "pull-print-com2", nullptr);
+    replace_inp_entry(inp, "gb-algorithm", nullptr);
+    replace_inp_entry(inp, "nstgbradii", nullptr);
+    replace_inp_entry(inp, "rgbradii", nullptr);
+    replace_inp_entry(inp, "gb-epsilon-solvent", nullptr);
+    replace_inp_entry(inp, "gb-saltconc", nullptr);
+    replace_inp_entry(inp, "gb-obc-alpha", nullptr);
+    replace_inp_entry(inp, "gb-obc-beta", nullptr);
+    replace_inp_entry(inp, "gb-obc-gamma", nullptr);
+    replace_inp_entry(inp, "gb-dielectric-offset", nullptr);
+    replace_inp_entry(inp, "sa-algorithm", nullptr);
+    replace_inp_entry(inp, "sa-surface-tension", nullptr);
 
     /* replace the following commands with the clearer new versions*/
     replace_inp_entry(inp, "unconstrained-start", "continuation");
index 330ffea8fb09dd5d219dd95226dde4f604b51733..caab3f8b5fbac1dd8561c504bd0940756cb86b2f 100644 (file)
@@ -91,7 +91,7 @@ void pr_alloc (int extra, t_params *pr)
     {
         return;
     }
-    GMX_ASSERT(pr->nr != 0 || pr->param == NULL, "Invalid t_params object");
+    GMX_ASSERT(pr->nr != 0 || pr->param == nullptr, "Invalid t_params object");
     if (pr->nr+extra > pr->maxnr)
     {
         pr->maxnr = std::max(static_cast<int>(1.2*pr->maxnr), pr->maxnr + extra);
index f10501ab0634b005f71d32ee355026d5720ff9a7..0ce5b9a8ba629a2cd7822193eb6641fb9bb3cfab 100644 (file)
@@ -1115,7 +1115,7 @@ static void clean_vsite_bonds(t_params *plist, t_pindex pindex[],
                     else
                     {
                         GMX_ASSERT(vsnral != 0, "nvsite > 1 must have vsnral != 0");
-                        GMX_ASSERT(first_atoms != NULL, "nvsite > 1 must have first_atoms != NULL");
+                        GMX_ASSERT(first_atoms != nullptr, "nvsite > 1 must have first_atoms != NULL");
                         /* if it is not the first then
                            check if this vsite is constructed from the same atoms */
                         if (vsnral == NRAL(pindex[atom].ftype)-1)
@@ -1185,7 +1185,7 @@ static void clean_vsite_bonds(t_params *plist, t_pindex pindex[],
                     bUsed = FALSE;
                     for (m = 0; (m < vsnral) && !bUsed; m++)
                     {
-                        GMX_ASSERT(first_atoms != NULL, "If we've seen a vsite before, we know what its first atom index was");
+                        GMX_ASSERT(first_atoms != nullptr, "If we've seen a vsite before, we know what its first atom index was");
 
                         if (atom == first_atoms[m])
                         {
@@ -1328,7 +1328,7 @@ static void clean_vsite_angles(t_params *plist, t_pindex pindex[],
                 else
                 {
                     GMX_ASSERT(vsnral != 0, "If we've seen a vsite before, we know how many constructing atoms it had");
-                    GMX_ASSERT(first_atoms != NULL, "If we've seen a vsite before, we know what its first atom index was");
+                    GMX_ASSERT(first_atoms != nullptr, "If we've seen a vsite before, we know what its first atom index was");
                     /* check if this vsite is constructed from the same atoms */
                     if (vsnral == NRAL(pindex[atom].ftype)-1)
                     {
@@ -1376,7 +1376,7 @@ static void clean_vsite_angles(t_params *plist, t_pindex pindex[],
                 bUsed = FALSE;
                 for (m = 0; (m < vsnral) && !bUsed; m++)
                 {
-                    GMX_ASSERT(first_atoms != NULL, "If we've seen a vsite before, we know what its first atom index was");
+                    GMX_ASSERT(first_atoms != nullptr, "If we've seen a vsite before, we know what its first atom index was");
 
                     if (atom == first_atoms[m])
                     {
@@ -1472,7 +1472,7 @@ static void clean_vsite_dihs(t_params *plist, t_pindex pindex[],
                 else
                 {
                     GMX_ASSERT(vsnral != 0, "If we've seen a vsite before, we know how many constructing atoms it had");
-                    GMX_ASSERT(first_atoms != NULL, "If we've seen a vsite before, we know what its first atom index was");
+                    GMX_ASSERT(first_atoms != nullptr, "If we've seen a vsite before, we know what its first atom index was");
                     /* check if this vsite is constructed from the same atoms */
                     if (vsnral == NRAL(pindex[atom].ftype)-1)
                     {
@@ -1514,7 +1514,7 @@ static void clean_vsite_dihs(t_params *plist, t_pindex pindex[],
         for (k = 0; (k < 4) && !bKeep; k++) /* for all atoms in the dihedral */
         {
             GMX_ASSERT(vsnral != 0, "If we've seen a vsite before, we know how many constructing atoms it had");
-            GMX_ASSERT(first_atoms != NULL, "If we've seen a vsite before, we know what its first atom index was");
+            GMX_ASSERT(first_atoms != nullptr, "If we've seen a vsite before, we know what its first atom index was");
             atom = ps->param[i].a[k];
             if (vsite_type[atom] == NOTSET)
             {
index 7ca13e3733d5c7730b1bd5c5fa6ff88cac493fed..0a47d3f6f6699a4280f142529a83c0d9458df930 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2008, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -452,7 +452,7 @@ int gmx_x2top(int argc, char *argv[])
     };
 #define NFILE asize(fnm)
     real               kb                            = 4e5, kt = 400, kp = 5;
-    t_restp            rtp_header_settings           = { 0 };
+    t_restp            rtp_header_settings           = { nullptr };
     gmx_bool           bRemoveDihedralIfWithImproper = FALSE;
     gmx_bool           bGenerateHH14Interactions     = TRUE;
     gmx_bool           bKeepAllGeneratedDihedrals    = FALSE;
index 959babb6689d3f2eadb5d3948359be96e91a4453..49eb068444bcbd7b250fb72e8c194a1c5fadf1fa 100644 (file)
@@ -382,7 +382,7 @@ void calc_disres_R_6(const t_commrec *cr,
             Rtav_6[res] *= invn;
         }
 
-        GMX_ASSERT(cr != NULL && ms != NULL, "We need multisim with nsystems>1");
+        GMX_ASSERT(cr != nullptr && ms != nullptr, "We need multisim with nsystems>1");
         gmx_sum_sim(2*dd->nres, dd->Rt_6, ms);
 
         if (DOMAINDECOMP(cr))
index d9339eef09ac2a9d3a703a23f7039d534aa721fc..c9d4ef810750c6448b61e49a5e423a2c1fd036c2 100644 (file)
@@ -896,7 +896,7 @@ void calc_verlet_buffer_size(const gmx_mtop_t *mtop, real boxvol,
     particle_distance = std::cbrt(boxvol*std::sqrt(2)/mtop->natoms);
 
     get_verlet_buffer_atomtypes(mtop, &att, &natt, n_nonlin_vsite);
-    assert(att != NULL && natt >= 0);
+    assert(att != nullptr && natt >= 0);
 
     if (debug)
     {
index fb80a116bfffa6280bfa8a0a2d02f52032e38f94..8a15aad14c329d320674175511b9d3ec481052dd 100644 (file)
@@ -156,7 +156,7 @@ class Constraints::Impl
         gmx_edsam_t           ed = nullptr;
 
         //! Thread-local virial contribution.
-        tensor            *vir_r_m_dr_th = {0};
+        tensor            *vir_r_m_dr_th = {nullptr};
         //! Did a settle error occur?
         bool              *bSettleErrorHasOccurred = nullptr;
 
index 6dc008d88838b365c82117571eeaa0774b38a191..66bdd39819e84d85263419da42f0544ebb00b742 100644 (file)
@@ -1872,7 +1872,7 @@ gmx_bool uses_simple_tables(int                 cutoff_scheme,
             bUsesSimpleTables = TRUE;
             break;
         case ecutsVERLET:
-            assert(NULL != nbv && NULL != nbv->grp);
+            assert(nullptr != nbv);
             grp_index         = (group < 0) ? 0 : (nbv->ngrp - 1);
             bUsesSimpleTables = nbnxn_kernel_pairlist_simple(nbv->grp[grp_index].kernel_type);
             break;
@@ -2083,7 +2083,7 @@ init_interaction_const(FILE                       *fp,
         if (ic->eeltype != eelGRF)
         {
             calc_rffac(fp, ic->eeltype, ic->epsilon_r, ic->epsilon_rf,
-                       ic->rcoulomb, 0, 0, NULL,
+                       ic->rcoulomb, 0, 0, nullptr,
                        &ic->k_rf, &ic->c_rf);
         }
 
index df9589ab4ec3e9b40c2e0009a13e90d29b89c81f..471d49a635c2ac973db8903200ce4bca5381cd23 100644 (file)
@@ -125,7 +125,7 @@ void mdAlgorithmsSetupAtomData(const t_commrec   *cr,
 
     if (!usingDomDec && ir->ePBC != epbcNONE && !fr->bMolPBC)
     {
-        GMX_ASSERT(graph != NULL, "We use a graph with PBC (no periodic mols) and without DD");
+        GMX_ASSERT(graph != nullptr, "We use a graph with PBC (no periodic mols) and without DD");
 
         *graph = mk_graph(nullptr, &(top->idef), 0, top_global->natoms, FALSE, FALSE);
     }
index fe17c5b9c02a99da0a52e1039a658ae434d9f9dd..e78d8ae594469913687cad26d5e0268c99d1204c 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2017, by the GROMACS development team, led by
+ * Copyright (c) 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.
@@ -405,7 +405,7 @@ setDynamicPairlistPruningParameters(const t_inputrec             *ir,
         listParams->nstlistPrune = tunedNstlistPrune;
         calc_verlet_buffer_size(mtop, det(box), ir,
                                 tunedNstlistPrune, listLifetime,
-                                -1, &listSetup, NULL,
+                                -1, &listSetup, nullptr,
                                 &listParams->rlistInner);
 
         /* On the GPU we apply the dynamic pruning in a rolling fashion
@@ -498,14 +498,14 @@ void setupDynamicPairlistPruning(const gmx::MDLogger       &mdlog,
     const bool useGpu             = (nbnxnKernelType == nbnxnk8x8x8_GPU);
 
     if (supportsDynamicPairlistGenerationInterval(*ir) &&
-        getenv("GMX_DISABLE_DYNAMICPRUNING") == NULL)
+        getenv("GMX_DISABLE_DYNAMICPRUNING") == nullptr)
     {
         /* Note that nstlistPrune can have any value independently of nstlist.
          * Actually applying rolling pruning is only useful when
          * nstlistPrune < nstlist -1
          */
         char *env                 = getenv("GMX_NSTLIST_DYNAMICPRUNING");
-        bool  userSetNstlistPrune = (env != NULL);
+        bool  userSetNstlistPrune = (env != nullptr);
 
         if (userSetNstlistPrune)
         {
index 76cd00446c6a3285b41525cdb9f7f6fef8eee854..a5504796b037f73e1a33c7365c98433a7be386bb 100644 (file)
@@ -1717,7 +1717,7 @@ real pull_potential(struct pull_t *pull, const t_mdatoms *md, t_pbc *pbc,
 {
     real V = 0;
 
-    assert(pull != NULL);
+    assert(pull != nullptr);
 
     /* Ideally we should check external potential registration only during
      * the initialization phase, but that requires another function call
@@ -1772,7 +1772,7 @@ void pull_constraint(struct pull_t *pull, const t_mdatoms *md, t_pbc *pbc,
                      const t_commrec *cr, double dt, double t,
                      rvec *x, rvec *xp, rvec *v, tensor vir)
 {
-    assert(pull != NULL);
+    assert(pull != nullptr);
 
     if (pull->comm.bParticipate)
     {
@@ -1932,7 +1932,7 @@ void dd_make_local_pull_groups(const t_commrec *cr, struct pull_t *pull, t_mdato
             /* This might be an extremely expensive operation, so we try
              * to avoid this splitting as much as possible.
              */
-            assert(dd != NULL);
+            assert(dd != nullptr);
             MPI_Comm_split(dd->mpi_comm_all, bWillParticipate ? 0 : 1, dd->rank,
                            &comm->mpi_comm_com);
 #endif
@@ -2179,7 +2179,7 @@ init_pull(FILE *fplog, const pull_params_t *pull_params, const t_inputrec *ir,
     for (int c = 0; c < pull->params.ncoord; c++)
     {
         /* Construct a pull coordinate, copying all coordinate parameters */
-        pull->coord.push_back(pull_params->coord[c]);
+        pull->coord.emplace_back(pull_params->coord[c]);
 
         pull_coord_work_t *pcrd = &pull->coord.back();
 
index 60de897942e0c554f8a5552895f858b0b7878095..4a42d29fdc04fb914a28b0d288810df1a1a170ab 100644 (file)
@@ -628,7 +628,7 @@ void pull_calc_coms(const t_commrec *cr,
                     pgrp->nat_loc == 1 &&
                     md->massT[pgrp->ind_loc[0]] == 0)
                 {
-                    GMX_ASSERT(xp == NULL, "We should not have groups with zero mass with constraints, i.e. xp!=NULL");
+                    GMX_ASSERT(xp == nullptr, "We should not have groups with zero mass with constraints, i.e. xp!=NULL");
 
                     /* Copy the single atom coordinate */
                     for (int d = 0; d < DIM; d++)
index f9b8e02fd3dad3be635aa05453657f3c6c2b2327..ba0a377f14b4b824b0a623ff39a49cf5e94fa62a 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -1218,7 +1218,7 @@ setup_memory_pooling(const SelectionTreeElementPointer &sel,
 static void
 init_item_evaloutput(const SelectionTreeElementPointer &sel)
 {
-    GMX_ASSERT(!(sel->child == NULL &&
+    GMX_ASSERT(!(sel->child == nullptr &&
                  (sel->type == SEL_SUBEXPRREF || sel->type == SEL_SUBEXPR)),
                "Subexpression elements should always have a child element");
 
@@ -2510,7 +2510,7 @@ init_required_atoms(const SelectionTreeElementPointer &sel,
 static void
 postprocess_item_subexpressions(const SelectionTreeElementPointer &sel)
 {
-    GMX_ASSERT(!(sel->child == NULL &&
+    GMX_ASSERT(!(sel->child == nullptr &&
                  (sel->type == SEL_SUBEXPRREF || sel->type == SEL_SUBEXPR)),
                "Subexpression elements should always have a child element");
 
index 3032cf58aea60edcb8567b5c68e483e088f6078b..c8102a22c605991de5c9ff3c058ac59b3f0f6890 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -165,7 +165,7 @@ void computeMassesAndCharges(const gmx_mtop_t *top, const gmx_ana_pos_t &pos,
                              std::vector<real> *masses,
                              std::vector<real> *charges)
 {
-    GMX_ASSERT(top != NULL, "Should not have been called with NULL topology");
+    GMX_ASSERT(top != nullptr, "Should not have been called with NULL topology");
     masses->clear();
     charges->clear();
     int molb = 0;
index 4d88270866ef1959da4bb8f38af6ef978bc560d4..3d3b87a4b863b46a2f8a28a5780f0c03658197cf 100644 (file)
@@ -799,7 +799,7 @@ t_blocka *init_index(const char *gfile, char ***grpname)
                     maxentries += 1024;
                     srenew(b->a, maxentries);
                 }
-                assert(b->a != NULL); // for clang analyzer
+                assert(b->a != nullptr); // for clang analyzer
                 b->a[i] = strtol(str, nullptr, 10)-1;
                 b->index[b->nr]++;
                 (b->nra)++;
@@ -811,7 +811,7 @@ t_blocka *init_index(const char *gfile, char ***grpname)
 
     for (i = 0; (i < b->nr); i++)
     {
-        assert(b->a != NULL); // for clang analyzer
+        assert(b->a != nullptr); // for clang analyzer
         for (j = b->index[i]; (j < b->index[i+1]); j++)
         {
             if (b->a[j] < 0)