From 19fb4da2d6bbdcb634131829f47305089f850381 Mon Sep 17 00:00:00 2001 From: Pascal Merz Date: Sun, 14 Feb 2021 13:19:32 -0700 Subject: [PATCH] Make the restraint history const during force calculation 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 | 4 ++-- src/gromacs/listed_forces/disre.h | 4 ++-- src/gromacs/listed_forces/listed_forces.cpp | 2 +- src/gromacs/listed_forces/listed_forces.h | 4 ++-- src/gromacs/listed_forces/orires.cpp | 4 ++-- src/gromacs/listed_forces/orires.h | 4 ++-- src/gromacs/mdlib/force.h | 4 ++-- src/gromacs/mdlib/sim_util.cpp | 2 +- src/gromacs/mdrun/shellfc.cpp | 2 +- src/gromacs/mdrun/shellfc.h | 4 ++-- 10 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/gromacs/listed_forces/disre.cpp b/src/gromacs/listed_forces/disre.cpp index 73d23f5f52..d08261a7a8 100644 --- a/src/gromacs/listed_forces/disre.cpp +++ b/src/gromacs/listed_forces/disre.cpp @@ -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; diff --git a/src/gromacs/listed_forces/disre.h b/src/gromacs/listed_forces/disre.h index 7144dd0f12..cbe81d778f 100644 --- a/src/gromacs/listed_forces/disre.h +++ b/src/gromacs/listed_forces/disre.h @@ -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, diff --git a/src/gromacs/listed_forces/listed_forces.cpp b/src/gromacs/listed_forces/listed_forces.cpp index a7280159ff..d855b2e096 100644 --- a/src/gromacs/listed_forces/listed_forces.cpp +++ b/src/gromacs/listed_forces/listed_forces.cpp @@ -783,7 +783,7 @@ void ListedForces::calculate(struct gmx_wallcycle* wcycle, gmx::ArrayRefWithPadding coordinates, gmx::ArrayRef xWholeMolecules, t_fcdata* fcdata, - history_t* hist, + const history_t* hist, gmx::ForceOutputs* forceOutputs, const t_forcerec* fr, const struct t_pbc* pbc, diff --git a/src/gromacs/listed_forces/listed_forces.h b/src/gromacs/listed_forces/listed_forces.h index c044baf117..4bed406827 100644 --- a/src/gromacs/listed_forces/listed_forces.h +++ b/src/gromacs/listed_forces/listed_forces.h @@ -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 coordinates, gmx::ArrayRef xWholeMolecules, t_fcdata* fcdata, - history_t* hist, + const history_t* hist, gmx::ForceOutputs* forceOutputs, const t_forcerec* fr, const struct t_pbc* pbc, diff --git a/src/gromacs/listed_forces/orires.cpp b/src/gromacs/listed_forces/orires.cpp index 70e5af4275..47e3eb3714 100644 --- a/src/gromacs/listed_forces/orires.cpp +++ b/src/gromacs/listed_forces/orires.cpp @@ -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; diff --git a/src/gromacs/listed_forces/orires.h b/src/gromacs/listed_forces/orires.h index 37065e8be5..0ad20a07af 100644 --- a/src/gromacs/listed_forces/orires.h +++ b/src/gromacs/listed_forces/orires.h @@ -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. diff --git a/src/gromacs/mdlib/force.h b/src/gromacs/mdlib/force.h index 63f80e8839..608849357f 100644 --- a/src/gromacs/mdlib/force.h +++ b/src/gromacs/mdlib/force.h @@ -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 coordinates, - history_t* hist, + const history_t* hist, gmx::ForceBuffersView* force, tensor vir_force, const t_mdatoms* mdatoms, diff --git a/src/gromacs/mdlib/sim_util.cpp b/src/gromacs/mdlib/sim_util.cpp index 2494b02c6b..0ed4399e70 100644 --- a/src/gromacs/mdlib/sim_util.cpp +++ b/src/gromacs/mdlib/sim_util.cpp @@ -1168,7 +1168,7 @@ void do_force(FILE* fplog, const gmx_localtop_t* top, const matrix box, gmx::ArrayRefWithPadding x, - history_t* hist, + const history_t* hist, gmx::ForceBuffersView* forceView, tensor vir_force, const t_mdatoms* mdatoms, diff --git a/src/gromacs/mdrun/shellfc.cpp b/src/gromacs/mdrun/shellfc.cpp index 9943027574..38b68d157a 100644 --- a/src/gromacs/mdrun/shellfc.cpp +++ b/src/gromacs/mdrun/shellfc.cpp @@ -976,7 +976,7 @@ void relax_shell_flexcon(FILE* fplog, ArrayRefWithPadding vPadded, const matrix box, ArrayRef lambda, - history_t* hist, + const history_t* hist, gmx::ForceBuffersView* f, tensor force_vir, const t_mdatoms* md, diff --git a/src/gromacs/mdrun/shellfc.h b/src/gromacs/mdrun/shellfc.h index f5145cfb8d..3e44708c47 100644 --- a/src/gromacs/mdrun/shellfc.h +++ b/src/gromacs/mdrun/shellfc.h @@ -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 v, const matrix box, gmx::ArrayRef lambda, - history_t* hist, + const history_t* hist, gmx::ForceBuffersView* f, tensor force_vir, const t_mdatoms* md, -- 2.22.0