Use ArrayRef in calc_mu
authorJoe Jordan <ejjordan12@gmail.com>
Tue, 23 Mar 2021 09:40:41 +0000 (09:40 +0000)
committerArtem Zhmurov <zhmurov@gmail.com>
Tue, 23 Mar 2021 09:40:41 +0000 (09:40 +0000)
src/gromacs/mdlib/calcmu.cpp
src/gromacs/mdlib/calcmu.h
src/gromacs/mdlib/sim_util.cpp

index 982faf33e02020aa5a85eb91ec562d5de490faf2..07b27aad0048a020d041d2777f5b9495add4abb4 100644 (file)
@@ -52,9 +52,9 @@
 void calc_mu(int                            start,
              int                            homenr,
              gmx::ArrayRef<const gmx::RVec> x,
-             const real                     q[],
-             const real                     qB[],
-             int                            nChargePerturbed,
+             gmx::ArrayRef<const real>      q,
+             gmx::ArrayRef<const real>      qB,
+             bool                           havePerturbedCharges,
              dvec                           mu,
              dvec                           mu_B)
 {
@@ -82,7 +82,7 @@ void calc_mu(int                            start,
         mu[m] *= gmx::c_enm2Debye;
     }
 
-    if (nChargePerturbed)
+    if (havePerturbedCharges)
     {
         mu_x = mu_y = mu_z = 0.0;
 #pragma omp parallel for reduction(+: mu_x, mu_y, mu_z) schedule(static) \
index 4081afc4efe16a84106468f45035c9a20ced6c20..23a4fd2907d575847b9604e508f7c7c9498834c4 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) 2010,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.
@@ -52,9 +52,9 @@ class ArrayRef;
 void calc_mu(int                            start,
              int                            homenr,
              gmx::ArrayRef<const gmx::RVec> x,
-             const real                     q[],
-             const real                     qB[],
-             int                            nChargePerturbed,
+             gmx::ArrayRef<const real>      q,
+             gmx::ArrayRef<const real>      qB,
+             bool                           havePerturbedCharges,
              dvec                           mu,
              dvec                           mu_B);
 
index ec10bb27a0fa7dd3fc09c0c7aa819b2e6c97b6d7..30985796d99b392f5baaf7abc453b729b66ff547 100644 (file)
@@ -1663,9 +1663,9 @@ void do_force(FILE*                               fplog,
         calc_mu(start,
                 mdatoms->homenr,
                 xRef,
-                mdatoms->chargeA,
-                mdatoms->chargeB,
-                mdatoms->nChargePerturbed,
+                gmx::arrayRefFromArray(mdatoms->chargeA, mdatoms->nr),
+                gmx::arrayRefFromArray(mdatoms->chargeB, mdatoms->nr),
+                mdatoms->nChargePerturbed != 0,
                 dipoleData.muStaging[0],
                 dipoleData.muStaging[1]);