Remove mdatoms from forceprovider call signature
[alexxy/gromacs.git] / src / gromacs / restraint / restraintmdmodule.cpp
index b1dcb03d09c0f3eef63b75d5b6e2062fc581d262..5ea9cdd07c91b856f427acd5daecb42e9d2ac7ce 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * 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.
@@ -68,8 +68,8 @@ void RestraintForceProvider::calculateForces(const ForceProviderInput& forceProv
 {
     GMX_ASSERT(restraint_, "Restraint must be initialized.");
 
-    const auto& mdatoms = forceProviderInput.mdatoms_;
-    GMX_ASSERT(mdatoms.homenr >= 0, "number of home atoms must be non-negative.");
+    const int homenr = forceProviderInput.homenr_;
+    GMX_ASSERT(homenr >= 0, "number of home atoms must be non-negative.");
 
     const auto& box = forceProviderInput.box_;
     GMX_ASSERT(check_box(PbcType::Unset, box) == nullptr, "Invalid box.");
@@ -80,7 +80,7 @@ void RestraintForceProvider::calculateForces(const ForceProviderInput& forceProv
     const auto& cr = forceProviderInput.cr_;
     const auto& t  = forceProviderInput.t_;
     // Cooperatively get Cartesian coordinates for center of mass of each site
-    RVec r1 = sites_[0].centerOfMass(cr, static_cast<size_t>(mdatoms.homenr), x, t);
+    RVec r1 = sites_[0].centerOfMass(cr, static_cast<size_t>(homenr), x, t);
     // r2 is to be constructed as
     // r2 = (site[N] - site[N-1]) + (site_{N-1} - site_{N-2}) + ... + (site_2 - site_1) + site_1
     // where the minimum image convention is applied to each path but not to the overall sum.
@@ -96,8 +96,8 @@ void RestraintForceProvider::calculateForces(const ForceProviderInput& forceProv
     // a big molecule in a small box.
     for (size_t i = 0; i < sites_.size() - 1; ++i)
     {
-        RVec a = sites_[i].centerOfMass(cr, static_cast<size_t>(mdatoms.homenr), x, t);
-        RVec b = sites_[i + 1].centerOfMass(cr, static_cast<size_t>(mdatoms.homenr), x, t);
+        RVec a = sites_[i].centerOfMass(cr, static_cast<size_t>(homenr), x, t);
+        RVec b = sites_[i + 1].centerOfMass(cr, static_cast<size_t>(homenr), x, t);
         // dr = minimum_image_vector(b - a)
         pbc_dx(&pbc, b, a, dr);
         r2[0] += dr[0];