Tidy: modernize-use-nullptr
[alexxy/gromacs.git] / src / gromacs / ewald / pme.cpp
index e5dea7d8c43390258c055bd13114ed03b5261b6a..b66892b8f55c0b855f491f74d26eccf83397b390 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.
@@ -466,7 +466,7 @@ void gmx_pme_check_restrictions(int pme_order,
                   nkx/(double)nnodes_major, pme_order);
     }
 
-    if (bValidSettings != NULL)
+    if (bValidSettings != nullptr)
     {
         *bValidSettings = TRUE;
     }
@@ -493,7 +493,7 @@ int gmx_pme_init(struct gmx_pme_t **pmedata,
                  real               ewaldcoeff_lj,
                  int                nthread)
 {
-    struct gmx_pme_t *pme = NULL;
+    struct gmx_pme_t *pme = nullptr;
 
     int               use_threads, sum_use_threads, i;
     ivec              ndata;
@@ -504,8 +504,8 @@ int gmx_pme_init(struct gmx_pme_t **pmedata,
     }
     snew(pme, 1);
 
-    pme->sum_qgrid_tmp       = NULL;
-    pme->sum_qgrid_dd_tmp    = NULL;
+    pme->sum_qgrid_tmp       = nullptr;
+    pme->sum_qgrid_dd_tmp    = nullptr;
     pme->buf_nalloc          = 0;
 
     pme->nnodes              = 1;
@@ -629,7 +629,7 @@ int gmx_pme_init(struct gmx_pme_t **pmedata,
     pme->nkx           = ir->nkx;
     pme->nky           = ir->nky;
     pme->nkz           = ir->nkz;
-    pme->bP3M          = (ir->coulombtype == eelP3M_AD || getenv("GMX_PME_P3M") != NULL);
+    pme->bP3M          = (ir->coulombtype == eelP3M_AD || getenv("GMX_PME_P3M") != nullptr);
     pme->pme_order     = ir->pme_order;
     pme->ewaldcoeff_q  = ewaldcoeff_q;
     pme->ewaldcoeff_lj = ewaldcoeff_lj;
@@ -647,7 +647,7 @@ int gmx_pme_init(struct gmx_pme_t **pmedata,
                                pme->nnodes_minor,
                                pme->bUseThreads,
                                TRUE,
-                               NULL);
+                               nullptr);
 
     if (pme->nnodes > 1)
     {
@@ -814,8 +814,8 @@ int gmx_pme_init(struct gmx_pme_t **pmedata,
         pme_realloc_atomcomm_things(&pme->atc[0]);
     }
 
-    pme->lb_buf1       = NULL;
-    pme->lb_buf2       = NULL;
+    pme->lb_buf1       = nullptr;
+    pme->lb_buf2       = nullptr;
     pme->lb_buf_nalloc = 0;
 
     pme_init_all_work(&pme->solve_work, pme->nthread, pme->nkx);
@@ -880,7 +880,7 @@ void gmx_pme_calc_energy(struct gmx_pme_t *pme, int n, rvec *x, real *q, real *V
 
     atc            = &pme->atc_energy;
     atc->nthread   = 1;
-    if (atc->spline == NULL)
+    if (atc->spline == nullptr)
     {
         snew(atc->spline, atc->nthread);
     }
@@ -896,7 +896,7 @@ void gmx_pme_calc_energy(struct gmx_pme_t *pme, int n, rvec *x, real *q, real *V
     grid = &pme->pmegrid[PME_GRID_QA];
 
     /* Only calculate the spline coefficients, don't actually spread */
-    spread_on_grid(pme, atc, NULL, TRUE, FALSE, pme->fftgrid[PME_GRID_QA], FALSE, PME_GRID_QA);
+    spread_on_grid(pme, atc, nullptr, TRUE, FALSE, pme->fftgrid[PME_GRID_QA], FALSE, PME_GRID_QA);
 
     *V = gather_energy_bsplines(pme, grid->grid.grid, atc);
 }
@@ -945,11 +945,11 @@ int gmx_pme_do(struct gmx_pme_t *pme,
 {
     int                  d, i, j, npme, grid_index, max_grid_index;
     int                  n_d;
-    pme_atomcomm_t      *atc        = NULL;
-    pmegrids_t          *pmegrid    = NULL;
-    real                *grid       = NULL;
+    pme_atomcomm_t      *atc        = nullptr;
+    pmegrids_t          *pmegrid    = nullptr;
+    real                *grid       = nullptr;
     rvec                *f_d;
-    real                *coefficient = NULL;
+    real                *coefficient = nullptr;
     real                 energy_AB[4];
     matrix               vir_AB[4];
     real                 scale, lambda;
@@ -1054,7 +1054,7 @@ int gmx_pme_do(struct gmx_pme_t *pme,
             fprintf(debug, "PME: number of ranks = %d, rank = %d\n",
                     cr->nnodes, cr->nodeid);
             fprintf(debug, "Grid = %p\n", (void*)grid);
-            if (grid == NULL)
+            if (grid == nullptr)
             {
                 gmx_fatal(FARGS, "No grid!");
             }
@@ -1285,10 +1285,10 @@ int gmx_pme_do(struct gmx_pme_t *pme,
         /* Loop over A- and B-state if we are doing FEP */
         for (fep_state = 0; fep_state < fep_states_lj; ++fep_state)
         {
-            real *local_c6 = NULL, *local_sigma = NULL, *RedistC6 = NULL, *RedistSigma = NULL;
+            real *local_c6 = nullptr, *local_sigma = nullptr, *RedistC6 = nullptr, *RedistSigma = nullptr;
             if (pme->nnodes == 1)
             {
-                if (pme->lb_buf1 == NULL)
+                if (pme->lb_buf1 == nullptr)
                 {
                     pme->lb_buf_nalloc = pme->atc[0].n;
                     snew(pme->lb_buf1, pme->lb_buf_nalloc);
@@ -1675,7 +1675,7 @@ int gmx_pme_destroy(struct gmx_pme_t **pmedata)
     sfree(pme->sum_qgrid_dd_tmp);
 
     sfree(*pmedata);
-    *pmedata = NULL;
+    *pmedata = nullptr;
 
     return 0;
 }