Apply clang-format to source tree
[alexxy/gromacs.git] / src / gromacs / selection / tests / nbsearch.cpp
index 7b6d88e78a2aab54eda42db66eae4690da36dc3f..7e85995a1dda77e71e6e2e62fd10a1b9812eef4b 100644 (file)
@@ -79,128 +79,122 @@ namespace
 
 class NeighborhoodSearchTestData
 {
-    public:
-        struct RefPair
+public:
+    struct RefPair
+    {
+        RefPair(int refIndex, real distance) :
+            refIndex(refIndex),
+            distance(distance),
+            bFound(false),
+            bExcluded(false),
+            bIndexed(true)
         {
-            RefPair(int refIndex, real distance)
-                : refIndex(refIndex), distance(distance), bFound(false),
-                  bExcluded(false), bIndexed(true)
-            {
-            }
+        }
 
-            bool operator<(const RefPair &other) const
-            {
-                return refIndex < other.refIndex;
-            }
+        bool operator<(const RefPair& other) const { return refIndex < other.refIndex; }
+
+        int  refIndex;
+        real distance;
+        // The variables below are state variables that are only used
+        // during the actual testing after creating a copy of the reference
+        // pair list, not as part of the reference data.
+        // Simpler to have just a single structure for both purposes.
+        bool bFound;
+        bool bExcluded;
+        bool bIndexed;
+    };
 
-            int                 refIndex;
-            real                distance;
-            // The variables below are state variables that are only used
-            // during the actual testing after creating a copy of the reference
-            // pair list, not as part of the reference data.
-            // Simpler to have just a single structure for both purposes.
-            bool                bFound;
-            bool                bExcluded;
-            bool                bIndexed;
-        };
-
-        struct TestPosition
+    struct TestPosition
+    {
+        explicit TestPosition(const rvec x) : refMinDist(0.0), refNearestPoint(-1)
         {
-            explicit TestPosition(const rvec x)
-                : refMinDist(0.0), refNearestPoint(-1)
-            {
-                copy_rvec(x, this->x);
-            }
+            copy_rvec(x, this->x);
+        }
 
-            rvec                 x;
-            real                 refMinDist;
-            int                  refNearestPoint;
-            std::vector<RefPair> refPairs;
-        };
+        rvec                 x;
+        real                 refMinDist;
+        int                  refNearestPoint;
+        std::vector<RefPair> refPairs;
+    };
 
-        typedef std::vector<TestPosition> TestPositionList;
+    typedef std::vector<TestPosition> TestPositionList;
 
-        NeighborhoodSearchTestData(uint64_t seed, real cutoff);
+    NeighborhoodSearchTestData(uint64_t seed, real cutoff);
 
-        gmx::AnalysisNeighborhoodPositions refPositions() const
-        {
-            return gmx::AnalysisNeighborhoodPositions(refPos_);
-        }
-        gmx::AnalysisNeighborhoodPositions testPositions() const
+    gmx::AnalysisNeighborhoodPositions refPositions() const
+    {
+        return gmx::AnalysisNeighborhoodPositions(refPos_);
+    }
+    gmx::AnalysisNeighborhoodPositions testPositions() const
+    {
+        if (testPos_.empty())
         {
-            if (testPos_.empty())
+            testPos_.reserve(testPositions_.size());
+            for (size_t i = 0; i < testPositions_.size(); ++i)
             {
-                testPos_.reserve(testPositions_.size());
-                for (size_t i = 0; i < testPositions_.size(); ++i)
-                {
-                    testPos_.emplace_back(testPositions_[i].x);
-                }
+                testPos_.emplace_back(testPositions_[i].x);
             }
-            return gmx::AnalysisNeighborhoodPositions(testPos_);
-        }
-        gmx::AnalysisNeighborhoodPositions testPosition(int index) const
-        {
-            return testPositions().selectSingleFromArray(index);
-        }
-
-        void addTestPosition(const rvec x)
-        {
-            GMX_RELEASE_ASSERT(testPos_.empty(),
-                               "Cannot add positions after testPositions() call");
-            testPositions_.emplace_back(x);
-        }
-        gmx::RVec generateRandomPosition();
-        std::vector<int> generateIndex(int count, uint64_t seed) const;
-        void generateRandomRefPositions(int count);
-        void generateRandomTestPositions(int count);
-        void useRefPositionsAsTestPositions();
-        void computeReferences(t_pbc *pbc)
-        {
-            computeReferencesInternal(pbc, false);
-        }
-        void computeReferencesXY(t_pbc *pbc)
-        {
-            computeReferencesInternal(pbc, true);
         }
+        return gmx::AnalysisNeighborhoodPositions(testPos_);
+    }
+    gmx::AnalysisNeighborhoodPositions testPosition(int index) const
+    {
+        return testPositions().selectSingleFromArray(index);
+    }
 
-        bool containsPair(int testIndex, const RefPair &pair) const
-        {
-            const std::vector<RefPair>          &refPairs = testPositions_[testIndex].refPairs;
-            std::vector<RefPair>::const_iterator foundRefPair
-                = std::lower_bound(refPairs.begin(), refPairs.end(), pair);
-            return !(foundRefPair == refPairs.end() || foundRefPair->refIndex != pair.refIndex);
-        }
+    void addTestPosition(const rvec x)
+    {
+        GMX_RELEASE_ASSERT(testPos_.empty(), "Cannot add positions after testPositions() call");
+        testPositions_.emplace_back(x);
+    }
+    gmx::RVec        generateRandomPosition();
+    std::vector<int> generateIndex(int count, uint64_t seed) const;
+    void             generateRandomRefPositions(int count);
+    void             generateRandomTestPositions(int count);
+    void             useRefPositionsAsTestPositions();
+    void             computeReferences(t_pbc* pbc) { computeReferencesInternal(pbc, false); }
+    void             computeReferencesXY(t_pbc* pbc) { computeReferencesInternal(pbc, true); }
+
+    bool containsPair(int testIndex, const RefPair& pair) const
+    {
+        const std::vector<RefPair>&          refPairs = testPositions_[testIndex].refPairs;
+        std::vector<RefPair>::const_iterator foundRefPair =
+                std::lower_bound(refPairs.begin(), refPairs.end(), pair);
+        return !(foundRefPair == refPairs.end() || foundRefPair->refIndex != pair.refIndex);
+    }
 
-        // Return a tolerance that accounts for the magnitudes of the coordinates
-        // when doing subtractions, so that we set the ULP tolerance relative to the
-        // coordinate values rather than their difference.
-        // i.e., 10.0-9.9999999 will achieve a few ULP accuracy relative
-        // to 10.0, but a much larger error relative to the difference.
-        gmx::test::FloatingPointTolerance relativeTolerance() const
-        {
-            real magnitude = std::max(box_[XX][XX], std::max(box_[YY][YY], box_[ZZ][ZZ]));
-            return gmx::test::relativeToleranceAsUlp(magnitude, 4);
-        }
+    // Return a tolerance that accounts for the magnitudes of the coordinates
+    // when doing subtractions, so that we set the ULP tolerance relative to the
+    // coordinate values rather than their difference.
+    // i.e., 10.0-9.9999999 will achieve a few ULP accuracy relative
+    // to 10.0, but a much larger error relative to the difference.
+    gmx::test::FloatingPointTolerance relativeTolerance() const
+    {
+        real magnitude = std::max(box_[XX][XX], std::max(box_[YY][YY], box_[ZZ][ZZ]));
+        return gmx::test::relativeToleranceAsUlp(magnitude, 4);
+    }
 
-        gmx::DefaultRandomEngine         rng_;
-        real                             cutoff_;
-        matrix                           box_;
-        t_pbc                            pbc_;
-        int                              refPosCount_;
-        std::vector<gmx::RVec>           refPos_;
-        TestPositionList                 testPositions_;
+    gmx::DefaultRandomEngine rng_;
+    real                     cutoff_;
+    matrix                   box_;
+    t_pbc                    pbc_;
+    int                      refPosCount_;
+    std::vector<gmx::RVec>   refPos_;
+    TestPositionList         testPositions_;
 
-    private:
-        void computeReferencesInternal(t_pbc *pbc, bool bXY);
+private:
+    void computeReferencesInternal(t_pbc* pbc, bool bXY);
 
-        mutable std::vector<gmx::RVec>   testPos_;
+    mutable std::vector<gmx::RVec> testPos_;
 };
 
 //! Shorthand for a collection of reference pairs.
 typedef std::vector<NeighborhoodSearchTestData::RefPair> RefPairList;
 
-NeighborhoodSearchTestData::NeighborhoodSearchTestData(uint64_t seed, real cutoff)
-    : rng_(seed), cutoff_(cutoff), refPosCount_(0)
+NeighborhoodSearchTestData::NeighborhoodSearchTestData(uint64_t seed, real cutoff) :
+    rng_(seed),
+    cutoff_(cutoff),
+    refPosCount_(0)
 {
     clear_mat(box_);
     set_pbc(&pbc_, epbcNONE, box_);
@@ -208,8 +202,8 @@ NeighborhoodSearchTestData::NeighborhoodSearchTestData(uint64_t seed, real cutof
 
 gmx::RVec NeighborhoodSearchTestData::generateRandomPosition()
 {
-    gmx::UniformRealDistribution<real>  dist;
-    rvec fx, x;
+    gmx::UniformRealDistribution<real> dist;
+    rvec                               fx, x;
     fx[XX] = dist(rng_);
     fx[YY] = dist(rng_);
     fx[ZZ] = dist(rng_);
@@ -223,9 +217,9 @@ gmx::RVec NeighborhoodSearchTestData::generateRandomPosition()
 
 std::vector<int> NeighborhoodSearchTestData::generateIndex(int count, uint64_t seed) const
 {
-    gmx::DefaultRandomEngine             rngIndex(seed);
-    gmx::UniformRealDistribution<real>   dist;
-    std::vector<int>                     result;
+    gmx::DefaultRandomEngine           rngIndex(seed);
+    gmx::UniformRealDistribution<real> dist;
+    std::vector<int>                   result;
 
     for (int i = 0; i < count; ++i)
     {
@@ -259,20 +253,20 @@ void NeighborhoodSearchTestData::generateRandomTestPositions(int count)
 void NeighborhoodSearchTestData::useRefPositionsAsTestPositions()
 {
     testPositions_.reserve(refPosCount_);
-    for (const auto &refPos : refPos_)
+    for (const autorefPos : refPos_)
     {
         addTestPosition(refPos);
     }
 }
 
-void NeighborhoodSearchTestData::computeReferencesInternal(t_pbc *pbc, bool bXY)
+void NeighborhoodSearchTestData::computeReferencesInternal(t_pbcpbc, bool bXY)
 {
     real cutoff = cutoff_;
     if (cutoff <= 0)
     {
         cutoff = std::numeric_limits<real>::max();
     }
-    for (TestPosition &testPos : testPositions_)
+    for (TestPositiontestPos : testPositions_)
     {
         testPos.refMinDist      = cutoff;
         testPos.refNearestPoint = -1;
@@ -291,8 +285,7 @@ void NeighborhoodSearchTestData::computeReferencesInternal(t_pbc *pbc, bool bXY)
             // TODO: This may not work intuitively for 2D with the third box
             // vector not parallel to the Z axis, but neither does the actual
             // neighborhood search.
-            const real dist =
-                !bXY ? norm(dx) : std::hypot(dx[XX], dx[YY]);
+            const real dist = !bXY ? norm(dx) : std::hypot(dx[XX], dx[YY]);
             if (dist < testPos.refMinDist)
             {
                 testPos.refMinDist      = dist;
@@ -315,47 +308,44 @@ void NeighborhoodSearchTestData::computeReferencesInternal(t_pbc *pbc, bool bXY)
 
 class ExclusionsHelper
 {
-    public:
-        static void markExcludedPairs(RefPairList *refPairs, int testIndex,
-                                      const t_blocka *excls);
+public:
+    static void markExcludedPairs(RefPairList* refPairs, int testIndex, const t_blocka* excls);
 
-        ExclusionsHelper(int refPosCount, int testPosCount);
+    ExclusionsHelper(int refPosCount, int testPosCount);
 
-        void generateExclusions();
+    void generateExclusions();
 
-        const t_blocka *exclusions() const { return &excls_; }
+    const t_blocka* exclusions() const { return &excls_; }
 
-        gmx::ArrayRef<const int> refPosIds() const
-        {
-            return gmx::makeArrayRef(exclusionIds_).subArray(0, refPosCount_);
-        }
-        gmx::ArrayRef<const int> testPosIds() const
-        {
-            return gmx::makeArrayRef(exclusionIds_).subArray(0, testPosCount_);
-        }
+    gmx::ArrayRef<const int> refPosIds() const
+    {
+        return gmx::makeArrayRef(exclusionIds_).subArray(0, refPosCount_);
+    }
+    gmx::ArrayRef<const int> testPosIds() const
+    {
+        return gmx::makeArrayRef(exclusionIds_).subArray(0, testPosCount_);
+    }
 
-    private:
-        int              refPosCount_;
-        int              testPosCount_;
-        std::vector<int> exclusionIds_;
-        std::vector<int> exclsIndex_;
-        std::vector<int> exclsAtoms_;
-        t_blocka         excls_;
+private:
+    int              refPosCount_;
+    int              testPosCount_;
+    std::vector<int> exclusionIds_;
+    std::vector<int> exclsIndex_;
+    std::vector<int> exclsAtoms_;
+    t_blocka         excls_;
 };
 
 // static
-void ExclusionsHelper::markExcludedPairs(RefPairList *refPairs, int testIndex,
-                                         const t_blocka *excls)
+void ExclusionsHelper::markExcludedPairs(RefPairList* refPairs, int testIndex, const t_blocka* excls)
 {
     int count = 0;
     for (int i = excls->index[testIndex]; i < excls->index[testIndex + 1]; ++i)
     {
         const int                           excludedIndex = excls->a[i];
         NeighborhoodSearchTestData::RefPair searchPair(excludedIndex, 0.0);
-        RefPairList::iterator               excludedRefPair
-            = std::lower_bound(refPairs->begin(), refPairs->end(), searchPair);
-        if (excludedRefPair != refPairs->end()
-            && excludedRefPair->refIndex == excludedIndex)
+        RefPairList::iterator               excludedRefPair =
+                std::lower_bound(refPairs->begin(), refPairs->end(), searchPair);
+        if (excludedRefPair != refPairs->end() && excludedRefPair->refIndex == excludedIndex)
         {
             excludedRefPair->bFound    = true;
             excludedRefPair->bExcluded = true;
@@ -364,16 +354,16 @@ void ExclusionsHelper::markExcludedPairs(RefPairList *refPairs, int testIndex,
     }
 }
 
-ExclusionsHelper::ExclusionsHelper(int refPosCount, int testPosCount)
-    : refPosCount_(refPosCount), testPosCount_(testPosCount)
+ExclusionsHelper::ExclusionsHelper(int refPosCount, int testPosCount) :
+    refPosCount_(refPosCount),
+    testPosCount_(testPosCount)
 {
     // Generate an array of 0, 1, 2, ...
     // TODO: Make the tests work also with non-trivial exclusion IDs,
     // and test that.
     exclusionIds_.resize(std::max(refPosCount, testPosCount), 1);
     exclusionIds_[0] = 0;
-    std::partial_sum(exclusionIds_.begin(), exclusionIds_.end(),
-                     exclusionIds_.begin());
+    std::partial_sum(exclusionIds_.begin(), exclusionIds_.end(), exclusionIds_.begin());
 
     excls_.nr           = 0;
     excls_.index        = nullptr;
@@ -396,7 +386,7 @@ void ExclusionsHelper::generateExclusions()
     {
         for (int j = 0; j < 20; ++j)
         {
-            exclsAtoms_.push_back(i + j*3);
+            exclsAtoms_.push_back(i + j * 3);
         }
         exclsIndex_.push_back(exclsAtoms_.size());
     }
@@ -412,45 +402,39 @@ void ExclusionsHelper::generateExclusions()
 
 class NeighborhoodSearchTest : public ::testing::Test
 {
-    public:
-        void testIsWithin(gmx::AnalysisNeighborhoodSearch  *search,
-                          const NeighborhoodSearchTestData &data);
-        void testMinimumDistance(gmx::AnalysisNeighborhoodSearch  *search,
-                                 const NeighborhoodSearchTestData &data);
-        void testNearestPoint(gmx::AnalysisNeighborhoodSearch  *search,
-                              const NeighborhoodSearchTestData &data);
-        void testPairSearch(gmx::AnalysisNeighborhoodSearch  *search,
-                            const NeighborhoodSearchTestData &data);
-        void testPairSearchIndexed(gmx::AnalysisNeighborhood        *nb,
-                                   const NeighborhoodSearchTestData &data,
-                                   uint64_t                          seed);
-        void testPairSearchFull(gmx::AnalysisNeighborhoodSearch          *search,
-                                const NeighborhoodSearchTestData         &data,
-                                const gmx::AnalysisNeighborhoodPositions &pos,
-                                const t_blocka                           *excls,
-                                const gmx::ArrayRef<const int>           &refIndices,
-                                const gmx::ArrayRef<const int>           &testIndices,
-                                bool                                      selfPairs);
-
-        gmx::AnalysisNeighborhood        nb_;
+public:
+    void testIsWithin(gmx::AnalysisNeighborhoodSearch* search, const NeighborhoodSearchTestData& data);
+    void testMinimumDistance(gmx::AnalysisNeighborhoodSearch*  search,
+                             const NeighborhoodSearchTestData& data);
+    void testNearestPoint(gmx::AnalysisNeighborhoodSearch* search, const NeighborhoodSearchTestData& data);
+    void testPairSearch(gmx::AnalysisNeighborhoodSearch* search, const NeighborhoodSearchTestData& data);
+    void testPairSearchIndexed(gmx::AnalysisNeighborhood*        nb,
+                               const NeighborhoodSearchTestData& data,
+                               uint64_t                          seed);
+    void testPairSearchFull(gmx::AnalysisNeighborhoodSearch*          search,
+                            const NeighborhoodSearchTestData&         data,
+                            const gmx::AnalysisNeighborhoodPositions& pos,
+                            const t_blocka*                           excls,
+                            const gmx::ArrayRef<const int>&           refIndices,
+                            const gmx::ArrayRef<const int>&           testIndices,
+                            bool                                      selfPairs);
+
+    gmx::AnalysisNeighborhood nb_;
 };
 
-void NeighborhoodSearchTest::testIsWithin(
-        gmx::AnalysisNeighborhoodSearch  *search,
-        const NeighborhoodSearchTestData &data)
+void NeighborhoodSearchTest::testIsWithin(gmx::AnalysisNeighborhoodSearch*  search,
+                                          const NeighborhoodSearchTestData& data)
 {
     NeighborhoodSearchTestData::TestPositionList::const_iterator i;
     for (i = data.testPositions_.begin(); i != data.testPositions_.end(); ++i)
     {
         const bool bWithin = (i->refMinDist <= data.cutoff_);
-        EXPECT_EQ(bWithin, search->isWithin(i->x))
-        << "Distance is " << i->refMinDist;
+        EXPECT_EQ(bWithin, search->isWithin(i->x)) << "Distance is " << i->refMinDist;
     }
 }
 
-void NeighborhoodSearchTest::testMinimumDistance(
-        gmx::AnalysisNeighborhoodSearch  *search,
-        const NeighborhoodSearchTestData &data)
+void NeighborhoodSearchTest::testMinimumDistance(gmx::AnalysisNeighborhoodSearch*  search,
+                                                 const NeighborhoodSearchTestData& data)
 {
     NeighborhoodSearchTestData::TestPositionList::const_iterator i;
 
@@ -461,9 +445,8 @@ void NeighborhoodSearchTest::testMinimumDistance(
     }
 }
 
-void NeighborhoodSearchTest::testNearestPoint(
-        gmx::AnalysisNeighborhoodSearch  *search,
-        const NeighborhoodSearchTestData &data)
+void NeighborhoodSearchTest::testNearestPoint(gmx::AnalysisNeighborhoodSearch*  search,
+                                              const NeighborhoodSearchTestData& data)
 {
     NeighborhoodSearchTestData::TestPositionList::const_iterator i;
     for (i = data.testPositions_.begin(); i != data.testPositions_.end(); ++i)
@@ -491,9 +474,10 @@ std::string formatVector(const rvec x)
 /*! \brief
  * Helper function to check that all expected pairs were found.
  */
-void checkAllPairsFound(const RefPairList &refPairs,
-                        const std::vector<gmx::RVec> &refPos,
-                        int testPosIndex, const rvec testPos)
+void checkAllPairsFound(const RefPairList&            refPairs,
+                        const std::vector<gmx::RVec>& refPos,
+                        int                           testPosIndex,
+                        const rvec                    testPos)
 {
     // This could be elegantly expressed with Google Mock matchers, but that
     // has a significant effect on the runtime of the tests...
@@ -509,46 +493,39 @@ void checkAllPairsFound(const RefPairList &refPairs,
     }
     if (count > 0)
     {
-        ADD_FAILURE()
-        << "Some pairs (" << count << "/" << refPairs.size() << ") "
-        << "within the cutoff were not found. First pair:\n"
-        << " Ref: " << first->refIndex << " at "
-        << formatVector(refPos[first->refIndex]) << "\n"
-        << "Test: " << testPosIndex << " at " << formatVector(testPos) << "\n"
-        << "Dist: " << first->distance;
+        ADD_FAILURE() << "Some pairs (" << count << "/" << refPairs.size() << ") "
+                      << "within the cutoff were not found. First pair:\n"
+                      << " Ref: " << first->refIndex << " at "
+                      << formatVector(refPos[first->refIndex]) << "\n"
+                      << "Test: " << testPosIndex << " at " << formatVector(testPos) << "\n"
+                      << "Dist: " << first->distance;
     }
 }
 
-void NeighborhoodSearchTest::testPairSearch(
-        gmx::AnalysisNeighborhoodSearch  *search,
-        const NeighborhoodSearchTestData &data)
+void NeighborhoodSearchTest::testPairSearch(gmx::AnalysisNeighborhoodSearch*  search,
+                                            const NeighborhoodSearchTestData& data)
 {
-    testPairSearchFull(search, data, data.testPositions(), nullptr,
-                       {}, {}, false);
+    testPairSearchFull(search, data, data.testPositions(), nullptr, {}, {}, false);
 }
 
-void NeighborhoodSearchTest::testPairSearchIndexed(
-        gmx::AnalysisNeighborhood        *nb,
-        const NeighborhoodSearchTestData &data,
-        uint64_t                          seed)
+void NeighborhoodSearchTest::testPairSearchIndexed(gmx::AnalysisNeighborhood*        nb,
+                                                   const NeighborhoodSearchTestData& data,
+                                                   uint64_t                          seed)
 {
-    std::vector<int>                refIndices(data.generateIndex(data.refPos_.size(), seed++));
-    std::vector<int>                testIndices(data.generateIndex(data.testPositions_.size(), seed++));
+    std::vector<int> refIndices(data.generateIndex(data.refPos_.size(), seed++));
+    std::vector<int> testIndices(data.generateIndex(data.testPositions_.size(), seed++));
     gmx::AnalysisNeighborhoodSearch search =
-        nb->initSearch(&data.pbc_,
-                       data.refPositions().indexed(refIndices));
-    testPairSearchFull(&search, data, data.testPositions(), nullptr,
-                       refIndices, testIndices, false);
+            nb->initSearch(&data.pbc_, data.refPositions().indexed(refIndices));
+    testPairSearchFull(&search, data, data.testPositions(), nullptr, refIndices, testIndices, false);
 }
 
-void NeighborhoodSearchTest::testPairSearchFull(
-        gmx::AnalysisNeighborhoodSearch          *search,
-        const NeighborhoodSearchTestData         &data,
-        const gmx::AnalysisNeighborhoodPositions &pos,
-        const t_blocka                           *excls,
-        const gmx::ArrayRef<const int>           &refIndices,
-        const gmx::ArrayRef<const int>           &testIndices,
-        bool                                      selfPairs)
+void NeighborhoodSearchTest::testPairSearchFull(gmx::AnalysisNeighborhoodSearch*          search,
+                                                const NeighborhoodSearchTestData&         data,
+                                                const gmx::AnalysisNeighborhoodPositions& pos,
+                                                const t_blocka*                           excls,
+                                                const gmx::ArrayRef<const int>& refIndices,
+                                                const gmx::ArrayRef<const int>& testIndices,
+                                                bool                            selfPairs)
 {
     std::map<int, RefPairList> refPairs;
     // TODO: Some parts of this code do not work properly if pos does not
@@ -570,7 +547,7 @@ void NeighborhoodSearchTest::testPairSearchFull(
     if (excls != nullptr)
     {
         GMX_RELEASE_ASSERT(!selfPairs, "Self-pairs testing not implemented with exclusions");
-        for (auto &entry : refPairs)
+        for (autoentry : refPairs)
         {
             const int testIndex = entry.first;
             ExclusionsHelper::markExcludedPairs(&entry.second, testIndex, excls);
@@ -579,9 +556,9 @@ void NeighborhoodSearchTest::testPairSearchFull(
     if (!refIndices.empty())
     {
         GMX_RELEASE_ASSERT(!selfPairs, "Self-pairs testing not implemented with indexing");
-        for (auto &entry : refPairs)
+        for (autoentry : refPairs)
         {
-            for (auto &refPair : entry.second)
+            for (autorefPair : entry.second)
             {
                 refPair.bIndexed = false;
             }
@@ -594,7 +571,7 @@ void NeighborhoodSearchTest::testPairSearchFull(
                     refPair->bIndexed = true;
                 }
             }
-            for (auto &refPair : entry.second)
+            for (autorefPair : entry.second)
             {
                 if (!refPair.bIndexed)
                 {
@@ -604,62 +581,51 @@ void NeighborhoodSearchTest::testPairSearchFull(
         }
     }
 
-    gmx::AnalysisNeighborhoodPositions  posCopy(pos);
+    gmx::AnalysisNeighborhoodPositions posCopy(pos);
     if (!testIndices.empty())
     {
         posCopy.indexed(testIndices);
     }
-    gmx::AnalysisNeighborhoodPairSearch pairSearch
-        = selfPairs
-            ? search->startSelfPairSearch()
-            : search->startPairSearch(posCopy);
-    gmx::AnalysisNeighborhoodPair       pair;
+    gmx::AnalysisNeighborhoodPairSearch pairSearch =
+            selfPairs ? search->startSelfPairSearch() : search->startPairSearch(posCopy);
+    gmx::AnalysisNeighborhoodPair pair;
     while (pairSearch.findNextPair(&pair))
     {
-        const int testIndex =
-            (testIndices.empty() ? pair.testIndex() : testIndices[pair.testIndex()]);
-        const int refIndex =
-            (refIndices.empty() ? pair.refIndex() : refIndices[pair.refIndex()]);
+        const int testIndex = (testIndices.empty() ? pair.testIndex() : testIndices[pair.testIndex()]);
+        const int refIndex = (refIndices.empty() ? pair.refIndex() : refIndices[pair.refIndex()]);
 
         if (refPairs.count(testIndex) == 0)
         {
-            ADD_FAILURE()
-            << "Expected: No pairs are returned for test position " << testIndex << ".\n"
-            << "  Actual: Pair with ref " << refIndex << " is returned.";
+            ADD_FAILURE() << "Expected: No pairs are returned for test position " << testIndex << ".\n"
+                          << "  Actual: Pair with ref " << refIndex << " is returned.";
             continue;
         }
-        NeighborhoodSearchTestData::RefPair searchPair(refIndex,
-                                                       std::sqrt(pair.distance2()));
-        const auto foundRefPair
-            = std::lower_bound(refPairs[testIndex].begin(), refPairs[testIndex].end(),
-                               searchPair);
+        NeighborhoodSearchTestData::RefPair searchPair(refIndex, std::sqrt(pair.distance2()));
+        const auto                          foundRefPair =
+                std::lower_bound(refPairs[testIndex].begin(), refPairs[testIndex].end(), searchPair);
         if (foundRefPair == refPairs[testIndex].end() || foundRefPair->refIndex != refIndex)
         {
-            ADD_FAILURE()
-            << "Expected: Pair (ref: " << refIndex << ", test: " << testIndex
-            << ") is not within the cutoff.\n"
-            << "  Actual: It is returned.";
+            ADD_FAILURE() << "Expected: Pair (ref: " << refIndex << ", test: " << testIndex
+                          << ") is not within the cutoff.\n"
+                          << "  Actual: It is returned.";
         }
         else if (foundRefPair->bExcluded)
         {
-            ADD_FAILURE()
-            << "Expected: Pair (ref: " << refIndex << ", test: " << testIndex
-            << ") is excluded from the search.\n"
-            << "  Actual: It is returned.";
+            ADD_FAILURE() << "Expected: Pair (ref: " << refIndex << ", test: " << testIndex
+                          << ") is excluded from the search.\n"
+                          << "  Actual: It is returned.";
         }
         else if (!foundRefPair->bIndexed)
         {
-            ADD_FAILURE()
-            << "Expected: Pair (ref: " << refIndex << ", test: " << testIndex
-            << ") is not part of the indexed set.\n"
-            << "  Actual: It is returned.";
+            ADD_FAILURE() << "Expected: Pair (ref: " << refIndex << ", test: " << testIndex
+                          << ") is not part of the indexed set.\n"
+                          << "  Actual: It is returned.";
         }
         else if (foundRefPair->bFound)
         {
-            ADD_FAILURE()
-            << "Expected: Pair (ref: " << refIndex << ", test: " << testIndex
-            << ") is returned only once.\n"
-            << "  Actual: It is returned multiple times.";
+            ADD_FAILURE() << "Expected: Pair (ref: " << refIndex << ", test: " << testIndex
+                          << ") is returned only once.\n"
+                          << "  Actual: It is returned multiple times.";
             return;
         }
         else
@@ -667,13 +633,12 @@ void NeighborhoodSearchTest::testPairSearchFull(
             foundRefPair->bFound = true;
 
             EXPECT_REAL_EQ_TOL(foundRefPair->distance, searchPair.distance, data.relativeTolerance())
-            << "Distance computed by the neighborhood search does not match.";
+                    << "Distance computed by the neighborhood search does not match.";
             if (selfPairs)
             {
-                searchPair = NeighborhoodSearchTestData::RefPair(testIndex, 0.0);
-                const auto otherRefPair
-                    = std::lower_bound(refPairs[refIndex].begin(), refPairs[refIndex].end(),
-                                       searchPair);
+                searchPair              = NeighborhoodSearchTestData::RefPair(testIndex, 0.0);
+                const auto otherRefPair = std::lower_bound(refPairs[refIndex].begin(),
+                                                           refPairs[refIndex].end(), searchPair);
                 GMX_RELEASE_ASSERT(otherRefPair != refPairs[refIndex].end(),
                                    "Precomputed reference data is not symmetric");
                 otherRefPair->bFound = true;
@@ -681,11 +646,10 @@ void NeighborhoodSearchTest::testPairSearchFull(
         }
     }
 
-    for (auto &entry : refPairs)
+    for (autoentry : refPairs)
     {
         const int testIndex = entry.first;
-        checkAllPairsFound(entry.second, data.refPos_, testIndex,
-                           data.testPositions_[testIndex].x);
+        checkAllPairsFound(entry.second, data.refPos_, testIndex, data.testPositions_[testIndex].x);
     }
 }
 
@@ -695,229 +659,229 @@ void NeighborhoodSearchTest::testPairSearchFull(
 
 class TrivialTestData
 {
-    public:
-        static const NeighborhoodSearchTestData &get()
-        {
-            static TrivialTestData singleton;
-            return singleton.data_;
-        }
+public:
+    static const NeighborhoodSearchTestData& get()
+    {
+        static TrivialTestData singleton;
+        return singleton.data_;
+    }
 
-        TrivialTestData() : data_(12345, 1.0)
-        {
-            // Make the box so small we are virtually guaranteed to have
-            // several neighbors for the five test positions
-            data_.box_[XX][XX] = 3.0;
-            data_.box_[YY][YY] = 3.0;
-            data_.box_[ZZ][ZZ] = 3.0;
-            data_.generateRandomRefPositions(10);
-            data_.generateRandomTestPositions(5);
-            set_pbc(&data_.pbc_, epbcXYZ, data_.box_);
-            data_.computeReferences(&data_.pbc_);
-        }
+    TrivialTestData() : data_(12345, 1.0)
+    {
+        // Make the box so small we are virtually guaranteed to have
+        // several neighbors for the five test positions
+        data_.box_[XX][XX] = 3.0;
+        data_.box_[YY][YY] = 3.0;
+        data_.box_[ZZ][ZZ] = 3.0;
+        data_.generateRandomRefPositions(10);
+        data_.generateRandomTestPositions(5);
+        set_pbc(&data_.pbc_, epbcXYZ, data_.box_);
+        data_.computeReferences(&data_.pbc_);
+    }
 
-    private:
-        NeighborhoodSearchTestData data_;
+private:
+    NeighborhoodSearchTestData data_;
 };
 
 class TrivialSelfPairsTestData
 {
-    public:
-        static const NeighborhoodSearchTestData &get()
-        {
-            static TrivialSelfPairsTestData singleton;
-            return singleton.data_;
-        }
+public:
+    static const NeighborhoodSearchTestData& get()
+    {
+        static TrivialSelfPairsTestData singleton;
+        return singleton.data_;
+    }
 
-        TrivialSelfPairsTestData() : data_(12345, 1.0)
-        {
-            data_.box_[XX][XX] = 3.0;
-            data_.box_[YY][YY] = 3.0;
-            data_.box_[ZZ][ZZ] = 3.0;
-            data_.generateRandomRefPositions(20);
-            data_.useRefPositionsAsTestPositions();
-            set_pbc(&data_.pbc_, epbcXYZ, data_.box_);
-            data_.computeReferences(&data_.pbc_);
-        }
+    TrivialSelfPairsTestData() : data_(12345, 1.0)
+    {
+        data_.box_[XX][XX] = 3.0;
+        data_.box_[YY][YY] = 3.0;
+        data_.box_[ZZ][ZZ] = 3.0;
+        data_.generateRandomRefPositions(20);
+        data_.useRefPositionsAsTestPositions();
+        set_pbc(&data_.pbc_, epbcXYZ, data_.box_);
+        data_.computeReferences(&data_.pbc_);
+    }
 
-    private:
-        NeighborhoodSearchTestData data_;
+private:
+    NeighborhoodSearchTestData data_;
 };
 
 class TrivialNoPBCTestData
 {
-    public:
-        static const NeighborhoodSearchTestData &get()
-        {
-            static TrivialNoPBCTestData singleton;
-            return singleton.data_;
-        }
+public:
+    static const NeighborhoodSearchTestData& get()
+    {
+        static TrivialNoPBCTestData singleton;
+        return singleton.data_;
+    }
 
-        TrivialNoPBCTestData() : data_(12345, 1.0)
-        {
-            data_.generateRandomRefPositions(10);
-            data_.generateRandomTestPositions(5);
-            data_.computeReferences(nullptr);
-        }
+    TrivialNoPBCTestData() : data_(12345, 1.0)
+    {
+        data_.generateRandomRefPositions(10);
+        data_.generateRandomTestPositions(5);
+        data_.computeReferences(nullptr);
+    }
 
-    private:
-        NeighborhoodSearchTestData data_;
+private:
+    NeighborhoodSearchTestData data_;
 };
 
 class RandomBoxFullPBCData
 {
-    public:
-        static const NeighborhoodSearchTestData &get()
-        {
-            static RandomBoxFullPBCData singleton;
-            return singleton.data_;
-        }
+public:
+    static const NeighborhoodSearchTestData& get()
+    {
+        static RandomBoxFullPBCData singleton;
+        return singleton.data_;
+    }
 
-        RandomBoxFullPBCData() : data_(12345, 1.0)
-        {
-            data_.box_[XX][XX] = 10.0;
-            data_.box_[YY][YY] = 5.0;
-            data_.box_[ZZ][ZZ] = 7.0;
-            // TODO: Consider whether manually picking some positions would give better
-            // test coverage.
-            data_.generateRandomRefPositions(1000);
-            data_.generateRandomTestPositions(100);
-            set_pbc(&data_.pbc_, epbcXYZ, data_.box_);
-            data_.computeReferences(&data_.pbc_);
-        }
+    RandomBoxFullPBCData() : data_(12345, 1.0)
+    {
+        data_.box_[XX][XX] = 10.0;
+        data_.box_[YY][YY] = 5.0;
+        data_.box_[ZZ][ZZ] = 7.0;
+        // TODO: Consider whether manually picking some positions would give better
+        // test coverage.
+        data_.generateRandomRefPositions(1000);
+        data_.generateRandomTestPositions(100);
+        set_pbc(&data_.pbc_, epbcXYZ, data_.box_);
+        data_.computeReferences(&data_.pbc_);
+    }
 
-    private:
-        NeighborhoodSearchTestData data_;
+private:
+    NeighborhoodSearchTestData data_;
 };
 
 class RandomBoxSelfPairsData
 {
-    public:
-        static const NeighborhoodSearchTestData &get()
-        {
-            static RandomBoxSelfPairsData singleton;
-            return singleton.data_;
-        }
+public:
+    static const NeighborhoodSearchTestData& get()
+    {
+        static RandomBoxSelfPairsData singleton;
+        return singleton.data_;
+    }
 
-        RandomBoxSelfPairsData() : data_(12345, 1.0)
-        {
-            data_.box_[XX][XX] = 10.0;
-            data_.box_[YY][YY] = 5.0;
-            data_.box_[ZZ][ZZ] = 7.0;
-            data_.generateRandomRefPositions(1000);
-            data_.useRefPositionsAsTestPositions();
-            set_pbc(&data_.pbc_, epbcXYZ, data_.box_);
-            data_.computeReferences(&data_.pbc_);
-        }
+    RandomBoxSelfPairsData() : data_(12345, 1.0)
+    {
+        data_.box_[XX][XX] = 10.0;
+        data_.box_[YY][YY] = 5.0;
+        data_.box_[ZZ][ZZ] = 7.0;
+        data_.generateRandomRefPositions(1000);
+        data_.useRefPositionsAsTestPositions();
+        set_pbc(&data_.pbc_, epbcXYZ, data_.box_);
+        data_.computeReferences(&data_.pbc_);
+    }
 
-    private:
-        NeighborhoodSearchTestData data_;
+private:
+    NeighborhoodSearchTestData data_;
 };
 
 class RandomBoxXYFullPBCData
 {
-    public:
-        static const NeighborhoodSearchTestData &get()
-        {
-            static RandomBoxXYFullPBCData singleton;
-            return singleton.data_;
-        }
+public:
+    static const NeighborhoodSearchTestData& get()
+    {
+        static RandomBoxXYFullPBCData singleton;
+        return singleton.data_;
+    }
 
-        RandomBoxXYFullPBCData() : data_(54321, 1.0)
-        {
-            data_.box_[XX][XX] = 10.0;
-            data_.box_[YY][YY] = 5.0;
-            data_.box_[ZZ][ZZ] = 7.0;
-            // TODO: Consider whether manually picking some positions would give better
-            // test coverage.
-            data_.generateRandomRefPositions(1000);
-            data_.generateRandomTestPositions(100);
-            set_pbc(&data_.pbc_, epbcXYZ, data_.box_);
-            data_.computeReferencesXY(&data_.pbc_);
-        }
+    RandomBoxXYFullPBCData() : data_(54321, 1.0)
+    {
+        data_.box_[XX][XX] = 10.0;
+        data_.box_[YY][YY] = 5.0;
+        data_.box_[ZZ][ZZ] = 7.0;
+        // TODO: Consider whether manually picking some positions would give better
+        // test coverage.
+        data_.generateRandomRefPositions(1000);
+        data_.generateRandomTestPositions(100);
+        set_pbc(&data_.pbc_, epbcXYZ, data_.box_);
+        data_.computeReferencesXY(&data_.pbc_);
+    }
 
-    private:
-        NeighborhoodSearchTestData data_;
+private:
+    NeighborhoodSearchTestData data_;
 };
 
 class RandomTriclinicFullPBCData
 {
-    public:
-        static const NeighborhoodSearchTestData &get()
-        {
-            static RandomTriclinicFullPBCData singleton;
-            return singleton.data_;
-        }
+public:
+    static const NeighborhoodSearchTestData& get()
+    {
+        static RandomTriclinicFullPBCData singleton;
+        return singleton.data_;
+    }
 
-        RandomTriclinicFullPBCData() : data_(12345, 1.0)
-        {
-            data_.box_[XX][XX] = 5.0;
-            data_.box_[YY][XX] = 2.5;
-            data_.box_[YY][YY] = 2.5*std::sqrt(3.0);
-            data_.box_[ZZ][XX] = 2.5;
-            data_.box_[ZZ][YY] = 2.5*std::sqrt(1.0/3.0);
-            data_.box_[ZZ][ZZ] = 5.0*std::sqrt(2.0/3.0);
-            // TODO: Consider whether manually picking some positions would give better
-            // test coverage.
-            data_.generateRandomRefPositions(1000);
-            data_.generateRandomTestPositions(100);
-            set_pbc(&data_.pbc_, epbcXYZ, data_.box_);
-            data_.computeReferences(&data_.pbc_);
-        }
+    RandomTriclinicFullPBCData() : data_(12345, 1.0)
+    {
+        data_.box_[XX][XX] = 5.0;
+        data_.box_[YY][XX] = 2.5;
+        data_.box_[YY][YY] = 2.5 * std::sqrt(3.0);
+        data_.box_[ZZ][XX] = 2.5;
+        data_.box_[ZZ][YY] = 2.5 * std::sqrt(1.0 / 3.0);
+        data_.box_[ZZ][ZZ] = 5.0 * std::sqrt(2.0 / 3.0);
+        // TODO: Consider whether manually picking some positions would give better
+        // test coverage.
+        data_.generateRandomRefPositions(1000);
+        data_.generateRandomTestPositions(100);
+        set_pbc(&data_.pbc_, epbcXYZ, data_.box_);
+        data_.computeReferences(&data_.pbc_);
+    }
 
-    private:
-        NeighborhoodSearchTestData data_;
+private:
+    NeighborhoodSearchTestData data_;
 };
 
 class RandomBox2DPBCData
 {
-    public:
-        static const NeighborhoodSearchTestData &get()
-        {
-            static RandomBox2DPBCData singleton;
-            return singleton.data_;
-        }
+public:
+    static const NeighborhoodSearchTestData& get()
+    {
+        static RandomBox2DPBCData singleton;
+        return singleton.data_;
+    }
 
-        RandomBox2DPBCData() : data_(12345, 1.0)
-        {
-            data_.box_[XX][XX] = 10.0;
-            data_.box_[YY][YY] = 7.0;
-            data_.box_[ZZ][ZZ] = 5.0;
-            // TODO: Consider whether manually picking some positions would give better
-            // test coverage.
-            data_.generateRandomRefPositions(1000);
-            data_.generateRandomTestPositions(100);
-            set_pbc(&data_.pbc_, epbcXY, data_.box_);
-            data_.computeReferences(&data_.pbc_);
-        }
+    RandomBox2DPBCData() : data_(12345, 1.0)
+    {
+        data_.box_[XX][XX] = 10.0;
+        data_.box_[YY][YY] = 7.0;
+        data_.box_[ZZ][ZZ] = 5.0;
+        // TODO: Consider whether manually picking some positions would give better
+        // test coverage.
+        data_.generateRandomRefPositions(1000);
+        data_.generateRandomTestPositions(100);
+        set_pbc(&data_.pbc_, epbcXY, data_.box_);
+        data_.computeReferences(&data_.pbc_);
+    }
 
-    private:
-        NeighborhoodSearchTestData data_;
+private:
+    NeighborhoodSearchTestData data_;
 };
 
 class RandomBoxNoPBCData
 {
-    public:
-        static const NeighborhoodSearchTestData &get()
-        {
-            static RandomBoxNoPBCData singleton;
-            return singleton.data_;
-        }
+public:
+    static const NeighborhoodSearchTestData& get()
+    {
+        static RandomBoxNoPBCData singleton;
+        return singleton.data_;
+    }
 
-        RandomBoxNoPBCData() : data_(12345, 1.0)
-        {
-            data_.box_[XX][XX] = 10.0;
-            data_.box_[YY][YY] = 5.0;
-            data_.box_[ZZ][ZZ] = 7.0;
-            // TODO: Consider whether manually picking some positions would give better
-            // test coverage.
-            data_.generateRandomRefPositions(1000);
-            data_.generateRandomTestPositions(100);
-            set_pbc(&data_.pbc_, epbcNONE, data_.box_);
-            data_.computeReferences(nullptr);
-        }
+    RandomBoxNoPBCData() : data_(12345, 1.0)
+    {
+        data_.box_[XX][XX] = 10.0;
+        data_.box_[YY][YY] = 5.0;
+        data_.box_[ZZ][ZZ] = 7.0;
+        // TODO: Consider whether manually picking some positions would give better
+        // test coverage.
+        data_.generateRandomRefPositions(1000);
+        data_.generateRandomTestPositions(100);
+        set_pbc(&data_.pbc_, epbcNONE, data_.box_);
+        data_.computeReferences(nullptr);
+    }
 
-    private:
-        NeighborhoodSearchTestData data_;
+private:
+    NeighborhoodSearchTestData data_;
 };
 
 /********************************************************************
@@ -926,12 +890,11 @@ class RandomBoxNoPBCData
 
 TEST_F(NeighborhoodSearchTest, SimpleSearch)
 {
-    const NeighborhoodSearchTestData &data = RandomBoxFullPBCData::get();
+    const NeighborhoodSearchTestDatadata = RandomBoxFullPBCData::get();
 
     nb_.setCutoff(data.cutoff_);
     nb_.setMode(gmx::AnalysisNeighborhood::eSearchMode_Simple);
-    gmx::AnalysisNeighborhoodSearch search =
-        nb_.initSearch(&data.pbc_, data.refPositions());
+    gmx::AnalysisNeighborhoodSearch search = nb_.initSearch(&data.pbc_, data.refPositions());
     ASSERT_EQ(gmx::AnalysisNeighborhood::eSearchMode_Simple, search.mode());
 
     testIsWithin(&search, data);
@@ -945,13 +908,12 @@ TEST_F(NeighborhoodSearchTest, SimpleSearch)
 
 TEST_F(NeighborhoodSearchTest, SimpleSearchXY)
 {
-    const NeighborhoodSearchTestData &data = RandomBoxXYFullPBCData::get();
+    const NeighborhoodSearchTestDatadata = RandomBoxXYFullPBCData::get();
 
     nb_.setCutoff(data.cutoff_);
     nb_.setMode(gmx::AnalysisNeighborhood::eSearchMode_Simple);
     nb_.setXYMode(true);
-    gmx::AnalysisNeighborhoodSearch search =
-        nb_.initSearch(&data.pbc_, data.refPositions());
+    gmx::AnalysisNeighborhoodSearch search = nb_.initSearch(&data.pbc_, data.refPositions());
     ASSERT_EQ(gmx::AnalysisNeighborhood::eSearchMode_Simple, search.mode());
 
     testIsWithin(&search, data);
@@ -962,12 +924,11 @@ TEST_F(NeighborhoodSearchTest, SimpleSearchXY)
 
 TEST_F(NeighborhoodSearchTest, GridSearchBox)
 {
-    const NeighborhoodSearchTestData &data = RandomBoxFullPBCData::get();
+    const NeighborhoodSearchTestDatadata = RandomBoxFullPBCData::get();
 
     nb_.setCutoff(data.cutoff_);
     nb_.setMode(gmx::AnalysisNeighborhood::eSearchMode_Grid);
-    gmx::AnalysisNeighborhoodSearch search =
-        nb_.initSearch(&data.pbc_, data.refPositions());
+    gmx::AnalysisNeighborhoodSearch search = nb_.initSearch(&data.pbc_, data.refPositions());
     ASSERT_EQ(gmx::AnalysisNeighborhood::eSearchMode_Grid, search.mode());
 
     testIsWithin(&search, data);
@@ -981,12 +942,11 @@ TEST_F(NeighborhoodSearchTest, GridSearchBox)
 
 TEST_F(NeighborhoodSearchTest, GridSearchTriclinic)
 {
-    const NeighborhoodSearchTestData &data = RandomTriclinicFullPBCData::get();
+    const NeighborhoodSearchTestDatadata = RandomTriclinicFullPBCData::get();
 
     nb_.setCutoff(data.cutoff_);
     nb_.setMode(gmx::AnalysisNeighborhood::eSearchMode_Grid);
-    gmx::AnalysisNeighborhoodSearch search =
-        nb_.initSearch(&data.pbc_, data.refPositions());
+    gmx::AnalysisNeighborhoodSearch search = nb_.initSearch(&data.pbc_, data.refPositions());
     ASSERT_EQ(gmx::AnalysisNeighborhood::eSearchMode_Grid, search.mode());
 
     testPairSearch(&search, data);
@@ -994,12 +954,11 @@ TEST_F(NeighborhoodSearchTest, GridSearchTriclinic)
 
 TEST_F(NeighborhoodSearchTest, GridSearch2DPBC)
 {
-    const NeighborhoodSearchTestData &data = RandomBox2DPBCData::get();
+    const NeighborhoodSearchTestDatadata = RandomBox2DPBCData::get();
 
     nb_.setCutoff(data.cutoff_);
     nb_.setMode(gmx::AnalysisNeighborhood::eSearchMode_Grid);
-    gmx::AnalysisNeighborhoodSearch search =
-        nb_.initSearch(&data.pbc_, data.refPositions());
+    gmx::AnalysisNeighborhoodSearch search = nb_.initSearch(&data.pbc_, data.refPositions());
     ASSERT_EQ(gmx::AnalysisNeighborhood::eSearchMode_Grid, search.mode());
 
     testIsWithin(&search, data);
@@ -1010,12 +969,11 @@ TEST_F(NeighborhoodSearchTest, GridSearch2DPBC)
 
 TEST_F(NeighborhoodSearchTest, GridSearchNoPBC)
 {
-    const NeighborhoodSearchTestData &data = RandomBoxNoPBCData::get();
+    const NeighborhoodSearchTestDatadata = RandomBoxNoPBCData::get();
 
     nb_.setCutoff(data.cutoff_);
     nb_.setMode(gmx::AnalysisNeighborhood::eSearchMode_Grid);
-    gmx::AnalysisNeighborhoodSearch search =
-        nb_.initSearch(&data.pbc_, data.refPositions());
+    gmx::AnalysisNeighborhoodSearch search = nb_.initSearch(&data.pbc_, data.refPositions());
     ASSERT_EQ(gmx::AnalysisNeighborhood::eSearchMode_Grid, search.mode());
 
     testPairSearch(&search, data);
@@ -1023,13 +981,12 @@ TEST_F(NeighborhoodSearchTest, GridSearchNoPBC)
 
 TEST_F(NeighborhoodSearchTest, GridSearchXYBox)
 {
-    const NeighborhoodSearchTestData &data = RandomBoxXYFullPBCData::get();
+    const NeighborhoodSearchTestDatadata = RandomBoxXYFullPBCData::get();
 
     nb_.setCutoff(data.cutoff_);
     nb_.setMode(gmx::AnalysisNeighborhood::eSearchMode_Grid);
     nb_.setXYMode(true);
-    gmx::AnalysisNeighborhoodSearch search =
-        nb_.initSearch(&data.pbc_, data.refPositions());
+    gmx::AnalysisNeighborhoodSearch search = nb_.initSearch(&data.pbc_, data.refPositions());
     ASSERT_EQ(gmx::AnalysisNeighborhood::eSearchMode_Grid, search.mode());
 
     testIsWithin(&search, data);
@@ -1040,55 +997,47 @@ TEST_F(NeighborhoodSearchTest, GridSearchXYBox)
 
 TEST_F(NeighborhoodSearchTest, SimpleSelfPairsSearch)
 {
-    const NeighborhoodSearchTestData &data = TrivialSelfPairsTestData::get();
+    const NeighborhoodSearchTestDatadata = TrivialSelfPairsTestData::get();
 
     nb_.setCutoff(data.cutoff_);
     nb_.setMode(gmx::AnalysisNeighborhood::eSearchMode_Simple);
-    gmx::AnalysisNeighborhoodSearch search =
-        nb_.initSearch(&data.pbc_, data.refPositions());
+    gmx::AnalysisNeighborhoodSearch search = nb_.initSearch(&data.pbc_, data.refPositions());
     ASSERT_EQ(gmx::AnalysisNeighborhood::eSearchMode_Simple, search.mode());
 
-    testPairSearchFull(&search, data, data.testPositions(), nullptr,
-                       {}, {}, true);
+    testPairSearchFull(&search, data, data.testPositions(), nullptr, {}, {}, true);
 }
 
 TEST_F(NeighborhoodSearchTest, GridSelfPairsSearch)
 {
-    const NeighborhoodSearchTestData &data = RandomBoxSelfPairsData::get();
+    const NeighborhoodSearchTestDatadata = RandomBoxSelfPairsData::get();
 
     nb_.setCutoff(data.cutoff_);
     nb_.setMode(gmx::AnalysisNeighborhood::eSearchMode_Grid);
-    gmx::AnalysisNeighborhoodSearch search =
-        nb_.initSearch(&data.pbc_, data.refPositions());
+    gmx::AnalysisNeighborhoodSearch search = nb_.initSearch(&data.pbc_, data.refPositions());
     ASSERT_EQ(gmx::AnalysisNeighborhood::eSearchMode_Grid, search.mode());
 
-    testPairSearchFull(&search, data, data.testPositions(), nullptr,
-                       {}, {}, true);
+    testPairSearchFull(&search, data, data.testPositions(), nullptr, {}, {}, true);
 }
 
 TEST_F(NeighborhoodSearchTest, HandlesConcurrentSearches)
 {
-    const NeighborhoodSearchTestData &data = TrivialTestData::get();
+    const NeighborhoodSearchTestDatadata = TrivialTestData::get();
 
     nb_.setCutoff(data.cutoff_);
-    gmx::AnalysisNeighborhoodSearch search1 =
-        nb_.initSearch(&data.pbc_, data.refPositions());
-    gmx::AnalysisNeighborhoodSearch search2 =
-        nb_.initSearch(&data.pbc_, data.refPositions());
+    gmx::AnalysisNeighborhoodSearch search1 = nb_.initSearch(&data.pbc_, data.refPositions());
+    gmx::AnalysisNeighborhoodSearch search2 = nb_.initSearch(&data.pbc_, data.refPositions());
 
     // These checks are fragile, and unfortunately depend on the random
     // engine used to create the test positions. There is no particular reason
     // why exactly particles 0 & 2 should have neighbors, but in this case they do.
-    gmx::AnalysisNeighborhoodPairSearch pairSearch1 =
-        search1.startPairSearch(data.testPosition(0));
-    gmx::AnalysisNeighborhoodPairSearch pairSearch2 =
-        search1.startPairSearch(data.testPosition(2));
+    gmx::AnalysisNeighborhoodPairSearch pairSearch1 = search1.startPairSearch(data.testPosition(0));
+    gmx::AnalysisNeighborhoodPairSearch pairSearch2 = search1.startPairSearch(data.testPosition(2));
 
     testPairSearch(&search2, data);
 
     gmx::AnalysisNeighborhoodPair pair;
     ASSERT_TRUE(pairSearch1.findNextPair(&pair))
-    << "Test data did not contain any pairs for position 0 (problem in the test).";
+            << "Test data did not contain any pairs for position 0 (problem in the test).";
     EXPECT_EQ(0, pair.testIndex());
     {
         NeighborhoodSearchTestData::RefPair searchPair(pair.refIndex(), std::sqrt(pair.distance2()));
@@ -1096,7 +1045,7 @@ TEST_F(NeighborhoodSearchTest, HandlesConcurrentSearches)
     }
 
     ASSERT_TRUE(pairSearch2.findNextPair(&pair))
-    << "Test data did not contain any pairs for position 2 (problem in the test).";
+            << "Test data did not contain any pairs for position 2 (problem in the test).";
     EXPECT_EQ(2, pair.testIndex());
     {
         NeighborhoodSearchTestData::RefPair searchPair(pair.refIndex(), std::sqrt(pair.distance2()));
@@ -1106,11 +1055,10 @@ TEST_F(NeighborhoodSearchTest, HandlesConcurrentSearches)
 
 TEST_F(NeighborhoodSearchTest, HandlesNoPBC)
 {
-    const NeighborhoodSearchTestData &data = TrivialNoPBCTestData::get();
+    const NeighborhoodSearchTestDatadata = TrivialNoPBCTestData::get();
 
     nb_.setCutoff(data.cutoff_);
-    gmx::AnalysisNeighborhoodSearch search =
-        nb_.initSearch(&data.pbc_, data.refPositions());
+    gmx::AnalysisNeighborhoodSearch search = nb_.initSearch(&data.pbc_, data.refPositions());
     ASSERT_EQ(gmx::AnalysisNeighborhood::eSearchMode_Simple, search.mode());
 
     testIsWithin(&search, data);
@@ -1121,11 +1069,10 @@ TEST_F(NeighborhoodSearchTest, HandlesNoPBC)
 
 TEST_F(NeighborhoodSearchTest, HandlesNullPBC)
 {
-    const NeighborhoodSearchTestData &data = TrivialNoPBCTestData::get();
+    const NeighborhoodSearchTestDatadata = TrivialNoPBCTestData::get();
 
     nb_.setCutoff(data.cutoff_);
-    gmx::AnalysisNeighborhoodSearch search =
-        nb_.initSearch(nullptr, data.refPositions());
+    gmx::AnalysisNeighborhoodSearch search = nb_.initSearch(nullptr, data.refPositions());
     ASSERT_EQ(gmx::AnalysisNeighborhood::eSearchMode_Simple, search.mode());
 
     testIsWithin(&search, data);
@@ -1136,13 +1083,11 @@ TEST_F(NeighborhoodSearchTest, HandlesNullPBC)
 
 TEST_F(NeighborhoodSearchTest, HandlesSkippingPairs)
 {
-    const NeighborhoodSearchTestData &data = TrivialTestData::get();
+    const NeighborhoodSearchTestDatadata = TrivialTestData::get();
 
     nb_.setCutoff(data.cutoff_);
-    gmx::AnalysisNeighborhoodSearch     search =
-        nb_.initSearch(&data.pbc_, data.refPositions());
-    gmx::AnalysisNeighborhoodPairSearch pairSearch =
-        search.startPairSearch(data.testPositions());
+    gmx::AnalysisNeighborhoodSearch     search = nb_.initSearch(&data.pbc_, data.refPositions());
+    gmx::AnalysisNeighborhoodPairSearch pairSearch = search.startPairSearch(data.testPositions());
     gmx::AnalysisNeighborhoodPair       pair;
     // TODO: This test needs to be adjusted if the grid search gets optimized
     // to loop over the test positions in cell order (first, the ordering
@@ -1165,44 +1110,38 @@ TEST_F(NeighborhoodSearchTest, HandlesSkippingPairs)
 
 TEST_F(NeighborhoodSearchTest, SimpleSearchExclusions)
 {
-    const NeighborhoodSearchTestData &data = RandomBoxFullPBCData::get();
+    const NeighborhoodSearchTestDatadata = RandomBoxFullPBCData::get();
 
-    ExclusionsHelper                  helper(data.refPosCount_, data.testPositions_.size());
+    ExclusionsHelper helper(data.refPosCount_, data.testPositions_.size());
     helper.generateExclusions();
 
     nb_.setCutoff(data.cutoff_);
     nb_.setTopologyExclusions(helper.exclusions());
     nb_.setMode(gmx::AnalysisNeighborhood::eSearchMode_Simple);
     gmx::AnalysisNeighborhoodSearch search =
-        nb_.initSearch(&data.pbc_,
-                       data.refPositions().exclusionIds(helper.refPosIds()));
+            nb_.initSearch(&data.pbc_, data.refPositions().exclusionIds(helper.refPosIds()));
     ASSERT_EQ(gmx::AnalysisNeighborhood::eSearchMode_Simple, search.mode());
 
-    testPairSearchFull(&search, data,
-                       data.testPositions().exclusionIds(helper.testPosIds()),
-                       helper.exclusions(), {},
-                       {}, false);
+    testPairSearchFull(&search, data, data.testPositions().exclusionIds(helper.testPosIds()),
+                       helper.exclusions(), {}, {}, false);
 }
 
 TEST_F(NeighborhoodSearchTest, GridSearchExclusions)
 {
-    const NeighborhoodSearchTestData &data = RandomBoxFullPBCData::get();
+    const NeighborhoodSearchTestDatadata = RandomBoxFullPBCData::get();
 
-    ExclusionsHelper                  helper(data.refPosCount_, data.testPositions_.size());
+    ExclusionsHelper helper(data.refPosCount_, data.testPositions_.size());
     helper.generateExclusions();
 
     nb_.setCutoff(data.cutoff_);
     nb_.setTopologyExclusions(helper.exclusions());
     nb_.setMode(gmx::AnalysisNeighborhood::eSearchMode_Grid);
     gmx::AnalysisNeighborhoodSearch search =
-        nb_.initSearch(&data.pbc_,
-                       data.refPositions().exclusionIds(helper.refPosIds()));
+            nb_.initSearch(&data.pbc_, data.refPositions().exclusionIds(helper.refPosIds()));
     ASSERT_EQ(gmx::AnalysisNeighborhood::eSearchMode_Grid, search.mode());
 
-    testPairSearchFull(&search, data,
-                       data.testPositions().exclusionIds(helper.testPosIds()),
-                       helper.exclusions(), {},
-                       {}, false);
+    testPairSearchFull(&search, data, data.testPositions().exclusionIds(helper.testPosIds()),
+                       helper.exclusions(), {}, {}, false);
 }
 
 } // namespace