Expand signatures for nblib listed forces calculator
[alexxy/gromacs.git] / api / nblib / listed_forces / tests / helpers.cpp
index e265bf7f335762e4b5258b87f1f6599111057f48..e705c16978226d76f8e357b10ce109fb9ee31287 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2020, by the GROMACS development team, led by
+ * Copyright (c) 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.
@@ -62,7 +62,7 @@ TEST(NBlibTest, CanSplitListedWork)
 {
     ListedInteractionData interactions;
 
-    DefaultAngle     angle(Degrees(1), 1);
+    HarmonicAngle    angle(1, Degrees(1));
     HarmonicBondType bond(1, 1);
 
     int largestIndex = 20;
@@ -71,30 +71,30 @@ TEST(NBlibTest, CanSplitListedWork)
     std::vector<InteractionIndex<HarmonicBondType>> bondIndices{
         { 0, 1, 0 }, { 0, 6, 0 }, { 11, 12, 0 }, { 18, 19, 0 }
     };
-    std::vector<InteractionIndex<DefaultAngle>> angleIndices{
+    std::vector<InteractionIndex<HarmonicAngle>> angleIndices{
         { 0, 1, 2, 0 }, { 0, 6, 7, 0 }, { 11, 12, 13, 0 }, { 17, 19, 18, 0 }
     };
 
     pickType<HarmonicBondType>(interactions).indices = bondIndices;
-    pickType<DefaultAngle>(interactions).indices     = angleIndices;
+    pickType<HarmonicAngle>(interactions).indices    = angleIndices;
 
     std::vector<ListedInteractionData> splitInteractions =
             splitListedWork(interactions, largestIndex, nSplits);
 
     std::vector<InteractionIndex<HarmonicBondType>> refBondIndices0{ { 0, 1, 0 }, { 0, 6, 0 } };
-    std::vector<InteractionIndex<DefaultAngle>> refAngleIndices0{ { 0, 1, 2, 0 }, { 0, 6, 7, 0 } };
+    std::vector<InteractionIndex<HarmonicAngle>> refAngleIndices0{ { 0, 1, 2, 0 }, { 0, 6, 7, 0 } };
     std::vector<InteractionIndex<HarmonicBondType>> refBondIndices1{ { 11, 12, 0 } };
-    std::vector<InteractionIndex<DefaultAngle>>     refAngleIndices1{ { 11, 12, 13, 0 } };
+    std::vector<InteractionIndex<HarmonicAngle>>    refAngleIndices1{ { 11, 12, 13, 0 } };
     std::vector<InteractionIndex<HarmonicBondType>> refBondIndices2{ { 18, 19, 0 } };
-    std::vector<InteractionIndex<DefaultAngle>>     refAngleIndices2{ { 17, 19, 18, 0 } };
+    std::vector<InteractionIndex<HarmonicAngle>>    refAngleIndices2{ { 17, 19, 18, 0 } };
 
     EXPECT_EQ(refBondIndices0, pickType<HarmonicBondType>(splitInteractions[0]).indices);
     EXPECT_EQ(refBondIndices1, pickType<HarmonicBondType>(splitInteractions[1]).indices);
     EXPECT_EQ(refBondIndices2, pickType<HarmonicBondType>(splitInteractions[2]).indices);
 
-    EXPECT_EQ(refAngleIndices0, pickType<DefaultAngle>(splitInteractions[0]).indices);
-    EXPECT_EQ(refAngleIndices1, pickType<DefaultAngle>(splitInteractions[1]).indices);
-    EXPECT_EQ(refAngleIndices2, pickType<DefaultAngle>(splitInteractions[2]).indices);
+    EXPECT_EQ(refAngleIndices0, pickType<HarmonicAngle>(splitInteractions[0]).indices);
+    EXPECT_EQ(refAngleIndices1, pickType<HarmonicAngle>(splitInteractions[1]).indices);
+    EXPECT_EQ(refAngleIndices2, pickType<HarmonicAngle>(splitInteractions[2]).indices);
 }
 
 
@@ -106,12 +106,13 @@ TEST(NBlibTest, ListedForceBuffer)
     T              vzero{ 0, 0, 0 };
     std::vector<T> masterBuffer(ncoords, vzero);
 
-    // the ForceBuffer is going to access indices [10-15) through the masterBuffer
+    // the ForceBufferProxy is going to access indices [10-15) through the masterBuffer
     // and the outliers internally
     int rangeStart = 10;
     int rangeEnd   = 15;
 
-    ForceBuffer<T> forceBuffer(masterBuffer.data(), rangeStart, rangeEnd);
+    ForceBufferProxy<T> forceBuffer(rangeStart, rangeEnd);
+    forceBuffer.setMasterBuffer(masterBuffer);
 
     // in range
     T internal1{ 1, 2, 3 };
@@ -131,8 +132,8 @@ TEST(NBlibTest, ListedForceBuffer)
     {
         for (size_t m = 0; m < dimSize; ++m)
         {
-            EXPECT_REAL_EQ_TOL(refMasterBuffer[i][m], masterBuffer[i][m],
-                               gmx::test::defaultRealTolerance());
+            EXPECT_REAL_EQ_TOL(
+                    refMasterBuffer[i][m], masterBuffer[i][m], gmx::test::defaultRealTolerance());
         }
     }