Make AWH parameters proper C++
[alexxy/gromacs.git] / src / gromacs / applied_forces / awh / coordstate.cpp
index 544a940bb4ad3b1d3c60fe2af2e734e9c50da6b4..f29eee36b06f9d0702e44588f9e6f998598dbdaf 100644 (file)
@@ -67,9 +67,12 @@ CoordState::CoordState(const AwhBiasParams&      awhBiasParams,
                        ArrayRef<const DimParams> dimParams,
                        const BiasGrid&           grid)
 {
-    for (size_t d = 0; d < dimParams.size(); d++)
+    GMX_RELEASE_ASSERT(awhBiasParams.ndim() == dimParams.ssize(),
+                       "Need to have identical size for dimensions");
+    const auto& awhDimParams = awhBiasParams.dimParams();
+    for (int d = 0; d < gmx::ssize(awhDimParams); d++)
     {
-        coordValue_[d] = dimParams[d].scaleUserInputToInternal(awhBiasParams.dimParams[d].coordValueInit);
+        coordValue_[d] = dimParams[d].scaleUserInputToInternal(awhDimParams[d].initialCoordinate());
     }
 
     /* The grid-point index is always the nearest point to the coordinate.