diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 18637cc563..ad9e4babe4 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -40,7 +40,7 @@ function(dissolve_add_test) target_link_libraries( ${TEST_NAME} PUBLIC ${WHOLE_ARCHIVE_FLAG} ${BASIC_LINK_LIBS} ${MODULENOGUI_LINK_LIBS} ${NO_WHOLE_ARCHIVE_FLAG} - PRIVATE ${CORE_LINK_LIBS} GTest::gtest_main + PRIVATE ${CORE_LINK_LIBS} testing GTest::gtest_main ) if(DISSOLVE_UNIT_TEST_GUI) @@ -62,6 +62,13 @@ function(dissolve_add_test) endfunction() +add_library(testing testing.cpp testGraph.cpp testing.h testGraph.h) +target_link_libraries(testing PRIVATE GTest::gtest_main) +target_include_directories( + testing PRIVATE ${PROJECT_SOURCE_DIR}/src ${PROJECT_BINARY_DIR}/src ${PROJECT_SOURCE_DIR} ${CONAN_INCLUDE_DIRS_GTEST} + ${CONAN_INCLUDE_DIRS_PUGIXML} +) + # Add unit test subdirectories add_subdirectory(algorithms) add_subdirectory(classes) diff --git a/tests/algorithms/array3DIterator.cpp b/tests/algorithms/array3DIterator.cpp index 82de4161d1..54d971350c 100644 --- a/tests/algorithms/array3DIterator.cpp +++ b/tests/algorithms/array3DIterator.cpp @@ -6,8 +6,8 @@ #include "templates/algorithms.h" #include "templates/array3D.h" #include +#include -#include "iostream" namespace UnitTest { diff --git a/tests/algorithms/zip.cpp b/tests/algorithms/zip.cpp index f37362f124..f97f4c8bf9 100644 --- a/tests/algorithms/zip.cpp +++ b/tests/algorithms/zip.cpp @@ -4,7 +4,6 @@ #include "templates/algorithms.h" #include #include -#include #include namespace UnitTest diff --git a/tests/classes/cells.cpp b/tests/classes/cells.cpp index 788b490642..7188b54170 100644 --- a/tests/classes/cells.cpp +++ b/tests/classes/cells.cpp @@ -2,12 +2,13 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "classes/atomType.h" +#include "classes/configuration.h" #include "classes/species.h" #include "kernels/energy.h" #include "main/dissolve.h" #include "math/mathFunc.h" -#include "tests/graphData.h" -#include +#include "nodes/species.h" +#include "tests/testGraph.h" namespace UnitTest { diff --git a/tests/classes/cells3.cpp b/tests/classes/cells3.cpp index 8908ed9a55..c21b868dad 100644 --- a/tests/classes/cells3.cpp +++ b/tests/classes/cells3.cpp @@ -1,10 +1,11 @@ // SPDX-License-Identifier: GPL-3.0-or-later // Copyright (c) 2026 Team Dissolve and contributors +#include "classes/configuration.h" #include "kernels/energy.h" +#include "nodes/species.h" #include "templates/algorithms.h" -#include "tests/graphData.h" -#include +#include "tests/testGraph.h" namespace UnitTest { diff --git a/tests/classes/cells4.cpp b/tests/classes/cells4.cpp index 6742c039fb..e203bd9800 100644 --- a/tests/classes/cells4.cpp +++ b/tests/classes/cells4.cpp @@ -1,8 +1,8 @@ // SPDX-License-Identifier: GPL-3.0-or-later // Copyright (c) 2026 Team Dissolve and contributors -#include "tests/graphData.h" -#include +#include "classes/configuration.h" +#include "tests/testGraph.h" namespace UnitTest { diff --git a/tests/classes/doubleKeyedMap.cpp b/tests/classes/doubleKeyedMap.cpp index 87927f8502..c0ecdad747 100644 --- a/tests/classes/doubleKeyedMap.cpp +++ b/tests/classes/doubleKeyedMap.cpp @@ -2,8 +2,7 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "templates/doubleKeyedMap.h" -#include -#include +#include "tests/testing.h" namespace UnitTest { diff --git a/tests/classes/empiricalFormula.cpp b/tests/classes/empiricalFormula.cpp index 44f6ea0745..ad5f033478 100644 --- a/tests/classes/empiricalFormula.cpp +++ b/tests/classes/empiricalFormula.cpp @@ -2,7 +2,7 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "classes/empiricalFormula.h" -#include "tests/testData.h" +#include "classes/species.h" #include TEST(EmpiricalFormulaTest, Order) diff --git a/tests/classes/history.cpp b/tests/classes/history.cpp index 3046f87d21..489485d51f 100644 --- a/tests/classes/history.cpp +++ b/tests/classes/history.cpp @@ -3,9 +3,8 @@ #include "math/history.h" #include "nodes/number.h" -#include "tests/graphData.h" -#include "tests/testData.h" -#include +#include "nodes/species.h" +#include "tests/testGraph.h" namespace UnitTest { @@ -80,11 +79,11 @@ TEST(History, CustomClass) for (auto n = 1; n <= 5; ++n) { sum += n; - EXPECT_TRUE(DissolveSystemTest::checkData1D(d * (sum / n), "Original", a.push(d * n, avgLength), "Averaged")); + EXPECT_TRUE(testData1D(d * (sum / n), "Original", a.push(d * n, avgLength), "Averaged")); } tomlRoundTrip(a, b); - EXPECT_TRUE(DissolveSystemTest::checkData1D(a.average(), "A", b.average(), "B")); + EXPECT_TRUE(testData1D(a.average(), "A", b.average(), "B")); } TEST(History, CustomClassWithInitialiser) @@ -131,15 +130,13 @@ TEST(History, CustomClassWithInitialiser) for (auto n = 0; n < 3; ++n) { auto avg = a.push(p, avgLength); + EXPECT_TRUE(testData1D(p.partials().get("Ar//Ar"), "Partial", avg.partials().get("Ar//Ar"), "Averaged")); + EXPECT_TRUE(testData1D(p.boundPartials().get("Ar//Ar"), "BoundPartial", avg.boundPartials().get("Ar//Ar"), "Averaged")); + EXPECT_TRUE(testData1D(p.boundTotal(), "BoundTotal", avg.boundTotal(), "Averaged")); EXPECT_TRUE( - DissolveSystemTest::checkData1D(p.partials().get("Ar//Ar"), "Partial", avg.partials().get("Ar//Ar"), "Averaged")); - EXPECT_TRUE(DissolveSystemTest::checkData1D(p.boundPartials().get("Ar//Ar"), "BoundPartial", - avg.boundPartials().get("Ar//Ar"), "Averaged")); - EXPECT_TRUE(DissolveSystemTest::checkData1D(p.boundTotal(), "BoundTotal", avg.boundTotal(), "Averaged")); - EXPECT_TRUE(DissolveSystemTest::checkData1D(p.unboundPartials().get("Ar//Ar"), "UnboundPartial", - avg.unboundPartials().get("Ar//Ar"), "Averaged")); - EXPECT_TRUE(DissolveSystemTest::checkData1D(p.unboundTotal(), "UnboundTotal", avg.unboundTotal(), "Averaged")); - EXPECT_TRUE(DissolveSystemTest::checkData1D(p.total(), "Total", avg.total(), "Averaged")); + testData1D(p.unboundPartials().get("Ar//Ar"), "UnboundPartial", avg.unboundPartials().get("Ar//Ar"), "Averaged")); + EXPECT_TRUE(testData1D(p.unboundTotal(), "UnboundTotal", avg.unboundTotal(), "Averaged")); + EXPECT_TRUE(testData1D(p.total(), "Total", avg.total(), "Averaged")); } // Accumulate opposite trig values - just test partials as the totals are not automatically modified by PartialSet @@ -149,21 +146,20 @@ TEST(History, CustomClassWithInitialiser) for (auto n = 1; n <= 3; ++n) { auto avg = a.push(p, avgLength); - EXPECT_TRUE( - DissolveSystemTest::checkData1D(p.partials().get("Ar//Ar"), "Partial", avg.partials().get("Ar//Ar"), "Averaged")); - EXPECT_TRUE(DissolveSystemTest::checkData1D((dcos * (avgLength - n) - dsin * n) / avgLength, "BoundPartial", - avg.boundPartials().get("Ar//Ar"), "Averaged")); - EXPECT_TRUE(DissolveSystemTest::checkData1D((dsin * (avgLength - n) - dcos * n) / avgLength, "UnboundPartial", - avg.unboundPartials().get("Ar//Ar"), "Averaged")); + EXPECT_TRUE(testData1D(p.partials().get("Ar//Ar"), "Partial", avg.partials().get("Ar//Ar"), "Averaged")); + EXPECT_TRUE(testData1D((dcos * (avgLength - n) - dsin * n) / avgLength, "BoundPartial", + avg.boundPartials().get("Ar//Ar"), "Averaged")); + EXPECT_TRUE(testData1D((dsin * (avgLength - n) - dcos * n) / avgLength, "UnboundPartial", + avg.unboundPartials().get("Ar//Ar"), "Averaged")); } tomlRoundTrip(a, b); auto avgA = a.average(); auto avgB = b.average(); - EXPECT_TRUE(DissolveSystemTest::checkData1D(avgA.boundPartials().get("Ar//Ar"), "BoundPartialA", - avgB.boundPartials().get("Ar//Ar"), "BoundPartialB")); - EXPECT_TRUE(DissolveSystemTest::checkData1D(avgA.unboundPartials().get("Ar//Ar"), "UnboundPartialA", - avgB.unboundPartials().get("Ar//Ar"), "UnboundPartialB")); + EXPECT_TRUE( + testData1D(avgA.boundPartials().get("Ar//Ar"), "BoundPartialA", avgB.boundPartials().get("Ar//Ar"), "BoundPartialB")); + EXPECT_TRUE(testData1D(avgA.unboundPartials().get("Ar//Ar"), "UnboundPartialA", avgB.unboundPartials().get("Ar//Ar"), + "UnboundPartialB")); } } // namespace UnitTest \ No newline at end of file diff --git a/tests/classes/neta.cpp b/tests/classes/neta.cpp index d826515867..5295894f4a 100644 --- a/tests/classes/neta.cpp +++ b/tests/classes/neta.cpp @@ -6,7 +6,6 @@ #include "data/elements.h" #include "data/ff/ff.h" #include "templates/algorithms.h" -#include "tests/testData.h" #include #include diff --git a/tests/classes/neutronWeights.cpp b/tests/classes/neutronWeights.cpp index 1e4b12c922..54517f9f1b 100644 --- a/tests/classes/neutronWeights.cpp +++ b/tests/classes/neutronWeights.cpp @@ -3,10 +3,9 @@ #include "classes/neutronWeights.h" #include "classes/isotopologueSet.h" -#include "tests/graphData.h" +#include "classes/species.h" #include "tests/tempFile.h" -#include "tests/testData.h" -#include +#include "tests/testing.h" namespace UnitTest { diff --git a/tests/classes/potentialSet.cpp b/tests/classes/potentialSet.cpp index f0771cfbf9..3a6378dc96 100644 --- a/tests/classes/potentialSet.cpp +++ b/tests/classes/potentialSet.cpp @@ -5,7 +5,6 @@ #include "classes/atomType.h" #include "math/data1D.h" #include "math/history.h" -#include "tests/testData.h" #include namespace UnitTest diff --git a/tests/classes/speciesSite.cpp b/tests/classes/speciesSite.cpp index 8ba399f869..beb336b209 100644 --- a/tests/classes/speciesSite.cpp +++ b/tests/classes/speciesSite.cpp @@ -3,7 +3,6 @@ #include "classes/site.h" #include "classes/species.h" -#include "tests/testData.h" #include namespace UnitTest diff --git a/tests/classes/structure.cpp b/tests/classes/structure.cpp index e07c5032b5..d54799b7b9 100644 --- a/tests/classes/structure.cpp +++ b/tests/classes/structure.cpp @@ -3,9 +3,8 @@ #include "classes/structure.h" #include "nodes/calculateBonding.h" -#include "tests/graphData.h" +#include "tests/testGraph.h" #include -#include namespace UnitTest { diff --git a/tests/ff/assignment-Kulmala2010.cpp b/tests/ff/assignment-Kulmala2010.cpp index b710da0af8..726a6ddaa8 100644 --- a/tests/ff/assignment-Kulmala2010.cpp +++ b/tests/ff/assignment-Kulmala2010.cpp @@ -2,15 +2,13 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "data/ff/library.h" -#include "tests/graphData.h" -#include "tests/testData.h" -#include +#include "nodes/species.h" +#include "tests/testGraph.h" namespace UnitTest { TEST(Kulmala2010AssignmentTest, Hydronium) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield( "Hydronium", "ImportXYZStructure", "xyz/hydronium.xyz", ForcefieldLibrary::forcefield("Kulmala2010")); @@ -23,14 +21,13 @@ TEST(Kulmala2010AssignmentTest, Hydronium) ASSERT_EQ(species.torsions().size(), 0); ASSERT_EQ(species.impropers().size(), 0); - systemTest.checkSpeciesAtomType(&species, {{0, "OW+"}, {1, "HW+"}, {2, "HW+"}, {3, "HW+"}}); - systemTest.checkSpeciesIntramolecular(&species, {0, 1}, {BondFunctions::Form::Harmonic, "k=4030 eq=0.969"}); - systemTest.checkSpeciesIntramolecular(&species, {1, 0, 2}, {AngleFunctions::Form::Harmonic, "k=451.4 eq=113.1"}); + testSpeciesAtomType(&species, {{0, "OW+"}, {1, "HW+"}, {2, "HW+"}, {3, "HW+"}}); + testSpeciesIntramolecular(&species, {0, 1}, {BondFunctions::Form::Harmonic, "k=4030 eq=0.969"}); + testSpeciesIntramolecular(&species, {1, 0, 2}, {AngleFunctions::Form::Harmonic, "k=451.4 eq=113.1"}); } TEST(Kulmala2010AssignmentTest, Ammonia) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("Ammonia", "ImportXYZStructure", "xyz/ammonia.xyz", ForcefieldLibrary::forcefield("Kulmala2010")); @@ -43,14 +40,13 @@ TEST(Kulmala2010AssignmentTest, Ammonia) ASSERT_EQ(species.torsions().size(), 0); ASSERT_EQ(species.impropers().size(), 0); - systemTest.checkSpeciesAtomType(&species, {{0, "NH"}, {1, "HN"}, {2, "HN"}, {3, "HN"}}); - systemTest.checkSpeciesIntramolecular(&species, {0, 1}, {BondFunctions::Form::Harmonic, "k=3864 eq=1.003"}); - systemTest.checkSpeciesIntramolecular(&species, {1, 0, 2}, {AngleFunctions::Form::Harmonic, "k=334.01 eq=107.18"}); + testSpeciesAtomType(&species, {{0, "NH"}, {1, "HN"}, {2, "HN"}, {3, "HN"}}); + testSpeciesIntramolecular(&species, {0, 1}, {BondFunctions::Form::Harmonic, "k=3864 eq=1.003"}); + testSpeciesIntramolecular(&species, {1, 0, 2}, {AngleFunctions::Form::Harmonic, "k=334.01 eq=107.18"}); } TEST(Kulmala2010AssignmentTest, Ammonium) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("Ammonium", "ImportXYZStructure", "xyz/ammonium.xyz", ForcefieldLibrary::forcefield("Kulmala2010")); @@ -63,14 +59,13 @@ TEST(Kulmala2010AssignmentTest, Ammonium) ASSERT_EQ(species.torsions().size(), 0); ASSERT_EQ(species.impropers().size(), 0); - systemTest.checkSpeciesAtomType(&species, {{0, "NH+"}, {1, "HN+"}, {2, "HN+"}, {3, "HN+"}}); - systemTest.checkSpeciesIntramolecular(&species, {0, 1}, {BondFunctions::Form::Harmonic, "k=3660.3 eq=1.013"}); - systemTest.checkSpeciesIntramolecular(&species, {1, 0, 2}, {AngleFunctions::Form::Harmonic, "k=518.26 eq=109.47"}); + testSpeciesAtomType(&species, {{0, "NH+"}, {1, "HN+"}, {2, "HN+"}, {3, "HN+"}}); + testSpeciesIntramolecular(&species, {0, 1}, {BondFunctions::Form::Harmonic, "k=3660.3 eq=1.013"}); + testSpeciesIntramolecular(&species, {1, 0, 2}, {AngleFunctions::Form::Harmonic, "k=518.26 eq=109.47"}); } TEST(Kulmala2010AssignmentTest, Dimethylammonium) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield( "Dimethylammonium", "ImportXYZStructure", "xyz/dimethylammonium.xyz", ForcefieldLibrary::forcefield("Kulmala2010")); @@ -83,31 +78,30 @@ TEST(Kulmala2010AssignmentTest, Dimethylammonium) ASSERT_EQ(species.torsions().size(), 18); ASSERT_EQ(species.impropers().size(), 0); - systemTest.checkSpeciesAtomType(&species, {{0, "NDM"}, - {1, "HDM"}, - {2, "HDM"}, - {3, "CDM"}, - {4, "CDM"}, - {5, "HCD"}, - {6, "HCD"}, - {7, "HCD"}, - {8, "HCD"}, - {9, "HCD"}, - {10, "HCD"}}); - systemTest.checkSpeciesIntramolecular(&species, {0, 1}, {BondFunctions::Form::Harmonic, "k=3632 eq=1.01"}); - systemTest.checkSpeciesIntramolecular(&species, {0, 3}, {BondFunctions::Form::Harmonic, "k=3071 eq=1.499"}); - systemTest.checkSpeciesIntramolecular(&species, {3, 8}, {BondFunctions::Form::Harmonic, "k=2845.12 eq=1.09"}); - systemTest.checkSpeciesIntramolecular(&species, {2, 0, 1}, {AngleFunctions::Form::Harmonic, "k=292.9 eq=105.5"}); - systemTest.checkSpeciesIntramolecular(&species, {3, 0, 1}, {AngleFunctions::Form::Harmonic, "k=418.4 eq=109.2"}); - systemTest.checkSpeciesIntramolecular(&species, {0, 3, 8}, {AngleFunctions::Form::Harmonic, "k=209.2 eq=108.5"}); - systemTest.checkSpeciesIntramolecular(&species, {9, 3, 8}, {AngleFunctions::Form::Harmonic, "k=276.144 eq=107.8"}); - systemTest.checkSpeciesIntramolecular(&species, {2, 0, 4, 5}, {TorsionFunctions::Form::Cos3, "0 0 0"}); - systemTest.checkSpeciesIntramolecular(&species, {3, 0, 4, 5}, {TorsionFunctions::Form::Cos3, "0 0 3.3765"}); + testSpeciesAtomType(&species, {{0, "NDM"}, + {1, "HDM"}, + {2, "HDM"}, + {3, "CDM"}, + {4, "CDM"}, + {5, "HCD"}, + {6, "HCD"}, + {7, "HCD"}, + {8, "HCD"}, + {9, "HCD"}, + {10, "HCD"}}); + testSpeciesIntramolecular(&species, {0, 1}, {BondFunctions::Form::Harmonic, "k=3632 eq=1.01"}); + testSpeciesIntramolecular(&species, {0, 3}, {BondFunctions::Form::Harmonic, "k=3071 eq=1.499"}); + testSpeciesIntramolecular(&species, {3, 8}, {BondFunctions::Form::Harmonic, "k=2845.12 eq=1.09"}); + testSpeciesIntramolecular(&species, {2, 0, 1}, {AngleFunctions::Form::Harmonic, "k=292.9 eq=105.5"}); + testSpeciesIntramolecular(&species, {3, 0, 1}, {AngleFunctions::Form::Harmonic, "k=418.4 eq=109.2"}); + testSpeciesIntramolecular(&species, {0, 3, 8}, {AngleFunctions::Form::Harmonic, "k=209.2 eq=108.5"}); + testSpeciesIntramolecular(&species, {9, 3, 8}, {AngleFunctions::Form::Harmonic, "k=276.144 eq=107.8"}); + testSpeciesIntramolecular(&species, {2, 0, 4, 5}, {TorsionFunctions::Form::Cos3, "0 0 0"}); + testSpeciesIntramolecular(&species, {3, 0, 4, 5}, {TorsionFunctions::Form::Cos3, "0 0 3.3765"}); } TEST(Kulmala2010AssignmentTest, H2SO4) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("H2SO4", "ImportXYZStructure", "xyz/h2so4.xyz", ForcefieldLibrary::forcefield("Kulmala2010")); @@ -120,19 +114,17 @@ TEST(Kulmala2010AssignmentTest, H2SO4) ASSERT_EQ(species.torsions().size(), 6); ASSERT_EQ(species.impropers().size(), 0); - systemTest.checkSpeciesAtomType(&species, - {{0, "SA"}, {1, "OA"}, {2, "OA"}, {3, "OHA"}, {4, "OHA"}, {5, "HSA"}, {6, "HSA"}}); - systemTest.checkSpeciesIntramolecular(&species, {0, 1}, {BondFunctions::Form::Harmonic, "k=6258 eq=1.411"}); - systemTest.checkSpeciesIntramolecular(&species, {0, 3}, {BondFunctions::Form::Harmonic, "k=3083.8 eq=1.571"}); - systemTest.checkSpeciesIntramolecular(&species, {3, 6}, {BondFunctions::Form::Harmonic, "k=4561.1 eq=0.949"}); - systemTest.checkSpeciesIntramolecular(&species, {1, 0, 2}, {AngleFunctions::Form::Harmonic, "k=224.37 eq=123.69"}); - systemTest.checkSpeciesIntramolecular(&species, {6, 3, 0}, {AngleFunctions::Form::Harmonic, "k=396.82 eq=110.5"}); - systemTest.checkSpeciesIntramolecular(&species, {6, 3, 0, 2}, {TorsionFunctions::Form::Cos3, "0 0 0"}); + testSpeciesAtomType(&species, {{0, "SA"}, {1, "OA"}, {2, "OA"}, {3, "OHA"}, {4, "OHA"}, {5, "HSA"}, {6, "HSA"}}); + testSpeciesIntramolecular(&species, {0, 1}, {BondFunctions::Form::Harmonic, "k=6258 eq=1.411"}); + testSpeciesIntramolecular(&species, {0, 3}, {BondFunctions::Form::Harmonic, "k=3083.8 eq=1.571"}); + testSpeciesIntramolecular(&species, {3, 6}, {BondFunctions::Form::Harmonic, "k=4561.1 eq=0.949"}); + testSpeciesIntramolecular(&species, {1, 0, 2}, {AngleFunctions::Form::Harmonic, "k=224.37 eq=123.69"}); + testSpeciesIntramolecular(&species, {6, 3, 0}, {AngleFunctions::Form::Harmonic, "k=396.82 eq=110.5"}); + testSpeciesIntramolecular(&species, {6, 3, 0, 2}, {TorsionFunctions::Form::Cos3, "0 0 0"}); } TEST(Kulmala2010AssignmentTest, HSO4Minus) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("HSO4-", "ImportXYZStructure", "xyz/hso4minus.xyz", ForcefieldLibrary::forcefield("Kulmala2010")); @@ -145,14 +137,14 @@ TEST(Kulmala2010AssignmentTest, HSO4Minus) ASSERT_EQ(species.torsions().size(), 3); ASSERT_EQ(species.impropers().size(), 0); - systemTest.checkSpeciesAtomType(&species, {{0, "SA-"}, {1, "OA-"}, {2, "OA-"}, {3, "OA-"}, {4, "OHA-"}, {5, "HSA-"}}); - systemTest.checkSpeciesIntramolecular(&species, {0, 1}, {BondFunctions::Form::Harmonic, "k=5239.9 eq=1.438"}); - systemTest.checkSpeciesIntramolecular(&species, {0, 4}, {BondFunctions::Form::Harmonic, "k=2328.3 eq=1.634"}); - systemTest.checkSpeciesIntramolecular(&species, {4, 5}, {BondFunctions::Form::Harmonic, "k=4561.1 eq=0.949"}); - systemTest.checkSpeciesIntramolecular(&species, {1, 0, 2}, {AngleFunctions::Form::Harmonic, "k=456.97 eq=114.76"}); - systemTest.checkSpeciesIntramolecular(&species, {1, 0, 4}, {AngleFunctions::Form::Harmonic, "k=814.48 eq=103.45"}); - systemTest.checkSpeciesIntramolecular(&species, {5, 4, 0}, {AngleFunctions::Form::Harmonic, "k=398.12 eq=106.39"}); - systemTest.checkSpeciesIntramolecular(&species, {5, 4, 0, 2}, {TorsionFunctions::Form::Cos3, "0 0 0"}); + testSpeciesAtomType(&species, {{0, "SA-"}, {1, "OA-"}, {2, "OA-"}, {3, "OA-"}, {4, "OHA-"}, {5, "HSA-"}}); + testSpeciesIntramolecular(&species, {0, 1}, {BondFunctions::Form::Harmonic, "k=5239.9 eq=1.438"}); + testSpeciesIntramolecular(&species, {0, 4}, {BondFunctions::Form::Harmonic, "k=2328.3 eq=1.634"}); + testSpeciesIntramolecular(&species, {4, 5}, {BondFunctions::Form::Harmonic, "k=4561.1 eq=0.949"}); + testSpeciesIntramolecular(&species, {1, 0, 2}, {AngleFunctions::Form::Harmonic, "k=456.97 eq=114.76"}); + testSpeciesIntramolecular(&species, {1, 0, 4}, {AngleFunctions::Form::Harmonic, "k=814.48 eq=103.45"}); + testSpeciesIntramolecular(&species, {5, 4, 0}, {AngleFunctions::Form::Harmonic, "k=398.12 eq=106.39"}); + testSpeciesIntramolecular(&species, {5, 4, 0, 2}, {TorsionFunctions::Form::Cos3, "0 0 0"}); } } // namespace UnitTest diff --git a/tests/ff/assignment-Ludwig-py5.cpp b/tests/ff/assignment-Ludwig-py5.cpp index 0b9317ea40..a412b49f0c 100644 --- a/tests/ff/assignment-Ludwig-py5.cpp +++ b/tests/ff/assignment-Ludwig-py5.cpp @@ -2,16 +2,14 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "data/ff/library.h" -#include "tests/graphData.h" -#include "tests/testData.h" -#include +#include "nodes/species.h" +#include "tests/testGraph.h" #include namespace UnitTest { TEST(LudwigPy5AssignmentTest, Py5) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("Py5", "ImportXYZStructure", "xyz/py5.xyz", ForcefieldLibrary::forcefield("Ludwig/Py5")); @@ -25,20 +23,20 @@ TEST(LudwigPy5AssignmentTest, Py5) ASSERT_EQ(species.torsions().size(), 66); ASSERT_EQ(species.impropers().size(), 6); - systemTest.checkSpeciesAtomType( - &species, {{0, "nc"}, {1, "ca_o"}, {2, "ca_m"}, {3, "ca_p"}, {4, "ca_m"}, {5, "ca_o"}, {6, "ha_o"}, - {7, "ha_m"}, {8, "ha_p"}, {9, "ha_m"}, {10, "ha_o"}, {11, "ct_1"}, {12, "ct_2"}, {13, "hc_1"}, - {14, "hc_1"}, {15, "ct_3"}, {16, "hc_2"}, {17, "hc_2"}, {18, "ct_4"}, {19, "hc_3"}, {20, "hc_3"}, - {21, "cm"}, {22, "hc_4"}, {23, "hc_4"}, {24, "hm"}, {25, "hm"}, {26, "hm"}}); - systemTest.checkSpeciesIntramolecular(&species, {0, 1}, {BondFunctions::Form::Harmonic, "k=4042 eq=1.339"}); - systemTest.checkSpeciesIntramolecular(&species, {1, 6}, {BondFunctions::Form::Harmonic, "k=3071 eq=1.08"}); - systemTest.checkSpeciesIntramolecular(&species, {11, 0, 1}, {AngleFunctions::Form::Harmonic, "k=585.8 eq=121.5"}); - systemTest.checkSpeciesIntramolecular(&species, {0, 1, 2, 3}, {TorsionFunctions::Form::Cosine, "15.178 2 180 1"}); - systemTest.checkSpeciesIntramolecular(&species, {0, 1, 5, 11}, {TorsionFunctions::Form::Cosine, "4.606 2 180 1"}); - systemTest.checkSpeciesIntramolecular(&species, {1, 0, 2, 6}, {TorsionFunctions::Form::Cosine, "4.606 2 180 1"}); - systemTest.checkSpeciesIntramolecular(&species, {2, 1, 3, 7}, {TorsionFunctions::Form::Cosine, "4.606 2 180 1"}); - systemTest.checkSpeciesIntramolecular(&species, {3, 2, 4, 8}, {TorsionFunctions::Form::Cosine, "4.606 2 180 1"}); - systemTest.checkSpeciesIntramolecular(&species, {4, 3, 5, 9}, {TorsionFunctions::Form::Cosine, "4.606 2 180 1"}); - systemTest.checkSpeciesIntramolecular(&species, {5, 0, 4, 10}, {TorsionFunctions::Form::Cosine, "4.606 2 180 1"}); + testSpeciesAtomType(&species, + {{0, "nc"}, {1, "ca_o"}, {2, "ca_m"}, {3, "ca_p"}, {4, "ca_m"}, {5, "ca_o"}, {6, "ha_o"}, + {7, "ha_m"}, {8, "ha_p"}, {9, "ha_m"}, {10, "ha_o"}, {11, "ct_1"}, {12, "ct_2"}, {13, "hc_1"}, + {14, "hc_1"}, {15, "ct_3"}, {16, "hc_2"}, {17, "hc_2"}, {18, "ct_4"}, {19, "hc_3"}, {20, "hc_3"}, + {21, "cm"}, {22, "hc_4"}, {23, "hc_4"}, {24, "hm"}, {25, "hm"}, {26, "hm"}}); + testSpeciesIntramolecular(&species, {0, 1}, {BondFunctions::Form::Harmonic, "k=4042 eq=1.339"}); + testSpeciesIntramolecular(&species, {1, 6}, {BondFunctions::Form::Harmonic, "k=3071 eq=1.08"}); + testSpeciesIntramolecular(&species, {11, 0, 1}, {AngleFunctions::Form::Harmonic, "k=585.8 eq=121.5"}); + testSpeciesIntramolecular(&species, {0, 1, 2, 3}, {TorsionFunctions::Form::Cosine, "15.178 2 180 1"}); + testSpeciesIntramolecular(&species, {0, 1, 5, 11}, {TorsionFunctions::Form::Cosine, "4.606 2 180 1"}); + testSpeciesIntramolecular(&species, {1, 0, 2, 6}, {TorsionFunctions::Form::Cosine, "4.606 2 180 1"}); + testSpeciesIntramolecular(&species, {2, 1, 3, 7}, {TorsionFunctions::Form::Cosine, "4.606 2 180 1"}); + testSpeciesIntramolecular(&species, {3, 2, 4, 8}, {TorsionFunctions::Form::Cosine, "4.606 2 180 1"}); + testSpeciesIntramolecular(&species, {4, 3, 5, 9}, {TorsionFunctions::Form::Cosine, "4.606 2 180 1"}); + testSpeciesIntramolecular(&species, {5, 0, 4, 10}, {TorsionFunctions::Form::Cosine, "4.606 2 180 1"}); } }; // namespace UnitTest diff --git a/tests/ff/assignment-OPLSAA2005-alcohols.cpp b/tests/ff/assignment-OPLSAA2005-alcohols.cpp index c1de39a054..fdead9e1bc 100644 --- a/tests/ff/assignment-OPLSAA2005-alcohols.cpp +++ b/tests/ff/assignment-OPLSAA2005-alcohols.cpp @@ -2,15 +2,13 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "data/ff/library.h" -#include "tests/graphData.h" -#include "tests/testData.h" -#include +#include "nodes/species.h" +#include "tests/testGraph.h" namespace UnitTest { TEST(OPLSAA2005AlcoholsAssignmentTest, Methanol) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("Methanol", "ImportXYZStructure", "xyz/methanol.xyz", ForcefieldLibrary::forcefield("OPLSAA2005/Alcohols")); @@ -24,11 +22,11 @@ TEST(OPLSAA2005AlcoholsAssignmentTest, Methanol) ASSERT_EQ(species.torsions().size(), 3); ASSERT_EQ(species.impropers().size(), 0); - systemTest.checkSpeciesAtomType(&species, {{0, "CT"}, {1, "OH"}, {2, "HO"}, {3, "HC"}, {4, "HC"}, {5, "HC"}}); - systemTest.checkSpeciesIntramolecular(&species, {0, 1}, {BondFunctions::Form::Harmonic, "k=2677.76 eq=1.41"}); - systemTest.checkSpeciesIntramolecular(&species, {0, 3}, {BondFunctions::Form::Harmonic, "k=2845.12 eq=1.09"}); - systemTest.checkSpeciesIntramolecular(&species, {0, 1, 2}, {AngleFunctions::Form::Harmonic, "k=460.24 eq=108.5"}); - systemTest.checkSpeciesIntramolecular(&species, {4, 0, 1}, {AngleFunctions::Form::Harmonic, "k=292.88 eq=109.5"}); - systemTest.checkSpeciesIntramolecular(&species, {3, 0, 1, 2}, {TorsionFunctions::Form::Cos3, "0 0 1.47444"}); + testSpeciesAtomType(&species, {{0, "CT"}, {1, "OH"}, {2, "HO"}, {3, "HC"}, {4, "HC"}, {5, "HC"}}); + testSpeciesIntramolecular(&species, {0, 1}, {BondFunctions::Form::Harmonic, "k=2677.76 eq=1.41"}); + testSpeciesIntramolecular(&species, {0, 3}, {BondFunctions::Form::Harmonic, "k=2845.12 eq=1.09"}); + testSpeciesIntramolecular(&species, {0, 1, 2}, {AngleFunctions::Form::Harmonic, "k=460.24 eq=108.5"}); + testSpeciesIntramolecular(&species, {4, 0, 1}, {AngleFunctions::Form::Harmonic, "k=292.88 eq=109.5"}); + testSpeciesIntramolecular(&species, {3, 0, 1, 2}, {TorsionFunctions::Form::Cos3, "0 0 1.47444"}); } }; // namespace UnitTest diff --git a/tests/ff/assignment-OPLSAA2005-alkanes.cpp b/tests/ff/assignment-OPLSAA2005-alkanes.cpp index 5853c76847..5a8fcdd918 100644 --- a/tests/ff/assignment-OPLSAA2005-alkanes.cpp +++ b/tests/ff/assignment-OPLSAA2005-alkanes.cpp @@ -2,15 +2,13 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "data/ff/library.h" -#include "tests/graphData.h" -#include "tests/testData.h" -#include +#include "nodes/species.h" +#include "tests/testGraph.h" namespace UnitTest { TEST(OPLSAA2005AlkanesAssignmentTest, Heptane) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("Heptane", "ImportXYZStructure", "xyz/heptane.xyz", ForcefieldLibrary::forcefield("OPLSAA2005/Alkanes")); @@ -24,36 +22,35 @@ TEST(OPLSAA2005AlkanesAssignmentTest, Heptane) ASSERT_EQ(species.torsions().size(), 36); ASSERT_EQ(species.impropers().size(), 0); - systemTest.checkSpeciesAtomType(&species, {{0, "CT3"}, - {1, "CT2"}, - {2, "CT2"}, - {3, "CT2"}, - {4, "CT3"}, - {5, "HC"}, - {6, "HC"}, - {7, "HC"}, - {8, "HC"}, - {9, "HC"}, - {10, "HC"}, - {11, "HC"}, - {12, "HC"}, - {13, "HC"}, - {14, "HC"}, - {15, "HC"}, - {16, "HC"}}); - systemTest.checkSpeciesIntramolecular(&species, {0, 1}, {BondFunctions::Form::Harmonic, "k=2242.62 eq=1.529"}); - systemTest.checkSpeciesIntramolecular(&species, {0, 7}, {BondFunctions::Form::Harmonic, "k=2845.12 eq=1.09"}); - systemTest.checkSpeciesIntramolecular(&species, {0, 1, 9}, {AngleFunctions::Form::Harmonic, "k=313.8 eq=110.7"}); - systemTest.checkSpeciesIntramolecular(&species, {0, 1, 2}, {AngleFunctions::Form::Harmonic, "k=488.273 eq=112.7"}); - systemTest.checkSpeciesIntramolecular(&species, {15, 4, 16}, {AngleFunctions::Form::Harmonic, "k=276.144 eq=107.8"}); - systemTest.checkSpeciesIntramolecular(&species, {7, 0, 1, 9}, {TorsionFunctions::Form::Cos3, "0 0 1.2552"}); - systemTest.checkSpeciesIntramolecular(&species, {7, 0, 1, 2}, {TorsionFunctions::Form::Cos3, "0 0 1.2552"}); - systemTest.checkSpeciesIntramolecular(&species, {0, 1, 2, 3}, {TorsionFunctions::Form::Cos3, "5.4392 -0.2092 0.8368"}); + testSpeciesAtomType(&species, {{0, "CT3"}, + {1, "CT2"}, + {2, "CT2"}, + {3, "CT2"}, + {4, "CT3"}, + {5, "HC"}, + {6, "HC"}, + {7, "HC"}, + {8, "HC"}, + {9, "HC"}, + {10, "HC"}, + {11, "HC"}, + {12, "HC"}, + {13, "HC"}, + {14, "HC"}, + {15, "HC"}, + {16, "HC"}}); + testSpeciesIntramolecular(&species, {0, 1}, {BondFunctions::Form::Harmonic, "k=2242.62 eq=1.529"}); + testSpeciesIntramolecular(&species, {0, 7}, {BondFunctions::Form::Harmonic, "k=2845.12 eq=1.09"}); + testSpeciesIntramolecular(&species, {0, 1, 9}, {AngleFunctions::Form::Harmonic, "k=313.8 eq=110.7"}); + testSpeciesIntramolecular(&species, {0, 1, 2}, {AngleFunctions::Form::Harmonic, "k=488.273 eq=112.7"}); + testSpeciesIntramolecular(&species, {15, 4, 16}, {AngleFunctions::Form::Harmonic, "k=276.144 eq=107.8"}); + testSpeciesIntramolecular(&species, {7, 0, 1, 9}, {TorsionFunctions::Form::Cos3, "0 0 1.2552"}); + testSpeciesIntramolecular(&species, {7, 0, 1, 2}, {TorsionFunctions::Form::Cos3, "0 0 1.2552"}); + testSpeciesIntramolecular(&species, {0, 1, 2, 3}, {TorsionFunctions::Form::Cos3, "5.4392 -0.2092 0.8368"}); } TEST(OPLSAA2005AlkanesAssignmentTest, Cycloheptane) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield( "Cycloheptane", "ImportXYZStructure", "xyz/cycloheptane.xyz", ForcefieldLibrary::forcefield("OPLSAA2005/Alkanes")); @@ -67,17 +64,16 @@ TEST(OPLSAA2005AlkanesAssignmentTest, Cycloheptane) ASSERT_EQ(species.torsions().size(), 63); ASSERT_EQ(species.impropers().size(), 0); - systemTest.checkSpeciesAtomType(&species, - {{0, "CT2"}, {1, "CT2"}, {2, "CT2"}, {3, "CT2"}, {4, "CT2"}, {5, "CT2"}, {6, "CT2"}, - {7, "HC"}, {8, "HC"}, {9, "HC"}, {10, "HC"}, {11, "HC"}, {12, "HC"}, {13, "HC"}, - {14, "HC"}, {15, "HC"}, {16, "HC"}, {17, "HC"}, {18, "HC"}, {19, "HC"}, {20, "HC"}}); - systemTest.checkSpeciesIntramolecular(&species, {0, 1}, {BondFunctions::Form::Harmonic, "k=2242.62 eq=1.529"}); - systemTest.checkSpeciesIntramolecular(&species, {0, 7}, {BondFunctions::Form::Harmonic, "k=2845.12 eq=1.09"}); - systemTest.checkSpeciesIntramolecular(&species, {0, 1, 9}, {AngleFunctions::Form::Harmonic, "k=313.8 eq=110.7"}); - systemTest.checkSpeciesIntramolecular(&species, {0, 1, 2}, {AngleFunctions::Form::Harmonic, "k=488.273 eq=112.7"}); - systemTest.checkSpeciesIntramolecular(&species, {15, 4, 16}, {AngleFunctions::Form::Harmonic, "k=276.144 eq=107.8"}); - systemTest.checkSpeciesIntramolecular(&species, {7, 0, 1, 9}, {TorsionFunctions::Form::Cos3, "0 0 1.2552"}); - systemTest.checkSpeciesIntramolecular(&species, {7, 0, 1, 2}, {TorsionFunctions::Form::Cos3, "0 0 1.2552"}); - systemTest.checkSpeciesIntramolecular(&species, {0, 1, 2, 3}, {TorsionFunctions::Form::Cos3, "5.4392 -0.2092 0.8368"}); + testSpeciesAtomType(&species, {{0, "CT2"}, {1, "CT2"}, {2, "CT2"}, {3, "CT2"}, {4, "CT2"}, {5, "CT2"}, {6, "CT2"}, + {7, "HC"}, {8, "HC"}, {9, "HC"}, {10, "HC"}, {11, "HC"}, {12, "HC"}, {13, "HC"}, + {14, "HC"}, {15, "HC"}, {16, "HC"}, {17, "HC"}, {18, "HC"}, {19, "HC"}, {20, "HC"}}); + testSpeciesIntramolecular(&species, {0, 1}, {BondFunctions::Form::Harmonic, "k=2242.62 eq=1.529"}); + testSpeciesIntramolecular(&species, {0, 7}, {BondFunctions::Form::Harmonic, "k=2845.12 eq=1.09"}); + testSpeciesIntramolecular(&species, {0, 1, 9}, {AngleFunctions::Form::Harmonic, "k=313.8 eq=110.7"}); + testSpeciesIntramolecular(&species, {0, 1, 2}, {AngleFunctions::Form::Harmonic, "k=488.273 eq=112.7"}); + testSpeciesIntramolecular(&species, {15, 4, 16}, {AngleFunctions::Form::Harmonic, "k=276.144 eq=107.8"}); + testSpeciesIntramolecular(&species, {7, 0, 1, 9}, {TorsionFunctions::Form::Cos3, "0 0 1.2552"}); + testSpeciesIntramolecular(&species, {7, 0, 1, 2}, {TorsionFunctions::Form::Cos3, "0 0 1.2552"}); + testSpeciesIntramolecular(&species, {0, 1, 2, 3}, {TorsionFunctions::Form::Cos3, "5.4392 -0.2092 0.8368"}); } }; // namespace UnitTest diff --git a/tests/ff/assignment-OPLSAA2005-aromatics.cpp b/tests/ff/assignment-OPLSAA2005-aromatics.cpp index 6852574ddb..41518cfabe 100644 --- a/tests/ff/assignment-OPLSAA2005-aromatics.cpp +++ b/tests/ff/assignment-OPLSAA2005-aromatics.cpp @@ -2,15 +2,13 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "data/ff/library.h" -#include "tests/graphData.h" -#include "tests/testData.h" -#include +#include "nodes/species.h" +#include "tests/testGraph.h" namespace UnitTest { TEST(OPLSAA2005AromaticsAssignmentTest, Benzene) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield( "Benzene", "ImportXYZStructure", "xyz/benzene.xyz", ForcefieldLibrary::forcefield("OPLSAA2005/Aromatics")); @@ -24,19 +22,18 @@ TEST(OPLSAA2005AromaticsAssignmentTest, Benzene) ASSERT_EQ(species.torsions().size(), 24); ASSERT_EQ(species.impropers().size(), 6); - systemTest.checkSpeciesAtomType(&species, {{0, "CA"}, {1, "HA"}}); - systemTest.checkSpeciesIntramolecular(&species, {0, 1}, {BondFunctions::Form::Harmonic, "k=3071.06 eq=1.08"}); - systemTest.checkSpeciesIntramolecular(&species, {0, 2}, {BondFunctions::Form::Harmonic, "k=3924.59 eq=1.4"}); - systemTest.checkSpeciesIntramolecular(&species, {1, 0, 2}, {AngleFunctions::Form::Harmonic, "k=292.88 eq=120"}); - systemTest.checkSpeciesIntramolecular(&species, {0, 2, 4}, {AngleFunctions::Form::Harmonic, "k=527.184 eq=120"}); - systemTest.checkSpeciesIntramolecular(&species, {1, 0, 2, 3}, {TorsionFunctions::Form::Cos3, "0 30.334 0"}); - systemTest.checkSpeciesIntramolecular(&species, {1, 0, 2, 4}, {TorsionFunctions::Form::Cos3, "0 30.334 0"}); - systemTest.checkSpeciesIntramolecular(&species, {10, 0, 2, 4}, {TorsionFunctions::Form::Cos3, "0 30.334 0"}); + testSpeciesAtomType(&species, {{0, "CA"}, {1, "HA"}}); + testSpeciesIntramolecular(&species, {0, 1}, {BondFunctions::Form::Harmonic, "k=3071.06 eq=1.08"}); + testSpeciesIntramolecular(&species, {0, 2}, {BondFunctions::Form::Harmonic, "k=3924.59 eq=1.4"}); + testSpeciesIntramolecular(&species, {1, 0, 2}, {AngleFunctions::Form::Harmonic, "k=292.88 eq=120"}); + testSpeciesIntramolecular(&species, {0, 2, 4}, {AngleFunctions::Form::Harmonic, "k=527.184 eq=120"}); + testSpeciesIntramolecular(&species, {1, 0, 2, 3}, {TorsionFunctions::Form::Cos3, "0 30.334 0"}); + testSpeciesIntramolecular(&species, {1, 0, 2, 4}, {TorsionFunctions::Form::Cos3, "0 30.334 0"}); + testSpeciesIntramolecular(&species, {10, 0, 2, 4}, {TorsionFunctions::Form::Cos3, "0 30.334 0"}); } TEST(OPLSAA2005AromaticsAssignmentTest, Naphthalene) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield( "Naphthalene", "ImportXYZStructure", "xyz/naphthalene.xyz", ForcefieldLibrary::forcefield("OPLSAA2005/Aromatics")); @@ -50,27 +47,27 @@ TEST(OPLSAA2005AromaticsAssignmentTest, Naphthalene) ASSERT_EQ(species.torsions().size(), 44); ASSERT_EQ(species.impropers().size(), 10); - systemTest.checkSpeciesAtomType(&species, {{0, "CA"}, - {1, "CA"}, - {2, "CNap"}, - {3, "CA"}, - {4, "CA"}, - {5, "CA"}, - {6, "CA"}, - {7, "CNap"}, - {8, "CA"}, - {9, "CA"}, - {10, "HA"}, - {11, "HA"}, - {12, "HA"}, - {13, "HA"}, - {14, "HA"}, - {15, "HA"}, - {16, "HA"}, - {17, "HA"}}); - systemTest.checkSpeciesIntramolecular(&species, {2, 7}, {BondFunctions::Form::Harmonic, "k=3924.59 eq=1.4"}); - systemTest.checkSpeciesIntramolecular(&species, {1, 2, 7}, {AngleFunctions::Form::Harmonic, "k=527.184 eq=120"}); - systemTest.checkSpeciesIntramolecular(&species, {1, 2, 3}, {AngleFunctions::Form::Harmonic, "k=527.184 eq=120"}); - systemTest.checkSpeciesIntramolecular(&species, {8, 0, 1, 2}, {TorsionFunctions::Form::Cos3, "0 30.334 0"}); + testSpeciesAtomType(&species, {{0, "CA"}, + {1, "CA"}, + {2, "CNap"}, + {3, "CA"}, + {4, "CA"}, + {5, "CA"}, + {6, "CA"}, + {7, "CNap"}, + {8, "CA"}, + {9, "CA"}, + {10, "HA"}, + {11, "HA"}, + {12, "HA"}, + {13, "HA"}, + {14, "HA"}, + {15, "HA"}, + {16, "HA"}, + {17, "HA"}}); + testSpeciesIntramolecular(&species, {2, 7}, {BondFunctions::Form::Harmonic, "k=3924.59 eq=1.4"}); + testSpeciesIntramolecular(&species, {1, 2, 7}, {AngleFunctions::Form::Harmonic, "k=527.184 eq=120"}); + testSpeciesIntramolecular(&species, {1, 2, 3}, {AngleFunctions::Form::Harmonic, "k=527.184 eq=120"}); + testSpeciesIntramolecular(&species, {8, 0, 1, 2}, {TorsionFunctions::Form::Cos3, "0 30.334 0"}); } }; // namespace UnitTest diff --git a/tests/ff/assignment-PCL2019-anions.cpp b/tests/ff/assignment-PCL2019-anions.cpp index 75eff79824..1eca653a08 100644 --- a/tests/ff/assignment-PCL2019-anions.cpp +++ b/tests/ff/assignment-PCL2019-anions.cpp @@ -2,15 +2,13 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "data/ff/library.h" -#include "tests/graphData.h" -#include "tests/testData.h" -#include +#include "nodes/species.h" +#include "tests/testGraph.h" namespace UnitTest { TEST(PCL2019AnionsAssignmentTest, beti) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("Hydronium", "ImportXYZStructure", "xyz/beti.xyz", ForcefieldLibrary::forcefield("PCL2019/Anions")); @@ -24,16 +22,14 @@ TEST(PCL2019AnionsAssignmentTest, beti) ASSERT_EQ(species.torsions().size(), 42); ASSERT_EQ(species.impropers().size(), 0); - systemTest.checkSpeciesAtomType(&species, - {{0, "C1F"}, {1, "CEF"}, {2, "F1"}, {3, "F1"}, {4, "SBT"}, {5, "NBT"}, {6, "OBT"}, - {7, "OBT"}, {8, "SBT"}, {9, "OBT"}, {10, "OBT"}, {11, "C1F"}, {12, "CEF"}, {13, "F1"}, - {14, "F1"}, {15, "F"}, {16, "F"}, {17, "F"}, {18, "F"}, {19, "F"}, {20, "F"}}); + testSpeciesAtomType(&species, {{0, "C1F"}, {1, "CEF"}, {2, "F1"}, {3, "F1"}, {4, "SBT"}, {5, "NBT"}, {6, "OBT"}, + {7, "OBT"}, {8, "SBT"}, {9, "OBT"}, {10, "OBT"}, {11, "C1F"}, {12, "CEF"}, {13, "F1"}, + {14, "F1"}, {15, "F"}, {16, "F"}, {17, "F"}, {18, "F"}, {19, "F"}, {20, "F"}}); EXPECT_NEAR(species.totalCharge(true), -1, 1.0e-6); } TEST(PCL2019AnionsAssignmentTest, BF4) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("BF4", "ImportXYZStructure", "xyz/bf4.xyz", ForcefieldLibrary::forcefield("PCL2019/Anions")); @@ -47,13 +43,12 @@ TEST(PCL2019AnionsAssignmentTest, BF4) ASSERT_EQ(species.torsions().size(), 0); ASSERT_EQ(species.impropers().size(), 0); - systemTest.checkSpeciesAtomType(&species, {{0, "B"}, {1, "FB"}, {2, "FB"}, {3, "FB"}, {4, "FB"}}); + testSpeciesAtomType(&species, {{0, "B"}, {1, "FB"}, {2, "FB"}, {3, "FB"}, {4, "FB"}}); EXPECT_NEAR(species.totalCharge(true), -1, 1.0e-6); } TEST(PCL2019AnionsAssignmentTest, c1SO3) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("C1SO3", "ImportXYZStructure", "xyz/c1so3.xyz", ForcefieldLibrary::forcefield("PCL2019/Anions")); @@ -67,14 +62,13 @@ TEST(PCL2019AnionsAssignmentTest, c1SO3) ASSERT_EQ(species.torsions().size(), 9); ASSERT_EQ(species.impropers().size(), 0); - systemTest.checkSpeciesAtomType( - &species, {{0, "SO"}, {1, "OS3"}, {2, "OS3"}, {3, "OS3"}, {4, "CS3"}, {5, "HS3"}, {6, "HS3"}, {7, "HS3"}}); + testSpeciesAtomType(&species, + {{0, "SO"}, {1, "OS3"}, {2, "OS3"}, {3, "OS3"}, {4, "CS3"}, {5, "HS3"}, {6, "HS3"}, {7, "HS3"}}); EXPECT_NEAR(species.totalCharge(true), -1, 1.0e-6); } TEST(PCL2019AnionsAssignmentTest, c1SO4) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("C1SO4", "ImportXYZStructure", "xyz/c1so4.xyz", ForcefieldLibrary::forcefield("PCL2019/Anions")); @@ -88,14 +82,13 @@ TEST(PCL2019AnionsAssignmentTest, c1SO4) ASSERT_EQ(species.torsions().size(), 6); ASSERT_EQ(species.impropers().size(), 0); - systemTest.checkSpeciesAtomType( + testSpeciesAtomType( &species, {{0, "HS4"}, {1, "CS4"}, {2, "OC4"}, {3, "HS4"}, {4, "HS4"}, {5, "SO"}, {6, "OS4"}, {7, "OS4"}, {8, "OS4"}}); EXPECT_NEAR(species.totalCharge(true), -1, 1.0e-6); } TEST(PCL2019AnionsAssignmentTest, c2SO3) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("C2SO3", "ImportXYZStructure", "xyz/c2so3.xyz", ForcefieldLibrary::forcefield("PCL2019/Anions")); @@ -109,23 +102,22 @@ TEST(PCL2019AnionsAssignmentTest, c2SO3) ASSERT_EQ(species.torsions().size(), 18); ASSERT_EQ(species.impropers().size(), 0); - systemTest.checkSpeciesAtomType(&species, {{0, "SO"}, - {1, "OS3"}, - {2, "OS3"}, - {3, "OS3"}, - {4, "CS3"}, - {5, "CT3"}, - {6, "HS3"}, - {7, "HS3"}, - {8, "HC"}, - {9, "HC"}, - {10, "HC"}}); + testSpeciesAtomType(&species, {{0, "SO"}, + {1, "OS3"}, + {2, "OS3"}, + {3, "OS3"}, + {4, "CS3"}, + {5, "CT3"}, + {6, "HS3"}, + {7, "HS3"}, + {8, "HC"}, + {9, "HC"}, + {10, "HC"}}); EXPECT_NEAR(species.totalCharge(true), -1, 1.0e-6); } TEST(PCL2019AnionsAssignmentTest, c2SO4) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("C2SO4", "ImportXYZStructure", "xyz/c2so4.xyz", ForcefieldLibrary::forcefield("PCL2019/Anions")); @@ -139,24 +131,23 @@ TEST(PCL2019AnionsAssignmentTest, c2SO4) ASSERT_EQ(species.torsions().size(), 15); ASSERT_EQ(species.impropers().size(), 0); - systemTest.checkSpeciesAtomType(&species, {{0, "CT3"}, - {1, "CS4"}, - {2, "OC4"}, - {3, "HC"}, - {4, "HC"}, - {5, "HC"}, - {6, "HS4"}, - {7, "HS4"}, - {8, "SO"}, - {9, "OS4"}, - {10, "OS4"}, - {11, "OS4"}}); + testSpeciesAtomType(&species, {{0, "CT3"}, + {1, "CS4"}, + {2, "OC4"}, + {3, "HC"}, + {4, "HC"}, + {5, "HC"}, + {6, "HS4"}, + {7, "HS4"}, + {8, "SO"}, + {9, "OS4"}, + {10, "OS4"}, + {11, "OS4"}}); EXPECT_NEAR(species.totalCharge(true), -1, 1.0e-6); } TEST(PCL2019AnionsAssignmentTest, c4fc1fsi) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("C4FC1FSI", "ImportXYZStructure", "xyz/c4fc1fsi.xyz", ForcefieldLibrary::forcefield("PCL2019/Anions")); @@ -170,16 +161,15 @@ TEST(PCL2019AnionsAssignmentTest, c4fc1fsi) ASSERT_EQ(species.torsions().size(), 51); ASSERT_EQ(species.impropers().size(), 0); - systemTest.checkSpeciesAtomType(&species, {{0, "CBT"}, {1, "F1"}, {2, "F1"}, {3, "F1"}, {4, "SBT"}, {5, "NBT"}, - {6, "OBT"}, {7, "OBT"}, {8, "SBT"}, {9, "OBT"}, {10, "OBT"}, {11, "C1F"}, - {12, "CSF"}, {13, "F1"}, {14, "F1"}, {15, "CSF"}, {16, "F"}, {17, "F"}, - {18, "CTF"}, {19, "F"}, {20, "F"}, {21, "F"}, {22, "F"}, {23, "F"}}); + testSpeciesAtomType(&species, + {{0, "CBT"}, {1, "F1"}, {2, "F1"}, {3, "F1"}, {4, "SBT"}, {5, "NBT"}, {6, "OBT"}, {7, "OBT"}, + {8, "SBT"}, {9, "OBT"}, {10, "OBT"}, {11, "C1F"}, {12, "CSF"}, {13, "F1"}, {14, "F1"}, {15, "CSF"}, + {16, "F"}, {17, "F"}, {18, "CTF"}, {19, "F"}, {20, "F"}, {21, "F"}, {22, "F"}, {23, "F"}}); EXPECT_NEAR(species.totalCharge(true), -1, 1.0e-6); } TEST(PCL2019AnionsAssignmentTest, CCN3) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("CCN3", "ImportXYZStructure", "xyz/ccn3.xyz", ForcefieldLibrary::forcefield("PCL2019/Anions")); @@ -193,13 +183,12 @@ TEST(PCL2019AnionsAssignmentTest, CCN3) ASSERT_EQ(species.torsions().size(), 6); ASSERT_EQ(species.impropers().size(), 1); - systemTest.checkSpeciesAtomType(&species, {{0, "C3A"}, {1, "CN"}, {2, "CN"}, {3, "CN"}, {4, "NC"}}); + testSpeciesAtomType(&species, {{0, "C3A"}, {1, "CN"}, {2, "CN"}, {3, "CN"}, {4, "NC"}}); EXPECT_NEAR(species.totalCharge(true), -1, 1.0e-6); } TEST(PCL2019AnionsAssignmentTest, dca) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("DCA", "ImportXYZStructure", "xyz/dca.xyz", ForcefieldLibrary::forcefield("PCL2019/Anions")); @@ -213,13 +202,12 @@ TEST(PCL2019AnionsAssignmentTest, dca) ASSERT_EQ(species.torsions().size(), 2); ASSERT_EQ(species.impropers().size(), 0); - systemTest.checkSpeciesAtomType(&species, {{0, "N3A"}, {1, "CZA"}, {2, "NZA"}, {3, "CZA"}, {4, "NZA"}}); + testSpeciesAtomType(&species, {{0, "N3A"}, {1, "CZA"}, {2, "NZA"}, {3, "CZA"}, {4, "NZA"}}); EXPECT_NEAR(species.totalCharge(true), -1, 1.0e-6); } TEST(PCL2019AnionsAssignmentTest, fsi) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("FSI", "ImportXYZStructure", "xyz/fsi.xyz", ForcefieldLibrary::forcefield("PCL2019/Anions")); @@ -233,14 +221,13 @@ TEST(PCL2019AnionsAssignmentTest, fsi) ASSERT_EQ(species.torsions().size(), 6); ASSERT_EQ(species.impropers().size(), 0); - systemTest.checkSpeciesAtomType( + testSpeciesAtomType( &species, {{0, "FSI"}, {1, "SBT"}, {2, "NBT"}, {3, "OBT"}, {4, "OBT"}, {5, "SBT"}, {6, "OBT"}, {7, "OBT"}, {8, "FSI"}}); EXPECT_NEAR(species.totalCharge(true), -1, 1.0e-6); } TEST(PCL2019AnionsAssignmentTest, ntf2) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("NTf2", "ImportXYZStructure", "xyz/ntf2.xyz", ForcefieldLibrary::forcefield("PCL2019/Anions")); @@ -254,27 +241,26 @@ TEST(PCL2019AnionsAssignmentTest, ntf2) ASSERT_EQ(species.torsions().size(), 24); ASSERT_EQ(species.impropers().size(), 0); - systemTest.checkSpeciesAtomType(&species, {{0, "CBT"}, - {1, "F1"}, - {2, "F1"}, - {3, "F1"}, - {4, "SBT"}, - {5, "NBT"}, - {6, "OBT"}, - {7, "OBT"}, - {8, "SBT"}, - {9, "OBT"}, - {10, "OBT"}, - {11, "CBT"}, - {12, "F1"}, - {13, "F1"}, - {14, "F1"}}); + testSpeciesAtomType(&species, {{0, "CBT"}, + {1, "F1"}, + {2, "F1"}, + {3, "F1"}, + {4, "SBT"}, + {5, "NBT"}, + {6, "OBT"}, + {7, "OBT"}, + {8, "SBT"}, + {9, "OBT"}, + {10, "OBT"}, + {11, "CBT"}, + {12, "F1"}, + {13, "F1"}, + {14, "F1"}}); EXPECT_NEAR(species.totalCharge(true), -1, 1.0e-6); } TEST(PCL2019AnionsAssignmentTest, oac) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("OAc", "ImportXYZStructure", "xyz/oac.xyz", ForcefieldLibrary::forcefield("PCL2019/Anions")); @@ -288,13 +274,12 @@ TEST(PCL2019AnionsAssignmentTest, oac) ASSERT_EQ(species.torsions().size(), 6); ASSERT_EQ(species.impropers().size(), 1); - systemTest.checkSpeciesAtomType(&species, {{0, "CTA"}, {1, "HC"}, {2, "HC"}, {3, "HC"}, {4, "CO2"}, {5, "O2"}, {6, "O2"}}); + testSpeciesAtomType(&species, {{0, "CTA"}, {1, "HC"}, {2, "HC"}, {3, "HC"}, {4, "CO2"}, {5, "O2"}, {6, "O2"}}); EXPECT_NEAR(species.totalCharge(true), -1, 1.0e-6); } TEST(PCL2019AnionsAssignmentTest, otf) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("OTf", "ImportXYZStructure", "xyz/otf.xyz", ForcefieldLibrary::forcefield("PCL2019/Anions")); @@ -308,14 +293,13 @@ TEST(PCL2019AnionsAssignmentTest, otf) ASSERT_EQ(species.torsions().size(), 9); ASSERT_EQ(species.impropers().size(), 0); - systemTest.checkSpeciesAtomType( - &species, {{0, "CBT"}, {1, "F1"}, {2, "F1"}, {3, "F1"}, {4, "SBT"}, {5, "OTF"}, {6, "OTF"}, {7, "OTF"}}); + testSpeciesAtomType(&species, + {{0, "CBT"}, {1, "F1"}, {2, "F1"}, {3, "F1"}, {4, "SBT"}, {5, "OTF"}, {6, "OTF"}, {7, "OTF"}}); EXPECT_NEAR(species.totalCharge(true), -1, 1.0e-6); } TEST(PCL2019AnionsAssignmentTest, PF6) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("PF6", "ImportXYZStructure", "xyz/pf6.xyz", ForcefieldLibrary::forcefield("PCL2019/Anions")); @@ -329,13 +313,12 @@ TEST(PCL2019AnionsAssignmentTest, PF6) ASSERT_EQ(species.torsions().size(), 0); ASSERT_EQ(species.impropers().size(), 0); - systemTest.checkSpeciesAtomType(&species, {{0, "P"}, {1, "FP"}, {2, "FP"}, {3, "FP"}, {4, "FP"}, {5, "FP"}, {6, "FP"}}); + testSpeciesAtomType(&species, {{0, "P"}, {1, "FP"}, {2, "FP"}, {3, "FP"}, {4, "FP"}, {5, "FP"}, {6, "FP"}}); EXPECT_NEAR(species.totalCharge(true), -1, 1.0e-6); } TEST(PCL2019AnionsAssignmentTest, SCN) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("SCN", "ImportXYZStructure", "xyz/scn.xyz", ForcefieldLibrary::forcefield("PCL2019/Anions")); @@ -349,13 +332,12 @@ TEST(PCL2019AnionsAssignmentTest, SCN) ASSERT_EQ(species.torsions().size(), 0); ASSERT_EQ(species.impropers().size(), 0); - systemTest.checkSpeciesAtomType(&species, {{0, "SK"}, {1, "CK"}, {2, "NK"}}); + testSpeciesAtomType(&species, {{0, "SK"}, {1, "CK"}, {2, "NK"}}); EXPECT_NEAR(species.totalCharge(true), -1, 1.0e-6); } TEST(PCL2019AnionsAssignmentTest, tfa) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("TFA", "ImportXYZStructure", "xyz/tfa.xyz", ForcefieldLibrary::forcefield("PCL2019/Anions")); @@ -369,14 +351,12 @@ TEST(PCL2019AnionsAssignmentTest, tfa) ASSERT_EQ(species.torsions().size(), 6); ASSERT_EQ(species.impropers().size(), 0); - systemTest.checkSpeciesAtomType(&species, - {{0, "CFA"}, {1, "FFA"}, {2, "FFA"}, {3, "FFA"}, {4, "CO2"}, {5, "O2F"}, {6, "O2F"}}); + testSpeciesAtomType(&species, {{0, "CFA"}, {1, "FFA"}, {2, "FFA"}, {3, "FFA"}, {4, "CO2"}, {5, "O2F"}, {6, "O2F"}}); EXPECT_NEAR(species.totalCharge(true), -1, 1.0e-6); } TEST(PCL2019AnionsAssignmentTest, tso) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("TSO", "ImportXYZStructure", "xyz/tso.xyz", ForcefieldLibrary::forcefield("PCL2019/Anions")); @@ -390,24 +370,24 @@ TEST(PCL2019AnionsAssignmentTest, tso) ASSERT_EQ(species.torsions().size(), 36); ASSERT_EQ(species.impropers().size(), 6); - systemTest.checkSpeciesAtomType(&species, {{0, "CATS"}, - {1, "CAOS"}, - {2, "CAMS"}, - {3, "CAOS"}, - {4, "CAMS"}, - {5, "CAPS"}, - {6, "CTTS"}, - {7, "SO"}, - {8, "HATS"}, - {9, "HATS"}, - {10, "HATS"}, - {11, "HATS"}, - {12, "HTS"}, - {13, "HTS"}, - {14, "HTS"}, - {15, "OS3"}, - {16, "OS3"}, - {17, "OS3"}}); + testSpeciesAtomType(&species, {{0, "CATS"}, + {1, "CAOS"}, + {2, "CAMS"}, + {3, "CAOS"}, + {4, "CAMS"}, + {5, "CAPS"}, + {6, "CTTS"}, + {7, "SO"}, + {8, "HATS"}, + {9, "HATS"}, + {10, "HATS"}, + {11, "HATS"}, + {12, "HTS"}, + {13, "HTS"}, + {14, "HTS"}, + {15, "OS3"}, + {16, "OS3"}, + {17, "OS3"}}); EXPECT_NEAR(species.totalCharge(true), -1, 1.0e-6); } }; // namespace UnitTest diff --git a/tests/ff/assignment-PCL2019-cations.cpp b/tests/ff/assignment-PCL2019-cations.cpp index 84effeb760..65addbdeff 100644 --- a/tests/ff/assignment-PCL2019-cations.cpp +++ b/tests/ff/assignment-PCL2019-cations.cpp @@ -2,15 +2,13 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "data/ff/library.h" -#include "tests/graphData.h" -#include "tests/testData.h" -#include +#include "nodes/species.h" +#include "tests/testGraph.h" namespace UnitTest { TEST(PCL2019CationsAssignmentTest, benzc1im) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("benzc1im", "ImportXYZStructure", "xyz/benzc1im.xyz", ForcefieldLibrary::forcefield("PCL2019/Cations")); @@ -24,17 +22,15 @@ TEST(PCL2019CationsAssignmentTest, benzc1im) ASSERT_EQ(species.torsions().size(), 62); ASSERT_EQ(species.impropers().size(), 11); - systemTest.checkSpeciesAtomType(&species, - {{0, "NA"}, {1, "CR"}, {2, "NA"}, {3, "CW"}, {4, "CW"}, {5, "C1"}, {6, "HCR"}, - {7, "C1T"}, {8, "HCW"}, {9, "HCW"}, {10, "H1"}, {11, "H1"}, {12, "H1"}, {13, "H1"}, - {14, "H1"}, {15, "CAT"}, {16, "CAO"}, {17, "CAM"}, {18, "CAP"}, {19, "CAM"}, {20, "CAO"}, - {21, "HAT"}, {22, "HAT"}, {23, "HAT"}, {24, "HAT"}, {25, "HAT"}}); + testSpeciesAtomType(&species, {{0, "NA"}, {1, "CR"}, {2, "NA"}, {3, "CW"}, {4, "CW"}, {5, "C1"}, {6, "HCR"}, + {7, "C1T"}, {8, "HCW"}, {9, "HCW"}, {10, "H1"}, {11, "H1"}, {12, "H1"}, {13, "H1"}, + {14, "H1"}, {15, "CAT"}, {16, "CAO"}, {17, "CAM"}, {18, "CAP"}, {19, "CAM"}, {20, "CAO"}, + {21, "HAT"}, {22, "HAT"}, {23, "HAT"}, {24, "HAT"}, {25, "HAT"}}); EXPECT_NEAR(species.totalCharge(true), 1, 1.0e-6); } TEST(PCL2019CationsAssignmentTest, c12c1im) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("c12c1im", "ImportXYZStructure", "xyz/c12c1im.xyz", ForcefieldLibrary::forcefield("PCL2019/Cations")); @@ -48,19 +44,18 @@ TEST(PCL2019CationsAssignmentTest, c12c1im) ASSERT_EQ(species.torsions().size(), 131); ASSERT_EQ(species.impropers().size(), 5); - systemTest.checkSpeciesAtomType( - &species, - {{0, "NA"}, {1, "CR"}, {2, "NA"}, {3, "CW"}, {4, "CW"}, {5, "C1"}, {6, "HCR"}, {7, "C1"}, {8, "HCW"}, {9, "HCW"}, - {10, "H1"}, {11, "H1"}, {12, "H1"}, {13, "C2"}, {14, "H1"}, {15, "H1"}, {16, "CS"}, {17, "HC"}, {18, "HC"}, {19, "CS"}, - {20, "HC"}, {21, "HC"}, {22, "CS"}, {23, "HC"}, {24, "HC"}, {25, "CS"}, {26, "HC"}, {27, "HC"}, {28, "CS"}, {29, "HC"}, - {30, "HC"}, {31, "CS"}, {32, "HC"}, {33, "HC"}, {34, "CS"}, {35, "HC"}, {36, "HC"}, {37, "CS"}, {38, "HC"}, {39, "HC"}, - {40, "CS"}, {41, "HC"}, {42, "HC"}, {43, "CT"}, {44, "HC"}, {45, "HC"}, {46, "HC"}, {47, "HC"}, {48, "HC"}}); + testSpeciesAtomType(&species, {{0, "NA"}, {1, "CR"}, {2, "NA"}, {3, "CW"}, {4, "CW"}, {5, "C1"}, {6, "HCR"}, + {7, "C1"}, {8, "HCW"}, {9, "HCW"}, {10, "H1"}, {11, "H1"}, {12, "H1"}, {13, "C2"}, + {14, "H1"}, {15, "H1"}, {16, "CS"}, {17, "HC"}, {18, "HC"}, {19, "CS"}, {20, "HC"}, + {21, "HC"}, {22, "CS"}, {23, "HC"}, {24, "HC"}, {25, "CS"}, {26, "HC"}, {27, "HC"}, + {28, "CS"}, {29, "HC"}, {30, "HC"}, {31, "CS"}, {32, "HC"}, {33, "HC"}, {34, "CS"}, + {35, "HC"}, {36, "HC"}, {37, "CS"}, {38, "HC"}, {39, "HC"}, {40, "CS"}, {41, "HC"}, + {42, "HC"}, {43, "CT"}, {44, "HC"}, {45, "HC"}, {46, "HC"}, {47, "HC"}, {48, "HC"}}); EXPECT_NEAR(species.totalCharge(true), 1, 1.0e-6); } TEST(PCL2019CationsAssignmentTest, c1c1im) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("c1c1im", "ImportXYZStructure", "xyz/c1c1im.xyz", ForcefieldLibrary::forcefield("PCL2019/Cations")); @@ -74,28 +69,27 @@ TEST(PCL2019CationsAssignmentTest, c1c1im) ASSERT_EQ(species.torsions().size(), 32); ASSERT_EQ(species.impropers().size(), 5); - systemTest.checkSpeciesAtomType(&species, {{0, "NA"}, - {1, "CR"}, - {2, "NA"}, - {3, "CW"}, - {4, "CW"}, - {5, "C1"}, - {6, "HCR"}, - {7, "C1"}, - {8, "HCW"}, - {9, "HCW"}, - {10, "H1"}, - {11, "H1"}, - {12, "H1"}, - {13, "H1"}, - {14, "H1"}, - {15, "H1"}}); + testSpeciesAtomType(&species, {{0, "NA"}, + {1, "CR"}, + {2, "NA"}, + {3, "CW"}, + {4, "CW"}, + {5, "C1"}, + {6, "HCR"}, + {7, "C1"}, + {8, "HCW"}, + {9, "HCW"}, + {10, "H1"}, + {11, "H1"}, + {12, "H1"}, + {13, "H1"}, + {14, "H1"}, + {15, "H1"}}); EXPECT_NEAR(species.totalCharge(true), 1, 1.0e-6); } TEST(PCL2019CationsAssignmentTest, c1c1pyrr) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("c1c1pyrr", "ImportXYZStructure", "xyz/c1c1pyrr.xyz", ForcefieldLibrary::forcefield("PCL2019/Cations")); @@ -109,16 +103,14 @@ TEST(PCL2019CationsAssignmentTest, c1c1pyrr) ASSERT_EQ(species.torsions().size(), 63); ASSERT_EQ(species.impropers().size(), 0); - systemTest.checkSpeciesAtomType(&species, - {{0, "N4"}, {1, "C1"}, {2, "C1"}, {3, "C2"}, {4, "C2"}, {5, "C1"}, {6, "C1"}, - {7, "H1"}, {8, "H1"}, {9, "H1"}, {10, "H1"}, {11, "HC"}, {12, "HC"}, {13, "HC"}, - {14, "HC"}, {15, "H1"}, {16, "H1"}, {17, "H1"}, {18, "H1"}, {19, "H1"}, {20, "H1"}}); + testSpeciesAtomType(&species, {{0, "N4"}, {1, "C1"}, {2, "C1"}, {3, "C2"}, {4, "C2"}, {5, "C1"}, {6, "C1"}, + {7, "H1"}, {8, "H1"}, {9, "H1"}, {10, "H1"}, {11, "HC"}, {12, "HC"}, {13, "HC"}, + {14, "HC"}, {15, "H1"}, {16, "H1"}, {17, "H1"}, {18, "H1"}, {19, "H1"}, {20, "H1"}}); EXPECT_NEAR(species.totalCharge(true), 1, 1.0e-6); } TEST(PCL2019CationsAssignmentTest, c2c1c1im) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("c2c1c1im", "ImportXYZStructure", "xyz/c2c1c1im.xyz", ForcefieldLibrary::forcefield("PCL2019/Cations")); @@ -132,16 +124,15 @@ TEST(PCL2019CationsAssignmentTest, c2c1c1im) ASSERT_EQ(species.torsions().size(), 47); ASSERT_EQ(species.impropers().size(), 5); - systemTest.checkSpeciesAtomType(&species, {{0, "NAM"}, {1, "CRM"}, {2, "NAM"}, {3, "CW"}, {4, "CW"}, {5, "C1"}, - {6, "CCR"}, {7, "C1"}, {8, "HCW"}, {9, "HCW"}, {10, "H1"}, {11, "H1"}, - {12, "H1"}, {13, "CE"}, {14, "H1"}, {15, "H1"}, {16, "HC"}, {17, "HC"}, - {18, "HC"}, {19, "H1"}, {20, "H1"}, {21, "H1"}}); + testSpeciesAtomType(&species, + {{0, "NAM"}, {1, "CRM"}, {2, "NAM"}, {3, "CW"}, {4, "CW"}, {5, "C1"}, {6, "CCR"}, {7, "C1"}, + {8, "HCW"}, {9, "HCW"}, {10, "H1"}, {11, "H1"}, {12, "H1"}, {13, "CE"}, {14, "H1"}, {15, "H1"}, + {16, "HC"}, {17, "HC"}, {18, "HC"}, {19, "H1"}, {20, "H1"}, {21, "H1"}}); EXPECT_NEAR(species.totalCharge(true), 1, 1.0e-6); } TEST(PCL2019CationsAssignmentTest, c2c1im) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("c2c1im", "ImportXYZStructure", "xyz/c2c1im.xyz", ForcefieldLibrary::forcefield("PCL2019/Cations")); @@ -155,31 +146,30 @@ TEST(PCL2019CationsAssignmentTest, c2c1im) ASSERT_EQ(species.torsions().size(), 41); ASSERT_EQ(species.impropers().size(), 5); - systemTest.checkSpeciesAtomType(&species, {{0, "NA"}, - {1, "CR"}, - {2, "NA"}, - {3, "CW"}, - {4, "CW"}, - {5, "C1"}, - {6, "HCR"}, - {7, "C1"}, - {8, "HCW"}, - {9, "HCW"}, - {10, "H1"}, - {11, "H1"}, - {12, "H1"}, - {13, "CE"}, - {14, "H1"}, - {15, "H1"}, - {16, "HC"}, - {17, "HC"}, - {18, "HC"}}); + testSpeciesAtomType(&species, {{0, "NA"}, + {1, "CR"}, + {2, "NA"}, + {3, "CW"}, + {4, "CW"}, + {5, "C1"}, + {6, "HCR"}, + {7, "C1"}, + {8, "HCW"}, + {9, "HCW"}, + {10, "H1"}, + {11, "H1"}, + {12, "H1"}, + {13, "CE"}, + {14, "H1"}, + {15, "H1"}, + {16, "HC"}, + {17, "HC"}, + {18, "HC"}}); EXPECT_NEAR(species.totalCharge(true), 1, 1.0e-6); } TEST(PCL2019CationsAssignmentTest, c2im) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("c2im", "ImportXYZStructure", "xyz/c2im.xyz", ForcefieldLibrary::forcefield("PCL2019/Cations")); @@ -193,28 +183,27 @@ TEST(PCL2019CationsAssignmentTest, c2im) ASSERT_EQ(species.torsions().size(), 35); ASSERT_EQ(species.impropers().size(), 4); - systemTest.checkSpeciesAtomType(&species, {{0, "NAH"}, - {1, "CRH"}, - {2, "NA"}, - {3, "CW"}, - {4, "CWH"}, - {5, "HCR"}, - {6, "C1"}, - {7, "HCW"}, - {8, "HCW"}, - {9, "CE"}, - {10, "H1"}, - {11, "H1"}, - {12, "HC"}, - {13, "HC"}, - {14, "HC"}, - {15, "HNA"}}); + testSpeciesAtomType(&species, {{0, "NAH"}, + {1, "CRH"}, + {2, "NA"}, + {3, "CW"}, + {4, "CWH"}, + {5, "HCR"}, + {6, "C1"}, + {7, "HCW"}, + {8, "HCW"}, + {9, "CE"}, + {10, "H1"}, + {11, "H1"}, + {12, "HC"}, + {13, "HC"}, + {14, "HC"}, + {15, "HNA"}}); EXPECT_NEAR(species.totalCharge(true), 1, 1.0e-6); } TEST(PCL2019CationsAssignmentTest, c2OHc1im) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("c2OHc1im", "ImportXYZStructure", "xyz/c2ohc1im.xyz", ForcefieldLibrary::forcefield("PCL2019/Cations")); @@ -228,16 +217,14 @@ TEST(PCL2019CationsAssignmentTest, c2OHc1im) ASSERT_EQ(species.torsions().size(), 44); ASSERT_EQ(species.impropers().size(), 5); - systemTest.checkSpeciesAtomType(&species, - {{0, "NA"}, {1, "CR"}, {2, "NA"}, {3, "CW"}, {4, "CW"}, {5, "C1"}, {6, "HCR"}, - {7, "C1"}, {8, "HCW"}, {9, "HCW"}, {10, "H1"}, {11, "H1"}, {12, "H1"}, {13, "C2O"}, - {14, "H1"}, {15, "H1"}, {16, "OH"}, {17, "HC"}, {18, "HC"}, {19, "HO"}}); + testSpeciesAtomType(&species, {{0, "NA"}, {1, "CR"}, {2, "NA"}, {3, "CW"}, {4, "CW"}, {5, "C1"}, {6, "HCR"}, + {7, "C1"}, {8, "HCW"}, {9, "HCW"}, {10, "H1"}, {11, "H1"}, {12, "H1"}, {13, "C2O"}, + {14, "H1"}, {15, "H1"}, {16, "OH"}, {17, "HC"}, {18, "HC"}, {19, "HO"}}); EXPECT_NEAR(species.totalCharge(true), 1, 1.0e-6); } TEST(PCL2019CationsAssignmentTest, c2py) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("c2py", "ImportXYZStructure", "xyz/c2py.xyz", ForcefieldLibrary::forcefield("PCL2019/Cations")); @@ -251,30 +238,29 @@ TEST(PCL2019CationsAssignmentTest, c2py) ASSERT_EQ(species.torsions().size(), 39); ASSERT_EQ(species.impropers().size(), 6); - systemTest.checkSpeciesAtomType(&species, {{0, "NAP"}, - {1, "CAPO"}, - {2, "CAPO"}, - {3, "CAPM"}, - {4, "HAP"}, - {5, "CAPP"}, - {6, "HAP"}, - {7, "CAPM"}, - {8, "HAP"}, - {9, "HAP"}, - {10, "HAP"}, - {11, "C1"}, - {12, "CE"}, - {13, "HC"}, - {14, "HC"}, - {15, "HC"}, - {16, "H1"}, - {17, "H1"}}); + testSpeciesAtomType(&species, {{0, "NAP"}, + {1, "CAPO"}, + {2, "CAPO"}, + {3, "CAPM"}, + {4, "HAP"}, + {5, "CAPP"}, + {6, "HAP"}, + {7, "CAPM"}, + {8, "HAP"}, + {9, "HAP"}, + {10, "HAP"}, + {11, "C1"}, + {12, "CE"}, + {13, "HC"}, + {14, "HC"}, + {15, "HC"}, + {16, "H1"}, + {17, "H1"}}); EXPECT_NEAR(species.totalCharge(true), 1, 1.0e-6); } TEST(PCL2019CationsAssignmentTest, c3c1im) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("c3c1im", "ImportXYZStructure", "xyz/c3c1im.xyz", ForcefieldLibrary::forcefield("PCL2019/Cations")); @@ -288,16 +274,15 @@ TEST(PCL2019CationsAssignmentTest, c3c1im) ASSERT_EQ(species.torsions().size(), 50); ASSERT_EQ(species.impropers().size(), 5); - systemTest.checkSpeciesAtomType(&species, {{0, "NA"}, {1, "CR"}, {2, "NA"}, {3, "CW"}, {4, "CW"}, {5, "C1"}, - {6, "HCR"}, {7, "C1"}, {8, "HCW"}, {9, "HCW"}, {10, "H1"}, {11, "H1"}, - {12, "H1"}, {13, "C2"}, {14, "H1"}, {15, "H1"}, {16, "CT"}, {17, "HC"}, - {18, "HC"}, {19, "HC"}, {20, "HC"}, {21, "HC"}}); + testSpeciesAtomType(&species, + {{0, "NA"}, {1, "CR"}, {2, "NA"}, {3, "CW"}, {4, "CW"}, {5, "C1"}, {6, "HCR"}, {7, "C1"}, + {8, "HCW"}, {9, "HCW"}, {10, "H1"}, {11, "H1"}, {12, "H1"}, {13, "C2"}, {14, "H1"}, {15, "H1"}, + {16, "CT"}, {17, "HC"}, {18, "HC"}, {19, "HC"}, {20, "HC"}, {21, "HC"}}); EXPECT_NEAR(species.totalCharge(true), 1, 1.0e-6); } TEST(PCL2019CationsAssignmentTest, c3c1pyrr) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("c3c1pyrr", "ImportXYZStructure", "xyz/c3c1pyrr.xyz", ForcefieldLibrary::forcefield("PCL2019/Cations")); @@ -311,16 +296,15 @@ TEST(PCL2019CationsAssignmentTest, c3c1pyrr) ASSERT_EQ(species.torsions().size(), 81); ASSERT_EQ(species.impropers().size(), 0); - systemTest.checkSpeciesAtomType( - &species, {{0, "N4"}, {1, "C1"}, {2, "C1"}, {3, "C2"}, {4, "C2"}, {5, "C1"}, {6, "C1"}, {7, "H1"}, {8, "H1"}, - {9, "H1"}, {10, "H1"}, {11, "HC"}, {12, "HC"}, {13, "HC"}, {14, "HC"}, {15, "H1"}, {16, "H1"}, {17, "H1"}, - {18, "H1"}, {19, "H1"}, {20, "C2"}, {21, "HC"}, {22, "HC"}, {23, "CT"}, {24, "HC"}, {25, "HC"}, {26, "HC"}}); + testSpeciesAtomType(&species, {{0, "N4"}, {1, "C1"}, {2, "C1"}, {3, "C2"}, {4, "C2"}, {5, "C1"}, {6, "C1"}, + {7, "H1"}, {8, "H1"}, {9, "H1"}, {10, "H1"}, {11, "HC"}, {12, "HC"}, {13, "HC"}, + {14, "HC"}, {15, "H1"}, {16, "H1"}, {17, "H1"}, {18, "H1"}, {19, "H1"}, {20, "C2"}, + {21, "HC"}, {22, "HC"}, {23, "CT"}, {24, "HC"}, {25, "HC"}, {26, "HC"}}); EXPECT_NEAR(species.totalCharge(true), 1, 1.0e-6); } TEST(PCL2019CationsAssignmentTest, c4c1c1im) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("c4c1c1im", "ImportXYZStructure", "xyz/c4c1c1im.xyz", ForcefieldLibrary::forcefield("PCL2019/Cations")); @@ -334,17 +318,15 @@ TEST(PCL2019CationsAssignmentTest, c4c1c1im) ASSERT_EQ(species.torsions().size(), 65); ASSERT_EQ(species.impropers().size(), 5); - systemTest.checkSpeciesAtomType(&species, - {{0, "NAM"}, {1, "CRM"}, {2, "NAM"}, {3, "CW"}, {4, "CW"}, {5, "C1"}, {6, "CCR"}, - {7, "C1"}, {8, "HCW"}, {9, "HCW"}, {10, "H1"}, {11, "H1"}, {12, "H1"}, {13, "C2"}, - {14, "H1"}, {15, "H1"}, {16, "CS"}, {17, "HC"}, {18, "HC"}, {19, "CT"}, {20, "HC"}, - {21, "HC"}, {22, "HC"}, {23, "HC"}, {24, "HC"}, {25, "H1"}, {26, "H1"}, {27, "H1"}}); + testSpeciesAtomType(&species, {{0, "NAM"}, {1, "CRM"}, {2, "NAM"}, {3, "CW"}, {4, "CW"}, {5, "C1"}, {6, "CCR"}, + {7, "C1"}, {8, "HCW"}, {9, "HCW"}, {10, "H1"}, {11, "H1"}, {12, "H1"}, {13, "C2"}, + {14, "H1"}, {15, "H1"}, {16, "CS"}, {17, "HC"}, {18, "HC"}, {19, "CT"}, {20, "HC"}, + {21, "HC"}, {22, "HC"}, {23, "HC"}, {24, "HC"}, {25, "H1"}, {26, "H1"}, {27, "H1"}}); EXPECT_NEAR(species.totalCharge(true), 1, 1.0e-6); } TEST(PCL2019CationsAssignmentTest, c4c1im) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("c4c1im", "ImportXYZStructure", "xyz/c4c1im.xyz", ForcefieldLibrary::forcefield("PCL2019/Cations")); @@ -358,16 +340,15 @@ TEST(PCL2019CationsAssignmentTest, c4c1im) ASSERT_EQ(species.torsions().size(), 59); ASSERT_EQ(species.impropers().size(), 5); - systemTest.checkSpeciesAtomType( - &species, {{0, "NA"}, {1, "CR"}, {2, "NA"}, {3, "CW"}, {4, "CW"}, {5, "C1"}, {6, "HCR"}, {7, "C1"}, {8, "HCW"}, - {9, "HCW"}, {10, "H1"}, {11, "H1"}, {12, "H1"}, {13, "C2"}, {14, "H1"}, {15, "H1"}, {16, "CS"}, {17, "HC"}, - {18, "HC"}, {19, "CT"}, {20, "HC"}, {21, "HC"}, {22, "HC"}, {23, "HC"}, {24, "HC"}}); + testSpeciesAtomType(&species, {{0, "NA"}, {1, "CR"}, {2, "NA"}, {3, "CW"}, {4, "CW"}, {5, "C1"}, {6, "HCR"}, + {7, "C1"}, {8, "HCW"}, {9, "HCW"}, {10, "H1"}, {11, "H1"}, {12, "H1"}, {13, "C2"}, + {14, "H1"}, {15, "H1"}, {16, "CS"}, {17, "HC"}, {18, "HC"}, {19, "CT"}, {20, "HC"}, + {21, "HC"}, {22, "HC"}, {23, "HC"}, {24, "HC"}}); EXPECT_NEAR(species.totalCharge(true), 1, 1.0e-6); } TEST(PCL2019CationsAssignmentTest, c4c1pyrr) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("c4c1pyrr", "ImportXYZStructure", "xyz/c4c1pyrr.xyz", ForcefieldLibrary::forcefield("PCL2019/Cations")); @@ -381,17 +362,16 @@ TEST(PCL2019CationsAssignmentTest, c4c1pyrr) ASSERT_EQ(species.torsions().size(), 90); ASSERT_EQ(species.impropers().size(), 0); - systemTest.checkSpeciesAtomType(&species, {{0, "N4"}, {1, "C1"}, {2, "C1"}, {3, "C2"}, {4, "C2"}, {5, "C1"}, - {6, "C1"}, {7, "H1"}, {8, "H1"}, {9, "H1"}, {10, "H1"}, {11, "HC"}, - {12, "HC"}, {13, "HC"}, {14, "HC"}, {15, "H1"}, {16, "H1"}, {17, "H1"}, - {18, "H1"}, {19, "H1"}, {20, "C2"}, {21, "HC"}, {22, "HC"}, {23, "CS"}, - {24, "HC"}, {25, "HC"}, {26, "CT"}, {27, "HC"}, {28, "HC"}, {29, "HC"}}); + testSpeciesAtomType(&species, + {{0, "N4"}, {1, "C1"}, {2, "C1"}, {3, "C2"}, {4, "C2"}, {5, "C1"}, {6, "C1"}, {7, "H1"}, + {8, "H1"}, {9, "H1"}, {10, "H1"}, {11, "HC"}, {12, "HC"}, {13, "HC"}, {14, "HC"}, {15, "H1"}, + {16, "H1"}, {17, "H1"}, {18, "H1"}, {19, "H1"}, {20, "C2"}, {21, "HC"}, {22, "HC"}, {23, "CS"}, + {24, "HC"}, {25, "HC"}, {26, "CT"}, {27, "HC"}, {28, "HC"}, {29, "HC"}}); EXPECT_NEAR(species.totalCharge(true), 1, 1.0e-6); } TEST(PCL2019CationsAssignmentTest, c4c4im) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("c4c4im", "ImportXYZStructure", "xyz/c4c4im.xyz", ForcefieldLibrary::forcefield("PCL2019/Cations")); @@ -405,17 +385,16 @@ TEST(PCL2019CationsAssignmentTest, c4c4im) ASSERT_EQ(species.torsions().size(), 86); ASSERT_EQ(species.impropers().size(), 5); - systemTest.checkSpeciesAtomType( - &species, {{0, "NA"}, {1, "CR"}, {2, "NA"}, {3, "CW"}, {4, "CW"}, {5, "C1"}, {6, "HCR"}, {7, "C1"}, {8, "HCW"}, - {9, "HCW"}, {10, "C2"}, {11, "H1"}, {12, "H1"}, {13, "CS"}, {14, "HC"}, {15, "HC"}, {16, "CT"}, {17, "HC"}, - {18, "HC"}, {19, "HC"}, {20, "HC"}, {21, "HC"}, {22, "C2"}, {23, "H1"}, {24, "H1"}, {25, "CS"}, {26, "HC"}, - {27, "HC"}, {28, "CT"}, {29, "HC"}, {30, "HC"}, {31, "HC"}, {32, "HC"}, {33, "HC"}}); + testSpeciesAtomType(&species, {{0, "NA"}, {1, "CR"}, {2, "NA"}, {3, "CW"}, {4, "CW"}, {5, "C1"}, {6, "HCR"}, + {7, "C1"}, {8, "HCW"}, {9, "HCW"}, {10, "C2"}, {11, "H1"}, {12, "H1"}, {13, "CS"}, + {14, "HC"}, {15, "HC"}, {16, "CT"}, {17, "HC"}, {18, "HC"}, {19, "HC"}, {20, "HC"}, + {21, "HC"}, {22, "C2"}, {23, "H1"}, {24, "H1"}, {25, "CS"}, {26, "HC"}, {27, "HC"}, + {28, "CT"}, {29, "HC"}, {30, "HC"}, {31, "HC"}, {32, "HC"}, {33, "HC"}}); EXPECT_NEAR(species.totalCharge(true), 1, 1.0e-6); } TEST(PCL2019CationsAssignmentTest, c4pyri) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("c4pyri", "ImportXYZStructure", "xyz/c4pyri.xyz", ForcefieldLibrary::forcefield("PCL2019/Cations")); @@ -429,16 +408,15 @@ TEST(PCL2019CationsAssignmentTest, c4pyri) ASSERT_EQ(species.torsions().size(), 57); ASSERT_EQ(species.impropers().size(), 6); - systemTest.checkSpeciesAtomType(&species, {{0, "NAP"}, {1, "CAPO"}, {2, "CAPM"}, {3, "CAPP"}, {4, "CAPM"}, {5, "CAPO"}, - {6, "C1"}, {7, "HAP"}, {8, "HAP"}, {9, "HAP"}, {10, "HAP"}, {11, "HAP"}, - {12, "C2"}, {13, "H1"}, {14, "H1"}, {15, "CS"}, {16, "HC"}, {17, "HC"}, - {18, "CT"}, {19, "HC"}, {20, "HC"}, {21, "HC"}, {22, "HC"}, {23, "HC"}}); + testSpeciesAtomType(&species, + {{0, "NAP"}, {1, "CAPO"}, {2, "CAPM"}, {3, "CAPP"}, {4, "CAPM"}, {5, "CAPO"}, {6, "C1"}, {7, "HAP"}, + {8, "HAP"}, {9, "HAP"}, {10, "HAP"}, {11, "HAP"}, {12, "C2"}, {13, "H1"}, {14, "H1"}, {15, "CS"}, + {16, "HC"}, {17, "HC"}, {18, "CT"}, {19, "HC"}, {20, "HC"}, {21, "HC"}, {22, "HC"}, {23, "HC"}}); EXPECT_NEAR(species.totalCharge(true), 1, 1.0e-6); } TEST(PCL2019CationsAssignmentTest, c6c1im) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("c6c1im", "ImportXYZStructure", "xyz/c6c1im.xyz", ForcefieldLibrary::forcefield("PCL2019/Cations")); @@ -452,17 +430,16 @@ TEST(PCL2019CationsAssignmentTest, c6c1im) ASSERT_EQ(species.torsions().size(), 77); ASSERT_EQ(species.impropers().size(), 5); - systemTest.checkSpeciesAtomType( - &species, {{0, "NA"}, {1, "CR"}, {2, "NA"}, {3, "CW"}, {4, "CW"}, {5, "C1"}, {6, "HCR"}, {7, "C1"}, - {8, "HCW"}, {9, "HCW"}, {10, "H1"}, {11, "H1"}, {12, "H1"}, {13, "C2"}, {14, "H1"}, {15, "H1"}, - {16, "CS"}, {17, "HC"}, {18, "HC"}, {19, "CS"}, {20, "HC"}, {21, "HC"}, {22, "CS"}, {23, "HC"}, - {24, "HC"}, {25, "CT"}, {26, "HC"}, {27, "HC"}, {28, "HC"}, {29, "HC"}, {30, "HC"}}); + testSpeciesAtomType(&species, + {{0, "NA"}, {1, "CR"}, {2, "NA"}, {3, "CW"}, {4, "CW"}, {5, "C1"}, {6, "HCR"}, {7, "C1"}, + {8, "HCW"}, {9, "HCW"}, {10, "H1"}, {11, "H1"}, {12, "H1"}, {13, "C2"}, {14, "H1"}, {15, "H1"}, + {16, "CS"}, {17, "HC"}, {18, "HC"}, {19, "CS"}, {20, "HC"}, {21, "HC"}, {22, "CS"}, {23, "HC"}, + {24, "HC"}, {25, "CT"}, {26, "HC"}, {27, "HC"}, {28, "HC"}, {29, "HC"}, {30, "HC"}}); EXPECT_NEAR(species.totalCharge(true), 1, 1.0e-6); } TEST(PCL2019CationsAssignmentTest, c8c1im) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("c8c1im", "ImportXYZStructure", "xyz/c8c1im.xyz", ForcefieldLibrary::forcefield("PCL2019/Cations")); @@ -476,18 +453,17 @@ TEST(PCL2019CationsAssignmentTest, c8c1im) ASSERT_EQ(species.torsions().size(), 95); ASSERT_EQ(species.impropers().size(), 5); - systemTest.checkSpeciesAtomType( - &species, - {{0, "NA"}, {1, "CR"}, {2, "NA"}, {3, "CW"}, {4, "CW"}, {5, "C1"}, {6, "HCR"}, {7, "C1"}, {8, "HCW"}, {9, "HCW"}, - {10, "H1"}, {11, "H1"}, {12, "H1"}, {13, "C2"}, {14, "H1"}, {15, "H1"}, {16, "CS"}, {17, "HC"}, {18, "HC"}, {19, "CS"}, - {20, "HC"}, {21, "HC"}, {22, "CS"}, {23, "HC"}, {24, "HC"}, {25, "CS"}, {26, "HC"}, {27, "HC"}, {28, "CS"}, {29, "HC"}, - {30, "HC"}, {31, "CT"}, {32, "HC"}, {33, "HC"}, {34, "HC"}, {35, "HC"}, {36, "HC"}}); + testSpeciesAtomType(&species, + {{0, "NA"}, {1, "CR"}, {2, "NA"}, {3, "CW"}, {4, "CW"}, {5, "C1"}, {6, "HCR"}, {7, "C1"}, + {8, "HCW"}, {9, "HCW"}, {10, "H1"}, {11, "H1"}, {12, "H1"}, {13, "C2"}, {14, "H1"}, {15, "H1"}, + {16, "CS"}, {17, "HC"}, {18, "HC"}, {19, "CS"}, {20, "HC"}, {21, "HC"}, {22, "CS"}, {23, "HC"}, + {24, "HC"}, {25, "CS"}, {26, "HC"}, {27, "HC"}, {28, "CS"}, {29, "HC"}, {30, "HC"}, {31, "CT"}, + {32, "HC"}, {33, "HC"}, {34, "HC"}, {35, "HC"}, {36, "HC"}}); EXPECT_NEAR(species.totalCharge(true), 1, 1.0e-6); } TEST(PCL2019CationsAssignmentTest, c8fc1im) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("c8fc1im", "ImportXYZStructure", "xyz/c8fc1im.xyz", ForcefieldLibrary::forcefield("PCL2019/Cations")); @@ -501,18 +477,17 @@ TEST(PCL2019CationsAssignmentTest, c8fc1im) ASSERT_EQ(species.torsions().size(), 95); ASSERT_EQ(species.impropers().size(), 5); - systemTest.checkSpeciesAtomType( - &species, {{0, "NA"}, {1, "CR"}, {2, "NA"}, {3, "CW"}, {4, "CW"}, {5, "C1"}, {6, "HCR"}, {7, "C1H"}, - {8, "HCW"}, {9, "HCW"}, {10, "H1"}, {11, "H1"}, {12, "H1"}, {13, "C2"}, {14, "H1"}, {15, "H1"}, - {16, "CFH"}, {17, "HC"}, {18, "HC"}, {19, "CSF"}, {20, "F"}, {21, "F"}, {22, "CSF"}, {23, "F"}, - {24, "F"}, {25, "CSF"}, {26, "F"}, {27, "F"}, {28, "CSF"}, {29, "F"}, {30, "F"}, {31, "CTF"}, - {32, "F"}, {33, "F"}, {34, "F"}, {35, "F"}, {36, "F"}}); + testSpeciesAtomType(&species, + {{0, "NA"}, {1, "CR"}, {2, "NA"}, {3, "CW"}, {4, "CW"}, {5, "C1"}, {6, "HCR"}, {7, "C1H"}, + {8, "HCW"}, {9, "HCW"}, {10, "H1"}, {11, "H1"}, {12, "H1"}, {13, "C2"}, {14, "H1"}, {15, "H1"}, + {16, "CFH"}, {17, "HC"}, {18, "HC"}, {19, "CSF"}, {20, "F"}, {21, "F"}, {22, "CSF"}, {23, "F"}, + {24, "F"}, {25, "CSF"}, {26, "F"}, {27, "F"}, {28, "CSF"}, {29, "F"}, {30, "F"}, {31, "CTF"}, + {32, "F"}, {33, "F"}, {34, "F"}, {35, "F"}, {36, "F"}}); EXPECT_NEAR(species.totalCharge(true), 1, 1.0e-6); } TEST(PCL2019CationsAssignmentTest, c8isoqui) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("c8isoqui", "ImportXYZStructure", "xyz/c8isoqui.xyz", ForcefieldLibrary::forcefield("PCL2019/Cations")); @@ -526,19 +501,17 @@ TEST(PCL2019CationsAssignmentTest, c8isoqui) ASSERT_EQ(species.torsions().size(), 113); ASSERT_EQ(species.impropers().size(), 10); - systemTest.checkSpeciesAtomType(&species, - {{0, "NAQ"}, {1, "CA"}, {2, "CAQ"}, {3, "CA"}, {4, "CA"}, {5, "CA"}, {6, "CA"}, - {7, "CAQ"}, {8, "CA"}, {9, "CA"}, {10, "HAP"}, {11, "HA"}, {12, "HA"}, {13, "HA"}, - {14, "HA"}, {15, "HAP"}, {16, "HAP"}, {17, "C1"}, {18, "H1"}, {19, "H1"}, {20, "C2"}, - {21, "CS"}, {22, "CS"}, {23, "CS"}, {24, "CS"}, {25, "CS"}, {26, "CT"}, {27, "HC"}, - {28, "HC"}, {29, "HC"}, {30, "HC"}, {31, "HC"}, {32, "HC"}, {33, "HC"}, {34, "HC"}, - {35, "HC"}, {36, "HC"}, {37, "HC"}, {38, "HC"}, {39, "HC"}, {40, "HC"}, {41, "HC"}}); + testSpeciesAtomType(&species, {{0, "NAQ"}, {1, "CA"}, {2, "CAQ"}, {3, "CA"}, {4, "CA"}, {5, "CA"}, {6, "CA"}, + {7, "CAQ"}, {8, "CA"}, {9, "CA"}, {10, "HAP"}, {11, "HA"}, {12, "HA"}, {13, "HA"}, + {14, "HA"}, {15, "HAP"}, {16, "HAP"}, {17, "C1"}, {18, "H1"}, {19, "H1"}, {20, "C2"}, + {21, "CS"}, {22, "CS"}, {23, "CS"}, {24, "CS"}, {25, "CS"}, {26, "CT"}, {27, "HC"}, + {28, "HC"}, {29, "HC"}, {30, "HC"}, {31, "HC"}, {32, "HC"}, {33, "HC"}, {34, "HC"}, + {35, "HC"}, {36, "HC"}, {37, "HC"}, {38, "HC"}, {39, "HC"}, {40, "HC"}, {41, "HC"}}); EXPECT_NEAR(species.totalCharge(true), 1, 1.0e-6); } TEST(PCL2019CationsAssignmentTest, cholinium) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield( "cholinium", "ImportXYZStructure", "xyz/cholinium.xyz", ForcefieldLibrary::forcefield("PCL2019/Cations")); @@ -552,16 +525,14 @@ TEST(PCL2019CationsAssignmentTest, cholinium) ASSERT_EQ(species.torsions().size(), 48); ASSERT_EQ(species.impropers().size(), 0); - systemTest.checkSpeciesAtomType(&species, - {{0, "N4"}, {1, "C1"}, {2, "C1"}, {3, "C1"}, {4, "H1"}, {5, "H1"}, {6, "H1"}, - {7, "H1"}, {8, "H1"}, {9, "H1"}, {10, "H1"}, {11, "H1"}, {12, "H1"}, {13, "C1"}, - {14, "H1"}, {15, "COL"}, {16, "H1"}, {17, "HC"}, {18, "HC"}, {19, "OH"}, {20, "HO"}}); + testSpeciesAtomType(&species, {{0, "N4"}, {1, "C1"}, {2, "C1"}, {3, "C1"}, {4, "H1"}, {5, "H1"}, {6, "H1"}, + {7, "H1"}, {8, "H1"}, {9, "H1"}, {10, "H1"}, {11, "H1"}, {12, "H1"}, {13, "C1"}, + {14, "H1"}, {15, "COL"}, {16, "H1"}, {17, "HC"}, {18, "HC"}, {19, "OH"}, {20, "HO"}}); EXPECT_NEAR(species.totalCharge(true), 1, 1.0e-6); } TEST(PCL2019CationsAssignmentTest, gua) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("Gua", "ImportXYZStructure", "xyz/gua.xyz", ForcefieldLibrary::forcefield("PCL2019/Cations")); @@ -575,7 +546,7 @@ TEST(PCL2019CationsAssignmentTest, gua) ASSERT_EQ(species.torsions().size(), 12); ASSERT_EQ(species.impropers().size(), 4); - systemTest.checkSpeciesAtomType( + testSpeciesAtomType( &species, {{0, "CG"}, {1, "NG"}, {2, "NG"}, {3, "NG"}, {4, "HG"}, {5, "HG"}, {6, "HG"}, {7, "HG"}, {8, "HG"}, {9, "HG"}}); EXPECT_NEAR(species.totalCharge(true), 1, 1.0e-6); @@ -583,7 +554,6 @@ TEST(PCL2019CationsAssignmentTest, gua) TEST(PCL2019CationsAssignmentTest, N1110) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("N1110", "ImportXYZStructure", "xyz/n1110.xyz", ForcefieldLibrary::forcefield("PCL2019/Cations")); @@ -597,26 +567,25 @@ TEST(PCL2019CationsAssignmentTest, N1110) ASSERT_EQ(species.torsions().size(), 27); ASSERT_EQ(species.impropers().size(), 0); - systemTest.checkSpeciesAtomType(&species, {{0, "N3"}, - {1, "C1"}, - {2, "C1"}, - {3, "C1"}, - {4, "H3"}, - {5, "H1"}, - {6, "H1"}, - {7, "H1"}, - {8, "H1"}, - {9, "H1"}, - {10, "H1"}, - {11, "H1"}, - {12, "H1"}, - {13, "H1"}}); + testSpeciesAtomType(&species, {{0, "N3"}, + {1, "C1"}, + {2, "C1"}, + {3, "C1"}, + {4, "H3"}, + {5, "H1"}, + {6, "H1"}, + {7, "H1"}, + {8, "H1"}, + {9, "H1"}, + {10, "H1"}, + {11, "H1"}, + {12, "H1"}, + {13, "H1"}}); EXPECT_NEAR(species.totalCharge(true), 1, 1.0e-6); } TEST(PCL2019CationsAssignmentTest, N1111) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("N1111", "ImportXYZStructure", "xyz/n1111.xyz", ForcefieldLibrary::forcefield("PCL2019/Cations")); @@ -630,29 +599,28 @@ TEST(PCL2019CationsAssignmentTest, N1111) ASSERT_EQ(species.torsions().size(), 36); ASSERT_EQ(species.impropers().size(), 0); - systemTest.checkSpeciesAtomType(&species, {{0, "N4"}, - {1, "C1"}, - {2, "C1"}, - {3, "C1"}, - {4, "C1"}, - {5, "H1"}, - {6, "H1"}, - {7, "H1"}, - {8, "H1"}, - {9, "H1"}, - {10, "H1"}, - {11, "H1"}, - {12, "H1"}, - {13, "H1"}, - {14, "H1"}, - {15, "H1"}, - {16, "H1"}}); + testSpeciesAtomType(&species, {{0, "N4"}, + {1, "C1"}, + {2, "C1"}, + {3, "C1"}, + {4, "C1"}, + {5, "H1"}, + {6, "H1"}, + {7, "H1"}, + {8, "H1"}, + {9, "H1"}, + {10, "H1"}, + {11, "H1"}, + {12, "H1"}, + {13, "H1"}, + {14, "H1"}, + {15, "H1"}, + {16, "H1"}}); EXPECT_NEAR(species.totalCharge(true), 1, 1.0e-6); } TEST(PCL2019CationsAssignmentTest, N2220) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("N2220", "ImportXYZStructure", "xyz/n2220.xyz", ForcefieldLibrary::forcefield("PCL2019/Cations")); @@ -666,16 +634,15 @@ TEST(PCL2019CationsAssignmentTest, N2220) ASSERT_EQ(species.torsions().size(), 54); ASSERT_EQ(species.impropers().size(), 0); - systemTest.checkSpeciesAtomType(&species, {{0, "N3"}, {1, "C1"}, {2, "C1"}, {3, "C1"}, {4, "CE"}, {5, "H1"}, - {6, "H1"}, {7, "HC"}, {8, "HC"}, {9, "HC"}, {10, "H1"}, {11, "H1"}, - {12, "CE"}, {13, "HC"}, {14, "HC"}, {15, "HC"}, {16, "H1"}, {17, "H1"}, - {18, "CE"}, {19, "HC"}, {20, "HC"}, {21, "HC"}, {22, "H3"}}); + testSpeciesAtomType(&species, + {{0, "N3"}, {1, "C1"}, {2, "C1"}, {3, "C1"}, {4, "CE"}, {5, "H1"}, {6, "H1"}, {7, "HC"}, + {8, "HC"}, {9, "HC"}, {10, "H1"}, {11, "H1"}, {12, "CE"}, {13, "HC"}, {14, "HC"}, {15, "HC"}, + {16, "H1"}, {17, "H1"}, {18, "CE"}, {19, "HC"}, {20, "HC"}, {21, "HC"}, {22, "H3"}}); EXPECT_NEAR(species.totalCharge(true), 1, 1.0e-6); } TEST(PCL2019CationsAssignmentTest, N2222) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("N2222", "ImportXYZStructure", "xyz/n2222.xyz", ForcefieldLibrary::forcefield("PCL2019/Cations")); @@ -689,17 +656,16 @@ TEST(PCL2019CationsAssignmentTest, N2222) ASSERT_EQ(species.torsions().size(), 72); ASSERT_EQ(species.impropers().size(), 0); - systemTest.checkSpeciesAtomType(&species, {{0, "N4"}, {1, "C1"}, {2, "C1"}, {3, "C1"}, {4, "C1"}, {5, "H1"}, - {6, "H1"}, {7, "H1"}, {8, "H1"}, {9, "H1"}, {10, "H1"}, {11, "H1"}, - {12, "H1"}, {13, "CE"}, {14, "CE"}, {15, "CE"}, {16, "CE"}, {17, "HC"}, - {18, "HC"}, {19, "HC"}, {20, "HC"}, {21, "HC"}, {22, "HC"}, {23, "HC"}, - {24, "HC"}, {25, "HC"}, {26, "HC"}, {27, "HC"}, {28, "HC"}}); + testSpeciesAtomType(&species, + {{0, "N4"}, {1, "C1"}, {2, "C1"}, {3, "C1"}, {4, "C1"}, {5, "H1"}, {6, "H1"}, {7, "H1"}, + {8, "H1"}, {9, "H1"}, {10, "H1"}, {11, "H1"}, {12, "H1"}, {13, "CE"}, {14, "CE"}, {15, "CE"}, + {16, "CE"}, {17, "HC"}, {18, "HC"}, {19, "HC"}, {20, "HC"}, {21, "HC"}, {22, "HC"}, {23, "HC"}, + {24, "HC"}, {25, "HC"}, {26, "HC"}, {27, "HC"}, {28, "HC"}}); EXPECT_NEAR(species.totalCharge(true), 1, 1.0e-6); } TEST(PCL2019CationsAssignmentTest, N4444) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("N4444", "ImportXYZStructure", "xyz/n4444.xyz", ForcefieldLibrary::forcefield("PCL2019/Cations")); @@ -713,7 +679,7 @@ TEST(PCL2019CationsAssignmentTest, N4444) ASSERT_EQ(species.torsions().size(), 144); ASSERT_EQ(species.impropers().size(), 0); - systemTest.checkSpeciesAtomType( + testSpeciesAtomType( &species, {{0, "N4"}, {1, "C1"}, {2, "C1"}, {3, "C1"}, {4, "C1"}, {5, "H1"}, {6, "H1"}, {7, "H1"}, {8, "H1"}, {9, "H1"}, {10, "H1"}, {11, "H1"}, {12, "H1"}, {13, "C2"}, {14, "C2"}, {15, "C2"}, {16, "C2"}, {17, "HC"}, {18, "HC"}, {19, "HC"}, {20, "HC"}, {21, "HC"}, {22, "HC"}, {23, "HC"}, {24, "HC"}, {25, "CS"}, {26, "CS"}, @@ -725,7 +691,6 @@ TEST(PCL2019CationsAssignmentTest, N4444) TEST(PCL2019CationsAssignmentTest, P66614) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("P66614", "ImportXYZStructure", "xyz/p66614.xyz", ForcefieldLibrary::forcefield("PCL2019/Cations")); @@ -739,7 +704,7 @@ TEST(PCL2019CationsAssignmentTest, P66614) ASSERT_EQ(species.torsions().size(), 288); ASSERT_EQ(species.impropers().size(), 0); - systemTest.checkSpeciesAtomType( + testSpeciesAtomType( &species, {{0, "P4"}, {1, "C1P"}, {2, "C1P"}, {3, "C1P"}, {4, "C1P"}, {5, "C2"}, {6, "H1"}, {7, "H1"}, {8, "H1"}, {9, "H1"}, {10, "C2"}, {11, "C2"}, {12, "H1"}, {13, "H1"}, {14, "H1"}, {15, "H1"}, {16, "C2"}, {17, "CS"}, {18, "HC"}, {19, "HC"}, diff --git a/tests/ff/assignment-SPCFw.cpp b/tests/ff/assignment-SPCFw.cpp index 99a37f5575..0beca0f7d8 100644 --- a/tests/ff/assignment-SPCFw.cpp +++ b/tests/ff/assignment-SPCFw.cpp @@ -2,15 +2,13 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "data/ff/library.h" -#include "tests/graphData.h" -#include "tests/testData.h" -#include +#include "nodes/species.h" +#include "tests/testGraph.h" namespace UnitTest { TEST(SPCFwAssignmentTest, Water) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("Water", "ImportXYZStructure", "xyz/water.xyz", ForcefieldLibrary::forcefield("SPC/Fw")); @@ -24,8 +22,8 @@ TEST(SPCFwAssignmentTest, Water) ASSERT_EQ(species.torsions().size(), 0); ASSERT_EQ(species.impropers().size(), 0); - systemTest.checkSpeciesAtomType(&species, {{0, "OW"}, {1, "HW"}, {2, "HW"}}); - systemTest.checkSpeciesIntramolecular(&species, {0, 1}, {BondFunctions::Form::Harmonic, "k=4431.53 eq=1"}); - systemTest.checkSpeciesIntramolecular(&species, {1, 0, 2}, {AngleFunctions::Form::Harmonic, "k=317.5656 eq=113.24"}); + testSpeciesAtomType(&species, {{0, "OW"}, {1, "HW"}, {2, "HW"}}); + testSpeciesIntramolecular(&species, {0, 1}, {BondFunctions::Form::Harmonic, "k=4431.53 eq=1"}); + testSpeciesIntramolecular(&species, {1, 0, 2}, {AngleFunctions::Form::Harmonic, "k=317.5656 eq=113.24"}); } }; // namespace UnitTest diff --git a/tests/ff/assignment-UFF-nmethylformamide.cpp b/tests/ff/assignment-UFF-nmethylformamide.cpp index 8cce26b198..31470b34c2 100644 --- a/tests/ff/assignment-UFF-nmethylformamide.cpp +++ b/tests/ff/assignment-UFF-nmethylformamide.cpp @@ -2,15 +2,13 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "data/ff/library.h" -#include "tests/graphData.h" -#include "tests/testData.h" -#include +#include "nodes/species.h" +#include "tests/testGraph.h" namespace UnitTest { TEST(UFFNMethylFormamideAssignmentTest, NMethylFormamide) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield( "NMethylFormamide", "ImportXYZStructure", "xyz/n-methylformamide.xyz", ForcefieldLibrary::forcefield("UFF")); @@ -24,20 +22,16 @@ TEST(UFFNMethylFormamideAssignmentTest, NMethylFormamide) ASSERT_EQ(species.torsions().size(), 10); ASSERT_EQ(species.impropers().size(), 2); - systemTest.checkSpeciesAtomType( + testSpeciesAtomType( &species, {{0, "H_"}, {1, "C_amR"}, {2, "N_amR"}, {3, "O_2"}, {4, "C_3"}, {5, "H_"}, {6, "H_"}, {7, "H_"}, {8, "H_"}}); - systemTest.checkSpeciesIntramolecular(&species, {1, 2}, {BondFunctions::Form::Harmonic, "k=5410.2978 eq=1.3568"}, 5.0e-5); - systemTest.checkSpeciesIntramolecular(&species, {0, 1}, {BondFunctions::Form::Harmonic, "k=2991.0611 eq=1.08142"}, 5.0e-5); - systemTest.checkSpeciesIntramolecular(&species, {2, 4}, {BondFunctions::Form::Harmonic, "k=4432.3881 eq=1.45007"}, 5.0e-5); - systemTest.checkSpeciesIntramolecular(&species, {1, 2, 4}, {AngleFunctions::Form::Cos2, "882.7151 0.5 0.666667 0.333333"}, - 5.0e-5); - systemTest.checkSpeciesIntramolecular(&species, {3, 1, 2}, {AngleFunctions::Form::Cos2, "1590.3058 0.5 0.6667 0.3333"}, - 5.0e-5); - systemTest.checkSpeciesIntramolecular(&species, {8, 4, 7}, - {AngleFunctions::Form::Cos2, "315.8868 0.343737 0.37492 0.281246"}, 6.0e-5); - systemTest.checkSpeciesIntramolecular(&species, {0, 1, 2, 4}, {TorsionFunctions::Form::UFFCosine, "101.9308 2 180"}, - 2.0e-5); - systemTest.checkSpeciesIntramolecular(&species, {1, 0, 2, 3}, {TorsionFunctions::Form::FourierN, "209.2 1 -1 0"}); - systemTest.checkSpeciesIntramolecular(&species, {2, 5, 1, 4}, {TorsionFunctions::Form::FourierN, "25.104 1 -1 0"}); + testSpeciesIntramolecular(&species, {1, 2}, {BondFunctions::Form::Harmonic, "k=5410.2978 eq=1.3568"}, 5.0e-5); + testSpeciesIntramolecular(&species, {0, 1}, {BondFunctions::Form::Harmonic, "k=2991.0611 eq=1.08142"}, 5.0e-5); + testSpeciesIntramolecular(&species, {2, 4}, {BondFunctions::Form::Harmonic, "k=4432.3881 eq=1.45007"}, 5.0e-5); + testSpeciesIntramolecular(&species, {1, 2, 4}, {AngleFunctions::Form::Cos2, "882.7151 0.5 0.666667 0.333333"}, 5.0e-5); + testSpeciesIntramolecular(&species, {3, 1, 2}, {AngleFunctions::Form::Cos2, "1590.3058 0.5 0.6667 0.3333"}, 5.0e-5); + testSpeciesIntramolecular(&species, {8, 4, 7}, {AngleFunctions::Form::Cos2, "315.8868 0.343737 0.37492 0.281246"}, 6.0e-5); + testSpeciesIntramolecular(&species, {0, 1, 2, 4}, {TorsionFunctions::Form::UFFCosine, "101.9308 2 180"}, 2.0e-5); + testSpeciesIntramolecular(&species, {1, 0, 2, 3}, {TorsionFunctions::Form::FourierN, "209.2 1 -1 0"}); + testSpeciesIntramolecular(&species, {2, 5, 1, 4}, {TorsionFunctions::Form::FourierN, "25.104 1 -1 0"}); } }; // namespace UnitTest diff --git a/tests/ff/assignment-UFF4MOF-mof5.cpp b/tests/ff/assignment-UFF4MOF-mof5.cpp index 239c223c90..ec1f930f55 100644 --- a/tests/ff/assignment-UFF4MOF-mof5.cpp +++ b/tests/ff/assignment-UFF4MOF-mof5.cpp @@ -2,15 +2,13 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "data/ff/library.h" -#include "tests/graphData.h" -#include "tests/testData.h" -#include +#include "nodes/species.h" +#include "tests/testGraph.h" namespace UnitTest { TEST(UFF4MOFMOF5AssignmentTest, MOF5) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *importNode = testGraph.createNode("ImportXYZStructure"); ASSERT_TRUE(importNode); @@ -40,32 +38,29 @@ TEST(UFF4MOFMOF5AssignmentTest, MOF5) ASSERT_EQ(species.torsions().size(), 1536); ASSERT_EQ(species.impropers().size(), 192); - systemTest.checkSpeciesAtomType(&species, {{0, "Zn3f2"}, - {1, "Zn3f2"}, - {26, "Zn3f2"}, - {29, "Zn3f2"}, - {32, "O_f_3"}, - {71, "O_m_2"}, - {112, "O_m_2"}, - {117, "O_m_2"}, - {121, "O_m_2"}, - {133, "O_m_2"}, - {122, "O_m_2"}, - {156, "C_R"}, - {178, "C_R"}, - {226, "C_R"}, - {290, "C_R"}, - {386, "H_"}}); - systemTest.checkSpeciesIntramolecular(&species, {386, 290}, {BondFunctions::Form::Harmonic, "k=2991.0611 eq=1.08142"}, - 1.0e-5); - systemTest.checkSpeciesIntramolecular(&species, {0, 32}, {BondFunctions::Form::Harmonic, "k=1337.872 eq=1.84185"}, 3.0e-5); - systemTest.checkSpeciesIntramolecular(&species, {8, 32}, {BondFunctions::Form::Harmonic, "k=1337.872 eq=1.84185"}, 1.0e-5); - systemTest.checkSpeciesIntramolecular(&species, {71, 156}, {BondFunctions::Form::Harmonic, "k=5048.4039 eq=1.34262"}, - 5.0e-6); - systemTest.checkSpeciesIntramolecular(&species, {178, 122, 26}, {AngleFunctions::Form::Cosine, "53.5872 3 0 -1"}, 3.0e-5); - systemTest.checkSpeciesIntramolecular(&species, {121, 29, 112}, {AngleFunctions::Form::Cosine, "107.58286 3 0 -1"}, 6.0e-6); - systemTest.checkSpeciesIntramolecular(&species, {178, 122, 26, 117}, {TorsionFunctions::Form::UFFCosine, "96.4708 2 180"}, - 5.0e-5); - systemTest.checkSpeciesIntramolecular(&species, {178, 122, 133, 226}, {TorsionFunctions::Form::FourierN, "25.104 1 -1 0"}); + testSpeciesAtomType(&species, {{0, "Zn3f2"}, + {1, "Zn3f2"}, + {26, "Zn3f2"}, + {29, "Zn3f2"}, + {32, "O_f_3"}, + {71, "O_m_2"}, + {112, "O_m_2"}, + {117, "O_m_2"}, + {121, "O_m_2"}, + {133, "O_m_2"}, + {122, "O_m_2"}, + {156, "C_R"}, + {178, "C_R"}, + {226, "C_R"}, + {290, "C_R"}, + {386, "H_"}}); + testSpeciesIntramolecular(&species, {386, 290}, {BondFunctions::Form::Harmonic, "k=2991.0611 eq=1.08142"}, 1.0e-5); + testSpeciesIntramolecular(&species, {0, 32}, {BondFunctions::Form::Harmonic, "k=1337.872 eq=1.84185"}, 3.0e-5); + testSpeciesIntramolecular(&species, {8, 32}, {BondFunctions::Form::Harmonic, "k=1337.872 eq=1.84185"}, 1.0e-5); + testSpeciesIntramolecular(&species, {71, 156}, {BondFunctions::Form::Harmonic, "k=5048.4039 eq=1.34262"}, 5.0e-6); + testSpeciesIntramolecular(&species, {178, 122, 26}, {AngleFunctions::Form::Cosine, "53.5872 3 0 -1"}, 3.0e-5); + testSpeciesIntramolecular(&species, {121, 29, 112}, {AngleFunctions::Form::Cosine, "107.58286 3 0 -1"}, 6.0e-6); + testSpeciesIntramolecular(&species, {178, 122, 26, 117}, {TorsionFunctions::Form::UFFCosine, "96.4708 2 180"}, 5.0e-5); + testSpeciesIntramolecular(&species, {178, 122, 133, 226}, {TorsionFunctions::Form::FourierN, "25.104 1 -1 0"}); } }; // namespace UnitTest diff --git a/tests/ff/benzene.cpp b/tests/ff/benzene.cpp index 94a2c0bdf7..377bb590d6 100644 --- a/tests/ff/benzene.cpp +++ b/tests/ff/benzene.cpp @@ -1,11 +1,11 @@ // SPDX-License-Identifier: GPL-3.0-or-later // Copyright (c) 2026 Team Dissolve and contributors +#include "kernels/energy.h" #include "kernels/force.h" #include "nodes/dissolve.h" -#include "tests/graphData.h" -#include "tests/testData.h" -#include +#include "nodes/species.h" +#include "tests/testGraph.h" namespace UnitTest { @@ -58,7 +58,7 @@ TEST_F(BenzeneForcefieldTest, Energies) auto kernel = testGraph_.createEnergyKernel(configuration_); // Check consistency between production and test energies - auto productionEnergy = checkEnergyConsistency(kernel); + auto productionEnergy = testEnergyConsistency(kernel); // Interatomic energy: -1334.653 LJ + 182.307 correction + 561.2389 Coulomb EXPECT_NEAR(-1334.653 + 182.307 + 561.2389, productionEnergy.pairPotential.total(), 4.0e-2); @@ -79,11 +79,11 @@ TEST_F(BenzeneForcefieldTest, ForcesFull) // Check consistency between production and test forces std::vector pairPotentialForces, geometryForces; - checkForceConsistency(kernel, pairPotentialForces, geometryForces); + testForceConsistency(kernel, pairPotentialForces, geometryForces); // Check agreement with external reference total forces - checkReferenceForceConsistency(pairPotentialForces, geometryForces, - importNode_->getOutputValue>("Forces"), 0.12); + testReferenceForceConsistency(pairPotentialForces, geometryForces, + importNode_->getOutputValue>("Forces"), 0.12); } TEST_F(BenzeneForcefieldTest, ForcesIntra) @@ -95,12 +95,12 @@ TEST_F(BenzeneForcefieldTest, ForcesIntra) // Check consistency between production and test forces std::vector pairPotentialForces, geometryForces; - checkForceConsistency(kernel, pairPotentialForces, geometryForces); + testForceConsistency(kernel, pairPotentialForces, geometryForces); std::vector zeroForces(pairPotentialForces.size()); // Check agreement with external reference total forces - checkReferenceForceConsistency(zeroForces, geometryForces, importNode_->getOutputValue>("Forces"), - 1.0e-2); + testReferenceForceConsistency(zeroForces, geometryForces, importNode_->getOutputValue>("Forces"), + 1.0e-2); } TEST_F(BenzeneForcefieldTest, ForcesVDW) @@ -116,12 +116,12 @@ TEST_F(BenzeneForcefieldTest, ForcesVDW) // Check consistency between production and test forces std::vector pairPotentialForces, geometryForces; - checkForceConsistency(kernel, pairPotentialForces, geometryForces); + testForceConsistency(kernel, pairPotentialForces, geometryForces); std::vector zeroForces(pairPotentialForces.size()); // Check agreement with external reference total forces - checkReferenceForceConsistency(pairPotentialForces, zeroForces, importNode_->getOutputValue>("Forces"), - 0.12); + testReferenceForceConsistency(pairPotentialForces, zeroForces, importNode_->getOutputValue>("Forces"), + 0.12); } TEST_F(BenzeneForcefieldTest, ForcesElectrostatics) @@ -137,11 +137,11 @@ TEST_F(BenzeneForcefieldTest, ForcesElectrostatics) // Check consistency between production and test forces std::vector pairPotentialForces, geometryForces; - checkForceConsistency(kernel, pairPotentialForces, geometryForces); + testForceConsistency(kernel, pairPotentialForces, geometryForces); std::vector zeroForces(pairPotentialForces.size()); // Check agreement with external reference total forces - checkReferenceForceConsistency(pairPotentialForces, zeroForces, importNode_->getOutputValue>("Forces"), - 3.0e-4); + testReferenceForceConsistency(pairPotentialForces, zeroForces, importNode_->getOutputValue>("Forces"), + 3.0e-4); } } // namespace UnitTest \ No newline at end of file diff --git a/tests/ff/cos-n.cpp b/tests/ff/cos-n.cpp index 60f39f7770..51b1005668 100644 --- a/tests/ff/cos-n.cpp +++ b/tests/ff/cos-n.cpp @@ -2,10 +2,10 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "data/ff/library.h" -#include "tests/graphData.h" +#include "kernels/energy.h" +#include "kernels/force.h" #include "tests/tempFile.h" -#include "tests/testData.h" -#include +#include "tests/testGraph.h" namespace UnitTest { @@ -29,7 +29,7 @@ TEST(CosNTorsionEnergyTest, POE) auto kernel = testGraph.createEnergyKernel(cfg); // Check consistency between production and test energies - auto productionEnergy = checkEnergyConsistency(kernel); + auto productionEnergy = testEnergyConsistency(kernel); // Intramolecular energy: 183.4801 # (2.866876 per molecule) * 64 molecules EXPECT_NEAR(183.4801, productionEnergy.geometry.torsionEnergy, 1.0e-2); @@ -57,11 +57,11 @@ TEST(CosNTorsionForcesTest, POE) // Check consistency between production and test forces std::vector pairPotentialForces, geometryForces; - checkForceConsistency(kernel, pairPotentialForces, geometryForces); + testForceConsistency(kernel, pairPotentialForces, geometryForces); // Check agreement with external reference forces - checkReferenceForceConsistency(pairPotentialForces, geometryForces, - importNode->getOutputValue>("Forces"), 6.0e-2); + testReferenceForceConsistency(pairPotentialForces, geometryForces, + importNode->getOutputValue>("Forces"), 6.0e-2); } TEST(CosNTorsionEnergyTest, Py4OHNTf2) @@ -84,7 +84,7 @@ TEST(CosNTorsionEnergyTest, Py4OHNTf2) auto kernel = testGraph.createEnergyKernel(cfg); // Check consistency between production and test energies - auto productionEnergy = checkEnergyConsistency(kernel); + auto productionEnergy = testEnergyConsistency(kernel); // Intramolecular energy: 51.050222 # (25.525111 per molecule) * 2 molecules EXPECT_NEAR(51.050222, productionEnergy.geometry.torsionEnergy, 2.0e-5); @@ -113,11 +113,11 @@ TEST(CosNTorsionForcesTest, Py4OHNTf2) // Check consistency between production and test forces std::vector pairPotentialForces, geometryForces; - checkForceConsistency(kernel, pairPotentialForces, geometryForces); + testForceConsistency(kernel, pairPotentialForces, geometryForces); // Check agreement with external reference forces - checkReferenceForceConsistency(pairPotentialForces, geometryForces, - importNode->getOutputValue>("Forces"), 9.0e-3); + testReferenceForceConsistency(pairPotentialForces, geometryForces, + importNode->getOutputValue>("Forces"), 9.0e-3); } TEST(CosNImproperEnergyTest, Py4OHNTf2) @@ -140,7 +140,7 @@ TEST(CosNImproperEnergyTest, Py4OHNTf2) auto kernel = testGraph.createEnergyKernel(cfg); // Check consistency between production and test energies - auto productionEnergy = checkEnergyConsistency(kernel); + auto productionEnergy = testEnergyConsistency(kernel); // Intramolecular energy: 0.055228 # (0.027614 per molecule) * 2 molecules EXPECT_NEAR(0.055228, productionEnergy.geometry.improperEnergy, 1.0e-6); @@ -169,11 +169,11 @@ TEST(CosNImproperForcesTest, Py4OHNTf2) // Check consistency between production and test forces std::vector pairPotentialForces, geometryForces; - checkForceConsistency(kernel, pairPotentialForces, geometryForces); + testForceConsistency(kernel, pairPotentialForces, geometryForces); // Check agreement with external reference forces - checkReferenceForceConsistency(pairPotentialForces, geometryForces, - importNode->getOutputValue>("Forces"), 7.0e-2); + testReferenceForceConsistency(pairPotentialForces, geometryForces, + importNode->getOutputValue>("Forces"), 7.0e-2); } TEST(CosNTorsionEnergyTest, Py5NTf2) @@ -196,7 +196,7 @@ TEST(CosNTorsionEnergyTest, Py5NTf2) auto kernel = testGraph.createEnergyKernel(cfg); // Check consistency between production and test energies - auto productionEnergy = checkEnergyConsistency(kernel); + auto productionEnergy = testEnergyConsistency(kernel); // Intramolecular energy: 39.29711 # (19.648555 per molecule) * 2 molecules EXPECT_NEAR(39.29711, productionEnergy.geometry.torsionEnergy, 5.0e-5); @@ -225,11 +225,11 @@ TEST(CosNTorsionForcesTest, Py5NTf2) // Check consistency between production and test forces std::vector pairPotentialForces, geometryForces; - checkForceConsistency(kernel, pairPotentialForces, geometryForces); + testForceConsistency(kernel, pairPotentialForces, geometryForces); // Check agreement with external reference forces - checkReferenceForceConsistency(pairPotentialForces, geometryForces, - importNode->getOutputValue>("Forces"), 9.0e-2); + testReferenceForceConsistency(pairPotentialForces, geometryForces, + importNode->getOutputValue>("Forces"), 9.0e-2); } TEST(CosNImproperEnergyTest, Py5NTf2) @@ -252,7 +252,7 @@ TEST(CosNImproperEnergyTest, Py5NTf2) auto kernel = testGraph.createEnergyKernel(cfg); // Check consistency between production and test energies - auto productionEnergy = checkEnergyConsistency(kernel); + auto productionEnergy = testEnergyConsistency(kernel); // Intramolecular energy: 0.34961 # (0.174805 per molecule) * 2 molecules EXPECT_NEAR(0.34961, productionEnergy.geometry.improperEnergy, 2.0e-6); @@ -281,11 +281,11 @@ TEST(CosNImproperForcesTest, Py5NTf2) // Check consistency between production and test forces std::vector pairPotentialForces, geometryForces; - checkForceConsistency(kernel, pairPotentialForces, geometryForces); + testForceConsistency(kernel, pairPotentialForces, geometryForces); // Check agreement with external reference forces - checkReferenceForceConsistency(pairPotentialForces, geometryForces, - importNode->getOutputValue>("Forces"), 4.0e-3); + testReferenceForceConsistency(pairPotentialForces, geometryForces, + importNode->getOutputValue>("Forces"), 4.0e-3); } } // namespace UnitTest diff --git a/tests/ff/hexane.cpp b/tests/ff/hexane.cpp index b6df57a7d3..6b12dc15df 100644 --- a/tests/ff/hexane.cpp +++ b/tests/ff/hexane.cpp @@ -1,11 +1,11 @@ // SPDX-License-Identifier: GPL-3.0-or-later // Copyright (c) 2026 Team Dissolve and contributors +#include "kernels/energy.h" #include "kernels/force.h" #include "nodes/dissolve.h" -#include "tests/graphData.h" -#include "tests/testData.h" -#include +#include "nodes/species.h" +#include "tests/testGraph.h" namespace UnitTest { @@ -51,7 +51,7 @@ TEST_F(HexaneForcefieldTest, Energies1) auto kernel = testGraph_.createEnergyKernel(configuration_); // Check consistency between production and test energies - auto productionEnergy = checkEnergyConsistency(kernel); + auto productionEnergy = testEnergyConsistency(kernel); // Interatomic energy: 3.504968 LJ + 0.00501830 correction + 10.8152 Coulomb EXPECT_NEAR(3.504968 + 0.00501830 + 10.8152, productionEnergy.pairPotential.total(), 2.0e-4); @@ -72,11 +72,11 @@ TEST_F(HexaneForcefieldTest, Forces1) // Check consistency between production and test forces std::vector pairPotentialForces, geometryForces; - checkForceConsistency(kernel, pairPotentialForces, geometryForces); + testForceConsistency(kernel, pairPotentialForces, geometryForces); // Check agreement with external reference total forces - checkReferenceForceConsistency(pairPotentialForces, geometryForces, - importNode_->getOutputValue>("Forces"), 3.0e-2); + testReferenceForceConsistency(pairPotentialForces, geometryForces, + importNode_->getOutputValue>("Forces"), 3.0e-2); } TEST_F(HexaneForcefieldTest, Energies2) @@ -87,7 +87,7 @@ TEST_F(HexaneForcefieldTest, Energies2) auto kernel = testGraph_.createEnergyKernel(configuration_); // Check consistency between production and test energies - auto productionEnergy = checkEnergyConsistency(kernel); + auto productionEnergy = testEnergyConsistency(kernel); // Interatomic energy: 5.200344 LJ + 0.0200732 correction + 21.52276 Coulomb EXPECT_NEAR(5.200344 + 0.0200732 + 21.52276, productionEnergy.pairPotential.total(), 3.0e-4); @@ -108,11 +108,11 @@ TEST_F(HexaneForcefieldTest, Forces2) // Check consistency between production and test forces std::vector pairPotentialForces, geometryForces; - checkForceConsistency(kernel, pairPotentialForces, geometryForces); + testForceConsistency(kernel, pairPotentialForces, geometryForces); // Check agreement with external reference total forces - checkReferenceForceConsistency(pairPotentialForces, geometryForces, - importNode_->getOutputValue>("Forces"), 3.0e-2); + testReferenceForceConsistency(pairPotentialForces, geometryForces, + importNode_->getOutputValue>("Forces"), 3.0e-2); } TEST_F(HexaneForcefieldTest, Energies200) @@ -123,7 +123,7 @@ TEST_F(HexaneForcefieldTest, Energies200) auto kernel = testGraph_.createEnergyKernel(configuration_); // Check consistency between production and test energies - auto productionEnergy = checkEnergyConsistency(kernel); + auto productionEnergy = testEnergyConsistency(kernel); // Interatomic energy: -5124.720 LJ + 200.732 correction + 2020.063 Coulomb EXPECT_NEAR(-5124.720 + 200.732 + 2020.063, productionEnergy.pairPotential.total(), 5.0e-2); @@ -144,11 +144,11 @@ TEST_F(HexaneForcefieldTest, Forces200Full) // Check consistency between production and test forces std::vector pairPotentialForces, geometryForces; - checkForceConsistency(kernel, pairPotentialForces, geometryForces); + testForceConsistency(kernel, pairPotentialForces, geometryForces); // Check agreement with external reference total forces - checkReferenceForceConsistency(pairPotentialForces, geometryForces, - importNode_->getOutputValue>("Forces"), 0.2); + testReferenceForceConsistency(pairPotentialForces, geometryForces, + importNode_->getOutputValue>("Forces"), 0.2); } TEST_F(HexaneForcefieldTest, Forces200Bound) @@ -160,12 +160,12 @@ TEST_F(HexaneForcefieldTest, Forces200Bound) // Check consistency between production and test forces std::vector pairPotentialForces, geometryForces; - checkForceConsistency(kernel, pairPotentialForces, geometryForces); + testForceConsistency(kernel, pairPotentialForces, geometryForces); std::vector zeroForces(pairPotentialForces.size()); // Check agreement with external reference total bound forces only - checkReferenceForceConsistency(zeroForces, geometryForces, importNode_->getOutputValue>("Forces"), - 1.0e-7); + testReferenceForceConsistency(zeroForces, geometryForces, importNode_->getOutputValue>("Forces"), + 1.0e-7); } TEST_F(HexaneForcefieldTest, Forces200Unbound) @@ -177,11 +177,11 @@ TEST_F(HexaneForcefieldTest, Forces200Unbound) // Check consistency between production and test forces std::vector pairPotentialForces, geometryForces; - checkForceConsistency(kernel, pairPotentialForces, geometryForces); + testForceConsistency(kernel, pairPotentialForces, geometryForces); std::vector zeroForces(pairPotentialForces.size()); // Check agreement with external reference total pair potential forces only - checkReferenceForceConsistency(pairPotentialForces, zeroForces, importNode_->getOutputValue>("Forces"), - 0.2); + testReferenceForceConsistency(pairPotentialForces, zeroForces, importNode_->getOutputValue>("Forces"), + 0.2); } } // namespace UnitTest \ No newline at end of file diff --git a/tests/ff/water-1000.cpp b/tests/ff/water-1000.cpp index f05341bcff..6fac9b6cb2 100644 --- a/tests/ff/water-1000.cpp +++ b/tests/ff/water-1000.cpp @@ -1,11 +1,10 @@ // SPDX-License-Identifier: GPL-3.0-or-later // Copyright (c) 2026 Team Dissolve and contributors +#include "kernels/energy.h" #include "kernels/force.h" -#include "nodes/dissolve.h" -#include "tests/graphData.h" -#include "tests/testData.h" -#include +#include "nodes/species.h" +#include "tests/testGraph.h" namespace UnitTest { @@ -29,7 +28,7 @@ TEST(Water1000EnergyTest, Full) auto kernel = testGraph.createEnergyKernel(cfg); // Check consistency between production and test energies - auto productionEnergy = checkEnergyConsistency(kernel); + auto productionEnergy = testEnergyConsistency(kernel); // Interatomic energy: 1716.032 LJ + 54.1342 correction + -29163.384451743802 Coulomb EXPECT_NEAR(1716.032 + 54.1342 - 29163.384451743802, productionEnergy.pairPotential.interMolecular, 4.3e-2); @@ -63,11 +62,11 @@ TEST(Water1000ForceTest, Full) // Check consistency between production and test forces std::vector pairPotentialForces, geometryForces; - checkForceConsistency(kernel, pairPotentialForces, geometryForces); + testForceConsistency(kernel, pairPotentialForces, geometryForces); // Check agreement with external reference total forces - checkReferenceForceConsistency(pairPotentialForces, geometryForces, - importNode->getOutputValue>("Forces"), 1.9); + testReferenceForceConsistency(pairPotentialForces, geometryForces, + importNode->getOutputValue>("Forces"), 1.9); } TEST(Water1000ForceTest, Intra) @@ -93,11 +92,11 @@ TEST(Water1000ForceTest, Intra) // Check consistency between production and test forces std::vector pairPotentialForces, geometryForces; - checkForceConsistency(kernel, pairPotentialForces, geometryForces); + testForceConsistency(kernel, pairPotentialForces, geometryForces); // Check agreement with external reference total forces std::vector noPP(geometryForces.size()); - checkReferenceForceConsistency(noPP, geometryForces, importNode->getOutputValue>("Forces"), 1.9); + testReferenceForceConsistency(noPP, geometryForces, importNode->getOutputValue>("Forces"), 1.9); } TEST(Water1000EnergyTest, ShortRangeOnly) @@ -130,7 +129,7 @@ TEST(Water1000EnergyTest, ShortRangeOnly) auto kernel = testGraph.createEnergyKernel(cfg); // Check consistency between production and test energies - auto productionEnergy = checkEnergyConsistency(kernel); + auto productionEnergy = testEnergyConsistency(kernel); // Interatomic energy: 1716.032 LJ + 54.1342 correction EXPECT_NEAR(1716.032 + 54.1342, productionEnergy.pairPotential.interMolecular, 4.3e-2); @@ -169,11 +168,11 @@ TEST(Water1000ForceTest, ShortRangeOnly) // Check consistency between production and test forces std::vector pairPotentialForces, geometryForces; - checkForceConsistency(kernel, pairPotentialForces, geometryForces, {Kernel::CalculationFlags::ExcludeGeometric}); + testForceConsistency(kernel, pairPotentialForces, geometryForces, {Kernel::CalculationFlags::ExcludeGeometric}); // Check agreement with external reference forces - checkReferenceForceConsistency(pairPotentialForces, geometryForces, - importNode->getOutputValue>("Forces"), 1.6e-1); + testReferenceForceConsistency(pairPotentialForces, geometryForces, + importNode->getOutputValue>("Forces"), 1.6e-1); } TEST(Water1000EnergyTest, ShiftedCoulombOnly) @@ -203,7 +202,7 @@ TEST(Water1000EnergyTest, ShiftedCoulombOnly) auto kernel = testGraph.createEnergyKernel(cfg); // Check consistency between production and test energies - auto productionEnergy = checkEnergyConsistency(kernel); + auto productionEnergy = testEnergyConsistency(kernel); // Interatomic energy: -29163.384451743802 Coulomb EXPECT_NEAR(-29163.384451743802, productionEnergy.pairPotential.interMolecular, 4.3e-2); @@ -239,11 +238,11 @@ TEST(Water1000ForceTest, CoulombOnly) // Check consistency between production and test forces std::vector pairPotentialForces, geometryForces; - checkForceConsistency(kernel, pairPotentialForces, geometryForces, {Kernel::CalculationFlags::ExcludeGeometric}); + testForceConsistency(kernel, pairPotentialForces, geometryForces, {Kernel::CalculationFlags::ExcludeGeometric}); // Check agreement with external reference forces - checkReferenceForceConsistency(pairPotentialForces, geometryForces, - importNode->getOutputValue>("Forces"), 1.6e-1); + testReferenceForceConsistency(pairPotentialForces, geometryForces, + importNode->getOutputValue>("Forces"), 1.6e-1); } TEST(Water1000ForceTest, ShiftedCoulombOnly) @@ -276,11 +275,11 @@ TEST(Water1000ForceTest, ShiftedCoulombOnly) // Check consistency between production and test forces std::vector pairPotentialForces, geometryForces; - checkForceConsistency(kernel, pairPotentialForces, geometryForces, {Kernel::CalculationFlags::ExcludeGeometric}); + testForceConsistency(kernel, pairPotentialForces, geometryForces, {Kernel::CalculationFlags::ExcludeGeometric}); // Check agreement with external reference forces - checkReferenceForceConsistency(pairPotentialForces, geometryForces, - importNode->getOutputValue>("Forces"), 1.6e-1); + testReferenceForceConsistency(pairPotentialForces, geometryForces, + importNode->getOutputValue>("Forces"), 1.6e-1); } TEST(Water1000EnergyTest, Override) { @@ -360,7 +359,7 @@ TEST(Water1000ForceTest, Overrides) kernel->totalForces(pairPotentialForces, geometryForces, {Kernel::CalculationFlags::ExcludeGeometric}); // Check agreement with external reference forces - checkReferenceForceConsistency(pairPotentialForces, geometryForces, - importNode->getOutputValue>("Forces"), 1.6e-1); + testReferenceForceConsistency(pairPotentialForces, geometryForces, + importNode->getOutputValue>("Forces"), 1.6e-1); } } // namespace UnitTest diff --git a/tests/generator/procedure.cpp b/tests/generator/procedure.cpp index 912a6b5d9d..b7cdf99007 100644 --- a/tests/generator/procedure.cpp +++ b/tests/generator/procedure.cpp @@ -7,7 +7,6 @@ #include "generator/parameters.h" #include "generator/select.h" #include "keywords/node.h" -#include #include namespace UnitTest diff --git a/tests/generator/rotateFragment.cpp b/tests/generator/rotateFragment.cpp index 2582612777..df5d403c57 100644 --- a/tests/generator/rotateFragment.cpp +++ b/tests/generator/rotateFragment.cpp @@ -9,8 +9,6 @@ #include "generator/generator.h" #include "generator/select.h" #include "main/dissolve.h" -#include "tests/testData.h" -#include #include namespace UnitTest diff --git a/tests/generator/select.cpp b/tests/generator/select.cpp index dd7227f832..5ef06a12e3 100644 --- a/tests/generator/select.cpp +++ b/tests/generator/select.cpp @@ -6,8 +6,6 @@ #include "data/ff/library.h" #include "generator/generator.h" #include "main/dissolve.h" -#include "tests/testData.h" -#include #include namespace UnitTest diff --git a/tests/graphData.h b/tests/graphData.h deleted file mode 100644 index 8a551f23e5..0000000000 --- a/tests/graphData.h +++ /dev/null @@ -1,363 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2026 Team Dissolve and contributors - -#pragma once - -#include "classes/isotopologueSet.h" -#include "data/structureFactors.h" -#include "main/dissolve.h" -#include "nodes/bragg.h" -#include "nodes/configuration.h" -#include "nodes/dissolve.h" -#include "nodes/forcefield.h" -#include "nodes/gr.h" -#include "nodes/insert.h" -#include "nodes/iterableGraph.h" -#include "nodes/neutronSQ.h" -#include "nodes/setCoordinates.h" -#include "nodes/species.h" -#include "nodes/sq.h" -#include "nodes/xRaySQ.h" -#include - -namespace UnitTest -{ -// Basic object setup for any Graph-based test -class TestGraph : public DissolveGraph -{ - public: - TestGraph() : currentGraph_(this) - { - setEcho(true); - PairPotential::setChargeSource(PairPotential::ChargeSource::Automatic); - } - ~TestGraph() { exportMermaidGraph(); } - - public: - // Container for data 1D import filename and whether or not it is a histogram - struct Data1DImportFileFormat - { - std::string filename; - bool histogram; - - Data1DImportFileFormat(std::string filename = "", bool histogram = false) : filename(filename), histogram(histogram) {} - }; - - private: - // Current graph target - Graph *currentGraph_{nullptr}; - // Most recently appended node in the current graph - Node *head_{nullptr}; - - /* - * Graph Creation Helpers - */ - public: - // Returns pointer to current top node in graph - Node *fetchHead() const { return head_; } - // Returns the name of the current head node in the graph - std::string fetchHeadName() const { return head_ ? std::string(head_->name()) : "NO_NODE"; } - // Returns reference to current top node in graph, cast to the known node type - template NodeType *head() const { return static_cast(head_); } - // Append new node to the graph - Node *appendNode(const std::string &nodeType, const std::optional &name = {}) - { - auto node = name.has_value() ? currentGraph_->createNode(nodeType, *name) : currentGraph_->createNode(nodeType); - - if (!node) - return nullptr; - - head_ = node; - - return node; - } - // Create species insertion node chain - Node *createAndInsertSpecies(Node *cfgSourceNode, std::string cfgSourceOutput, - const std::vector> &species, double rho, - Units::DensityUnits rhoUnits = Units::DensityUnits::AtomsPerAngstromUnits, - InsertNode::BoxActionStyle boxActionStyle = InsertNode::BoxActionStyle::AddVolume) - { - // Add Species and Insert nodes - for (auto &[speciesString, population] : species) - { - // Create the species node and get the species pointer - std::unique_ptr speciesUnique; - if (speciesString.ends_with(".toml")) - speciesUnique = loadTOMLSpecies(speciesString); - else - { - if (speciesString.find('|') == std::string::npos) - speciesUnique = - createAtomicSpecies(Elements::element(speciesString), {ShortRangeFunctions::Form::Undefined}); - else - speciesUnique = createAtomicSpecies( - Elements::element(DissolveSys::beforeChar(speciesString, '|')), - {ShortRangeFunctions::Form::LennardJones, DissolveSys::afterChar(speciesString, '|')}); - } - EXPECT_TRUE(speciesUnique); - auto &speciesNode = speciesUnique->species(); - - // Move the species node into the graph - currentGraph_->addNode(std::move(speciesUnique), speciesNode.name()); - - auto insertNodeName = std::format("Insert-{}", speciesNode.name()); - EXPECT_TRUE(appendNode("Insert", insertNodeName)); - EXPECT_TRUE(fetchHead()->setInput("Population", population)); - EXPECT_TRUE(fetchHead()->setInput("Density", rho)); - EXPECT_TRUE(fetchHead()->setOption("BoxAction", boxActionStyle)); - EXPECT_TRUE(fetchHead()->setOption("DensityUnits", rhoUnits)); - EXPECT_TRUE(currentGraph_->addEdge({std::string(speciesNode.name()), "Species", insertNodeName, "Species"})); - EXPECT_TRUE( - currentGraph_->addEdge({std::string(cfgSourceNode->name()), cfgSourceOutput, insertNodeName, "Configuration"})); - - cfgSourceNode = fetchHead(); - - // After the first InsertNode addition the source output name reverts to "Configuration" (it may previously have - // been Output from SetBox) - cfgSourceOutput = "Configuration"; - } - - return fetchHead(); - } - - public: - // Create and return atomic SpeciesNode - static std::unique_ptr createAtomicSpecies(Elements::Element element, - InteractionPotential potential = { - ShortRangeFunctions::Form::Undefined, ""}) - { - // Add species node - auto speciesNodeUniquePtr = std::make_unique(nullptr); - auto speciesNodePtr = speciesNodeUniquePtr.get(); - auto species = &speciesNodePtr->species(); - species->setName(Elements::symbol(element)); - species->createAtomic(element, potential); - - return speciesNodeUniquePtr; - } - // Create species from TOML file - static std::unique_ptr loadTOMLSpecies(std::string_view path) - { - // Add species node - auto speciesNodeUniquePtr = std::make_unique(nullptr); - auto speciesNodePtr = speciesNodeUniquePtr.get(); - auto &species = speciesNodePtr->species(); - species.load(path); - - return speciesNodeUniquePtr; - } - // Create a species node with structure and forcefield data sources - SpeciesNode *createSpeciesFromStructureAndForcefield(std::string name, std::string structureNodeType, - std::string structureFilePath, std::shared_ptr ff, - bool calculateBonding = true) - { - // Add species node - auto speciesNodeUniquePtr = std::make_unique(nullptr); - EXPECT_TRUE(speciesNodeUniquePtr); - auto speciesNodePtr = speciesNodeUniquePtr.get(); - EXPECT_TRUE(speciesNodePtr); - auto &species = speciesNodePtr->species(); - species.setName(name); - currentGraph_->addNode(std::move(speciesNodeUniquePtr), name); - - // Create structure import node - auto structureNode = createNode(structureNodeType); - EXPECT_TRUE(structureNode); - structureNode->setOption("FilePath", structureFilePath); - - // Create rebonding node? - if (calculateBonding) - { - auto calculateBondingNode = createNode("CalculateBonding"); - EXPECT_TRUE(calculateBondingNode); - EXPECT_TRUE(currentGraph_->addEdge({structureNodeType, "Structure", "CalculateBonding", "Structure"})); - EXPECT_TRUE(currentGraph_->addEdge({"CalculateBonding", "Structure", name, "Structure"})); - } - else - EXPECT_TRUE(currentGraph_->addEdge({structureNodeType, "Structure", name, "Structure"})); - - // Create forcefield node - auto forcefieldNode = dynamic_cast(createNode("Forcefield")); - EXPECT_TRUE(forcefieldNode); - EXPECT_TRUE(forcefieldNode->setOption("Forcefield", ff.get())); - EXPECT_TRUE(currentGraph_->addEdge({"Forcefield", "Recipe", name, "Recipe"})); - - return speciesNodePtr; - } - // Create basic configuration graph, returning the last node - Node *createConfiguration(std::string name, const std::vector> &species, double rho, - Units::DensityUnits rhoUnits = Units::DensityUnits::AtomsPerAngstromUnits) - { - // Create configuration - EXPECT_TRUE(appendNode("Configuration", name)); - - // Add Species and Insert nodes - return createAndInsertSpecies(fetchHead(), "Configuration", species, rho, rhoUnits, - InsertNode::BoxActionStyle::AddVolume); - } - // Create basic configuration graph, returning the last node - Node *createConfiguration(std::string name, const std::vector> &species, - const Vector3 &cellLengths, const Vector3 &cellAngles = {90.0, 90.0, 90.0}) - { - // Create configuration and SetBox nodes - EXPECT_TRUE(appendNode("Configuration", name)); - EXPECT_TRUE(appendNode("SetBox")); - fetchHead()->setOption("Lengths", cellLengths); - fetchHead()->setOption("Angles", cellAngles); - EXPECT_TRUE(currentGraph_->addEdge({name, "Configuration", "SetBox", "Input"})); - - // Add Species and Insert nodes - return createAndInsertSpecies(fetchHead(), "Output", species, 0.1, Units::DensityUnits::AtomsPerAngstromUnits, - InsertNode::BoxActionStyle::None); - } - // Append a set coordinates node with a structure import input - Node *appendSetCoordinates(std::string_view importNodeType, std::string filePath, - std::string sourceOutpuName = "Configuration") - { - const auto cfgSourceNode = fetchHead(); - - EXPECT_TRUE(appendNode("SetCoordinates")); - auto structureNode = createNode(importNodeType); - EXPECT_TRUE(structureNode); - EXPECT_TRUE(structureNode->setOption("FilePath", filePath)); - - EXPECT_TRUE(currentGraph_->addEdge({std::string(structureNode->name()), "Structure", "SetCoordinates", "Structure"})); - - EXPECT_TRUE( - currentGraph_->addEdge({std::string(cfgSourceNode->name()), sourceOutpuName, "SetCoordinates", "Configuration"})); - - return head(); - } - // Create a trajectory iterator subgraph - IterableGraph *appendTrajectoryIterator(std::string trajectoryImportNodeType, std::string filePath) - { - // Get current head node before we create the IterableGraph - auto oldHead = head_; - auto oldGraph = currentGraph_; - - // Add iterator node and make it the current graph - currentGraph_ = dynamic_cast(appendNode("Iterator", "Iterator")); - EXPECT_TRUE(currentGraph_); - head_ = nullptr; - - // Create a dynamic input from the (assumed) "Configuration" output on the old head of the previous graph - EXPECT_TRUE(oldGraph->addEdge({std::string(oldHead->name()), "Configuration", "Iterator", "Configuration"})); - - // Within the iterator graph create SetCoordinates and trajectory import nodes - auto trajectoryNode = appendNode(trajectoryImportNodeType); - EXPECT_TRUE(trajectoryNode); - EXPECT_TRUE(trajectoryNode->setOption("FilePath", filePath)); - EXPECT_TRUE(appendNode("SetCoordinates")); - - EXPECT_TRUE(currentGraph_->addEdge({std::string(trajectoryNode->name()), "Structure", "SetCoordinates", "Structure"})); - - EXPECT_TRUE(currentGraph_->addEdge({"Inputs", "Configuration", "SetCoordinates", "Configuration"})); - - return dynamic_cast(currentGraph_); - } - // Append GR and SQ nodes - std::pair appendGRSQ(bool noAveraging = false, bool noIntraBroadening = false) - { - // Create and setup the GR node - auto grNode = dynamic_cast(createNode("GR")); - EXPECT_TRUE(grNode); - if (noAveraging) - EXPECT_TRUE(grNode->setOption("Averaging", std::optional())); - if (noIntraBroadening) - EXPECT_TRUE(grNode->setOption("IntraBroadening", Function1DWrapper())); - - EXPECT_TRUE(currentGraph_->addEdge({std::string(fetchHead()->name()), "Configuration", "GR", "Configuration"})); - - // Create the SQ node - auto sqNode = dynamic_cast(createNode("SQ")); - EXPECT_TRUE(sqNode); - EXPECT_TRUE(currentGraph_->addEdge({"GR", "UnweightedGR", "SQ", "UnweightedGR"})); - - return {grNode, sqNode}; - } - // Create a NeutronSQ node with optional reference data - NeutronSQNode *appendNeutronSQ(SQNode *sqNode, std::string name, - const std::vector> isotopologues = {}, - TestGraph::Data1DImportFileFormat referenceData = TestGraph::Data1DImportFileFormat{}) - { - // Construct the isotopologue set - IsotopologueSet isotopologueSet; - for (auto &&[speciesName, isotopologueName, relativeWeight] : isotopologues) - { - // Find the named species node - auto speciesNode = dynamic_cast(findNode(speciesName)); - if (!speciesNode) - { - std::cout << std::format("No species named '{}' exists in the graph - can't construct IsotopologueSet\n", - speciesName); - return nullptr; - } - auto &species = speciesNode->species(); - auto isotopologue = species.findIsotopologue(isotopologueName); - if (!isotopologue) - { - std::cout << std::format( - "No isotopologue named '{}' exists in species '{}' - can't construct IsotopologueSet\n", isotopologueName, - speciesName); - return nullptr; - } - isotopologueSet.add(isotopologue, relativeWeight); - } - - EXPECT_TRUE(appendNode("NeutronSQ", name)); - EXPECT_TRUE(fetchHead()->setOption("Isotopologues", isotopologueSet)); - EXPECT_TRUE(currentGraph_->addEdge({std::string(sqNode->name()), "UnweightedGR", name, "UnweightedGR"})); - EXPECT_TRUE(currentGraph_->addEdge({std::string(sqNode->name()), "UnweightedSQ", name, "UnweightedSQ"})); - - // Set reference F(Q) data - if (!referenceData.filename.empty()) - { - auto data1DImportNode = createNode("ImportXYData", std::format("Reference-{}", name)); - EXPECT_TRUE(data1DImportNode); - EXPECT_TRUE(data1DImportNode->setOption("FilePath", std::string(referenceData.filename))); - EXPECT_TRUE(data1DImportNode->setOption("Histogram", referenceData.histogram)); - EXPECT_TRUE(currentGraph_->addEdge({std::format("Reference-{}", name), "Data", name, "ReferenceData"})); - } - - return head(); - } - // Create an XRaySQ node with optional reference data - XRaySQNode *appendXRaySQ(SQNode *sqNode, std::string name, - TestGraph::Data1DImportFileFormat referenceData = TestGraph::Data1DImportFileFormat{}) - { - EXPECT_TRUE(appendNode("XRaySQ", name)); - EXPECT_TRUE(currentGraph_->addEdge({std::string(sqNode->name()), "UnweightedGR", name, "UnweightedGR"})); - EXPECT_TRUE(currentGraph_->addEdge({std::string(sqNode->name()), "UnweightedSQ", name, "UnweightedSQ"})); - - // Set reference F(Q) data - if (!referenceData.filename.empty()) - { - auto data1DImportNode = createNode("ImportXYData", std::format("Reference-{}", name)); - EXPECT_TRUE(data1DImportNode); - EXPECT_TRUE(data1DImportNode->setOption("FilePath", std::string(referenceData.filename))); - EXPECT_TRUE(data1DImportNode->setOption("Histogram", referenceData.histogram)); - EXPECT_TRUE(currentGraph_->addEdge({std::format("Reference-{}", name), "Data", name, "ReferenceData"})); - } - return head(); - } - - /* - * Utility Functions - */ - public: - // Save the specified graph in Mermaid format to a file named after the unit test - static void exportMermaidGraph(Graph &graph) - { - auto suite = ::testing::UnitTest::GetInstance()->current_test_info()->test_suite_name(); - auto name = ::testing::UnitTest::GetInstance()->current_test_info()->name(); - std::string filename = std::format("{}-{}.mermaid", suite, name); - - std::ofstream myfile; - myfile.open(filename); - myfile << graph; - myfile.close(); - } - // Save the current graph in Mermaid format to a file named after the unit test - void exportMermaidGraph() { exportMermaidGraph(*this); } -}; -} // namespace UnitTest diff --git a/tests/gui/addForcefieldTerms.cpp b/tests/gui/addForcefieldTerms.cpp index c90652756f..2aba80f01b 100644 --- a/tests/gui/addForcefieldTerms.cpp +++ b/tests/gui/addForcefieldTerms.cpp @@ -3,10 +3,9 @@ #include "gui/models/addForcefieldDialogModel.h" #include "main/dissolve.h" -#include "tests/graphData.h" +#include "tests/testing.h" #include #include -#include namespace UnitTest { diff --git a/tests/gui/isotopologueSetModel.cpp b/tests/gui/isotopologueSetModel.cpp index 0cb35c607e..1c6bed3aea 100644 --- a/tests/gui/isotopologueSetModel.cpp +++ b/tests/gui/isotopologueSetModel.cpp @@ -3,8 +3,8 @@ #include "gui/models/isotopologueSetModel.h" #include "classes/isotopologueSet.h" -#include "tests/graphData.h" -#include +#include "classes/species.h" +#include "tests/testing.h" namespace UnitTest { diff --git a/tests/gui/masterTerms.cpp b/tests/gui/masterTerms.cpp index e2d217aac1..212993b403 100644 --- a/tests/gui/masterTerms.cpp +++ b/tests/gui/masterTerms.cpp @@ -8,7 +8,6 @@ #include "main/dissolve.h" #include #include -#include #include diff --git a/tests/gui/modifyCharges.cpp b/tests/gui/modifyCharges.cpp index 174d729bb9..b306e63fd6 100644 --- a/tests/gui/modifyCharges.cpp +++ b/tests/gui/modifyCharges.cpp @@ -4,7 +4,6 @@ #include "classes/species.h" #include "gui/models/modifyChargesModel.h" #include -#include #define NO_DISPLAY false diff --git a/tests/gui/optionalDoubleKeyword.cpp b/tests/gui/optionalDoubleKeyword.cpp index ee9a3d34f7..0b4c44db2e 100644 --- a/tests/gui/optionalDoubleKeyword.cpp +++ b/tests/gui/optionalDoubleKeyword.cpp @@ -3,7 +3,6 @@ #include "gui/keywordWidgets/optionalDouble.h" #include -#include namespace UnitTest { diff --git a/tests/gui/optionalIntegerKeyword.cpp b/tests/gui/optionalIntegerKeyword.cpp index b7400b7d6c..529f4bc5cb 100644 --- a/tests/gui/optionalIntegerKeyword.cpp +++ b/tests/gui/optionalIntegerKeyword.cpp @@ -3,7 +3,6 @@ #include "gui/keywordWidgets/optionalInt.h" #include -#include namespace UnitTest { diff --git a/tests/gui/speciesModel.cpp b/tests/gui/speciesModel.cpp index 6d602837cd..690d947406 100644 --- a/tests/gui/speciesModel.cpp +++ b/tests/gui/speciesModel.cpp @@ -5,7 +5,6 @@ #include "classes/bondFunctions.h" #include "data/elements.h" #include "gui/models/nodeGraph/graphModel.h" -#include namespace UnitTest { diff --git a/tests/gui/speciesTab.cpp b/tests/gui/speciesTab.cpp index 0d6b2778e0..4abfa06461 100644 --- a/tests/gui/speciesTab.cpp +++ b/tests/gui/speciesTab.cpp @@ -10,7 +10,6 @@ #include "gui/models/speciesTorsionModel.h" #include "main/dissolve.h" #include -#include #include Q_DECLARE_METATYPE(Sears91::Isotope); diff --git a/tests/math/data1D.cpp b/tests/math/data1D.cpp index 540a6dbfa0..5fc8333c79 100644 --- a/tests/math/data1D.cpp +++ b/tests/math/data1D.cpp @@ -2,8 +2,7 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "math/data1D.h" -#include "tests/testData.h" -#include +#include "tests/testing.h" namespace UnitTest { diff --git a/tests/math/histogram1D.cpp b/tests/math/histogram1D.cpp index 39b7549042..f08f97d57f 100644 --- a/tests/math/histogram1D.cpp +++ b/tests/math/histogram1D.cpp @@ -2,8 +2,7 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "math/histogram1D.h" -#include "tests/testData.h" -#include +#include "tests/testing.h" namespace UnitTest { diff --git a/tests/math/poisson.cpp b/tests/math/poisson.cpp index ded2ae54c0..59b8f98bee 100644 --- a/tests/math/poisson.cpp +++ b/tests/math/poisson.cpp @@ -2,8 +2,8 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "math/poissonFit.h" -#include "tests/testData.h" -#include +#include "nodes/importXYData.h" +#include "tests/testing.h" namespace UnitTest { @@ -40,8 +40,7 @@ void testReconstruction(std::string inpAFile, std::string delfitFile, PoissonFit coeffMinimiser(axisData); coeffMinimiser.constructReciprocal(0.0, 12.0, fitCoefficients, 0.01, 0.01, 0, 0.01, 0); - EXPECT_TRUE( - DissolveSystemTest::checkData1D(coeffMinimiser.approximation(), dataSet, delfitFile, 1, column, errorThreshold)); + EXPECT_TRUE(testData1D(coeffMinimiser.approximation(), dataSet, delfitFile, 1, column, errorThreshold)); } } diff --git a/tests/math/rangedVector3.cpp b/tests/math/rangedVector3.cpp index 2b826980e7..e7a21fc227 100644 --- a/tests/math/rangedVector3.cpp +++ b/tests/math/rangedVector3.cpp @@ -2,7 +2,6 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "math/rangedVector3.h" -#include "tests/testData.h" #include namespace UnitTest diff --git a/tests/math/regression.cpp b/tests/math/regression.cpp index 2d200c8db5..a00ce95996 100644 --- a/tests/math/regression.cpp +++ b/tests/math/regression.cpp @@ -2,7 +2,7 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "math/regression.h" -#include "tests/testData.h" +#include "math/data1D.h" #include namespace UnitTest diff --git a/tests/math/sampledValues.cpp b/tests/math/sampledValues.cpp index caffb832ce..90f16bd0ac 100644 --- a/tests/math/sampledValues.cpp +++ b/tests/math/sampledValues.cpp @@ -5,9 +5,8 @@ #include "math/sampledDouble.h" #include "math/sampledVector.h" #include "templates/algorithms.h" -#include "tests/testData.h" +#include "tests/testing.h" #include -#include #include namespace UnitTest diff --git a/tests/math/vector3.cpp b/tests/math/vector3.cpp index 9fdf2de794..9150631f0c 100644 --- a/tests/math/vector3.cpp +++ b/tests/math/vector3.cpp @@ -2,8 +2,7 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "math/vector3.h" -#include "tests/testData.h" -#include +#include "tests/testing.h" namespace UnitTest { diff --git a/tests/math/wrap.cpp b/tests/math/wrap.cpp index 4eadf5b05a..010c0df103 100644 --- a/tests/math/wrap.cpp +++ b/tests/math/wrap.cpp @@ -1,8 +1,8 @@ // SPDX-License-Identifier: GPL-3.0-or-later // Copyright (c) 2026 Team Dissolve and contributors +#include "math/mathFunc.h" #include "math/vector3.h" -#include "tests/testData.h" #include namespace UnitTest diff --git a/tests/nodes/angle.cpp b/tests/nodes/angle.cpp index 103dceecae..c9c4577f10 100644 --- a/tests/nodes/angle.cpp +++ b/tests/nodes/angle.cpp @@ -5,9 +5,8 @@ #include "classes/speciesSites.h" #include "math/rangedVector3.h" #include "nodes/iterableGraph.h" -#include "tests/graphData.h" -#include "tests/testData.h" -#include +#include "nodes/species.h" +#include "tests/testGraph.h" namespace UnitTest { @@ -39,11 +38,10 @@ TEST(AngleNodeTest, Water) ASSERT_TRUE(iterator->setOption("N", 95)); ASSERT_EQ(iterator->run(), NodeConstants::ProcessResult::Success); - EXPECT_TRUE(DissolveSystemTest::checkData1D(angle->rdfBC(), "B-C RDF", - "dlpoly/water267-analysis/water-267-298K.aardf_21_23_inter_sum", 1, 2, 4.0e-3)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(angle->angleABC(), "A-B-C angle", - "dlpoly/water267-analysis/water-267-298K.dahist1_02_1_01_02.angle.norm", 1, 2, - 3.0e-6)); + EXPECT_TRUE( + testData1D(angle->rdfBC(), "B-C RDF", "dlpoly/water267-analysis/water-267-298K.aardf_21_23_inter_sum", 1, 2, 4.0e-3)); + EXPECT_TRUE(testData1D(angle->angleABC(), "A-B-C angle", + "dlpoly/water267-analysis/water-267-298K.dahist1_02_1_01_02.angle.norm", 1, 2, 3.0e-6)); } } // namespace UnitTest \ No newline at end of file diff --git a/tests/nodes/atomicMC.cpp b/tests/nodes/atomicMC.cpp index fba29cd1f3..9ed21373b5 100644 --- a/tests/nodes/atomicMC.cpp +++ b/tests/nodes/atomicMC.cpp @@ -4,11 +4,8 @@ #include "nodes/atomicMC.h" #include "nodes/configuration.h" #include "nodes/dissolve.h" -#include "nodes/insert.h" #include "nodes/iterableGraph.h" -#include "tests/graphData.h" -#include "tests/testData.h" -#include +#include "tests/testGraph.h" #include namespace UnitTest diff --git a/tests/nodes/averageMolecule.cpp b/tests/nodes/averageMolecule.cpp index 235c4bd21e..98a213531a 100644 --- a/tests/nodes/averageMolecule.cpp +++ b/tests/nodes/averageMolecule.cpp @@ -3,9 +3,8 @@ #include "nodes/averageMolecule.h" #include "nodes/iterableGraph.h" -#include "tests/graphData.h" -#include "tests/testData.h" -#include +#include "nodes/species.h" +#include "tests/testGraph.h" namespace UnitTest { @@ -32,9 +31,9 @@ TEST(AverageMoleculeNodeTest, Water) ASSERT_EQ(iterator->run(), NodeConstants::ProcessResult::Success); auto &structure = avgMol->structure(); - DissolveSystemTest::checkVec3(structure.atom(0)->r(), {-0.83305, 0.0, 0.0}, 1.0e-3); - DissolveSystemTest::checkVec3(structure.atom(1)->r(), {0.00016, 0.60443, 0.0}, 1.0e-3); - DissolveSystemTest::checkVec3(structure.atom(2)->r(), {0.83305, 0.0, 0.0}, 1.0e-3); + testVec3(structure.atom(0)->r(), {-0.83305, 0.0, 0.0}, 1.0e-3); + testVec3(structure.atom(1)->r(), {0.00016, 0.60443, 0.0}, 1.0e-3); + testVec3(structure.atom(2)->r(), {0.83305, 0.0, 0.0}, 1.0e-3); } TEST(AverageMoleculeNodeTest, BeNDy) @@ -60,9 +59,9 @@ TEST(AverageMoleculeNodeTest, BeNDy) ASSERT_EQ(iterator->run(), NodeConstants::ProcessResult::Success); auto &structure = avgMol->structure(); - DissolveSystemTest::checkVec3(structure.atom(0)->r(), {2.0, 0.0, 0.0}, 1.0e-3); - DissolveSystemTest::checkVec3(structure.atom(1)->r(), {0.0, 0.0, 0.0}, 1.0e-3); - DissolveSystemTest::checkVec3(structure.atom(2)->r(), {2.0, 2.828427, 0.0}, 1.0e-3); + testVec3(structure.atom(0)->r(), {2.0, 0.0, 0.0}, 1.0e-3); + testVec3(structure.atom(1)->r(), {0.0, 0.0, 0.0}, 1.0e-3); + testVec3(structure.atom(2)->r(), {2.0, 2.828427, 0.0}, 1.0e-3); } } // namespace UnitTest \ No newline at end of file diff --git a/tests/nodes/axisAngle.cpp b/tests/nodes/axisAngle.cpp index 3b66f7b8e5..2213a24860 100644 --- a/tests/nodes/axisAngle.cpp +++ b/tests/nodes/axisAngle.cpp @@ -2,9 +2,8 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "nodes/axisAngle.h" -#include "tests/graphData.h" -#include "tests/testData.h" -#include +#include "nodes/species.h" +#include "tests/testGraph.h" namespace UnitTest { diff --git a/tests/nodes/bragg.cpp b/tests/nodes/bragg.cpp index 81372ded6a..e5b05d3ffb 100644 --- a/tests/nodes/bragg.cpp +++ b/tests/nodes/bragg.cpp @@ -8,9 +8,7 @@ #include "nodes/gr.h" #include "nodes/iterableGraph.h" #include "nodes/sq.h" -#include "tests/graphData.h" -#include "tests/testData.h" -#include +#include "tests/testGraph.h" #include namespace UnitTest @@ -151,18 +149,18 @@ TEST_F(BraggNodeTest, MgO_Full) auto weightedSQ = neutronSQNode_->getOutputValue("WeightedSQ"); auto weightedTotal = weightedSQ->total(); - EXPECT_TRUE(DissolveSystemTest::checkData1D( + EXPECT_TRUE(testData1D( unboundPartials.get("Mg1//Mg1"), "SQs_UnweightedSQ_Mg-Mg_Unbound", "epsr25/mgo500-555/mgo.EPSR.f01", 1, 2, 1.5e-2)); - EXPECT_TRUE(DissolveSystemTest::checkData1D( + EXPECT_TRUE(testData1D( unboundPartials.get("Mg1//O1"), "SQs_UnweightedSQ_Mg-OX_Unbound", "epsr25/mgo500-555/mgo.EPSR.f01", 1, 4, 1.5e-2)); - EXPECT_TRUE(DissolveSystemTest::checkData1D( + EXPECT_TRUE(testData1D( unboundPartials.get("O1//O1"), "SQs_UnweightedSQ_OX-OX_Unbound", "epsr25/mgo500-555/mgo.EPSR.f01", 1, 6, 1.5e-2)); // Check total F(Q) - EXPECT_TRUE(DissolveSystemTest::checkData1D( + EXPECT_TRUE(testData1D( weightedTotal, "NeutronSQ01_WeightedSQ_Total", "epsr25/mgo500-555/mgo.EPSR.u01", 1, 2, 2.7e-3)); diff --git a/tests/nodes/broadening.cpp b/tests/nodes/broadening.cpp index 7066ab5086..c55c4a71ce 100644 --- a/tests/nodes/broadening.cpp +++ b/tests/nodes/broadening.cpp @@ -3,9 +3,9 @@ #include "math/windowFunction.h" #include "nodes/gr.h" -#include "tests/graphData.h" -#include "tests/testData.h" -#include +#include "nodes/neutronSQ.h" +#include "nodes/sq.h" +#include "tests/testGraph.h" namespace UnitTest { @@ -44,9 +44,9 @@ TEST(BroadeningTest, ArgonBroadening) // Get the weighted SQ auto weightedSQ = neutronSQNode->getOutputValue("WeightedSQ"); ASSERT_TRUE(weightedSQ); - EXPECT_TRUE(DissolveSystemTest::checkData1D( - weightedSQ->total(), std::format("{} {}", Functions1D::forms().keyword(form), joinStrings(parameters)), dataFile, 1, - 2, 3.0e-3)); + EXPECT_TRUE(testData1D(weightedSQ->total(), + std::format("{} {}", Functions1D::forms().keyword(form), joinStrings(parameters)), dataFile, 1, + 2, 3.0e-3)); } } diff --git a/tests/nodes/cif.cpp b/tests/nodes/cif.cpp index 49516c7486..ebc9dd28a4 100644 --- a/tests/nodes/cif.cpp +++ b/tests/nodes/cif.cpp @@ -1,11 +1,10 @@ // SPDX-License-Identifier: GPL-3.0-or-later // Copyright (c) 2026 Team Dissolve and contributors +#include "classes/configuration.h" #include "classes/empiricalFormula.h" #include "nodes/cif/importCIFStructure.h" -#include "tests/graphData.h" -#include "tests/testData.h" -#include +#include "tests/testGraph.h" #include namespace UnitTest @@ -140,10 +139,10 @@ TEST_F(CIFNodeTest, NaCl) testMolecularSpecies(molecularSpecies.at(0), {"Na", 4, 1}); std::vector R = {{0.0, 0.0, 0.0}, {0.0, A / 2, A / 2}, {A / 2, 0.0, A / 2}, {A / 2, A / 2, 0.0}}; for (auto &&[instance, r2] : zip(molecularSpecies.at(0).instances(), R)) - DissolveSystemTest::checkVec3(instance.localAtoms()[0].r(), r2); + testVec3(instance.localAtoms()[0].r(), r2); testMolecularSpecies(molecularSpecies.at(1), {"Cl", 4, 1}); for (auto &&[instance, r2] : zip(molecularSpecies.at(1).instances(), R)) - DissolveSystemTest::checkVec3(instance.localAtoms()[0].r(), (r2 - A / 2).abs()); + testVec3(instance.localAtoms()[0].r(), (r2 - A / 2).abs()); // 2x2x2 supercell molecularSpeciesNode->setOption("SupercellRepeat", {2, 2, 2}); diff --git a/tests/nodes/dAngle.cpp b/tests/nodes/dAngle.cpp index 2ba86e6ce6..1c004642f8 100644 --- a/tests/nodes/dAngle.cpp +++ b/tests/nodes/dAngle.cpp @@ -5,9 +5,8 @@ #include "analyser/dataOperator2D.h" #include "nodes/importDLPUtilsSurface.h" #include "nodes/iterableGraph.h" -#include "tests/graphData.h" -#include "tests/testData.h" -#include +#include "nodes/species.h" +#include "tests/testGraph.h" namespace UnitTest { @@ -38,11 +37,10 @@ TEST(DAngleNodeTest, Water) ASSERT_TRUE(iterator->setOption("N", 95)); ASSERT_EQ(iterator->run(), NodeConstants::ProcessResult::Success); - EXPECT_TRUE(DissolveSystemTest::checkData1D(dAngle->rdfBC(), "B-C RDF", - "dlpoly/water267-analysis/water-267-298K.aardf_21_23_inter_sum", 1, 2, 4.0e-3)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(dAngle->angle(), "Angle Distributions", - "dlpoly/water267-analysis/water-267-298K.dahist1_02_1_01_02.angle.norm", 1, 2, - 3.0e-6)); + EXPECT_TRUE( + testData1D(dAngle->rdfBC(), "B-C RDF", "dlpoly/water267-analysis/water-267-298K.aardf_21_23_inter_sum", 1, 2, 4.0e-3)); + EXPECT_TRUE(testData1D(dAngle->angle(), "Angle Distributions", + "dlpoly/water267-analysis/water-267-298K.dahist1_02_1_01_02.angle.norm", 1, 2, 3.0e-6)); // Test DAngle map - the reference data have not been normalised to account for sin(y) or the spherical shell (RDF) density. Data2D referenceData; @@ -51,8 +49,7 @@ TEST(DAngleNodeTest, Water) auto data = dAngle->distanceAngleMap().accumulatedData(); DataOperator2D dAngleNormaliser(data); dAngleNormaliser.divide(267.0); - EXPECT_TRUE(DissolveSystemTest::checkData2D(data, "Distance-Angle Map", referenceData, - "water-267-298K.dahist1_02_1_01_02.surf", 3.0e-3)); + EXPECT_TRUE(testData2D(data, "Distance-Angle Map", referenceData, "water-267-298K.dahist1_02_1_01_02.surf", 3.0e-3)); } } // namespace UnitTest \ No newline at end of file diff --git a/tests/nodes/epsr.cpp b/tests/nodes/epsr.cpp index bde978872e..05e938c2e8 100644 --- a/tests/nodes/epsr.cpp +++ b/tests/nodes/epsr.cpp @@ -4,9 +4,11 @@ #include "nodes/epsr.h" #include "classes/configuration.h" #include "main/dissolve.h" -#include "tests/graphData.h" -#include "tests/testData.h" -#include +#include "nodes/gr.h" +#include "nodes/neutronSQ.h" +#include "nodes/sq.h" +#include "nodes/xRaySQ.h" +#include "tests/testGraph.h" #include namespace UnitTest @@ -74,12 +76,12 @@ TEST(EPSRNodeTest, Water3N) ASSERT_EQ(epsrNode->run(), NodeConstants::ProcessResult::Success); // Estimated Partials - EXPECT_TRUE(DissolveSystemTest::checkData1D(epsrNode->estimatedSQ("OW", "OW"), "EPSR01_EstimatedSQ_OW-OW", - "epsr25/water1000-neutron/water.EPSR.q01", 1, 2, 2.0e-4)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(epsrNode->estimatedSQ("OW", "HW"), "EPSR01_EstimatedSQ_OW-HW", - "epsr25/water1000-neutron/water.EPSR.q01", 1, 4, 2.0e-4)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(epsrNode->estimatedSQ("HW", "HW"), "EPSR01_EstimatedSQ_HW-HW", - "epsr25/water1000-neutron/water.EPSR.q01", 1, 6, 1.0e-4)); + EXPECT_TRUE(testData1D(epsrNode->estimatedSQ("OW", "OW"), "EPSR01_EstimatedSQ_OW-OW", + "epsr25/water1000-neutron/water.EPSR.q01", 1, 2, 2.0e-4)); + EXPECT_TRUE(testData1D(epsrNode->estimatedSQ("OW", "HW"), "EPSR01_EstimatedSQ_OW-HW", + "epsr25/water1000-neutron/water.EPSR.q01", 1, 4, 2.0e-4)); + EXPECT_TRUE(testData1D(epsrNode->estimatedSQ("HW", "HW"), "EPSR01_EstimatedSQ_HW-HW", + "epsr25/water1000-neutron/water.EPSR.q01", 1, 6, 1.0e-4)); } TEST(EPSRNodeTest, Water3NX) @@ -150,22 +152,22 @@ TEST(EPSRNodeTest, Water3NX) ASSERT_EQ(epsrNode->run(), NodeConstants::ProcessResult::Success); // Test total neutron-weighted F(r) - EXPECT_TRUE(DissolveSystemTest::checkData1D(epsrNode->targetProcessData(D2O).simulatedFR, "EPSR01_SimulatedFR_D2O", - "epsr25/water1000-neutron-xray/water.EPSR.x01", 1, 2, 2.0e-2)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(epsrNode->targetProcessData(H2O).simulatedFR, "EPSR01_SimulatedFR_H2O", - "epsr25/water1000-neutron-xray/water.EPSR.x01", 1, 4, 8.0e-3)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(epsrNode->targetProcessData(HDO).simulatedFR, "EPSR01_SimulatedFR_HDO", - "epsr25/water1000-neutron-xray/water.EPSR.x01", 1, 6, 2.0e-2)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(epsrNode->targetProcessData(H2Ox).simulatedFR, "EPSR01_SimulatedFR_H2Ox", - "epsr25/water1000-neutron-xray/water.EPSR.x01", 1, 8, 2.0e-2)); + EXPECT_TRUE(testData1D(epsrNode->targetProcessData(D2O).simulatedFR, "EPSR01_SimulatedFR_D2O", + "epsr25/water1000-neutron-xray/water.EPSR.x01", 1, 2, 2.0e-2)); + EXPECT_TRUE(testData1D(epsrNode->targetProcessData(H2O).simulatedFR, "EPSR01_SimulatedFR_H2O", + "epsr25/water1000-neutron-xray/water.EPSR.x01", 1, 4, 8.0e-3)); + EXPECT_TRUE(testData1D(epsrNode->targetProcessData(HDO).simulatedFR, "EPSR01_SimulatedFR_HDO", + "epsr25/water1000-neutron-xray/water.EPSR.x01", 1, 6, 2.0e-2)); + EXPECT_TRUE(testData1D(epsrNode->targetProcessData(H2Ox).simulatedFR, "EPSR01_SimulatedFR_H2Ox", + "epsr25/water1000-neutron-xray/water.EPSR.x01", 1, 8, 2.0e-2)); // Estimated Partials - EXPECT_TRUE(DissolveSystemTest::checkData1D(epsrNode->estimatedSQ("OW", "OW"), "EPSR01_EstimatedSQ_OW-OW", - "epsr25/water1000-neutron-xray/water.EPSR.q01", 1, 2, 6.0e-3)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(epsrNode->estimatedSQ("OW", "HW"), "EPSR01_EstimatedSQ_OW-HW", - "epsr25/water1000-neutron-xray/water.EPSR.q01", 1, 4, 6.0e-3)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(epsrNode->estimatedSQ("HW", "HW"), "EPSR01_EstimatedSQ_HW-HW", - "epsr25/water1000-neutron-xray/water.EPSR.q01", 1, 6, 1.3e-2)); + EXPECT_TRUE(testData1D(epsrNode->estimatedSQ("OW", "OW"), "EPSR01_EstimatedSQ_OW-OW", + "epsr25/water1000-neutron-xray/water.EPSR.q01", 1, 2, 6.0e-3)); + EXPECT_TRUE(testData1D(epsrNode->estimatedSQ("OW", "HW"), "EPSR01_EstimatedSQ_OW-HW", + "epsr25/water1000-neutron-xray/water.EPSR.q01", 1, 4, 6.0e-3)); + EXPECT_TRUE(testData1D(epsrNode->estimatedSQ("HW", "HW"), "EPSR01_EstimatedSQ_HW-HW", + "epsr25/water1000-neutron-xray/water.EPSR.q01", 1, 6, 1.3e-2)); } TEST(EPSRNodeTest, Benzene) @@ -220,21 +222,20 @@ TEST(EPSRNodeTest, Benzene) ASSERT_EQ(epsrNode->run(), NodeConstants::ProcessResult::Success); // Test total neutron-weighted F(r) - EXPECT_TRUE(DissolveSystemTest::checkData1D(epsrNode->targetProcessData(C6H6).simulatedFR, "EPSR01//SimulatedFR//C6H6", - "epsr25/benzene200-neutron/benzene.EPSR.x01", 1, 2, 1.5e-3)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(epsrNode->targetProcessData(C6D6).simulatedFR, "EPSR01//SimulatedFR//C6D6", - "epsr25/benzene200-neutron/benzene.EPSR.x01", 1, 4, 1.7e-2)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(epsrNode->targetProcessData(FiftyFifty).simulatedFR, - "EPSR01//SimulatedFR//5050", "epsr25/benzene200-neutron/benzene.EPSR.x01", 1, 6, - 1.1e-2)); + EXPECT_TRUE(testData1D(epsrNode->targetProcessData(C6H6).simulatedFR, "EPSR01//SimulatedFR//C6H6", + "epsr25/benzene200-neutron/benzene.EPSR.x01", 1, 2, 1.5e-3)); + EXPECT_TRUE(testData1D(epsrNode->targetProcessData(C6D6).simulatedFR, "EPSR01//SimulatedFR//C6D6", + "epsr25/benzene200-neutron/benzene.EPSR.x01", 1, 4, 1.7e-2)); + EXPECT_TRUE(testData1D(epsrNode->targetProcessData(FiftyFifty).simulatedFR, "EPSR01//SimulatedFR//5050", + "epsr25/benzene200-neutron/benzene.EPSR.x01", 1, 6, 1.1e-2)); // Test partial S(Q) derived from experiment via matrix inversion - EXPECT_TRUE(DissolveSystemTest::checkData1D(epsrNode->estimatedSQ("CA", "CA"), "EPSR01//EstimatedSQ//CA-CA", - "epsr25/benzene200-neutron/benzene.EPSR.q01", 1, 2, 2.0e-2)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(epsrNode->estimatedSQ("CA", "HA"), "EPSR01//EstimatedSQ//CA-HA", - "epsr25/benzene200-neutron/benzene.EPSR.q01", 1, 4, 2.0e-2)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(epsrNode->estimatedSQ("HA", "HA"), "EPSR01//EstimatedSQ//HA-HA", - "epsr25/benzene200-neutron/benzene.EPSR.q01", 1, 6, 2.0e-2)); + EXPECT_TRUE(testData1D(epsrNode->estimatedSQ("CA", "CA"), "EPSR01//EstimatedSQ//CA-CA", + "epsr25/benzene200-neutron/benzene.EPSR.q01", 1, 2, 2.0e-2)); + EXPECT_TRUE(testData1D(epsrNode->estimatedSQ("CA", "HA"), "EPSR01//EstimatedSQ//CA-HA", + "epsr25/benzene200-neutron/benzene.EPSR.q01", 1, 4, 2.0e-2)); + EXPECT_TRUE(testData1D(epsrNode->estimatedSQ("HA", "HA"), "EPSR01//EstimatedSQ//HA-HA", + "epsr25/benzene200-neutron/benzene.EPSR.q01", 1, 6, 2.0e-2)); } } // namespace UnitTest \ No newline at end of file diff --git a/tests/nodes/flow.cpp b/tests/nodes/flow.cpp index 4df955c317..2442811f1c 100644 --- a/tests/nodes/flow.cpp +++ b/tests/nodes/flow.cpp @@ -6,8 +6,7 @@ #include "nodes/graph.h" #include "nodes/number.h" #include "nodes/numberNode.h" -#include "tests/graphData.h" -#include +#include "tests/testGraph.h" namespace UnitTest { @@ -231,7 +230,7 @@ TEST_F(GraphFlowTest, RemoveEdges) x2a->set(Number{20}); EXPECT_EQ(z_->run(), NodeConstants::ProcessResult::Success); EXPECT_EQ(z_->findOutput("Result")->get().asInteger(), 30); - TestGraph::exportMermaidGraph(graph_); + exportMermaidGraph(graph_); } } // namespace UnitTest diff --git a/tests/nodes/gr.cpp b/tests/nodes/gr.cpp index e839e07ce3..9572030836 100644 --- a/tests/nodes/gr.cpp +++ b/tests/nodes/gr.cpp @@ -3,9 +3,7 @@ #include "nodes/gr.h" #include "math/windowFunction.h" -#include "tests/graphData.h" -#include "tests/testData.h" -#include +#include "tests/testGraph.h" namespace UnitTest { @@ -32,14 +30,14 @@ TEST(GRNodeTest, Methods) ASSERT_EQ(grNode->run(), NodeConstants::ProcessResult::Success); auto rawGRSimple = *grNode->getOutputValue("RawGR"); ASSERT_EQ(grNode->versionIndex(), 1); - ASSERT_TRUE(DissolveSystemTest::checkPartialSet(rawGRBaseline, rawGRSimple, 1.0e-8)); + ASSERT_TRUE(testPartialSet(rawGRBaseline, rawGRSimple, 1.0e-8)); // Test against cells method ASSERT_TRUE(grNode->setOption("Method", GRNode::PartialsMethod::CellsMethod)); ASSERT_EQ(grNode->run(), NodeConstants::ProcessResult::Success); auto rawGRCells = *grNode->getOutputValue("RawGR"); ASSERT_EQ(grNode->versionIndex(), 2); - ASSERT_TRUE(DissolveSystemTest::checkPartialSet(rawGRBaseline, rawGRCells, 1.0e-8)); + ASSERT_TRUE(testPartialSet(rawGRBaseline, rawGRCells, 1.0e-8)); } TEST(GRNodeTest, Water) @@ -62,25 +60,20 @@ TEST(GRNodeTest, Water) auto rawGR = grNode->getOutputValue("RawGR"); // Partial g(r) (unbound terms) - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("OW", "OW")), - "OW-OW Unbound Partial", "epsr25/water1000-neutron/water.EPSR.g01", 1, 2, - 6.0e-2)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("HW", "OW")), - "HW-OW Unbound Partial", "epsr25/water1000-neutron/water.EPSR.g01", 1, 4, - 2.0e-2)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("HW", "HW")), - "HW-HW Unbound Partial", "epsr25/water1000-neutron/water.EPSR.g01", 1, 6, - 2.0e-2)); + EXPECT_TRUE(testData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("OW", "OW")), "OW-OW Unbound Partial", + "epsr25/water1000-neutron/water.EPSR.g01", 1, 2, 6.0e-2)); + EXPECT_TRUE(testData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("HW", "OW")), "HW-OW Unbound Partial", + "epsr25/water1000-neutron/water.EPSR.g01", 1, 4, 2.0e-2)); + EXPECT_TRUE(testData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("HW", "HW")), "HW-HW Unbound Partial", + "epsr25/water1000-neutron/water.EPSR.g01", 1, 6, 2.0e-2)); // Partial g(r) (intramolecular terms) - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("OW", "OW")), - "OW-OW Bound Partial", "epsr25/water1000-neutron/water.EPSR.y01", 1, 2, 1.0e-5, - Error::ErrorType::RMSEError)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("HW", "OW")), - "HW-OW Bound Partial", "epsr25/water1000-neutron/water.EPSR.y01", 1, 4, 0.1)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("HW", "HW")), - "HW-HW Bound Partial", "epsr25/water1000-neutron/water.EPSR.y01", 1, 6, - 1.5e-2)); + EXPECT_TRUE(testData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("OW", "OW")), "OW-OW Bound Partial", + "epsr25/water1000-neutron/water.EPSR.y01", 1, 2, 1.0e-5, Error::ErrorType::RMSEError)); + EXPECT_TRUE(testData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("HW", "OW")), "HW-OW Bound Partial", + "epsr25/water1000-neutron/water.EPSR.y01", 1, 4, 0.1)); + EXPECT_TRUE(testData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("HW", "HW")), "HW-HW Bound Partial", + "epsr25/water1000-neutron/water.EPSR.y01", 1, 6, 1.5e-2)); } TEST(GRNodeTest, WaterMethanol) @@ -112,136 +105,94 @@ TEST(GRNodeTest, WaterMethanol) */ // Partial g(r) (unbound terms - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("OW", "OW")), - "OW-OW Unbound Partial", "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 2, - 1.0)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("OW", "HW")), - "OW-HW Unbound Partial", "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 4, - 0.5)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("OW", "CT")), - "OW-CT Unbound Partial", "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 6, - 0.2)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("OW", "HC")), - "OW-HC Unbound Partial", "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 8, - 7.0e-2)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("OW", "OH")), - "OW-OH Unbound Partial", "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 10, - 0.2)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("OW", "HO")), - "OW-HO Unbound Partial", "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 12, - 0.3)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("HW", "HW")), - "HW-HW Unbound Partial", "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 14, - 0.4)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("HW", "CT")), - "HW-CT Unbound Partial", "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 16, - 0.1)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("HW", "HC")), - "HW-HC Unbound Partial", "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 18, - 4.0e-2)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("HW", "OH")), - "HW-OH Unbound Partial", "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 20, - 0.2)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("HW", "HO")), - "HW-HO Unbound Partial", "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 22, - 0.2)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("CT", "CT")), - "CT-CT Unbound Partial", "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 24, - 0.2)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("CT", "HC")), - "CT-HC Unbound Partial", "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 26, - 4.0e-2)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("CT", "OH")), - "CT-OH Unbound Partial", "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 28, - 0.1)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("CT", "HO")), - "CT-HO Unbound Partial", "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 30, - 0.1)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("HC", "HC")), - "HC-HC Unbound Partial", "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 32, - 4.0e-2)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("HC", "OH")), - "HC-OH Unbound Partial", "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 34, - 4.0e-2)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("HC", "HO")), - "HC-HO Unbound Partial", "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 36, - 5.0e-2)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("OH", "OH")), - "OH-OH Unbound Partial", "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 38, - 0.3)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("OH", "HO")), - "OH-HO Unbound Partial", "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 40, - 0.1)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("HO", "HO")), - "HO-HO Unbound Partial", "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 42, - 0.3)); + EXPECT_TRUE(testData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("OW", "OW")), "OW-OW Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 2, 1.0)); + EXPECT_TRUE(testData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("OW", "HW")), "OW-HW Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 4, 0.5)); + EXPECT_TRUE(testData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("OW", "CT")), "OW-CT Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 6, 0.2)); + EXPECT_TRUE(testData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("OW", "HC")), "OW-HC Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 8, 7.0e-2)); + EXPECT_TRUE(testData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("OW", "OH")), "OW-OH Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 10, 0.2)); + EXPECT_TRUE(testData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("OW", "HO")), "OW-HO Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 12, 0.3)); + EXPECT_TRUE(testData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("HW", "HW")), "HW-HW Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 14, 0.4)); + EXPECT_TRUE(testData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("HW", "CT")), "HW-CT Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 16, 0.1)); + EXPECT_TRUE(testData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("HW", "HC")), "HW-HC Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 18, 4.0e-2)); + EXPECT_TRUE(testData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("HW", "OH")), "HW-OH Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 20, 0.2)); + EXPECT_TRUE(testData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("HW", "HO")), "HW-HO Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 22, 0.2)); + EXPECT_TRUE(testData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("CT", "CT")), "CT-CT Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 24, 0.2)); + EXPECT_TRUE(testData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("CT", "HC")), "CT-HC Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 26, 4.0e-2)); + EXPECT_TRUE(testData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("CT", "OH")), "CT-OH Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 28, 0.1)); + EXPECT_TRUE(testData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("CT", "HO")), "CT-HO Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 30, 0.1)); + EXPECT_TRUE(testData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("HC", "HC")), "HC-HC Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 32, 4.0e-2)); + EXPECT_TRUE(testData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("HC", "OH")), "HC-OH Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 34, 4.0e-2)); + EXPECT_TRUE(testData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("HC", "HO")), "HC-HO Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 36, 5.0e-2)); + EXPECT_TRUE(testData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("OH", "OH")), "OH-OH Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 38, 0.3)); + EXPECT_TRUE(testData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("OH", "HO")), "OH-HO Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 40, 0.1)); + EXPECT_TRUE(testData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("HO", "HO")), "HO-HO Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 42, 0.3)); // Partial g(r) (intramolecular terms) - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("OW", "HW")), - "OW-HW Bound Partial", "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 4, - 0.8)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("HW", "HW")), - "HW-HW Bound Partial", "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 14, - 0.5)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("CT", "HC")), - "CT-HC Bound Partial", "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 26, - 0.3)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("CT", "OH")), - "CT-OH Bound Partial", "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 28, - 0.5)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("CT", "HO")), - "CT-HO Bound Partial", "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 30, - 0.2)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("HC", "HC")), - "HC-HC Bound Partial", "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 32, - 0.06)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("HC", "OH")), - "HC-OH Bound Partial", "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 34, - 0.08)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("HC", "HO")), - "HC-HO Bound Partial", "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 36, - 0.5)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("OH", "HO")), - "OH-HO Bound Partial", "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 40, - 0.5)); + EXPECT_TRUE(testData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("OW", "HW")), "OW-HW Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 4, 0.8)); + EXPECT_TRUE(testData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("HW", "HW")), "HW-HW Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 14, 0.5)); + EXPECT_TRUE(testData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("CT", "HC")), "CT-HC Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 26, 0.3)); + EXPECT_TRUE(testData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("CT", "OH")), "CT-OH Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 28, 0.5)); + EXPECT_TRUE(testData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("CT", "HO")), "CT-HO Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 30, 0.2)); + EXPECT_TRUE(testData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("HC", "HC")), "HC-HC Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 32, 0.06)); + EXPECT_TRUE(testData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("HC", "OH")), "HC-OH Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 34, 0.08)); + EXPECT_TRUE(testData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("HC", "HO")), "HC-HO Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 36, 0.5)); + EXPECT_TRUE(testData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("OH", "HO")), "OH-HO Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 40, 0.5)); // Partial g(r) (intramolecular terms, zero) - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("OW", "OW")), - "OW-OW Bound Partial", "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 2, - 1.0e-5, Error::ErrorType::RMSEError)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("OW", "CT")), - "OW-CT Bound Partial", "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 6, - 1.0e-5, Error::ErrorType::RMSEError)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("OW", "HC")), - "OW-HC Bound Partial", "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 8, - 1.0e-5, Error::ErrorType::RMSEError)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("OW", "OH")), - "OW-OH Bound Partial", "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 10, - 1.0e-5, Error::ErrorType::RMSEError)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("OW", "HO")), - "OW-HO Bound Partial", "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 12, - 1.0e-5, Error::ErrorType::RMSEError)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("HW", "CT")), - "HW-CT Bound Partial", "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 16, - 1.0e-5, Error::ErrorType::RMSEError)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("HW", "HC")), - "HW-HC Bound Partial", "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 18, - 1.0e-5, Error::ErrorType::RMSEError)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("HW", "OH")), - "HW-OH Bound Partial", "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 20, - 1.0e-5, Error::ErrorType::RMSEError)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("HW", "HO")), - "HW-HO Bound Partial", "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 22, - 1.0e-5, Error::ErrorType::RMSEError)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("CT", "CT")), - "CT-CT Bound Partial", "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 24, - 1.0e-5, Error::ErrorType::RMSEError)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("OH", "OH")), - "OH-OH Bound Partial", "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 38, - 1.0e-5, Error::ErrorType::RMSEError)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("HO", "HO")), - "HO-HO Bound Partial", "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 42, - 1.0e-5, Error::ErrorType::RMSEError)); + EXPECT_TRUE(testData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("OW", "OW")), "OW-OW Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 2, 1.0e-5, Error::ErrorType::RMSEError)); + EXPECT_TRUE(testData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("OW", "CT")), "OW-CT Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 6, 1.0e-5, Error::ErrorType::RMSEError)); + EXPECT_TRUE(testData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("OW", "HC")), "OW-HC Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 8, 1.0e-5, Error::ErrorType::RMSEError)); + EXPECT_TRUE(testData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("OW", "OH")), "OW-OH Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 10, 1.0e-5, Error::ErrorType::RMSEError)); + EXPECT_TRUE(testData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("OW", "HO")), "OW-HO Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 12, 1.0e-5, Error::ErrorType::RMSEError)); + EXPECT_TRUE(testData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("HW", "CT")), "HW-CT Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 16, 1.0e-5, Error::ErrorType::RMSEError)); + EXPECT_TRUE(testData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("HW", "HC")), "HW-HC Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 18, 1.0e-5, Error::ErrorType::RMSEError)); + EXPECT_TRUE(testData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("HW", "OH")), "HW-OH Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 20, 1.0e-5, Error::ErrorType::RMSEError)); + EXPECT_TRUE(testData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("HW", "HO")), "HW-HO Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 22, 1.0e-5, Error::ErrorType::RMSEError)); + EXPECT_TRUE(testData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("CT", "CT")), "CT-CT Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 24, 1.0e-5, Error::ErrorType::RMSEError)); + EXPECT_TRUE(testData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("OH", "OH")), "OH-OH Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 38, 1.0e-5, Error::ErrorType::RMSEError)); + EXPECT_TRUE(testData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("HO", "HO")), "HO-HO Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 42, 1.0e-5, Error::ErrorType::RMSEError)); } TEST(GRNodeTest, Benzene) @@ -265,26 +216,20 @@ TEST(GRNodeTest, Benzene) auto rawGR = grNode->getOutputValue("RawGR"); // Partial g(r) (unbound terms) - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("CA", "CA")), - "CA-CA Unbound Partial", "epsr25/benzene200-neutron/benzene.EPSR.g01", 1, 2, - 3.0e-2)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("CA", "HA")), - "CA-HA Unbound Partial", "epsr25/benzene200-neutron/benzene.EPSR.g01", 1, 4, - 2.0e-2)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("HA", "HA")), - "HA-HA Unbound Partial", "epsr25/benzene200-neutron/benzene.EPSR.g01", 1, 6, - 4.0e-2)); + EXPECT_TRUE(testData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("CA", "CA")), "CA-CA Unbound Partial", + "epsr25/benzene200-neutron/benzene.EPSR.g01", 1, 2, 3.0e-2)); + EXPECT_TRUE(testData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("CA", "HA")), "CA-HA Unbound Partial", + "epsr25/benzene200-neutron/benzene.EPSR.g01", 1, 4, 2.0e-2)); + EXPECT_TRUE(testData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("HA", "HA")), "HA-HA Unbound Partial", + "epsr25/benzene200-neutron/benzene.EPSR.g01", 1, 6, 4.0e-2)); // Partial g(r) (intramolecular terms) - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("CA", "CA")), - "CA-CA Bound Partial", "epsr25/benzene200-neutron/benzene.EPSR.y01", 1, 2, - 0.12)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("CA", "HA")), - "CA-HA Bound Partial", "epsr25/benzene200-neutron/benzene.EPSR.y01", 1, 4, - 0.18)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("HA", "HA")), - "HA-HA Bound Partial", "epsr25/benzene200-neutron/benzene.EPSR.y01", 1, 6, - 9.0e-2)); + EXPECT_TRUE(testData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("CA", "CA")), "CA-CA Bound Partial", + "epsr25/benzene200-neutron/benzene.EPSR.y01", 1, 2, 0.12)); + EXPECT_TRUE(testData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("CA", "HA")), "CA-HA Bound Partial", + "epsr25/benzene200-neutron/benzene.EPSR.y01", 1, 4, 0.18)); + EXPECT_TRUE(testData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("HA", "HA")), "HA-HA Bound Partial", + "epsr25/benzene200-neutron/benzene.EPSR.y01", 1, 6, 9.0e-2)); } } // namespace UnitTest \ No newline at end of file diff --git a/tests/nodes/graph.cpp b/tests/nodes/graph.cpp index 5e686a9387..a363148aa9 100644 --- a/tests/nodes/graph.cpp +++ b/tests/nodes/graph.cpp @@ -4,9 +4,7 @@ #include "nodes/add.h" #include "nodes/dissolve.h" #include "nodes/registry.h" -#include "tests/graphData.h" -#include "tests/testData.h" -#include +#include "tests/testGraph.h" namespace UnitTest { @@ -67,7 +65,6 @@ TEST_F(GraphCoreTest, Serialisation) { createGraph(); - Dissolve d; DissolveGraph copy; auto serialised = root_.into_toml(); diff --git a/tests/nodes/graphArgon.cpp b/tests/nodes/graphArgon.cpp index fbe304c18f..ff15ba36b1 100644 --- a/tests/nodes/graphArgon.cpp +++ b/tests/nodes/graphArgon.cpp @@ -2,11 +2,12 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "base/units.h" +#include "classes/configuration.h" #include "classes/isotopologueSet.h" #include "data/structureFactors.h" -#include "tests/graphData.h" -#include "tests/testData.h" -#include +#include "nodes/neutronSQ.h" +#include "nodes/sq.h" +#include "tests/testGraph.h" namespace UnitTest { @@ -47,14 +48,12 @@ TEST(GraphArgonTest, AllCorrelations) // Check total unweighted SQ auto unweightedSQ = sqNode->getOutputValue("UnweightedSQ"); ASSERT_TRUE(unweightedSQ); - ASSERT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->total(), "UnweightedSQ", - "dissolve2/argon/SQ01-UnweightedSQ-total.sq", 1, 2)); + ASSERT_TRUE(testData1D(unweightedSQ->total(), "UnweightedSQ", "dissolve2/argon/SQ01-UnweightedSQ-total.sq", 1, 2)); // Check neutron weighted SQ auto weightedSQ = neutronSQNode->getOutputValue("WeightedSQ"); ASSERT_TRUE(weightedSQ); - ASSERT_TRUE(DissolveSystemTest::checkData1D(weightedSQ->total(), "WeightedSQ", - "dissolve2/argon/NeutronSQ01-WeightedSQ-total.sq", 1, 2, 0.025)); + ASSERT_TRUE(testData1D(weightedSQ->total(), "WeightedSQ", "dissolve2/argon/NeutronSQ01-WeightedSQ-total.sq", 1, 2, 0.025)); } } // namespace UnitTest diff --git a/tests/nodes/histogramCN.cpp b/tests/nodes/histogramCN.cpp index 3fb429b63f..39fe8412fa 100644 --- a/tests/nodes/histogramCN.cpp +++ b/tests/nodes/histogramCN.cpp @@ -3,9 +3,9 @@ #include "nodes/histogramCN.h" #include "nodes/angle.h" -#include "tests/graphData.h" -#include "tests/testData.h" -#include +#include "nodes/iterableGraph.h" +#include "nodes/species.h" +#include "tests/testGraph.h" namespace UnitTest { diff --git a/tests/nodes/intraAngle.cpp b/tests/nodes/intraAngle.cpp index 5f16cd638e..8023f2b988 100644 --- a/tests/nodes/intraAngle.cpp +++ b/tests/nodes/intraAngle.cpp @@ -5,10 +5,8 @@ #include "classes/speciesSites.h" #include "math/rangedVector3.h" #include "nodes/iterableGraph.h" -#include "tests/graphData.h" -#include "tests/testData.h" -#include -#include +#include "nodes/species.h" +#include "tests/testGraph.h" namespace UnitTest { @@ -37,8 +35,8 @@ TEST(IntraAngleNodeTest, Water) ASSERT_TRUE(iterator->setOption("N", 95)); ASSERT_EQ(iterator->run(), NodeConstants::ProcessResult::Success); - EXPECT_TRUE(DissolveSystemTest::checkData1D(intraAngle->intraAngleData(), "A(H1-O-H2)//Angle(ABC)", - "dlpoly/water267-analysis/water-267-298K.01-02-03.ijk", 1, 3, 2.0e-4)); + EXPECT_TRUE(testData1D(intraAngle->intraAngleData(), "A(H1-O-H2)//Angle(ABC)", + "dlpoly/water267-analysis/water-267-298K.01-02-03.ijk", 1, 3, 2.0e-4)); } } // namespace UnitTest diff --git a/tests/nodes/intraDistance.cpp b/tests/nodes/intraDistance.cpp index 13826748a5..2570ce4a9a 100644 --- a/tests/nodes/intraDistance.cpp +++ b/tests/nodes/intraDistance.cpp @@ -4,9 +4,8 @@ #include "nodes/intraDistance.h" #include "classes/speciesSites.h" #include "nodes/iterableGraph.h" -#include "tests/graphData.h" -#include "tests/testData.h" -#include +#include "nodes/species.h" +#include "tests/testGraph.h" #include namespace UnitTest @@ -51,12 +50,12 @@ TEST(IntraDistanceNodeTest, Water) ASSERT_TRUE(iterator->setOption("N", 95)); ASSERT_EQ(iterator->run(), NodeConstants::ProcessResult::Success); - EXPECT_TRUE(DissolveSystemTest::checkData1D(dOH1->rdfAB(), "D(O-H1)//NormalisedHistogram", - "dlpoly/water267-analysis/water-267-298K.01-02.ij", 1, 3, 6.0e-5)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(dOH2->rdfAB(), "D(O-H2)//NormalisedHistogram", - "dlpoly/water267-analysis/water-267-298K.02-03.ij", 1, 3, 7.0e-5)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(dH1H2->rdfAB(), "D(H1-H2)//NormalisedHistogram", - "dlpoly/water267-analysis/water-267-298K.01-03.ij", 1, 3, 5.0e-5)); + EXPECT_TRUE(testData1D(dOH1->rdfAB(), "D(O-H1)//NormalisedHistogram", "dlpoly/water267-analysis/water-267-298K.01-02.ij", 1, + 3, 6.0e-5)); + EXPECT_TRUE(testData1D(dOH2->rdfAB(), "D(O-H2)//NormalisedHistogram", "dlpoly/water267-analysis/water-267-298K.02-03.ij", 1, + 3, 7.0e-5)); + EXPECT_TRUE(testData1D(dH1H2->rdfAB(), "D(H1-H2)//NormalisedHistogram", "dlpoly/water267-analysis/water-267-298K.01-03.ij", + 1, 3, 5.0e-5)); } } // namespace UnitTest diff --git a/tests/nodes/loop.cpp b/tests/nodes/loop.cpp index 27b784b671..21ccf88364 100644 --- a/tests/nodes/loop.cpp +++ b/tests/nodes/loop.cpp @@ -7,7 +7,6 @@ #include "nodes/numberNode.h" #include "nodes/outputs.h" #include "nodes/registry.h" -#include "tests/testData.h" #include namespace UnitTest @@ -74,7 +73,6 @@ class IterableGraphTest : public ::testing::Test TEST_F(IterableGraphTest, BasicNonLoopingSeries) { - Dissolve dissolve; auto root = std::make_unique(); auto loop = dynamic_cast(root->createNode("Iterator", "Iterator")); auto i = dynamic_cast(root->createNode("Number", "i")); diff --git a/tests/nodes/modifierOSites.cpp b/tests/nodes/modifierOSites.cpp index 3059e5fca4..6a2c0d555c 100644 --- a/tests/nodes/modifierOSites.cpp +++ b/tests/nodes/modifierOSites.cpp @@ -2,9 +2,8 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "nodes/modifierOSites.h" -#include "tests/graphData.h" -#include "tests/testData.h" -#include +#include "nodes/species.h" +#include "tests/testGraph.h" namespace UnitTest { diff --git a/tests/nodes/moleculeTorsion.cpp b/tests/nodes/moleculeTorsion.cpp index 593a3fbc7d..9d74073763 100644 --- a/tests/nodes/moleculeTorsion.cpp +++ b/tests/nodes/moleculeTorsion.cpp @@ -3,9 +3,7 @@ #include "nodes/moleculeTorsion.h" #include "nodes/iterableGraph.h" -#include "tests/graphData.h" -#include "tests/testData.h" -#include +#include "tests/testGraph.h" namespace UnitTest { @@ -35,8 +33,8 @@ TEST(MoleculeTorsionNodeTest, Benzene) ASSERT_TRUE(iterator->setOption("N", 80)); ASSERT_EQ(iterator->run(), NodeConstants::ProcessResult::Success); - EXPECT_TRUE(DissolveSystemTest::checkData1D(moleculeTorsion->frequency(), "Normalised Frequency", - "dlpoly/benzene181/benzene181.01-03-05-07.tors.norm", 1, 2, 1.0e-3)); + EXPECT_TRUE(testData1D(moleculeTorsion->frequency(), "Normalised Frequency", + "dlpoly/benzene181/benzene181.01-03-05-07.tors.norm", 1, 2, 1.0e-3)); } } // namespace UnitTest \ No newline at end of file diff --git a/tests/nodes/neutronSQ.cpp b/tests/nodes/neutronSQ.cpp index e1511bab26..cbbe689945 100644 --- a/tests/nodes/neutronSQ.cpp +++ b/tests/nodes/neutronSQ.cpp @@ -1,11 +1,11 @@ // SPDX-License-Identifier: GPL-3.0-or-later // Copyright (c) 2026 Team Dissolve and contributors +#include "nodes/neutronSQ.h" #include "math/windowFunction.h" #include "nodes/gr.h" -#include "tests/graphData.h" -#include "tests/testData.h" -#include +#include "nodes/sq.h" +#include "tests/testGraph.h" namespace UnitTest { @@ -42,12 +42,12 @@ TEST(NeutronSQNodeTest, Water) ASSERT_EQ(HDO->versionIndex(), 0); // Check total F(Q) - EXPECT_TRUE(DissolveSystemTest::checkData1D(D2O->getOutputValue("WeightedSQ")->total(), "D2O F(Q)", - "epsr25/water1000-neutron/water.EPSR.u01", 1, 2, 3.0e-4)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(H2O->getOutputValue("WeightedSQ")->total(), "H2O F(Q)", - "epsr25/water1000-neutron/water.EPSR.u01", 1, 4, 6.0e-4)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(HDO->getOutputValue("WeightedSQ")->total(), "HDO F(Q)", - "epsr25/water1000-neutron/water.EPSR.u01", 1, 6, 2.0e-5)); + EXPECT_TRUE(testData1D(D2O->getOutputValue("WeightedSQ")->total(), "D2O F(Q)", + "epsr25/water1000-neutron/water.EPSR.u01", 1, 2, 3.0e-4)); + EXPECT_TRUE(testData1D(H2O->getOutputValue("WeightedSQ")->total(), "H2O F(Q)", + "epsr25/water1000-neutron/water.EPSR.u01", 1, 4, 6.0e-4)); + EXPECT_TRUE(testData1D(HDO->getOutputValue("WeightedSQ")->total(), "HDO F(Q)", + "epsr25/water1000-neutron/water.EPSR.u01", 1, 6, 2.0e-5)); } TEST(NeutronSQNodeTest, WaterReferenceFT) @@ -84,12 +84,12 @@ TEST(NeutronSQNodeTest, WaterReferenceFT) ASSERT_EQ(grNode->versionIndex(), 0); ASSERT_EQ(HDO->versionIndex(), 0); - EXPECT_TRUE(DissolveSystemTest::checkData1D(D2O->getOutputValue("ReferenceGR"), "D2O Reference G(r)", - "epsr25/water1000-neutron-xray/water.EPSR.w01", 1, 2, 5.0e-5)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(H2O->getOutputValue("ReferenceGR"), "H2O Reference G(r)", - "epsr25/water1000-neutron-xray/water.EPSR.w01", 1, 4, 5.0e-5)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(HDO->getOutputValue("ReferenceGR"), "HDO Reference G(r)", - "epsr25/water1000-neutron-xray/water.EPSR.w01", 1, 6, 5.0e-5)); + EXPECT_TRUE(testData1D(D2O->getOutputValue("ReferenceGR"), "D2O Reference G(r)", + "epsr25/water1000-neutron-xray/water.EPSR.w01", 1, 2, 5.0e-5)); + EXPECT_TRUE(testData1D(H2O->getOutputValue("ReferenceGR"), "H2O Reference G(r)", + "epsr25/water1000-neutron-xray/water.EPSR.w01", 1, 4, 5.0e-5)); + EXPECT_TRUE(testData1D(HDO->getOutputValue("ReferenceGR"), "HDO Reference G(r)", + "epsr25/water1000-neutron-xray/water.EPSR.w01", 1, 6, 5.0e-5)); } TEST(NeutronSQNodeTest, WaterMethanol) @@ -132,30 +132,22 @@ TEST(NeutronSQNodeTest, WaterMethanol) // u01 file: 1 2 4 6 8 10 12 14 16 // Q HHH H5H DHH HDH HHD DDH HDD DDD - EXPECT_TRUE(DissolveSystemTest::checkData1D(neutronSQ["HHH"]->getOutputValue("WeightedSQ")->total(), - "HHH Total F(Q)", "epsr25/water300methanol600/watermeth.EPSR.u01", 1, 2, - 1.0e-4)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(neutronSQ["H5H"]->getOutputValue("WeightedSQ")->total(), - "H5H Total F(Q)", "epsr25/water300methanol600/watermeth.EPSR.u01", 1, 4, - 1.0e-4)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(neutronSQ["DHH"]->getOutputValue("WeightedSQ")->total(), - "DHH Total F(Q)", "epsr25/water300methanol600/watermeth.EPSR.u01", 1, 6, - 1.0e-4)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(neutronSQ["HDH"]->getOutputValue("WeightedSQ")->total(), - "HDH Total F(Q)", "epsr25/water300methanol600/watermeth.EPSR.u01", 1, 8, - 1.0e-4)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(neutronSQ["HHD"]->getOutputValue("WeightedSQ")->total(), - "HHD Total F(Q)", "epsr25/water300methanol600/watermeth.EPSR.u01", 1, 10, - 5.0e-4)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(neutronSQ["DDH"]->getOutputValue("WeightedSQ")->total(), - "DDH Total F(Q)", "epsr25/water300methanol600/watermeth.EPSR.u01", 1, 12, - 8.0e-4)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(neutronSQ["HDD"]->getOutputValue("WeightedSQ")->total(), - "HDD Total F(Q)", "epsr25/water300methanol600/watermeth.EPSR.u01", 1, 14, - 5.0e-4)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(neutronSQ["DDD"]->getOutputValue("WeightedSQ")->total(), - "DDD Total F(Q)", "epsr25/water300methanol600/watermeth.EPSR.u01", 1, 16, - 5.0e-4)); + EXPECT_TRUE(testData1D(neutronSQ["HHH"]->getOutputValue("WeightedSQ")->total(), "HHH Total F(Q)", + "epsr25/water300methanol600/watermeth.EPSR.u01", 1, 2, 1.0e-4)); + EXPECT_TRUE(testData1D(neutronSQ["H5H"]->getOutputValue("WeightedSQ")->total(), "H5H Total F(Q)", + "epsr25/water300methanol600/watermeth.EPSR.u01", 1, 4, 1.0e-4)); + EXPECT_TRUE(testData1D(neutronSQ["DHH"]->getOutputValue("WeightedSQ")->total(), "DHH Total F(Q)", + "epsr25/water300methanol600/watermeth.EPSR.u01", 1, 6, 1.0e-4)); + EXPECT_TRUE(testData1D(neutronSQ["HDH"]->getOutputValue("WeightedSQ")->total(), "HDH Total F(Q)", + "epsr25/water300methanol600/watermeth.EPSR.u01", 1, 8, 1.0e-4)); + EXPECT_TRUE(testData1D(neutronSQ["HHD"]->getOutputValue("WeightedSQ")->total(), "HHD Total F(Q)", + "epsr25/water300methanol600/watermeth.EPSR.u01", 1, 10, 5.0e-4)); + EXPECT_TRUE(testData1D(neutronSQ["DDH"]->getOutputValue("WeightedSQ")->total(), "DDH Total F(Q)", + "epsr25/water300methanol600/watermeth.EPSR.u01", 1, 12, 8.0e-4)); + EXPECT_TRUE(testData1D(neutronSQ["HDD"]->getOutputValue("WeightedSQ")->total(), "HDD Total F(Q)", + "epsr25/water300methanol600/watermeth.EPSR.u01", 1, 14, 5.0e-4)); + EXPECT_TRUE(testData1D(neutronSQ["DDD"]->getOutputValue("WeightedSQ")->total(), "DDD Total F(Q)", + "epsr25/water300methanol600/watermeth.EPSR.u01", 1, 16, 5.0e-4)); } TEST(NeutronSQNodeTest, Benzene) @@ -193,12 +185,12 @@ TEST(NeutronSQNodeTest, Benzene) ASSERT_EQ(FiftyFifty->versionIndex(), 0); // Total F(Q) - EXPECT_TRUE(DissolveSystemTest::checkData1D(C6H6->getOutputValue("WeightedSQ")->total(), "C6H6 Total F(Q)", - "epsr25/benzene200-neutron/benzene.EPSR.u01", 1, 2, 2.0e-3)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(C6D6->getOutputValue("WeightedSQ")->total(), "C6D6 Total F(Q)", - "epsr25/benzene200-neutron/benzene.EPSR.u01", 1, 4, 2.0e-3)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(FiftyFifty->getOutputValue("WeightedSQ")->total(), - "5050 Total F(Q)", "epsr25/benzene200-neutron/benzene.EPSR.u01", 1, 6, 2.0e-3)); + EXPECT_TRUE(testData1D(C6H6->getOutputValue("WeightedSQ")->total(), "C6H6 Total F(Q)", + "epsr25/benzene200-neutron/benzene.EPSR.u01", 1, 2, 2.0e-3)); + EXPECT_TRUE(testData1D(C6D6->getOutputValue("WeightedSQ")->total(), "C6D6 Total F(Q)", + "epsr25/benzene200-neutron/benzene.EPSR.u01", 1, 4, 2.0e-3)); + EXPECT_TRUE(testData1D(FiftyFifty->getOutputValue("WeightedSQ")->total(), "5050 Total F(Q)", + "epsr25/benzene200-neutron/benzene.EPSR.u01", 1, 6, 2.0e-3)); } } // namespace UnitTest \ No newline at end of file diff --git a/tests/nodes/orientedSDF.cpp b/tests/nodes/orientedSDF.cpp index 4e53de5c77..909b1991e0 100644 --- a/tests/nodes/orientedSDF.cpp +++ b/tests/nodes/orientedSDF.cpp @@ -4,9 +4,8 @@ #include "nodes/orientedSDF.h" #include "nodes/importDLPUtilsPDens.h" #include "nodes/iterableGraph.h" -#include "tests/graphData.h" -#include "tests/testData.h" -#include +#include "nodes/species.h" +#include "tests/testGraph.h" namespace UnitTest { @@ -42,7 +41,6 @@ TEST(OrientedSDFNodeTest, Benzene) Data3D referenceData; EXPECT_TRUE(ImportDLPUtilsPDensNode::read(referenceData, "dlpoly/benzene181/benzene181.11.pdens.zOrient0_10")); - EXPECT_TRUE(DissolveSystemTest::checkData3D(osdf->sdf(), "SDF", referenceData, - "dlpoly/benzene181/benzene181.11.pdens.zOrient0_10", 0.09)); + EXPECT_TRUE(testData3D(osdf->sdf(), "SDF", referenceData, "dlpoly/benzene181/benzene181.11.pdens.zOrient0_10", 0.09)); } } // namespace UnitTest \ No newline at end of file diff --git a/tests/nodes/parameters.cpp b/tests/nodes/parameters.cpp index 96b9e6e0a1..1652e2cd9a 100644 --- a/tests/nodes/parameters.cpp +++ b/tests/nodes/parameters.cpp @@ -4,8 +4,7 @@ #include "nodes/dissolve.h" #include "nodes/numberNode.h" #include "nodes/test.h" -#include "tests/graphData.h" -#include +#include "tests/testGraph.h" namespace UnitTest { diff --git a/tests/nodes/qSpecies.cpp b/tests/nodes/qSpecies.cpp index 3b14cadfba..cd868d8b62 100644 --- a/tests/nodes/qSpecies.cpp +++ b/tests/nodes/qSpecies.cpp @@ -2,9 +2,8 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "nodes/qSpecies.h" -#include "tests/graphData.h" -#include "tests/testData.h" -#include +#include "nodes/species.h" +#include "tests/testGraph.h" namespace UnitTest { diff --git a/tests/nodes/sdf.cpp b/tests/nodes/sdf.cpp index 9a84ff63d2..3344e5d1c0 100644 --- a/tests/nodes/sdf.cpp +++ b/tests/nodes/sdf.cpp @@ -4,9 +4,8 @@ #include "nodes/sdf.h" #include "nodes/importDLPUtilsPDens.h" #include "nodes/iterableGraph.h" -#include "tests/graphData.h" -#include "tests/testData.h" -#include +#include "nodes/species.h" +#include "tests/testGraph.h" namespace UnitTest { @@ -38,8 +37,7 @@ TEST(SDFNodeTest, Water) Data3D referenceData; EXPECT_TRUE(ImportDLPUtilsPDensNode::read(referenceData, "dlpoly/water267-analysis/water-267-298K.11.pdens")); - EXPECT_TRUE(DissolveSystemTest::checkData3D(sdf->sdf(), "SDF", referenceData, - "dlpoly/water267-analysis/water-267-298K.11.pdens", 0.13)); + EXPECT_TRUE(testData3D(sdf->sdf(), "SDF", referenceData, "dlpoly/water267-analysis/water-267-298K.11.pdens", 0.13)); } TEST(SDFNodeTest, Benzene) @@ -70,7 +68,6 @@ TEST(SDFNodeTest, Benzene) Data3D referenceData; EXPECT_TRUE(ImportDLPUtilsPDensNode::read(referenceData, "dlpoly/benzene181/benzene181.11.pdens")); - EXPECT_TRUE( - DissolveSystemTest::checkData3D(sdf->sdf(), "SDF", referenceData, "dlpoly/benzene181/benzene181.11.pdens", 0.3)); + EXPECT_TRUE(testData3D(sdf->sdf(), "SDF", referenceData, "dlpoly/benzene181/benzene181.11.pdens", 0.3)); } } // namespace UnitTest \ No newline at end of file diff --git a/tests/nodes/siteRDF.cpp b/tests/nodes/siteRDF.cpp index ffc4f4b191..29714798cc 100644 --- a/tests/nodes/siteRDF.cpp +++ b/tests/nodes/siteRDF.cpp @@ -2,13 +2,10 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "nodes/siteRDF.h" -#include "classes/speciesSites.h" #include "math/rangedVector3.h" #include "nodes/iterableGraph.h" -#include "tests/graphData.h" -#include "tests/testData.h" -#include -#include +#include "nodes/species.h" +#include "tests/testGraph.h" namespace UnitTest { @@ -83,22 +80,22 @@ TEST_F(SiteRDFNodeTest, Water) ASSERT_EQ(iterator_->run(), NodeConstants::ProcessResult::Success); // O-O RDF - EXPECT_TRUE(DissolveSystemTest::checkData1D(oORDF->dataRDF(), "RDF(OW-OW)//RDF", - "dlpoly/water267-analysis/water-267-298K.aardf1_02_02", 1, 2, 9.0e-3)); + EXPECT_TRUE( + testData1D(oORDF->dataRDF(), "RDF(OW-OW)//RDF", "dlpoly/water267-analysis/water-267-298K.aardf1_02_02", 1, 2, 9.0e-3)); // H1-H2 RDF, excluding intramolecular - EXPECT_TRUE(DissolveSystemTest::checkData1D(h1H2RDF->dataRDF(), "RDF(H1-H2)//RDF", - "dlpoly/water267-analysis/water-267-298K.aardf1_01_03", 1, 2, 5.0e-3)); + EXPECT_TRUE(testData1D(h1H2RDF->dataRDF(), "RDF(H1-H2)//RDF", "dlpoly/water267-analysis/water-267-298K.aardf1_01_03", 1, 2, + 5.0e-3)); // COM-COM RDF - EXPECT_TRUE(DissolveSystemTest::checkData1D(comCOMRDF->dataRDF(), "RDF(COM-COM)//RDF", - "dlpoly/water267-analysis/water-267-298K.rdf11", 1, 2, 5.0e-4)); + EXPECT_TRUE( + testData1D(comCOMRDF->dataRDF(), "RDF(COM-COM)//RDF", "dlpoly/water267-analysis/water-267-298K.rdf11", 1, 2, 5.0e-4)); // Coordination numbers auto &[cNA, cNAData] = comCOMRDF->sumN("A"); auto &[cNB, cNBData] = comCOMRDF->sumN("B"); - EXPECT_TRUE(DissolveSystemTest::checkSampledDouble("coordination number A", cNA, 4.32359551, 2.0e-3)); - EXPECT_TRUE(DissolveSystemTest::checkSampledDouble("coordination number B", cNB, 19.413049, 7.0e-4)); + EXPECT_TRUE(testSampledDouble("coordination number A", cNA, 4.32359551, 2.0e-3)); + EXPECT_TRUE(testSampledDouble("coordination number B", cNB, 19.413049, 7.0e-4)); } TEST_F(SiteRDFNodeTest, WaterNPT) @@ -119,16 +116,16 @@ TEST_F(SiteRDFNodeTest, WaterNPT) ASSERT_EQ(iterator_->run(), NodeConstants::ProcessResult::Success); // O-O RDF - EXPECT_TRUE(DissolveSystemTest::checkData1D(oORDF->dataRDF(), "RDF(OW-OW)//RDF", - "dlpoly/water267-npt/water-267-298K.aardf1_02_02", 1, 2, 2.1e-2)); + EXPECT_TRUE( + testData1D(oORDF->dataRDF(), "RDF(OW-OW)//RDF", "dlpoly/water267-npt/water-267-298K.aardf1_02_02", 1, 2, 2.1e-2)); // H1-H2 RDF, excluding intramolecular interactions - EXPECT_TRUE(DissolveSystemTest::checkData1D(h1H2RDF->dataRDF(), "RDF(H1-H2)//RDF", - "dlpoly/water267-npt/water-267-298K.aardf1_01_03", 1, 2, 1.0e-2)); + EXPECT_TRUE( + testData1D(h1H2RDF->dataRDF(), "RDF(H1-H2)//RDF", "dlpoly/water267-npt/water-267-298K.aardf1_01_03", 1, 2, 1.0e-2)); // COM-COM RDF - EXPECT_TRUE(DissolveSystemTest::checkData1D(comCOMRDF->dataRDF(), "RDF(COM-COM)//RDF", - "dlpoly/water267-npt/water-267-298K.rdf11", 1, 2, 4.0e-3)); + EXPECT_TRUE( + testData1D(comCOMRDF->dataRDF(), "RDF(COM-COM)//RDF", "dlpoly/water267-npt/water-267-298K.rdf11", 1, 2, 4.0e-3)); } TEST_F(SiteRDFNodeTest, WaterDynamic) @@ -146,12 +143,12 @@ TEST_F(SiteRDFNodeTest, WaterDynamic) ASSERT_EQ(iterator_->run(), NodeConstants::ProcessResult::Success); // O-O RDF - EXPECT_TRUE(DissolveSystemTest::checkData1D(oORDF->dataRDF(), "RDF(OW-OW)//RDF", - "dlpoly/water267-analysis/water-267-298K.aardf1_02_02", 1, 2, 9.0e-3)); + EXPECT_TRUE( + testData1D(oORDF->dataRDF(), "RDF(OW-OW)//RDF", "dlpoly/water267-analysis/water-267-298K.aardf1_02_02", 1, 2, 9.0e-3)); // H1-H2 RDF, excluding intramolecular interactions - EXPECT_TRUE(DissolveSystemTest::checkData1D(hHRDF->dataRDF(), "RDF(H-H)//RDF", - "dlpoly/water267-analysis/water-267-298K.aardf1_HHsum", 1, 2, 3.0e-3)); + EXPECT_TRUE( + testData1D(hHRDF->dataRDF(), "RDF(H-H)//RDF", "dlpoly/water267-analysis/water-267-298K.aardf1_HHsum", 1, 2, 3.0e-3)); } TEST_F(SiteRDFNodeTest, WaterFragments) @@ -174,22 +171,22 @@ TEST_F(SiteRDFNodeTest, WaterFragments) ASSERT_EQ(iterator_->run(), NodeConstants::ProcessResult::Success); // O-O RDF - EXPECT_TRUE(DissolveSystemTest::checkData1D(oORDF->dataRDF(), "RDF(OW-OW)//RDF", - "dlpoly/water267-analysis/water-267-298K.aardf1_02_02", 1, 2, 1.0e-2)); + EXPECT_TRUE( + testData1D(oORDF->dataRDF(), "RDF(OW-OW)//RDF", "dlpoly/water267-analysis/water-267-298K.aardf1_02_02", 1, 2, 1.0e-2)); // H1-H2 RDF, excluding intramolecular - EXPECT_TRUE(DissolveSystemTest::checkData1D(hHRDF->dataRDF(), "RDF(H-H)//RDF", - "dlpoly/water267-analysis/water-267-298K.aardf1_01_03", 1, 2, 1.0e-2)); + EXPECT_TRUE( + testData1D(hHRDF->dataRDF(), "RDF(H-H)//RDF", "dlpoly/water267-analysis/water-267-298K.aardf1_01_03", 1, 2, 1.0e-2)); // COM-COM RDF - EXPECT_TRUE(DissolveSystemTest::checkData1D(comCOMRDF->dataRDF(), "RDF(COM-COM)//RDF", - "dlpoly/water267-analysis/water-267-298K.rdf11", 1, 2, 5.0e-4)); + EXPECT_TRUE( + testData1D(comCOMRDF->dataRDF(), "RDF(COM-COM)//RDF", "dlpoly/water267-analysis/water-267-298K.rdf11", 1, 2, 5.0e-4)); // Coordination numbers auto &[cNA, cNAData] = comCOMRDF->sumN("A"); auto &[cNB, cNBData] = comCOMRDF->sumN("B"); - EXPECT_TRUE(DissolveSystemTest::checkSampledDouble("coordination number A", cNA, 4.32359551, 2.0e-3)); - EXPECT_TRUE(DissolveSystemTest::checkSampledDouble("coordination number B", cNB, 19.413049, 7.0e-4)); + EXPECT_TRUE(testSampledDouble("coordination number A", cNA, 4.32359551, 2.0e-3)); + EXPECT_TRUE(testSampledDouble("coordination number B", cNB, 19.413049, 7.0e-4)); } } // namespace UnitTest \ No newline at end of file diff --git a/tests/nodes/sq.cpp b/tests/nodes/sq.cpp index e925cae277..75f829abf9 100644 --- a/tests/nodes/sq.cpp +++ b/tests/nodes/sq.cpp @@ -1,11 +1,10 @@ // SPDX-License-Identifier: GPL-3.0-or-later // Copyright (c) 2026 Team Dissolve and contributors +#include "nodes/sq.h" #include "math/windowFunction.h" #include "nodes/gr.h" -#include "tests/graphData.h" -#include "tests/testData.h" -#include +#include "tests/testGraph.h" namespace UnitTest { @@ -32,28 +31,22 @@ TEST(SQNodeTest, Water) ASSERT_TRUE(unweightedSQ); // Partial S(Q) (unbound terms) - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("OW", "OW")), - "OW-OW Unbound Partial", "epsr25/water1000-neutron/water.EPSR.f01", 1, 2, - 1.0e-3)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("OW", "HW")), - "OW-HW Unbound Partial", "epsr25/water1000-neutron/water.EPSR.f01", 1, 4, - 3.0e-3)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("HW", "HW")), - "HW-HW Unbound Partial", "epsr25/water1000-neutron/water.EPSR.f01", 1, 6, - 3.0e-3)); + EXPECT_TRUE(testData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("OW", "OW")), "OW-OW Unbound Partial", + "epsr25/water1000-neutron/water.EPSR.f01", 1, 2, 1.0e-3)); + EXPECT_TRUE(testData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("OW", "HW")), "OW-HW Unbound Partial", + "epsr25/water1000-neutron/water.EPSR.f01", 1, 4, 3.0e-3)); + EXPECT_TRUE(testData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("HW", "HW")), "HW-HW Unbound Partial", + "epsr25/water1000-neutron/water.EPSR.f01", 1, 6, 3.0e-3)); // Partial S(Q) (intramolecular terms) - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("OW", "HW")), - "OW-HW Bound Partial", "epsr25/water1000-neutron/water.EPSR.s01", 1, 4, - 1.0e-4)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("HW", "HW")), - "HW-HW Bound Partial", "epsr25/water1000-neutron/water.EPSR.s01", 1, 6, - 4.0e-5)); + EXPECT_TRUE(testData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("OW", "HW")), "OW-HW Bound Partial", + "epsr25/water1000-neutron/water.EPSR.s01", 1, 4, 1.0e-4)); + EXPECT_TRUE(testData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("HW", "HW")), "HW-HW Bound Partial", + "epsr25/water1000-neutron/water.EPSR.s01", 1, 6, 4.0e-5)); // Partial S(Q) (intramolecular terms) - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("OW", "OW")), - "OW-OW Bound Partial", "epsr25/water1000-neutron/water.EPSR.s01", 1, 2, 1.0e-5, - Error::ErrorType::RMSEError)); + EXPECT_TRUE(testData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("OW", "OW")), "OW-OW Bound Partial", + "epsr25/water1000-neutron/water.EPSR.s01", 1, 2, 1.0e-5, Error::ErrorType::RMSEError)); } TEST(SQNodeTest, WaterMethanol) @@ -89,127 +82,94 @@ TEST(SQNodeTest, WaterMethanol) */ // Partial g(r) (unbound terms - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("OW", "OW")), - "OW-OW Unbound Partial", "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 2, - 4.0e-2)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("OW", "HW")), - "OW-HW Unbound Partial", "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 4, - 5.0e-2)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("OW", "CT")), - "OW-CT Unbound Partial", "epsr25/water300methanol600/watermeth.EPSR.f01", 1, - 6)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("OW", "HC")), - "OW-HC Unbound Partial", "epsr25/water300methanol600/watermeth.EPSR.f01", 1, - 8)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("OW", "OH")), - "OW-OH Unbound Partial", "epsr25/water300methanol600/watermeth.EPSR.f01", 1, - 10)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("OW", "HO")), - "OW-HO Unbound Partial", "epsr25/water300methanol600/watermeth.EPSR.f01", 1, - 12)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("HW", "HW")), - "HW-HW Unbound Partial", "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 14, - 5.0e-2)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("HW", "CT")), - "HW-CT Unbound Partial", "epsr25/water300methanol600/watermeth.EPSR.f01", 1, - 16)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("HW", "HC")), - "HW-HC Unbound Partial", "epsr25/water300methanol600/watermeth.EPSR.f01", 1, - 18)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("HW", "OH")), - "HW-OH Unbound Partial", "epsr25/water300methanol600/watermeth.EPSR.f01", 1, - 20)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("HW", "HO")), - "HW-HO Unbound Partial", "epsr25/water300methanol600/watermeth.EPSR.f01", 1, - 22)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("CT", "CT")), - "CT-CT Unbound Partial", "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 24, - 8.0e-3)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("CT", "HC")), - "CT-HC Unbound Partial", "epsr25/water300methanol600/watermeth.EPSR.f01", 1, - 26)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("CT", "OH")), - "CT-OH Unbound Partial", "epsr25/water300methanol600/watermeth.EPSR.f01", 1, - 28)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("CT", "HO")), - "CT-HO Unbound Partial", "epsr25/water300methanol600/watermeth.EPSR.f01", 1, - 30)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("HC", "HC")), - "HC-HC Unbound Partial", "epsr25/water300methanol600/watermeth.EPSR.f01", 1, - 32)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("HC", "OH")), - "HC-OH Unbound Partial", "epsr25/water300methanol600/watermeth.EPSR.f01", 1, - 34)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("HC", "HO")), - "HC-HO Unbound Partial", "epsr25/water300methanol600/watermeth.EPSR.f01", 1, - 36)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("OH", "OH")), - "OH-OH Unbound Partial", "epsr25/water300methanol600/watermeth.EPSR.f01", 1, - 38)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("OH", "HO")), - "OH-HO Unbound Partial", "epsr25/water300methanol600/watermeth.EPSR.f01", 1, - 40)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("HO", "HO")), - "HO-HO Unbound Partial", "epsr25/water300methanol600/watermeth.EPSR.f01", 1, - 42)); + EXPECT_TRUE(testData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("OW", "OW")), "OW-OW Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 2, 4.0e-2)); + EXPECT_TRUE(testData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("OW", "HW")), "OW-HW Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 4, 5.0e-2)); + EXPECT_TRUE(testData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("OW", "CT")), "OW-CT Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 6)); + EXPECT_TRUE(testData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("OW", "HC")), "OW-HC Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 8)); + EXPECT_TRUE(testData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("OW", "OH")), "OW-OH Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 10)); + EXPECT_TRUE(testData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("OW", "HO")), "OW-HO Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 12)); + EXPECT_TRUE(testData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("HW", "HW")), "HW-HW Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 14, 5.0e-2)); + EXPECT_TRUE(testData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("HW", "CT")), "HW-CT Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 16)); + EXPECT_TRUE(testData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("HW", "HC")), "HW-HC Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 18)); + EXPECT_TRUE(testData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("HW", "OH")), "HW-OH Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 20)); + EXPECT_TRUE(testData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("HW", "HO")), "HW-HO Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 22)); + EXPECT_TRUE(testData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("CT", "CT")), "CT-CT Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 24, 8.0e-3)); + EXPECT_TRUE(testData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("CT", "HC")), "CT-HC Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 26)); + EXPECT_TRUE(testData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("CT", "OH")), "CT-OH Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 28)); + EXPECT_TRUE(testData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("CT", "HO")), "CT-HO Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 30)); + EXPECT_TRUE(testData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("HC", "HC")), "HC-HC Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 32)); + EXPECT_TRUE(testData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("HC", "OH")), "HC-OH Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 34)); + EXPECT_TRUE(testData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("HC", "HO")), "HC-HO Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 36)); + EXPECT_TRUE(testData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("OH", "OH")), "OH-OH Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 38)); + EXPECT_TRUE(testData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("OH", "HO")), "OH-HO Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 40)); + EXPECT_TRUE(testData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("HO", "HO")), "HO-HO Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 42)); // Partial g(r) (intramolecular terms) - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("OW", "HW")), - "OW-HW Bound Partial", "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 4)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("HW", "HW")), - "HW-HW Bound Partial", "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 14)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("CT", "HC")), - "CT-HC Bound Partial", "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 26)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("CT", "OH")), - "CT-OH Bound Partial", "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 28)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("CT", "HO")), - "CT-HO Bound Partial", "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 30)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("HC", "HC")), - "HC-HC Bound Partial", "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 32)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("HC", "OH")), - "HC-OH Bound Partial", "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 34)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("HC", "HO")), - "HC-HO Bound Partial", "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 36)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("OH", "HO")), - "OH-HO Bound Partial", "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 40)); + EXPECT_TRUE(testData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("OW", "HW")), "OW-HW Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 4)); + EXPECT_TRUE(testData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("HW", "HW")), "HW-HW Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 14)); + EXPECT_TRUE(testData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("CT", "HC")), "CT-HC Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 26)); + EXPECT_TRUE(testData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("CT", "OH")), "CT-OH Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 28)); + EXPECT_TRUE(testData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("CT", "HO")), "CT-HO Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 30)); + EXPECT_TRUE(testData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("HC", "HC")), "HC-HC Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 32)); + EXPECT_TRUE(testData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("HC", "OH")), "HC-OH Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 34)); + EXPECT_TRUE(testData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("HC", "HO")), "HC-HO Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 36)); + EXPECT_TRUE(testData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("OH", "HO")), "OH-HO Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 40)); // Partial g(r) (intramolecular terms, zero) - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("OW", "OW")), - "OW-OW Bound Partial", "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 2, - 1.0e-5, Error::ErrorType::RMSEError)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("OW", "CT")), - "OW-CT Bound Partial", "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 6, - 1.0e-5, Error::ErrorType::RMSEError)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("OW", "HC")), - "OW-HC Bound Partial", "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 8, - 1.0e-5, Error::ErrorType::RMSEError)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("OW", "OH")), - "OW-OH Bound Partial", "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 10, - 1.0e-5, Error::ErrorType::RMSEError)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("OW", "HO")), - "OW-HO Bound Partial", "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 12, - 1.0e-5, Error::ErrorType::RMSEError)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("HW", "CT")), - "HW-CT Bound Partial", "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 16, - 1.0e-5, Error::ErrorType::RMSEError)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("HW", "HC")), - "HW-HC Bound Partial", "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 18, - 1.0e-5, Error::ErrorType::RMSEError)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("HW", "OH")), - "HW-OH Bound Partial", "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 20, - 1.0e-5, Error::ErrorType::RMSEError)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("HW", "HO")), - "HW-HO Bound Partial", "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 22, - 1.0e-5, Error::ErrorType::RMSEError)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("CT", "CT")), - "CT-CT Bound Partial", "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 24, - 1.0e-5, Error::ErrorType::RMSEError)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("OH", "OH")), - "OH-OH Bound Partial", "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 38, - 1.0e-5, Error::ErrorType::RMSEError)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("HO", "HO")), - "HO-HO Bound Partial", "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 42, - 1.0e-5, Error::ErrorType::RMSEError)); + EXPECT_TRUE(testData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("OW", "OW")), "OW-OW Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 2, 1.0e-5, Error::ErrorType::RMSEError)); + EXPECT_TRUE(testData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("OW", "CT")), "OW-CT Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 6, 1.0e-5, Error::ErrorType::RMSEError)); + EXPECT_TRUE(testData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("OW", "HC")), "OW-HC Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 8, 1.0e-5, Error::ErrorType::RMSEError)); + EXPECT_TRUE(testData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("OW", "OH")), "OW-OH Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 10, 1.0e-5, Error::ErrorType::RMSEError)); + EXPECT_TRUE(testData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("OW", "HO")), "OW-HO Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 12, 1.0e-5, Error::ErrorType::RMSEError)); + EXPECT_TRUE(testData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("HW", "CT")), "HW-CT Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 16, 1.0e-5, Error::ErrorType::RMSEError)); + EXPECT_TRUE(testData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("HW", "HC")), "HW-HC Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 18, 1.0e-5, Error::ErrorType::RMSEError)); + EXPECT_TRUE(testData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("HW", "OH")), "HW-OH Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 20, 1.0e-5, Error::ErrorType::RMSEError)); + EXPECT_TRUE(testData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("HW", "HO")), "HW-HO Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 22, 1.0e-5, Error::ErrorType::RMSEError)); + EXPECT_TRUE(testData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("CT", "CT")), "CT-CT Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 24, 1.0e-5, Error::ErrorType::RMSEError)); + EXPECT_TRUE(testData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("OH", "OH")), "OH-OH Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 38, 1.0e-5, Error::ErrorType::RMSEError)); + EXPECT_TRUE(testData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("HO", "HO")), "HO-HO Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 42, 1.0e-5, Error::ErrorType::RMSEError)); } TEST(SQNodeTest, Benzene) @@ -236,26 +196,20 @@ TEST(SQNodeTest, Benzene) auto unweightedSQ = sqNode->getOutputValue("UnweightedSQ"); // Partial S(Q) (unbound terms) - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("CA", "CA")), - "CA-CA Unbound Partial", "epsr25/benzene200-neutron/benzene.EPSR.f01", 1, 2, - 7.0e-3)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("CA", "HA")), - "CA-HA Unbound Partial", "epsr25/benzene200-neutron/benzene.EPSR.f01", 1, 4, - 5.0e-3)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("HA", "HA")), - "HA-HA Unbound Partial", "epsr25/benzene200-neutron/benzene.EPSR.f01", 1, 6, - 8.0e-3)); + EXPECT_TRUE(testData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("CA", "CA")), "CA-CA Unbound Partial", + "epsr25/benzene200-neutron/benzene.EPSR.f01", 1, 2, 7.0e-3)); + EXPECT_TRUE(testData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("CA", "HA")), "CA-HA Unbound Partial", + "epsr25/benzene200-neutron/benzene.EPSR.f01", 1, 4, 5.0e-3)); + EXPECT_TRUE(testData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("HA", "HA")), "HA-HA Unbound Partial", + "epsr25/benzene200-neutron/benzene.EPSR.f01", 1, 6, 8.0e-3)); // Partial S(Q) (intramolecular terms) - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("CA", "CA")), - "CA-CA Bound Partial", "epsr25/benzene200-neutron/benzene.EPSR.s01", 1, 2, - 1.1e-2, Error::ErrorType::RMSEError)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("CA", "HA")), - "CA-HA Bound Partial", "epsr25/benzene200-neutron/benzene.EPSR.s01", 1, 4, - 5.0e-3)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("HA", "HA")), - "HA-HA Bound Partial", "epsr25/benzene200-neutron/benzene.EPSR.s01", 1, 6, - 1.0e-2)); + EXPECT_TRUE(testData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("CA", "CA")), "CA-CA Bound Partial", + "epsr25/benzene200-neutron/benzene.EPSR.s01", 1, 2, 1.1e-2, Error::ErrorType::RMSEError)); + EXPECT_TRUE(testData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("CA", "HA")), "CA-HA Bound Partial", + "epsr25/benzene200-neutron/benzene.EPSR.s01", 1, 4, 5.0e-3)); + EXPECT_TRUE(testData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("HA", "HA")), "HA-HA Bound Partial", + "epsr25/benzene200-neutron/benzene.EPSR.s01", 1, 6, 1.0e-2)); } } // namespace UnitTest \ No newline at end of file diff --git a/tests/nodes/subGraph.cpp b/tests/nodes/subGraph.cpp index 7891090631..b1d6f29aaf 100644 --- a/tests/nodes/subGraph.cpp +++ b/tests/nodes/subGraph.cpp @@ -4,7 +4,6 @@ #include "nodes/add.h" #include "nodes/dissolve.h" #include "nodes/number.h" -#include "tests/testData.h" #include namespace UnitTest diff --git a/tests/nodes/trajectory.cpp b/tests/nodes/trajectory.cpp index c4236ac235..f178305de4 100644 --- a/tests/nodes/trajectory.cpp +++ b/tests/nodes/trajectory.cpp @@ -4,11 +4,9 @@ #include "nodes/constants.h" #include "nodes/exportXYZTrajectory.h" #include "nodes/importXYZTrajectory.h" -#include "tests/graphData.h" #include "tests/tempFile.h" -#include "tests/testData.h" +#include "tests/testGraph.h" #include -#include #include #include diff --git a/tests/nodes/voxelDensity.cpp b/tests/nodes/voxelDensity.cpp index 821e24b4fe..83afe99b29 100644 --- a/tests/nodes/voxelDensity.cpp +++ b/tests/nodes/voxelDensity.cpp @@ -3,9 +3,8 @@ #include "nodes/voxelDensity.h" #include "data/atomicMasses.h" -#include "tests/graphData.h" -#include "tests/testData.h" -#include +#include "nodes/configuration.h" +#include "tests/testGraph.h" namespace UnitTest { diff --git a/tests/nodes/xRaySQ.cpp b/tests/nodes/xRaySQ.cpp index 0b227c217d..3385fcb217 100644 --- a/tests/nodes/xRaySQ.cpp +++ b/tests/nodes/xRaySQ.cpp @@ -3,9 +3,7 @@ #include "nodes/xRaySQ.h" #include "nodes/gr.h" -#include "tests/graphData.h" -#include "tests/testData.h" -#include +#include "tests/testGraph.h" namespace UnitTest { @@ -37,12 +35,12 @@ TEST(XRaySQNodeTest, WaterReferenceFT) ASSERT_EQ(H2Ox->versionIndex(), 0); // Total F(Q) - EXPECT_TRUE(DissolveSystemTest::checkData1D(H2Ox->getOutputValue("WeightedSQ")->total(), "H2Ox F(Q)", - "epsr25/water1000-neutron-xray/water.EPSR.u01", 1, 8, 1.5e-4)); + EXPECT_TRUE(testData1D(H2Ox->getOutputValue("WeightedSQ")->total(), "H2Ox F(Q)", + "epsr25/water1000-neutron-xray/water.EPSR.u01", 1, 8, 1.5e-4)); // Total G(r) - EXPECT_TRUE(DissolveSystemTest::checkData1D(H2Ox->getOutputValue("ReferenceGR"), "H2Ox Reference G(r)", - "epsr25/water1000-neutron-xray/water.EPSR.w01", 1, 8, 5.0e-5)); + EXPECT_TRUE(testData1D(H2Ox->getOutputValue("ReferenceGR"), "H2Ox Reference G(r)", + "epsr25/water1000-neutron-xray/water.EPSR.w01", 1, 8, 5.0e-5)); } } // namespace UnitTest \ No newline at end of file diff --git a/tests/pairPotentials/cutoffs.cpp b/tests/pairPotentials/cutoffs.cpp index d3e10115ed..bad982d6d1 100644 --- a/tests/pairPotentials/cutoffs.cpp +++ b/tests/pairPotentials/cutoffs.cpp @@ -3,9 +3,8 @@ #include "kernels/force.h" #include "nodes/dissolve.h" -#include "tests/graphData.h" -#include "tests/testData.h" -#include +#include "nodes/species.h" +#include "tests/testGraph.h" namespace UnitTest { @@ -44,7 +43,7 @@ TEST(PairPotentialCutoffTest, ShortRange) { PairPotential::setRange(cutoff, 1.0e-4); auto kernel = testGraph.createForceKernel(cfg); - checkForceConsistency(kernel, pairPotentialForces, geometryForces, {Kernel::CalculationFlags::ExcludeGeometric}); + testForceConsistency(kernel, pairPotentialForces, geometryForces, {Kernel::CalculationFlags::ExcludeGeometric}); } } @@ -78,7 +77,7 @@ TEST(PairPotentialCutoffTest, Coulomb) { PairPotential::setRange(cutoff, 1.0e-4); auto kernel = testGraph.createForceKernel(cfg); - checkForceConsistency(kernel, pairPotentialForces, geometryForces, {Kernel::CalculationFlags::ExcludeGeometric}); + testForceConsistency(kernel, pairPotentialForces, geometryForces, {Kernel::CalculationFlags::ExcludeGeometric}); } } diff --git a/tests/pairPotentials/overrides.cpp b/tests/pairPotentials/overrides.cpp index 2c4eba421b..0739f0dcc1 100644 --- a/tests/pairPotentials/overrides.cpp +++ b/tests/pairPotentials/overrides.cpp @@ -2,9 +2,9 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "kernels/energy.h" -#include "tests/graphData.h" -#include -#include +#include "nodes/neutronSQ.h" +#include "nodes/species.h" +#include "tests/testGraph.h" namespace UnitTest { diff --git a/tests/testData.h b/tests/testData.h deleted file mode 100644 index 3bb78b255d..0000000000 --- a/tests/testData.h +++ /dev/null @@ -1,407 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2026 Team Dissolve and contributors - -#pragma once - -#include "classes/partialSet.h" -#include "classes/species.h" -#include "kernels/energy.h" -#include "kernels/force.h" -#include "main/dissolve.h" -#include "math/data2D.h" -#include "math/data3D.h" -#include "math/error.h" -#include "math/mathFunc.h" -#include "math/sampledData1D.h" -#include "math/sampledDouble.h" -#include "math/sampledVector.h" -#include "nodes/energy.h" -#include "nodes/graph.h" -#include "nodes/importXYData.h" -#include "nodes/serialisableData.h" -#include "nodes/species.h" -#include - -namespace UnitTest -{ - -// Flags that can modify how a test is setUp. This can be useful -// for masking tests that are known to be failing, but cannot be -// resolved at this juncture. The indices must be unique powers -// of two in order for masks to be composable. -// -// Eventually, once we move to C++23, this can be replaced by a -// std::bitset, but bitset isn't constexpr until then. -enum TestFlags -{ - TomlFailure = 1, // tests where the TOML testing is known to fail -}; - -// Custom Macros -// See https://stackoverflow.com/questions/42956538 - -// Wrap a code block with try-catch, handle exceptions thrown, print them into EXCEPT_STREAM and rethrow. -// clang-format off -#define PRINT_AND_RETHROW(CODE_BLOCK, EXCEPT_STREAM) try{CODE_BLOCK;}catch(const std::exception& ex){ EXCEPT_STREAM << "std::exception thrown: " << ex.what() << std::endl; throw; }catch(...){ EXCEPT_STREAM << "unknown structure thrown" << std::endl; throw;} -// clang-format on - -// Wrap a code block with try-catch, handle exceptions thrown, print them into std::cerr and rethrow. -#define PRINT_STDERR_AND_RETHROW(CODE_BLOCK) PRINT_AND_RETHROW(CODE_BLOCK, std::cerr) -#define EXPECT_NO_THROW_VERBOSE(CODE_BLOCK) EXPECT_NO_THROW(PRINT_STDERR_AND_RETHROW(CODE_BLOCK)) -#define ASSERT_NO_THROW_VERBOSE(CODE_BLOCK) ASSERT_NO_THROW(PRINT_STDERR_AND_RETHROW(CODE_BLOCK)) - -/* - * Helper Functions - */ - -// Helper function for comparing TOML values with context, but without insisting on a specific ordering of fields. -void compareToml(std::string location, SerialisedValue toml, SerialisedValue toml2) -{ - if (toml.is_table()) - { - ASSERT_TRUE(toml2.is_table()) << location; - for (auto &[k, v] : toml.as_table()) - { - ASSERT_TRUE(toml2.contains(k)) << location << "." << k << std::endl << "Expected:" << std::endl << toml[k]; - compareToml(std::format("{}.{}", location, k), v, toml2.at(k)); - } - } - else if (toml.is_array()) - { - auto arr = toml.as_array(); - auto arr2 = toml2.as_array(); - ASSERT_EQ(arr.size(), arr2.size()) << location << std::endl << "Expected" << std::endl << toml; - for (int i = 0; i < arr.size(); ++i) - compareToml(std::format("{}[{}]", location, i), arr[i], arr2[i]); - } - else - { - EXPECT_EQ(toml, toml2) << location; - } -} - -// Serialise A and deserialise into B -template void tomlRoundTrip(T &a, T &b) -{ - SerialisedValue serialised; - auto s = std::make_shared>("data", a); - ASSERT_NO_THROW(serialised = s->serialise()); - - auto d = std::make_shared>("data", b); - ASSERT_NO_THROW(d->deserialise(serialised)); -} - -/* - * System Test Class - */ - -class DissolveSystemTest -{ - public: - DissolveSystemTest() { dissolve_.setRestartFileFrequency(0); }; - - /* - * Dissolve & CoreData - */ - private: - Dissolve dissolve_; - // Whether to perform rewrite checks on setUp - bool rewriteCheck_{true}; - // Function to execute to perform additional setup prior to prepare() - std::function additionalSetUp_; - - public: - // Return the Dissolve object - Dissolve &dissolve() { return dissolve_; } - - /* - * Checks - */ - public: - // Test simple double - [[nodiscard]] static bool checkDouble(std::string_view quantity, double A, double B, double threshold) - { - auto delta = fabs(A - B); - auto isOK = delta <= threshold; - Messenger::print("Reference {} delta with correct value is {:15.9e} and is {} (threshold is {:10.3e})\n", quantity, - delta, isOK ? "OK" : "NOT OK", threshold); - return isOK; - } - // Test sampled double - [[nodiscard]] static bool checkSampledDouble(std::string_view quantity, SampledDouble A, double B, double threshold) - { - return checkDouble(quantity, A.value(), B, threshold); - } - // Test Data1D - [[nodiscard]] static bool checkData1D(const Data1D &dataA, std::string_view nameA, const Data1D &dataB, - std::string_view nameB, double tolerance = 5.0e-3, - Error::ErrorType errorType = Error::ErrorType::EuclideanError) - { - // Generate the error estimate and compare against the threshold value - auto error = Error::error(errorType, dataA, dataB).error; - auto notOK = std::isnan(error) || error > tolerance; - Messenger::print("Data '{}' has error of {:7.3e} with data '{}' and is {} (threshold is {:6.3e}).\n", nameA, error, - nameB, notOK ? "NOT OK" : "OK", tolerance); - return !notOK; - } - [[nodiscard]] static bool checkData1D(const Data1D &dataA, std::string_view nameA, std::string filePath, int xColumn, - int yColumn, double tolerance = 5.0e-3, - Error::ErrorType errorType = Error::ErrorType::EuclideanError) - { - Data1D dataB; - if (!ImportXYDataNode::read(dataB, filePath, xColumn, yColumn)) - { - std::cout << std::format("Failed to read data from '{}'\n", filePath); - return false; - } - - return checkData1D(dataA, nameA, dataB, filePath, tolerance, errorType); - } - // Test Data2D - [[nodiscard]] static bool checkData2D(const Data2D &dataA, std::string_view nameA, const Data2D &dataB, - std::string_view nameB, double tolerance = 5.0e-3, - Error::ErrorType errorType = Error::ErrorType::EuclideanError) - { - // Generate the error estimate and compare against the threshold value - auto error = Error::error(errorType, dataA.values().linearArray(), dataB.values().linearArray()).error; - auto notOK = std::isnan(error) || error > tolerance; - Messenger::print("Data '{}' has error of {:7.3f} with data '{}' and is {} (threshold is {:6.3e})\n\n", nameA, error, - nameB, notOK ? "NOT OK" : "OK", tolerance); - - return !notOK; - } - // Test Data3D - [[nodiscard]] static bool checkData3D(const Data3D &dataA, std::string_view nameA, const Data3D &dataB, - std::string_view nameB, double tolerance = 5.0e-3, - Error::ErrorType errorType = Error::ErrorType::EuclideanError) - { - // Generate the error estimate and compare against the threshold value - auto error = Error::error(errorType, dataA.values().linearArray(), dataB.values().linearArray()).error; - auto notOK = std::isnan(error) || error > tolerance; - Messenger::print("Internal data '{}' has error of {:7.3f} with external data '{}' and is {} (threshold is {:6.3e})\n\n", - nameA, error, nameB, notOK ? "NOT OK" : "OK", tolerance); - - return !notOK; - } - // Test Vec3 data - static void checkVec3(const Vector3 &A, const Vector3 &B, double tolerance = 1.0e-6) - { - EXPECT_NEAR(A.x, B.x, tolerance); - EXPECT_NEAR(A.y, B.y, tolerance); - EXPECT_NEAR(A.z, B.z, tolerance); - } - // Test Vec3 vector data - static void checkVec3Vector(const std::vector &A, const std::vector &B, double tolerance = 1.0e-6) - { - ASSERT_EQ(A.size(), B.size()); - for (auto n = 0; n < A.size(); ++n) - checkVec3(A[n], B[n], tolerance); - } - // Test species atom type - static void checkSpeciesAtomType(Species *sp, const std::map &namesById) - { - for (auto &[atomIndex, atomTypeName] : namesById) - { - ASSERT_TRUE(atomIndex >= 0 && atomIndex < sp->nAtoms()); - auto &spAtom = sp->atom(atomIndex); - auto at = spAtom.atomType(); - ASSERT_TRUE(at); - EXPECT_EQ(at->name(), atomTypeName); - } - } - // Test interaction parameters - template - void checkIntramolecularTerms(const std::string &termInfo, const InteractionPotential &expectedParams, - const InteractionPotential &actualParams, double tolerance = 1.0e-6) - { - Messenger::print("Testing intramolecular interaction: {}...\n", termInfo); - EXPECT_EQ(Intra::forms().keyword(actualParams.form()), Intra::forms().keyword(expectedParams.form())); - EXPECT_EQ(actualParams.nParameters(), expectedParams.nParameters()); - for (auto &&[current, expected] : zip(actualParams.parameters(), expectedParams.parameters())) - EXPECT_NEAR(current, expected, tolerance); - } - // Test species bond term - void checkSpeciesIntramolecular(Species *sp, std::vector atoms, - const InteractionPotential &expectedParams, double tolerance = 1.0e-6) - { - ASSERT_TRUE(atoms.size() == 2); - const auto &b = sp->getBond(&sp->atoms()[atoms[0]], &sp->atoms()[atoms[1]]); - if (!b) - throw(std::runtime_error(std::format("No bond {} exists in species '{}'.\n", joinStrings(atoms, "-"), sp->name()))); - checkIntramolecularTerms(std::format("bond {}", joinStrings(atoms, "-")), expectedParams, - b->get().interactionPotential(), tolerance); - } - // Test species angle term - void checkSpeciesIntramolecular(Species *sp, std::vector atoms, - const InteractionPotential &expectedParams, double tolerance = 1.0e-6) - { - ASSERT_TRUE(atoms.size() == 3); - const auto &a = sp->getAngle(&sp->atoms()[atoms[0]], &sp->atoms()[atoms[1]], &sp->atoms()[atoms[2]]); - if (!a) - throw( - std::runtime_error(std::format("No angle {} exists in species '{}'.\n", joinStrings(atoms, "-"), sp->name()))); - checkIntramolecularTerms(std::format("angle {}", joinStrings(atoms, "-")), expectedParams, - a->get().interactionPotential(), tolerance); - } - // Test species torsion / improper term - void checkSpeciesIntramolecular(Species *sp, std::vector atoms, - const InteractionPotential &expectedParams, double tolerance = 1.0e-6) - { - ASSERT_TRUE(atoms.size() == 4); - const auto &t = - sp->getTorsion(&sp->atoms()[atoms[0]], &sp->atoms()[atoms[1]], &sp->atoms()[atoms[2]], &sp->atoms()[atoms[3]]); - const auto &i = - sp->getImproper(&sp->atoms()[atoms[0]], &sp->atoms()[atoms[1]], &sp->atoms()[atoms[2]], &sp->atoms()[atoms[3]]); - if (!t && !i) - throw(std::runtime_error( - std::format("No torsion or improper {} exists in species '{}'.\n", joinStrings(atoms, "-"), sp->name()))); - else if (t) - checkIntramolecularTerms(std::format("torsion {}", joinStrings(atoms, "-")), expectedParams, - t->get().interactionPotential(), tolerance); - else - checkIntramolecularTerms(std::format("improper {}", joinStrings(atoms, "-")), expectedParams, - i->get().interactionPotential(), tolerance); - } - // Test consistency between the two supplied double-keyed Data1D maps - static bool checkDoubleKeyedMap(std::string_view mapContents, const DoubleKeyedMap &mapA, - const DoubleKeyedMap &mapB, double testThreshold) - { - // Check map sizes - if (mapA.size() != mapB.size()) - { - std::cout << std::format("Maps containing {} data are of dissimilar size (A = {}, B = {})\n", mapContents, - mapA.size(), mapB.size()); - return false; - } - - // Check individual data - for (auto &[key, dataA] : mapA) - { - // Find same-keyed data in mapB - if (mapB.contains(key)) - { - auto errorReport = Error::percent(dataA, mapB.get(key)); - std::cout << Error::errorReportString(errorReport) << std::endl; - std::cout << std::format("{} '{}' in map B has {} error of {:7.3f}{} with data in map A and is " - "{} (threshold is {:6.3f}%)\n\n", - mapContents, key, Error::errorTypes().keyword(errorReport.errorType), - errorReport.error, errorReport.errorType == Error::ErrorType::PercentError ? "%" : "", - errorReport.error <= testThreshold ? "OK" : "NOT OK", testThreshold); - if (errorReport.error > testThreshold) - return false; - } - else - { - std::cout << std::format("{} '{}' is present in map A but not in map B.\n", mapContents, key); - return false; - } - } - - return true; - } - // Test consistency, and error, between supplied partial sets - static bool checkPartialSet(const PartialSet &setA, const PartialSet &setB, double testThreshold) - { - // Full partials - if (!checkDoubleKeyedMap("Full Partials", setA.partials(), setB.partials(), testThreshold)) - return false; - - // Bound partials - if (!checkDoubleKeyedMap("Bound Partials", setA.boundPartials(), setB.boundPartials(), testThreshold)) - return false; - - // Unbound partials - if (!checkDoubleKeyedMap("Unbound Partials", setA.unboundPartials(), setB.unboundPartials(), testThreshold)) - return false; - - // Total - auto errorReport = Error::percent(setA.total(), setB.total()); - std::cout << Error::errorReportString(errorReport) << std::endl; - std::cout << std::format( - "Total in set B has {} error of {:7.3f}{} with data in set A and is {} (threshold is {:6.3f}%)\n\n", - Error::errorTypes().keyword(errorReport.errorType), errorReport.error, - errorReport.errorType == Error::ErrorType::PercentError ? "%" : "", - errorReport.error <= testThreshold ? "OK" : "NOT OK", testThreshold); - if (errorReport.error > testThreshold) - return false; - - return true; - } -}; - -// Check consistency between production, molecular, and test energies, returning production values -Kernel::EnergyResult checkEnergyConsistency(const std::unique_ptr &kernel, double testThreshold = 1.0e-6) -{ - // Calculate production energies (fully optimised) - auto productionEnergy = kernel->totalEnergy(); - - // Calculate baseline test energies (simple double-loop, PBC always) - auto testEnergy = kernel->totalEnergySimple(); - - // Calculate molecule-centric energy - auto molecularPPEnergy = kernel->totalMoleculePairPotentialEnergy(); - - // Compare basic energies with production value - EXPECT_NEAR(testEnergy.pairPotential.interMolecular, productionEnergy.pairPotential.interMolecular, testThreshold); - EXPECT_NEAR(testEnergy.pairPotential.intraMolecular, productionEnergy.pairPotential.intraMolecular, testThreshold); - EXPECT_NEAR(testEnergy.geometry.total(), productionEnergy.geometry.total(), testThreshold); - - // Compare basic energies with molecule-based values - EXPECT_NEAR(testEnergy.pairPotential.total(), molecularPPEnergy.total(), testThreshold); - EXPECT_NEAR(testEnergy.pairPotential.interMolecular, molecularPPEnergy.interMolecular, testThreshold); - - // Compare molecule-based energies with production values - EXPECT_NEAR(molecularPPEnergy.total(), productionEnergy.pairPotential.total(), testThreshold); - EXPECT_NEAR(molecularPPEnergy.interMolecular, productionEnergy.pairPotential.interMolecular, testThreshold); - - return productionEnergy; -} - -// Check consistency between production and test forces -void checkForceConsistency(const std::unique_ptr &kernel, std::vector &ppForces, - std::vector &geomForces, Flags flags = {}, - double ppMaxDeviation = 1.0e-2, double geomMaxDeviation = 1.0e-6) -{ - // Calculate production forces (fully optimised) - kernel->totalForces(ppForces, geomForces, flags); - - // Calculate baseline test forces (simple double-loop, PBC always) - std::vector ppTestForces, geomTestForces; - kernel->totalForcesSimple(ppTestForces, geomTestForces, flags); - - // Pair potential forces - if (!(flags.isSet(Kernel::CalculationFlags::ExcludeInterMolecularPairPotential) && - flags.isSet(Kernel::CalculationFlags::ExcludeIntraMolecularPairPotential))) - for (auto &&[pairPotentialTestForce, pairPotentialProductionForce] : zip(ppTestForces, ppForces)) - { - EXPECT_NEAR(pairPotentialProductionForce.x, pairPotentialTestForce.x, ppMaxDeviation); - EXPECT_NEAR(pairPotentialProductionForce.y, pairPotentialTestForce.y, ppMaxDeviation); - EXPECT_NEAR(pairPotentialProductionForce.z, pairPotentialTestForce.z, ppMaxDeviation); - } - - // Geometric forces - if (flags.isNotSet(Kernel::CalculationFlags::ExcludeGeometric)) - for (auto &&[geometryTestForce, geometryProductionForce] : zip(geomTestForces, geomForces)) - { - EXPECT_NEAR(geometryProductionForce.x, geometryTestForce.x, geomMaxDeviation); - EXPECT_NEAR(geometryProductionForce.y, geometryTestForce.y, geomMaxDeviation); - EXPECT_NEAR(geometryProductionForce.z, geometryTestForce.z, geomMaxDeviation); - } -} - -// Check consistency of supplied forces -void checkReferenceForceConsistency(const std::vector &ppForces, const std::vector &geomForces, - const std::vector &referenceForces, double maxDeviation = 1.0e-3) -{ - ASSERT_TRUE(ppForces.size() == geomForces.size()); - ASSERT_TRUE(ppForces.size() == referenceForces.size()); - - for (auto &&[ppForce, geometryForce, referenceForce] : zip(ppForces, geomForces, referenceForces)) - { - auto calculatedForce = ppForce + geometryForce; - EXPECT_NEAR(calculatedForce.x, referenceForce.x, maxDeviation); - EXPECT_NEAR(calculatedForce.y, referenceForce.y, maxDeviation); - EXPECT_NEAR(calculatedForce.z, referenceForce.z, maxDeviation); - } -} -} // namespace UnitTest diff --git a/tests/testGraph.cpp b/tests/testGraph.cpp new file mode 100644 index 0000000000..57f0d3a5ca --- /dev/null +++ b/tests/testGraph.cpp @@ -0,0 +1,303 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +// Copyright (c) 2026 Team Dissolve and contributors + +#include "tests/testGraph.h" +#include "classes/isotopologueSet.h" +#include "main/dissolve.h" +#include "nodes/bragg.h" +#include "nodes/dissolve.h" +#include "nodes/forcefield.h" +#include "nodes/gr.h" +#include "nodes/insert.h" +#include "nodes/iterableGraph.h" +#include "nodes/neutronSQ.h" +#include "nodes/setCoordinates.h" +#include "nodes/species.h" +#include "nodes/sq.h" +#include "nodes/xRaySQ.h" +#include + +namespace UnitTest +{ +/* + * Graph Creation Helpers + */ + +// Returns pointer to current top node in graph +Node *TestGraph::fetchHead() const { return head_; } +// Returns the name of the current head node in the graph +std::string TestGraph::fetchHeadName() const { return head_ ? std::string(head_->name()) : "NO_NODE"; } +// Append new node to the graph +Node *TestGraph::appendNode(const std::string &nodeType, const std::optional &name) +{ + auto node = name.has_value() ? currentGraph_->createNode(nodeType, *name) : currentGraph_->createNode(nodeType); + + if (!node) + return nullptr; + + head_ = node; + + return node; +} +// Create species insertion node chain +Node *TestGraph::createAndInsertSpecies(Node *cfgSourceNode, std::string cfgSourceOutput, + const std::vector> &species, double rho, + Units::DensityUnits rhoUnits, InsertNode::BoxActionStyle boxActionStyle) +{ + // Add Species and Insert nodes + for (auto &[speciesString, population] : species) + { + // Create the species node and get the species pointer + std::unique_ptr speciesUnique; + if (speciesString.ends_with(".toml")) + speciesUnique = loadTOMLSpecies(speciesString); + else + { + if (speciesString.find('|') == std::string::npos) + speciesUnique = createAtomicSpecies(Elements::element(speciesString), {ShortRangeFunctions::Form::Undefined}); + else + speciesUnique = + createAtomicSpecies(Elements::element(DissolveSys::beforeChar(speciesString, '|')), + {ShortRangeFunctions::Form::LennardJones, DissolveSys::afterChar(speciesString, '|')}); + } + EXPECT_TRUE(speciesUnique); + auto &speciesNode = speciesUnique->species(); + + // Move the species node into the graph + currentGraph_->addNode(std::move(speciesUnique), speciesNode.name()); + + auto insertNodeName = std::format("Insert-{}", speciesNode.name()); + EXPECT_TRUE(appendNode("Insert", insertNodeName)); + EXPECT_TRUE(fetchHead()->setInput("Population", population)); + EXPECT_TRUE(fetchHead()->setInput("Density", rho)); + EXPECT_TRUE(fetchHead()->setOption("BoxAction", boxActionStyle)); + EXPECT_TRUE(fetchHead()->setOption("DensityUnits", rhoUnits)); + EXPECT_TRUE(currentGraph_->addEdge({std::string(speciesNode.name()), "Species", insertNodeName, "Species"})); + EXPECT_TRUE( + currentGraph_->addEdge({std::string(cfgSourceNode->name()), cfgSourceOutput, insertNodeName, "Configuration"})); + + cfgSourceNode = fetchHead(); + + // After the first InsertNode addition the source output name reverts to "Configuration" (it may previously have + // been Output from SetBox) + cfgSourceOutput = "Configuration"; + } + + return fetchHead(); +} + +// Create and return atomic SpeciesNode +std::unique_ptr TestGraph::createAtomicSpecies(Elements::Element element, + InteractionPotential potential) +{ + // Add species node + auto speciesNodeUniquePtr = std::make_unique(nullptr); + auto speciesNodePtr = speciesNodeUniquePtr.get(); + auto species = &speciesNodePtr->species(); + species->setName(Elements::symbol(element)); + species->createAtomic(element, potential); + + return speciesNodeUniquePtr; +} +// Create species from TOML file +std::unique_ptr TestGraph::loadTOMLSpecies(std::string_view path) +{ + // Add species node + auto speciesNodeUniquePtr = std::make_unique(nullptr); + auto speciesNodePtr = speciesNodeUniquePtr.get(); + auto &species = speciesNodePtr->species(); + species.load(path); + + return speciesNodeUniquePtr; +} +// Create a species node with structure and forcefield data sources +SpeciesNode *TestGraph::createSpeciesFromStructureAndForcefield(std::string name, std::string structureNodeType, + std::string structureFilePath, std::shared_ptr ff, + bool calculateBonding) +{ + // Add species node + auto speciesNodeUniquePtr = std::make_unique(nullptr); + EXPECT_TRUE(speciesNodeUniquePtr); + auto speciesNodePtr = speciesNodeUniquePtr.get(); + EXPECT_TRUE(speciesNodePtr); + auto &species = speciesNodePtr->species(); + species.setName(name); + currentGraph_->addNode(std::move(speciesNodeUniquePtr), name); + + // Create structure import node + auto structureNode = createNode(structureNodeType); + EXPECT_TRUE(structureNode); + structureNode->setOption("FilePath", structureFilePath); + + // Create rebonding node? + if (calculateBonding) + { + auto calculateBondingNode = createNode("CalculateBonding"); + EXPECT_TRUE(calculateBondingNode); + EXPECT_TRUE(currentGraph_->addEdge({structureNodeType, "Structure", "CalculateBonding", "Structure"})); + EXPECT_TRUE(currentGraph_->addEdge({"CalculateBonding", "Structure", name, "Structure"})); + } + else + EXPECT_TRUE(currentGraph_->addEdge({structureNodeType, "Structure", name, "Structure"})); + + // Create forcefield node + auto forcefieldNode = dynamic_cast(createNode("Forcefield")); + EXPECT_TRUE(forcefieldNode); + EXPECT_TRUE(forcefieldNode->setOption("Forcefield", ff.get())); + EXPECT_TRUE(currentGraph_->addEdge({"Forcefield", "Recipe", name, "Recipe"})); + + return speciesNodePtr; +} +// Create basic configuration graph, returning the last node +Node *TestGraph::createConfiguration(std::string name, const std::vector> &species, double rho, + Units::DensityUnits rhoUnits) +{ + // Create configuration + EXPECT_TRUE(appendNode("Configuration", name)); + + // Add Species and Insert nodes + return createAndInsertSpecies(fetchHead(), "Configuration", species, rho, rhoUnits, InsertNode::BoxActionStyle::AddVolume); +} +// Create basic configuration graph, returning the last node +Node *TestGraph::createConfiguration(std::string name, const std::vector> &species, + const Vector3 &cellLengths, const Vector3 &cellAngles) +{ + // Create configuration and SetBox nodes + EXPECT_TRUE(appendNode("Configuration", name)); + EXPECT_TRUE(appendNode("SetBox")); + fetchHead()->setOption("Lengths", cellLengths); + fetchHead()->setOption("Angles", cellAngles); + EXPECT_TRUE(currentGraph_->addEdge({name, "Configuration", "SetBox", "Input"})); + + // Add Species and Insert nodes + return createAndInsertSpecies(fetchHead(), "Output", species, 0.1, Units::DensityUnits::AtomsPerAngstromUnits, + InsertNode::BoxActionStyle::None); +} +// Append a set coordinates node with a structure import input +Node *TestGraph::appendSetCoordinates(std::string_view importNodeType, std::string filePath, std::string sourceOutpuName) +{ + const auto cfgSourceNode = fetchHead(); + + EXPECT_TRUE(appendNode("SetCoordinates")); + auto structureNode = createNode(importNodeType); + EXPECT_TRUE(structureNode); + EXPECT_TRUE(structureNode->setOption("FilePath", filePath)); + + EXPECT_TRUE(currentGraph_->addEdge({std::string(structureNode->name()), "Structure", "SetCoordinates", "Structure"})); + + EXPECT_TRUE( + currentGraph_->addEdge({std::string(cfgSourceNode->name()), sourceOutpuName, "SetCoordinates", "Configuration"})); + + return head(); +} +// Create a trajectory iterator subgraph +IterableGraph *TestGraph::appendTrajectoryIterator(std::string trajectoryImportNodeType, std::string filePath) +{ + // Get current head node before we create the IterableGraph + auto oldHead = head_; + auto oldGraph = currentGraph_; + + // Add iterator node and make it the current graph + currentGraph_ = dynamic_cast(appendNode("Iterator", "Iterator")); + EXPECT_TRUE(currentGraph_); + head_ = nullptr; + + // Create a dynamic input from the (assumed) "Configuration" output on the old head of the previous graph + EXPECT_TRUE(oldGraph->addEdge({std::string(oldHead->name()), "Configuration", "Iterator", "Configuration"})); + + // Within the iterator graph create SetCoordinates and trajectory import nodes + auto trajectoryNode = appendNode(trajectoryImportNodeType); + EXPECT_TRUE(trajectoryNode); + EXPECT_TRUE(trajectoryNode->setOption("FilePath", filePath)); + EXPECT_TRUE(appendNode("SetCoordinates")); + + EXPECT_TRUE(currentGraph_->addEdge({std::string(trajectoryNode->name()), "Structure", "SetCoordinates", "Structure"})); + + EXPECT_TRUE(currentGraph_->addEdge({"Inputs", "Configuration", "SetCoordinates", "Configuration"})); + + return dynamic_cast(currentGraph_); +} +// Append GR and SQ nodes +std::pair TestGraph::appendGRSQ(bool noAveraging, bool noIntraBroadening) +{ + // Create and setup the GR node + auto grNode = dynamic_cast(createNode("GR")); + EXPECT_TRUE(grNode); + if (noAveraging) + EXPECT_TRUE(grNode->setOption("Averaging", std::optional())); + if (noIntraBroadening) + EXPECT_TRUE(grNode->setOption("IntraBroadening", Function1DWrapper())); + + EXPECT_TRUE(currentGraph_->addEdge({std::string(fetchHead()->name()), "Configuration", "GR", "Configuration"})); + + // Create the SQ node + auto sqNode = dynamic_cast(createNode("SQ")); + EXPECT_TRUE(sqNode); + EXPECT_TRUE(currentGraph_->addEdge({"GR", "UnweightedGR", "SQ", "UnweightedGR"})); + + return {grNode, sqNode}; +} +// Create a NeutronSQ node with optional reference data +NeutronSQNode *TestGraph::appendNeutronSQ(SQNode *sqNode, std::string name, + const std::vector> isotopologues, + std::string referenceData, bool isHistogram) +{ + // Construct the isotopologue set + IsotopologueSet isotopologueSet; + for (auto &&[speciesName, isotopologueName, relativeWeight] : isotopologues) + { + // Find the named species node + auto speciesNode = dynamic_cast(findNode(speciesName)); + if (!speciesNode) + { + std::cout << std::format("No species named '{}' exists in the graph - can't construct IsotopologueSet\n", + speciesName); + return nullptr; + } + auto &species = speciesNode->species(); + auto isotopologue = species.findIsotopologue(isotopologueName); + if (!isotopologue) + { + std::cout << std::format("No isotopologue named '{}' exists in species '{}' - can't construct IsotopologueSet\n", + isotopologueName, speciesName); + return nullptr; + } + isotopologueSet.add(isotopologue, relativeWeight); + } + + EXPECT_TRUE(appendNode("NeutronSQ", name)); + EXPECT_TRUE(fetchHead()->setOption("Isotopologues", isotopologueSet)); + EXPECT_TRUE(currentGraph_->addEdge({std::string(sqNode->name()), "UnweightedGR", name, "UnweightedGR"})); + EXPECT_TRUE(currentGraph_->addEdge({std::string(sqNode->name()), "UnweightedSQ", name, "UnweightedSQ"})); + + // Set reference F(Q) data + if (!referenceData.empty()) + { + auto data1DImportNode = createNode("ImportXYData", std::format("Reference-{}", name)); + EXPECT_TRUE(data1DImportNode); + EXPECT_TRUE(data1DImportNode->setOption("FilePath", std::string(referenceData))); + EXPECT_TRUE(data1DImportNode->setOption("Histogram", isHistogram)); + EXPECT_TRUE(currentGraph_->addEdge({std::format("Reference-{}", name), "Data", name, "ReferenceData"})); + } + + return head(); +} +// Create an XRaySQ node with optional reference data +XRaySQNode *TestGraph::appendXRaySQ(SQNode *sqNode, std::string name, std::string referenceData, bool isHistogram) +{ + EXPECT_TRUE(appendNode("XRaySQ", name)); + EXPECT_TRUE(currentGraph_->addEdge({std::string(sqNode->name()), "UnweightedGR", name, "UnweightedGR"})); + EXPECT_TRUE(currentGraph_->addEdge({std::string(sqNode->name()), "UnweightedSQ", name, "UnweightedSQ"})); + + // Set reference F(Q) data + if (!referenceData.empty()) + { + auto data1DImportNode = createNode("ImportXYData", std::format("Reference-{}", name)); + EXPECT_TRUE(data1DImportNode); + EXPECT_TRUE(data1DImportNode->setOption("FilePath", std::string(referenceData))); + EXPECT_TRUE(data1DImportNode->setOption("Histogram", isHistogram)); + EXPECT_TRUE(currentGraph_->addEdge({std::format("Reference-{}", name), "Data", name, "ReferenceData"})); + } + return head(); +} +}; // namespace UnitTest diff --git a/tests/testGraph.h b/tests/testGraph.h new file mode 100644 index 0000000000..7c14f9ac3a --- /dev/null +++ b/tests/testGraph.h @@ -0,0 +1,89 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +// Copyright (c) 2026 Team Dissolve and contributors + +#pragma once + +#include "base/units.h" +#include "kernels/common.h" +#include "nodes/dissolve.h" +#include "tests/testing.h" +#include + +// Forward Declarations +class GRNode; +class IterableGraph; +class SpeciesNode; +class NeutronSQNode; +class SQNode; +class XRaySQNode; + +namespace UnitTest +{ +// Basic object setup for any Graph-based test +class TestGraph : public DissolveGraph +{ + public: + TestGraph() : currentGraph_(this) + { + setEcho(true); + PairPotential::setChargeSource(PairPotential::ChargeSource::Automatic); + } + ~TestGraph() { exportMermaidGraph(*this); } + + private: + // Current graph target + Graph *currentGraph_{nullptr}; + // Most recently appended node in the current graph + Node *head_{nullptr}; + + /* + * Graph Creation Helpers + */ + public: + // Returns pointer to current top node in graph + Node *fetchHead() const; + // Returns the name of the current head node in the graph + std::string fetchHeadName() const; + // Returns reference to current top node in graph, cast to the known node type + template NodeType *head() const { return static_cast(head_); } + // Append new node to the graph + Node *appendNode(const std::string &nodeType, const std::optional &name = {}); + // Create species insertion node chain + Node *createAndInsertSpecies(Node *cfgSourceNode, std::string cfgSourceOutput, + const std::vector> &species, double rho, + Units::DensityUnits rhoUnits = Units::DensityUnits::AtomsPerAngstromUnits, + InsertNode::BoxActionStyle boxActionStyle = InsertNode::BoxActionStyle::AddVolume); + + public: + // Create and return atomic SpeciesNode + static std::unique_ptr createAtomicSpecies(Elements::Element element, + InteractionPotential potential = { + ShortRangeFunctions::Form::Undefined, ""}); + // Create species from TOML file + static std::unique_ptr loadTOMLSpecies(std::string_view path); + // Create a species node with structure and forcefield data sources + SpeciesNode *createSpeciesFromStructureAndForcefield(std::string name, std::string structureNodeType, + std::string structureFilePath, std::shared_ptr ff, + bool calculateBonding = true); + // Create basic configuration graph, returning the last node + Node *createConfiguration(std::string name, const std::vector> &species, double rho, + Units::DensityUnits rhoUnits = Units::DensityUnits::AtomsPerAngstromUnits); + // Create basic configuration graph, returning the last node + Node *createConfiguration(std::string name, const std::vector> &species, + const Vector3 &cellLengths, const Vector3 &cellAngles = {90.0, 90.0, 90.0}); + // Append a set coordinates node with a structure import input + Node *appendSetCoordinates(std::string_view importNodeType, std::string filePath, + std::string sourceOutpuName = "Configuration"); + // Create a trajectory iterator subgraph + IterableGraph *appendTrajectoryIterator(std::string trajectoryImportNodeType, std::string filePath); + // Append GR and SQ nodes + std::pair appendGRSQ(bool noAveraging = false, bool noIntraBroadening = false); + // Create a NeutronSQ node with optional reference data + NeutronSQNode *appendNeutronSQ(SQNode *sqNode, std::string name, + const std::vector> isotopologues = {}, + std::string referenceData = {}, bool isHistogram = false); + // Create an XRaySQ node with optional reference data + XRaySQNode *appendXRaySQ(SQNode *sqNode, std::string name, + std::string referenceData = {}, bool isHistogram = false); +}; +}; // namespace UnitTest diff --git a/tests/testing.cpp b/tests/testing.cpp new file mode 100644 index 0000000000..40a3e93965 --- /dev/null +++ b/tests/testing.cpp @@ -0,0 +1,344 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +// Copyright (c) 2026 Team Dissolve and contributors + +#include "tests/testing.h" +#include "classes/species.h" +#include "kernels/energy.h" +#include "kernels/force.h" +#include "nodes/importXYData.h" +#include + +namespace UnitTest +{ +/* + * Checks + */ + +// Test simple double +[[nodiscard]] bool testDouble(std::string_view quantity, double A, double B, double threshold) +{ + auto delta = fabs(A - B); + auto isOK = delta <= threshold; + Messenger::print("Reference {} delta with correct value is {:15.9e} and is {} (threshold is {:10.3e})\n", quantity, delta, + isOK ? "OK" : "NOT OK", threshold); + return isOK; +} +// Test sampled double +[[nodiscard]] bool testSampledDouble(std::string_view quantity, SampledDouble A, double B, double threshold) +{ + return testDouble(quantity, A.value(), B, threshold); +} +// Test Data1D +[[nodiscard]] bool testData1D(const Data1D &dataA, std::string_view nameA, const Data1D &dataB, std::string_view nameB, + double tolerance, Error::ErrorType errorType) +{ + // Generate the error estimate and compare against the threshold value + auto error = Error::error(errorType, dataA, dataB).error; + auto notOK = std::isnan(error) || error > tolerance; + Messenger::print("Data '{}' has error of {:7.3e} with data '{}' and is {} (threshold is {:6.3e}).\n", nameA, error, nameB, + notOK ? "NOT OK" : "OK", tolerance); + return !notOK; +} +[[nodiscard]] bool testData1D(const Data1D &dataA, std::string_view nameA, std::string filePath, int xColumn, int yColumn, + double tolerance, Error::ErrorType errorType) +{ + Data1D dataB; + if (!ImportXYDataNode::read(dataB, filePath, xColumn, yColumn)) + { + std::cout << std::format("Failed to read data from '{}'\n", filePath); + return false; + } + + return testData1D(dataA, nameA, dataB, filePath, tolerance, errorType); +} +// Test Data2D +[[nodiscard]] bool testData2D(const Data2D &dataA, std::string_view nameA, const Data2D &dataB, std::string_view nameB, + double tolerance, Error::ErrorType errorType) +{ + // Generate the error estimate and compare against the threshold value + auto error = Error::error(errorType, dataA.values().linearArray(), dataB.values().linearArray()).error; + auto notOK = std::isnan(error) || error > tolerance; + Messenger::print("Data '{}' has error of {:7.3f} with data '{}' and is {} (threshold is {:6.3e})\n\n", nameA, error, nameB, + notOK ? "NOT OK" : "OK", tolerance); + + return !notOK; +} +// Test Data3D +[[nodiscard]] bool testData3D(const Data3D &dataA, std::string_view nameA, const Data3D &dataB, std::string_view nameB, + double tolerance, Error::ErrorType errorType) +{ + // Generate the error estimate and compare against the threshold value + auto error = Error::error(errorType, dataA.values().linearArray(), dataB.values().linearArray()).error; + auto notOK = std::isnan(error) || error > tolerance; + Messenger::print("Internal data '{}' has error of {:7.3f} with external data '{}' and is {} (threshold is {:6.3e})\n\n", + nameA, error, nameB, notOK ? "NOT OK" : "OK", tolerance); + + return !notOK; +} +// Test Vec3 data +void testVec3(const Vector3 &A, const Vector3 &B, double tolerance) +{ + EXPECT_NEAR(A.x, B.x, tolerance); + EXPECT_NEAR(A.y, B.y, tolerance); + EXPECT_NEAR(A.z, B.z, tolerance); +} +// Test Vec3 vector data +void testVec3Vector(const std::vector &A, const std::vector &B, double tolerance) +{ + ASSERT_EQ(A.size(), B.size()); + for (auto n = 0; n < A.size(); ++n) + testVec3(A[n], B[n], tolerance); +} +// Test species atom type +void testSpeciesAtomType(Species *sp, const std::map &namesById) +{ + for (auto &[atomIndex, atomTypeName] : namesById) + { + ASSERT_TRUE(atomIndex >= 0 && atomIndex < sp->nAtoms()); + auto &spAtom = sp->atom(atomIndex); + auto at = spAtom.atomType(); + ASSERT_TRUE(at); + EXPECT_EQ(at->name(), atomTypeName); + } +} +// Test interaction parameters +template +void checkIntramolecularTerms(const std::string &termInfo, const InteractionPotential &expectedParams, + const InteractionPotential &actualParams, double tolerance) +{ + Messenger::print("Testing intramolecular interaction: {}...\n", termInfo); + EXPECT_EQ(Intra::forms().keyword(actualParams.form()), Intra::forms().keyword(expectedParams.form())); + EXPECT_EQ(actualParams.nParameters(), expectedParams.nParameters()); + for (auto &&[current, expected] : zip(actualParams.parameters(), expectedParams.parameters())) + EXPECT_NEAR(current, expected, tolerance); +} +// Test species bond term +void testSpeciesIntramolecular(Species *sp, std::vector atoms, const InteractionPotential &expectedParams, + double tolerance) +{ + ASSERT_TRUE(atoms.size() == 2); + const auto &b = sp->getBond(&sp->atoms()[atoms[0]], &sp->atoms()[atoms[1]]); + if (!b) + throw(std::runtime_error(std::format("No bond {} exists in species '{}'.\n", joinStrings(atoms, "-"), sp->name()))); + checkIntramolecularTerms(std::format("bond {}", joinStrings(atoms, "-")), expectedParams, b->get().interactionPotential(), + tolerance); +} +// Test species angle term +void testSpeciesIntramolecular(Species *sp, std::vector atoms, const InteractionPotential &expectedParams, + double tolerance) +{ + ASSERT_TRUE(atoms.size() == 3); + const auto &a = sp->getAngle(&sp->atoms()[atoms[0]], &sp->atoms()[atoms[1]], &sp->atoms()[atoms[2]]); + if (!a) + throw(std::runtime_error(std::format("No angle {} exists in species '{}'.\n", joinStrings(atoms, "-"), sp->name()))); + checkIntramolecularTerms(std::format("angle {}", joinStrings(atoms, "-")), expectedParams, a->get().interactionPotential(), + tolerance); +} +// Test species torsion / improper term +void testSpeciesIntramolecular(Species *sp, std::vector atoms, + const InteractionPotential &expectedParams, double tolerance) +{ + ASSERT_TRUE(atoms.size() == 4); + const auto &t = + sp->getTorsion(&sp->atoms()[atoms[0]], &sp->atoms()[atoms[1]], &sp->atoms()[atoms[2]], &sp->atoms()[atoms[3]]); + const auto &i = + sp->getImproper(&sp->atoms()[atoms[0]], &sp->atoms()[atoms[1]], &sp->atoms()[atoms[2]], &sp->atoms()[atoms[3]]); + if (!t && !i) + throw(std::runtime_error( + std::format("No torsion or improper {} exists in species '{}'.\n", joinStrings(atoms, "-"), sp->name()))); + else if (t) + checkIntramolecularTerms(std::format("torsion {}", joinStrings(atoms, "-")), expectedParams, + t->get().interactionPotential(), tolerance); + else + checkIntramolecularTerms(std::format("improper {}", joinStrings(atoms, "-")), expectedParams, + i->get().interactionPotential(), tolerance); +} +// Test consistency between the two supplied double-keyed Data1D maps +bool testDoubleKeyedMap(std::string_view mapContents, const DoubleKeyedMap &mapA, const DoubleKeyedMap &mapB, + double testThreshold) +{ + // Check map sizes + if (mapA.size() != mapB.size()) + { + std::cout << std::format("Maps containing {} data are of dissimilar size (A = {}, B = {})\n", mapContents, mapA.size(), + mapB.size()); + return false; + } + + // Check individual data + for (auto &[key, dataA] : mapA) + { + // Find same-keyed data in mapB + if (mapB.contains(key)) + { + auto errorReport = Error::percent(dataA, mapB.get(key)); + std::cout << Error::errorReportString(errorReport) << std::endl; + std::cout << std::format("{} '{}' in map B has {} error of {:7.3f}{} with data in map A and is " + "{} (threshold is {:6.3f}%)\n\n", + mapContents, key, Error::errorTypes().keyword(errorReport.errorType), errorReport.error, + errorReport.errorType == Error::ErrorType::PercentError ? "%" : "", + errorReport.error <= testThreshold ? "OK" : "NOT OK", testThreshold); + if (errorReport.error > testThreshold) + return false; + } + else + { + std::cout << std::format("{} '{}' is present in map A but not in map B.\n", mapContents, key); + return false; + } + } + + return true; +} +// Test consistency, and error, between supplied partial sets +bool testPartialSet(const PartialSet &setA, const PartialSet &setB, double testThreshold) +{ + // Full partials + if (!testDoubleKeyedMap("Full Partials", setA.partials(), setB.partials(), testThreshold)) + return false; + + // Bound partials + if (!testDoubleKeyedMap("Bound Partials", setA.boundPartials(), setB.boundPartials(), testThreshold)) + return false; + + // Unbound partials + if (!testDoubleKeyedMap("Unbound Partials", setA.unboundPartials(), setB.unboundPartials(), testThreshold)) + return false; + + // Total + auto errorReport = Error::percent(setA.total(), setB.total()); + std::cout << Error::errorReportString(errorReport) << std::endl; + std::cout << std::format( + "Total in set B has {} error of {:7.3f}{} with data in set A and is {} (threshold is {:6.3f}%)\n\n", + Error::errorTypes().keyword(errorReport.errorType), errorReport.error, + errorReport.errorType == Error::ErrorType::PercentError ? "%" : "", + errorReport.error <= testThreshold ? "OK" : "NOT OK", testThreshold); + if (errorReport.error > testThreshold) + return false; + + return true; +} + +// Check consistency between production, molecular, and test energies, returning production values +Kernel::EnergyResult testEnergyConsistency(const std::unique_ptr &kernel, double testThreshold) +{ + // Calculate production energies (fully optimised) + auto productionEnergy = kernel->totalEnergy(); + + // Calculate baseline test energies (simple double-loop, PBC always) + auto testEnergy = kernel->totalEnergySimple(); + + // Calculate molecule-centric energy + auto molecularPPEnergy = kernel->totalMoleculePairPotentialEnergy(); + + // Compare basic energies with production value + EXPECT_NEAR(testEnergy.pairPotential.interMolecular, productionEnergy.pairPotential.interMolecular, testThreshold); + EXPECT_NEAR(testEnergy.pairPotential.intraMolecular, productionEnergy.pairPotential.intraMolecular, testThreshold); + EXPECT_NEAR(testEnergy.geometry.total(), productionEnergy.geometry.total(), testThreshold); + + // Compare basic energies with molecule-based values + EXPECT_NEAR(testEnergy.pairPotential.total(), molecularPPEnergy.total(), testThreshold); + EXPECT_NEAR(testEnergy.pairPotential.interMolecular, molecularPPEnergy.interMolecular, testThreshold); + + // Compare molecule-based energies with production values + EXPECT_NEAR(molecularPPEnergy.total(), productionEnergy.pairPotential.total(), testThreshold); + EXPECT_NEAR(molecularPPEnergy.interMolecular, productionEnergy.pairPotential.interMolecular, testThreshold); + + return productionEnergy; +} + +// Check consistency between production and test forces +void testForceConsistency(const std::unique_ptr &kernel, std::vector &ppForces, + std::vector &geomForces, Flags flags, double ppMaxDeviation, + double geomMaxDeviation) +{ + // Calculate production forces (fully optimised) + kernel->totalForces(ppForces, geomForces, flags); + + // Calculate baseline test forces (simple double-loop, PBC always) + std::vector ppTestForces, geomTestForces; + kernel->totalForcesSimple(ppTestForces, geomTestForces, flags); + + // Pair potential forces + if (!(flags.isSet(Kernel::CalculationFlags::ExcludeInterMolecularPairPotential) && + flags.isSet(Kernel::CalculationFlags::ExcludeIntraMolecularPairPotential))) + for (auto &&[pairPotentialTestForce, pairPotentialProductionForce] : zip(ppTestForces, ppForces)) + { + EXPECT_NEAR(pairPotentialProductionForce.x, pairPotentialTestForce.x, ppMaxDeviation); + EXPECT_NEAR(pairPotentialProductionForce.y, pairPotentialTestForce.y, ppMaxDeviation); + EXPECT_NEAR(pairPotentialProductionForce.z, pairPotentialTestForce.z, ppMaxDeviation); + } + + // Geometric forces + if (flags.isNotSet(Kernel::CalculationFlags::ExcludeGeometric)) + for (auto &&[geometryTestForce, geometryProductionForce] : zip(geomTestForces, geomForces)) + { + EXPECT_NEAR(geometryProductionForce.x, geometryTestForce.x, geomMaxDeviation); + EXPECT_NEAR(geometryProductionForce.y, geometryTestForce.y, geomMaxDeviation); + EXPECT_NEAR(geometryProductionForce.z, geometryTestForce.z, geomMaxDeviation); + } +} + +// Check consistency of supplied forces +void testReferenceForceConsistency(const std::vector &ppForces, const std::vector &geomForces, + const std::vector &referenceForces, double maxDeviation) +{ + ASSERT_TRUE(ppForces.size() == geomForces.size()); + ASSERT_TRUE(ppForces.size() == referenceForces.size()); + + for (auto &&[ppForce, geometryForce, referenceForce] : zip(ppForces, geomForces, referenceForces)) + { + auto calculatedForce = ppForce + geometryForce; + EXPECT_NEAR(calculatedForce.x, referenceForce.x, maxDeviation); + EXPECT_NEAR(calculatedForce.y, referenceForce.y, maxDeviation); + EXPECT_NEAR(calculatedForce.z, referenceForce.z, maxDeviation); + } +} + +/* + * TOML + */ + +// Compare TOML values with context, but without insisting on a specific ordering of fields +void compareToml(std::string location, SerialisedValue toml, SerialisedValue toml2) +{ + if (toml.is_table()) + { + ASSERT_TRUE(toml2.is_table()) << location; + for (auto &[k, v] : toml.as_table()) + { + ASSERT_TRUE(toml2.contains(k)) << location << "." << k << std::endl << "Expected:" << std::endl << toml[k]; + compareToml(std::format("{}.{}", location, k), v, toml2.at(k)); + } + } + else if (toml.is_array()) + { + auto arr = toml.as_array(); + auto arr2 = toml2.as_array(); + ASSERT_EQ(arr.size(), arr2.size()) << location << std::endl << "Expected" << std::endl << toml; + for (int i = 0; i < arr.size(); ++i) + compareToml(std::format("{}[{}]", location, i), arr[i], arr2[i]); + } + else + { + EXPECT_EQ(toml, toml2) << location; + } +} + +/* + * Utility Functions + */ + +// Save the specified graph in Mermaid format to a file named after the unit test +void exportMermaidGraph(Graph &graph) +{ + auto suite = ::testing::UnitTest::GetInstance()->current_test_info()->test_suite_name(); + auto name = ::testing::UnitTest::GetInstance()->current_test_info()->name(); + std::string filename = std::format("{}-{}.mermaid", suite, name); + + std::ofstream myfile; + myfile.open(filename); + myfile << graph; + myfile.close(); +} +}; // namespace UnitTest diff --git a/tests/testing.h b/tests/testing.h new file mode 100644 index 0000000000..3d04d7aaec --- /dev/null +++ b/tests/testing.h @@ -0,0 +1,103 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +// Copyright (c) 2026 Team Dissolve and contributors + +#pragma once + +#include "base/units.h" +#include "classes/partialSet.h" +#include "kernels/common.h" +#include "math/data1D.h" +#include "math/data2D.h" +#include "math/data3D.h" +#include "math/error.h" +#include "nodes/dissolve.h" +#include "nodes/insert.h" +#include + +// Forward Declarations +class GRNode; +class IterableGraph; +class SpeciesNode; +class NeutronSQNode; +class SQNode; +class XRaySQNode; + +namespace UnitTest +{ +/* + * Utility Functions + */ + +// Save the specified graph in Mermaid format to a file named after the unit test +void exportMermaidGraph(Graph &graph); + +/* + * Data Test Functions + */ + +// Test simple double +[[nodiscard]] bool testDouble(std::string_view quantity, double A, double B, double threshold); +// Test sampled double +[[nodiscard]] bool testSampledDouble(std::string_view quantity, SampledDouble A, double B, double threshold); +// Test Data1D +[[nodiscard]] bool testData1D(const Data1D &dataA, std::string_view nameA, const Data1D &dataB, std::string_view nameB, + double tolerance = 5.0e-3, Error::ErrorType errorType = Error::ErrorType::EuclideanError); +[[nodiscard]] bool testData1D(const Data1D &dataA, std::string_view nameA, std::string filePath, int xColumn, int yColumn, + double tolerance = 5.0e-3, Error::ErrorType errorType = Error::ErrorType::EuclideanError); +// Test Data2D +[[nodiscard]] bool testData2D(const Data2D &dataA, std::string_view nameA, const Data2D &dataB, std::string_view nameB, + double tolerance = 5.0e-3, Error::ErrorType errorType = Error::ErrorType::EuclideanError); +// Test Data3D +[[nodiscard]] bool testData3D(const Data3D &dataA, std::string_view nameA, const Data3D &dataB, std::string_view nameB, + double tolerance = 5.0e-3, Error::ErrorType errorType = Error::ErrorType::EuclideanError); +// Test Vec3 data +void testVec3(const Vector3 &A, const Vector3 &B, double tolerance = 1.0e-6); +// Test Vec3 vector data +void testVec3Vector(const std::vector &A, const std::vector &B, double tolerance = 1.0e-6); +// Test species atom type +void testSpeciesAtomType(Species *sp, const std::map &namesById); +// Test interaction parameters +template +void checkIntramolecularTerms(const std::string &termInfo, const InteractionPotential &expectedParams, + const InteractionPotential &actualParams, double tolerance = 1.0e-6); +// Test species bond term +void testSpeciesIntramolecular(Species *sp, std::vector atoms, const InteractionPotential &expectedParams, + double tolerance = 1.0e-6); +// Test species angle term +void testSpeciesIntramolecular(Species *sp, std::vector atoms, const InteractionPotential &expectedParams, + double tolerance = 1.0e-6); +// Test species torsion / improper term +void testSpeciesIntramolecular(Species *sp, std::vector atoms, + const InteractionPotential &expectedParams, double tolerance = 1.0e-6); +// Test consistency between the two supplied double-keyed Data1D maps +static bool testDoubleKeyedMap(std::string_view mapContents, const DoubleKeyedMap &mapA, + const DoubleKeyedMap &mapB, double testThreshold); +// Test consistency, and error, between supplied partial sets +bool testPartialSet(const PartialSet &setA, const PartialSet &setB, double testThreshold); +// Check consistency between production, molecular, and test energies, returning production values +Kernel::EnergyResult testEnergyConsistency(const std::unique_ptr &kernel, double testThreshold = 1.0e-6); +// Check consistency between production and test forces +void testForceConsistency(const std::unique_ptr &kernel, std::vector &ppForces, + std::vector &geomForces, Flags flags = {}, + double ppMaxDeviation = 1.0e-2, double geomMaxDeviation = 1.0e-6); +// Check consistency of supplied forces +void testReferenceForceConsistency(const std::vector &ppForces, const std::vector &geomForces, + const std::vector &referenceForces, double maxDeviation = 1.0e-3); + +/* + * TOML + */ + +// Comparie TOML values with context, but without insisting on a specific ordering of fields +void compareToml(std::string location, SerialisedValue toml, SerialisedValue toml2); +// Perform round-trip serialisation of A into B +template void tomlRoundTrip(T &a, T &b) +{ + SerialisedValue serialised; + auto s = std::make_shared>("data", a); + ASSERT_NO_THROW(serialised = s->serialise()); + + auto d = std::make_shared>("data", b); + ASSERT_NO_THROW(d->deserialise(serialised)); +} +}; // namespace UnitTest diff --git a/tests/workflows/phantomAtoms.cpp b/tests/workflows/phantomAtoms.cpp index 0b79e67c16..f8043cfe6d 100644 --- a/tests/workflows/phantomAtoms.cpp +++ b/tests/workflows/phantomAtoms.cpp @@ -2,9 +2,12 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "data/atomicMasses.h" -#include "tests/graphData.h" -#include "tests/testData.h" -#include +#include "nodes/gr.h" +#include "nodes/neutronSQ.h" +#include "nodes/species.h" +#include "nodes/sq.h" +#include "nodes/xRaySQ.h" +#include "tests/testGraph.h" namespace UnitTest { @@ -92,65 +95,54 @@ TEST(PhantomAtomsTest, Water) auto rawGR = grNode->getOutputValue("RawGR"); // Partial g(r) (unbound terms) - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("OW", "OW")), - "OW-OW Unbound Partial", "epsr25/water1000-neutron/water.EPSR.g01", 1, 2, - 6.0e-2)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("HW", "OW")), - "HW-OW Unbound Partial", "epsr25/water1000-neutron/water.EPSR.g01", 1, 4, - 2.0e-2)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("HW", "HW")), - "HW-HW Unbound Partial", "epsr25/water1000-neutron/water.EPSR.g01", 1, 6, - 2.0e-2)); + EXPECT_TRUE(testData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("OW", "OW")), "OW-OW Unbound Partial", + "epsr25/water1000-neutron/water.EPSR.g01", 1, 2, 6.0e-2)); + EXPECT_TRUE(testData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("HW", "OW")), "HW-OW Unbound Partial", + "epsr25/water1000-neutron/water.EPSR.g01", 1, 4, 2.0e-2)); + EXPECT_TRUE(testData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("HW", "HW")), "HW-HW Unbound Partial", + "epsr25/water1000-neutron/water.EPSR.g01", 1, 6, 2.0e-2)); // Partial g(r) (intramolecular terms) - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("OW", "OW")), - "OW-OW Bound Partial", "epsr25/water1000-neutron/water.EPSR.y01", 1, 2, 1.0e-5, - Error::ErrorType::RMSEError)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("HW", "OW")), - "HW-OW Bound Partial", "epsr25/water1000-neutron/water.EPSR.y01", 1, 4, 0.1)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("HW", "HW")), - "HW-HW Bound Partial", "epsr25/water1000-neutron/water.EPSR.y01", 1, 6, - 1.5e-2)); + EXPECT_TRUE(testData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("OW", "OW")), "OW-OW Bound Partial", + "epsr25/water1000-neutron/water.EPSR.y01", 1, 2, 1.0e-5, Error::ErrorType::RMSEError)); + EXPECT_TRUE(testData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("HW", "OW")), "HW-OW Bound Partial", + "epsr25/water1000-neutron/water.EPSR.y01", 1, 4, 0.1)); + EXPECT_TRUE(testData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("HW", "HW")), "HW-HW Bound Partial", + "epsr25/water1000-neutron/water.EPSR.y01", 1, 6, 1.5e-2)); // Get the SQ auto unweightedSQ = sqNode->getOutputValue("UnweightedSQ"); ASSERT_TRUE(unweightedSQ); // Partial S(Q) (unbound terms) - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("OW", "OW")), - "OW-OW Unbound Partial", "epsr25/water1000-neutron/water.EPSR.f01", 1, 2, - 1.0e-3)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("OW", "HW")), - "OW-HW Unbound Partial", "epsr25/water1000-neutron/water.EPSR.f01", 1, 4, - 3.0e-3)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("HW", "HW")), - "HW-HW Unbound Partial", "epsr25/water1000-neutron/water.EPSR.f01", 1, 6, - 3.0e-3)); + EXPECT_TRUE(testData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("OW", "OW")), "OW-OW Unbound Partial", + "epsr25/water1000-neutron/water.EPSR.f01", 1, 2, 1.0e-3)); + EXPECT_TRUE(testData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("OW", "HW")), "OW-HW Unbound Partial", + "epsr25/water1000-neutron/water.EPSR.f01", 1, 4, 3.0e-3)); + EXPECT_TRUE(testData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("HW", "HW")), "HW-HW Unbound Partial", + "epsr25/water1000-neutron/water.EPSR.f01", 1, 6, 3.0e-3)); // Partial S(Q) (intramolecular terms) - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("OW", "HW")), - "OW-HW Bound Partial", "epsr25/water1000-neutron/water.EPSR.s01", 1, 4, - 1.0e-4)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("HW", "HW")), - "HW-HW Bound Partial", "epsr25/water1000-neutron/water.EPSR.s01", 1, 6, - 4.0e-5)); + EXPECT_TRUE(testData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("OW", "HW")), "OW-HW Bound Partial", + "epsr25/water1000-neutron/water.EPSR.s01", 1, 4, 1.0e-4)); + EXPECT_TRUE(testData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("HW", "HW")), "HW-HW Bound Partial", + "epsr25/water1000-neutron/water.EPSR.s01", 1, 6, 4.0e-5)); // Partial S(Q) (intramolecular terms) - EXPECT_TRUE(DissolveSystemTest::checkData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("OW", "OW")), - "OW-OW Bound Partial", "epsr25/water1000-neutron/water.EPSR.s01", 1, 2, 1.0e-5, - Error::ErrorType::RMSEError)); + EXPECT_TRUE(testData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("OW", "OW")), "OW-OW Bound Partial", + "epsr25/water1000-neutron/water.EPSR.s01", 1, 2, 1.0e-5, Error::ErrorType::RMSEError)); // Total F(Q) - EXPECT_TRUE(DissolveSystemTest::checkData1D(D2O->getOutputValue("WeightedSQ")->total(), "D2O F(Q)", - "epsr25/water1000-neutron/water.EPSR.u01", 1, 2, 3.0e-4)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(H2O->getOutputValue("WeightedSQ")->total(), "H2O F(Q)", - "epsr25/water1000-neutron/water.EPSR.u01", 1, 4, 6.0e-4)); - EXPECT_TRUE(DissolveSystemTest::checkData1D(HDO->getOutputValue("WeightedSQ")->total(), "HDO F(Q)", - "epsr25/water1000-neutron/water.EPSR.u01", 1, 6, 2.0e-5)); + EXPECT_TRUE(testData1D(D2O->getOutputValue("WeightedSQ")->total(), "D2O F(Q)", + "epsr25/water1000-neutron/water.EPSR.u01", 1, 2, 3.0e-4)); + EXPECT_TRUE(testData1D(H2O->getOutputValue("WeightedSQ")->total(), "H2O F(Q)", + "epsr25/water1000-neutron/water.EPSR.u01", 1, 4, 6.0e-4)); + EXPECT_TRUE(testData1D(HDO->getOutputValue("WeightedSQ")->total(), "HDO F(Q)", + "epsr25/water1000-neutron/water.EPSR.u01", 1, 6, 2.0e-5)); // Total F(Q) - EXPECT_TRUE(DissolveSystemTest::checkData1D(H2Ox->getOutputValue("WeightedSQ")->total(), "H2Ox F(Q)", - "epsr25/water1000-neutron-xray/water.EPSR.u01", 1, 8, 1.5e-4)); + EXPECT_TRUE(testData1D(H2Ox->getOutputValue("WeightedSQ")->total(), "H2Ox F(Q)", + "epsr25/water1000-neutron-xray/water.EPSR.u01", 1, 8, 1.5e-4)); } } // namespace UnitTest