Tidy: modernize-use-nullptr
[alexxy/gromacs.git] / src / gromacs / gmxana / gmx_density.cpp
index ad9b231fea9398db62a7bb9703ac831abdad52d7..e92661be9fe9d631ab38d0adc6d74259b65026a8 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, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017, 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.
@@ -94,7 +94,7 @@ int get_electrons(t_electron **eltab, const char *fn)
         gmx_fatal(FARGS, "Couldn't open %s. Exiting.\n", fn);
     }
 
-    if (NULL == fgets(buffer, 255, in))
+    if (nullptr == fgets(buffer, 255, in))
     {
         gmx_fatal(FARGS, "Error reading from file %s", fn);
     }
@@ -108,7 +108,7 @@ int get_electrons(t_electron **eltab, const char *fn)
 
     for (i = 0; i < nr; i++)
     {
-        if (fgets(buffer, 255, in) == NULL)
+        if (fgets(buffer, 255, in) == nullptr)
         {
             gmx_fatal(FARGS, "reading datafile. Check your datafile.\n");
         }
@@ -186,7 +186,7 @@ void calc_electron_density(const char *fn, int **index, int gnx[],
     t_electron  *found;         /* found by bsearch */
     t_electron   sought;        /* thingie thought by bsearch */
     real         boxSz, aveBox;
-    gmx_rmpbc_t  gpbc = NULL;
+    gmx_rmpbc_t  gpbc = nullptr;
 
     real         t,
                  z;
@@ -281,7 +281,7 @@ void calc_electron_density(const char *fn, int **index, int gnx[],
                             (const void *)eltab, nr, sizeof(t_electron),
                             (int(*)(const void*, const void*))compare);
 
-                if (found == NULL)
+                if (found == nullptr)
                 {
                     fprintf(stderr, "Couldn't find %s. Add it to the .dat file\n",
                             *(top->atoms.atomname[index[n][i]]));
@@ -343,7 +343,7 @@ void calc_density(const char *fn, int **index, int gnx[],
     real         t,
                  z;
     real         boxSz, aveBox;
-    gmx_rmpbc_t  gpbc = NULL;
+    gmx_rmpbc_t  gpbc = nullptr;
 
     if (axis < 0 || axis >= DIM)
     {
@@ -482,9 +482,9 @@ void plot_density(double *slDensity[], const char *afile, int nslices,
                   const gmx_output_env_t *oenv)
 {
     FILE       *den;
-    const char *title  = NULL;
-    const char *xlabel = NULL;
-    const char *ylabel = NULL;
+    const char *title  = nullptr;
+    const char *xlabel = nullptr;
+    const char *ylabel = nullptr;
     int         slice, n;
     real        ddd;
     real        axispos;
@@ -621,7 +621,7 @@ int gmx_density(int argc, char *argv[])
 
     gmx_output_env_t  *oenv;
     static const char *dens_opt[] =
-    { NULL, "mass", "number", "charge", "electron", NULL };
+    { nullptr, "mass", "number", "charge", "electron", nullptr };
     static int         axis        = 2;  /* normal to memb. default z  */
     static const char *axtitle     = "Z";
     static int         nslices     = 50; /* nr of slices defined       */
@@ -666,9 +666,9 @@ int gmx_density(int argc, char *argv[])
     int                i;
 
     t_filenm           fnm[] = { /* files for g_density       */
-        { efTRX, "-f", NULL,  ffREAD },
-        { efNDX, NULL, NULL,  ffOPTRD },
-        { efTPR, NULL, NULL,  ffREAD },
+        { efTRX, "-f", nullptr,  ffREAD },
+        { efNDX, nullptr, nullptr,  ffOPTRD },
+        { efTPR, nullptr, nullptr,  ffREAD },
         { efDAT, "-ei", "electrons", ffOPTRD }, /* file with nr. of electrons */
         { efXVG, "-o", "density", ffWRITE },
     };
@@ -682,7 +682,7 @@ int gmx_density(int argc, char *argv[])
         return 0;
     }
 
-    GMX_RELEASE_ASSERT(dens_opt[0] != NULL, "Option setting inconsistency; dens_opt[0] is NULL");
+    GMX_RELEASE_ASSERT(dens_opt[0] != nullptr, "Option setting inconsistency; dens_opt[0] is NULL");
 
     if (bSymmetrize && !bCenter)
     {
@@ -725,7 +725,7 @@ int gmx_density(int argc, char *argv[])
     else
     {
         ncenter      = 0;
-        index_center = NULL;
+        index_center = nullptr;
     }
 
     fprintf(stderr, "\nSelect %d group%s to calculate density for:\n", ngrps, (ngrps > 1) ? "s" : "");