Tidy: modernize-use-nullptr
[alexxy/gromacs.git] / src / gromacs / gmxpreprocess / solvate.cpp
index 93f9ba6c49e63ffbe7e4880f1ab8d83cab5206cf..f576d62ac120936aa1e7671298bac7a5d9ce6b5f 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.
@@ -86,7 +86,7 @@ static void sort_molecule(t_atoms **atoms_solvt, std::vector<RVec> *x,
     atoms = *atoms_solvt;
 
     /* copy each residue from *atoms to a molecule in *molecule */
-    moltypes   = NULL;
+    moltypes   = nullptr;
     nrmoltypes = 0;
     for (i = 0; i < atoms->nr; i++)
     {
@@ -311,7 +311,7 @@ static void replicateSolventBox(t_atoms *atoms, std::vector<RVec> *x,
     // but not in all).
     t_atoms           newAtoms;
     init_t_atoms(&newAtoms, 0, FALSE);
-    gmx::AtomsBuilder builder(&newAtoms, NULL);
+    gmx::AtomsBuilder builder(&newAtoms, nullptr);
     builder.reserve(atoms->nr * nmol, atoms->nres * nmol);
     std::vector<RVec> newX(atoms->nr * nmol);
     std::vector<RVec> newV(!v->empty() ? atoms->nr * nmol : 0);
@@ -615,7 +615,7 @@ static void add_solv(const char *fn, t_topology *top,
 
     char             *filename = gmxlibfn(fn);
     snew(top_solvt, 1);
-    readConformation(filename, top_solvt, &x_solvt, !v->empty() ? &v_solvt : NULL,
+    readConformation(filename, top_solvt, &x_solvt, !v->empty() ? &v_solvt : nullptr,
                      &ePBC_solvt, box_solvt, "solvent");
     t_atoms *atoms_solvt = &top_solvt->atoms;
     if (0 == atoms_solvt->nr)
@@ -732,7 +732,7 @@ static void update_top(t_atoms *atoms, matrix box, int NFILE, t_filenm fnm[],
             bSkip = FALSE;
             line++;
             strcpy(buf2, buf);
-            if ((temp = strchr(buf2, '\n')) != NULL)
+            if ((temp = strchr(buf2, '\n')) != nullptr)
             {
                 temp[0] = '\0';
             }
@@ -740,7 +740,7 @@ static void update_top(t_atoms *atoms, matrix box, int NFILE, t_filenm fnm[],
             if (buf2[0] == '[')
             {
                 buf2[0] = ' ';
-                if ((temp = strchr(buf2, '\n')) != NULL)
+                if ((temp = strchr(buf2, '\n')) != nullptr)
                 {
                     temp[0] = '\0';
                 }
@@ -781,7 +781,7 @@ static void update_top(t_atoms *atoms, matrix box, int NFILE, t_filenm fnm[],
             }
             if (bSkip)
             {
-                if ((temp = strchr(buf, '\n')) != NULL)
+                if ((temp = strchr(buf, '\n')) != nullptr)
                 {
                     temp[0] = '\0';
                 }
@@ -876,8 +876,8 @@ int gmx_solvate(int argc, char *argv[])
     t_filenm    fnm[] = {
         { efSTX, "-cp", "protein", ffOPTRD },
         { efSTX, "-cs", "spc216",  ffLIBRD},
-        { efSTO, NULL,  NULL,      ffWRITE},
-        { efTOP, NULL,  NULL,      ffOPTRW},
+        { efSTO, nullptr,  nullptr,      ffWRITE},
+        { efTOP, nullptr,  nullptr,      ffOPTRW},
     };
 #define NFILE asize(fnm)
 
@@ -928,7 +928,7 @@ int gmx_solvate(int argc, char *argv[])
         /* Generate a solute configuration */
         conf_prot = opt2fn("-cp", NFILE, fnm);
         readConformation(conf_prot, top, &x,
-                         bReadV ? &v : NULL, &ePBC, box, "solute");
+                         bReadV ? &v : nullptr, &ePBC, box, "solute");
         if (bReadV && v.empty())
         {
             fprintf(stderr, "Note: no velocities found\n");
@@ -961,7 +961,7 @@ int gmx_solvate(int argc, char *argv[])
     fprintf(stderr, "Writing generated configuration to %s\n", confout);
     const char *outputTitle = (bProt ? *top->name : "Generated by gmx solvate");
     write_sto_conf(confout, outputTitle, &top->atoms, as_rvec_array(x.data()),
-                   !v.empty() ? as_rvec_array(v.data()) : NULL, ePBC, box);
+                   !v.empty() ? as_rvec_array(v.data()) : nullptr, ePBC, box);
 
     /* print size of generated configuration */
     fprintf(stderr, "\nOutput configuration contains %d atoms in %d residues\n",