Merge branch release-2021
[alexxy/gromacs.git] / src / gromacs / listed_forces / listed_forces.cpp
index 5c27087d4c2d4e5e1e54137c95a1916e4300e5a0..a7280159ff90d8d1498defb2986b3a329f3e18ea 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.
@@ -804,8 +804,11 @@ void ListedForces::calculate(struct gmx_wallcycle*                     wcycle,
     // Todo: replace all rvec use here with ArrayRefWithPadding
     const rvec* x = as_rvec_array(coordinates.paddedArrayRef().data());
 
+    const bool calculateRestInteractions =
+            interactionSelection_.test(static_cast<int>(ListedForces::InteractionGroup::Rest));
+
     t_pbc pbc_full; /* Full PBC is needed for position restraints */
-    if (haveRestraints(*fcdata))
+    if (calculateRestInteractions && haveRestraints(*fcdata))
     {
         if (!idef.il[F_POSRES].empty() || !idef.il[F_FBPOSRES].empty())
         {