More const correctness
authorMark Abraham <mark.j.abraham@gmail.com>
Thu, 3 May 2018 20:43:25 +0000 (22:43 +0200)
committerMark Abraham <mark.j.abraham@gmail.com>
Fri, 4 May 2018 09:27:10 +0000 (11:27 +0200)
Also made a bunch of functions have one parameter per line because
expected changes to names and types of parameters will rebase better
this way. Also some may find it easier to read and edit.

Also used a little more ArrayRef while I was there.

Change-Id: I33481e37206c28de178417b7efd9bacb272e9052

40 files changed:
src/gromacs/applied-forces/electricfield.cpp
src/gromacs/applied-forces/tests/electricfield.cpp
src/gromacs/essentialdynamics/edsam.cpp
src/gromacs/essentialdynamics/edsam.h
src/gromacs/ewald/ewald.cpp
src/gromacs/ewald/ewald.h
src/gromacs/ewald/long-range-correction.cpp
src/gromacs/ewald/long-range-correction.h
src/gromacs/gmxlib/chargegroup.cpp
src/gromacs/gmxlib/chargegroup.h
src/gromacs/gmxlib/nonbonded/nb_kernel.h
src/gromacs/gmxlib/nonbonded/nb_kernel_c/nb_kernel_allvsall.cpp
src/gromacs/gmxlib/nonbonded/nonbonded.cpp
src/gromacs/gmxlib/nonbonded/nonbonded.h
src/gromacs/mdlib/constr.cpp
src/gromacs/mdlib/constr.h
src/gromacs/mdlib/force.cpp
src/gromacs/mdlib/force.h
src/gromacs/mdlib/groupcoord.cpp
src/gromacs/mdlib/groupcoord.h
src/gromacs/mdlib/lincs.cpp
src/gromacs/mdlib/lincs.h
src/gromacs/mdlib/ns.cpp
src/gromacs/mdlib/ns.h
src/gromacs/mdlib/qmmm.cpp
src/gromacs/mdlib/qmmm.h
src/gromacs/mdlib/rf_util.cpp
src/gromacs/mdlib/shellfc.cpp
src/gromacs/mdlib/shellfc.h
src/gromacs/mdlib/sim_util.cpp
src/gromacs/mdlib/wall.cpp
src/gromacs/mdrun/md.cpp
src/gromacs/mdrun/minimize.cpp
src/gromacs/mdtypes/iforceprovider.cpp
src/gromacs/mdtypes/iforceprovider.h
src/gromacs/pulling/pull.cpp
src/gromacs/pulling/pull.h
src/gromacs/pulling/pull_rotation.cpp
src/gromacs/pulling/pull_rotation.h
src/gromacs/pulling/pullutil.cpp

index 2c232e5755626e137edf0c399695a71ce3ee69d7..a6b79073afab3dc6c39ee47d9f5d09e22c7fb228 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2017,2018, 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.
@@ -194,12 +194,12 @@ class ElectricField final : public IMDModule,
 
         // From IForceProvider
         //! \copydoc IForceProvider::calculateForces()
-        void calculateForces(const t_commrec       *cr,
-                             const t_mdatoms       *mdatoms,
-                             const matrix           box,
-                             double                 t,
-                             const rvec            *x,
-                             gmx::ForceWithVirial  *forceWithVirial) override;
+        void calculateForces(const t_commrec               *cr,
+                             const t_mdatoms               *mdatoms,
+                             const matrix                   box,
+                             double                         t,
+                             gmx::ArrayRef<const gmx::RVec> x,
+                             gmx::ForceWithVirial          *forceWithVirial) override;
 
     private:
         //! Return whether or not to apply a field
@@ -356,12 +356,14 @@ void ElectricField::printComponents(double t) const
             field(XX, t), field(YY, t), field(ZZ, t));
 }
 
-void ElectricField::calculateForces(const t_commrec       *cr,
-                                    const t_mdatoms       *mdatoms,
-                                    const matrix           /* box */,
-                                    double                 t,
-                                    const rvec             * /* x */,
-                                    gmx::ForceWithVirial  *forceWithVirial)
+using gmx::ArrayRef;
+
+void ElectricField::calculateForces(const t_commrec           *cr,
+                                    const t_mdatoms           *mdatoms,
+                                    const matrix,
+                                    double                     t,
+                                    ArrayRef<const gmx::RVec>,
+                                    gmx::ForceWithVirial      *forceWithVirial)
 {
     if (isActive())
     {
index 65a0c12454b73d11bcedd9816acb963b7ba1f10d..5a9edd39034ed430890d316bfa5b806d600f7f85 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2017,2018, 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.
@@ -115,7 +115,7 @@ class ElectricFieldTest : public ::testing::Test
             md.chargeA[0] = 1;
 
             t_commrec  *cr = init_commrec();
-            forceProviders.calculateForces(cr, &md, nullptr, 0, nullptr, &forceWithVirial);
+            forceProviders.calculateForces(cr, &md, nullptr, 0, gmx::EmptyArrayRef {}, &forceWithVirial);
             done_commrec(cr);
 
             EXPECT_REAL_EQ_TOL(f[0][dim], expectedValue, tolerance);
index b1990e575bc239960b9281797979e582e88b8861..3503109a361c0b8150ca8df96611dbca8f377ce3 100644 (file)
@@ -875,7 +875,7 @@ static void update_adaption(t_edpar *edi)
 
 static void do_single_flood(
         FILE            *edo,
-        rvec             x[],
+        const rvec       x[],
         rvec             force[],
         t_edpar         *edi,
         gmx_int64_t      step,
@@ -980,9 +980,9 @@ static void do_single_flood(
 /* Main flooding routine, called from do_force */
 extern void do_flood(const t_commrec  *cr,
                      const t_inputrec *ir,
-                     rvec              x[],
+                     const rvec        x[],
                      rvec              force[],
-                     gmx_edsam_t       ed,
+                     const gmx_edsam  *ed,
                      matrix            box,
                      gmx_int64_t       step,
                      gmx_bool          bNS)
index 43466797b739125482bb59dba39cbebe1328b2f6..9415744d8124d6e520fd43332afcb1cb29ac740f 100644 (file)
@@ -83,7 +83,7 @@ class Constraints;
  * \param ed                The essential dynamics data.
  */
 void do_edsam(const t_inputrec *ir, gmx_int64_t step,
-              const t_commrec *cr, rvec xs[], rvec v[], matrix box, gmx_edsam_t ed);
+              const t_commrec *cr, rvec xs[], rvec v[], matrix box, gmx_edsam *ed);
 
 
 /*! \brief Initializes the essential dynamics and flooding module.
@@ -134,8 +134,14 @@ void dd_make_local_ed_indices(gmx_domdec_t *dd, gmx_edsam_t ed);
  * \param step              Number of the time step.
  * \param bNS               Are we in a neighbor searching step?
  */
-void do_flood(const t_commrec *cr, const t_inputrec *ir, rvec x[], rvec force[], gmx_edsam_t ed,
-              matrix box, gmx_int64_t step, gmx_bool bNS);
+void do_flood(const t_commrec  *cr,
+              const t_inputrec *ir,
+              const rvec        x[],
+              rvec              force[],
+              const gmx_edsam  *ed,
+              matrix            box,
+              gmx_int64_t       step,
+              gmx_bool          bNS);
 
 /*! \brief Clean up
  *
index f33e68d5ad4c19dd6343ab31ec13077b119759c0..c4481a832b433e5eb7c2918096aea3968872de25 100644 (file)
@@ -103,7 +103,7 @@ static void calc_lll(const rvec box, rvec lll)
 }
 
 //! Make tables for the structure factor parts
-static void tabulateStructureFactors(int natom, rvec x[], int kmax, cvec **eir, rvec lll)
+static void tabulateStructureFactors(int natom, const rvec x[], int kmax, cvec **eir, rvec lll)
 {
     int  i, j, m;
 
@@ -136,21 +136,27 @@ static void tabulateStructureFactors(int natom, rvec x[], int kmax, cvec **eir,
     }
 }
 
-real do_ewald(t_inputrec *ir,
-              rvec x[],        rvec f[],
-              real chargeA[],  real chargeB[],
-              matrix box,
-              const t_commrec *cr, int natoms,
-              matrix lrvir,    real ewaldcoeff,
-              real lambda,     real *dvdlambda,
-              struct gmx_ewald_tab_t *et)
+real do_ewald(const t_inputrec *ir,
+              const rvec        x[],
+              rvec              f[],
+              const real        chargeA[],
+              const real        chargeB[],
+              matrix            box,
+              const t_commrec  *cr,
+              int               natoms,
+              matrix            lrvir,
+              real              ewaldcoeff,
+              real              lambda,
+              real             *dvdlambda,
+              gmx_ewald_tab_t  *et)
 {
-    real     factor     = -1.0/(4*ewaldcoeff*ewaldcoeff);
-    real    *charge, energy_AB[2], energy;
-    rvec     lll;
-    int      lowiy, lowiz, ix, iy, iz, n, q;
-    real     tmp, cs, ss, ak, akv, mx, my, mz, m2, scale;
-    gmx_bool bFreeEnergy;
+    real        factor     = -1.0/(4*ewaldcoeff*ewaldcoeff);
+    const real *charge;
+    real        energy_AB[2], energy;
+    rvec        lll;
+    int         lowiy, lowiz, ix, iy, iz, n, q;
+    real        tmp, cs, ss, ak, akv, mx, my, mz, m2, scale;
+    gmx_bool    bFreeEnergy;
 
     if (cr != nullptr)
     {
index e54780b57fcd383abad42c1a6367702cdce52f02..96faec983b5d491f7ec2409250448d5080ef124c 100644 (file)
@@ -84,14 +84,19 @@ init_ewald_tab(struct gmx_ewald_tab_t **et, const t_inputrec *ir,
 
 /*! \brief Do the long-ranged part of an Ewald calculation */
 real
-do_ewald(t_inputrec *ir,
-         rvec x[],        rvec f[],
-         real chargeA[],  real chargeB[],
-         matrix box,
-         const t_commrec *cr, int natoms,
-         matrix lrvir,   real ewaldcoeff,
-         real lambda,    real *dvdlambda,
-         struct gmx_ewald_tab_t *et);
+do_ewald(const t_inputrec *ir,
+         const rvec        x[],
+         rvec              f[],
+         const real        chargeA[],
+         const real        chargeB[],
+         matrix            box,
+         const t_commrec  *cr,
+         int               natoms,
+         matrix            lrvir,
+         real              ewaldcoeff,
+         real              lambda,
+         real             *dvdlambda,
+         gmx_ewald_tab_t  *et);
 
 /*! \brief Calculate the correction to the Ewald sum, due to a net system
  * charge.
index b1ba5dbd5493e42c697536d668a02c55c71cab9b..6bfc1c46a4d519cbaea5994cc851f1ad02d720e7 100644 (file)
@@ -75,7 +75,8 @@ void ewald_LRcorrection(int numAtomsLocal,
                         real *sigma3A, real *sigma3B,
                         gmx_bool bHaveChargeOrTypePerturbed,
                         gmx_bool calc_excl_corr,
-                        t_blocka *excl, rvec x[],
+                        const t_blocka *excl,
+                        const rvec x[],
                         matrix box, rvec mu_tot[],
                         int ewald_geometry, real epsilon_surface,
                         rvec *f, tensor vir_q, tensor vir_lj,
index 3508ab5f664b6ed8faaac77918956b0a12de2c52..617a0bfac0c9b75ce2325073e8d09fa69e237077 100644 (file)
@@ -79,7 +79,8 @@ ewald_LRcorrection(int numAtomsLocal,
                    real *sigma3A, real *sigma3B,
                    gmx_bool bHaveChargeOrTypePerturbed,
                    gmx_bool calc_excl_corr,
-                   t_blocka *excl, rvec x[],
+                   const t_blocka *excl,
+                   const rvec x[],
                    matrix box, rvec mu_tot[],
                    int ewald_geometry, real epsilon_surface,
                    rvec *f, tensor vir_q, tensor vir_lj,
index fc45a1dc723b67e701bd6788d60c12d048bb0393..dcb2b656466e8156f673b48d8305e4130a259642 100644 (file)
@@ -185,7 +185,7 @@ void calc_cgcm(FILE gmx_unused *fplog, int cg0, int cg1, const t_block *cgs,
 }
 
 void put_charge_groups_in_box(FILE gmx_unused *fplog, int cg0, int cg1,
-                              int ePBC, matrix box, t_block *cgs,
+                              int ePBC, matrix box, const t_block *cgs,
                               rvec pos[], rvec cg_cm[])
 
 {
index f22c772bea36fcac61309a9b003f3fc4ff821636..231b190079aac5c32527cfa6f37aaa7640fa3521 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) 2010,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2010,2014,2015,2018, 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.
@@ -59,7 +59,7 @@ void calc_cgcm(FILE *log, int cg0, int cg1, const t_block *cgs,
  */
 
 void put_charge_groups_in_box (FILE *log, int cg0, int cg1,
-                               int ePBC, matrix box, t_block *cgs,
+                               int ePBC, matrix box, const t_block *cgs,
                                rvec pos[],
                                rvec cg_cm[]);
 /* This routine puts charge groups in the periodic box, keeping them
index e85b6a251912c1db7a736d6e8eeba3a6e2fe99f4..643ac97af7100b1bd80b21315af40e726619c46c 100644 (file)
@@ -74,7 +74,7 @@ extern "C" {
 typedef struct
 {
     int                flags;
-    t_blocka *         exclusions;
+    const t_blocka    *exclusions;
     real *             lambda;
     real *             dvdl;
 
@@ -94,8 +94,8 @@ typedef void
     nb_kernel_t (t_nblist *                nlist,
                  rvec *                    x,
                  rvec *                    f,
-                 struct t_forcerec *       fr,
-                 t_mdatoms *               mdatoms,
+                 const struct t_forcerec * fr,
+                 const t_mdatoms *         mdatoms,
                  nb_kernel_data_t *        kernel_data,
                  t_nrnb *                  nrnb);
 
index 45ba18b20dff014a9000932b558a4ce4e428e8f4..497be54f41322a524676b6e2ac681b7430b1b895 100644 (file)
@@ -109,7 +109,7 @@ calc_maxoffset(int i, int natoms)
 
 static void
 setup_exclusions_and_indices(gmx_allvsall_data_t *   aadata,
-                             t_blocka *              excl,
+                             const t_blocka *        excl,
                              int                     natoms)
 {
     int i, j, k, iexcl;
@@ -200,7 +200,7 @@ setup_exclusions_and_indices(gmx_allvsall_data_t *   aadata,
 
 static void
 setup_aadata(gmx_allvsall_data_t **  p_aadata,
-             t_blocka *              excl,
+             const t_blocka *        excl,
              int                     natoms,
              int *                   type,
              int                     ntype,
@@ -265,7 +265,7 @@ nb_kernel_allvsall(t_nblist gmx_unused *     nlist,
     real                 vcoul, vctot;
     real                 c6, c12, Vvdw6, Vvdw12, Vvdwtot;
     real                 fscal;
-    t_blocka           * excl;
+    const t_blocka      *excl;
     real           *     f;
     real           *     x;
     real           *     Vvdw;
index aba9e8f7355dafa82660dfa68346a7c75184617c..68f5f9a723e85e38be0103796093a2ea3a050097 100644 (file)
@@ -316,11 +316,18 @@ gmx_nonbonded_set_kernel_pointers(FILE *log, t_nblist *nl, gmx_bool bElecAndVdwS
     return;
 }
 
-void do_nonbonded(t_forcerec *fr,
-                  rvec x[], rvec f_shortrange[], t_mdatoms *mdatoms, t_blocka *excl,
+void do_nonbonded(const t_forcerec  *fr,
+                  rvec               x[],
+                  rvec               f_shortrange[],
+                  const t_mdatoms   *mdatoms,
+                  const t_blocka    *excl,
                   gmx_grppairener_t *grppener,
-                  t_nrnb *nrnb, real *lambda, real *dvdl,
-                  int nls, int eNL, int flags)
+                  t_nrnb            *nrnb,
+                  real              *lambda,
+                  real              *dvdl,
+                  int                nls,
+                  int                eNL,
+                  int                flags)
 {
     t_nblist *        nlist;
     int               n, n0, n1, i, i0, i1;
index 5a3bbf1b0395fbcbaa3d1233363c990ed5b635fe..6dccff7c30aa97078c52b5d016a36ade1135b5b0 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, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2018, 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.
@@ -69,10 +69,17 @@ gmx_nonbonded_set_kernel_pointers(FILE *       fplog,
 #define GMX_NONBONDED_DO_SR             (1<<5)
 
 void
-do_nonbonded(t_forcerec *fr,
-             rvec x[], rvec f_shortrange[], t_mdatoms *md, t_blocka *excl,
+do_nonbonded(const t_forcerec  *fr,
+             rvec               x[],
+             rvec               f_shortrange[],
+             const t_mdatoms   *md,
+             const t_blocka    *excl,
              gmx_grppairener_t *grppener,
-             t_nrnb *nrnb, real *lambda, real dvdlambda[],
-             int nls, int eNL, int flags);
+             t_nrnb            *nrnb,
+             real              *lambda,
+             real               dvdlambda[],
+             int                nls,
+             int                eNL,
+             int                flags);
 
 #endif
index 7b006bac1a810c67446a6e3f11dc8a7aaa76884a..f3921463e67d752a1122463d56004a2078d7e5f3 100644 (file)
@@ -239,28 +239,28 @@ static void dump_confs(FILE *fplog, gmx_int64_t step, const gmx_mtop_t *mtop,
 
 bool constrain(FILE *fplog, bool bLog, bool bEner,
                Constraints *constr,
-               t_idef *idef, const t_inputrec *ir,
+               const t_idef *idef, const t_inputrec *ir,
                const t_commrec *cr,
                const gmx_multisim_t *ms,
                gmx_int64_t step, int delta_step,
                real step_scaling,
-               t_mdatoms *md,
+               const t_mdatoms *md,
                rvec *x, rvec *xprime, rvec *min_proj,
                bool bMolPBC, matrix box,
                real lambda, real *dvdlambda,
                rvec *v, tensor *vir,
                t_nrnb *nrnb, int econq)
 {
-    bool        bOK, bDump;
-    int         start, homenr;
-    tensor      vir_r_m_dr;
-    real        scaled_delta_t;
-    real        invdt, vir_fac = 0, t;
-    t_ilist    *settle;
-    int         nsettle;
-    t_pbc       pbc, *pbc_null;
-    char        buf[22];
-    int         nth, th;
+    bool           bOK, bDump;
+    int            start, homenr;
+    tensor         vir_r_m_dr;
+    real           scaled_delta_t;
+    real           invdt, vir_fac = 0, t;
+    const t_ilist *settle;
+    int            nsettle;
+    t_pbc          pbc, *pbc_null;
+    char           buf[22];
+    int            nth, th;
 
     if (econq == econqForceDispl && !EI_ENERGY_MINIMIZATION(ir->eI))
     {
index a0d86431360e77e61cff2231a44cf0611567a06e..eaae1e36d3121f7a2d498989b3441246115fc192 100644 (file)
@@ -123,13 +123,13 @@ void too_many_constraint_warnings(int eConstrAlg, int warncount);
  */
 bool constrain(FILE *log, bool bLog, bool bEner,
                Constraints *constr,
-               t_idef *idef,
+               const t_idef *idef,
                const t_inputrec *ir,
                const t_commrec *cr,
                const gmx_multisim_t *ms,
                gmx_int64_t step, int delta_step,
                real step_scaling,
-               t_mdatoms *md,
+               const t_mdatoms *md,
                rvec *x, rvec *xprime, rvec *min_proj,
                bool bMolPBC, matrix box,
                real lambda, real *dvdlambda,
index 0850c34602761acea93a0cb0dbefc9b779875531..416c95c3cd5225fdc943b512c964f363d733ccc6 100644 (file)
 #include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/smalloc.h"
 
-void ns(FILE              *fp,
-        t_forcerec        *fr,
-        matrix             box,
-        gmx_groups_t      *groups,
-        gmx_localtop_t    *top,
-        t_mdatoms         *md,
-        const t_commrec   *cr,
-        t_nrnb            *nrnb,
-        gmx_bool           bFillGrid)
+void ns(FILE               *fp,
+        t_forcerec         *fr,
+        matrix              box,
+        const gmx_groups_t *groups,
+        gmx_localtop_t     *top,
+        const t_mdatoms    *md,
+        const t_commrec    *cr,
+        t_nrnb             *nrnb,
+        gmx_bool            bFillGrid)
 {
     int     nsearch;
 
@@ -134,24 +134,28 @@ static void reduceEwaldThreadOuput(int nthreads, ewald_corr_thread_t *ewc_t)
     }
 }
 
-void do_force_lowlevel(t_forcerec *fr,      t_inputrec *ir,
-                       t_idef     *idef,    const t_commrec *cr,
+void do_force_lowlevel(t_forcerec           *fr,
+                       const t_inputrec     *ir,
+                       const t_idef         *idef,
+                       const t_commrec      *cr,
                        const gmx_multisim_t *ms,
-                       t_nrnb     *nrnb,    gmx_wallcycle_t wcycle,
-                       t_mdatoms  *md,
-                       rvec       x[],      history_t  *hist,
-                       rvec      *forceForUseWithShiftForces,
+                       t_nrnb               *nrnb,
+                       gmx_wallcycle_t       wcycle,
+                       const t_mdatoms      *md,
+                       rvec                  x[],
+                       history_t            *hist,
+                       rvec                 *forceForUseWithShiftForces,
                        gmx::ForceWithVirial *forceWithVirial,
-                       gmx_enerdata_t *enerd,
-                       t_fcdata   *fcd,
-                       matrix     box,
-                       t_lambda   *fepvals,
-                       real       *lambda,
-                       t_graph    *graph,
-                       t_blocka   *excl,
-                       rvec       mu_tot[],
-                       int        flags,
-                       float     *cycles_pme)
+                       gmx_enerdata_t       *enerd,
+                       t_fcdata             *fcd,
+                       matrix                box,
+                       t_lambda             *fepvals,
+                       real                 *lambda,
+                       const t_graph        *graph,
+                       const t_blocka       *excl,
+                       rvec                  mu_tot[],
+                       int                   flags,
+                       float                *cycles_pme)
 {
     int         i, j;
     int         donb_flags;
index 55e889c07700fb0d18eaacea5d22a02f6bedd6c8..34075da9ce248c390fbc195a53a3483b61348db3 100644 (file)
@@ -79,10 +79,16 @@ void f_calc_vir(int i0, int i1, rvec x[], rvec f[], tensor vir,
                 t_graph *g, rvec shift_vec[]);
 /* Calculate virial taking periodicity into account */
 
-real RF_excl_correction(const t_forcerec *fr, t_graph *g,
-                        const t_mdatoms *mdatoms, const t_blocka *excl,
-                        rvec x[], rvec f[], rvec *fshift, const t_pbc *pbc,
-                        real lambda, real *dvdlambda);
+real RF_excl_correction(const t_forcerec *fr,
+                        const t_graph    *g,
+                        const t_mdatoms  *mdatoms,
+                        const t_blocka   *excl,
+                        rvec              x[],
+                        rvec              f[],
+                        rvec             *fshift,
+                        const t_pbc      *pbc,
+                        real              lambda,
+                        real             *dvdlambda);
 /* Calculate the reaction-field energy correction for this node:
  * epsfac q_i q_j (k_rf r_ij^2 - c_rf)
  * and force correction for all excluded pairs, including self pairs.
@@ -106,8 +112,15 @@ void make_wall_tables(FILE *fplog,
                       const gmx_groups_t *groups,
                       t_forcerec *fr);
 
-real do_walls(t_inputrec *ir, t_forcerec *fr, matrix box, t_mdatoms *md,
-              rvec x[], rvec f[], real lambda, real Vlj[], t_nrnb *nrnb);
+real do_walls(const t_inputrec *ir,
+              t_forcerec       *fr,
+              matrix            box,
+              const t_mdatoms  *md,
+              const rvec        x[],
+              rvec              f[],
+              real              lambda,
+              real              Vlj[],
+              t_nrnb           *nrnb);
 
 gmx_bool can_use_allvsall(const t_inputrec *ir,
                           gmx_bool bPrintNote, const t_commrec *cr, FILE *fp);
@@ -152,22 +165,34 @@ void sum_dhdl(gmx_enerdata_t *enerd, gmx::ArrayRef<const real> lambda, t_lambda
 void set_avcsixtwelve(FILE *fplog, t_forcerec *fr,
                       const gmx_mtop_t *mtop);
 
-void do_force(FILE *log, const t_commrec *cr,
-              const gmx_multisim_t *ms,
-              t_inputrec *inputrec,
-              gmx_int64_t step, struct t_nrnb *nrnb, gmx_wallcycle_t wcycle,
-              gmx_localtop_t *top,
-              gmx_groups_t *groups,
-              matrix box, gmx::PaddedArrayRef<gmx::RVec> coordinates, history_t *hist,
-              gmx::PaddedArrayRef<gmx::RVec> force,
-              tensor vir_force,
-              t_mdatoms *mdatoms,
-              gmx_enerdata_t *enerd, t_fcdata *fcd,
-              gmx::ArrayRef<real> lambda, t_graph *graph,
-              t_forcerec *fr,
-              gmx_vsite_t *vsite, rvec mu_tot,
-              double t, struct gmx_edsam *ed,
-              int flags,
+void do_force(FILE                                     *log,
+              const t_commrec                          *cr,
+              const gmx_multisim_t                     *ms,
+              const t_inputrec                         *inputrec,
+              gmx_int64_t                               step,
+              t_nrnb                                   *nrnb,
+              gmx_wallcycle_t                           wcycle,
+              // TODO top can be const when the group scheme no longer
+              // builds exclusions during neighbor searching within
+              // do_force_cutsGROUP.
+              gmx_localtop_t                           *top,
+              const gmx_groups_t                       *groups,
+              matrix                                    box,
+              gmx::PaddedArrayRef<gmx::RVec>            coordinates,
+              history_t                                *hist,
+              gmx::PaddedArrayRef<gmx::RVec>            force,
+              tensor                                    vir_force,
+              const t_mdatoms                          *mdatoms,
+              gmx_enerdata_t                           *enerd,
+              t_fcdata                                 *fcd,
+              gmx::ArrayRef<real>                       lambda,
+              t_graph                                  *graph,
+              t_forcerec                               *fr,
+              const gmx_vsite_t                        *vsite,
+              rvec                                      mu_tot,
+              double                                    t,
+              const gmx_edsam                          *ed,
+              int                                       flags,
               DdOpenBalanceRegionBeforeForceComputation ddOpenBalanceRegion,
               DdCloseBalanceRegionAfterForceComputation ddCloseBalanceRegion);
 
@@ -180,25 +205,25 @@ void do_force(FILE *log, const t_commrec *cr,
  * f is always required.
  */
 
-void ns(FILE              *fplog,
-        t_forcerec        *fr,
-        matrix             box,
-        gmx_groups_t      *groups,
-        gmx_localtop_t    *top,
-        t_mdatoms         *md,
-        const t_commrec   *cr,
-        t_nrnb            *nrnb,
-        gmx_bool           bFillGrid);
+void ns(FILE               *fplog,
+        t_forcerec         *fr,
+        matrix              box,
+        const gmx_groups_t *groups,
+        gmx_localtop_t     *top,
+        const t_mdatoms    *md,
+        const t_commrec    *cr,
+        t_nrnb             *nrnb,
+        gmx_bool            bFillGrid);
 /* Call the neighborsearcher */
 
 void do_force_lowlevel(t_forcerec   *fr,
-                       t_inputrec   *ir,
-                       t_idef       *idef,
+                       const t_inputrec *ir,
+                       const t_idef *idef,
                        const t_commrec *cr,
                        const gmx_multisim_t *ms,
                        t_nrnb       *nrnb,
                        gmx_wallcycle_t wcycle,
-                       t_mdatoms    *md,
+                       const t_mdatoms *md,
                        rvec         x[],
                        history_t    *hist,
                        rvec         f_shortrange[],
@@ -208,8 +233,8 @@ void do_force_lowlevel(t_forcerec   *fr,
                        matrix       box,
                        t_lambda     *fepvals,
                        real         *lambda,
-                       t_graph      *graph,
-                       t_blocka     *excl,
+                       const t_graph *graph,
+                       const t_blocka *excl,
                        rvec         mu_tot[2],
                        int          flags,
                        float        *cycles_pme);
index 7444e6855fbcebe003b2d569983466a8dfd9a39e..b1b6d48c107f9bf59b8769da96613912ca1bde3c 100644 (file)
@@ -199,7 +199,7 @@ extern void communicate_group_positions(
         ivec            *shifts,       /* Collective array of shifts for xcoll (can be NULL) */
         ivec            *extra_shifts, /* (optional) Extra shifts since last time step */
         const gmx_bool   bNS,          /* (optional) NS step, the shifts have changed */
-        rvec            *x_loc,        /* Local positions on this node */
+        const rvec      *x_loc,        /* Local positions on this node */
         const int        nr,           /* Total number of atoms in the group */
         const int        nr_loc,       /* Local number of atoms in the group */
         int             *anrs_loc,     /* Local atom numbers */
index 51c13b9334f540b5c75f15326ee197fa00684cfc..a61b3e172b440ae5ab96d046c62d3e902d4d6df2 100644 (file)
@@ -129,7 +129,7 @@ extern void dd_make_local_group_indices(gmx_ga2la_t *ga2la,
  */
 extern void communicate_group_positions(const t_commrec *cr, rvec *xcoll, ivec *shifts,
                                         ivec *extra_shifts, const gmx_bool bNS,
-                                        rvec *x_loc, const int nr, const int nr_loc,
+                                        const rvec *x_loc, const int nr, const int nr_loc,
                                         int *anrs_loc, int *coll_ind, rvec *xcoll_old,
                                         matrix box);
 
index 3b440e7f31373c6937760a109cbbc3b1a9cad302..c0c02c895cce0b8190f02211ae3b1f39a1411840 100644 (file)
@@ -2402,7 +2402,7 @@ static void cconerr(const Lincs *lincsd,
 bool constrain_lincs(FILE *fplog, bool bLog, bool bEner,
                      const t_inputrec *ir,
                      gmx_int64_t step,
-                     Lincs *lincsd, t_mdatoms *md,
+                     Lincs *lincsd, const t_mdatoms *md,
                      const t_commrec *cr,
                      const gmx_multisim_t *ms,
                      rvec *x, rvec *xprime, rvec *min_proj,
index 7e61f763454c6187e0cb3813e00ef9ea55161eae..60102e9b5e07d08877bbd1b52388fb5a00599a01 100644 (file)
@@ -89,7 +89,7 @@ bool
 constrain_lincs(FILE *log, bool bLog, bool bEner,
                 const t_inputrec *ir,
                 gmx_int64_t step,
-                Lincs *lincsd, t_mdatoms *md,
+                Lincs *lincsd, const t_mdatoms *md,
                 const t_commrec *cr,
                 const gmx_multisim_t *ms,
                 rvec *x, rvec *xprime, rvec *min_proj,
index e3e792f43bcb9f0a1534c6016f50bff8790de205..ad8f04fec21877aa20c2f35794184aa58c3718f4 100644 (file)
@@ -528,7 +528,7 @@ static inline void add_j_to_nblist_cg(t_nblist *nlist,
 typedef void
     put_in_list_t (gmx_bool              bHaveVdW[],
                    int                   ngid,
-                   t_mdatoms     *       md,
+                   const t_mdatoms      *md,
                    int                   icg,
                    int                   jgid,
                    int                   nj,
@@ -544,7 +544,7 @@ typedef void
 static void
 put_in_list_at(gmx_bool              bHaveVdW[],
                int                   ngid,
-               t_mdatoms     *       md,
+               const t_mdatoms      *md,
                int                   icg,
                int                   jgid,
                int                   nj,
@@ -1050,7 +1050,7 @@ put_in_list_at(gmx_bool              bHaveVdW[],
 static void
 put_in_list_qmmm(gmx_bool gmx_unused              bHaveVdW[],
                  int                              ngid,
-                 t_mdatoms gmx_unused     *       md,
+                 const t_mdatoms                  * /* md */,
                  int                              icg,
                  int                              jgid,
                  int                              nj,
@@ -1114,7 +1114,7 @@ put_in_list_qmmm(gmx_bool gmx_unused              bHaveVdW[],
 static void
 put_in_list_cg(gmx_bool  gmx_unused             bHaveVdW[],
                int                              ngid,
-               t_mdatoms  gmx_unused    *       md,
+               const t_mdatoms                  * /* md */,
                int                              icg,
                int                              jgid,
                int                              nj,
@@ -1338,10 +1338,19 @@ static real calc_image_rect(rvec xi, rvec xj, rvec box_size,
     return r2;
 }
 
-static void add_simple(t_ns_buf * nsbuf, int nrj, int cg_j,
-                       gmx_bool bHaveVdW[], int ngid, t_mdatoms *md,
-                       int icg, int jgid, t_block *cgs, t_excl bexcl[],
-                       int shift, t_forcerec *fr, put_in_list_t *put_in_list)
+static void add_simple(t_ns_buf       * nsbuf,
+                       int              nrj,
+                       int              cg_j,
+                       gmx_bool         bHaveVdW[],
+                       int              ngid,
+                       const t_mdatoms *md,
+                       int              icg,
+                       int              jgid,
+                       t_block         *cgs,
+                       t_excl           bexcl[],
+                       int              shift,
+                       t_forcerec      *fr,
+                       put_in_list_t   *put_in_list)
 {
     if (nsbuf->nj + nrj > MAX_CG)
     {
@@ -1354,13 +1363,22 @@ static void add_simple(t_ns_buf * nsbuf, int nrj, int cg_j,
     nsbuf->nj               += nrj;
 }
 
-static void ns_inner_tric(rvec x[], int icg, int *i_egp_flags,
-                          int njcg, int jcg[],
-                          matrix box, rvec b_inv, real rcut2,
-                          t_block *cgs, t_ns_buf **ns_buf,
-                          gmx_bool bHaveVdW[], int ngid, t_mdatoms *md,
-                          t_excl bexcl[], t_forcerec *fr,
-                          put_in_list_t *put_in_list)
+static void ns_inner_tric(rvec             x[],
+                          int              icg,
+                          int             *i_egp_flags,
+                          int              njcg,
+                          int              jcg[],
+                          matrix           box,
+                          rvec             b_inv,
+                          real             rcut2,
+                          t_block         *cgs,
+                          t_ns_buf       **ns_buf,
+                          gmx_bool         bHaveVdW[],
+                          int              ngid,
+                          const t_mdatoms *md,
+                          t_excl           bexcl[],
+                          t_forcerec      *fr,
+                          put_in_list_t   *put_in_list)
 {
     int       shift;
     int       j, nrj, jgid;
@@ -1386,13 +1404,23 @@ static void ns_inner_tric(rvec x[], int icg, int *i_egp_flags,
     }
 }
 
-static void ns_inner_rect(rvec x[], int icg, int *i_egp_flags,
-                          int njcg, int jcg[],
-                          gmx_bool bBox, rvec box_size, rvec b_inv, real rcut2,
-                          t_block *cgs, t_ns_buf **ns_buf,
-                          gmx_bool bHaveVdW[], int ngid, t_mdatoms *md,
-                          t_excl bexcl[], t_forcerec *fr,
-                          put_in_list_t *put_in_list)
+static void ns_inner_rect(rvec             x[],
+                          int              icg,
+                          int             *i_egp_flags,
+                          int              njcg,
+                          int              jcg[],
+                          gmx_bool         bBox,
+                          rvec             box_size,
+                          rvec             b_inv,
+                          real             rcut2,
+                          t_block         *cgs,
+                          t_ns_buf       **ns_buf,
+                          gmx_bool         bHaveVdW[],
+                          int              ngid,
+                          const t_mdatoms *md,
+                          t_excl           bexcl[],
+                          t_forcerec      *fr,
+                          put_in_list_t   *put_in_list)
 {
     int       shift;
     int       j, nrj, jgid;
@@ -1441,13 +1469,17 @@ static void ns_inner_rect(rvec x[], int icg, int *i_egp_flags,
 
 /* ns_simple_core needs to be adapted for QMMM still 2005 */
 
-static int ns_simple_core(t_forcerec *fr,
-                          gmx_localtop_t *top,
-                          t_mdatoms *md,
-                          matrix box, rvec box_size,
-                          t_excl bexcl[], int *aaj,
-                          int ngid, t_ns_buf **ns_buf,
-                          put_in_list_t *put_in_list, gmx_bool bHaveVdW[])
+static int ns_simple_core(t_forcerec      *fr,
+                          gmx_localtop_t  *top,
+                          const t_mdatoms *md,
+                          matrix           box,
+                          rvec             box_size,
+                          t_excl           bexcl[],
+                          int             *aaj,
+                          int              ngid,
+                          t_ns_buf       **ns_buf,
+                          put_in_list_t   *put_in_list,
+                          gmx_bool         bHaveVdW[])
 {
     int          naaj, k;
     real         rlist2;
@@ -1668,42 +1700,45 @@ static void init_nsgrid_lists(t_forcerec *fr, int ngid, gmx_ns_t *ns)
     }
 }
 
-static int nsgrid_core(const t_commrec *cr, t_forcerec *fr,
-                       matrix box, int ngid,
-                       gmx_localtop_t *top,
-                       t_grid *grid,
-                       t_excl bexcl[], gmx_bool *bExcludeAlleg,
-                       t_mdatoms *md,
-                       put_in_list_t *put_in_list,
-                       gmx_bool bHaveVdW[],
-                       gmx_bool bMakeQMMMnblist)
+static int nsgrid_core(const t_commrec *cr,
+                       t_forcerec      *fr,
+                       matrix           box,
+                       int              ngid,
+                       gmx_localtop_t  *top,
+                       t_grid          *grid,
+                       t_excl           bexcl[],
+                       gmx_bool        *bExcludeAlleg,
+                       const t_mdatoms *md,
+                       put_in_list_t   *put_in_list,
+                       gmx_bool         bHaveVdW[],
+                       gmx_bool         bMakeQMMMnblist)
 {
-    gmx_ns_t     *ns;
-    int         **nl_sr;
-    int          *nsr;
-    gmx_domdec_t *dd;
-    t_block      *cgs    = &(top->cgs);
-    int          *cginfo = fr->cginfo;
+    gmx_ns_t      *ns;
+    int          **nl_sr;
+    int           *nsr;
+    gmx_domdec_t  *dd;
+    const t_block *cgs    = &(top->cgs);
+    int           *cginfo = fr->cginfo;
     /* int *i_atoms,*cgsindex=cgs->index; */
-    ivec          sh0, sh1, shp;
-    int           cell_x, cell_y, cell_z;
-    int           d, tx, ty, tz, dx, dy, dz, cj;
+    ivec           sh0, sh1, shp;
+    int            cell_x, cell_y, cell_z;
+    int            d, tx, ty, tz, dx, dy, dz, cj;
 #ifdef ALLOW_OFFDIAG_LT_HALFDIAG
-    int           zsh_ty, zsh_tx, ysh_tx;
+    int            zsh_ty, zsh_tx, ysh_tx;
 #endif
-    int           dx0, dx1, dy0, dy1, dz0, dz1;
-    int           Nx, Ny, Nz, shift = -1, j, nrj, nns, nn = -1;
-    real          gridx, gridy, gridz, grid_x, grid_y;
-    real         *dcx2, *dcy2, *dcz2;
-    int           zgi, ygi, xgi;
-    int           cg0, cg1, icg = -1, cgsnr, i0, igid, naaj, max_jcg;
-    int           jcg0, jcg1, jjcg, cgj0, jgid;
-    int          *grida, *gridnra, *gridind;
-    rvec         *cgcm, grid_offset;
-    real          r2, rs2, XI, YI, ZI, tmp1, tmp2;
-    int          *i_egp_flags;
-    gmx_bool      bDomDec, bTriclinicX, bTriclinicY;
-    ivec          ncpddc;
+    int            dx0, dx1, dy0, dy1, dz0, dz1;
+    int            Nx, Ny, Nz, shift = -1, j, nrj, nns, nn = -1;
+    real           gridx, gridy, gridz, grid_x, grid_y;
+    real          *dcx2, *dcy2, *dcz2;
+    int            zgi, ygi, xgi;
+    int            cg0, cg1, icg = -1, cgsnr, i0, igid, naaj, max_jcg;
+    int            jcg0, jcg1, jjcg, cgj0, jgid;
+    int           *grida, *gridnra, *gridind;
+    rvec          *cgcm, grid_offset;
+    real           r2, rs2, XI, YI, ZI, tmp1, tmp2;
+    int           *i_egp_flags;
+    gmx_bool       bDomDec, bTriclinicX, bTriclinicY;
+    ivec           ncpddc;
 
     ns = fr->ns;
 
@@ -2173,15 +2208,17 @@ void done_ns(gmx_ns_t *ns, int numEnergyGroups)
     sfree(ns);
 }
 
-int search_neighbours(FILE *log, t_forcerec *fr,
-                      matrix box,
-                      gmx_localtop_t *top,
-                      gmx_groups_t *groups,
-                      const t_commrec *cr,
-                      t_nrnb *nrnb, t_mdatoms *md,
-                      gmx_bool bFillGrid)
+int search_neighbours(FILE               *log,
+                      t_forcerec         *fr,
+                      matrix              box,
+                      gmx_localtop_t     *top,
+                      const gmx_groups_t *groups,
+                      const t_commrec    *cr,
+                      t_nrnb             *nrnb,
+                      const t_mdatoms    *md,
+                      gmx_bool            bFillGrid)
 {
-    t_block            *cgs = &(top->cgs);
+    const t_block      *cgs = &(top->cgs);
     rvec                box_size, grid_x0, grid_x1;
     int                 m, ngid;
     real                min_size, grid_dens;
index 06b51346a50e08fc4aaa697f59d6032ac5321d18..da55cfb783299b46369d6669c3df071f9137bd07 100644 (file)
@@ -86,12 +86,15 @@ void init_ns(FILE *fplog, const t_commrec *cr,
 //! Destructor.
 void done_ns(gmx_ns_t *ns, int numEnergyGroups);
 
-int search_neighbours(FILE *log, t_forcerec *fr, matrix box,
-                      gmx_localtop_t *top,
-                      gmx_groups_t *groups,
-                      const t_commrec *cr,
-                      t_nrnb *nrnb, t_mdatoms *md,
-                      gmx_bool bFillGrid);
+int search_neighbours(FILE               *log,
+                      t_forcerec         *fr,
+                      matrix              box,
+                      gmx_localtop_t     *top,
+                      const gmx_groups_t *groups,
+                      const t_commrec    *cr,
+                      t_nrnb             *nrnb,
+                      const t_mdatoms    *md,
+                      gmx_bool            bFillGrid);
 
 
 /* Debugging routines from wnblist.c */
index 22b5543975fbe5d199a1b8df42d5adb4b289e8f8..062c1ebf0213de8409c221f3fae0175c93412f7c 100644 (file)
@@ -80,7 +80,7 @@ void
 init_gamess(const t_commrec *cr, t_QMrec *qm, t_MMrec *mm);
 
 real
-call_gamess(t_forcerec *fr,
+call_gamess(const t_forcerec *fr,
             t_QMrec *qm, t_MMrec *mm, rvec f[], rvec fshift[]);
 
 #elif GMX_QMMM_MOPAC
@@ -102,10 +102,10 @@ void
 init_gaussian(t_QMrec *qm);
 
 real
-call_gaussian_SH(t_forcerec *fr, t_QMrec *qm, t_MMrec *mm, rvec f[], rvec fshift[]);
+call_gaussian_SH(const t_forcerec *fr, t_QMrec *qm, t_MMrec *mm, rvec f[], rvec fshift[]);
 
 real
-call_gaussian(t_forcerec *fr, t_QMrec *qm, t_MMrec *mm, rvec f[], rvec fshift[]);
+call_gaussian(const t_forcerec *fr, t_QMrec *qm, t_MMrec *mm, rvec f[], rvec fshift[]);
 
 #elif GMX_QMMM_ORCA
 #include "gromacs/mdlib/qm_orca.h"
@@ -130,7 +130,7 @@ static int struct_comp(const void *a, const void *b)
 
 } /* struct_comp */
 
-static real call_QMroutine(const t_commrec gmx_unused *cr, t_forcerec gmx_unused *fr, t_QMrec gmx_unused *qm,
+static real call_QMroutine(const t_commrec gmx_unused *cr, const t_forcerec gmx_unused *fr, t_QMrec gmx_unused *qm,
                            t_MMrec gmx_unused *mm, rvec gmx_unused f[], rvec gmx_unused fshift[])
 {
     /* makes a call to the requested QM routine (qm->QMmethod)
@@ -211,7 +211,7 @@ static void init_QMroutine(const t_commrec gmx_unused *cr, t_QMrec gmx_unused *q
     }
 } /* init_QMroutine */
 
-static void update_QMMM_coord(const rvec *x, t_forcerec *fr, t_QMrec *qm, t_MMrec *mm)
+static void update_QMMM_coord(const rvec *x, const t_forcerec *fr, t_QMrec *qm, t_MMrec *mm)
 {
     /* shifts the QM and MM particles into the central box and stores
      * these shifted coordinates in the coordinate arrays of the
@@ -360,10 +360,10 @@ t_QMMMrec *mk_QMMMrec(void)
 
 } /* mk_QMMMrec */
 
-void init_QMMMrec(const t_commrec *cr,
-                  gmx_mtop_t      *mtop,
-                  t_inputrec      *ir,
-                  t_forcerec      *fr)
+void init_QMMMrec(const t_commrec  *cr,
+                  gmx_mtop_t       *mtop,
+                  t_inputrec       *ir,
+                  const t_forcerec *fr)
 {
     /* we put the atomsnumbers of atoms that belong to the QMMM group in
      * an array that will be copied later to QMMMrec->indexQM[..]. Also
@@ -582,11 +582,11 @@ void init_QMMMrec(const t_commrec *cr,
     }
 } /* init_QMMMrec */
 
-void update_QMMMrec(const t_commrec *cr,
-                    t_forcerec      *fr,
-                    const rvec      *x,
-                    const t_mdatoms *md,
-                    const matrix     box)
+void update_QMMMrec(const t_commrec  *cr,
+                    const t_forcerec *fr,
+                    const rvec       *x,
+                    const t_mdatoms  *md,
+                    const matrix      box)
 {
     /* updates the coordinates of both QM atoms and MM atoms and stores
      * them in the QMMMrec.
@@ -852,9 +852,9 @@ void update_QMMMrec(const t_commrec *cr,
 } /* update_QMMM_rec */
 
 
-real calculate_QMMM(const t_commrec *cr,
-                    rvec             f[],
-                    t_forcerec      *fr)
+real calculate_QMMM(const t_commrec  *cr,
+                    rvec              f[],
+                    const t_forcerec *fr)
 {
     real
         QMener = 0.0;
index 714646e415f260c2a909b00a3feeb2ab4f4f9521..568957bc1308d06b27a6d5b4a2268f1f51e42c3f 100644 (file)
@@ -109,10 +109,10 @@ void atomic_number(int nr, char ***atomtype, int *nucnum);
 t_QMMMrec *mk_QMMMrec(void);
 /* allocates memory for QMMMrec */
 
-void init_QMMMrec(const t_commrec *cr,
-                  gmx_mtop_t      *mtop,
-                  t_inputrec      *ir,
-                  t_forcerec      *fr);
+void init_QMMMrec(const t_commrec  *cr,
+                  gmx_mtop_t       *mtop,
+                  t_inputrec       *ir,
+                  const t_forcerec *fr);
 
 /* init_QMMMrec initializes the QMMM record. From
  * topology->atoms.atomname and topology->atoms.atomtype the atom
@@ -121,11 +121,11 @@ void init_QMMMrec(const t_commrec *cr,
  * and md->cQMMM gives numbers of the MM and QM atoms
  */
 
-void update_QMMMrec(const t_commrec *cr,
-                    t_forcerec      *fr,
-                    const rvec      *x,
-                    const t_mdatoms *md,
-                    const matrix     box);
+void update_QMMMrec(const t_commrec  *cr,
+                    const t_forcerec *fr,
+                    const rvec       *x,
+                    const t_mdatoms  *md,
+                    const matrix      box);
 
 /* update_QMMMrec fills the MM stuff in QMMMrec. The MM atoms are
  * taken froom the neighbourlists of the QM atoms. In a QMMM run this
@@ -133,9 +133,9 @@ void update_QMMMrec(const t_commrec *cr,
  * elements of the t_QMMMrec struct.
  */
 
-real calculate_QMMM(const t_commrec *cr,
-                    rvec             f[],
-                    t_forcerec      *fr);
+real calculate_QMMM(const t_commrec  *cr,
+                    rvec              f[],
+                    const t_forcerec *fr);
 
 /* QMMM computes the QM forces. This routine makes either function
  * calls to gmx QM routines (derived from MOPAC7 (semi-emp.) and MPQC
index 0b1cb15831c2e35e855f6ab8bdf4168c0fb28f14..fc554d6b2cbce26402b64b5ee01b90ceeefb4d95 100644 (file)
 #include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/pleasecite.h"
 
-real RF_excl_correction(const t_forcerec *fr, t_graph *g,
-                        const t_mdatoms *mdatoms, const t_blocka *excl,
-                        rvec x[], rvec f[], rvec *fshift, const t_pbc *pbc,
-                        real lambda, real *dvdlambda)
+real RF_excl_correction(const t_forcerec *fr,
+                        const t_graph    *g,
+                        const t_mdatoms  *mdatoms,
+                        const t_blocka   *excl,
+                        rvec              x[],
+                        rvec              f[],
+                        rvec             *fshift,
+                        const t_pbc      *pbc,
+                        real              lambda,
+                        real             *dvdlambda)
 {
     /* Calculate the reaction-field energy correction for this node:
      * epsfac q_i q_j (k_rf r_ij^2 - c_rf)
index 4556ab99e2e2d867d27ad6fd7c773ea2172139ba..58f6f50bf9c1415f2be3a8eb12d0362ef0347708 100644 (file)
@@ -590,8 +590,9 @@ gmx_shellfc_t *init_shell_flexcon(FILE *fplog,
     return shfc;
 }
 
-void make_local_shells(const t_commrec *cr, t_mdatoms *md,
-                       gmx_shellfc_t *shfc)
+void make_local_shells(const t_commrec *cr,
+                       const t_mdatoms *md,
+                       gmx_shellfc_t   *shfc)
 {
     t_shell      *shell;
     int           a0, a1, *ind, nshell, i;
@@ -889,17 +890,27 @@ static void dump_shells(FILE *fp, gmx::ArrayRef<gmx::RVec> x, gmx::ArrayRef<gmx:
     }
 }
 
-static void init_adir(FILE *log, gmx_shellfc_t *shfc,
-                      gmx::Constraints *constr, t_idef *idef, t_inputrec *ir,
-                      const t_commrec *cr,
-                      const gmx_multisim_t *ms,
-                      int dd_ac1,
-                      gmx_int64_t step, t_mdatoms *md, int end,
-                      rvec *x_old, rvec *x_init, rvec *x,
-                      rvec *f, rvec *acc_dir,
-                      gmx_bool bMolPBC, matrix box,
-                      gmx::ArrayRef<const real> lambda, real *dvdlambda,
-                      t_nrnb *nrnb)
+static void init_adir(FILE                     *log,
+                      gmx_shellfc_t            *shfc,
+                      gmx::Constraints         *constr,
+                      const t_idef             *idef,
+                      const t_inputrec         *ir,
+                      const t_commrec          *cr,
+                      const gmx_multisim_t     *ms,
+                      int                       dd_ac1,
+                      gmx_int64_t               step,
+                      const t_mdatoms          *md,
+                      int                       end,
+                      rvec                     *x_old,
+                      rvec                     *x_init,
+                      rvec                     *x,
+                      rvec                     *f,
+                      rvec                     *acc_dir,
+                      gmx_bool                  bMolPBC,
+                      matrix                    box,
+                      gmx::ArrayRef<const real> lambda,
+                      real                     *dvdlambda,
+                      t_nrnb                   *nrnb)
 {
     rvec           *xnold, *xnew;
     double          dt, w_dt;
@@ -973,39 +984,46 @@ static void init_adir(FILE *log, gmx_shellfc_t *shfc,
               nullptr, nullptr, nrnb, gmx::econqDeriv_FlexCon);
 }
 
-void relax_shell_flexcon(FILE *fplog, const t_commrec *cr,
-                         const gmx_multisim_t *ms,
-                         gmx_bool bVerbose,
-                         gmx_int64_t mdstep, t_inputrec *inputrec,
-                         gmx_bool bDoNS, int force_flags,
-                         gmx_localtop_t *top,
-                         gmx::Constraints *constr,
-                         gmx_enerdata_t *enerd, t_fcdata *fcd,
-                         t_state *state, PaddedRVecVector *f,
-                         tensor force_vir,
-                         t_mdatoms *md,
-                         t_nrnb *nrnb, gmx_wallcycle_t wcycle,
-                         t_graph *graph,
-                         gmx_groups_t *groups,
-                         gmx_shellfc_t *shfc,
-                         t_forcerec *fr,
-                         double t, rvec mu_tot,
-                         gmx_vsite_t *vsite,
+void relax_shell_flexcon(FILE                                     *fplog,
+                         const t_commrec                          *cr,
+                         const gmx_multisim_t                     *ms,
+                         gmx_bool                                  bVerbose,
+                         gmx_int64_t                               mdstep,
+                         const t_inputrec                         *inputrec,
+                         gmx_bool                                  bDoNS,
+                         int                                       force_flags,
+                         gmx_localtop_t                           *top,
+                         gmx::Constraints                         *constr,
+                         gmx_enerdata_t                           *enerd,
+                         t_fcdata                                 *fcd,
+                         t_state                                  *state,
+                         gmx::PaddedArrayRef<gmx::RVec>            f,
+                         tensor                                    force_vir,
+                         const t_mdatoms                          *md,
+                         t_nrnb                                   *nrnb,
+                         gmx_wallcycle_t                           wcycle,
+                         t_graph                                  *graph,
+                         const gmx_groups_t                       *groups,
+                         gmx_shellfc_t                            *shfc,
+                         t_forcerec                               *fr,
+                         double                                    t,
+                         rvec                                      mu_tot,
+                         const gmx_vsite_t                        *vsite,
                          DdOpenBalanceRegionBeforeForceComputation ddOpenBalanceRegion,
                          DdCloseBalanceRegionAfterForceComputation ddCloseBalanceRegion)
 {
-    int        nshell;
-    t_shell   *shell;
-    t_idef    *idef;
-    rvec      *acc_dir = nullptr, *x_old = nullptr;
-    real       Epot[2], df[2];
-    real       sf_dir, invdt;
-    real       ftol, dum = 0;
-    char       sbuf[22];
-    gmx_bool   bCont, bInit, bConverged;
-    int        nat, dd_ac0, dd_ac1 = 0, i;
-    int        homenr = md->homenr, end = homenr, cg0, cg1;
-    int        nflexcon, number_steps, d, Min = 0, count = 0;
+    int           nshell;
+    t_shell      *shell;
+    const t_idef *idef;
+    rvec         *acc_dir = nullptr, *x_old = nullptr;
+    real          Epot[2], df[2];
+    real          sf_dir, invdt;
+    real          ftol, dum = 0;
+    char          sbuf[22];
+    gmx_bool      bCont, bInit, bConverged;
+    int           nat, dd_ac0, dd_ac1 = 0, i;
+    int           homenr = md->homenr, end = homenr, cg0, cg1;
+    int           nflexcon, number_steps, d, Min = 0, count = 0;
 #define  Try (1-Min)             /* At start Try = 1 */
 
     bCont        = (mdstep == inputrec->init_step) && inputrec->bContinuation;
@@ -1323,7 +1341,7 @@ void relax_shell_flexcon(FILE *fplog, const t_commrec *cr,
 
     /* Copy back the coordinates and the forces */
     std::copy(pos[Min].begin(), pos[Min].end(), state->x.begin());
-    std::copy(force[Min].begin(), force[Min].end(), f->begin());
+    std::copy(force[Min].begin(), force[Min].end(), f.begin());
 }
 
 void done_shellfc(FILE *fplog, gmx_shellfc_t *shfc, gmx_int64_t numSteps)
index 95569432c3476fafc52fd353d2225889fb0d9855..67884a3103054801dc5290868b62e890ad2e3421 100644 (file)
@@ -68,28 +68,36 @@ gmx_shellfc_t *init_shell_flexcon(FILE *fplog,
                                   bool usingDomainDecomposition);
 
 /* Get the local shell with domain decomposition */
-void make_local_shells(const t_commrec *cr, t_mdatoms *md,
-                       gmx_shellfc_t *shfc);
+void make_local_shells(const t_commrec *cr,
+                       const t_mdatoms *md,
+                       gmx_shellfc_t   *shfc);
 
 /* Optimize shell positions */
-void relax_shell_flexcon(FILE *log, const t_commrec *cr,
-                         const gmx_multisim_t *ms,
-                         gmx_bool bVerbose,
-                         gmx_int64_t mdstep, t_inputrec *inputrec,
-                         gmx_bool bDoNS, int force_flags,
-                         gmx_localtop_t *top,
-                         gmx::Constraints *constr,
-                         gmx_enerdata_t *enerd, t_fcdata *fcd,
-                         t_state *state, PaddedRVecVector *f,
-                         tensor force_vir,
-                         t_mdatoms *md,
-                         t_nrnb *nrnb, gmx_wallcycle_t wcycle,
-                         t_graph *graph,
-                         gmx_groups_t *groups,
-                         gmx_shellfc_t *shfc,
-                         t_forcerec *fr,
-                         double t, rvec mu_tot,
-                         gmx_vsite_t *vsite,
+void relax_shell_flexcon(FILE                                     *log,
+                         const t_commrec                          *cr,
+                         const gmx_multisim_t                     *ms,
+                         gmx_bool                                  bVerbose,
+                         gmx_int64_t                               mdstep,
+                         const t_inputrec                         *inputrec,
+                         gmx_bool                                  bDoNS,
+                         int                                       force_flags,
+                         gmx_localtop_t                           *top,
+                         gmx::Constraints                         *constr,
+                         gmx_enerdata_t                           *enerd,
+                         t_fcdata                                 *fcd,
+                         t_state                                  *state,
+                         gmx::PaddedArrayRef<gmx::RVec>            f,
+                         tensor                                    force_vir,
+                         const t_mdatoms                          *md,
+                         t_nrnb                                   *nrnb,
+                         gmx_wallcycle_t                           wcycle,
+                         t_graph                                  *graph,
+                         const gmx_groups_t                       *groups,
+                         gmx_shellfc_t                            *shfc,
+                         t_forcerec                               *fr,
+                         double                                    t,
+                         rvec                                      mu_tot,
+                         const gmx_vsite_t                        *vsite,
                          DdOpenBalanceRegionBeforeForceComputation ddOpenBalanceRegion,
                          DdCloseBalanceRegionAfterForceComputation ddCloseBalanceRegion);
 
index 366b265a38a649b38de31c907080c8d74781e0d6..625b57427e13010f87747ddcb13b8242b8fa72cb 100644 (file)
@@ -277,10 +277,10 @@ static void calc_virial(int start, int homenr, rvec x[], rvec f[],
 }
 
 static void pull_potential_wrapper(const t_commrec *cr,
-                                   t_inputrec *ir,
-                                   matrix box, rvec x[],
+                                   const t_inputrec *ir,
+                                   matrix box, ArrayRef<const RVec> x,
                                    ForceWithVirial *force,
-                                   t_mdatoms *mdatoms,
+                                   const t_mdatoms *mdatoms,
                                    gmx_enerdata_t *enerd,
                                    real *lambda,
                                    double t,
@@ -297,7 +297,7 @@ static void pull_potential_wrapper(const t_commrec *cr,
     dvdl                     = 0;
     enerd->term[F_COM_PULL] +=
         pull_potential(ir->pull_work, mdatoms, &pbc,
-                       cr, t, lambda[efptRESTRAINT], x, force, &dvdl);
+                       cr, t, lambda[efptRESTRAINT], as_rvec_array(x.data()), force, &dvdl);
     enerd->dvdl_lin[efptRESTRAINT] += dvdl;
     wallcycle_stop(wcycle, ewcPULLPOT);
 }
@@ -333,9 +333,13 @@ static void pme_receive_force_ener(const t_commrec *cr,
     wallcycle_stop(wcycle, ewcPP_PMEWAITRECVF);
 }
 
-static void print_large_forces(FILE *fp, t_mdatoms *md, const t_commrec *cr,
-                               gmx_int64_t step, real forceTolerance,
-                               const rvec *x, const rvec *f)
+static void print_large_forces(FILE            *fp,
+                               const t_mdatoms *md,
+                               const t_commrec *cr,
+                               gmx_int64_t      step,
+                               real             forceTolerance,
+                               const rvec      *x,
+                               const rvec      *f)
 {
     real           force2Tolerance = gmx::square(forceTolerance);
     std::uintmax_t numNonFinite    = 0;
@@ -364,18 +368,21 @@ static void print_large_forces(FILE *fp, t_mdatoms *md, const t_commrec *cr,
     }
 }
 
-static void post_process_forces(const t_commrec *cr,
-                                gmx_int64_t step,
-                                t_nrnb *nrnb, gmx_wallcycle_t wcycle,
-                                gmx_localtop_t *top,
-                                matrix box, rvec x[],
-                                rvec f[],
-                                ForceWithVirial *forceWithVirial,
-                                tensor vir_force,
-                                t_mdatoms *mdatoms,
-                                t_graph *graph,
-                                t_forcerec *fr, gmx_vsite_t *vsite,
-                                int flags)
+static void post_process_forces(const t_commrec      *cr,
+                                gmx_int64_t           step,
+                                t_nrnb               *nrnb,
+                                gmx_wallcycle_t       wcycle,
+                                const gmx_localtop_t *top,
+                                matrix                box,
+                                rvec                  x[],
+                                rvec                  f[],
+                                ForceWithVirial      *forceWithVirial,
+                                tensor                vir_force,
+                                const t_mdatoms      *mdatoms,
+                                t_graph              *graph,
+                                t_forcerec           *fr,
+                                const gmx_vsite_t    *vsite,
+                                int                   flags)
 {
     if (fr->haveDirectVirialContributions)
     {
@@ -561,7 +568,7 @@ static void do_nb_verlet_fep(nbnxn_pairlist_set_t *nbl_lists,
                              t_forcerec           *fr,
                              rvec                  x[],
                              rvec                  f[],
-                             t_mdatoms            *mdatoms,
+                             const t_mdatoms      *mdatoms,
                              t_lambda             *fepvals,
                              real                 *lambda,
                              gmx_enerdata_t       *enerd,
@@ -815,22 +822,22 @@ static void checkPotentialEnergyValidity(gmx_int64_t           step,
  * \todo Convert all other algorithms called here to ForceProviders.
  */
 static void
-computeSpecialForces(FILE             *fplog,
-                     const t_commrec  *cr,
-                     t_inputrec       *inputrec,
-                     gmx_int64_t       step,
-                     double            t,
-                     gmx_wallcycle_t   wcycle,
-                     ForceProviders   *forceProviders,
-                     matrix            box,
-                     rvec             *x,
-                     t_mdatoms        *mdatoms,
-                     real             *lambda,
-                     int               forceFlags,
-                     ForceWithVirial  *forceWithVirial,
-                     gmx_enerdata_t   *enerd,
-                     gmx_edsam_t       ed,
-                     gmx_bool          bNS)
+computeSpecialForces(FILE                *fplog,
+                     const t_commrec     *cr,
+                     const t_inputrec    *inputrec,
+                     gmx_int64_t          step,
+                     double               t,
+                     gmx_wallcycle_t      wcycle,
+                     ForceProviders      *forceProviders,
+                     matrix               box,
+                     ArrayRef<const RVec> x,
+                     const t_mdatoms     *mdatoms,
+                     real                *lambda,
+                     int                  forceFlags,
+                     ForceWithVirial     *forceWithVirial,
+                     gmx_enerdata_t      *enerd,
+                     const gmx_edsam     *ed,
+                     gmx_bool             bNS)
 {
     const bool computeForces = (forceFlags & GMX_FORCE_FORCES);
 
@@ -877,7 +884,7 @@ computeSpecialForces(FILE             *fplog,
          * Thus if no other algorithm (e.g. PME) requires it, the forces
          * here will contribute to the virial.
          */
-        do_flood(cr, inputrec, x, f, ed, box, step, bNS);
+        do_flood(cr, inputrec, as_rvec_array(x.data()), f, ed, box, step, bNS);
     }
 
     /* Add forces from interactive molecular dynamics (IMD), if bIMD == TRUE. */
@@ -1035,21 +1042,29 @@ static inline void launchGpuRollingPruning(const t_commrec          *cr,
     }
 }
 
-static void do_force_cutsVERLET(FILE *fplog, const t_commrec *cr,
+static void do_force_cutsVERLET(FILE *fplog,
+                                const t_commrec *cr,
                                 const gmx_multisim_t *ms,
-                                t_inputrec *inputrec,
-                                gmx_int64_t step, t_nrnb *nrnb, gmx_wallcycle_t wcycle,
-                                gmx_localtop_t *top,
-                                gmx_groups_t gmx_unused *groups,
-                                matrix box, gmx::PaddedArrayRef<gmx::RVec> x, history_t *hist,
+                                const t_inputrec *inputrec,
+                                gmx_int64_t step,
+                                t_nrnb *nrnb,
+                                gmx_wallcycle_t wcycle,
+                                const gmx_localtop_t *top,
+                                const gmx_groups_t * /* groups */,
+                                matrix box, gmx::PaddedArrayRef<gmx::RVec> x,
+                                history_t *hist,
                                 gmx::PaddedArrayRef<gmx::RVec> force,
                                 tensor vir_force,
-                                t_mdatoms *mdatoms,
+                                const t_mdatoms *mdatoms,
                                 gmx_enerdata_t *enerd, t_fcdata *fcd,
-                                real *lambda, t_graph *graph,
-                                t_forcerec *fr, interaction_const_t *ic,
-                                gmx_vsite_t *vsite, rvec mu_tot,
-                                double t, gmx_edsam_t ed,
+                                real *lambda,
+                                t_graph *graph,
+                                t_forcerec *fr,
+                                interaction_const_t *ic,
+                                const gmx_vsite_t *vsite,
+                                rvec mu_tot,
+                                double t,
+                                const gmx_edsam *ed,
                                 int flags,
                                 DdOpenBalanceRegionBeforeForceComputation ddOpenBalanceRegion,
                                 DdCloseBalanceRegionAfterForceComputation ddCloseBalanceRegion)
@@ -1527,7 +1542,7 @@ static void do_force_cutsVERLET(FILE *fplog, const t_commrec *cr,
     wallcycle_stop(wcycle, ewcFORCE);
 
     computeSpecialForces(fplog, cr, inputrec, step, t, wcycle,
-                         fr->forceProviders, box, as_rvec_array(x.data()), mdatoms, lambda,
+                         fr->forceProviders, box, x, mdatoms, lambda,
                          flags, &forceWithVirial, enerd,
                          ed, bNS);
 
@@ -1722,20 +1737,29 @@ static void do_force_cutsVERLET(FILE *fplog, const t_commrec *cr,
     }
 }
 
-static void do_force_cutsGROUP(FILE *fplog, const t_commrec *cr,
+static void do_force_cutsGROUP(FILE *fplog,
+                               const t_commrec *cr,
                                const gmx_multisim_t *ms,
-                               t_inputrec *inputrec,
-                               gmx_int64_t step, t_nrnb *nrnb, gmx_wallcycle_t wcycle,
+                               const t_inputrec *inputrec,
+                               gmx_int64_t step,
+                               t_nrnb *nrnb,
+                               gmx_wallcycle_t wcycle,
                                gmx_localtop_t *top,
-                               gmx_groups_t *groups,
-                               matrix box, gmx::PaddedArrayRef<gmx::RVec> x, history_t *hist,
+                               const gmx_groups_t *groups,
+                               matrix box, gmx::PaddedArrayRef<gmx::RVec> x,
+                               history_t *hist,
                                gmx::PaddedArrayRef<gmx::RVec> force,
                                tensor vir_force,
-                               t_mdatoms *mdatoms,
-                               gmx_enerdata_t *enerd, t_fcdata *fcd,
-                               real *lambda, t_graph *graph,
-                               t_forcerec *fr, gmx_vsite_t *vsite, rvec mu_tot,
-                               double t, gmx_edsam_t ed,
+                               const t_mdatoms *mdatoms,
+                               gmx_enerdata_t *enerd,
+                               t_fcdata *fcd,
+                               real *lambda,
+                               t_graph *graph,
+                               t_forcerec *fr,
+                               const gmx_vsite_t *vsite,
+                               rvec mu_tot,
+                               double t,
+                               const gmx_edsam *ed,
                                int flags,
                                DdOpenBalanceRegionBeforeForceComputation ddOpenBalanceRegion,
                                DdCloseBalanceRegionAfterForceComputation ddCloseBalanceRegion)
@@ -1975,7 +1999,7 @@ static void do_force_cutsGROUP(FILE *fplog, const t_commrec *cr,
     }
 
     computeSpecialForces(fplog, cr, inputrec, step, t, wcycle,
-                         fr->forceProviders, box, as_rvec_array(x.data()), mdatoms, lambda,
+                         fr->forceProviders, box, x, mdatoms, lambda,
                          flags, &forceWithVirial, enerd,
                          ed, bNS);
 
@@ -2045,22 +2069,31 @@ static void do_force_cutsGROUP(FILE *fplog, const t_commrec *cr,
 
 }
 
-void do_force(FILE *fplog, const t_commrec *cr,
-              const gmx_multisim_t *ms,
-              t_inputrec *inputrec,
-              gmx_int64_t step, t_nrnb *nrnb, gmx_wallcycle_t wcycle,
-              gmx_localtop_t *top,
-              gmx_groups_t *groups,
-              matrix box, gmx::PaddedArrayRef<gmx::RVec> x, history_t *hist,
-              gmx::PaddedArrayRef<gmx::RVec> force,
-              tensor vir_force,
-              t_mdatoms *mdatoms,
-              gmx_enerdata_t *enerd, t_fcdata *fcd,
-              gmx::ArrayRef<real> lambda, t_graph *graph,
-              t_forcerec *fr,
-              gmx_vsite_t *vsite, rvec mu_tot,
-              double t, gmx_edsam_t ed,
-              int flags,
+void do_force(FILE                                     *fplog,
+              const t_commrec                          *cr,
+              const gmx_multisim_t                     *ms,
+              const t_inputrec                         *inputrec,
+              gmx_int64_t                               step,
+              t_nrnb                                   *nrnb,
+              gmx_wallcycle_t                           wcycle,
+              gmx_localtop_t                           *top,
+              const gmx_groups_t                       *groups,
+              matrix                                    box,
+              gmx::PaddedArrayRef<gmx::RVec>            x,
+              history_t                                *hist,
+              gmx::PaddedArrayRef<gmx::RVec>            force,
+              tensor                                    vir_force,
+              const t_mdatoms                          *mdatoms,
+              gmx_enerdata_t                           *enerd,
+              t_fcdata                                 *fcd,
+              gmx::ArrayRef<real>                       lambda,
+              t_graph                                  *graph,
+              t_forcerec                               *fr,
+              const gmx_vsite_t                        *vsite,
+              rvec                                      mu_tot,
+              double                                    t,
+              const gmx_edsam                          *ed,
+              int                                       flags,
               DdOpenBalanceRegionBeforeForceComputation ddOpenBalanceRegion,
               DdCloseBalanceRegionAfterForceComputation ddCloseBalanceRegion)
 {
index 9f7de7cb92472402241035adc91dd3fbea1da7c5..4be749be23d52837cceb16e53589bba8706517c4 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2008, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017,2018, 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.
@@ -105,7 +105,7 @@ void make_wall_tables(FILE *fplog,
     }
 }
 
-static void wall_error(int a, rvec *x, real r)
+static void wall_error(int a, const rvec *x, real r)
 {
     gmx_fatal(FARGS,
               "An atom is beyond the wall: coordinates %f %f %f, distance %f\n"
@@ -113,8 +113,8 @@ static void wall_error(int a, rvec *x, real r)
               x[a][XX], x[a][YY], x[a][ZZ], r);
 }
 
-real do_walls(t_inputrec *ir, t_forcerec *fr, matrix box, t_mdatoms *md,
-              rvec x[], rvec f[], real lambda, real Vlj[], t_nrnb *nrnb)
+real do_walls(const t_inputrec *ir, t_forcerec *fr, matrix box, const t_mdatoms *md,
+              const rvec x[], rvec f[], real lambda, real Vlj[], t_nrnb *nrnb)
 {
     int             nwall;
     int             ntw[2], at, ntype, ngid, ggid, *egp_flags, *type;
index 8f8717ca67b759b33cbe5ce7d05d3e5f9ee458ef..57f0acae56762bfa20ec0dd053f3c9ea7a157855 100644 (file)
@@ -1164,7 +1164,7 @@ void gmx::Integrator::do_md()
             relax_shell_flexcon(fplog, cr, ms, mdrunOptions.verbose, step,
                                 ir, bNS, force_flags, top,
                                 constr, enerd, fcd,
-                                state, &f, force_vir, mdatoms,
+                                state, f, force_vir, mdatoms,
                                 nrnb, wcycle, graph, groups,
                                 shellfc, fr, t, mu_tot,
                                 vsite,
index 60f4f370e7e9e35ecbd3b3dfc552223291a3b26f..33ee89e395c23216199d0e6425aa9507a1f0585b 100644 (file)
@@ -2781,16 +2781,33 @@ Integrator::do_nm()
                 if (shellfc)
                 {
                     /* Now is the time to relax the shells */
-                    (void) relax_shell_flexcon(fplog, cr, ms, mdrunOptions.verbose, step,
-                                               inputrec, bNS, force_flags,
-                                               top,
-                                               constr, enerd, fcd,
-                                               &state_work.s, &state_work.f, vir, mdatoms,
-                                               nrnb, wcycle, graph, &top_global->groups,
-                                               shellfc, fr, t, mu_tot,
-                                               vsite,
-                                               DdOpenBalanceRegionBeforeForceComputation::no,
-                                               DdCloseBalanceRegionAfterForceComputation::no);
+                    relax_shell_flexcon(fplog,
+                                        cr,
+                                        ms,
+                                        mdrunOptions.verbose,
+                                        step,
+                                        inputrec,
+                                        bNS,
+                                        force_flags,
+                                        top,
+                                        constr,
+                                        enerd,
+                                        fcd,
+                                        &state_work.s,
+                                        state_work.f,
+                                        vir,
+                                        mdatoms,
+                                        nrnb,
+                                        wcycle,
+                                        graph,
+                                        &top_global->groups,
+                                        shellfc,
+                                        fr,
+                                        t,
+                                        mu_tot,
+                                        vsite,
+                                        DdOpenBalanceRegionBeforeForceComputation::no,
+                                        DdCloseBalanceRegionAfterForceComputation::no);
                     bNS = false;
                     step++;
                 }
index bb9a8c03e8e4e251708126197ee20230cbfcb550..0481f3d508f002239de313e26326df3bb5ef6807 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2017, by the GROMACS development team, led by
+ * Copyright (c) 2017,2018, 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.
@@ -74,12 +74,12 @@ bool ForceProviders::hasForceProvider() const
     return !impl_->providers_.empty();
 }
 
-void ForceProviders::calculateForces(const t_commrec       *cr,
-                                     const t_mdatoms       *mdatoms,
-                                     const matrix           box,
-                                     double                 t,
-                                     const rvec            *x,
-                                     gmx::ForceWithVirial  *forceWithVirial) const
+void ForceProviders::calculateForces(const t_commrec               *cr,
+                                     const t_mdatoms               *mdatoms,
+                                     const matrix                   box,
+                                     double                         t,
+                                     gmx::ArrayRef<const gmx::RVec> x,
+                                     gmx::ForceWithVirial          *forceWithVirial) const
 {
     for (auto provider : impl_->providers_)
     {
index ae5fb68e12d365e054efac2e52de1e6463821e8f..f2556baa1237ce88cbee15cf7bdeffe73cf75a22 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2016,2017,2018, 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.
@@ -46,6 +46,7 @@
 #define GMX_MDTYPES_IFORCEPROVIDER_H
 
 #include "gromacs/math/vectypes.h"
+#include "gromacs/utility/arrayref.h"
 #include "gromacs/utility/classhelpers.h"
 
 struct t_commrec;
@@ -90,12 +91,12 @@ class IForceProvider
          * \param[in]    x                The coordinates
          * \param[inout] forceWithVirial  The forces and virial
          */
-        virtual void calculateForces(const t_commrec          *cr,
-                                     const t_mdatoms          *mdatoms,
-                                     const matrix              box,
-                                     double                    t,
-                                     const rvec               *x,
-                                     gmx::ForceWithVirial     *forceWithVirial) = 0;
+        virtual void calculateForces(const t_commrec               *cr,
+                                     const t_mdatoms               *mdatoms,
+                                     const matrix                   box,
+                                     double                         t,
+                                     gmx::ArrayRef<const gmx::RVec> x,
+                                     gmx::ForceWithVirial          *forceWithVirial) = 0;
 
     protected:
         ~IForceProvider() {}
@@ -128,12 +129,12 @@ struct ForceProviders
         bool hasForceProvider() const;
 
         //! Computes forces.
-        void calculateForces(const t_commrec          *cr,
-                             const t_mdatoms          *mdatoms,
-                             const matrix              box,
-                             double                    t,
-                             const rvec               *x,
-                             gmx::ForceWithVirial     *forceWithVirial) const;
+        void calculateForces(const t_commrec               *cr,
+                             const t_mdatoms               *mdatoms,
+                             const matrix                   box,
+                             double                         t,
+                             gmx::ArrayRef<const gmx::RVec> x,
+                             gmx::ForceWithVirial          *forceWithVirial) const;
 
     private:
         class Impl;
index 4b632062a946cf88b8efec601b08ec91b68c0bb0..76cd00446c6a3285b41525cdb9f7f6fef8eee854 100644 (file)
@@ -1711,9 +1711,9 @@ do_pull_pot_coord(struct pull_t *pull, int coord_ind, t_pbc *pbc,
     return pullCoordForces;
 }
 
-real pull_potential(struct pull_t *pull, t_mdatoms *md, t_pbc *pbc,
+real pull_potential(struct pull_t *pull, const t_mdatoms *md, t_pbc *pbc,
                     const t_commrec *cr, double t, real lambda,
-                    rvec *x, gmx::ForceWithVirial *force, real *dvdlambda)
+                    const rvec *x, gmx::ForceWithVirial *force, real *dvdlambda)
 {
     real V = 0;
 
@@ -1768,7 +1768,7 @@ real pull_potential(struct pull_t *pull, t_mdatoms *md, t_pbc *pbc,
     return (MASTER(cr) ? V : 0.0);
 }
 
-void pull_constraint(struct pull_t *pull, t_mdatoms *md, t_pbc *pbc,
+void pull_constraint(struct pull_t *pull, const t_mdatoms *md, t_pbc *pbc,
                      const t_commrec *cr, double dt, double t,
                      rvec *x, rvec *xp, rvec *v, tensor vir)
 {
index 7f45fec6f875b217ce520ca85f268fb4c64e1e4d..525ad5858d13a3d96083be32c22cacba47054819 100644 (file)
@@ -184,9 +184,9 @@ void clear_pull_forces(struct pull_t *pull);
  *
  * \returns The pull potential energy.
  */
-real pull_potential(struct pull_t *pull, t_mdatoms *md, struct t_pbc *pbc,
+real pull_potential(struct pull_t *pull, const t_mdatoms *md, struct t_pbc *pbc,
                     const t_commrec *cr, double t, real lambda,
-                    rvec *x, gmx::ForceWithVirial *force, real *dvdlambda);
+                    const rvec *x, gmx::ForceWithVirial *force, real *dvdlambda);
 
 
 /*! \brief Constrain the coordinates xp in the directions in x
@@ -203,7 +203,7 @@ real pull_potential(struct pull_t *pull, t_mdatoms *md, struct t_pbc *pbc,
  * \param[in,out] v      Velocities, which may get a pull correction.
  * \param[in,out] vir    The virial, which, if != NULL, gets a pull correction.
  */
-void pull_constraint(struct pull_t *pull, t_mdatoms *md, struct t_pbc *pbc,
+void pull_constraint(struct pull_t *pull, const t_mdatoms *md, struct t_pbc *pbc,
                      const t_commrec *cr, double dt, double t,
                      rvec *x, rvec *xp, rvec *v, tensor vir);
 
@@ -279,13 +279,13 @@ void pull_print_output(struct pull_t *pull, gmx_int64_t step, double time);
  * \param[in,out] xp   Updated x, can be NULL.
  *
  */
-void pull_calc_coms(const t_commrec  *cr,
-                    struct pull_t    *pull,
-                    t_mdatoms        *md,
-                    struct t_pbc     *pbc,
-                    double            t,
-                    rvec              x[],
-                    rvec             *xp);
+void pull_calc_coms(const t_commrec *cr,
+                    pull_t          *pull,
+                    const t_mdatoms *md,
+                    t_pbc           *pbc,
+                    double           t,
+                    const rvec       x[],
+                    rvec            *xp);
 
 
 /*! \brief Returns if we have pull coordinates with potential pulling.
index 429290d71939cb5bfb36f18be6f5073ca555c0f1..1296be0e2992fa61f7907de5a18ac805b03c01a8 100644 (file)
@@ -3885,13 +3885,13 @@ static void choose_pbc_image(rvec x[], t_rotgrp *rotg, matrix box, int npbcdim)
 
 
 extern void do_rotation(
-        const t_commrec *cr,
-        t_inputrec      *ir,
-        matrix           box,
-        rvec             x[],
-        real             t,
-        gmx_int64_t      step,
-        gmx_bool         bNS)
+        const t_commrec       *cr,
+        const t_inputrec      *ir,
+        matrix                 box,
+        rvec                   x[],
+        real                   t,
+        gmx_int64_t            step,
+        gmx_bool               bNS)
 {
     int             g, i, ii;
     t_rot          *rot;
index 915b04264f000679711e98a36afa8d474d4d875a..310b131220129cdf4576561f73b8d17f27d84e3c 100644 (file)
@@ -116,8 +116,13 @@ extern void dd_make_local_rotation_groups(struct gmx_domdec_t *dd, t_rot *rot);
  * \param bNS     After domain decomposition / neighbor searching several
  *                local arrays have to be updated (masses, shifts)
  */
-extern void do_rotation(const t_commrec *cr, t_inputrec *ir, matrix box, rvec x[], real t,
-                        gmx_int64_t step, gmx_bool bNS);
+extern void do_rotation(const t_commrec  *cr,
+                        const t_inputrec *ir,
+                        matrix            box,
+                        rvec              x[],
+                        real              t,
+                        gmx_int64_t       step,
+                        gmx_bool          bNS);
 
 
 /*! \brief Add the enforced rotation forces to the official force array.
index 0045821ce782ef3baf7295f8229ad1453cf7aaa9..276161c5bb7136c958020b902d607bf9cad245fe 100644 (file)
@@ -131,7 +131,7 @@ static void pullAllReduce(const t_commrec *cr,
 }
 
 static void pull_set_pbcatom(const t_commrec *cr, pull_group_work_t *pgrp,
-                             rvec *x,
+                             const rvec *x,
                              rvec x_pbc)
 {
     int a;
@@ -154,7 +154,7 @@ static void pull_set_pbcatom(const t_commrec *cr, pull_group_work_t *pgrp,
 }
 
 static void pull_set_pbcatoms(const t_commrec *cr, struct pull_t *pull,
-                              rvec *x,
+                              const rvec *x,
                               rvec *x_pbc)
 {
     int g, n;
@@ -183,8 +183,12 @@ static void pull_set_pbcatoms(const t_commrec *cr, struct pull_t *pull,
     }
 }
 
-static void make_cyl_refgrps(const t_commrec *cr, struct pull_t *pull, t_mdatoms *md,
-                             t_pbc *pbc, double t, rvec *x)
+static void make_cyl_refgrps(const t_commrec *cr,
+                             pull_t          *pull,
+                             const t_mdatoms *md,
+                             t_pbc           *pbc,
+                             double           t,
+                             const rvec      *x)
 {
     /* The size and stride per coord for the reduction buffer */
     const int       stride = 9;
@@ -538,8 +542,11 @@ static void sum_com_part_cosweight(const pull_group_work_t *pgrp,
 
 /* calculates center of mass of selection index from all coordinates x */
 void pull_calc_coms(const t_commrec *cr,
-                    struct pull_t *pull, t_mdatoms *md, t_pbc *pbc, double t,
-                    rvec x[], rvec *xp)
+                    pull_t *pull,
+                    const t_mdatoms *md,
+                    t_pbc *pbc,
+                    double t,
+                    const rvec x[], rvec *xp)
 {
     int          g;
     real         twopi_box = 0;