Tidy: modernize-use-nullptr
[alexxy/gromacs.git] / src / gromacs / fileio / tpxio.cpp
index c85e1530ddc545f716ae94e92ea1e2c3eeb9a58e..24d71f8e6d68af744d1dfc0cbd075d3aff4bf86a 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, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,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.
@@ -292,14 +292,14 @@ static void do_pull_coord(t_fileio *fio, t_pull_coord *pcrd,
             }
             else
             {
-                pcrd->externalPotentialProvider = NULL;
+                pcrd->externalPotentialProvider = nullptr;
             }
         }
         else
         {
             if (bRead)
             {
-                pcrd->externalPotentialProvider = NULL;
+                pcrd->externalPotentialProvider = nullptr;
             }
         }
         /* Note that we try to support adding new geometries without
@@ -538,7 +538,7 @@ static void do_fepvals(t_fileio *fio, t_lambda *fepvals, gmx_bool bRead, int fil
     else
     {
         fepvals->n_lambda     = 0;
-        fepvals->all_lambda   = NULL;
+        fepvals->all_lambda   = nullptr;
         if (fepvals->init_lambda >= 0)
         {
             fepvals->separate_dvdl[efptFEP] = TRUE;
@@ -2118,7 +2118,7 @@ static void do_ilists(t_fileio *fio, t_ilist *ilist, gmx_bool bRead,
         if (bClear)
         {
             ilist[j].nr     = 0;
-            ilist[j].iatoms = NULL;
+            ilist[j].iatoms = nullptr;
         }
         else
         {
@@ -2162,7 +2162,7 @@ static void do_block(t_fileio *fio, t_block *block, gmx_bool bRead, int file_ver
     }
     if (bRead)
     {
-        if ((block->nalloc_index > 0) && (NULL != block->index))
+        if ((block->nalloc_index > 0) && (nullptr != block->index))
         {
             sfree(block->index);
         }
@@ -2419,7 +2419,7 @@ static void do_atoms(t_fileio *fio, t_atoms *atoms, gmx_bool bRead, t_symtab *sy
         {
             snew(groups->grpname, groups->ngrpname);
         }
-        atoms->pdbinfo = NULL;
+        atoms->pdbinfo = nullptr;
     }
     else
     {
@@ -2463,7 +2463,7 @@ static void do_groups(t_fileio *fio, gmx_groups_t *groups,
         {
             if (bRead)
             {
-                groups->grpnr[g] = NULL;
+                groups->grpnr[g] = nullptr;
             }
         }
         else
@@ -2530,7 +2530,7 @@ static void do_symtab(t_fileio *fio, t_symtab *symtab, gmx_bool bRead)
     else
     {
         symbuf = symtab->symbuf;
-        while (symbuf != NULL)
+        while (symbuf != nullptr)
         {
             for (i = 0; (i < symbuf->bufsize) && (i < nr); i++)
             {
@@ -2877,7 +2877,7 @@ static void do_mtop(t_fileio *fio, gmx_mtop_t *mtop, gmx_bool bRead,
     {
         mtop->ffparams.cmap_grid.ngrid        = 0;
         mtop->ffparams.cmap_grid.grid_spacing = 0;
-        mtop->ffparams.cmap_grid.cmapdata     = NULL;
+        mtop->ffparams.cmap_grid.cmapdata     = nullptr;
     }
 
     if (file_version >= 57)
@@ -3080,14 +3080,14 @@ static int do_tpx(t_fileio *fio, gmx_bool bRead,
 
     if (!bRead)
     {
-        GMX_RELEASE_ASSERT(x == NULL && v == NULL, "Passing separate x and v pointers to do_tpx() is not supported when writing");
+        GMX_RELEASE_ASSERT(x == nullptr && v == nullptr, "Passing separate x and v pointers to do_tpx() is not supported when writing");
 
         tpx.natoms    = state->natoms;
         tpx.ngtc      = state->ngtc;
         tpx.fep_state = state->fep_state;
         tpx.lambda    = state->lambda[efptFEP];
-        tpx.bIr       = (ir       != NULL);
-        tpx.bTop      = (mtop     != NULL);
+        tpx.bIr       = (ir       != nullptr);
+        tpx.bTop      = (mtop     != nullptr);
         tpx.bX        = (state->flags & (1 << estX));
         tpx.bV        = (state->flags & (1 << estV));
         tpx.bF        = FALSE;
@@ -3095,10 +3095,10 @@ static int do_tpx(t_fileio *fio, gmx_bool bRead,
     }
     else
     {
-        GMX_RELEASE_ASSERT(!(x == NULL && v != NULL), "Passing x==NULL and v!=NULL is not supported");
+        GMX_RELEASE_ASSERT(!(x == nullptr && v != nullptr), "Passing x==NULL and v!=NULL is not supported");
     }
 
-    TopOnlyOK = (ir == NULL);
+    TopOnlyOK = (ir == nullptr);
 
     int fileVersion;    /* Version number of the code that wrote the file */
     int fileGeneration; /* Generation version number of the code that wrote the file */
@@ -3107,7 +3107,7 @@ static int do_tpx(t_fileio *fio, gmx_bool bRead,
     if (bRead)
     {
         state->flags  = 0;
-        if (x != NULL)
+        if (x != nullptr)
         {
             init_state(state, 0, tpx.ngtc, 0, 0, 0);
         }
@@ -3117,7 +3117,7 @@ static int do_tpx(t_fileio *fio, gmx_bool bRead,
         }
     }
 
-    if (x == NULL)
+    if (x == nullptr)
     {
         x = as_rvec_array(state->x.data());
         v = as_rvec_array(state->v.data());
@@ -3227,7 +3227,7 @@ static int do_tpx(t_fileio *fio, gmx_bool bRead,
         }
         if (fileGeneration <= tpx_generation && ir)
         {
-            do_inputrec(fio, ir, bRead, fileVersion, mtop ? &mtop->ffparams.fudgeQQ : NULL);
+            do_inputrec(fio, ir, bRead, fileVersion, mtop ? &mtop->ffparams.fudgeQQ : nullptr);
             if (fileVersion < 51)
             {
                 set_box_rel(ir, state);
@@ -3302,7 +3302,7 @@ void read_tpxheader(const char *fn, t_tpxheader *tpx, gmx_bool TopOnlyOK)
     t_fileio *fio;
 
     fio = open_tpx(fn, "r");
-    do_tpxheader(fio, TRUE, tpx, TopOnlyOK, NULL, NULL);
+    do_tpxheader(fio, TRUE, tpx, TopOnlyOK, nullptr, nullptr);
     close_tpx(fio);
 }
 
@@ -3314,7 +3314,7 @@ void write_tpx_state(const char *fn,
     fio = open_tpx(fn, "w");
     do_tpx(fio, FALSE,
            const_cast<t_inputrec *>(ir),
-           const_cast<t_state *>(state), NULL, NULL,
+           const_cast<t_state *>(state), nullptr, nullptr,
            const_cast<gmx_mtop_t *>(mtop));
     close_tpx(fio);
 }
@@ -3325,7 +3325,7 @@ void read_tpx_state(const char *fn,
     t_fileio *fio;
 
     fio = open_tpx(fn, "r");
-    do_tpx(fio, TRUE, ir, state, NULL, NULL, mtop);
+    do_tpx(fio, TRUE, ir, state, nullptr, nullptr, mtop);
     close_tpx(fio);
 }