Use const ref to inputrec in do_force
[alexxy/gromacs.git] / src / gromacs / ewald / ewald.cpp
index 6e089c2b99c511867ac4f7fa33c608667d4e5c00..81e6bb4709ca51ff9429dc04085691d276032e90 100644 (file)
@@ -4,7 +4,7 @@
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
  * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
- * Copyright (c) 2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020,2021, 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.
@@ -78,7 +78,7 @@ struct gmx_ewald_tab_t
     t_complex *tab_xy, *tab_qxyz;
 };
 
-void init_ewald_tab(struct gmx_ewald_tab_t** et, const t_inputrec* ir, FILE* fp)
+void init_ewald_tab(struct gmx_ewald_tab_t** et, const t_inputrec& ir, FILE* fp)
 {
     snew(*et, 1);
     if (fp)
@@ -86,9 +86,9 @@ void init_ewald_tab(struct gmx_ewald_tab_t** et, const t_inputrec* ir, FILE* fp)
         fprintf(fp, "Will do ordinary reciprocal space Ewald sum.\n");
     }
 
-    (*et)->nx       = ir->nkx + 1;
-    (*et)->ny       = ir->nky + 1;
-    (*et)->nz       = ir->nkz + 1;
+    (*et)->nx       = ir.nkx + 1;
+    (*et)->ny       = ir.nky + 1;
+    (*et)->nz       = ir.nkz + 1;
     (*et)->kmax     = std::max((*et)->nx, std::max((*et)->ny, (*et)->nz));
     (*et)->eir      = nullptr;
     (*et)->tab_xy   = nullptr;
@@ -137,7 +137,7 @@ static void tabulateStructureFactors(int natom, const rvec x[], int kmax, cvec**
     }
 }
 
-real do_ewald(const t_inputrec* ir,
+real do_ewald(const t_inputrec& ir,
               const rvec        x[],
               rvec              f[],
               const real        chargeA[],
@@ -169,7 +169,7 @@ real do_ewald(const t_inputrec* ir,
 
     /* Scale box with Ewald wall factor */
     matrix          scaledBox;
-    EwaldBoxZScaler boxScaler(*ir);
+    EwaldBoxZScaler boxScaler(ir);
     boxScaler.scaleBox(box, scaledBox);
 
     rvec boxDiag;
@@ -179,7 +179,7 @@ real do_ewald(const t_inputrec* ir,
     }
 
     /* 1/(Vol*e0) */
-    real scaleRecip = 4.0 * M_PI / (boxDiag[XX] * boxDiag[YY] * boxDiag[ZZ]) * ONE_4PI_EPS0 / ir->epsilon_r;
+    real scaleRecip = 4.0 * M_PI / (boxDiag[XX] * boxDiag[YY] * boxDiag[ZZ]) * ONE_4PI_EPS0 / ir.epsilon_r;
 
     if (!et->eir) /* allocate if we need to */
     {
@@ -192,7 +192,7 @@ real do_ewald(const t_inputrec* ir,
         snew(et->tab_qxyz, natoms);
     }
 
-    bFreeEnergy = (ir->efep != efepNO);
+    bFreeEnergy = (ir.efep != efepNO);
 
     clear_mat(lrvir);