Make box const in do_force()
authorBerk Hess <hess@kth.se>
Wed, 31 Jul 2019 20:49:13 +0000 (22:49 +0200)
committerChristian Blau <cblau@gwdg.de>
Mon, 5 Aug 2019 20:44:17 +0000 (22:44 +0200)
Change-Id: Ie0854b159512af227790a5d8010d5501af3d5094

src/gromacs/domdec/domdec.cpp
src/gromacs/domdec/domdec.h
src/gromacs/essentialdynamics/edsam.cpp
src/gromacs/essentialdynamics/edsam.h
src/gromacs/ewald/pme.h
src/gromacs/ewald/pme_pp.cpp
src/gromacs/mdlib/force.h
src/gromacs/mdlib/sim_util.cpp
src/gromacs/pulling/pull_rotation.cpp
src/gromacs/pulling/pull_rotation.h

index 40488725e73536f38ca5c281fc9b237310276768..0cd58aac881ba6979804d31c573c85ba6e632c4d 100644 (file)
@@ -306,7 +306,7 @@ void dd_get_constraint_range(const gmx_domdec_t *dd, int *at_start, int *at_end)
 }
 
 void dd_move_x(gmx_domdec_t             *dd,
-               matrix                    box,
+               const matrix              box,
                gmx::ArrayRef<gmx::RVec>  x,
                gmx_wallcycle            *wcycle)
 {
index e216dd31ad469b224e5ed76f1100bb5f08668191..d015ab31c27925bd9952570a9cbe9d6a81471ce7 100644 (file)
@@ -208,7 +208,7 @@ void dd_cycles_add(const gmx_domdec_t *dd, float cycles, int ddCycl);
 
 /*! \brief Communicate the coordinates to the neighboring cells and do pbc. */
 void dd_move_x(struct gmx_domdec_t      *dd,
-               matrix                    box,
+               const matrix              box,
                gmx::ArrayRef<gmx::RVec>  x,
                gmx_wallcycle            *wcycle);
 
index ea47349a69321744fed72ea68a45aa480a980a5c..f4b2b2d0790e451cf661f213521e0b5017912a2b 100644 (file)
@@ -904,7 +904,7 @@ static void do_single_flood(
         rvec             force[],
         t_edpar         *edi,
         int64_t          step,
-        matrix           box,
+        const matrix     box,
         const t_commrec *cr,
         gmx_bool         bNS) /* Are we in a neighbor searching step? */
 {
@@ -1008,7 +1008,7 @@ extern void do_flood(const t_commrec  *cr,
                      const rvec        x[],
                      rvec              force[],
                      gmx_edsam        *ed,
-                     matrix            box,
+                     const matrix      box,
                      int64_t           step,
                      gmx_bool          bNS)
 {
index 875400828cf190c94723cc0908a94ba3919d1c14..04cf6cdcd7867edbd22df0e1b9f83f033209223f 100644 (file)
@@ -160,7 +160,7 @@ void do_flood(const t_commrec  *cr,
               const rvec        x[],
               rvec              force[],
               gmx_edsam        *ed,
-              matrix            box,
+              const matrix      box,
               int64_t           step,
               gmx_bool          bNS);
 
index 62b02a2269d47a93640fbd2380d6543ef8239965..29cc106554ded389f1b7b796e40906157bbcd5fe 100644 (file)
@@ -223,7 +223,7 @@ void gmx_pme_send_parameters(const t_commrec *cr,
                              int maxshift_x, int maxshift_y);
 
 /*! \brief Send the coordinates to our PME-only node and request a PME calculation */
-void gmx_pme_send_coordinates(const t_commrec *cr, matrix box, rvec *x,
+void gmx_pme_send_coordinates(const t_commrec *cr, const matrix box, const rvec *x,
                               real lambda_q, real lambda_lj,
                               gmx_bool bEnerVir,
                               int64_t step, gmx_wallcycle *wcycle);
index a15e1b57cd6e1b95c19ed1f0a2fb17ce5f3b2f5e..ad20784b020d043cd7a7da0adddfe1131fe20930 100644 (file)
@@ -92,7 +92,7 @@ static void gmx_pme_send_coeffs_coords(const t_commrec *cr, unsigned int flags,
                                        real gmx_unused *chargeA, real gmx_unused *chargeB,
                                        real gmx_unused *c6A, real gmx_unused *c6B,
                                        real gmx_unused *sigmaA, real gmx_unused *sigmaB,
-                                       matrix box, rvec gmx_unused *x,
+                                       const matrix box, const rvec gmx_unused *x,
                                        real lambda_q, real lambda_lj,
                                        int maxshift_x, int maxshift_y,
                                        int64_t step)
@@ -197,7 +197,9 @@ static void gmx_pme_send_coeffs_coords(const t_commrec *cr, unsigned int flags,
         }
         if (flags & PP_PME_COORD)
         {
-            MPI_Isend(x[0], n*sizeof(rvec), MPI_BYTE,
+            /* MPI_Isend does not accept a const buffer pointer */
+            real *xRealPtr = const_cast<real *>(x[0]);
+            MPI_Isend(xRealPtr, n*sizeof(rvec), MPI_BYTE,
                       dd->pme_nodeid, eCommType_COORD, cr->mpi_comm_mysim,
                       &dd->req_pme[dd->nreq_pme++]);
         }
@@ -244,7 +246,7 @@ void gmx_pme_send_parameters(const t_commrec *cr,
                                nullptr, nullptr, 0, 0, maxshift_x, maxshift_y, -1);
 }
 
-void gmx_pme_send_coordinates(const t_commrec *cr, matrix box, rvec *x,
+void gmx_pme_send_coordinates(const t_commrec *cr, const matrix box, const rvec *x,
                               real lambda_q, real lambda_lj,
                               gmx_bool bEnerVir,
                               int64_t step, gmx_wallcycle *wcycle)
index f5cc4f997ed7e0a61dd04effe8f8fc04c8b51c5d..41e674ebb549f2074af0003124aa83899dad5b40 100644 (file)
@@ -84,7 +84,7 @@ void do_force(FILE                                     *log,
               t_nrnb                                   *nrnb,
               gmx_wallcycle                            *wcycle,
               const gmx_localtop_t                     *top,
-              matrix                                    box,
+              const matrix                              box,
               gmx::ArrayRefWithPadding<gmx::RVec>       coordinates,
               history_t                                *hist,
               gmx::ArrayRefWithPadding<gmx::RVec>       force,
index dc60a7b0b0d4ce8ef22af629a8fefe6a28caa07b..c2b386d97e3c847e839326e95d964e80d39548dd 100644 (file)
@@ -530,7 +530,7 @@ computeSpecialForces(FILE                          *fplog,
                      double                         t,
                      gmx_wallcycle_t                wcycle,
                      ForceProviders                *forceProviders,
-                     matrix                         box,
+                     const matrix                   box,
                      gmx::ArrayRef<const gmx::RVec> x,
                      const t_mdatoms               *mdatoms,
                      real                          *lambda,
@@ -607,8 +607,8 @@ computeSpecialForces(FILE                          *fplog,
  * \param[in]  wcycle        The wallcycle structure
  */
 static inline void launchPmeGpuSpread(gmx_pme_t      *pmedata,
-                                      matrix          box,
-                                      rvec            x[],
+                                      const matrix    box,
+                                      const rvec      x[],
                                       int             flags,
                                       int             pmeFlags,
                                       gmx_wallcycle_t wcycle)
@@ -860,7 +860,7 @@ void do_force(FILE                                     *fplog,
               t_nrnb                                   *nrnb,
               gmx_wallcycle_t                           wcycle,
               const gmx_localtop_t                     *top,
-              matrix                                    box,
+              const matrix                              box,
               gmx::ArrayRefWithPadding<gmx::RVec>       x,     //NOLINT(performance-unnecessary-value-param)
               history_t                                *hist,
               gmx::ArrayRefWithPadding<gmx::RVec>       force, //NOLINT(performance-unnecessary-value-param)
index d74aa558f2180ce34b6154f8b810b2113b9fd2a0..dcfa19d05647fb283a99049b880da838b0119972 100644 (file)
@@ -1938,7 +1938,7 @@ static real do_flex2_lowlevel(
         rvec           x[],
         gmx_bool       bOutstepRot,
         gmx_bool       bOutstepSlab,
-        matrix         box)
+        const matrix   box)
 {
     int             count, ii, iigrp;
     rvec            xj;          /* position in the i-sum                         */
@@ -2185,7 +2185,7 @@ static real do_flex_lowlevel(
         rvec           x[],
         gmx_bool       bOutstepRot,
         gmx_bool       bOutstepSlab,
-        matrix         box)
+        const matrix   box)
 {
     int             count, iigrp;
     rvec            xj, yj0;                /* current and reference position                */
@@ -2523,7 +2523,7 @@ static void do_flexible(
         gmx_enfrot     *enfrot,       /* Other rotation data                        */
         gmx_enfrotgrp  *erg,
         rvec            x[],          /* The local positions                        */
-        matrix          box,
+        const matrix    box,
         double          t,            /* Time in picoseconds                        */
         gmx_bool        bOutstepRot,  /* Output to main rotation output file        */
         gmx_bool        bOutstepSlab) /* Output per-slab data                       */
@@ -2852,7 +2852,7 @@ static void do_radial_motion(
 static void do_radial_motion_pf(
         gmx_enfrotgrp  *erg,
         rvec            x[],          /* The positions                              */
-        matrix          box,          /* The simulation box                         */
+        const matrix    box,          /* The simulation box                         */
         gmx_bool        bOutstepRot,  /* Output to main rotation output file        */
         gmx_bool        bOutstepSlab) /* Output per-slab data                       */
 {
@@ -3056,7 +3056,7 @@ static void radial_motion2_precalc_inner_sum(const gmx_enfrotgrp *erg,
 static void do_radial_motion2(
         gmx_enfrotgrp  *erg,
         rvec            x[],          /* The positions                              */
-        matrix          box,          /* The simulation box                         */
+        const matrix    box,          /* The simulation box                         */
         gmx_bool        bOutstepRot,  /* Output to main rotation output file        */
         gmx_bool        bOutstepSlab) /* Output per-slab data                       */
 {
@@ -3757,7 +3757,7 @@ static void rotate_local_reference(gmx_enfrotgrp *erg)
  * its rotated reference */
 static void choose_pbc_image(rvec x[],
                              gmx_enfrotgrp *erg,
-                             matrix box, int npbcdim)
+                             const matrix box, int npbcdim)
 {
     const auto &localRotationGroupIndex = erg->atomSet->localIndex();
     for (gmx::index i = 0; i < localRotationGroupIndex.ssize(); i++)
@@ -3781,7 +3781,7 @@ static void choose_pbc_image(rvec x[],
 
 void do_rotation(const t_commrec       *cr,
                  gmx_enfrot            *er,
-                 matrix                 box,
+                 const matrix           box,
                  rvec                   x[],
                  real                   t,
                  int64_t                step,
index 9fcb9c27680ca373ccf2ea21858fd30ad9295b43..f231546b4e7184347c03e00b62abfcc3f079e410 100644 (file)
@@ -134,7 +134,7 @@ init_rot(FILE *fplog, t_inputrec *ir, int nfile, const t_filenm fnm[],
  */
 void do_rotation(const t_commrec  *cr,
                  gmx_enfrot       *er,
-                 matrix            box,
+                 const matrix      box,
                  rvec              x[],
                  real              t,
                  int64_t           step,