Make the restraint history const during force calculation
authorPascal Merz <pascal.merz@me.com>
Sun, 14 Feb 2021 20:19:32 +0000 (13:19 -0700)
committerAndrey Alekseenko <al42and@gmail.com>
Mon, 15 Feb 2021 15:51:35 +0000 (15:51 +0000)
The history is updated later, and is read-only within the force
routines. Adds a few const qualifiers to clarify this.

Refs #3430

src/gromacs/listed_forces/disre.cpp
src/gromacs/listed_forces/disre.h
src/gromacs/listed_forces/listed_forces.cpp
src/gromacs/listed_forces/listed_forces.h
src/gromacs/listed_forces/orires.cpp
src/gromacs/listed_forces/orires.h
src/gromacs/mdlib/force.h
src/gromacs/mdlib/sim_util.cpp
src/gromacs/mdrun/shellfc.cpp
src/gromacs/mdrun/shellfc.h

index 73d23f5f52c281d71b254bda0cf3ec22745390c5..d08261a7a88142203a4c82a6feaef902436618c0 100644 (file)
@@ -4,7 +4,7 @@
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
  * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
- * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020,2021, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -303,7 +303,7 @@ void calc_disres_R_6(const t_commrec*      cr,
                      const rvec            x[],
                      const t_pbc*          pbc,
                      t_disresdata*         dd,
-                     history_t*            hist)
+                     const history_t*      hist)
 {
     rvec     dx;
     real *   rt, *rm3tav, *Rtl_6, *Rt_6, *Rtav_6;
index 7144dd0f125d71e60fd6f5501d1d97f64150c698..cbe81d778f5c71a8a0961feb02f95de8051d86bd 100644 (file)
@@ -4,7 +4,7 @@
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
  * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
- * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020,2021, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -103,7 +103,7 @@ void calc_disres_R_6(const t_commrec*      cr,
                      const rvec*           x,
                      const t_pbc*          pbc,
                      t_disresdata*         disresdata,
-                     history_t*            hist);
+                     const history_t*      hist);
 
 //! Calculates the distance restraint forces, return the potential.
 real ta_disres(int              nfa,
index a7280159ff90d8d1498defb2986b3a329f3e18ea..d855b2e09611ddde3ecfd2e7c76915e5f62a20fe 100644 (file)
@@ -783,7 +783,7 @@ void ListedForces::calculate(struct gmx_wallcycle*                     wcycle,
                              gmx::ArrayRefWithPadding<const gmx::RVec> coordinates,
                              gmx::ArrayRef<const gmx::RVec>            xWholeMolecules,
                              t_fcdata*                                 fcdata,
-                             history_t*                                hist,
+                             const history_t*                          hist,
                              gmx::ForceOutputs*                        forceOutputs,
                              const t_forcerec*                         fr,
                              const struct t_pbc*                       pbc,
index c044baf11730375ab30db3a15b08b902bdfadfb8..4bed406827c1f7780c7332191d8f50cb27e15f48 100644 (file)
@@ -2,7 +2,7 @@
  * This file is part of the GROMACS molecular simulation package.
  *
  * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
- * Copyright (c) 2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020,2021, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -193,7 +193,7 @@ public:
                    gmx::ArrayRefWithPadding<const gmx::RVec> coordinates,
                    gmx::ArrayRef<const gmx::RVec>            xWholeMolecules,
                    t_fcdata*                                 fcdata,
-                   history_t*                                hist,
+                   const history_t*                          hist,
                    gmx::ForceOutputs*                        forceOutputs,
                    const t_forcerec*                         fr,
                    const struct t_pbc*                       pbc,
index 70e5af42759549fa496862d654e2211b5c644453..47e3eb37144b663d113234d749991e5ff9e02923 100644 (file)
@@ -4,7 +4,7 @@
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
  * Copyright (c) 2013,2014,2015,2016,2017 The GROMACS development team.
- * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020,2021, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -395,7 +395,7 @@ real calc_orires_dev(const gmx_multisim_t* ms,
                      const rvec            x[],
                      const t_pbc*          pbc,
                      t_oriresdata*         od,
-                     history_t*            hist)
+                     const history_t*      hist)
 {
     int          nref;
     real         edt, edt_1, invn, pfac, r2, invr, corrfac, wsv2, sw, dev;
index 37065e8be559164e7f12ac6204bc5e3322edde0e..0ad20a07af2fe112c18d71fa2bd3ae46e2d9c960 100644 (file)
@@ -4,7 +4,7 @@
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
  * Copyright (c) 2010,2014,2015,2017,2018 by the GROMACS development team.
- * Copyright (c) 2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020,2021, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -94,7 +94,7 @@ real calc_orires_dev(const gmx_multisim_t*          ms,
                      const rvec                     x[],
                      const t_pbc*                   pbc,
                      t_oriresdata*                  oriresdata,
-                     history_t*                     hist);
+                     const history_t*               hist);
 
 /*! \brief
  * Diagonalizes the order tensor(s) of the orienation restraints.
index 63f80e88394acbfc85503b10c56c55207104f7a5..608849357fc6deeee04f72dedb5993b6584100ee 100644 (file)
@@ -4,7 +4,7 @@
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
  * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
- * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020,2021, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -103,7 +103,7 @@ void do_force(FILE*                               log,
               const gmx_localtop_t*               top,
               const matrix                        box,
               gmx::ArrayRefWithPadding<gmx::RVec> coordinates,
-              history_t*                          hist,
+              const history_t*                    hist,
               gmx::ForceBuffersView*              force,
               tensor                              vir_force,
               const t_mdatoms*                    mdatoms,
index 2494b02c6b529ad2b2034d70b3d8df18b6603490..0ed4399e70ec720d0ab6f14fd5f3484f68a3faf4 100644 (file)
@@ -1168,7 +1168,7 @@ void do_force(FILE*                               fplog,
               const gmx_localtop_t*               top,
               const matrix                        box,
               gmx::ArrayRefWithPadding<gmx::RVec> x,
-              history_t*                          hist,
+              const history_t*                    hist,
               gmx::ForceBuffersView*              forceView,
               tensor                              vir_force,
               const t_mdatoms*                    mdatoms,
index 9943027574b6975fa1893a5a3e58bdc82dc2baa2..38b68d157ace0627e76648f2f1b7a8f7cba06352 100644 (file)
@@ -976,7 +976,7 @@ void relax_shell_flexcon(FILE*                         fplog,
                          ArrayRefWithPadding<RVec>     vPadded,
                          const matrix                  box,
                          ArrayRef<real>                lambda,
-                         history_t*                    hist,
+                         const history_t*              hist,
                          gmx::ForceBuffersView*        f,
                          tensor                        force_vir,
                          const t_mdatoms*              md,
index f5145cfb8d36864a0a8e99ec48121bc597825ae4..3e44708c475d60c3b08342dc3db0c106e106af40 100644 (file)
@@ -4,7 +4,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.
- * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020,2021, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -110,7 +110,7 @@ void relax_shell_flexcon(FILE*                               log,
                          gmx::ArrayRefWithPadding<gmx::RVec> v,
                          const matrix                        box,
                          gmx::ArrayRef<real>                 lambda,
-                         history_t*                          hist,
+                         const history_t*                    hist,
                          gmx::ForceBuffersView*              f,
                          tensor                              force_vir,
                          const t_mdatoms*                    md,