From 7e1b2147e298d48a0cf6526f365087ede5fae568 Mon Sep 17 00:00:00 2001 From: Tristan Youngs Date: Tue, 23 Jun 2026 16:43:48 +0100 Subject: [PATCH 1/7] Break out test function from header into source file, rename. --- tests/CMakeLists.txt | 9 +- tests/classes/cells.cpp | 4 +- tests/classes/cells3.cpp | 4 +- tests/classes/cells4.cpp | 3 +- tests/classes/history.cpp | 2 +- tests/classes/neutronWeights.cpp | 2 +- tests/classes/structure.cpp | 2 +- tests/ff/assignment-Kulmala2010.cpp | 2 +- tests/ff/assignment-Ludwig-py5.cpp | 2 +- tests/ff/assignment-OPLSAA2005-alcohols.cpp | 2 +- tests/ff/assignment-OPLSAA2005-alkanes.cpp | 2 +- tests/ff/assignment-OPLSAA2005-aromatics.cpp | 2 +- tests/ff/assignment-PCL2019-anions.cpp | 2 +- tests/ff/assignment-PCL2019-cations.cpp | 2 +- tests/ff/assignment-SPCFw.cpp | 2 +- tests/ff/assignment-UFF-nmethylformamide.cpp | 2 +- tests/ff/assignment-UFF4MOF-mof5.cpp | 2 +- tests/ff/benzene.cpp | 2 +- tests/ff/cos-n.cpp | 2 +- tests/ff/hexane.cpp | 2 +- tests/ff/water-1000.cpp | 2 +- tests/graphData.h | 363 ------------------- tests/gui/addForcefieldTerms.cpp | 2 +- tests/gui/isotopologueSetModel.cpp | 3 +- tests/nodes/angle.cpp | 2 +- tests/nodes/atomicMC.cpp | 2 +- tests/nodes/averageMolecule.cpp | 2 +- tests/nodes/axisAngle.cpp | 2 +- tests/nodes/bragg.cpp | 2 +- tests/nodes/broadening.cpp | 4 +- tests/nodes/cif.cpp | 3 +- tests/nodes/dAngle.cpp | 2 +- tests/nodes/epsr.cpp | 6 +- tests/nodes/flow.cpp | 2 +- tests/nodes/gr.cpp | 2 +- tests/nodes/graph.cpp | 2 +- tests/nodes/graphArgon.cpp | 5 +- tests/nodes/histogramCN.cpp | 3 +- tests/nodes/intraAngle.cpp | 2 +- tests/nodes/intraDistance.cpp | 2 +- tests/nodes/modifierOSites.cpp | 2 +- tests/nodes/moleculeTorsion.cpp | 2 +- tests/nodes/neutronSQ.cpp | 4 +- tests/nodes/orientedSDF.cpp | 2 +- tests/nodes/parameters.cpp | 2 +- tests/nodes/qSpecies.cpp | 2 +- tests/nodes/sdf.cpp | 2 +- tests/nodes/siteRDF.cpp | 2 +- tests/nodes/sq.cpp | 3 +- tests/nodes/trajectory.cpp | 2 +- tests/nodes/voxelDensity.cpp | 3 +- tests/nodes/xRaySQ.cpp | 2 +- tests/pairPotentials/cutoffs.cpp | 2 +- tests/pairPotentials/overrides.cpp | 4 +- tests/testing.cpp | 325 +++++++++++++++++ tests/testing.h | 111 ++++++ tests/workflows/phantomAtoms.cpp | 6 +- 57 files changed, 524 insertions(+), 417 deletions(-) delete mode 100644 tests/graphData.h create mode 100644 tests/testing.cpp create mode 100644 tests/testing.h diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 18637cc563..8a0946a015 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 testing.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} ${CONAN_INCLUDE_DIRS} +) + # Add unit test subdirectories add_subdirectory(algorithms) add_subdirectory(classes) diff --git a/tests/classes/cells.cpp b/tests/classes/cells.cpp index 788b490642..1fd98b5231 100644 --- a/tests/classes/cells.cpp +++ b/tests/classes/cells.cpp @@ -2,11 +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 "nodes/species.h" +#include "tests/testing.h" #include namespace UnitTest diff --git a/tests/classes/cells3.cpp b/tests/classes/cells3.cpp index 8908ed9a55..7f6169d5fd 100644 --- a/tests/classes/cells3.cpp +++ b/tests/classes/cells3.cpp @@ -1,9 +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 "tests/testing.h" #include namespace UnitTest diff --git a/tests/classes/cells4.cpp b/tests/classes/cells4.cpp index 6742c039fb..21e992702d 100644 --- a/tests/classes/cells4.cpp +++ b/tests/classes/cells4.cpp @@ -1,7 +1,8 @@ // SPDX-License-Identifier: GPL-3.0-or-later // Copyright (c) 2026 Team Dissolve and contributors -#include "tests/graphData.h" +#include "classes/configuration.h" +#include "tests/testing.h" #include namespace UnitTest diff --git a/tests/classes/history.cpp b/tests/classes/history.cpp index 3046f87d21..15832a5f0c 100644 --- a/tests/classes/history.cpp +++ b/tests/classes/history.cpp @@ -3,8 +3,8 @@ #include "math/history.h" #include "nodes/number.h" -#include "tests/graphData.h" #include "tests/testData.h" +#include "tests/testing.h" #include namespace UnitTest diff --git a/tests/classes/neutronWeights.cpp b/tests/classes/neutronWeights.cpp index 1e4b12c922..d0131473aa 100644 --- a/tests/classes/neutronWeights.cpp +++ b/tests/classes/neutronWeights.cpp @@ -3,9 +3,9 @@ #include "classes/neutronWeights.h" #include "classes/isotopologueSet.h" -#include "tests/graphData.h" #include "tests/tempFile.h" #include "tests/testData.h" +#include "tests/testing.h" #include namespace UnitTest diff --git a/tests/classes/structure.cpp b/tests/classes/structure.cpp index e07c5032b5..9ea35e620d 100644 --- a/tests/classes/structure.cpp +++ b/tests/classes/structure.cpp @@ -3,7 +3,7 @@ #include "classes/structure.h" #include "nodes/calculateBonding.h" -#include "tests/graphData.h" +#include "tests/testing.h" #include #include diff --git a/tests/ff/assignment-Kulmala2010.cpp b/tests/ff/assignment-Kulmala2010.cpp index b710da0af8..c6a4e3f131 100644 --- a/tests/ff/assignment-Kulmala2010.cpp +++ b/tests/ff/assignment-Kulmala2010.cpp @@ -2,8 +2,8 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "data/ff/library.h" -#include "tests/graphData.h" #include "tests/testData.h" +#include "tests/testing.h" #include namespace UnitTest diff --git a/tests/ff/assignment-Ludwig-py5.cpp b/tests/ff/assignment-Ludwig-py5.cpp index 0b9317ea40..aad69105e4 100644 --- a/tests/ff/assignment-Ludwig-py5.cpp +++ b/tests/ff/assignment-Ludwig-py5.cpp @@ -2,8 +2,8 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "data/ff/library.h" -#include "tests/graphData.h" #include "tests/testData.h" +#include "tests/testing.h" #include #include diff --git a/tests/ff/assignment-OPLSAA2005-alcohols.cpp b/tests/ff/assignment-OPLSAA2005-alcohols.cpp index c1de39a054..c0c06d3e9a 100644 --- a/tests/ff/assignment-OPLSAA2005-alcohols.cpp +++ b/tests/ff/assignment-OPLSAA2005-alcohols.cpp @@ -2,8 +2,8 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "data/ff/library.h" -#include "tests/graphData.h" #include "tests/testData.h" +#include "tests/testing.h" #include namespace UnitTest diff --git a/tests/ff/assignment-OPLSAA2005-alkanes.cpp b/tests/ff/assignment-OPLSAA2005-alkanes.cpp index 5853c76847..bfe9f43b5c 100644 --- a/tests/ff/assignment-OPLSAA2005-alkanes.cpp +++ b/tests/ff/assignment-OPLSAA2005-alkanes.cpp @@ -2,8 +2,8 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "data/ff/library.h" -#include "tests/graphData.h" #include "tests/testData.h" +#include "tests/testing.h" #include namespace UnitTest diff --git a/tests/ff/assignment-OPLSAA2005-aromatics.cpp b/tests/ff/assignment-OPLSAA2005-aromatics.cpp index 6852574ddb..bcc9e5ad99 100644 --- a/tests/ff/assignment-OPLSAA2005-aromatics.cpp +++ b/tests/ff/assignment-OPLSAA2005-aromatics.cpp @@ -2,8 +2,8 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "data/ff/library.h" -#include "tests/graphData.h" #include "tests/testData.h" +#include "tests/testing.h" #include namespace UnitTest diff --git a/tests/ff/assignment-PCL2019-anions.cpp b/tests/ff/assignment-PCL2019-anions.cpp index 75eff79824..f92d1fdca2 100644 --- a/tests/ff/assignment-PCL2019-anions.cpp +++ b/tests/ff/assignment-PCL2019-anions.cpp @@ -2,8 +2,8 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "data/ff/library.h" -#include "tests/graphData.h" #include "tests/testData.h" +#include "tests/testing.h" #include namespace UnitTest diff --git a/tests/ff/assignment-PCL2019-cations.cpp b/tests/ff/assignment-PCL2019-cations.cpp index 84effeb760..54af3887a3 100644 --- a/tests/ff/assignment-PCL2019-cations.cpp +++ b/tests/ff/assignment-PCL2019-cations.cpp @@ -2,8 +2,8 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "data/ff/library.h" -#include "tests/graphData.h" #include "tests/testData.h" +#include "tests/testing.h" #include namespace UnitTest diff --git a/tests/ff/assignment-SPCFw.cpp b/tests/ff/assignment-SPCFw.cpp index 99a37f5575..cf91d3f460 100644 --- a/tests/ff/assignment-SPCFw.cpp +++ b/tests/ff/assignment-SPCFw.cpp @@ -2,8 +2,8 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "data/ff/library.h" -#include "tests/graphData.h" #include "tests/testData.h" +#include "tests/testing.h" #include namespace UnitTest diff --git a/tests/ff/assignment-UFF-nmethylformamide.cpp b/tests/ff/assignment-UFF-nmethylformamide.cpp index 8cce26b198..7b39fe32b7 100644 --- a/tests/ff/assignment-UFF-nmethylformamide.cpp +++ b/tests/ff/assignment-UFF-nmethylformamide.cpp @@ -2,8 +2,8 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "data/ff/library.h" -#include "tests/graphData.h" #include "tests/testData.h" +#include "tests/testing.h" #include namespace UnitTest diff --git a/tests/ff/assignment-UFF4MOF-mof5.cpp b/tests/ff/assignment-UFF4MOF-mof5.cpp index 239c223c90..4d4323d66c 100644 --- a/tests/ff/assignment-UFF4MOF-mof5.cpp +++ b/tests/ff/assignment-UFF4MOF-mof5.cpp @@ -2,8 +2,8 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "data/ff/library.h" -#include "tests/graphData.h" #include "tests/testData.h" +#include "tests/testing.h" #include namespace UnitTest diff --git a/tests/ff/benzene.cpp b/tests/ff/benzene.cpp index 94a2c0bdf7..4994d6fe0b 100644 --- a/tests/ff/benzene.cpp +++ b/tests/ff/benzene.cpp @@ -3,8 +3,8 @@ #include "kernels/force.h" #include "nodes/dissolve.h" -#include "tests/graphData.h" #include "tests/testData.h" +#include "tests/testing.h" #include namespace UnitTest diff --git a/tests/ff/cos-n.cpp b/tests/ff/cos-n.cpp index 60f39f7770..464c1390a3 100644 --- a/tests/ff/cos-n.cpp +++ b/tests/ff/cos-n.cpp @@ -2,9 +2,9 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "data/ff/library.h" -#include "tests/graphData.h" #include "tests/tempFile.h" #include "tests/testData.h" +#include "tests/testing.h" #include namespace UnitTest diff --git a/tests/ff/hexane.cpp b/tests/ff/hexane.cpp index b6df57a7d3..07606a8e06 100644 --- a/tests/ff/hexane.cpp +++ b/tests/ff/hexane.cpp @@ -3,8 +3,8 @@ #include "kernels/force.h" #include "nodes/dissolve.h" -#include "tests/graphData.h" #include "tests/testData.h" +#include "tests/testing.h" #include namespace UnitTest diff --git a/tests/ff/water-1000.cpp b/tests/ff/water-1000.cpp index f05341bcff..7ac53646c9 100644 --- a/tests/ff/water-1000.cpp +++ b/tests/ff/water-1000.cpp @@ -3,8 +3,8 @@ #include "kernels/force.h" #include "nodes/dissolve.h" -#include "tests/graphData.h" #include "tests/testData.h" +#include "tests/testing.h" #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..b2f464df43 100644 --- a/tests/gui/addForcefieldTerms.cpp +++ b/tests/gui/addForcefieldTerms.cpp @@ -3,7 +3,7 @@ #include "gui/models/addForcefieldDialogModel.h" #include "main/dissolve.h" -#include "tests/graphData.h" +#include "tests/testing.h" #include #include #include diff --git a/tests/gui/isotopologueSetModel.cpp b/tests/gui/isotopologueSetModel.cpp index 0cb35c607e..4b59d534e6 100644 --- a/tests/gui/isotopologueSetModel.cpp +++ b/tests/gui/isotopologueSetModel.cpp @@ -3,7 +3,8 @@ #include "gui/models/isotopologueSetModel.h" #include "classes/isotopologueSet.h" -#include "tests/graphData.h" +#include "classes/species.h" +#include "tests/testing.h" #include namespace UnitTest diff --git a/tests/nodes/angle.cpp b/tests/nodes/angle.cpp index 103dceecae..6da6a6049f 100644 --- a/tests/nodes/angle.cpp +++ b/tests/nodes/angle.cpp @@ -5,8 +5,8 @@ #include "classes/speciesSites.h" #include "math/rangedVector3.h" #include "nodes/iterableGraph.h" -#include "tests/graphData.h" #include "tests/testData.h" +#include "tests/testing.h" #include namespace UnitTest diff --git a/tests/nodes/atomicMC.cpp b/tests/nodes/atomicMC.cpp index fba29cd1f3..6722067bae 100644 --- a/tests/nodes/atomicMC.cpp +++ b/tests/nodes/atomicMC.cpp @@ -6,8 +6,8 @@ #include "nodes/dissolve.h" #include "nodes/insert.h" #include "nodes/iterableGraph.h" -#include "tests/graphData.h" #include "tests/testData.h" +#include "tests/testing.h" #include #include diff --git a/tests/nodes/averageMolecule.cpp b/tests/nodes/averageMolecule.cpp index 235c4bd21e..6aa8167b3f 100644 --- a/tests/nodes/averageMolecule.cpp +++ b/tests/nodes/averageMolecule.cpp @@ -3,8 +3,8 @@ #include "nodes/averageMolecule.h" #include "nodes/iterableGraph.h" -#include "tests/graphData.h" #include "tests/testData.h" +#include "tests/testing.h" #include namespace UnitTest diff --git a/tests/nodes/axisAngle.cpp b/tests/nodes/axisAngle.cpp index 3b66f7b8e5..a8252a2fb0 100644 --- a/tests/nodes/axisAngle.cpp +++ b/tests/nodes/axisAngle.cpp @@ -2,8 +2,8 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "nodes/axisAngle.h" -#include "tests/graphData.h" #include "tests/testData.h" +#include "tests/testing.h" #include namespace UnitTest diff --git a/tests/nodes/bragg.cpp b/tests/nodes/bragg.cpp index 81372ded6a..dffcb1306a 100644 --- a/tests/nodes/bragg.cpp +++ b/tests/nodes/bragg.cpp @@ -8,8 +8,8 @@ #include "nodes/gr.h" #include "nodes/iterableGraph.h" #include "nodes/sq.h" -#include "tests/graphData.h" #include "tests/testData.h" +#include "tests/testing.h" #include #include diff --git a/tests/nodes/broadening.cpp b/tests/nodes/broadening.cpp index 7066ab5086..845718a461 100644 --- a/tests/nodes/broadening.cpp +++ b/tests/nodes/broadening.cpp @@ -3,8 +3,10 @@ #include "math/windowFunction.h" #include "nodes/gr.h" -#include "tests/graphData.h" +#include "nodes/neutronSQ.h" +#include "nodes/sq.h" #include "tests/testData.h" +#include "tests/testing.h" #include namespace UnitTest diff --git a/tests/nodes/cif.cpp b/tests/nodes/cif.cpp index 49516c7486..ca10a18c11 100644 --- a/tests/nodes/cif.cpp +++ b/tests/nodes/cif.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 "classes/empiricalFormula.h" #include "nodes/cif/importCIFStructure.h" -#include "tests/graphData.h" #include "tests/testData.h" +#include "tests/testing.h" #include #include diff --git a/tests/nodes/dAngle.cpp b/tests/nodes/dAngle.cpp index 2ba86e6ce6..6404dde66a 100644 --- a/tests/nodes/dAngle.cpp +++ b/tests/nodes/dAngle.cpp @@ -5,8 +5,8 @@ #include "analyser/dataOperator2D.h" #include "nodes/importDLPUtilsSurface.h" #include "nodes/iterableGraph.h" -#include "tests/graphData.h" #include "tests/testData.h" +#include "tests/testing.h" #include namespace UnitTest diff --git a/tests/nodes/epsr.cpp b/tests/nodes/epsr.cpp index bde978872e..7e84088c3a 100644 --- a/tests/nodes/epsr.cpp +++ b/tests/nodes/epsr.cpp @@ -4,8 +4,12 @@ #include "nodes/epsr.h" #include "classes/configuration.h" #include "main/dissolve.h" -#include "tests/graphData.h" +#include "nodes/gr.h" +#include "nodes/neutronSQ.h" +#include "nodes/sq.h" +#include "nodes/xRaySQ.h" #include "tests/testData.h" +#include "tests/testing.h" #include #include diff --git a/tests/nodes/flow.cpp b/tests/nodes/flow.cpp index 4df955c317..264cb4b221 100644 --- a/tests/nodes/flow.cpp +++ b/tests/nodes/flow.cpp @@ -6,7 +6,7 @@ #include "nodes/graph.h" #include "nodes/number.h" #include "nodes/numberNode.h" -#include "tests/graphData.h" +#include "tests/testing.h" #include namespace UnitTest diff --git a/tests/nodes/gr.cpp b/tests/nodes/gr.cpp index e839e07ce3..c285147d84 100644 --- a/tests/nodes/gr.cpp +++ b/tests/nodes/gr.cpp @@ -3,8 +3,8 @@ #include "nodes/gr.h" #include "math/windowFunction.h" -#include "tests/graphData.h" #include "tests/testData.h" +#include "tests/testing.h" #include namespace UnitTest diff --git a/tests/nodes/graph.cpp b/tests/nodes/graph.cpp index 5e686a9387..48e8ae62aa 100644 --- a/tests/nodes/graph.cpp +++ b/tests/nodes/graph.cpp @@ -4,8 +4,8 @@ #include "nodes/add.h" #include "nodes/dissolve.h" #include "nodes/registry.h" -#include "tests/graphData.h" #include "tests/testData.h" +#include "tests/testing.h" #include namespace UnitTest diff --git a/tests/nodes/graphArgon.cpp b/tests/nodes/graphArgon.cpp index fbe304c18f..8a253e1d62 100644 --- a/tests/nodes/graphArgon.cpp +++ b/tests/nodes/graphArgon.cpp @@ -2,10 +2,13 @@ // 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 "nodes/neutronSQ.h" +#include "nodes/sq.h" #include "tests/testData.h" +#include "tests/testing.h" #include namespace UnitTest diff --git a/tests/nodes/histogramCN.cpp b/tests/nodes/histogramCN.cpp index 3fb429b63f..3910be6e51 100644 --- a/tests/nodes/histogramCN.cpp +++ b/tests/nodes/histogramCN.cpp @@ -3,8 +3,9 @@ #include "nodes/histogramCN.h" #include "nodes/angle.h" -#include "tests/graphData.h" +#include "nodes/iterableGraph.h" #include "tests/testData.h" +#include "tests/testing.h" #include namespace UnitTest diff --git a/tests/nodes/intraAngle.cpp b/tests/nodes/intraAngle.cpp index 5f16cd638e..cc6c219804 100644 --- a/tests/nodes/intraAngle.cpp +++ b/tests/nodes/intraAngle.cpp @@ -5,8 +5,8 @@ #include "classes/speciesSites.h" #include "math/rangedVector3.h" #include "nodes/iterableGraph.h" -#include "tests/graphData.h" #include "tests/testData.h" +#include "tests/testing.h" #include #include diff --git a/tests/nodes/intraDistance.cpp b/tests/nodes/intraDistance.cpp index 13826748a5..1526227157 100644 --- a/tests/nodes/intraDistance.cpp +++ b/tests/nodes/intraDistance.cpp @@ -4,8 +4,8 @@ #include "nodes/intraDistance.h" #include "classes/speciesSites.h" #include "nodes/iterableGraph.h" -#include "tests/graphData.h" #include "tests/testData.h" +#include "tests/testing.h" #include #include diff --git a/tests/nodes/modifierOSites.cpp b/tests/nodes/modifierOSites.cpp index 3059e5fca4..10daf6369c 100644 --- a/tests/nodes/modifierOSites.cpp +++ b/tests/nodes/modifierOSites.cpp @@ -2,8 +2,8 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "nodes/modifierOSites.h" -#include "tests/graphData.h" #include "tests/testData.h" +#include "tests/testing.h" #include namespace UnitTest diff --git a/tests/nodes/moleculeTorsion.cpp b/tests/nodes/moleculeTorsion.cpp index 593a3fbc7d..f7d2449d36 100644 --- a/tests/nodes/moleculeTorsion.cpp +++ b/tests/nodes/moleculeTorsion.cpp @@ -3,8 +3,8 @@ #include "nodes/moleculeTorsion.h" #include "nodes/iterableGraph.h" -#include "tests/graphData.h" #include "tests/testData.h" +#include "tests/testing.h" #include namespace UnitTest diff --git a/tests/nodes/neutronSQ.cpp b/tests/nodes/neutronSQ.cpp index e1511bab26..4a4162bd5c 100644 --- a/tests/nodes/neutronSQ.cpp +++ b/tests/nodes/neutronSQ.cpp @@ -1,10 +1,12 @@ // 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 "nodes/sq.h" #include "tests/testData.h" +#include "tests/testing.h" #include namespace UnitTest diff --git a/tests/nodes/orientedSDF.cpp b/tests/nodes/orientedSDF.cpp index 4e53de5c77..0b754c0e48 100644 --- a/tests/nodes/orientedSDF.cpp +++ b/tests/nodes/orientedSDF.cpp @@ -4,8 +4,8 @@ #include "nodes/orientedSDF.h" #include "nodes/importDLPUtilsPDens.h" #include "nodes/iterableGraph.h" -#include "tests/graphData.h" #include "tests/testData.h" +#include "tests/testing.h" #include namespace UnitTest diff --git a/tests/nodes/parameters.cpp b/tests/nodes/parameters.cpp index 96b9e6e0a1..dae1722518 100644 --- a/tests/nodes/parameters.cpp +++ b/tests/nodes/parameters.cpp @@ -4,7 +4,7 @@ #include "nodes/dissolve.h" #include "nodes/numberNode.h" #include "nodes/test.h" -#include "tests/graphData.h" +#include "tests/testing.h" #include namespace UnitTest diff --git a/tests/nodes/qSpecies.cpp b/tests/nodes/qSpecies.cpp index 3b14cadfba..0ffc9ec5db 100644 --- a/tests/nodes/qSpecies.cpp +++ b/tests/nodes/qSpecies.cpp @@ -2,8 +2,8 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "nodes/qSpecies.h" -#include "tests/graphData.h" #include "tests/testData.h" +#include "tests/testing.h" #include namespace UnitTest diff --git a/tests/nodes/sdf.cpp b/tests/nodes/sdf.cpp index 9a84ff63d2..2bedf9ae80 100644 --- a/tests/nodes/sdf.cpp +++ b/tests/nodes/sdf.cpp @@ -4,8 +4,8 @@ #include "nodes/sdf.h" #include "nodes/importDLPUtilsPDens.h" #include "nodes/iterableGraph.h" -#include "tests/graphData.h" #include "tests/testData.h" +#include "tests/testing.h" #include namespace UnitTest diff --git a/tests/nodes/siteRDF.cpp b/tests/nodes/siteRDF.cpp index ffc4f4b191..70a4f751b6 100644 --- a/tests/nodes/siteRDF.cpp +++ b/tests/nodes/siteRDF.cpp @@ -5,8 +5,8 @@ #include "classes/speciesSites.h" #include "math/rangedVector3.h" #include "nodes/iterableGraph.h" -#include "tests/graphData.h" #include "tests/testData.h" +#include "tests/testing.h" #include #include diff --git a/tests/nodes/sq.cpp b/tests/nodes/sq.cpp index e925cae277..d79e779480 100644 --- a/tests/nodes/sq.cpp +++ b/tests/nodes/sq.cpp @@ -1,10 +1,11 @@ // 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 "tests/testing.h" #include namespace UnitTest diff --git a/tests/nodes/trajectory.cpp b/tests/nodes/trajectory.cpp index c4236ac235..fe83a57285 100644 --- a/tests/nodes/trajectory.cpp +++ b/tests/nodes/trajectory.cpp @@ -4,9 +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/testing.h" #include #include #include diff --git a/tests/nodes/voxelDensity.cpp b/tests/nodes/voxelDensity.cpp index 821e24b4fe..8d11f26936 100644 --- a/tests/nodes/voxelDensity.cpp +++ b/tests/nodes/voxelDensity.cpp @@ -3,8 +3,9 @@ #include "nodes/voxelDensity.h" #include "data/atomicMasses.h" -#include "tests/graphData.h" +#include "nodes/configuration.h" #include "tests/testData.h" +#include "tests/testing.h" #include namespace UnitTest diff --git a/tests/nodes/xRaySQ.cpp b/tests/nodes/xRaySQ.cpp index 0b227c217d..4bd78b1e86 100644 --- a/tests/nodes/xRaySQ.cpp +++ b/tests/nodes/xRaySQ.cpp @@ -3,8 +3,8 @@ #include "nodes/xRaySQ.h" #include "nodes/gr.h" -#include "tests/graphData.h" #include "tests/testData.h" +#include "tests/testing.h" #include namespace UnitTest diff --git a/tests/pairPotentials/cutoffs.cpp b/tests/pairPotentials/cutoffs.cpp index d3e10115ed..f57d83a2ab 100644 --- a/tests/pairPotentials/cutoffs.cpp +++ b/tests/pairPotentials/cutoffs.cpp @@ -3,8 +3,8 @@ #include "kernels/force.h" #include "nodes/dissolve.h" -#include "tests/graphData.h" #include "tests/testData.h" +#include "tests/testing.h" #include namespace UnitTest diff --git a/tests/pairPotentials/overrides.cpp b/tests/pairPotentials/overrides.cpp index 2c4eba421b..d42aaea64c 100644 --- a/tests/pairPotentials/overrides.cpp +++ b/tests/pairPotentials/overrides.cpp @@ -2,7 +2,9 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "kernels/energy.h" -#include "tests/graphData.h" +#include "nodes/neutronSQ.h" +#include "nodes/species.h" +#include "tests/testing.h" #include #include diff --git a/tests/testing.cpp b/tests/testing.cpp new file mode 100644 index 0000000000..0d6a9a98e8 --- /dev/null +++ b/tests/testing.cpp @@ -0,0 +1,325 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +// Copyright (c) 2026 Team Dissolve and contributors + +#include "tests/testing.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, + TestGraph::Data1DImportFileFormat referenceData) +{ + // 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 *TestGraph::appendXRaySQ(SQNode *sqNode, std::string name, TestGraph::Data1DImportFileFormat referenceData) +{ + 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(); +} + +/* + * Data Test Functions + */ + +/* + * Utility Functions + */ +// Save the specified graph in Mermaid format to a file named after the unit test +void TestGraph::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 TestGraph::exportMermaidGraph() { exportMermaidGraph(*this); } +}; // namespace UnitTest diff --git a/tests/testing.h b/tests/testing.h new file mode 100644 index 0000000000..34681c0404 --- /dev/null +++ b/tests/testing.h @@ -0,0 +1,111 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +// Copyright (c) 2026 Team Dissolve and contributors + +#pragma once + +#include "base/units.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 +{ +// 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; + // 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 = {}, + TestGraph::Data1DImportFileFormat referenceData = TestGraph::Data1DImportFileFormat{}); + // Create an XRaySQ node with optional reference data + XRaySQNode *appendXRaySQ(SQNode *sqNode, std::string name, + TestGraph::Data1DImportFileFormat referenceData = TestGraph::Data1DImportFileFormat{}); + + /* + * Data Test Functions + */ + public: + /* + * Utility Functions + */ + public: + // Save the specified graph in Mermaid format to a file named after the unit test + static void exportMermaidGraph(Graph &graph); + // Save the current graph in Mermaid format to a file named after the unit test + void exportMermaidGraph(); +}; +} // namespace UnitTest diff --git a/tests/workflows/phantomAtoms.cpp b/tests/workflows/phantomAtoms.cpp index 0b79e67c16..cf32028b87 100644 --- a/tests/workflows/phantomAtoms.cpp +++ b/tests/workflows/phantomAtoms.cpp @@ -2,8 +2,12 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "data/atomicMasses.h" -#include "tests/graphData.h" +#include "nodes/gr.h" +#include "nodes/neutronSQ.h" +#include "nodes/sq.h" +#include "nodes/xRaySQ.h" #include "tests/testData.h" +#include "tests/testing.h" #include namespace UnitTest From 3c54d27d40abf8f31ce7f05954cf4a78d30200ba Mon Sep 17 00:00:00 2001 From: Tristan Youngs Date: Fri, 26 Jun 2026 10:56:55 +0100 Subject: [PATCH 2/7] Bring checks in from testData.h. --- tests/CMakeLists.txt | 2 +- tests/testing.h | 55 ++++++++ tests/testingChecks.cpp | 292 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 348 insertions(+), 1 deletion(-) create mode 100644 tests/testingChecks.cpp diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 8a0946a015..12c74b4f8a 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -62,7 +62,7 @@ function(dissolve_add_test) endfunction() -add_library(testing testing.cpp testing.h) +add_library(testing testing.cpp testingChecks.cpp testing.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} diff --git a/tests/testing.h b/tests/testing.h index 34681c0404..657a8eb4a9 100644 --- a/tests/testing.h +++ b/tests/testing.h @@ -4,6 +4,12 @@ #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 @@ -99,6 +105,55 @@ class TestGraph : public DissolveGraph * Data Test Functions */ public: + // Test simple double + [[nodiscard]] bool checkDouble(std::string_view quantity, double A, double B, double threshold); + // Test sampled double + [[nodiscard]] bool checkSampledDouble(std::string_view quantity, SampledDouble A, double B, double threshold); + // Test Data1D + [[nodiscard]] 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); + [[nodiscard]] 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); + // Test Data2D + [[nodiscard]] 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); + // Test Data3D + [[nodiscard]] 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); + // Test Vec3 data + void checkVec3(const Vector3 &A, const Vector3 &B, double tolerance = 1.0e-6); + // Test Vec3 vector data + void checkVec3Vector(const std::vector &A, const std::vector &B, double tolerance = 1.0e-6); + // Test species atom type + void checkSpeciesAtomType(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 checkSpeciesIntramolecular(Species *sp, std::vector atoms, + const InteractionPotential &expectedParams, double tolerance = 1.0e-6); + // Test species angle term + void checkSpeciesIntramolecular(Species *sp, std::vector atoms, + const InteractionPotential &expectedParams, double tolerance = 1.0e-6); + // Test species torsion / improper term + void checkSpeciesIntramolecular(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 checkDoubleKeyedMap(std::string_view mapContents, const DoubleKeyedMap &mapA, + const DoubleKeyedMap &mapB, double testThreshold); + // Test consistency, and error, between supplied partial sets + bool checkPartialSet(const PartialSet &setA, const PartialSet &setB, double testThreshold); + // Check consistency between production, molecular, and test energies, returning production values + Kernel::EnergyResult checkEnergyConsistency(const std::unique_ptr &kernel, double testThreshold = 1.0e-6); + // 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); + // Check consistency of supplied forces + void checkReferenceForceConsistency(const std::vector &ppForces, const std::vector &geomForces, + const std::vector &referenceForces, double maxDeviation = 1.0e-3); + /* * Utility Functions */ diff --git a/tests/testingChecks.cpp b/tests/testingChecks.cpp new file mode 100644 index 0000000000..d6025681a5 --- /dev/null +++ b/tests/testingChecks.cpp @@ -0,0 +1,292 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +// Copyright (c) 2026 Team Dissolve and contributors + +#include "classes/species.h" +#include "kernels/energy.h" +#include "kernels/force.h" +#include "nodes/importXYData.h" +#include "tests/testing.h" + +namespace UnitTest +{ +// Test simple double +[[nodiscard]] 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]] bool checkSampledDouble(std::string_view quantity, SampledDouble A, double B, double threshold) +{ + return checkDouble(quantity, A.value(), B, threshold); +} +// Test Data1D +[[nodiscard]] 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]] 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]] 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]] 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 +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 +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 +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 +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 +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 From 0aa4f2f42255411f78c3c324174b3ed71c8bab94 Mon Sep 17 00:00:00 2001 From: Tristan Youngs Date: Fri, 26 Jun 2026 11:34:07 +0100 Subject: [PATCH 3/7] More. --- tests/CMakeLists.txt | 2 +- tests/classes/doubleKeyedMap.cpp | 2 +- tests/classes/empiricalFormula.cpp | 2 +- tests/classes/history.cpp | 40 +- tests/classes/neta.cpp | 1 - tests/classes/neutronWeights.cpp | 2 +- tests/classes/potentialSet.cpp | 1 - tests/classes/speciesSite.cpp | 1 - tests/ff/assignment-Kulmala2010.cpp | 97 ++--- tests/ff/assignment-Ludwig-py5.cpp | 33 +- tests/ff/assignment-OPLSAA2005-alcohols.cpp | 15 +- tests/ff/assignment-OPLSAA2005-alkanes.cpp | 77 ++-- tests/ff/assignment-OPLSAA2005-aromatics.cpp | 64 ++- tests/ff/assignment-PCL2019-anions.cpp | 173 ++++---- tests/ff/assignment-PCL2019-cations.cpp | 414 +++++++++---------- tests/ff/assignment-SPCFw.cpp | 9 +- tests/ff/assignment-UFF-nmethylformamide.cpp | 27 +- tests/ff/assignment-UFF4MOF-mof5.cpp | 54 ++- tests/ff/benzene.cpp | 3 +- tests/ff/cos-n.cpp | 3 +- tests/ff/hexane.cpp | 3 +- tests/ff/water-1000.cpp | 4 +- tests/generator/rotateFragment.cpp | 1 - tests/generator/select.cpp | 1 - tests/math/data1D.cpp | 2 +- tests/math/histogram1D.cpp | 2 +- tests/math/poisson.cpp | 6 +- tests/math/rangedVector3.cpp | 1 - tests/math/regression.cpp | 2 +- tests/math/sampledValues.cpp | 2 +- tests/math/vector3.cpp | 2 +- tests/math/wrap.cpp | 2 +- tests/nodes/angle.cpp | 11 +- tests/nodes/atomicMC.cpp | 1 - tests/nodes/averageMolecule.cpp | 14 +- tests/nodes/axisAngle.cpp | 2 +- tests/nodes/bragg.cpp | 9 +- tests/nodes/broadening.cpp | 7 +- tests/nodes/cif.cpp | 5 +- tests/nodes/dAngle.cpp | 14 +- tests/nodes/epsr.cpp | 66 ++- tests/nodes/flow.cpp | 2 +- tests/nodes/gr.cpp | 274 +++++------- tests/nodes/graph.cpp | 2 - tests/nodes/graphArgon.cpp | 7 +- tests/nodes/histogramCN.cpp | 2 +- tests/nodes/intraAngle.cpp | 6 +- tests/nodes/intraDistance.cpp | 14 +- tests/nodes/loop.cpp | 2 - tests/nodes/modifierOSites.cpp | 2 +- tests/nodes/moleculeTorsion.cpp | 5 +- tests/nodes/neutronSQ.cpp | 77 ++-- tests/nodes/orientedSDF.cpp | 5 +- tests/nodes/qSpecies.cpp | 2 +- tests/nodes/sdf.cpp | 8 +- tests/nodes/siteRDF.cpp | 56 ++- tests/nodes/sq.cpp | 262 +++++------- tests/nodes/subGraph.cpp | 1 - tests/nodes/trajectory.cpp | 1 - tests/nodes/voxelDensity.cpp | 1 - tests/nodes/xRaySQ.cpp | 9 +- tests/pairPotentials/cutoffs.cpp | 2 +- tests/testData.h | 407 ------------------ tests/testing.cpp | 9 +- tests/testing.h | 145 ++++--- tests/testingChecks.cpp | 28 +- tests/testingTOML.cpp | 33 ++ tests/workflows/phantomAtoms.cpp | 77 ++-- 68 files changed, 1014 insertions(+), 1602 deletions(-) delete mode 100644 tests/testData.h create mode 100644 tests/testingTOML.cpp diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 12c74b4f8a..a422b15b73 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -62,7 +62,7 @@ function(dissolve_add_test) endfunction() -add_library(testing testing.cpp testingChecks.cpp testing.h) +add_library(testing testing.cpp testingChecks.cpp testingTOML.cpp testing.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} diff --git a/tests/classes/doubleKeyedMap.cpp b/tests/classes/doubleKeyedMap.cpp index 87927f8502..6158b0e5fb 100644 --- a/tests/classes/doubleKeyedMap.cpp +++ b/tests/classes/doubleKeyedMap.cpp @@ -2,8 +2,8 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "templates/doubleKeyedMap.h" +#include "tests/testing.h" #include -#include 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 15832a5f0c..6c510bc624 100644 --- a/tests/classes/history.cpp +++ b/tests/classes/history.cpp @@ -3,7 +3,7 @@ #include "math/history.h" #include "nodes/number.h" -#include "tests/testData.h" +#include "nodes/species.h" #include "tests/testing.h" #include @@ -80,11 +80,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(checkData1D(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(checkData1D(a.average(), "A", b.average(), "B")); } TEST(History, CustomClassWithInitialiser) @@ -131,15 +131,14 @@ TEST(History, CustomClassWithInitialiser) for (auto n = 0; n < 3; ++n) { auto avg = a.push(p, avgLength); + EXPECT_TRUE(checkData1D(p.partials().get("Ar//Ar"), "Partial", avg.partials().get("Ar//Ar"), "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")); + checkData1D(p.boundPartials().get("Ar//Ar"), "BoundPartial", avg.boundPartials().get("Ar//Ar"), "Averaged")); + EXPECT_TRUE(checkData1D(p.boundTotal(), "BoundTotal", avg.boundTotal(), "Averaged")); + EXPECT_TRUE( + checkData1D(p.unboundPartials().get("Ar//Ar"), "UnboundPartial", avg.unboundPartials().get("Ar//Ar"), "Averaged")); + EXPECT_TRUE(checkData1D(p.unboundTotal(), "UnboundTotal", avg.unboundTotal(), "Averaged")); + EXPECT_TRUE(checkData1D(p.total(), "Total", avg.total(), "Averaged")); } // Accumulate opposite trig values - just test partials as the totals are not automatically modified by PartialSet @@ -149,21 +148,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(checkData1D(p.partials().get("Ar//Ar"), "Partial", avg.partials().get("Ar//Ar"), "Averaged")); + EXPECT_TRUE(checkData1D((dcos * (avgLength - n) - dsin * n) / avgLength, "BoundPartial", + avg.boundPartials().get("Ar//Ar"), "Averaged")); + EXPECT_TRUE(checkData1D((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( + checkData1D(avgA.boundPartials().get("Ar//Ar"), "BoundPartialA", avgB.boundPartials().get("Ar//Ar"), "BoundPartialB")); + EXPECT_TRUE(checkData1D(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 d0131473aa..cb20a672df 100644 --- a/tests/classes/neutronWeights.cpp +++ b/tests/classes/neutronWeights.cpp @@ -3,8 +3,8 @@ #include "classes/neutronWeights.h" #include "classes/isotopologueSet.h" +#include "classes/species.h" #include "tests/tempFile.h" -#include "tests/testData.h" #include "tests/testing.h" #include 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/ff/assignment-Kulmala2010.cpp b/tests/ff/assignment-Kulmala2010.cpp index c6a4e3f131..2b1e58c666 100644 --- a/tests/ff/assignment-Kulmala2010.cpp +++ b/tests/ff/assignment-Kulmala2010.cpp @@ -2,7 +2,7 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "data/ff/library.h" -#include "tests/testData.h" +#include "nodes/species.h" #include "tests/testing.h" #include @@ -10,7 +10,6 @@ namespace UnitTest { TEST(Kulmala2010AssignmentTest, Hydronium) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield( "Hydronium", "ImportXYZStructure", "xyz/hydronium.xyz", ForcefieldLibrary::forcefield("Kulmala2010")); @@ -23,14 +22,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"}); + checkSpeciesAtomType(&species, {{0, "OW+"}, {1, "HW+"}, {2, "HW+"}, {3, "HW+"}}); + checkSpeciesIntramolecular(&species, {0, 1}, {BondFunctions::Form::Harmonic, "k=4030 eq=0.969"}); + checkSpeciesIntramolecular(&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 +41,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"}); + checkSpeciesAtomType(&species, {{0, "NH"}, {1, "HN"}, {2, "HN"}, {3, "HN"}}); + checkSpeciesIntramolecular(&species, {0, 1}, {BondFunctions::Form::Harmonic, "k=3864 eq=1.003"}); + checkSpeciesIntramolecular(&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 +60,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"}); + checkSpeciesAtomType(&species, {{0, "NH+"}, {1, "HN+"}, {2, "HN+"}, {3, "HN+"}}); + checkSpeciesIntramolecular(&species, {0, 1}, {BondFunctions::Form::Harmonic, "k=3660.3 eq=1.013"}); + checkSpeciesIntramolecular(&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 +79,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"}); + checkSpeciesAtomType(&species, {{0, "NDM"}, + {1, "HDM"}, + {2, "HDM"}, + {3, "CDM"}, + {4, "CDM"}, + {5, "HCD"}, + {6, "HCD"}, + {7, "HCD"}, + {8, "HCD"}, + {9, "HCD"}, + {10, "HCD"}}); + checkSpeciesIntramolecular(&species, {0, 1}, {BondFunctions::Form::Harmonic, "k=3632 eq=1.01"}); + checkSpeciesIntramolecular(&species, {0, 3}, {BondFunctions::Form::Harmonic, "k=3071 eq=1.499"}); + checkSpeciesIntramolecular(&species, {3, 8}, {BondFunctions::Form::Harmonic, "k=2845.12 eq=1.09"}); + checkSpeciesIntramolecular(&species, {2, 0, 1}, {AngleFunctions::Form::Harmonic, "k=292.9 eq=105.5"}); + checkSpeciesIntramolecular(&species, {3, 0, 1}, {AngleFunctions::Form::Harmonic, "k=418.4 eq=109.2"}); + checkSpeciesIntramolecular(&species, {0, 3, 8}, {AngleFunctions::Form::Harmonic, "k=209.2 eq=108.5"}); + checkSpeciesIntramolecular(&species, {9, 3, 8}, {AngleFunctions::Form::Harmonic, "k=276.144 eq=107.8"}); + checkSpeciesIntramolecular(&species, {2, 0, 4, 5}, {TorsionFunctions::Form::Cos3, "0 0 0"}); + checkSpeciesIntramolecular(&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 +115,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"}); + checkSpeciesAtomType(&species, {{0, "SA"}, {1, "OA"}, {2, "OA"}, {3, "OHA"}, {4, "OHA"}, {5, "HSA"}, {6, "HSA"}}); + checkSpeciesIntramolecular(&species, {0, 1}, {BondFunctions::Form::Harmonic, "k=6258 eq=1.411"}); + checkSpeciesIntramolecular(&species, {0, 3}, {BondFunctions::Form::Harmonic, "k=3083.8 eq=1.571"}); + checkSpeciesIntramolecular(&species, {3, 6}, {BondFunctions::Form::Harmonic, "k=4561.1 eq=0.949"}); + checkSpeciesIntramolecular(&species, {1, 0, 2}, {AngleFunctions::Form::Harmonic, "k=224.37 eq=123.69"}); + checkSpeciesIntramolecular(&species, {6, 3, 0}, {AngleFunctions::Form::Harmonic, "k=396.82 eq=110.5"}); + checkSpeciesIntramolecular(&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 +138,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"}); + checkSpeciesAtomType(&species, {{0, "SA-"}, {1, "OA-"}, {2, "OA-"}, {3, "OA-"}, {4, "OHA-"}, {5, "HSA-"}}); + checkSpeciesIntramolecular(&species, {0, 1}, {BondFunctions::Form::Harmonic, "k=5239.9 eq=1.438"}); + checkSpeciesIntramolecular(&species, {0, 4}, {BondFunctions::Form::Harmonic, "k=2328.3 eq=1.634"}); + checkSpeciesIntramolecular(&species, {4, 5}, {BondFunctions::Form::Harmonic, "k=4561.1 eq=0.949"}); + checkSpeciesIntramolecular(&species, {1, 0, 2}, {AngleFunctions::Form::Harmonic, "k=456.97 eq=114.76"}); + checkSpeciesIntramolecular(&species, {1, 0, 4}, {AngleFunctions::Form::Harmonic, "k=814.48 eq=103.45"}); + checkSpeciesIntramolecular(&species, {5, 4, 0}, {AngleFunctions::Form::Harmonic, "k=398.12 eq=106.39"}); + checkSpeciesIntramolecular(&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 aad69105e4..ee7d8e2046 100644 --- a/tests/ff/assignment-Ludwig-py5.cpp +++ b/tests/ff/assignment-Ludwig-py5.cpp @@ -2,7 +2,7 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "data/ff/library.h" -#include "tests/testData.h" +#include "nodes/species.h" #include "tests/testing.h" #include #include @@ -11,7 +11,6 @@ namespace UnitTest { TEST(LudwigPy5AssignmentTest, Py5) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("Py5", "ImportXYZStructure", "xyz/py5.xyz", ForcefieldLibrary::forcefield("Ludwig/Py5")); @@ -25,20 +24,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"}); + 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"}}); + checkSpeciesIntramolecular(&species, {0, 1}, {BondFunctions::Form::Harmonic, "k=4042 eq=1.339"}); + checkSpeciesIntramolecular(&species, {1, 6}, {BondFunctions::Form::Harmonic, "k=3071 eq=1.08"}); + checkSpeciesIntramolecular(&species, {11, 0, 1}, {AngleFunctions::Form::Harmonic, "k=585.8 eq=121.5"}); + checkSpeciesIntramolecular(&species, {0, 1, 2, 3}, {TorsionFunctions::Form::Cosine, "15.178 2 180 1"}); + checkSpeciesIntramolecular(&species, {0, 1, 5, 11}, {TorsionFunctions::Form::Cosine, "4.606 2 180 1"}); + checkSpeciesIntramolecular(&species, {1, 0, 2, 6}, {TorsionFunctions::Form::Cosine, "4.606 2 180 1"}); + checkSpeciesIntramolecular(&species, {2, 1, 3, 7}, {TorsionFunctions::Form::Cosine, "4.606 2 180 1"}); + checkSpeciesIntramolecular(&species, {3, 2, 4, 8}, {TorsionFunctions::Form::Cosine, "4.606 2 180 1"}); + checkSpeciesIntramolecular(&species, {4, 3, 5, 9}, {TorsionFunctions::Form::Cosine, "4.606 2 180 1"}); + checkSpeciesIntramolecular(&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 c0c06d3e9a..2383955fbe 100644 --- a/tests/ff/assignment-OPLSAA2005-alcohols.cpp +++ b/tests/ff/assignment-OPLSAA2005-alcohols.cpp @@ -2,7 +2,7 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "data/ff/library.h" -#include "tests/testData.h" +#include "nodes/species.h" #include "tests/testing.h" #include @@ -10,7 +10,6 @@ namespace UnitTest { TEST(OPLSAA2005AlcoholsAssignmentTest, Methanol) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("Methanol", "ImportXYZStructure", "xyz/methanol.xyz", ForcefieldLibrary::forcefield("OPLSAA2005/Alcohols")); @@ -24,11 +23,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"}); + checkSpeciesAtomType(&species, {{0, "CT"}, {1, "OH"}, {2, "HO"}, {3, "HC"}, {4, "HC"}, {5, "HC"}}); + checkSpeciesIntramolecular(&species, {0, 1}, {BondFunctions::Form::Harmonic, "k=2677.76 eq=1.41"}); + checkSpeciesIntramolecular(&species, {0, 3}, {BondFunctions::Form::Harmonic, "k=2845.12 eq=1.09"}); + checkSpeciesIntramolecular(&species, {0, 1, 2}, {AngleFunctions::Form::Harmonic, "k=460.24 eq=108.5"}); + checkSpeciesIntramolecular(&species, {4, 0, 1}, {AngleFunctions::Form::Harmonic, "k=292.88 eq=109.5"}); + checkSpeciesIntramolecular(&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 bfe9f43b5c..327f4b4396 100644 --- a/tests/ff/assignment-OPLSAA2005-alkanes.cpp +++ b/tests/ff/assignment-OPLSAA2005-alkanes.cpp @@ -2,7 +2,7 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "data/ff/library.h" -#include "tests/testData.h" +#include "nodes/species.h" #include "tests/testing.h" #include @@ -10,7 +10,6 @@ namespace UnitTest { TEST(OPLSAA2005AlkanesAssignmentTest, Heptane) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("Heptane", "ImportXYZStructure", "xyz/heptane.xyz", ForcefieldLibrary::forcefield("OPLSAA2005/Alkanes")); @@ -24,36 +23,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"}); + 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"}}); + checkSpeciesIntramolecular(&species, {0, 1}, {BondFunctions::Form::Harmonic, "k=2242.62 eq=1.529"}); + checkSpeciesIntramolecular(&species, {0, 7}, {BondFunctions::Form::Harmonic, "k=2845.12 eq=1.09"}); + checkSpeciesIntramolecular(&species, {0, 1, 9}, {AngleFunctions::Form::Harmonic, "k=313.8 eq=110.7"}); + checkSpeciesIntramolecular(&species, {0, 1, 2}, {AngleFunctions::Form::Harmonic, "k=488.273 eq=112.7"}); + checkSpeciesIntramolecular(&species, {15, 4, 16}, {AngleFunctions::Form::Harmonic, "k=276.144 eq=107.8"}); + checkSpeciesIntramolecular(&species, {7, 0, 1, 9}, {TorsionFunctions::Form::Cos3, "0 0 1.2552"}); + checkSpeciesIntramolecular(&species, {7, 0, 1, 2}, {TorsionFunctions::Form::Cos3, "0 0 1.2552"}); + checkSpeciesIntramolecular(&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 +65,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"}); + 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"}}); + checkSpeciesIntramolecular(&species, {0, 1}, {BondFunctions::Form::Harmonic, "k=2242.62 eq=1.529"}); + checkSpeciesIntramolecular(&species, {0, 7}, {BondFunctions::Form::Harmonic, "k=2845.12 eq=1.09"}); + checkSpeciesIntramolecular(&species, {0, 1, 9}, {AngleFunctions::Form::Harmonic, "k=313.8 eq=110.7"}); + checkSpeciesIntramolecular(&species, {0, 1, 2}, {AngleFunctions::Form::Harmonic, "k=488.273 eq=112.7"}); + checkSpeciesIntramolecular(&species, {15, 4, 16}, {AngleFunctions::Form::Harmonic, "k=276.144 eq=107.8"}); + checkSpeciesIntramolecular(&species, {7, 0, 1, 9}, {TorsionFunctions::Form::Cos3, "0 0 1.2552"}); + checkSpeciesIntramolecular(&species, {7, 0, 1, 2}, {TorsionFunctions::Form::Cos3, "0 0 1.2552"}); + checkSpeciesIntramolecular(&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 bcc9e5ad99..5b805f83de 100644 --- a/tests/ff/assignment-OPLSAA2005-aromatics.cpp +++ b/tests/ff/assignment-OPLSAA2005-aromatics.cpp @@ -2,7 +2,7 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "data/ff/library.h" -#include "tests/testData.h" +#include "nodes/species.h" #include "tests/testing.h" #include @@ -10,7 +10,6 @@ namespace UnitTest { TEST(OPLSAA2005AromaticsAssignmentTest, Benzene) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield( "Benzene", "ImportXYZStructure", "xyz/benzene.xyz", ForcefieldLibrary::forcefield("OPLSAA2005/Aromatics")); @@ -24,19 +23,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"}); + checkSpeciesAtomType(&species, {{0, "CA"}, {1, "HA"}}); + checkSpeciesIntramolecular(&species, {0, 1}, {BondFunctions::Form::Harmonic, "k=3071.06 eq=1.08"}); + checkSpeciesIntramolecular(&species, {0, 2}, {BondFunctions::Form::Harmonic, "k=3924.59 eq=1.4"}); + checkSpeciesIntramolecular(&species, {1, 0, 2}, {AngleFunctions::Form::Harmonic, "k=292.88 eq=120"}); + checkSpeciesIntramolecular(&species, {0, 2, 4}, {AngleFunctions::Form::Harmonic, "k=527.184 eq=120"}); + checkSpeciesIntramolecular(&species, {1, 0, 2, 3}, {TorsionFunctions::Form::Cos3, "0 30.334 0"}); + checkSpeciesIntramolecular(&species, {1, 0, 2, 4}, {TorsionFunctions::Form::Cos3, "0 30.334 0"}); + checkSpeciesIntramolecular(&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 +48,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"}); + 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"}}); + checkSpeciesIntramolecular(&species, {2, 7}, {BondFunctions::Form::Harmonic, "k=3924.59 eq=1.4"}); + checkSpeciesIntramolecular(&species, {1, 2, 7}, {AngleFunctions::Form::Harmonic, "k=527.184 eq=120"}); + checkSpeciesIntramolecular(&species, {1, 2, 3}, {AngleFunctions::Form::Harmonic, "k=527.184 eq=120"}); + checkSpeciesIntramolecular(&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 f92d1fdca2..e3b9a420d0 100644 --- a/tests/ff/assignment-PCL2019-anions.cpp +++ b/tests/ff/assignment-PCL2019-anions.cpp @@ -2,7 +2,7 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "data/ff/library.h" -#include "tests/testData.h" +#include "nodes/species.h" #include "tests/testing.h" #include @@ -10,7 +10,6 @@ namespace UnitTest { TEST(PCL2019AnionsAssignmentTest, beti) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("Hydronium", "ImportXYZStructure", "xyz/beti.xyz", ForcefieldLibrary::forcefield("PCL2019/Anions")); @@ -24,16 +23,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"}}); + 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"}}); 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 +44,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"}}); + checkSpeciesAtomType(&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 +63,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"}}); + checkSpeciesAtomType(&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 +83,13 @@ TEST(PCL2019AnionsAssignmentTest, c1SO4) ASSERT_EQ(species.torsions().size(), 6); ASSERT_EQ(species.impropers().size(), 0); - systemTest.checkSpeciesAtomType( + checkSpeciesAtomType( &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 +103,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"}}); + checkSpeciesAtomType(&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 +132,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"}}); + 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"}}); 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 +162,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"}}); + 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"}}); 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 +184,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"}}); + checkSpeciesAtomType(&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 +203,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"}}); + checkSpeciesAtomType(&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 +222,13 @@ TEST(PCL2019AnionsAssignmentTest, fsi) ASSERT_EQ(species.torsions().size(), 6); ASSERT_EQ(species.impropers().size(), 0); - systemTest.checkSpeciesAtomType( + checkSpeciesAtomType( &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 +242,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"}}); + 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"}}); 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 +275,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"}}); + checkSpeciesAtomType(&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 +294,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"}}); + checkSpeciesAtomType(&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 +314,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"}}); + checkSpeciesAtomType(&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 +333,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"}}); + checkSpeciesAtomType(&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 +352,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"}}); + checkSpeciesAtomType(&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 +371,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"}}); + 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"}}); 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 54af3887a3..80efb4859a 100644 --- a/tests/ff/assignment-PCL2019-cations.cpp +++ b/tests/ff/assignment-PCL2019-cations.cpp @@ -2,7 +2,7 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "data/ff/library.h" -#include "tests/testData.h" +#include "nodes/species.h" #include "tests/testing.h" #include @@ -10,7 +10,6 @@ namespace UnitTest { TEST(PCL2019CationsAssignmentTest, benzc1im) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("benzc1im", "ImportXYZStructure", "xyz/benzc1im.xyz", ForcefieldLibrary::forcefield("PCL2019/Cations")); @@ -24,17 +23,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"}}); + 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"}}); 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 +45,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"}}); + 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"}}); 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 +70,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"}}); + 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"}}); 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 +104,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"}}); + 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"}}); 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 +125,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"}}); + 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"}}); 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 +147,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"}}); + 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"}}); 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 +184,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"}}); + 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"}}); 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 +218,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"}}); + 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"}}); 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 +239,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"}}); + 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"}}); 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 +275,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"}}); + 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"}}); 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 +297,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"}}); + 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"}}); 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 +319,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"}}); + 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"}}); 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 +341,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"}}); + 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"}}); 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 +363,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"}}); + 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"}}); 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 +386,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"}}); + 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"}}); 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 +409,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"}}); + 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"}}); 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 +431,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"}}); + 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"}}); 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 +454,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"}}); + 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"}}); 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 +478,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"}}); + 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"}}); 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 +502,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"}}); + 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"}}); 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 +526,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"}}); + 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"}}); 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 +547,7 @@ TEST(PCL2019CationsAssignmentTest, gua) ASSERT_EQ(species.torsions().size(), 12); ASSERT_EQ(species.impropers().size(), 4); - systemTest.checkSpeciesAtomType( + checkSpeciesAtomType( &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 +555,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 +568,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"}}); + 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"}}); 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 +600,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"}}); + 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"}}); 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 +635,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"}}); + 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"}}); 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 +657,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"}}); + 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"}}); 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 +680,7 @@ TEST(PCL2019CationsAssignmentTest, N4444) ASSERT_EQ(species.torsions().size(), 144); ASSERT_EQ(species.impropers().size(), 0); - systemTest.checkSpeciesAtomType( + 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, "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 +692,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 +705,7 @@ TEST(PCL2019CationsAssignmentTest, P66614) ASSERT_EQ(species.torsions().size(), 288); ASSERT_EQ(species.impropers().size(), 0); - systemTest.checkSpeciesAtomType( + checkSpeciesAtomType( &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 cf91d3f460..228d7a3c83 100644 --- a/tests/ff/assignment-SPCFw.cpp +++ b/tests/ff/assignment-SPCFw.cpp @@ -2,7 +2,7 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "data/ff/library.h" -#include "tests/testData.h" +#include "nodes/species.h" #include "tests/testing.h" #include @@ -10,7 +10,6 @@ namespace UnitTest { TEST(SPCFwAssignmentTest, Water) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield("Water", "ImportXYZStructure", "xyz/water.xyz", ForcefieldLibrary::forcefield("SPC/Fw")); @@ -24,8 +23,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"}); + checkSpeciesAtomType(&species, {{0, "OW"}, {1, "HW"}, {2, "HW"}}); + checkSpeciesIntramolecular(&species, {0, 1}, {BondFunctions::Form::Harmonic, "k=4431.53 eq=1"}); + checkSpeciesIntramolecular(&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 7b39fe32b7..6063ec9259 100644 --- a/tests/ff/assignment-UFF-nmethylformamide.cpp +++ b/tests/ff/assignment-UFF-nmethylformamide.cpp @@ -2,7 +2,7 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "data/ff/library.h" -#include "tests/testData.h" +#include "nodes/species.h" #include "tests/testing.h" #include @@ -10,7 +10,6 @@ namespace UnitTest { TEST(UFFNMethylFormamideAssignmentTest, NMethylFormamide) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *speciesNode = testGraph.createSpeciesFromStructureAndForcefield( "NMethylFormamide", "ImportXYZStructure", "xyz/n-methylformamide.xyz", ForcefieldLibrary::forcefield("UFF")); @@ -24,20 +23,16 @@ TEST(UFFNMethylFormamideAssignmentTest, NMethylFormamide) ASSERT_EQ(species.torsions().size(), 10); ASSERT_EQ(species.impropers().size(), 2); - systemTest.checkSpeciesAtomType( + checkSpeciesAtomType( &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"}); + checkSpeciesIntramolecular(&species, {1, 2}, {BondFunctions::Form::Harmonic, "k=5410.2978 eq=1.3568"}, 5.0e-5); + checkSpeciesIntramolecular(&species, {0, 1}, {BondFunctions::Form::Harmonic, "k=2991.0611 eq=1.08142"}, 5.0e-5); + checkSpeciesIntramolecular(&species, {2, 4}, {BondFunctions::Form::Harmonic, "k=4432.3881 eq=1.45007"}, 5.0e-5); + checkSpeciesIntramolecular(&species, {1, 2, 4}, {AngleFunctions::Form::Cos2, "882.7151 0.5 0.666667 0.333333"}, 5.0e-5); + checkSpeciesIntramolecular(&species, {3, 1, 2}, {AngleFunctions::Form::Cos2, "1590.3058 0.5 0.6667 0.3333"}, 5.0e-5); + checkSpeciesIntramolecular(&species, {8, 4, 7}, {AngleFunctions::Form::Cos2, "315.8868 0.343737 0.37492 0.281246"}, 6.0e-5); + checkSpeciesIntramolecular(&species, {0, 1, 2, 4}, {TorsionFunctions::Form::UFFCosine, "101.9308 2 180"}, 2.0e-5); + checkSpeciesIntramolecular(&species, {1, 0, 2, 3}, {TorsionFunctions::Form::FourierN, "209.2 1 -1 0"}); + checkSpeciesIntramolecular(&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 4d4323d66c..df67a810f2 100644 --- a/tests/ff/assignment-UFF4MOF-mof5.cpp +++ b/tests/ff/assignment-UFF4MOF-mof5.cpp @@ -2,7 +2,7 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "data/ff/library.h" -#include "tests/testData.h" +#include "nodes/species.h" #include "tests/testing.h" #include @@ -10,7 +10,6 @@ namespace UnitTest { TEST(UFF4MOFMOF5AssignmentTest, MOF5) { - DissolveSystemTest systemTest; TestGraph testGraph; auto *importNode = testGraph.createNode("ImportXYZStructure"); ASSERT_TRUE(importNode); @@ -40,32 +39,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"}); + 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_"}}); + checkSpeciesIntramolecular(&species, {386, 290}, {BondFunctions::Form::Harmonic, "k=2991.0611 eq=1.08142"}, 1.0e-5); + checkSpeciesIntramolecular(&species, {0, 32}, {BondFunctions::Form::Harmonic, "k=1337.872 eq=1.84185"}, 3.0e-5); + checkSpeciesIntramolecular(&species, {8, 32}, {BondFunctions::Form::Harmonic, "k=1337.872 eq=1.84185"}, 1.0e-5); + checkSpeciesIntramolecular(&species, {71, 156}, {BondFunctions::Form::Harmonic, "k=5048.4039 eq=1.34262"}, 5.0e-6); + checkSpeciesIntramolecular(&species, {178, 122, 26}, {AngleFunctions::Form::Cosine, "53.5872 3 0 -1"}, 3.0e-5); + checkSpeciesIntramolecular(&species, {121, 29, 112}, {AngleFunctions::Form::Cosine, "107.58286 3 0 -1"}, 6.0e-6); + checkSpeciesIntramolecular(&species, {178, 122, 26, 117}, {TorsionFunctions::Form::UFFCosine, "96.4708 2 180"}, 5.0e-5); + checkSpeciesIntramolecular(&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 4994d6fe0b..6dadfa68d4 100644 --- a/tests/ff/benzene.cpp +++ b/tests/ff/benzene.cpp @@ -1,9 +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/testData.h" +#include "nodes/species.h" #include "tests/testing.h" #include diff --git a/tests/ff/cos-n.cpp b/tests/ff/cos-n.cpp index 464c1390a3..142e6eddca 100644 --- a/tests/ff/cos-n.cpp +++ b/tests/ff/cos-n.cpp @@ -2,8 +2,9 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "data/ff/library.h" +#include "kernels/energy.h" +#include "kernels/force.h" #include "tests/tempFile.h" -#include "tests/testData.h" #include "tests/testing.h" #include diff --git a/tests/ff/hexane.cpp b/tests/ff/hexane.cpp index 07606a8e06..fa80b0dc93 100644 --- a/tests/ff/hexane.cpp +++ b/tests/ff/hexane.cpp @@ -1,9 +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/testData.h" +#include "nodes/species.h" #include "tests/testing.h" #include diff --git a/tests/ff/water-1000.cpp b/tests/ff/water-1000.cpp index 7ac53646c9..a1a4828d61 100644 --- a/tests/ff/water-1000.cpp +++ b/tests/ff/water-1000.cpp @@ -1,9 +1,9 @@ // 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/testData.h" +#include "nodes/species.h" #include "tests/testing.h" #include diff --git a/tests/generator/rotateFragment.cpp b/tests/generator/rotateFragment.cpp index 2582612777..725fb6758e 100644 --- a/tests/generator/rotateFragment.cpp +++ b/tests/generator/rotateFragment.cpp @@ -9,7 +9,6 @@ #include "generator/generator.h" #include "generator/select.h" #include "main/dissolve.h" -#include "tests/testData.h" #include #include diff --git a/tests/generator/select.cpp b/tests/generator/select.cpp index dd7227f832..824654e62b 100644 --- a/tests/generator/select.cpp +++ b/tests/generator/select.cpp @@ -6,7 +6,6 @@ #include "data/ff/library.h" #include "generator/generator.h" #include "main/dissolve.h" -#include "tests/testData.h" #include #include diff --git a/tests/math/data1D.cpp b/tests/math/data1D.cpp index 540a6dbfa0..cb871b52d0 100644 --- a/tests/math/data1D.cpp +++ b/tests/math/data1D.cpp @@ -2,7 +2,7 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "math/data1D.h" -#include "tests/testData.h" +#include "tests/testing.h" #include namespace UnitTest diff --git a/tests/math/histogram1D.cpp b/tests/math/histogram1D.cpp index 39b7549042..f7dca09550 100644 --- a/tests/math/histogram1D.cpp +++ b/tests/math/histogram1D.cpp @@ -2,7 +2,7 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "math/histogram1D.h" -#include "tests/testData.h" +#include "tests/testing.h" #include namespace UnitTest diff --git a/tests/math/poisson.cpp b/tests/math/poisson.cpp index ded2ae54c0..d6bc105d2f 100644 --- a/tests/math/poisson.cpp +++ b/tests/math/poisson.cpp @@ -2,7 +2,8 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "math/poissonFit.h" -#include "tests/testData.h" +#include "nodes/importXYData.h" +#include "tests/testing.h" #include namespace UnitTest @@ -40,8 +41,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(checkData1D(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..3284d9a6b0 100644 --- a/tests/math/sampledValues.cpp +++ b/tests/math/sampledValues.cpp @@ -5,7 +5,7 @@ #include "math/sampledDouble.h" #include "math/sampledVector.h" #include "templates/algorithms.h" -#include "tests/testData.h" +#include "tests/testing.h" #include #include #include diff --git a/tests/math/vector3.cpp b/tests/math/vector3.cpp index 9fdf2de794..8a93a8fc47 100644 --- a/tests/math/vector3.cpp +++ b/tests/math/vector3.cpp @@ -2,7 +2,7 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "math/vector3.h" -#include "tests/testData.h" +#include "tests/testing.h" #include 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 6da6a6049f..753c76ca13 100644 --- a/tests/nodes/angle.cpp +++ b/tests/nodes/angle.cpp @@ -5,7 +5,7 @@ #include "classes/speciesSites.h" #include "math/rangedVector3.h" #include "nodes/iterableGraph.h" -#include "tests/testData.h" +#include "nodes/species.h" #include "tests/testing.h" #include @@ -39,11 +39,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( + checkData1D(angle->rdfBC(), "B-C RDF", "dlpoly/water267-analysis/water-267-298K.aardf_21_23_inter_sum", 1, 2, 4.0e-3)); + EXPECT_TRUE(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)); } } // namespace UnitTest \ No newline at end of file diff --git a/tests/nodes/atomicMC.cpp b/tests/nodes/atomicMC.cpp index 6722067bae..cbfa4356f1 100644 --- a/tests/nodes/atomicMC.cpp +++ b/tests/nodes/atomicMC.cpp @@ -6,7 +6,6 @@ #include "nodes/dissolve.h" #include "nodes/insert.h" #include "nodes/iterableGraph.h" -#include "tests/testData.h" #include "tests/testing.h" #include #include diff --git a/tests/nodes/averageMolecule.cpp b/tests/nodes/averageMolecule.cpp index 6aa8167b3f..6547620944 100644 --- a/tests/nodes/averageMolecule.cpp +++ b/tests/nodes/averageMolecule.cpp @@ -3,7 +3,7 @@ #include "nodes/averageMolecule.h" #include "nodes/iterableGraph.h" -#include "tests/testData.h" +#include "nodes/species.h" #include "tests/testing.h" #include @@ -32,9 +32,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); + checkVec3(structure.atom(0)->r(), {-0.83305, 0.0, 0.0}, 1.0e-3); + checkVec3(structure.atom(1)->r(), {0.00016, 0.60443, 0.0}, 1.0e-3); + checkVec3(structure.atom(2)->r(), {0.83305, 0.0, 0.0}, 1.0e-3); } TEST(AverageMoleculeNodeTest, BeNDy) @@ -60,9 +60,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); + checkVec3(structure.atom(0)->r(), {2.0, 0.0, 0.0}, 1.0e-3); + checkVec3(structure.atom(1)->r(), {0.0, 0.0, 0.0}, 1.0e-3); + checkVec3(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 a8252a2fb0..df90cc04ec 100644 --- a/tests/nodes/axisAngle.cpp +++ b/tests/nodes/axisAngle.cpp @@ -2,7 +2,7 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "nodes/axisAngle.h" -#include "tests/testData.h" +#include "nodes/species.h" #include "tests/testing.h" #include diff --git a/tests/nodes/bragg.cpp b/tests/nodes/bragg.cpp index dffcb1306a..b112e94994 100644 --- a/tests/nodes/bragg.cpp +++ b/tests/nodes/bragg.cpp @@ -8,7 +8,6 @@ #include "nodes/gr.h" #include "nodes/iterableGraph.h" #include "nodes/sq.h" -#include "tests/testData.h" #include "tests/testing.h" #include #include @@ -151,18 +150,18 @@ TEST_F(BraggNodeTest, MgO_Full) auto weightedSQ = neutronSQNode_->getOutputValue("WeightedSQ"); auto weightedTotal = weightedSQ->total(); - EXPECT_TRUE(DissolveSystemTest::checkData1D( + EXPECT_TRUE(checkData1D( 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(checkData1D( 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(checkData1D( 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(checkData1D( 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 845718a461..a033b492f4 100644 --- a/tests/nodes/broadening.cpp +++ b/tests/nodes/broadening.cpp @@ -5,7 +5,6 @@ #include "nodes/gr.h" #include "nodes/neutronSQ.h" #include "nodes/sq.h" -#include "tests/testData.h" #include "tests/testing.h" #include @@ -46,9 +45,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(checkData1D(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 ca10a18c11..138ee8cc44 100644 --- a/tests/nodes/cif.cpp +++ b/tests/nodes/cif.cpp @@ -4,7 +4,6 @@ #include "classes/configuration.h" #include "classes/empiricalFormula.h" #include "nodes/cif/importCIFStructure.h" -#include "tests/testData.h" #include "tests/testing.h" #include #include @@ -141,10 +140,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); + checkVec3(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()); + checkVec3(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 6404dde66a..504860ea78 100644 --- a/tests/nodes/dAngle.cpp +++ b/tests/nodes/dAngle.cpp @@ -5,7 +5,7 @@ #include "analyser/dataOperator2D.h" #include "nodes/importDLPUtilsSurface.h" #include "nodes/iterableGraph.h" -#include "tests/testData.h" +#include "nodes/species.h" #include "tests/testing.h" #include @@ -38,11 +38,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( + checkData1D(dAngle->rdfBC(), "B-C RDF", "dlpoly/water267-analysis/water-267-298K.aardf_21_23_inter_sum", 1, 2, 4.0e-3)); + EXPECT_TRUE(checkData1D(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 +50,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(checkData2D(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 7e84088c3a..6e91ede952 100644 --- a/tests/nodes/epsr.cpp +++ b/tests/nodes/epsr.cpp @@ -8,7 +8,6 @@ #include "nodes/neutronSQ.h" #include "nodes/sq.h" #include "nodes/xRaySQ.h" -#include "tests/testData.h" #include "tests/testing.h" #include #include @@ -78,12 +77,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(checkData1D(epsrNode->estimatedSQ("OW", "OW"), "EPSR01_EstimatedSQ_OW-OW", + "epsr25/water1000-neutron/water.EPSR.q01", 1, 2, 2.0e-4)); + EXPECT_TRUE(checkData1D(epsrNode->estimatedSQ("OW", "HW"), "EPSR01_EstimatedSQ_OW-HW", + "epsr25/water1000-neutron/water.EPSR.q01", 1, 4, 2.0e-4)); + EXPECT_TRUE(checkData1D(epsrNode->estimatedSQ("HW", "HW"), "EPSR01_EstimatedSQ_HW-HW", + "epsr25/water1000-neutron/water.EPSR.q01", 1, 6, 1.0e-4)); } TEST(EPSRNodeTest, Water3NX) @@ -154,22 +153,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(checkData1D(epsrNode->targetProcessData(D2O).simulatedFR, "EPSR01_SimulatedFR_D2O", + "epsr25/water1000-neutron-xray/water.EPSR.x01", 1, 2, 2.0e-2)); + EXPECT_TRUE(checkData1D(epsrNode->targetProcessData(H2O).simulatedFR, "EPSR01_SimulatedFR_H2O", + "epsr25/water1000-neutron-xray/water.EPSR.x01", 1, 4, 8.0e-3)); + EXPECT_TRUE(checkData1D(epsrNode->targetProcessData(HDO).simulatedFR, "EPSR01_SimulatedFR_HDO", + "epsr25/water1000-neutron-xray/water.EPSR.x01", 1, 6, 2.0e-2)); + EXPECT_TRUE(checkData1D(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(checkData1D(epsrNode->estimatedSQ("OW", "OW"), "EPSR01_EstimatedSQ_OW-OW", + "epsr25/water1000-neutron-xray/water.EPSR.q01", 1, 2, 6.0e-3)); + EXPECT_TRUE(checkData1D(epsrNode->estimatedSQ("OW", "HW"), "EPSR01_EstimatedSQ_OW-HW", + "epsr25/water1000-neutron-xray/water.EPSR.q01", 1, 4, 6.0e-3)); + EXPECT_TRUE(checkData1D(epsrNode->estimatedSQ("HW", "HW"), "EPSR01_EstimatedSQ_HW-HW", + "epsr25/water1000-neutron-xray/water.EPSR.q01", 1, 6, 1.3e-2)); } TEST(EPSRNodeTest, Benzene) @@ -224,21 +223,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(checkData1D(epsrNode->targetProcessData(C6H6).simulatedFR, "EPSR01//SimulatedFR//C6H6", + "epsr25/benzene200-neutron/benzene.EPSR.x01", 1, 2, 1.5e-3)); + EXPECT_TRUE(checkData1D(epsrNode->targetProcessData(C6D6).simulatedFR, "EPSR01//SimulatedFR//C6D6", + "epsr25/benzene200-neutron/benzene.EPSR.x01", 1, 4, 1.7e-2)); + EXPECT_TRUE(checkData1D(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(checkData1D(epsrNode->estimatedSQ("CA", "CA"), "EPSR01//EstimatedSQ//CA-CA", + "epsr25/benzene200-neutron/benzene.EPSR.q01", 1, 2, 2.0e-2)); + EXPECT_TRUE(checkData1D(epsrNode->estimatedSQ("CA", "HA"), "EPSR01//EstimatedSQ//CA-HA", + "epsr25/benzene200-neutron/benzene.EPSR.q01", 1, 4, 2.0e-2)); + EXPECT_TRUE(checkData1D(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 264cb4b221..0ceba705ca 100644 --- a/tests/nodes/flow.cpp +++ b/tests/nodes/flow.cpp @@ -231,7 +231,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 c285147d84..057b676470 100644 --- a/tests/nodes/gr.cpp +++ b/tests/nodes/gr.cpp @@ -3,7 +3,6 @@ #include "nodes/gr.h" #include "math/windowFunction.h" -#include "tests/testData.h" #include "tests/testing.h" #include @@ -32,14 +31,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(checkPartialSet(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(checkPartialSet(rawGRBaseline, rawGRCells, 1.0e-8)); } TEST(GRNodeTest, Water) @@ -62,25 +61,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(checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("OW", "OW")), "OW-OW Unbound Partial", + "epsr25/water1000-neutron/water.EPSR.g01", 1, 2, 6.0e-2)); + EXPECT_TRUE(checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("HW", "OW")), "HW-OW Unbound Partial", + "epsr25/water1000-neutron/water.EPSR.g01", 1, 4, 2.0e-2)); + EXPECT_TRUE(checkData1D(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(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(checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("HW", "OW")), "HW-OW Bound Partial", + "epsr25/water1000-neutron/water.EPSR.y01", 1, 4, 0.1)); + EXPECT_TRUE(checkData1D(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 +106,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(checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("OW", "OW")), "OW-OW Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 2, 1.0)); + EXPECT_TRUE(checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("OW", "HW")), "OW-HW Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 4, 0.5)); + EXPECT_TRUE(checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("OW", "CT")), "OW-CT Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 6, 0.2)); + EXPECT_TRUE(checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("OW", "HC")), "OW-HC Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 8, 7.0e-2)); + EXPECT_TRUE(checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("OW", "OH")), "OW-OH Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 10, 0.2)); + EXPECT_TRUE(checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("OW", "HO")), "OW-HO Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 12, 0.3)); + EXPECT_TRUE(checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("HW", "HW")), "HW-HW Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 14, 0.4)); + EXPECT_TRUE(checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("HW", "CT")), "HW-CT Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 16, 0.1)); + EXPECT_TRUE(checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("HW", "HC")), "HW-HC Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 18, 4.0e-2)); + EXPECT_TRUE(checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("HW", "OH")), "HW-OH Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 20, 0.2)); + EXPECT_TRUE(checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("HW", "HO")), "HW-HO Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 22, 0.2)); + EXPECT_TRUE(checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("CT", "CT")), "CT-CT Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 24, 0.2)); + EXPECT_TRUE(checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("CT", "HC")), "CT-HC Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 26, 4.0e-2)); + EXPECT_TRUE(checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("CT", "OH")), "CT-OH Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 28, 0.1)); + EXPECT_TRUE(checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("CT", "HO")), "CT-HO Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 30, 0.1)); + EXPECT_TRUE(checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("HC", "HC")), "HC-HC Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 32, 4.0e-2)); + EXPECT_TRUE(checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("HC", "OH")), "HC-OH Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 34, 4.0e-2)); + EXPECT_TRUE(checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("HC", "HO")), "HC-HO Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 36, 5.0e-2)); + EXPECT_TRUE(checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("OH", "OH")), "OH-OH Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 38, 0.3)); + EXPECT_TRUE(checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("OH", "HO")), "OH-HO Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 40, 0.1)); + EXPECT_TRUE(checkData1D(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(checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("OW", "HW")), "OW-HW Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 4, 0.8)); + EXPECT_TRUE(checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("HW", "HW")), "HW-HW Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 14, 0.5)); + EXPECT_TRUE(checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("CT", "HC")), "CT-HC Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 26, 0.3)); + EXPECT_TRUE(checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("CT", "OH")), "CT-OH Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 28, 0.5)); + EXPECT_TRUE(checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("CT", "HO")), "CT-HO Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 30, 0.2)); + EXPECT_TRUE(checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("HC", "HC")), "HC-HC Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 32, 0.06)); + EXPECT_TRUE(checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("HC", "OH")), "HC-OH Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 34, 0.08)); + EXPECT_TRUE(checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("HC", "HO")), "HC-HO Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 36, 0.5)); + EXPECT_TRUE(checkData1D(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(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(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(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(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(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(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(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(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(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(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(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(checkData1D(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 +217,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(checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("CA", "CA")), "CA-CA Unbound Partial", + "epsr25/benzene200-neutron/benzene.EPSR.g01", 1, 2, 3.0e-2)); + EXPECT_TRUE(checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("CA", "HA")), "CA-HA Unbound Partial", + "epsr25/benzene200-neutron/benzene.EPSR.g01", 1, 4, 2.0e-2)); + EXPECT_TRUE(checkData1D(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(checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("CA", "CA")), "CA-CA Bound Partial", + "epsr25/benzene200-neutron/benzene.EPSR.y01", 1, 2, 0.12)); + EXPECT_TRUE(checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("CA", "HA")), "CA-HA Bound Partial", + "epsr25/benzene200-neutron/benzene.EPSR.y01", 1, 4, 0.18)); + EXPECT_TRUE(checkData1D(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 48e8ae62aa..f8a678916c 100644 --- a/tests/nodes/graph.cpp +++ b/tests/nodes/graph.cpp @@ -4,7 +4,6 @@ #include "nodes/add.h" #include "nodes/dissolve.h" #include "nodes/registry.h" -#include "tests/testData.h" #include "tests/testing.h" #include @@ -67,7 +66,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 8a253e1d62..adf8cf2c80 100644 --- a/tests/nodes/graphArgon.cpp +++ b/tests/nodes/graphArgon.cpp @@ -7,7 +7,6 @@ #include "data/structureFactors.h" #include "nodes/neutronSQ.h" #include "nodes/sq.h" -#include "tests/testData.h" #include "tests/testing.h" #include @@ -50,14 +49,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(checkData1D(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(checkData1D(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 3910be6e51..1a90aecde2 100644 --- a/tests/nodes/histogramCN.cpp +++ b/tests/nodes/histogramCN.cpp @@ -4,7 +4,7 @@ #include "nodes/histogramCN.h" #include "nodes/angle.h" #include "nodes/iterableGraph.h" -#include "tests/testData.h" +#include "nodes/species.h" #include "tests/testing.h" #include diff --git a/tests/nodes/intraAngle.cpp b/tests/nodes/intraAngle.cpp index cc6c219804..aa19b7f0b9 100644 --- a/tests/nodes/intraAngle.cpp +++ b/tests/nodes/intraAngle.cpp @@ -5,7 +5,7 @@ #include "classes/speciesSites.h" #include "math/rangedVector3.h" #include "nodes/iterableGraph.h" -#include "tests/testData.h" +#include "nodes/species.h" #include "tests/testing.h" #include #include @@ -37,8 +37,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(checkData1D(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 1526227157..f4e13c8515 100644 --- a/tests/nodes/intraDistance.cpp +++ b/tests/nodes/intraDistance.cpp @@ -4,7 +4,7 @@ #include "nodes/intraDistance.h" #include "classes/speciesSites.h" #include "nodes/iterableGraph.h" -#include "tests/testData.h" +#include "nodes/species.h" #include "tests/testing.h" #include #include @@ -51,12 +51,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(checkData1D(dOH1->rdfAB(), "D(O-H1)//NormalisedHistogram", "dlpoly/water267-analysis/water-267-298K.01-02.ij", + 1, 3, 6.0e-5)); + EXPECT_TRUE(checkData1D(dOH2->rdfAB(), "D(O-H2)//NormalisedHistogram", "dlpoly/water267-analysis/water-267-298K.02-03.ij", + 1, 3, 7.0e-5)); + EXPECT_TRUE(checkData1D(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 10daf6369c..79d5aa01d7 100644 --- a/tests/nodes/modifierOSites.cpp +++ b/tests/nodes/modifierOSites.cpp @@ -2,7 +2,7 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "nodes/modifierOSites.h" -#include "tests/testData.h" +#include "nodes/species.h" #include "tests/testing.h" #include diff --git a/tests/nodes/moleculeTorsion.cpp b/tests/nodes/moleculeTorsion.cpp index f7d2449d36..a255e5f556 100644 --- a/tests/nodes/moleculeTorsion.cpp +++ b/tests/nodes/moleculeTorsion.cpp @@ -3,7 +3,6 @@ #include "nodes/moleculeTorsion.h" #include "nodes/iterableGraph.h" -#include "tests/testData.h" #include "tests/testing.h" #include @@ -35,8 +34,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(checkData1D(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 4a4162bd5c..125a7dd460 100644 --- a/tests/nodes/neutronSQ.cpp +++ b/tests/nodes/neutronSQ.cpp @@ -5,7 +5,6 @@ #include "math/windowFunction.h" #include "nodes/gr.h" #include "nodes/sq.h" -#include "tests/testData.h" #include "tests/testing.h" #include @@ -44,12 +43,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(checkData1D(D2O->getOutputValue("WeightedSQ")->total(), "D2O F(Q)", + "epsr25/water1000-neutron/water.EPSR.u01", 1, 2, 3.0e-4)); + EXPECT_TRUE(checkData1D(H2O->getOutputValue("WeightedSQ")->total(), "H2O F(Q)", + "epsr25/water1000-neutron/water.EPSR.u01", 1, 4, 6.0e-4)); + EXPECT_TRUE(checkData1D(HDO->getOutputValue("WeightedSQ")->total(), "HDO F(Q)", + "epsr25/water1000-neutron/water.EPSR.u01", 1, 6, 2.0e-5)); } TEST(NeutronSQNodeTest, WaterReferenceFT) @@ -86,12 +85,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(checkData1D(D2O->getOutputValue("ReferenceGR"), "D2O Reference G(r)", + "epsr25/water1000-neutron-xray/water.EPSR.w01", 1, 2, 5.0e-5)); + EXPECT_TRUE(checkData1D(H2O->getOutputValue("ReferenceGR"), "H2O Reference G(r)", + "epsr25/water1000-neutron-xray/water.EPSR.w01", 1, 4, 5.0e-5)); + EXPECT_TRUE(checkData1D(HDO->getOutputValue("ReferenceGR"), "HDO Reference G(r)", + "epsr25/water1000-neutron-xray/water.EPSR.w01", 1, 6, 5.0e-5)); } TEST(NeutronSQNodeTest, WaterMethanol) @@ -134,30 +133,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(checkData1D(neutronSQ["HHH"]->getOutputValue("WeightedSQ")->total(), "HHH Total F(Q)", + "epsr25/water300methanol600/watermeth.EPSR.u01", 1, 2, 1.0e-4)); + EXPECT_TRUE(checkData1D(neutronSQ["H5H"]->getOutputValue("WeightedSQ")->total(), "H5H Total F(Q)", + "epsr25/water300methanol600/watermeth.EPSR.u01", 1, 4, 1.0e-4)); + EXPECT_TRUE(checkData1D(neutronSQ["DHH"]->getOutputValue("WeightedSQ")->total(), "DHH Total F(Q)", + "epsr25/water300methanol600/watermeth.EPSR.u01", 1, 6, 1.0e-4)); + EXPECT_TRUE(checkData1D(neutronSQ["HDH"]->getOutputValue("WeightedSQ")->total(), "HDH Total F(Q)", + "epsr25/water300methanol600/watermeth.EPSR.u01", 1, 8, 1.0e-4)); + EXPECT_TRUE(checkData1D(neutronSQ["HHD"]->getOutputValue("WeightedSQ")->total(), "HHD Total F(Q)", + "epsr25/water300methanol600/watermeth.EPSR.u01", 1, 10, 5.0e-4)); + EXPECT_TRUE(checkData1D(neutronSQ["DDH"]->getOutputValue("WeightedSQ")->total(), "DDH Total F(Q)", + "epsr25/water300methanol600/watermeth.EPSR.u01", 1, 12, 8.0e-4)); + EXPECT_TRUE(checkData1D(neutronSQ["HDD"]->getOutputValue("WeightedSQ")->total(), "HDD Total F(Q)", + "epsr25/water300methanol600/watermeth.EPSR.u01", 1, 14, 5.0e-4)); + EXPECT_TRUE(checkData1D(neutronSQ["DDD"]->getOutputValue("WeightedSQ")->total(), "DDD Total F(Q)", + "epsr25/water300methanol600/watermeth.EPSR.u01", 1, 16, 5.0e-4)); } TEST(NeutronSQNodeTest, Benzene) @@ -195,12 +186,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(checkData1D(C6H6->getOutputValue("WeightedSQ")->total(), "C6H6 Total F(Q)", + "epsr25/benzene200-neutron/benzene.EPSR.u01", 1, 2, 2.0e-3)); + EXPECT_TRUE(checkData1D(C6D6->getOutputValue("WeightedSQ")->total(), "C6D6 Total F(Q)", + "epsr25/benzene200-neutron/benzene.EPSR.u01", 1, 4, 2.0e-3)); + EXPECT_TRUE(checkData1D(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 0b754c0e48..0c31055c7e 100644 --- a/tests/nodes/orientedSDF.cpp +++ b/tests/nodes/orientedSDF.cpp @@ -4,7 +4,7 @@ #include "nodes/orientedSDF.h" #include "nodes/importDLPUtilsPDens.h" #include "nodes/iterableGraph.h" -#include "tests/testData.h" +#include "nodes/species.h" #include "tests/testing.h" #include @@ -42,7 +42,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(checkData3D(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/qSpecies.cpp b/tests/nodes/qSpecies.cpp index 0ffc9ec5db..3b8b470d9a 100644 --- a/tests/nodes/qSpecies.cpp +++ b/tests/nodes/qSpecies.cpp @@ -2,7 +2,7 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "nodes/qSpecies.h" -#include "tests/testData.h" +#include "nodes/species.h" #include "tests/testing.h" #include diff --git a/tests/nodes/sdf.cpp b/tests/nodes/sdf.cpp index 2bedf9ae80..9932cef93d 100644 --- a/tests/nodes/sdf.cpp +++ b/tests/nodes/sdf.cpp @@ -4,7 +4,7 @@ #include "nodes/sdf.h" #include "nodes/importDLPUtilsPDens.h" #include "nodes/iterableGraph.h" -#include "tests/testData.h" +#include "nodes/species.h" #include "tests/testing.h" #include @@ -38,8 +38,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(checkData3D(sdf->sdf(), "SDF", referenceData, "dlpoly/water267-analysis/water-267-298K.11.pdens", 0.13)); } TEST(SDFNodeTest, Benzene) @@ -70,7 +69,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(checkData3D(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 70a4f751b6..6d87d11272 100644 --- a/tests/nodes/siteRDF.cpp +++ b/tests/nodes/siteRDF.cpp @@ -2,13 +2,11 @@ // 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/testData.h" +#include "nodes/species.h" #include "tests/testing.h" #include -#include namespace UnitTest { @@ -83,22 +81,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( + checkData1D(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(checkData1D(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( + checkData1D(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(checkSampledDouble("coordination number A", cNA, 4.32359551, 2.0e-3)); + EXPECT_TRUE(checkSampledDouble("coordination number B", cNB, 19.413049, 7.0e-4)); } TEST_F(SiteRDFNodeTest, WaterNPT) @@ -119,16 +117,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( + checkData1D(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( + checkData1D(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( + checkData1D(comCOMRDF->dataRDF(), "RDF(COM-COM)//RDF", "dlpoly/water267-npt/water-267-298K.rdf11", 1, 2, 4.0e-3)); } TEST_F(SiteRDFNodeTest, WaterDynamic) @@ -146,12 +144,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( + checkData1D(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( + checkData1D(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 +172,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( + checkData1D(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( + checkData1D(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( + checkData1D(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(checkSampledDouble("coordination number A", cNA, 4.32359551, 2.0e-3)); + EXPECT_TRUE(checkSampledDouble("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 d79e779480..b8c7a0e23a 100644 --- a/tests/nodes/sq.cpp +++ b/tests/nodes/sq.cpp @@ -4,7 +4,6 @@ #include "nodes/sq.h" #include "math/windowFunction.h" #include "nodes/gr.h" -#include "tests/testData.h" #include "tests/testing.h" #include @@ -33,28 +32,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(checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("OW", "OW")), "OW-OW Unbound Partial", + "epsr25/water1000-neutron/water.EPSR.f01", 1, 2, 1.0e-3)); + EXPECT_TRUE(checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("OW", "HW")), "OW-HW Unbound Partial", + "epsr25/water1000-neutron/water.EPSR.f01", 1, 4, 3.0e-3)); + EXPECT_TRUE(checkData1D(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(checkData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("OW", "HW")), "OW-HW Bound Partial", + "epsr25/water1000-neutron/water.EPSR.s01", 1, 4, 1.0e-4)); + EXPECT_TRUE(checkData1D(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(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)); } TEST(SQNodeTest, WaterMethanol) @@ -90,127 +83,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(checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("OW", "OW")), "OW-OW Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 2, 4.0e-2)); + EXPECT_TRUE(checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("OW", "HW")), "OW-HW Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 4, 5.0e-2)); + EXPECT_TRUE(checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("OW", "CT")), "OW-CT Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 6)); + EXPECT_TRUE(checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("OW", "HC")), "OW-HC Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 8)); + EXPECT_TRUE(checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("OW", "OH")), "OW-OH Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 10)); + EXPECT_TRUE(checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("OW", "HO")), "OW-HO Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 12)); + EXPECT_TRUE(checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("HW", "HW")), "HW-HW Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 14, 5.0e-2)); + EXPECT_TRUE(checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("HW", "CT")), "HW-CT Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 16)); + EXPECT_TRUE(checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("HW", "HC")), "HW-HC Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 18)); + EXPECT_TRUE(checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("HW", "OH")), "HW-OH Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 20)); + EXPECT_TRUE(checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("HW", "HO")), "HW-HO Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 22)); + EXPECT_TRUE(checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("CT", "CT")), "CT-CT Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 24, 8.0e-3)); + EXPECT_TRUE(checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("CT", "HC")), "CT-HC Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 26)); + EXPECT_TRUE(checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("CT", "OH")), "CT-OH Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 28)); + EXPECT_TRUE(checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("CT", "HO")), "CT-HO Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 30)); + EXPECT_TRUE(checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("HC", "HC")), "HC-HC Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 32)); + EXPECT_TRUE(checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("HC", "OH")), "HC-OH Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 34)); + EXPECT_TRUE(checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("HC", "HO")), "HC-HO Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 36)); + EXPECT_TRUE(checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("OH", "OH")), "OH-OH Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 38)); + EXPECT_TRUE(checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("OH", "HO")), "OH-HO Unbound Partial", + "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 40)); + EXPECT_TRUE(checkData1D(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(checkData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("OW", "HW")), "OW-HW Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 4)); + EXPECT_TRUE(checkData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("HW", "HW")), "HW-HW Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 14)); + EXPECT_TRUE(checkData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("CT", "HC")), "CT-HC Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 26)); + EXPECT_TRUE(checkData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("CT", "OH")), "CT-OH Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 28)); + EXPECT_TRUE(checkData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("CT", "HO")), "CT-HO Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 30)); + EXPECT_TRUE(checkData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("HC", "HC")), "HC-HC Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 32)); + EXPECT_TRUE(checkData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("HC", "OH")), "HC-OH Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 34)); + EXPECT_TRUE(checkData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("HC", "HO")), "HC-HO Bound Partial", + "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 36)); + EXPECT_TRUE(checkData1D(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(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(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(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(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(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(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(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(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(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(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(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(checkData1D(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) @@ -237,26 +197,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(checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("CA", "CA")), "CA-CA Unbound Partial", + "epsr25/benzene200-neutron/benzene.EPSR.f01", 1, 2, 7.0e-3)); + EXPECT_TRUE(checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("CA", "HA")), "CA-HA Unbound Partial", + "epsr25/benzene200-neutron/benzene.EPSR.f01", 1, 4, 5.0e-3)); + EXPECT_TRUE(checkData1D(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(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(checkData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("CA", "HA")), "CA-HA Bound Partial", + "epsr25/benzene200-neutron/benzene.EPSR.s01", 1, 4, 5.0e-3)); + EXPECT_TRUE(checkData1D(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 fe83a57285..4030796cbd 100644 --- a/tests/nodes/trajectory.cpp +++ b/tests/nodes/trajectory.cpp @@ -5,7 +5,6 @@ #include "nodes/exportXYZTrajectory.h" #include "nodes/importXYZTrajectory.h" #include "tests/tempFile.h" -#include "tests/testData.h" #include "tests/testing.h" #include #include diff --git a/tests/nodes/voxelDensity.cpp b/tests/nodes/voxelDensity.cpp index 8d11f26936..d850e40271 100644 --- a/tests/nodes/voxelDensity.cpp +++ b/tests/nodes/voxelDensity.cpp @@ -4,7 +4,6 @@ #include "nodes/voxelDensity.h" #include "data/atomicMasses.h" #include "nodes/configuration.h" -#include "tests/testData.h" #include "tests/testing.h" #include diff --git a/tests/nodes/xRaySQ.cpp b/tests/nodes/xRaySQ.cpp index 4bd78b1e86..7def4342ad 100644 --- a/tests/nodes/xRaySQ.cpp +++ b/tests/nodes/xRaySQ.cpp @@ -3,7 +3,6 @@ #include "nodes/xRaySQ.h" #include "nodes/gr.h" -#include "tests/testData.h" #include "tests/testing.h" #include @@ -37,12 +36,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(checkData1D(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(checkData1D(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 f57d83a2ab..3487cbff8e 100644 --- a/tests/pairPotentials/cutoffs.cpp +++ b/tests/pairPotentials/cutoffs.cpp @@ -3,7 +3,7 @@ #include "kernels/force.h" #include "nodes/dissolve.h" -#include "tests/testData.h" +#include "nodes/species.h" #include "tests/testing.h" #include 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/testing.cpp b/tests/testing.cpp index 0d6a9a98e8..63e5116092 100644 --- a/tests/testing.cpp +++ b/tests/testing.cpp @@ -301,15 +301,12 @@ XRaySQNode *TestGraph::appendXRaySQ(SQNode *sqNode, std::string name, TestGraph: return head(); } -/* - * Data Test Functions - */ - /* * Utility Functions */ + // Save the specified graph in Mermaid format to a file named after the unit test -void TestGraph::exportMermaidGraph(Graph &graph) +void exportMermaidGraph(Graph &graph) { auto suite = ::testing::UnitTest::GetInstance()->current_test_info()->test_suite_name(); auto name = ::testing::UnitTest::GetInstance()->current_test_info()->name(); @@ -320,6 +317,4 @@ void TestGraph::exportMermaidGraph(Graph &graph) myfile << graph; myfile.close(); } -// Save the current graph in Mermaid format to a file named after the unit test -void TestGraph::exportMermaidGraph() { exportMermaidGraph(*this); } }; // namespace UnitTest diff --git a/tests/testing.h b/tests/testing.h index 657a8eb4a9..b738bad3bb 100644 --- a/tests/testing.h +++ b/tests/testing.h @@ -24,6 +24,17 @@ 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); + +/* + * Test Graph Framework + */ + // Basic object setup for any Graph-based test class TestGraph : public DissolveGraph { @@ -33,7 +44,7 @@ class TestGraph : public DissolveGraph setEcho(true); PairPotential::setChargeSource(PairPotential::ChargeSource::Automatic); } - ~TestGraph() { exportMermaidGraph(); } + ~TestGraph() { exportMermaidGraph(*this); } public: // Container for data 1D import filename and whether or not it is a histogram @@ -100,67 +111,75 @@ class TestGraph : public DissolveGraph // Create an XRaySQ node with optional reference data XRaySQNode *appendXRaySQ(SQNode *sqNode, std::string name, TestGraph::Data1DImportFileFormat referenceData = TestGraph::Data1DImportFileFormat{}); +}; - /* - * Data Test Functions - */ - public: - // Test simple double - [[nodiscard]] bool checkDouble(std::string_view quantity, double A, double B, double threshold); - // Test sampled double - [[nodiscard]] bool checkSampledDouble(std::string_view quantity, SampledDouble A, double B, double threshold); - // Test Data1D - [[nodiscard]] 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); - [[nodiscard]] 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); - // Test Data2D - [[nodiscard]] 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); - // Test Data3D - [[nodiscard]] 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); - // Test Vec3 data - void checkVec3(const Vector3 &A, const Vector3 &B, double tolerance = 1.0e-6); - // Test Vec3 vector data - void checkVec3Vector(const std::vector &A, const std::vector &B, double tolerance = 1.0e-6); - // Test species atom type - void checkSpeciesAtomType(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 checkSpeciesIntramolecular(Species *sp, std::vector atoms, - const InteractionPotential &expectedParams, double tolerance = 1.0e-6); - // Test species angle term - void checkSpeciesIntramolecular(Species *sp, std::vector atoms, - const InteractionPotential &expectedParams, double tolerance = 1.0e-6); - // Test species torsion / improper term - void checkSpeciesIntramolecular(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 checkDoubleKeyedMap(std::string_view mapContents, const DoubleKeyedMap &mapA, - const DoubleKeyedMap &mapB, double testThreshold); - // Test consistency, and error, between supplied partial sets - bool checkPartialSet(const PartialSet &setA, const PartialSet &setB, double testThreshold); - // Check consistency between production, molecular, and test energies, returning production values - Kernel::EnergyResult checkEnergyConsistency(const std::unique_ptr &kernel, double testThreshold = 1.0e-6); - // 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); - // Check consistency of supplied forces - void checkReferenceForceConsistency(const std::vector &ppForces, const std::vector &geomForces, - const std::vector &referenceForces, double maxDeviation = 1.0e-3); +/* + * Data Test Functions + */ - /* - * Utility Functions - */ - public: - // Save the specified graph in Mermaid format to a file named after the unit test - static void exportMermaidGraph(Graph &graph); - // Save the current graph in Mermaid format to a file named after the unit test - void exportMermaidGraph(); -}; -} // namespace UnitTest +// Test simple double +[[nodiscard]] bool checkDouble(std::string_view quantity, double A, double B, double threshold); +// Test sampled double +[[nodiscard]] bool checkSampledDouble(std::string_view quantity, SampledDouble A, double B, double threshold); +// Test Data1D +[[nodiscard]] 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); +[[nodiscard]] 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); +// Test Data2D +[[nodiscard]] 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); +// Test Data3D +[[nodiscard]] 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); +// Test Vec3 data +void checkVec3(const Vector3 &A, const Vector3 &B, double tolerance = 1.0e-6); +// Test Vec3 vector data +void checkVec3Vector(const std::vector &A, const std::vector &B, double tolerance = 1.0e-6); +// Test species atom type +void checkSpeciesAtomType(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 checkSpeciesIntramolecular(Species *sp, std::vector atoms, const InteractionPotential &expectedParams, + double tolerance = 1.0e-6); +// Test species angle term +void checkSpeciesIntramolecular(Species *sp, std::vector atoms, const InteractionPotential &expectedParams, + double tolerance = 1.0e-6); +// Test species torsion / improper term +void checkSpeciesIntramolecular(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 checkDoubleKeyedMap(std::string_view mapContents, const DoubleKeyedMap &mapA, + const DoubleKeyedMap &mapB, double testThreshold); +// Test consistency, and error, between supplied partial sets +bool checkPartialSet(const PartialSet &setA, const PartialSet &setB, double testThreshold); +// Check consistency between production, molecular, and test energies, returning production values +Kernel::EnergyResult checkEnergyConsistency(const std::unique_ptr &kernel, double testThreshold = 1.0e-6); +// 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); +// Check consistency of supplied forces +void checkReferenceForceConsistency(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/testingChecks.cpp b/tests/testingChecks.cpp index d6025681a5..68f254e284 100644 --- a/tests/testingChecks.cpp +++ b/tests/testingChecks.cpp @@ -25,7 +25,7 @@ namespace UnitTest } // Test Data1D [[nodiscard]] 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) + double tolerance, Error::ErrorType errorType) { // Generate the error estimate and compare against the threshold value auto error = Error::error(errorType, dataA, dataB).error; @@ -35,7 +35,7 @@ namespace UnitTest return !notOK; } [[nodiscard]] 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) + double tolerance, Error::ErrorType errorType) { Data1D dataB; if (!ImportXYDataNode::read(dataB, filePath, xColumn, yColumn)) @@ -48,7 +48,7 @@ namespace UnitTest } // Test Data2D [[nodiscard]] 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) + 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; @@ -60,7 +60,7 @@ namespace UnitTest } // Test Data3D [[nodiscard]] 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) + 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; @@ -71,14 +71,14 @@ namespace UnitTest return !notOK; } // Test Vec3 data -void checkVec3(const Vector3 &A, const Vector3 &B, double tolerance = 1.0e-6) +void checkVec3(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 checkVec3Vector(const std::vector &A, const std::vector &B, double tolerance = 1.0e-6) +void checkVec3Vector(const std::vector &A, const std::vector &B, double tolerance) { ASSERT_EQ(A.size(), B.size()); for (auto n = 0; n < A.size(); ++n) @@ -99,7 +99,7 @@ void checkSpeciesAtomType(Species *sp, const std::map &namesBy // Test interaction parameters template void checkIntramolecularTerms(const std::string &termInfo, const InteractionPotential &expectedParams, - const InteractionPotential &actualParams, double tolerance = 1.0e-6) + const InteractionPotential &actualParams, double tolerance) { Messenger::print("Testing intramolecular interaction: {}...\n", termInfo); EXPECT_EQ(Intra::forms().keyword(actualParams.form()), Intra::forms().keyword(expectedParams.form())); @@ -109,7 +109,7 @@ void checkIntramolecularTerms(const std::string &termInfo, const InteractionPote } // Test species bond term void checkSpeciesIntramolecular(Species *sp, std::vector atoms, const InteractionPotential &expectedParams, - double tolerance = 1.0e-6) + double tolerance) { ASSERT_TRUE(atoms.size() == 2); const auto &b = sp->getBond(&sp->atoms()[atoms[0]], &sp->atoms()[atoms[1]]); @@ -120,7 +120,7 @@ void checkSpeciesIntramolecular(Species *sp, std::vector atoms, const Inter } // Test species angle term void checkSpeciesIntramolecular(Species *sp, std::vector atoms, const InteractionPotential &expectedParams, - double tolerance = 1.0e-6) + double tolerance) { ASSERT_TRUE(atoms.size() == 3); const auto &a = sp->getAngle(&sp->atoms()[atoms[0]], &sp->atoms()[atoms[1]], &sp->atoms()[atoms[2]]); @@ -131,7 +131,7 @@ void checkSpeciesIntramolecular(Species *sp, std::vector atoms, const Inter } // Test species torsion / improper term void checkSpeciesIntramolecular(Species *sp, std::vector atoms, - const InteractionPotential &expectedParams, double tolerance = 1.0e-6) + const InteractionPotential &expectedParams, double tolerance) { ASSERT_TRUE(atoms.size() == 4); const auto &t = @@ -215,7 +215,7 @@ bool checkPartialSet(const PartialSet &setA, const PartialSet &setB, double test } // Check consistency between production, molecular, and test energies, returning production values -Kernel::EnergyResult checkEnergyConsistency(const std::unique_ptr &kernel, double testThreshold = 1.0e-6) +Kernel::EnergyResult checkEnergyConsistency(const std::unique_ptr &kernel, double testThreshold) { // Calculate production energies (fully optimised) auto productionEnergy = kernel->totalEnergy(); @@ -244,8 +244,8 @@ Kernel::EnergyResult checkEnergyConsistency(const std::unique_ptr // 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) + std::vector &geomForces, Flags flags, double ppMaxDeviation, + double geomMaxDeviation) { // Calculate production forces (fully optimised) kernel->totalForces(ppForces, geomForces, flags); @@ -276,7 +276,7 @@ void checkForceConsistency(const std::unique_ptr &kernel, std::vect // Check consistency of supplied forces void checkReferenceForceConsistency(const std::vector &ppForces, const std::vector &geomForces, - const std::vector &referenceForces, double maxDeviation = 1.0e-3) + const std::vector &referenceForces, double maxDeviation) { ASSERT_TRUE(ppForces.size() == geomForces.size()); ASSERT_TRUE(ppForces.size() == referenceForces.size()); diff --git a/tests/testingTOML.cpp b/tests/testingTOML.cpp new file mode 100644 index 0000000000..6849e3cde9 --- /dev/null +++ b/tests/testingTOML.cpp @@ -0,0 +1,33 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +// Copyright (c) 2026 Team Dissolve and contributors + +#include "tests/testing.h" + +namespace UnitTest +{ +// Comparie 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; + } +} +}; // namespace UnitTest \ No newline at end of file diff --git a/tests/workflows/phantomAtoms.cpp b/tests/workflows/phantomAtoms.cpp index cf32028b87..92e04a5494 100644 --- a/tests/workflows/phantomAtoms.cpp +++ b/tests/workflows/phantomAtoms.cpp @@ -4,9 +4,9 @@ #include "data/atomicMasses.h" #include "nodes/gr.h" #include "nodes/neutronSQ.h" +#include "nodes/species.h" #include "nodes/sq.h" #include "nodes/xRaySQ.h" -#include "tests/testData.h" #include "tests/testing.h" #include @@ -96,65 +96,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(checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("OW", "OW")), "OW-OW Unbound Partial", + "epsr25/water1000-neutron/water.EPSR.g01", 1, 2, 6.0e-2)); + EXPECT_TRUE(checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("HW", "OW")), "HW-OW Unbound Partial", + "epsr25/water1000-neutron/water.EPSR.g01", 1, 4, 2.0e-2)); + EXPECT_TRUE(checkData1D(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(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(checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("HW", "OW")), "HW-OW Bound Partial", + "epsr25/water1000-neutron/water.EPSR.y01", 1, 4, 0.1)); + EXPECT_TRUE(checkData1D(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(checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("OW", "OW")), "OW-OW Unbound Partial", + "epsr25/water1000-neutron/water.EPSR.f01", 1, 2, 1.0e-3)); + EXPECT_TRUE(checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("OW", "HW")), "OW-HW Unbound Partial", + "epsr25/water1000-neutron/water.EPSR.f01", 1, 4, 3.0e-3)); + EXPECT_TRUE(checkData1D(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(checkData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("OW", "HW")), "OW-HW Bound Partial", + "epsr25/water1000-neutron/water.EPSR.s01", 1, 4, 1.0e-4)); + EXPECT_TRUE(checkData1D(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(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)); // 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(checkData1D(D2O->getOutputValue("WeightedSQ")->total(), "D2O F(Q)", + "epsr25/water1000-neutron/water.EPSR.u01", 1, 2, 3.0e-4)); + EXPECT_TRUE(checkData1D(H2O->getOutputValue("WeightedSQ")->total(), "H2O F(Q)", + "epsr25/water1000-neutron/water.EPSR.u01", 1, 4, 6.0e-4)); + EXPECT_TRUE(checkData1D(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(checkData1D(H2Ox->getOutputValue("WeightedSQ")->total(), "H2Ox F(Q)", + "epsr25/water1000-neutron-xray/water.EPSR.u01", 1, 8, 1.5e-4)); } } // namespace UnitTest From 104bb68ae47200fd5f435e774910891e2723eff6 Mon Sep 17 00:00:00 2001 From: Tristan Youngs Date: Fri, 26 Jun 2026 11:48:00 +0100 Subject: [PATCH 4/7] Remove explicit gtest include from tests that don't need it. --- tests/CMakeLists.txt | 2 +- tests/algorithms/array3DIterator.cpp | 2 +- tests/algorithms/zip.cpp | 1 - tests/classes/cells.cpp | 1 - tests/classes/cells3.cpp | 1 - tests/classes/cells4.cpp | 1 - tests/classes/doubleKeyedMap.cpp | 1 - tests/classes/history.cpp | 1 - tests/classes/neutronWeights.cpp | 1 - tests/classes/structure.cpp | 1 - tests/ff/assignment-Kulmala2010.cpp | 1 - tests/ff/assignment-Ludwig-py5.cpp | 1 - tests/ff/assignment-OPLSAA2005-alcohols.cpp | 1 - tests/ff/assignment-OPLSAA2005-alkanes.cpp | 1 - tests/ff/assignment-OPLSAA2005-aromatics.cpp | 1 - tests/ff/assignment-PCL2019-anions.cpp | 1 - tests/ff/assignment-PCL2019-cations.cpp | 1 - tests/ff/assignment-SPCFw.cpp | 1 - tests/ff/assignment-UFF-nmethylformamide.cpp | 1 - tests/ff/assignment-UFF4MOF-mof5.cpp | 1 - tests/ff/benzene.cpp | 1 - tests/ff/cos-n.cpp | 1 - tests/ff/hexane.cpp | 1 - tests/ff/water-1000.cpp | 1 - tests/generator/procedure.cpp | 1 - tests/generator/rotateFragment.cpp | 1 - tests/generator/select.cpp | 1 - tests/gui/addForcefieldTerms.cpp | 1 - tests/gui/isotopologueSetModel.cpp | 1 - tests/gui/masterTerms.cpp | 1 - tests/gui/modifyCharges.cpp | 1 - tests/gui/optionalDoubleKeyword.cpp | 1 - tests/gui/optionalIntegerKeyword.cpp | 1 - tests/gui/speciesModel.cpp | 1 - tests/gui/speciesTab.cpp | 1 - tests/math/data1D.cpp | 1 - tests/math/histogram1D.cpp | 1 - tests/math/poisson.cpp | 1 - tests/math/sampledValues.cpp | 1 - tests/math/vector3.cpp | 1 - tests/nodes/angle.cpp | 1 - tests/nodes/atomicMC.cpp | 1 - tests/nodes/averageMolecule.cpp | 1 - tests/nodes/axisAngle.cpp | 1 - tests/nodes/bragg.cpp | 1 - tests/nodes/broadening.cpp | 1 - tests/nodes/cif.cpp | 1 - tests/nodes/dAngle.cpp | 1 - tests/nodes/epsr.cpp | 1 - tests/nodes/flow.cpp | 1 - tests/nodes/gr.cpp | 1 - tests/nodes/graph.cpp | 1 - tests/nodes/graphArgon.cpp | 1 - tests/nodes/histogramCN.cpp | 1 - tests/nodes/intraAngle.cpp | 1 - tests/nodes/intraDistance.cpp | 1 - tests/nodes/modifierOSites.cpp | 1 - tests/nodes/moleculeTorsion.cpp | 1 - tests/nodes/neutronSQ.cpp | 1 - tests/nodes/orientedSDF.cpp | 1 - tests/nodes/parameters.cpp | 1 - tests/nodes/qSpecies.cpp | 1 - tests/nodes/sdf.cpp | 1 - tests/nodes/siteRDF.cpp | 1 - tests/nodes/sq.cpp | 1 - tests/nodes/trajectory.cpp | 1 - tests/nodes/voxelDensity.cpp | 1 - tests/nodes/xRaySQ.cpp | 1 - tests/pairPotentials/cutoffs.cpp | 1 - tests/pairPotentials/overrides.cpp | 1 - tests/workflows/phantomAtoms.cpp | 1 - 71 files changed, 2 insertions(+), 71 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index a422b15b73..f13bc44963 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -66,7 +66,7 @@ add_library(testing testing.cpp testingChecks.cpp testingTOML.cpp testing.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} ${CONAN_INCLUDE_DIRS} + ${CONAN_INCLUDE_DIRS_PUGIXML} ) # Add unit test subdirectories 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 1fd98b5231..f6d5faa3eb 100644 --- a/tests/classes/cells.cpp +++ b/tests/classes/cells.cpp @@ -9,7 +9,6 @@ #include "math/mathFunc.h" #include "nodes/species.h" #include "tests/testing.h" -#include namespace UnitTest { diff --git a/tests/classes/cells3.cpp b/tests/classes/cells3.cpp index 7f6169d5fd..9b08be8e2a 100644 --- a/tests/classes/cells3.cpp +++ b/tests/classes/cells3.cpp @@ -6,7 +6,6 @@ #include "nodes/species.h" #include "templates/algorithms.h" #include "tests/testing.h" -#include namespace UnitTest { diff --git a/tests/classes/cells4.cpp b/tests/classes/cells4.cpp index 21e992702d..77ef9b8aeb 100644 --- a/tests/classes/cells4.cpp +++ b/tests/classes/cells4.cpp @@ -3,7 +3,6 @@ #include "classes/configuration.h" #include "tests/testing.h" -#include namespace UnitTest { diff --git a/tests/classes/doubleKeyedMap.cpp b/tests/classes/doubleKeyedMap.cpp index 6158b0e5fb..c0ecdad747 100644 --- a/tests/classes/doubleKeyedMap.cpp +++ b/tests/classes/doubleKeyedMap.cpp @@ -3,7 +3,6 @@ #include "templates/doubleKeyedMap.h" #include "tests/testing.h" -#include namespace UnitTest { diff --git a/tests/classes/history.cpp b/tests/classes/history.cpp index 6c510bc624..0dcc8c1a90 100644 --- a/tests/classes/history.cpp +++ b/tests/classes/history.cpp @@ -5,7 +5,6 @@ #include "nodes/number.h" #include "nodes/species.h" #include "tests/testing.h" -#include namespace UnitTest { diff --git a/tests/classes/neutronWeights.cpp b/tests/classes/neutronWeights.cpp index cb20a672df..54517f9f1b 100644 --- a/tests/classes/neutronWeights.cpp +++ b/tests/classes/neutronWeights.cpp @@ -6,7 +6,6 @@ #include "classes/species.h" #include "tests/tempFile.h" #include "tests/testing.h" -#include namespace UnitTest { diff --git a/tests/classes/structure.cpp b/tests/classes/structure.cpp index 9ea35e620d..6844d61483 100644 --- a/tests/classes/structure.cpp +++ b/tests/classes/structure.cpp @@ -5,7 +5,6 @@ #include "nodes/calculateBonding.h" #include "tests/testing.h" #include -#include namespace UnitTest { diff --git a/tests/ff/assignment-Kulmala2010.cpp b/tests/ff/assignment-Kulmala2010.cpp index 2b1e58c666..5673d1c264 100644 --- a/tests/ff/assignment-Kulmala2010.cpp +++ b/tests/ff/assignment-Kulmala2010.cpp @@ -4,7 +4,6 @@ #include "data/ff/library.h" #include "nodes/species.h" #include "tests/testing.h" -#include namespace UnitTest { diff --git a/tests/ff/assignment-Ludwig-py5.cpp b/tests/ff/assignment-Ludwig-py5.cpp index ee7d8e2046..202a44f73b 100644 --- a/tests/ff/assignment-Ludwig-py5.cpp +++ b/tests/ff/assignment-Ludwig-py5.cpp @@ -4,7 +4,6 @@ #include "data/ff/library.h" #include "nodes/species.h" #include "tests/testing.h" -#include #include namespace UnitTest diff --git a/tests/ff/assignment-OPLSAA2005-alcohols.cpp b/tests/ff/assignment-OPLSAA2005-alcohols.cpp index 2383955fbe..a053f1bb22 100644 --- a/tests/ff/assignment-OPLSAA2005-alcohols.cpp +++ b/tests/ff/assignment-OPLSAA2005-alcohols.cpp @@ -4,7 +4,6 @@ #include "data/ff/library.h" #include "nodes/species.h" #include "tests/testing.h" -#include namespace UnitTest { diff --git a/tests/ff/assignment-OPLSAA2005-alkanes.cpp b/tests/ff/assignment-OPLSAA2005-alkanes.cpp index 327f4b4396..6cd2a198fc 100644 --- a/tests/ff/assignment-OPLSAA2005-alkanes.cpp +++ b/tests/ff/assignment-OPLSAA2005-alkanes.cpp @@ -4,7 +4,6 @@ #include "data/ff/library.h" #include "nodes/species.h" #include "tests/testing.h" -#include namespace UnitTest { diff --git a/tests/ff/assignment-OPLSAA2005-aromatics.cpp b/tests/ff/assignment-OPLSAA2005-aromatics.cpp index 5b805f83de..aee3f1f651 100644 --- a/tests/ff/assignment-OPLSAA2005-aromatics.cpp +++ b/tests/ff/assignment-OPLSAA2005-aromatics.cpp @@ -4,7 +4,6 @@ #include "data/ff/library.h" #include "nodes/species.h" #include "tests/testing.h" -#include namespace UnitTest { diff --git a/tests/ff/assignment-PCL2019-anions.cpp b/tests/ff/assignment-PCL2019-anions.cpp index e3b9a420d0..695f8384a9 100644 --- a/tests/ff/assignment-PCL2019-anions.cpp +++ b/tests/ff/assignment-PCL2019-anions.cpp @@ -4,7 +4,6 @@ #include "data/ff/library.h" #include "nodes/species.h" #include "tests/testing.h" -#include namespace UnitTest { diff --git a/tests/ff/assignment-PCL2019-cations.cpp b/tests/ff/assignment-PCL2019-cations.cpp index 80efb4859a..b6ebcb2273 100644 --- a/tests/ff/assignment-PCL2019-cations.cpp +++ b/tests/ff/assignment-PCL2019-cations.cpp @@ -4,7 +4,6 @@ #include "data/ff/library.h" #include "nodes/species.h" #include "tests/testing.h" -#include namespace UnitTest { diff --git a/tests/ff/assignment-SPCFw.cpp b/tests/ff/assignment-SPCFw.cpp index 228d7a3c83..774286cf90 100644 --- a/tests/ff/assignment-SPCFw.cpp +++ b/tests/ff/assignment-SPCFw.cpp @@ -4,7 +4,6 @@ #include "data/ff/library.h" #include "nodes/species.h" #include "tests/testing.h" -#include namespace UnitTest { diff --git a/tests/ff/assignment-UFF-nmethylformamide.cpp b/tests/ff/assignment-UFF-nmethylformamide.cpp index 6063ec9259..5078112895 100644 --- a/tests/ff/assignment-UFF-nmethylformamide.cpp +++ b/tests/ff/assignment-UFF-nmethylformamide.cpp @@ -4,7 +4,6 @@ #include "data/ff/library.h" #include "nodes/species.h" #include "tests/testing.h" -#include namespace UnitTest { diff --git a/tests/ff/assignment-UFF4MOF-mof5.cpp b/tests/ff/assignment-UFF4MOF-mof5.cpp index df67a810f2..117cc9e8aa 100644 --- a/tests/ff/assignment-UFF4MOF-mof5.cpp +++ b/tests/ff/assignment-UFF4MOF-mof5.cpp @@ -4,7 +4,6 @@ #include "data/ff/library.h" #include "nodes/species.h" #include "tests/testing.h" -#include namespace UnitTest { diff --git a/tests/ff/benzene.cpp b/tests/ff/benzene.cpp index 6dadfa68d4..b6e7201062 100644 --- a/tests/ff/benzene.cpp +++ b/tests/ff/benzene.cpp @@ -6,7 +6,6 @@ #include "nodes/dissolve.h" #include "nodes/species.h" #include "tests/testing.h" -#include namespace UnitTest { diff --git a/tests/ff/cos-n.cpp b/tests/ff/cos-n.cpp index 142e6eddca..83190e7598 100644 --- a/tests/ff/cos-n.cpp +++ b/tests/ff/cos-n.cpp @@ -6,7 +6,6 @@ #include "kernels/force.h" #include "tests/tempFile.h" #include "tests/testing.h" -#include namespace UnitTest { diff --git a/tests/ff/hexane.cpp b/tests/ff/hexane.cpp index fa80b0dc93..e5df534923 100644 --- a/tests/ff/hexane.cpp +++ b/tests/ff/hexane.cpp @@ -6,7 +6,6 @@ #include "nodes/dissolve.h" #include "nodes/species.h" #include "tests/testing.h" -#include namespace UnitTest { diff --git a/tests/ff/water-1000.cpp b/tests/ff/water-1000.cpp index a1a4828d61..a7a315b117 100644 --- a/tests/ff/water-1000.cpp +++ b/tests/ff/water-1000.cpp @@ -5,7 +5,6 @@ #include "kernels/force.h" #include "nodes/species.h" #include "tests/testing.h" -#include 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 725fb6758e..df5d403c57 100644 --- a/tests/generator/rotateFragment.cpp +++ b/tests/generator/rotateFragment.cpp @@ -9,7 +9,6 @@ #include "generator/generator.h" #include "generator/select.h" #include "main/dissolve.h" -#include #include namespace UnitTest diff --git a/tests/generator/select.cpp b/tests/generator/select.cpp index 824654e62b..5ef06a12e3 100644 --- a/tests/generator/select.cpp +++ b/tests/generator/select.cpp @@ -6,7 +6,6 @@ #include "data/ff/library.h" #include "generator/generator.h" #include "main/dissolve.h" -#include #include namespace UnitTest diff --git a/tests/gui/addForcefieldTerms.cpp b/tests/gui/addForcefieldTerms.cpp index b2f464df43..2aba80f01b 100644 --- a/tests/gui/addForcefieldTerms.cpp +++ b/tests/gui/addForcefieldTerms.cpp @@ -6,7 +6,6 @@ #include "tests/testing.h" #include #include -#include namespace UnitTest { diff --git a/tests/gui/isotopologueSetModel.cpp b/tests/gui/isotopologueSetModel.cpp index 4b59d534e6..1c6bed3aea 100644 --- a/tests/gui/isotopologueSetModel.cpp +++ b/tests/gui/isotopologueSetModel.cpp @@ -5,7 +5,6 @@ #include "classes/isotopologueSet.h" #include "classes/species.h" #include "tests/testing.h" -#include 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 cb871b52d0..5fc8333c79 100644 --- a/tests/math/data1D.cpp +++ b/tests/math/data1D.cpp @@ -3,7 +3,6 @@ #include "math/data1D.h" #include "tests/testing.h" -#include namespace UnitTest { diff --git a/tests/math/histogram1D.cpp b/tests/math/histogram1D.cpp index f7dca09550..f08f97d57f 100644 --- a/tests/math/histogram1D.cpp +++ b/tests/math/histogram1D.cpp @@ -3,7 +3,6 @@ #include "math/histogram1D.h" #include "tests/testing.h" -#include namespace UnitTest { diff --git a/tests/math/poisson.cpp b/tests/math/poisson.cpp index d6bc105d2f..eb875b7fa5 100644 --- a/tests/math/poisson.cpp +++ b/tests/math/poisson.cpp @@ -4,7 +4,6 @@ #include "math/poissonFit.h" #include "nodes/importXYData.h" #include "tests/testing.h" -#include namespace UnitTest { diff --git a/tests/math/sampledValues.cpp b/tests/math/sampledValues.cpp index 3284d9a6b0..90f16bd0ac 100644 --- a/tests/math/sampledValues.cpp +++ b/tests/math/sampledValues.cpp @@ -7,7 +7,6 @@ #include "templates/algorithms.h" #include "tests/testing.h" #include -#include #include namespace UnitTest diff --git a/tests/math/vector3.cpp b/tests/math/vector3.cpp index 8a93a8fc47..9150631f0c 100644 --- a/tests/math/vector3.cpp +++ b/tests/math/vector3.cpp @@ -3,7 +3,6 @@ #include "math/vector3.h" #include "tests/testing.h" -#include namespace UnitTest { diff --git a/tests/nodes/angle.cpp b/tests/nodes/angle.cpp index 753c76ca13..f5e0a22a50 100644 --- a/tests/nodes/angle.cpp +++ b/tests/nodes/angle.cpp @@ -7,7 +7,6 @@ #include "nodes/iterableGraph.h" #include "nodes/species.h" #include "tests/testing.h" -#include namespace UnitTest { diff --git a/tests/nodes/atomicMC.cpp b/tests/nodes/atomicMC.cpp index cbfa4356f1..f8a0357429 100644 --- a/tests/nodes/atomicMC.cpp +++ b/tests/nodes/atomicMC.cpp @@ -7,7 +7,6 @@ #include "nodes/insert.h" #include "nodes/iterableGraph.h" #include "tests/testing.h" -#include #include namespace UnitTest diff --git a/tests/nodes/averageMolecule.cpp b/tests/nodes/averageMolecule.cpp index 6547620944..d37eb23f39 100644 --- a/tests/nodes/averageMolecule.cpp +++ b/tests/nodes/averageMolecule.cpp @@ -5,7 +5,6 @@ #include "nodes/iterableGraph.h" #include "nodes/species.h" #include "tests/testing.h" -#include namespace UnitTest { diff --git a/tests/nodes/axisAngle.cpp b/tests/nodes/axisAngle.cpp index df90cc04ec..a426cc70c6 100644 --- a/tests/nodes/axisAngle.cpp +++ b/tests/nodes/axisAngle.cpp @@ -4,7 +4,6 @@ #include "nodes/axisAngle.h" #include "nodes/species.h" #include "tests/testing.h" -#include namespace UnitTest { diff --git a/tests/nodes/bragg.cpp b/tests/nodes/bragg.cpp index b112e94994..d74730ebba 100644 --- a/tests/nodes/bragg.cpp +++ b/tests/nodes/bragg.cpp @@ -9,7 +9,6 @@ #include "nodes/iterableGraph.h" #include "nodes/sq.h" #include "tests/testing.h" -#include #include namespace UnitTest diff --git a/tests/nodes/broadening.cpp b/tests/nodes/broadening.cpp index a033b492f4..b00dd38e13 100644 --- a/tests/nodes/broadening.cpp +++ b/tests/nodes/broadening.cpp @@ -6,7 +6,6 @@ #include "nodes/neutronSQ.h" #include "nodes/sq.h" #include "tests/testing.h" -#include namespace UnitTest { diff --git a/tests/nodes/cif.cpp b/tests/nodes/cif.cpp index 138ee8cc44..aad00552e9 100644 --- a/tests/nodes/cif.cpp +++ b/tests/nodes/cif.cpp @@ -5,7 +5,6 @@ #include "classes/empiricalFormula.h" #include "nodes/cif/importCIFStructure.h" #include "tests/testing.h" -#include #include namespace UnitTest diff --git a/tests/nodes/dAngle.cpp b/tests/nodes/dAngle.cpp index 504860ea78..5b8749c982 100644 --- a/tests/nodes/dAngle.cpp +++ b/tests/nodes/dAngle.cpp @@ -7,7 +7,6 @@ #include "nodes/iterableGraph.h" #include "nodes/species.h" #include "tests/testing.h" -#include namespace UnitTest { diff --git a/tests/nodes/epsr.cpp b/tests/nodes/epsr.cpp index 6e91ede952..e50e4bf8bb 100644 --- a/tests/nodes/epsr.cpp +++ b/tests/nodes/epsr.cpp @@ -9,7 +9,6 @@ #include "nodes/sq.h" #include "nodes/xRaySQ.h" #include "tests/testing.h" -#include #include namespace UnitTest diff --git a/tests/nodes/flow.cpp b/tests/nodes/flow.cpp index 0ceba705ca..1bdffcdb89 100644 --- a/tests/nodes/flow.cpp +++ b/tests/nodes/flow.cpp @@ -7,7 +7,6 @@ #include "nodes/number.h" #include "nodes/numberNode.h" #include "tests/testing.h" -#include namespace UnitTest { diff --git a/tests/nodes/gr.cpp b/tests/nodes/gr.cpp index 057b676470..6d43757e19 100644 --- a/tests/nodes/gr.cpp +++ b/tests/nodes/gr.cpp @@ -4,7 +4,6 @@ #include "nodes/gr.h" #include "math/windowFunction.h" #include "tests/testing.h" -#include namespace UnitTest { diff --git a/tests/nodes/graph.cpp b/tests/nodes/graph.cpp index f8a678916c..62122e0e3c 100644 --- a/tests/nodes/graph.cpp +++ b/tests/nodes/graph.cpp @@ -5,7 +5,6 @@ #include "nodes/dissolve.h" #include "nodes/registry.h" #include "tests/testing.h" -#include namespace UnitTest { diff --git a/tests/nodes/graphArgon.cpp b/tests/nodes/graphArgon.cpp index adf8cf2c80..c3493a0c7b 100644 --- a/tests/nodes/graphArgon.cpp +++ b/tests/nodes/graphArgon.cpp @@ -8,7 +8,6 @@ #include "nodes/neutronSQ.h" #include "nodes/sq.h" #include "tests/testing.h" -#include namespace UnitTest { diff --git a/tests/nodes/histogramCN.cpp b/tests/nodes/histogramCN.cpp index 1a90aecde2..df2b0f865a 100644 --- a/tests/nodes/histogramCN.cpp +++ b/tests/nodes/histogramCN.cpp @@ -6,7 +6,6 @@ #include "nodes/iterableGraph.h" #include "nodes/species.h" #include "tests/testing.h" -#include namespace UnitTest { diff --git a/tests/nodes/intraAngle.cpp b/tests/nodes/intraAngle.cpp index aa19b7f0b9..4241a8a348 100644 --- a/tests/nodes/intraAngle.cpp +++ b/tests/nodes/intraAngle.cpp @@ -7,7 +7,6 @@ #include "nodes/iterableGraph.h" #include "nodes/species.h" #include "tests/testing.h" -#include #include namespace UnitTest diff --git a/tests/nodes/intraDistance.cpp b/tests/nodes/intraDistance.cpp index f4e13c8515..8a18928ca7 100644 --- a/tests/nodes/intraDistance.cpp +++ b/tests/nodes/intraDistance.cpp @@ -6,7 +6,6 @@ #include "nodes/iterableGraph.h" #include "nodes/species.h" #include "tests/testing.h" -#include #include namespace UnitTest diff --git a/tests/nodes/modifierOSites.cpp b/tests/nodes/modifierOSites.cpp index 79d5aa01d7..8403b70281 100644 --- a/tests/nodes/modifierOSites.cpp +++ b/tests/nodes/modifierOSites.cpp @@ -4,7 +4,6 @@ #include "nodes/modifierOSites.h" #include "nodes/species.h" #include "tests/testing.h" -#include namespace UnitTest { diff --git a/tests/nodes/moleculeTorsion.cpp b/tests/nodes/moleculeTorsion.cpp index a255e5f556..19c50dfd3a 100644 --- a/tests/nodes/moleculeTorsion.cpp +++ b/tests/nodes/moleculeTorsion.cpp @@ -4,7 +4,6 @@ #include "nodes/moleculeTorsion.h" #include "nodes/iterableGraph.h" #include "tests/testing.h" -#include namespace UnitTest { diff --git a/tests/nodes/neutronSQ.cpp b/tests/nodes/neutronSQ.cpp index 125a7dd460..1f0142edcd 100644 --- a/tests/nodes/neutronSQ.cpp +++ b/tests/nodes/neutronSQ.cpp @@ -6,7 +6,6 @@ #include "nodes/gr.h" #include "nodes/sq.h" #include "tests/testing.h" -#include namespace UnitTest { diff --git a/tests/nodes/orientedSDF.cpp b/tests/nodes/orientedSDF.cpp index 0c31055c7e..9149816522 100644 --- a/tests/nodes/orientedSDF.cpp +++ b/tests/nodes/orientedSDF.cpp @@ -6,7 +6,6 @@ #include "nodes/iterableGraph.h" #include "nodes/species.h" #include "tests/testing.h" -#include namespace UnitTest { diff --git a/tests/nodes/parameters.cpp b/tests/nodes/parameters.cpp index dae1722518..7d1eb79c97 100644 --- a/tests/nodes/parameters.cpp +++ b/tests/nodes/parameters.cpp @@ -5,7 +5,6 @@ #include "nodes/numberNode.h" #include "nodes/test.h" #include "tests/testing.h" -#include namespace UnitTest { diff --git a/tests/nodes/qSpecies.cpp b/tests/nodes/qSpecies.cpp index 3b8b470d9a..c5bc2d98b9 100644 --- a/tests/nodes/qSpecies.cpp +++ b/tests/nodes/qSpecies.cpp @@ -4,7 +4,6 @@ #include "nodes/qSpecies.h" #include "nodes/species.h" #include "tests/testing.h" -#include namespace UnitTest { diff --git a/tests/nodes/sdf.cpp b/tests/nodes/sdf.cpp index 9932cef93d..966b21ea59 100644 --- a/tests/nodes/sdf.cpp +++ b/tests/nodes/sdf.cpp @@ -6,7 +6,6 @@ #include "nodes/iterableGraph.h" #include "nodes/species.h" #include "tests/testing.h" -#include namespace UnitTest { diff --git a/tests/nodes/siteRDF.cpp b/tests/nodes/siteRDF.cpp index 6d87d11272..4647789b86 100644 --- a/tests/nodes/siteRDF.cpp +++ b/tests/nodes/siteRDF.cpp @@ -6,7 +6,6 @@ #include "nodes/iterableGraph.h" #include "nodes/species.h" #include "tests/testing.h" -#include namespace UnitTest { diff --git a/tests/nodes/sq.cpp b/tests/nodes/sq.cpp index b8c7a0e23a..f61f8641e4 100644 --- a/tests/nodes/sq.cpp +++ b/tests/nodes/sq.cpp @@ -5,7 +5,6 @@ #include "math/windowFunction.h" #include "nodes/gr.h" #include "tests/testing.h" -#include namespace UnitTest { diff --git a/tests/nodes/trajectory.cpp b/tests/nodes/trajectory.cpp index 4030796cbd..d87afa6b93 100644 --- a/tests/nodes/trajectory.cpp +++ b/tests/nodes/trajectory.cpp @@ -7,7 +7,6 @@ #include "tests/tempFile.h" #include "tests/testing.h" #include -#include #include #include diff --git a/tests/nodes/voxelDensity.cpp b/tests/nodes/voxelDensity.cpp index d850e40271..0061f1a821 100644 --- a/tests/nodes/voxelDensity.cpp +++ b/tests/nodes/voxelDensity.cpp @@ -5,7 +5,6 @@ #include "data/atomicMasses.h" #include "nodes/configuration.h" #include "tests/testing.h" -#include namespace UnitTest { diff --git a/tests/nodes/xRaySQ.cpp b/tests/nodes/xRaySQ.cpp index 7def4342ad..f382da1dbb 100644 --- a/tests/nodes/xRaySQ.cpp +++ b/tests/nodes/xRaySQ.cpp @@ -4,7 +4,6 @@ #include "nodes/xRaySQ.h" #include "nodes/gr.h" #include "tests/testing.h" -#include namespace UnitTest { diff --git a/tests/pairPotentials/cutoffs.cpp b/tests/pairPotentials/cutoffs.cpp index 3487cbff8e..9ebb2bf3c6 100644 --- a/tests/pairPotentials/cutoffs.cpp +++ b/tests/pairPotentials/cutoffs.cpp @@ -5,7 +5,6 @@ #include "nodes/dissolve.h" #include "nodes/species.h" #include "tests/testing.h" -#include namespace UnitTest { diff --git a/tests/pairPotentials/overrides.cpp b/tests/pairPotentials/overrides.cpp index d42aaea64c..2a0c02b76f 100644 --- a/tests/pairPotentials/overrides.cpp +++ b/tests/pairPotentials/overrides.cpp @@ -5,7 +5,6 @@ #include "nodes/neutronSQ.h" #include "nodes/species.h" #include "tests/testing.h" -#include #include namespace UnitTest diff --git a/tests/workflows/phantomAtoms.cpp b/tests/workflows/phantomAtoms.cpp index 92e04a5494..af35d63c57 100644 --- a/tests/workflows/phantomAtoms.cpp +++ b/tests/workflows/phantomAtoms.cpp @@ -8,7 +8,6 @@ #include "nodes/sq.h" #include "nodes/xRaySQ.h" #include "tests/testing.h" -#include namespace UnitTest { From 4a05609b6f0624bf3ff050826b674a8d9aaeac3c Mon Sep 17 00:00:00 2001 From: Tristan Youngs Date: Fri, 26 Jun 2026 12:47:20 +0100 Subject: [PATCH 5/7] TestGraph is its own thing. --- tests/CMakeLists.txt | 2 +- tests/classes/cells.cpp | 2 +- tests/classes/cells3.cpp | 2 +- tests/classes/cells4.cpp | 2 +- tests/classes/history.cpp | 2 +- tests/classes/structure.cpp | 2 +- tests/ff/assignment-Kulmala2010.cpp | 2 +- tests/ff/assignment-Ludwig-py5.cpp | 2 +- tests/ff/assignment-OPLSAA2005-alcohols.cpp | 2 +- tests/ff/assignment-OPLSAA2005-alkanes.cpp | 2 +- tests/ff/assignment-OPLSAA2005-aromatics.cpp | 2 +- tests/ff/assignment-PCL2019-anions.cpp | 2 +- tests/ff/assignment-PCL2019-cations.cpp | 2 +- tests/ff/assignment-SPCFw.cpp | 2 +- tests/ff/assignment-UFF-nmethylformamide.cpp | 2 +- tests/ff/assignment-UFF4MOF-mof5.cpp | 2 +- tests/ff/benzene.cpp | 2 +- tests/ff/cos-n.cpp | 2 +- tests/ff/hexane.cpp | 2 +- tests/ff/water-1000.cpp | 2 +- tests/nodes/angle.cpp | 2 +- tests/nodes/atomicMC.cpp | 3 +- tests/nodes/averageMolecule.cpp | 2 +- tests/nodes/axisAngle.cpp | 2 +- tests/nodes/bragg.cpp | 2 +- tests/nodes/broadening.cpp | 2 +- tests/nodes/cif.cpp | 2 +- tests/nodes/dAngle.cpp | 2 +- tests/nodes/epsr.cpp | 2 +- tests/nodes/flow.cpp | 2 +- tests/nodes/gr.cpp | 2 +- tests/nodes/graph.cpp | 2 +- tests/nodes/graphArgon.cpp | 2 +- tests/nodes/histogramCN.cpp | 2 +- tests/nodes/intraAngle.cpp | 3 +- tests/nodes/intraDistance.cpp | 2 +- tests/nodes/modifierOSites.cpp | 2 +- tests/nodes/moleculeTorsion.cpp | 2 +- tests/nodes/neutronSQ.cpp | 2 +- tests/nodes/orientedSDF.cpp | 2 +- tests/nodes/parameters.cpp | 2 +- tests/nodes/qSpecies.cpp | 2 +- tests/nodes/sdf.cpp | 2 +- tests/nodes/siteRDF.cpp | 2 +- tests/nodes/sq.cpp | 2 +- tests/nodes/trajectory.cpp | 2 +- tests/nodes/voxelDensity.cpp | 2 +- tests/nodes/xRaySQ.cpp | 2 +- tests/pairPotentials/cutoffs.cpp | 2 +- tests/pairPotentials/overrides.cpp | 3 +- tests/testGraph.cpp | 303 +++++++++++ tests/testGraph.h | 99 ++++ tests/testing.cpp | 508 ++++++++++--------- tests/testing.h | 82 --- tests/testingChecks.cpp | 292 ----------- tests/testingTOML.cpp | 33 -- tests/workflows/phantomAtoms.cpp | 2 +- 57 files changed, 719 insertions(+), 703 deletions(-) create mode 100644 tests/testGraph.cpp create mode 100644 tests/testGraph.h delete mode 100644 tests/testingChecks.cpp delete mode 100644 tests/testingTOML.cpp diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index f13bc44963..ad9e4babe4 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -62,7 +62,7 @@ function(dissolve_add_test) endfunction() -add_library(testing testing.cpp testingChecks.cpp testingTOML.cpp testing.h) +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} diff --git a/tests/classes/cells.cpp b/tests/classes/cells.cpp index f6d5faa3eb..7188b54170 100644 --- a/tests/classes/cells.cpp +++ b/tests/classes/cells.cpp @@ -8,7 +8,7 @@ #include "main/dissolve.h" #include "math/mathFunc.h" #include "nodes/species.h" -#include "tests/testing.h" +#include "tests/testGraph.h" namespace UnitTest { diff --git a/tests/classes/cells3.cpp b/tests/classes/cells3.cpp index 9b08be8e2a..c21b868dad 100644 --- a/tests/classes/cells3.cpp +++ b/tests/classes/cells3.cpp @@ -5,7 +5,7 @@ #include "kernels/energy.h" #include "nodes/species.h" #include "templates/algorithms.h" -#include "tests/testing.h" +#include "tests/testGraph.h" namespace UnitTest { diff --git a/tests/classes/cells4.cpp b/tests/classes/cells4.cpp index 77ef9b8aeb..e203bd9800 100644 --- a/tests/classes/cells4.cpp +++ b/tests/classes/cells4.cpp @@ -2,7 +2,7 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "classes/configuration.h" -#include "tests/testing.h" +#include "tests/testGraph.h" namespace UnitTest { diff --git a/tests/classes/history.cpp b/tests/classes/history.cpp index 0dcc8c1a90..366fbec402 100644 --- a/tests/classes/history.cpp +++ b/tests/classes/history.cpp @@ -4,7 +4,7 @@ #include "math/history.h" #include "nodes/number.h" #include "nodes/species.h" -#include "tests/testing.h" +#include "tests/testGraph.h" namespace UnitTest { diff --git a/tests/classes/structure.cpp b/tests/classes/structure.cpp index 6844d61483..d54799b7b9 100644 --- a/tests/classes/structure.cpp +++ b/tests/classes/structure.cpp @@ -3,7 +3,7 @@ #include "classes/structure.h" #include "nodes/calculateBonding.h" -#include "tests/testing.h" +#include "tests/testGraph.h" #include namespace UnitTest diff --git a/tests/ff/assignment-Kulmala2010.cpp b/tests/ff/assignment-Kulmala2010.cpp index 5673d1c264..85f08294e4 100644 --- a/tests/ff/assignment-Kulmala2010.cpp +++ b/tests/ff/assignment-Kulmala2010.cpp @@ -3,7 +3,7 @@ #include "data/ff/library.h" #include "nodes/species.h" -#include "tests/testing.h" +#include "tests/testGraph.h" namespace UnitTest { diff --git a/tests/ff/assignment-Ludwig-py5.cpp b/tests/ff/assignment-Ludwig-py5.cpp index 202a44f73b..cd3e916f56 100644 --- a/tests/ff/assignment-Ludwig-py5.cpp +++ b/tests/ff/assignment-Ludwig-py5.cpp @@ -3,7 +3,7 @@ #include "data/ff/library.h" #include "nodes/species.h" -#include "tests/testing.h" +#include "tests/testGraph.h" #include namespace UnitTest diff --git a/tests/ff/assignment-OPLSAA2005-alcohols.cpp b/tests/ff/assignment-OPLSAA2005-alcohols.cpp index a053f1bb22..6acae13c41 100644 --- a/tests/ff/assignment-OPLSAA2005-alcohols.cpp +++ b/tests/ff/assignment-OPLSAA2005-alcohols.cpp @@ -3,7 +3,7 @@ #include "data/ff/library.h" #include "nodes/species.h" -#include "tests/testing.h" +#include "tests/testGraph.h" namespace UnitTest { diff --git a/tests/ff/assignment-OPLSAA2005-alkanes.cpp b/tests/ff/assignment-OPLSAA2005-alkanes.cpp index 6cd2a198fc..7f6af6f3e4 100644 --- a/tests/ff/assignment-OPLSAA2005-alkanes.cpp +++ b/tests/ff/assignment-OPLSAA2005-alkanes.cpp @@ -3,7 +3,7 @@ #include "data/ff/library.h" #include "nodes/species.h" -#include "tests/testing.h" +#include "tests/testGraph.h" namespace UnitTest { diff --git a/tests/ff/assignment-OPLSAA2005-aromatics.cpp b/tests/ff/assignment-OPLSAA2005-aromatics.cpp index aee3f1f651..d456d56437 100644 --- a/tests/ff/assignment-OPLSAA2005-aromatics.cpp +++ b/tests/ff/assignment-OPLSAA2005-aromatics.cpp @@ -3,7 +3,7 @@ #include "data/ff/library.h" #include "nodes/species.h" -#include "tests/testing.h" +#include "tests/testGraph.h" namespace UnitTest { diff --git a/tests/ff/assignment-PCL2019-anions.cpp b/tests/ff/assignment-PCL2019-anions.cpp index 695f8384a9..d38cded69f 100644 --- a/tests/ff/assignment-PCL2019-anions.cpp +++ b/tests/ff/assignment-PCL2019-anions.cpp @@ -3,7 +3,7 @@ #include "data/ff/library.h" #include "nodes/species.h" -#include "tests/testing.h" +#include "tests/testGraph.h" namespace UnitTest { diff --git a/tests/ff/assignment-PCL2019-cations.cpp b/tests/ff/assignment-PCL2019-cations.cpp index b6ebcb2273..dca9a88bdc 100644 --- a/tests/ff/assignment-PCL2019-cations.cpp +++ b/tests/ff/assignment-PCL2019-cations.cpp @@ -3,7 +3,7 @@ #include "data/ff/library.h" #include "nodes/species.h" -#include "tests/testing.h" +#include "tests/testGraph.h" namespace UnitTest { diff --git a/tests/ff/assignment-SPCFw.cpp b/tests/ff/assignment-SPCFw.cpp index 774286cf90..49f53f57dc 100644 --- a/tests/ff/assignment-SPCFw.cpp +++ b/tests/ff/assignment-SPCFw.cpp @@ -3,7 +3,7 @@ #include "data/ff/library.h" #include "nodes/species.h" -#include "tests/testing.h" +#include "tests/testGraph.h" namespace UnitTest { diff --git a/tests/ff/assignment-UFF-nmethylformamide.cpp b/tests/ff/assignment-UFF-nmethylformamide.cpp index 5078112895..3520867872 100644 --- a/tests/ff/assignment-UFF-nmethylformamide.cpp +++ b/tests/ff/assignment-UFF-nmethylformamide.cpp @@ -3,7 +3,7 @@ #include "data/ff/library.h" #include "nodes/species.h" -#include "tests/testing.h" +#include "tests/testGraph.h" namespace UnitTest { diff --git a/tests/ff/assignment-UFF4MOF-mof5.cpp b/tests/ff/assignment-UFF4MOF-mof5.cpp index 117cc9e8aa..898179c3a2 100644 --- a/tests/ff/assignment-UFF4MOF-mof5.cpp +++ b/tests/ff/assignment-UFF4MOF-mof5.cpp @@ -3,7 +3,7 @@ #include "data/ff/library.h" #include "nodes/species.h" -#include "tests/testing.h" +#include "tests/testGraph.h" namespace UnitTest { diff --git a/tests/ff/benzene.cpp b/tests/ff/benzene.cpp index b6e7201062..37b723119a 100644 --- a/tests/ff/benzene.cpp +++ b/tests/ff/benzene.cpp @@ -5,7 +5,7 @@ #include "kernels/force.h" #include "nodes/dissolve.h" #include "nodes/species.h" -#include "tests/testing.h" +#include "tests/testGraph.h" namespace UnitTest { diff --git a/tests/ff/cos-n.cpp b/tests/ff/cos-n.cpp index 83190e7598..be92a18241 100644 --- a/tests/ff/cos-n.cpp +++ b/tests/ff/cos-n.cpp @@ -5,7 +5,7 @@ #include "kernels/energy.h" #include "kernels/force.h" #include "tests/tempFile.h" -#include "tests/testing.h" +#include "tests/testGraph.h" namespace UnitTest { diff --git a/tests/ff/hexane.cpp b/tests/ff/hexane.cpp index e5df534923..73944869ed 100644 --- a/tests/ff/hexane.cpp +++ b/tests/ff/hexane.cpp @@ -5,7 +5,7 @@ #include "kernels/force.h" #include "nodes/dissolve.h" #include "nodes/species.h" -#include "tests/testing.h" +#include "tests/testGraph.h" namespace UnitTest { diff --git a/tests/ff/water-1000.cpp b/tests/ff/water-1000.cpp index a7a315b117..77902145cd 100644 --- a/tests/ff/water-1000.cpp +++ b/tests/ff/water-1000.cpp @@ -4,7 +4,7 @@ #include "kernels/energy.h" #include "kernels/force.h" #include "nodes/species.h" -#include "tests/testing.h" +#include "tests/testGraph.h" namespace UnitTest { diff --git a/tests/nodes/angle.cpp b/tests/nodes/angle.cpp index f5e0a22a50..2da0146fb8 100644 --- a/tests/nodes/angle.cpp +++ b/tests/nodes/angle.cpp @@ -6,7 +6,7 @@ #include "math/rangedVector3.h" #include "nodes/iterableGraph.h" #include "nodes/species.h" -#include "tests/testing.h" +#include "tests/testGraph.h" namespace UnitTest { diff --git a/tests/nodes/atomicMC.cpp b/tests/nodes/atomicMC.cpp index f8a0357429..9ed21373b5 100644 --- a/tests/nodes/atomicMC.cpp +++ b/tests/nodes/atomicMC.cpp @@ -4,9 +4,8 @@ #include "nodes/atomicMC.h" #include "nodes/configuration.h" #include "nodes/dissolve.h" -#include "nodes/insert.h" #include "nodes/iterableGraph.h" -#include "tests/testing.h" +#include "tests/testGraph.h" #include namespace UnitTest diff --git a/tests/nodes/averageMolecule.cpp b/tests/nodes/averageMolecule.cpp index d37eb23f39..148697d03c 100644 --- a/tests/nodes/averageMolecule.cpp +++ b/tests/nodes/averageMolecule.cpp @@ -4,7 +4,7 @@ #include "nodes/averageMolecule.h" #include "nodes/iterableGraph.h" #include "nodes/species.h" -#include "tests/testing.h" +#include "tests/testGraph.h" namespace UnitTest { diff --git a/tests/nodes/axisAngle.cpp b/tests/nodes/axisAngle.cpp index a426cc70c6..2213a24860 100644 --- a/tests/nodes/axisAngle.cpp +++ b/tests/nodes/axisAngle.cpp @@ -3,7 +3,7 @@ #include "nodes/axisAngle.h" #include "nodes/species.h" -#include "tests/testing.h" +#include "tests/testGraph.h" namespace UnitTest { diff --git a/tests/nodes/bragg.cpp b/tests/nodes/bragg.cpp index d74730ebba..784fefff38 100644 --- a/tests/nodes/bragg.cpp +++ b/tests/nodes/bragg.cpp @@ -8,7 +8,7 @@ #include "nodes/gr.h" #include "nodes/iterableGraph.h" #include "nodes/sq.h" -#include "tests/testing.h" +#include "tests/testGraph.h" #include namespace UnitTest diff --git a/tests/nodes/broadening.cpp b/tests/nodes/broadening.cpp index b00dd38e13..ca2c5a56ba 100644 --- a/tests/nodes/broadening.cpp +++ b/tests/nodes/broadening.cpp @@ -5,7 +5,7 @@ #include "nodes/gr.h" #include "nodes/neutronSQ.h" #include "nodes/sq.h" -#include "tests/testing.h" +#include "tests/testGraph.h" namespace UnitTest { diff --git a/tests/nodes/cif.cpp b/tests/nodes/cif.cpp index aad00552e9..b47a418b88 100644 --- a/tests/nodes/cif.cpp +++ b/tests/nodes/cif.cpp @@ -4,7 +4,7 @@ #include "classes/configuration.h" #include "classes/empiricalFormula.h" #include "nodes/cif/importCIFStructure.h" -#include "tests/testing.h" +#include "tests/testGraph.h" #include namespace UnitTest diff --git a/tests/nodes/dAngle.cpp b/tests/nodes/dAngle.cpp index 5b8749c982..46d4cc7a30 100644 --- a/tests/nodes/dAngle.cpp +++ b/tests/nodes/dAngle.cpp @@ -6,7 +6,7 @@ #include "nodes/importDLPUtilsSurface.h" #include "nodes/iterableGraph.h" #include "nodes/species.h" -#include "tests/testing.h" +#include "tests/testGraph.h" namespace UnitTest { diff --git a/tests/nodes/epsr.cpp b/tests/nodes/epsr.cpp index e50e4bf8bb..6fb9c7ed1e 100644 --- a/tests/nodes/epsr.cpp +++ b/tests/nodes/epsr.cpp @@ -8,7 +8,7 @@ #include "nodes/neutronSQ.h" #include "nodes/sq.h" #include "nodes/xRaySQ.h" -#include "tests/testing.h" +#include "tests/testGraph.h" #include namespace UnitTest diff --git a/tests/nodes/flow.cpp b/tests/nodes/flow.cpp index 1bdffcdb89..2442811f1c 100644 --- a/tests/nodes/flow.cpp +++ b/tests/nodes/flow.cpp @@ -6,7 +6,7 @@ #include "nodes/graph.h" #include "nodes/number.h" #include "nodes/numberNode.h" -#include "tests/testing.h" +#include "tests/testGraph.h" namespace UnitTest { diff --git a/tests/nodes/gr.cpp b/tests/nodes/gr.cpp index 6d43757e19..d060d21133 100644 --- a/tests/nodes/gr.cpp +++ b/tests/nodes/gr.cpp @@ -3,7 +3,7 @@ #include "nodes/gr.h" #include "math/windowFunction.h" -#include "tests/testing.h" +#include "tests/testGraph.h" namespace UnitTest { diff --git a/tests/nodes/graph.cpp b/tests/nodes/graph.cpp index 62122e0e3c..a363148aa9 100644 --- a/tests/nodes/graph.cpp +++ b/tests/nodes/graph.cpp @@ -4,7 +4,7 @@ #include "nodes/add.h" #include "nodes/dissolve.h" #include "nodes/registry.h" -#include "tests/testing.h" +#include "tests/testGraph.h" namespace UnitTest { diff --git a/tests/nodes/graphArgon.cpp b/tests/nodes/graphArgon.cpp index c3493a0c7b..26ed8ca7de 100644 --- a/tests/nodes/graphArgon.cpp +++ b/tests/nodes/graphArgon.cpp @@ -7,7 +7,7 @@ #include "data/structureFactors.h" #include "nodes/neutronSQ.h" #include "nodes/sq.h" -#include "tests/testing.h" +#include "tests/testGraph.h" namespace UnitTest { diff --git a/tests/nodes/histogramCN.cpp b/tests/nodes/histogramCN.cpp index df2b0f865a..39fe8412fa 100644 --- a/tests/nodes/histogramCN.cpp +++ b/tests/nodes/histogramCN.cpp @@ -5,7 +5,7 @@ #include "nodes/angle.h" #include "nodes/iterableGraph.h" #include "nodes/species.h" -#include "tests/testing.h" +#include "tests/testGraph.h" namespace UnitTest { diff --git a/tests/nodes/intraAngle.cpp b/tests/nodes/intraAngle.cpp index 4241a8a348..8c6c57129c 100644 --- a/tests/nodes/intraAngle.cpp +++ b/tests/nodes/intraAngle.cpp @@ -6,8 +6,7 @@ #include "math/rangedVector3.h" #include "nodes/iterableGraph.h" #include "nodes/species.h" -#include "tests/testing.h" -#include +#include "tests/testGraph.h" namespace UnitTest { diff --git a/tests/nodes/intraDistance.cpp b/tests/nodes/intraDistance.cpp index 8a18928ca7..0c59b98dc0 100644 --- a/tests/nodes/intraDistance.cpp +++ b/tests/nodes/intraDistance.cpp @@ -5,7 +5,7 @@ #include "classes/speciesSites.h" #include "nodes/iterableGraph.h" #include "nodes/species.h" -#include "tests/testing.h" +#include "tests/testGraph.h" #include namespace UnitTest diff --git a/tests/nodes/modifierOSites.cpp b/tests/nodes/modifierOSites.cpp index 8403b70281..6a2c0d555c 100644 --- a/tests/nodes/modifierOSites.cpp +++ b/tests/nodes/modifierOSites.cpp @@ -3,7 +3,7 @@ #include "nodes/modifierOSites.h" #include "nodes/species.h" -#include "tests/testing.h" +#include "tests/testGraph.h" namespace UnitTest { diff --git a/tests/nodes/moleculeTorsion.cpp b/tests/nodes/moleculeTorsion.cpp index 19c50dfd3a..ffbd40a656 100644 --- a/tests/nodes/moleculeTorsion.cpp +++ b/tests/nodes/moleculeTorsion.cpp @@ -3,7 +3,7 @@ #include "nodes/moleculeTorsion.h" #include "nodes/iterableGraph.h" -#include "tests/testing.h" +#include "tests/testGraph.h" namespace UnitTest { diff --git a/tests/nodes/neutronSQ.cpp b/tests/nodes/neutronSQ.cpp index 1f0142edcd..095a657831 100644 --- a/tests/nodes/neutronSQ.cpp +++ b/tests/nodes/neutronSQ.cpp @@ -5,7 +5,7 @@ #include "math/windowFunction.h" #include "nodes/gr.h" #include "nodes/sq.h" -#include "tests/testing.h" +#include "tests/testGraph.h" namespace UnitTest { diff --git a/tests/nodes/orientedSDF.cpp b/tests/nodes/orientedSDF.cpp index 9149816522..e9f957f00e 100644 --- a/tests/nodes/orientedSDF.cpp +++ b/tests/nodes/orientedSDF.cpp @@ -5,7 +5,7 @@ #include "nodes/importDLPUtilsPDens.h" #include "nodes/iterableGraph.h" #include "nodes/species.h" -#include "tests/testing.h" +#include "tests/testGraph.h" namespace UnitTest { diff --git a/tests/nodes/parameters.cpp b/tests/nodes/parameters.cpp index 7d1eb79c97..1652e2cd9a 100644 --- a/tests/nodes/parameters.cpp +++ b/tests/nodes/parameters.cpp @@ -4,7 +4,7 @@ #include "nodes/dissolve.h" #include "nodes/numberNode.h" #include "nodes/test.h" -#include "tests/testing.h" +#include "tests/testGraph.h" namespace UnitTest { diff --git a/tests/nodes/qSpecies.cpp b/tests/nodes/qSpecies.cpp index c5bc2d98b9..cd868d8b62 100644 --- a/tests/nodes/qSpecies.cpp +++ b/tests/nodes/qSpecies.cpp @@ -3,7 +3,7 @@ #include "nodes/qSpecies.h" #include "nodes/species.h" -#include "tests/testing.h" +#include "tests/testGraph.h" namespace UnitTest { diff --git a/tests/nodes/sdf.cpp b/tests/nodes/sdf.cpp index 966b21ea59..4bd56da32c 100644 --- a/tests/nodes/sdf.cpp +++ b/tests/nodes/sdf.cpp @@ -5,7 +5,7 @@ #include "nodes/importDLPUtilsPDens.h" #include "nodes/iterableGraph.h" #include "nodes/species.h" -#include "tests/testing.h" +#include "tests/testGraph.h" namespace UnitTest { diff --git a/tests/nodes/siteRDF.cpp b/tests/nodes/siteRDF.cpp index 4647789b86..88de665efb 100644 --- a/tests/nodes/siteRDF.cpp +++ b/tests/nodes/siteRDF.cpp @@ -5,7 +5,7 @@ #include "math/rangedVector3.h" #include "nodes/iterableGraph.h" #include "nodes/species.h" -#include "tests/testing.h" +#include "tests/testGraph.h" namespace UnitTest { diff --git a/tests/nodes/sq.cpp b/tests/nodes/sq.cpp index f61f8641e4..92087c2b28 100644 --- a/tests/nodes/sq.cpp +++ b/tests/nodes/sq.cpp @@ -4,7 +4,7 @@ #include "nodes/sq.h" #include "math/windowFunction.h" #include "nodes/gr.h" -#include "tests/testing.h" +#include "tests/testGraph.h" namespace UnitTest { diff --git a/tests/nodes/trajectory.cpp b/tests/nodes/trajectory.cpp index d87afa6b93..f178305de4 100644 --- a/tests/nodes/trajectory.cpp +++ b/tests/nodes/trajectory.cpp @@ -5,7 +5,7 @@ #include "nodes/exportXYZTrajectory.h" #include "nodes/importXYZTrajectory.h" #include "tests/tempFile.h" -#include "tests/testing.h" +#include "tests/testGraph.h" #include #include #include diff --git a/tests/nodes/voxelDensity.cpp b/tests/nodes/voxelDensity.cpp index 0061f1a821..83afe99b29 100644 --- a/tests/nodes/voxelDensity.cpp +++ b/tests/nodes/voxelDensity.cpp @@ -4,7 +4,7 @@ #include "nodes/voxelDensity.h" #include "data/atomicMasses.h" #include "nodes/configuration.h" -#include "tests/testing.h" +#include "tests/testGraph.h" namespace UnitTest { diff --git a/tests/nodes/xRaySQ.cpp b/tests/nodes/xRaySQ.cpp index f382da1dbb..fcb6ce8938 100644 --- a/tests/nodes/xRaySQ.cpp +++ b/tests/nodes/xRaySQ.cpp @@ -3,7 +3,7 @@ #include "nodes/xRaySQ.h" #include "nodes/gr.h" -#include "tests/testing.h" +#include "tests/testGraph.h" namespace UnitTest { diff --git a/tests/pairPotentials/cutoffs.cpp b/tests/pairPotentials/cutoffs.cpp index 9ebb2bf3c6..1409d13783 100644 --- a/tests/pairPotentials/cutoffs.cpp +++ b/tests/pairPotentials/cutoffs.cpp @@ -4,7 +4,7 @@ #include "kernels/force.h" #include "nodes/dissolve.h" #include "nodes/species.h" -#include "tests/testing.h" +#include "tests/testGraph.h" namespace UnitTest { diff --git a/tests/pairPotentials/overrides.cpp b/tests/pairPotentials/overrides.cpp index 2a0c02b76f..0739f0dcc1 100644 --- a/tests/pairPotentials/overrides.cpp +++ b/tests/pairPotentials/overrides.cpp @@ -4,8 +4,7 @@ #include "kernels/energy.h" #include "nodes/neutronSQ.h" #include "nodes/species.h" -#include "tests/testing.h" -#include +#include "tests/testGraph.h" namespace UnitTest { diff --git a/tests/testGraph.cpp b/tests/testGraph.cpp new file mode 100644 index 0000000000..4bddb1dade --- /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, + TestGraph::Data1DImportFileFormat referenceData) +{ + // 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 *TestGraph::appendXRaySQ(SQNode *sqNode, std::string name, TestGraph::Data1DImportFileFormat referenceData) +{ + 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(); +} +}; // namespace UnitTest diff --git a/tests/testGraph.h b/tests/testGraph.h new file mode 100644 index 0000000000..b7ae0b22f6 --- /dev/null +++ b/tests/testGraph.h @@ -0,0 +1,99 @@ +// 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); } + + 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; + // 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 = {}, + TestGraph::Data1DImportFileFormat referenceData = TestGraph::Data1DImportFileFormat{}); + // Create an XRaySQ node with optional reference data + XRaySQNode *appendXRaySQ(SQNode *sqNode, std::string name, + TestGraph::Data1DImportFileFormat referenceData = TestGraph::Data1DImportFileFormat{}); +}; +}; // namespace UnitTest diff --git a/tests/testing.cpp b/tests/testing.cpp index 63e5116092..272ea0742a 100644 --- a/tests/testing.cpp +++ b/tests/testing.cpp @@ -2,303 +2,327 @@ // Copyright (c) 2026 Team Dissolve and contributors #include "tests/testing.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 "classes/species.h" +#include "kernels/energy.h" +#include "kernels/force.h" +#include "nodes/importXYData.h" #include namespace UnitTest { /* - * Graph Creation Helpers + * Checks */ -// 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) +// Test simple double +[[nodiscard]] bool checkDouble(std::string_view quantity, double A, double B, double threshold) { - auto node = name.has_value() ? currentGraph_->createNode(nodeType, *name) : currentGraph_->createNode(nodeType); - - if (!node) - return nullptr; - - head_ = node; - - return node; + 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 checkSampledDouble(std::string_view quantity, SampledDouble A, double B, double threshold) +{ + return checkDouble(quantity, A.value(), B, threshold); } -// 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) +// Test Data1D +[[nodiscard]] bool checkData1D(const Data1D &dataA, std::string_view nameA, const Data1D &dataB, std::string_view nameB, + double tolerance, Error::ErrorType errorType) { - // Add Species and Insert nodes - for (auto &[speciesString, population] : species) + // 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 checkData1D(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)) { - // 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"; + std::cout << std::format("Failed to read data from '{}'\n", filePath); + return false; } - return fetchHead(); + return checkData1D(dataA, nameA, dataB, filePath, tolerance, errorType); } - -// Create and return atomic SpeciesNode -std::unique_ptr TestGraph::createAtomicSpecies(Elements::Element element, - InteractionPotential potential) +// Test Data2D +[[nodiscard]] bool checkData2D(const Data2D &dataA, std::string_view nameA, const Data2D &dataB, std::string_view nameB, + double tolerance, Error::ErrorType errorType) { - // 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); + // 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 speciesNodeUniquePtr; + return !notOK; } -// Create species from TOML file -std::unique_ptr TestGraph::loadTOMLSpecies(std::string_view path) +// Test Data3D +[[nodiscard]] bool checkData3D(const Data3D &dataA, std::string_view nameA, const Data3D &dataB, std::string_view nameB, + double tolerance, Error::ErrorType errorType) { - // Add species node - auto speciesNodeUniquePtr = std::make_unique(nullptr); - auto speciesNodePtr = speciesNodeUniquePtr.get(); - auto &species = speciesNodePtr->species(); - species.load(path); + // 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 speciesNodeUniquePtr; + return !notOK; } -// 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) +// Test Vec3 data +void checkVec3(const Vector3 &A, const Vector3 &B, double tolerance) { - // 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) + 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 checkVec3Vector(const std::vector &A, const std::vector &B, double tolerance) +{ + ASSERT_EQ(A.size(), B.size()); + for (auto n = 0; n < A.size(); ++n) + checkVec3(A[n], B[n], tolerance); +} +// Test species atom type +void checkSpeciesAtomType(Species *sp, const std::map &namesById) +{ + for (auto &[atomIndex, atomTypeName] : namesById) { - auto calculateBondingNode = createNode("CalculateBonding"); - EXPECT_TRUE(calculateBondingNode); - EXPECT_TRUE(currentGraph_->addEdge({structureNodeType, "Structure", "CalculateBonding", "Structure"})); - EXPECT_TRUE(currentGraph_->addEdge({"CalculateBonding", "Structure", name, "Structure"})); + ASSERT_TRUE(atomIndex >= 0 && atomIndex < sp->nAtoms()); + auto &spAtom = sp->atom(atomIndex); + auto at = spAtom.atomType(); + ASSERT_TRUE(at); + EXPECT_EQ(at->name(), atomTypeName); } - 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) +// Test interaction parameters +template +void checkIntramolecularTerms(const std::string &termInfo, const InteractionPotential &expectedParams, + const InteractionPotential &actualParams, double tolerance) { - // Create configuration - EXPECT_TRUE(appendNode("Configuration", name)); - - // Add Species and Insert nodes - return createAndInsertSpecies(fetchHead(), "Configuration", species, rho, rhoUnits, InsertNode::BoxActionStyle::AddVolume); + 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); } -// Create basic configuration graph, returning the last node -Node *TestGraph::createConfiguration(std::string name, const std::vector> &species, - const Vector3 &cellLengths, const Vector3 &cellAngles) +// Test species bond term +void checkSpeciesIntramolecular(Species *sp, std::vector atoms, const InteractionPotential &expectedParams, + double tolerance) { - // 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); + 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); } -// Append a set coordinates node with a structure import input -Node *TestGraph::appendSetCoordinates(std::string_view importNodeType, std::string filePath, std::string sourceOutpuName) +// Test species angle term +void checkSpeciesIntramolecular(Species *sp, std::vector atoms, const InteractionPotential &expectedParams, + double tolerance) { - 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"})); + 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) +{ + 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 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; + } - EXPECT_TRUE( - currentGraph_->addEdge({std::string(cfgSourceNode->name()), sourceOutpuName, "SetCoordinates", "Configuration"})); + // 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 head(); + return true; } -// Create a trajectory iterator subgraph -IterableGraph *TestGraph::appendTrajectoryIterator(std::string trajectoryImportNodeType, std::string filePath) +// Test consistency, and error, between supplied partial sets +bool checkPartialSet(const PartialSet &setA, const PartialSet &setB, double testThreshold) { - // Get current head node before we create the IterableGraph - auto oldHead = head_; - auto oldGraph = currentGraph_; + // 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; +} - // Add iterator node and make it the current graph - currentGraph_ = dynamic_cast(appendNode("Iterator", "Iterator")); - EXPECT_TRUE(currentGraph_); - head_ = nullptr; +// Check consistency between production, molecular, and test energies, returning production values +Kernel::EnergyResult checkEnergyConsistency(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(); - // 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"})); + // Calculate molecule-centric energy + auto molecularPPEnergy = kernel->totalMoleculePairPotentialEnergy(); - // 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")); + // 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); - EXPECT_TRUE(currentGraph_->addEdge({std::string(trajectoryNode->name()), "Structure", "SetCoordinates", "Structure"})); + // Compare basic energies with molecule-based values + EXPECT_NEAR(testEnergy.pairPotential.total(), molecularPPEnergy.total(), testThreshold); + EXPECT_NEAR(testEnergy.pairPotential.interMolecular, molecularPPEnergy.interMolecular, testThreshold); - EXPECT_TRUE(currentGraph_->addEdge({"Inputs", "Configuration", "SetCoordinates", "Configuration"})); + // Compare molecule-based energies with production values + EXPECT_NEAR(molecularPPEnergy.total(), productionEnergy.pairPotential.total(), testThreshold); + EXPECT_NEAR(molecularPPEnergy.interMolecular, productionEnergy.pairPotential.interMolecular, testThreshold); - return dynamic_cast(currentGraph_); + return productionEnergy; } -// 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"})); +// Check consistency between production and test forces +void checkForceConsistency(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); - // Create the SQ node - auto sqNode = dynamic_cast(createNode("SQ")); - EXPECT_TRUE(sqNode); - EXPECT_TRUE(currentGraph_->addEdge({"GR", "UnweightedGR", "SQ", "UnweightedGR"})); + // Calculate baseline test forces (simple double-loop, PBC always) + std::vector ppTestForces, geomTestForces; + kernel->totalForcesSimple(ppTestForces, geomTestForces, flags); - return {grNode, sqNode}; -} -// Create a NeutronSQ node with optional reference data -NeutronSQNode *TestGraph::appendNeutronSQ(SQNode *sqNode, std::string name, - const std::vector> isotopologues, - TestGraph::Data1DImportFileFormat referenceData) -{ - // 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) + // Pair potential forces + if (!(flags.isSet(Kernel::CalculationFlags::ExcludeInterMolecularPairPotential) && + flags.isSet(Kernel::CalculationFlags::ExcludeIntraMolecularPairPotential))) + for (auto &&[pairPotentialTestForce, pairPotentialProductionForce] : zip(ppTestForces, ppForces)) { - std::cout << std::format("No species named '{}' exists in the graph - can't construct IsotopologueSet\n", - speciesName); - return nullptr; + EXPECT_NEAR(pairPotentialProductionForce.x, pairPotentialTestForce.x, ppMaxDeviation); + EXPECT_NEAR(pairPotentialProductionForce.y, pairPotentialTestForce.y, ppMaxDeviation); + EXPECT_NEAR(pairPotentialProductionForce.z, pairPotentialTestForce.z, ppMaxDeviation); } - auto &species = speciesNode->species(); - auto isotopologue = species.findIsotopologue(isotopologueName); - if (!isotopologue) + + // Geometric forces + if (flags.isNotSet(Kernel::CalculationFlags::ExcludeGeometric)) + for (auto &&[geometryTestForce, geometryProductionForce] : zip(geomTestForces, geomForces)) { - std::cout << std::format("No isotopologue named '{}' exists in species '{}' - can't construct IsotopologueSet\n", - isotopologueName, speciesName); - return nullptr; + EXPECT_NEAR(geometryProductionForce.x, geometryTestForce.x, geomMaxDeviation); + EXPECT_NEAR(geometryProductionForce.y, geometryTestForce.y, geomMaxDeviation); + EXPECT_NEAR(geometryProductionForce.z, geometryTestForce.z, geomMaxDeviation); } - 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"})); +// Check consistency of supplied forces +void checkReferenceForceConsistency(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()); - // Set reference F(Q) data - if (!referenceData.filename.empty()) + for (auto &&[ppForce, geometryForce, referenceForce] : zip(ppForces, geomForces, referenceForces)) { - 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"})); + 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); } - - return head(); } -// Create an XRaySQ node with optional reference data -XRaySQNode *TestGraph::appendXRaySQ(SQNode *sqNode, std::string name, TestGraph::Data1DImportFileFormat referenceData) -{ - 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()) +/* + * 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 { - 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"})); + EXPECT_EQ(toml, toml2) << location; } - return head(); } /* diff --git a/tests/testing.h b/tests/testing.h index b738bad3bb..ece2b96f36 100644 --- a/tests/testing.h +++ b/tests/testing.h @@ -31,88 +31,6 @@ namespace UnitTest // Save the specified graph in Mermaid format to a file named after the unit test void exportMermaidGraph(Graph &graph); -/* - * Test Graph Framework - */ - -// 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); } - - 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; - // 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 = {}, - TestGraph::Data1DImportFileFormat referenceData = TestGraph::Data1DImportFileFormat{}); - // Create an XRaySQ node with optional reference data - XRaySQNode *appendXRaySQ(SQNode *sqNode, std::string name, - TestGraph::Data1DImportFileFormat referenceData = TestGraph::Data1DImportFileFormat{}); -}; - /* * Data Test Functions */ diff --git a/tests/testingChecks.cpp b/tests/testingChecks.cpp deleted file mode 100644 index 68f254e284..0000000000 --- a/tests/testingChecks.cpp +++ /dev/null @@ -1,292 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2026 Team Dissolve and contributors - -#include "classes/species.h" -#include "kernels/energy.h" -#include "kernels/force.h" -#include "nodes/importXYData.h" -#include "tests/testing.h" - -namespace UnitTest -{ -// Test simple double -[[nodiscard]] 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]] bool checkSampledDouble(std::string_view quantity, SampledDouble A, double B, double threshold) -{ - return checkDouble(quantity, A.value(), B, threshold); -} -// Test Data1D -[[nodiscard]] bool checkData1D(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 checkData1D(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 checkData1D(dataA, nameA, dataB, filePath, tolerance, errorType); -} -// Test Data2D -[[nodiscard]] bool checkData2D(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 checkData3D(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 checkVec3(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 checkVec3Vector(const std::vector &A, const std::vector &B, double tolerance) -{ - ASSERT_EQ(A.size(), B.size()); - for (auto n = 0; n < A.size(); ++n) - checkVec3(A[n], B[n], tolerance); -} -// Test species atom type -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) -{ - 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) -{ - 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) -{ - 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) -{ - 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 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 -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) -{ - // 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, - 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 checkReferenceForceConsistency(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); - } -} -} // namespace UnitTest diff --git a/tests/testingTOML.cpp b/tests/testingTOML.cpp deleted file mode 100644 index 6849e3cde9..0000000000 --- a/tests/testingTOML.cpp +++ /dev/null @@ -1,33 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2026 Team Dissolve and contributors - -#include "tests/testing.h" - -namespace UnitTest -{ -// Comparie 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; - } -} -}; // namespace UnitTest \ No newline at end of file diff --git a/tests/workflows/phantomAtoms.cpp b/tests/workflows/phantomAtoms.cpp index af35d63c57..54aeadcfb4 100644 --- a/tests/workflows/phantomAtoms.cpp +++ b/tests/workflows/phantomAtoms.cpp @@ -7,7 +7,7 @@ #include "nodes/species.h" #include "nodes/sq.h" #include "nodes/xRaySQ.h" -#include "tests/testing.h" +#include "tests/testGraph.h" namespace UnitTest { From 87b4babfd201eaaefb209039c4239d75c96539f7 Mon Sep 17 00:00:00 2001 From: Tristan Youngs Date: Fri, 26 Jun 2026 12:53:24 +0100 Subject: [PATCH 6/7] Tests, not checks. --- tests/classes/history.cpp | 33 +- tests/ff/assignment-Kulmala2010.cpp | 88 ++--- tests/ff/assignment-Ludwig-py5.cpp | 30 +- tests/ff/assignment-OPLSAA2005-alcohols.cpp | 12 +- tests/ff/assignment-OPLSAA2005-alkanes.cpp | 72 ++-- tests/ff/assignment-OPLSAA2005-aromatics.cpp | 60 +-- tests/ff/assignment-PCL2019-anions.cpp | 152 ++++---- tests/ff/assignment-PCL2019-cations.cpp | 378 +++++++++---------- tests/ff/assignment-SPCFw.cpp | 6 +- tests/ff/assignment-UFF-nmethylformamide.cpp | 20 +- tests/ff/assignment-UFF4MOF-mof5.cpp | 48 +-- tests/ff/benzene.cpp | 26 +- tests/ff/cos-n.cpp | 40 +- tests/ff/hexane.cpp | 36 +- tests/ff/water-1000.cpp | 38 +- tests/math/poisson.cpp | 2 +- tests/nodes/angle.cpp | 6 +- tests/nodes/averageMolecule.cpp | 12 +- tests/nodes/bragg.cpp | 8 +- tests/nodes/broadening.cpp | 6 +- tests/nodes/cif.cpp | 4 +- tests/nodes/dAngle.cpp | 8 +- tests/nodes/epsr.cpp | 64 ++-- tests/nodes/gr.cpp | 220 +++++------ tests/nodes/graphArgon.cpp | 4 +- tests/nodes/intraAngle.cpp | 4 +- tests/nodes/intraDistance.cpp | 12 +- tests/nodes/moleculeTorsion.cpp | 4 +- tests/nodes/neutronSQ.cpp | 68 ++-- tests/nodes/orientedSDF.cpp | 2 +- tests/nodes/sdf.cpp | 4 +- tests/nodes/siteRDF.cpp | 32 +- tests/nodes/sq.cpp | 216 +++++------ tests/nodes/xRaySQ.cpp | 8 +- tests/pairPotentials/cutoffs.cpp | 4 +- tests/testing.cpp | 68 ++-- tests/testing.h | 56 +-- tests/workflows/phantomAtoms.cpp | 64 ++-- 38 files changed, 957 insertions(+), 958 deletions(-) diff --git a/tests/classes/history.cpp b/tests/classes/history.cpp index 366fbec402..489485d51f 100644 --- a/tests/classes/history.cpp +++ b/tests/classes/history.cpp @@ -79,11 +79,11 @@ TEST(History, CustomClass) for (auto n = 1; n <= 5; ++n) { sum += n; - EXPECT_TRUE(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(checkData1D(a.average(), "A", b.average(), "B")); + EXPECT_TRUE(testData1D(a.average(), "A", b.average(), "B")); } TEST(History, CustomClassWithInitialiser) @@ -130,14 +130,13 @@ TEST(History, CustomClassWithInitialiser) for (auto n = 0; n < 3; ++n) { auto avg = a.push(p, avgLength); - EXPECT_TRUE(checkData1D(p.partials().get("Ar//Ar"), "Partial", avg.partials().get("Ar//Ar"), "Averaged")); + 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( - checkData1D(p.boundPartials().get("Ar//Ar"), "BoundPartial", avg.boundPartials().get("Ar//Ar"), "Averaged")); - EXPECT_TRUE(checkData1D(p.boundTotal(), "BoundTotal", avg.boundTotal(), "Averaged")); - EXPECT_TRUE( - checkData1D(p.unboundPartials().get("Ar//Ar"), "UnboundPartial", avg.unboundPartials().get("Ar//Ar"), "Averaged")); - EXPECT_TRUE(checkData1D(p.unboundTotal(), "UnboundTotal", avg.unboundTotal(), "Averaged")); - EXPECT_TRUE(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 @@ -147,20 +146,20 @@ TEST(History, CustomClassWithInitialiser) for (auto n = 1; n <= 3; ++n) { auto avg = a.push(p, avgLength); - EXPECT_TRUE(checkData1D(p.partials().get("Ar//Ar"), "Partial", avg.partials().get("Ar//Ar"), "Averaged")); - EXPECT_TRUE(checkData1D((dcos * (avgLength - n) - dsin * n) / avgLength, "BoundPartial", - avg.boundPartials().get("Ar//Ar"), "Averaged")); - EXPECT_TRUE(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( - checkData1D(avgA.boundPartials().get("Ar//Ar"), "BoundPartialA", avgB.boundPartials().get("Ar//Ar"), "BoundPartialB")); - EXPECT_TRUE(checkData1D(avgA.unboundPartials().get("Ar//Ar"), "UnboundPartialA", avgB.unboundPartials().get("Ar//Ar"), - "UnboundPartialB")); + 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/ff/assignment-Kulmala2010.cpp b/tests/ff/assignment-Kulmala2010.cpp index 85f08294e4..726a6ddaa8 100644 --- a/tests/ff/assignment-Kulmala2010.cpp +++ b/tests/ff/assignment-Kulmala2010.cpp @@ -21,9 +21,9 @@ TEST(Kulmala2010AssignmentTest, Hydronium) ASSERT_EQ(species.torsions().size(), 0); ASSERT_EQ(species.impropers().size(), 0); - checkSpeciesAtomType(&species, {{0, "OW+"}, {1, "HW+"}, {2, "HW+"}, {3, "HW+"}}); - checkSpeciesIntramolecular(&species, {0, 1}, {BondFunctions::Form::Harmonic, "k=4030 eq=0.969"}); - 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) @@ -40,9 +40,9 @@ TEST(Kulmala2010AssignmentTest, Ammonia) ASSERT_EQ(species.torsions().size(), 0); ASSERT_EQ(species.impropers().size(), 0); - checkSpeciesAtomType(&species, {{0, "NH"}, {1, "HN"}, {2, "HN"}, {3, "HN"}}); - checkSpeciesIntramolecular(&species, {0, 1}, {BondFunctions::Form::Harmonic, "k=3864 eq=1.003"}); - 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) @@ -59,9 +59,9 @@ TEST(Kulmala2010AssignmentTest, Ammonium) ASSERT_EQ(species.torsions().size(), 0); ASSERT_EQ(species.impropers().size(), 0); - checkSpeciesAtomType(&species, {{0, "NH+"}, {1, "HN+"}, {2, "HN+"}, {3, "HN+"}}); - checkSpeciesIntramolecular(&species, {0, 1}, {BondFunctions::Form::Harmonic, "k=3660.3 eq=1.013"}); - 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) @@ -78,26 +78,26 @@ TEST(Kulmala2010AssignmentTest, Dimethylammonium) ASSERT_EQ(species.torsions().size(), 18); ASSERT_EQ(species.impropers().size(), 0); - checkSpeciesAtomType(&species, {{0, "NDM"}, - {1, "HDM"}, - {2, "HDM"}, - {3, "CDM"}, - {4, "CDM"}, - {5, "HCD"}, - {6, "HCD"}, - {7, "HCD"}, - {8, "HCD"}, - {9, "HCD"}, - {10, "HCD"}}); - checkSpeciesIntramolecular(&species, {0, 1}, {BondFunctions::Form::Harmonic, "k=3632 eq=1.01"}); - checkSpeciesIntramolecular(&species, {0, 3}, {BondFunctions::Form::Harmonic, "k=3071 eq=1.499"}); - checkSpeciesIntramolecular(&species, {3, 8}, {BondFunctions::Form::Harmonic, "k=2845.12 eq=1.09"}); - checkSpeciesIntramolecular(&species, {2, 0, 1}, {AngleFunctions::Form::Harmonic, "k=292.9 eq=105.5"}); - checkSpeciesIntramolecular(&species, {3, 0, 1}, {AngleFunctions::Form::Harmonic, "k=418.4 eq=109.2"}); - checkSpeciesIntramolecular(&species, {0, 3, 8}, {AngleFunctions::Form::Harmonic, "k=209.2 eq=108.5"}); - checkSpeciesIntramolecular(&species, {9, 3, 8}, {AngleFunctions::Form::Harmonic, "k=276.144 eq=107.8"}); - checkSpeciesIntramolecular(&species, {2, 0, 4, 5}, {TorsionFunctions::Form::Cos3, "0 0 0"}); - 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) @@ -114,13 +114,13 @@ TEST(Kulmala2010AssignmentTest, H2SO4) ASSERT_EQ(species.torsions().size(), 6); ASSERT_EQ(species.impropers().size(), 0); - checkSpeciesAtomType(&species, {{0, "SA"}, {1, "OA"}, {2, "OA"}, {3, "OHA"}, {4, "OHA"}, {5, "HSA"}, {6, "HSA"}}); - checkSpeciesIntramolecular(&species, {0, 1}, {BondFunctions::Form::Harmonic, "k=6258 eq=1.411"}); - checkSpeciesIntramolecular(&species, {0, 3}, {BondFunctions::Form::Harmonic, "k=3083.8 eq=1.571"}); - checkSpeciesIntramolecular(&species, {3, 6}, {BondFunctions::Form::Harmonic, "k=4561.1 eq=0.949"}); - checkSpeciesIntramolecular(&species, {1, 0, 2}, {AngleFunctions::Form::Harmonic, "k=224.37 eq=123.69"}); - checkSpeciesIntramolecular(&species, {6, 3, 0}, {AngleFunctions::Form::Harmonic, "k=396.82 eq=110.5"}); - 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) @@ -137,14 +137,14 @@ TEST(Kulmala2010AssignmentTest, HSO4Minus) ASSERT_EQ(species.torsions().size(), 3); ASSERT_EQ(species.impropers().size(), 0); - checkSpeciesAtomType(&species, {{0, "SA-"}, {1, "OA-"}, {2, "OA-"}, {3, "OA-"}, {4, "OHA-"}, {5, "HSA-"}}); - checkSpeciesIntramolecular(&species, {0, 1}, {BondFunctions::Form::Harmonic, "k=5239.9 eq=1.438"}); - checkSpeciesIntramolecular(&species, {0, 4}, {BondFunctions::Form::Harmonic, "k=2328.3 eq=1.634"}); - checkSpeciesIntramolecular(&species, {4, 5}, {BondFunctions::Form::Harmonic, "k=4561.1 eq=0.949"}); - checkSpeciesIntramolecular(&species, {1, 0, 2}, {AngleFunctions::Form::Harmonic, "k=456.97 eq=114.76"}); - checkSpeciesIntramolecular(&species, {1, 0, 4}, {AngleFunctions::Form::Harmonic, "k=814.48 eq=103.45"}); - checkSpeciesIntramolecular(&species, {5, 4, 0}, {AngleFunctions::Form::Harmonic, "k=398.12 eq=106.39"}); - 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 cd3e916f56..a412b49f0c 100644 --- a/tests/ff/assignment-Ludwig-py5.cpp +++ b/tests/ff/assignment-Ludwig-py5.cpp @@ -23,20 +23,20 @@ TEST(LudwigPy5AssignmentTest, Py5) ASSERT_EQ(species.torsions().size(), 66); ASSERT_EQ(species.impropers().size(), 6); - 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"}}); - checkSpeciesIntramolecular(&species, {0, 1}, {BondFunctions::Form::Harmonic, "k=4042 eq=1.339"}); - checkSpeciesIntramolecular(&species, {1, 6}, {BondFunctions::Form::Harmonic, "k=3071 eq=1.08"}); - checkSpeciesIntramolecular(&species, {11, 0, 1}, {AngleFunctions::Form::Harmonic, "k=585.8 eq=121.5"}); - checkSpeciesIntramolecular(&species, {0, 1, 2, 3}, {TorsionFunctions::Form::Cosine, "15.178 2 180 1"}); - checkSpeciesIntramolecular(&species, {0, 1, 5, 11}, {TorsionFunctions::Form::Cosine, "4.606 2 180 1"}); - checkSpeciesIntramolecular(&species, {1, 0, 2, 6}, {TorsionFunctions::Form::Cosine, "4.606 2 180 1"}); - checkSpeciesIntramolecular(&species, {2, 1, 3, 7}, {TorsionFunctions::Form::Cosine, "4.606 2 180 1"}); - checkSpeciesIntramolecular(&species, {3, 2, 4, 8}, {TorsionFunctions::Form::Cosine, "4.606 2 180 1"}); - checkSpeciesIntramolecular(&species, {4, 3, 5, 9}, {TorsionFunctions::Form::Cosine, "4.606 2 180 1"}); - 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 6acae13c41..fdead9e1bc 100644 --- a/tests/ff/assignment-OPLSAA2005-alcohols.cpp +++ b/tests/ff/assignment-OPLSAA2005-alcohols.cpp @@ -22,11 +22,11 @@ TEST(OPLSAA2005AlcoholsAssignmentTest, Methanol) ASSERT_EQ(species.torsions().size(), 3); ASSERT_EQ(species.impropers().size(), 0); - checkSpeciesAtomType(&species, {{0, "CT"}, {1, "OH"}, {2, "HO"}, {3, "HC"}, {4, "HC"}, {5, "HC"}}); - checkSpeciesIntramolecular(&species, {0, 1}, {BondFunctions::Form::Harmonic, "k=2677.76 eq=1.41"}); - checkSpeciesIntramolecular(&species, {0, 3}, {BondFunctions::Form::Harmonic, "k=2845.12 eq=1.09"}); - checkSpeciesIntramolecular(&species, {0, 1, 2}, {AngleFunctions::Form::Harmonic, "k=460.24 eq=108.5"}); - checkSpeciesIntramolecular(&species, {4, 0, 1}, {AngleFunctions::Form::Harmonic, "k=292.88 eq=109.5"}); - 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 7f6af6f3e4..5a8fcdd918 100644 --- a/tests/ff/assignment-OPLSAA2005-alkanes.cpp +++ b/tests/ff/assignment-OPLSAA2005-alkanes.cpp @@ -22,31 +22,31 @@ TEST(OPLSAA2005AlkanesAssignmentTest, Heptane) ASSERT_EQ(species.torsions().size(), 36); ASSERT_EQ(species.impropers().size(), 0); - 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"}}); - checkSpeciesIntramolecular(&species, {0, 1}, {BondFunctions::Form::Harmonic, "k=2242.62 eq=1.529"}); - checkSpeciesIntramolecular(&species, {0, 7}, {BondFunctions::Form::Harmonic, "k=2845.12 eq=1.09"}); - checkSpeciesIntramolecular(&species, {0, 1, 9}, {AngleFunctions::Form::Harmonic, "k=313.8 eq=110.7"}); - checkSpeciesIntramolecular(&species, {0, 1, 2}, {AngleFunctions::Form::Harmonic, "k=488.273 eq=112.7"}); - checkSpeciesIntramolecular(&species, {15, 4, 16}, {AngleFunctions::Form::Harmonic, "k=276.144 eq=107.8"}); - checkSpeciesIntramolecular(&species, {7, 0, 1, 9}, {TorsionFunctions::Form::Cos3, "0 0 1.2552"}); - checkSpeciesIntramolecular(&species, {7, 0, 1, 2}, {TorsionFunctions::Form::Cos3, "0 0 1.2552"}); - 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) @@ -64,16 +64,16 @@ TEST(OPLSAA2005AlkanesAssignmentTest, Cycloheptane) ASSERT_EQ(species.torsions().size(), 63); ASSERT_EQ(species.impropers().size(), 0); - 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"}}); - checkSpeciesIntramolecular(&species, {0, 1}, {BondFunctions::Form::Harmonic, "k=2242.62 eq=1.529"}); - checkSpeciesIntramolecular(&species, {0, 7}, {BondFunctions::Form::Harmonic, "k=2845.12 eq=1.09"}); - checkSpeciesIntramolecular(&species, {0, 1, 9}, {AngleFunctions::Form::Harmonic, "k=313.8 eq=110.7"}); - checkSpeciesIntramolecular(&species, {0, 1, 2}, {AngleFunctions::Form::Harmonic, "k=488.273 eq=112.7"}); - checkSpeciesIntramolecular(&species, {15, 4, 16}, {AngleFunctions::Form::Harmonic, "k=276.144 eq=107.8"}); - checkSpeciesIntramolecular(&species, {7, 0, 1, 9}, {TorsionFunctions::Form::Cos3, "0 0 1.2552"}); - checkSpeciesIntramolecular(&species, {7, 0, 1, 2}, {TorsionFunctions::Form::Cos3, "0 0 1.2552"}); - 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 d456d56437..41518cfabe 100644 --- a/tests/ff/assignment-OPLSAA2005-aromatics.cpp +++ b/tests/ff/assignment-OPLSAA2005-aromatics.cpp @@ -22,14 +22,14 @@ TEST(OPLSAA2005AromaticsAssignmentTest, Benzene) ASSERT_EQ(species.torsions().size(), 24); ASSERT_EQ(species.impropers().size(), 6); - checkSpeciesAtomType(&species, {{0, "CA"}, {1, "HA"}}); - checkSpeciesIntramolecular(&species, {0, 1}, {BondFunctions::Form::Harmonic, "k=3071.06 eq=1.08"}); - checkSpeciesIntramolecular(&species, {0, 2}, {BondFunctions::Form::Harmonic, "k=3924.59 eq=1.4"}); - checkSpeciesIntramolecular(&species, {1, 0, 2}, {AngleFunctions::Form::Harmonic, "k=292.88 eq=120"}); - checkSpeciesIntramolecular(&species, {0, 2, 4}, {AngleFunctions::Form::Harmonic, "k=527.184 eq=120"}); - checkSpeciesIntramolecular(&species, {1, 0, 2, 3}, {TorsionFunctions::Form::Cos3, "0 30.334 0"}); - checkSpeciesIntramolecular(&species, {1, 0, 2, 4}, {TorsionFunctions::Form::Cos3, "0 30.334 0"}); - 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) @@ -47,27 +47,27 @@ TEST(OPLSAA2005AromaticsAssignmentTest, Naphthalene) ASSERT_EQ(species.torsions().size(), 44); ASSERT_EQ(species.impropers().size(), 10); - 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"}}); - checkSpeciesIntramolecular(&species, {2, 7}, {BondFunctions::Form::Harmonic, "k=3924.59 eq=1.4"}); - checkSpeciesIntramolecular(&species, {1, 2, 7}, {AngleFunctions::Form::Harmonic, "k=527.184 eq=120"}); - checkSpeciesIntramolecular(&species, {1, 2, 3}, {AngleFunctions::Form::Harmonic, "k=527.184 eq=120"}); - 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 d38cded69f..1eca653a08 100644 --- a/tests/ff/assignment-PCL2019-anions.cpp +++ b/tests/ff/assignment-PCL2019-anions.cpp @@ -22,9 +22,9 @@ TEST(PCL2019AnionsAssignmentTest, beti) ASSERT_EQ(species.torsions().size(), 42); ASSERT_EQ(species.impropers().size(), 0); - 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); } @@ -43,7 +43,7 @@ TEST(PCL2019AnionsAssignmentTest, BF4) ASSERT_EQ(species.torsions().size(), 0); ASSERT_EQ(species.impropers().size(), 0); - 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); } @@ -62,8 +62,8 @@ TEST(PCL2019AnionsAssignmentTest, c1SO3) ASSERT_EQ(species.torsions().size(), 9); ASSERT_EQ(species.impropers().size(), 0); - 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); } @@ -82,7 +82,7 @@ TEST(PCL2019AnionsAssignmentTest, c1SO4) ASSERT_EQ(species.torsions().size(), 6); ASSERT_EQ(species.impropers().size(), 0); - 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); } @@ -102,17 +102,17 @@ TEST(PCL2019AnionsAssignmentTest, c2SO3) ASSERT_EQ(species.torsions().size(), 18); ASSERT_EQ(species.impropers().size(), 0); - 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); } @@ -131,18 +131,18 @@ TEST(PCL2019AnionsAssignmentTest, c2SO4) ASSERT_EQ(species.torsions().size(), 15); ASSERT_EQ(species.impropers().size(), 0); - 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); } @@ -161,10 +161,10 @@ TEST(PCL2019AnionsAssignmentTest, c4fc1fsi) ASSERT_EQ(species.torsions().size(), 51); ASSERT_EQ(species.impropers().size(), 0); - 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); } @@ -183,7 +183,7 @@ TEST(PCL2019AnionsAssignmentTest, CCN3) ASSERT_EQ(species.torsions().size(), 6); ASSERT_EQ(species.impropers().size(), 1); - 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); } @@ -202,7 +202,7 @@ TEST(PCL2019AnionsAssignmentTest, dca) ASSERT_EQ(species.torsions().size(), 2); ASSERT_EQ(species.impropers().size(), 0); - 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); } @@ -221,7 +221,7 @@ TEST(PCL2019AnionsAssignmentTest, fsi) ASSERT_EQ(species.torsions().size(), 6); ASSERT_EQ(species.impropers().size(), 0); - 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); } @@ -241,21 +241,21 @@ TEST(PCL2019AnionsAssignmentTest, ntf2) ASSERT_EQ(species.torsions().size(), 24); ASSERT_EQ(species.impropers().size(), 0); - 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); } @@ -274,7 +274,7 @@ TEST(PCL2019AnionsAssignmentTest, oac) ASSERT_EQ(species.torsions().size(), 6); ASSERT_EQ(species.impropers().size(), 1); - 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); } @@ -293,8 +293,8 @@ TEST(PCL2019AnionsAssignmentTest, otf) ASSERT_EQ(species.torsions().size(), 9); ASSERT_EQ(species.impropers().size(), 0); - 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); } @@ -313,7 +313,7 @@ TEST(PCL2019AnionsAssignmentTest, PF6) ASSERT_EQ(species.torsions().size(), 0); ASSERT_EQ(species.impropers().size(), 0); - 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); } @@ -332,7 +332,7 @@ TEST(PCL2019AnionsAssignmentTest, SCN) ASSERT_EQ(species.torsions().size(), 0); ASSERT_EQ(species.impropers().size(), 0); - 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); } @@ -351,7 +351,7 @@ TEST(PCL2019AnionsAssignmentTest, tfa) ASSERT_EQ(species.torsions().size(), 6); ASSERT_EQ(species.impropers().size(), 0); - 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); } @@ -370,24 +370,24 @@ TEST(PCL2019AnionsAssignmentTest, tso) ASSERT_EQ(species.torsions().size(), 36); ASSERT_EQ(species.impropers().size(), 6); - 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 dca9a88bdc..65addbdeff 100644 --- a/tests/ff/assignment-PCL2019-cations.cpp +++ b/tests/ff/assignment-PCL2019-cations.cpp @@ -22,10 +22,10 @@ TEST(PCL2019CationsAssignmentTest, benzc1im) ASSERT_EQ(species.torsions().size(), 62); ASSERT_EQ(species.impropers().size(), 11); - 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); } @@ -44,13 +44,13 @@ TEST(PCL2019CationsAssignmentTest, c12c1im) ASSERT_EQ(species.torsions().size(), 131); ASSERT_EQ(species.impropers().size(), 5); - 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); } @@ -69,22 +69,22 @@ TEST(PCL2019CationsAssignmentTest, c1c1im) ASSERT_EQ(species.torsions().size(), 32); ASSERT_EQ(species.impropers().size(), 5); - 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); } @@ -103,9 +103,9 @@ TEST(PCL2019CationsAssignmentTest, c1c1pyrr) ASSERT_EQ(species.torsions().size(), 63); ASSERT_EQ(species.impropers().size(), 0); - 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); } @@ -124,10 +124,10 @@ TEST(PCL2019CationsAssignmentTest, c2c1c1im) ASSERT_EQ(species.torsions().size(), 47); ASSERT_EQ(species.impropers().size(), 5); - 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); } @@ -146,25 +146,25 @@ TEST(PCL2019CationsAssignmentTest, c2c1im) ASSERT_EQ(species.torsions().size(), 41); ASSERT_EQ(species.impropers().size(), 5); - 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); } @@ -183,22 +183,22 @@ TEST(PCL2019CationsAssignmentTest, c2im) ASSERT_EQ(species.torsions().size(), 35); ASSERT_EQ(species.impropers().size(), 4); - 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); } @@ -217,9 +217,9 @@ TEST(PCL2019CationsAssignmentTest, c2OHc1im) ASSERT_EQ(species.torsions().size(), 44); ASSERT_EQ(species.impropers().size(), 5); - 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); } @@ -238,24 +238,24 @@ TEST(PCL2019CationsAssignmentTest, c2py) ASSERT_EQ(species.torsions().size(), 39); ASSERT_EQ(species.impropers().size(), 6); - 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); } @@ -274,10 +274,10 @@ TEST(PCL2019CationsAssignmentTest, c3c1im) ASSERT_EQ(species.torsions().size(), 50); ASSERT_EQ(species.impropers().size(), 5); - 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); } @@ -296,10 +296,10 @@ TEST(PCL2019CationsAssignmentTest, c3c1pyrr) ASSERT_EQ(species.torsions().size(), 81); ASSERT_EQ(species.impropers().size(), 0); - 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); } @@ -318,10 +318,10 @@ TEST(PCL2019CationsAssignmentTest, c4c1c1im) ASSERT_EQ(species.torsions().size(), 65); ASSERT_EQ(species.impropers().size(), 5); - 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); } @@ -340,10 +340,10 @@ TEST(PCL2019CationsAssignmentTest, c4c1im) ASSERT_EQ(species.torsions().size(), 59); ASSERT_EQ(species.impropers().size(), 5); - 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); } @@ -362,11 +362,11 @@ TEST(PCL2019CationsAssignmentTest, c4c1pyrr) ASSERT_EQ(species.torsions().size(), 90); ASSERT_EQ(species.impropers().size(), 0); - 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); } @@ -385,11 +385,11 @@ TEST(PCL2019CationsAssignmentTest, c4c4im) ASSERT_EQ(species.torsions().size(), 86); ASSERT_EQ(species.impropers().size(), 5); - 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); } @@ -408,10 +408,10 @@ TEST(PCL2019CationsAssignmentTest, c4pyri) ASSERT_EQ(species.torsions().size(), 57); ASSERT_EQ(species.impropers().size(), 6); - 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); } @@ -430,11 +430,11 @@ TEST(PCL2019CationsAssignmentTest, c6c1im) ASSERT_EQ(species.torsions().size(), 77); ASSERT_EQ(species.impropers().size(), 5); - 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); } @@ -453,12 +453,12 @@ TEST(PCL2019CationsAssignmentTest, c8c1im) ASSERT_EQ(species.torsions().size(), 95); ASSERT_EQ(species.impropers().size(), 5); - 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); } @@ -477,12 +477,12 @@ TEST(PCL2019CationsAssignmentTest, c8fc1im) ASSERT_EQ(species.torsions().size(), 95); ASSERT_EQ(species.impropers().size(), 5); - 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); } @@ -501,12 +501,12 @@ TEST(PCL2019CationsAssignmentTest, c8isoqui) ASSERT_EQ(species.torsions().size(), 113); ASSERT_EQ(species.impropers().size(), 10); - 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); } @@ -525,9 +525,9 @@ TEST(PCL2019CationsAssignmentTest, cholinium) ASSERT_EQ(species.torsions().size(), 48); ASSERT_EQ(species.impropers().size(), 0); - 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); } @@ -546,7 +546,7 @@ TEST(PCL2019CationsAssignmentTest, gua) ASSERT_EQ(species.torsions().size(), 12); ASSERT_EQ(species.impropers().size(), 4); - 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); @@ -567,20 +567,20 @@ TEST(PCL2019CationsAssignmentTest, N1110) ASSERT_EQ(species.torsions().size(), 27); ASSERT_EQ(species.impropers().size(), 0); - 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); } @@ -599,23 +599,23 @@ TEST(PCL2019CationsAssignmentTest, N1111) ASSERT_EQ(species.torsions().size(), 36); ASSERT_EQ(species.impropers().size(), 0); - 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); } @@ -634,10 +634,10 @@ TEST(PCL2019CationsAssignmentTest, N2220) ASSERT_EQ(species.torsions().size(), 54); ASSERT_EQ(species.impropers().size(), 0); - 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); } @@ -656,11 +656,11 @@ TEST(PCL2019CationsAssignmentTest, N2222) ASSERT_EQ(species.torsions().size(), 72); ASSERT_EQ(species.impropers().size(), 0); - 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); } @@ -679,7 +679,7 @@ TEST(PCL2019CationsAssignmentTest, N4444) ASSERT_EQ(species.torsions().size(), 144); ASSERT_EQ(species.impropers().size(), 0); - 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"}, @@ -704,7 +704,7 @@ TEST(PCL2019CationsAssignmentTest, P66614) ASSERT_EQ(species.torsions().size(), 288); ASSERT_EQ(species.impropers().size(), 0); - 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 49f53f57dc..0beca0f7d8 100644 --- a/tests/ff/assignment-SPCFw.cpp +++ b/tests/ff/assignment-SPCFw.cpp @@ -22,8 +22,8 @@ TEST(SPCFwAssignmentTest, Water) ASSERT_EQ(species.torsions().size(), 0); ASSERT_EQ(species.impropers().size(), 0); - checkSpeciesAtomType(&species, {{0, "OW"}, {1, "HW"}, {2, "HW"}}); - checkSpeciesIntramolecular(&species, {0, 1}, {BondFunctions::Form::Harmonic, "k=4431.53 eq=1"}); - 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 3520867872..31470b34c2 100644 --- a/tests/ff/assignment-UFF-nmethylformamide.cpp +++ b/tests/ff/assignment-UFF-nmethylformamide.cpp @@ -22,16 +22,16 @@ TEST(UFFNMethylFormamideAssignmentTest, NMethylFormamide) ASSERT_EQ(species.torsions().size(), 10); ASSERT_EQ(species.impropers().size(), 2); - 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_"}}); - checkSpeciesIntramolecular(&species, {1, 2}, {BondFunctions::Form::Harmonic, "k=5410.2978 eq=1.3568"}, 5.0e-5); - checkSpeciesIntramolecular(&species, {0, 1}, {BondFunctions::Form::Harmonic, "k=2991.0611 eq=1.08142"}, 5.0e-5); - checkSpeciesIntramolecular(&species, {2, 4}, {BondFunctions::Form::Harmonic, "k=4432.3881 eq=1.45007"}, 5.0e-5); - checkSpeciesIntramolecular(&species, {1, 2, 4}, {AngleFunctions::Form::Cos2, "882.7151 0.5 0.666667 0.333333"}, 5.0e-5); - checkSpeciesIntramolecular(&species, {3, 1, 2}, {AngleFunctions::Form::Cos2, "1590.3058 0.5 0.6667 0.3333"}, 5.0e-5); - checkSpeciesIntramolecular(&species, {8, 4, 7}, {AngleFunctions::Form::Cos2, "315.8868 0.343737 0.37492 0.281246"}, 6.0e-5); - checkSpeciesIntramolecular(&species, {0, 1, 2, 4}, {TorsionFunctions::Form::UFFCosine, "101.9308 2 180"}, 2.0e-5); - checkSpeciesIntramolecular(&species, {1, 0, 2, 3}, {TorsionFunctions::Form::FourierN, "209.2 1 -1 0"}); - 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 898179c3a2..ec1f930f55 100644 --- a/tests/ff/assignment-UFF4MOF-mof5.cpp +++ b/tests/ff/assignment-UFF4MOF-mof5.cpp @@ -38,29 +38,29 @@ TEST(UFF4MOFMOF5AssignmentTest, MOF5) ASSERT_EQ(species.torsions().size(), 1536); ASSERT_EQ(species.impropers().size(), 192); - 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_"}}); - checkSpeciesIntramolecular(&species, {386, 290}, {BondFunctions::Form::Harmonic, "k=2991.0611 eq=1.08142"}, 1.0e-5); - checkSpeciesIntramolecular(&species, {0, 32}, {BondFunctions::Form::Harmonic, "k=1337.872 eq=1.84185"}, 3.0e-5); - checkSpeciesIntramolecular(&species, {8, 32}, {BondFunctions::Form::Harmonic, "k=1337.872 eq=1.84185"}, 1.0e-5); - checkSpeciesIntramolecular(&species, {71, 156}, {BondFunctions::Form::Harmonic, "k=5048.4039 eq=1.34262"}, 5.0e-6); - checkSpeciesIntramolecular(&species, {178, 122, 26}, {AngleFunctions::Form::Cosine, "53.5872 3 0 -1"}, 3.0e-5); - checkSpeciesIntramolecular(&species, {121, 29, 112}, {AngleFunctions::Form::Cosine, "107.58286 3 0 -1"}, 6.0e-6); - checkSpeciesIntramolecular(&species, {178, 122, 26, 117}, {TorsionFunctions::Form::UFFCosine, "96.4708 2 180"}, 5.0e-5); - 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 37b723119a..377bb590d6 100644 --- a/tests/ff/benzene.cpp +++ b/tests/ff/benzene.cpp @@ -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 be92a18241..51b1005668 100644 --- a/tests/ff/cos-n.cpp +++ b/tests/ff/cos-n.cpp @@ -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 73944869ed..6b12dc15df 100644 --- a/tests/ff/hexane.cpp +++ b/tests/ff/hexane.cpp @@ -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 77902145cd..6fac9b6cb2 100644 --- a/tests/ff/water-1000.cpp +++ b/tests/ff/water-1000.cpp @@ -28,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); @@ -62,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) @@ -92,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) @@ -129,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); @@ -168,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) @@ -202,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); @@ -238,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) @@ -275,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) { @@ -359,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/math/poisson.cpp b/tests/math/poisson.cpp index eb875b7fa5..59b8f98bee 100644 --- a/tests/math/poisson.cpp +++ b/tests/math/poisson.cpp @@ -40,7 +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(checkData1D(coeffMinimiser.approximation(), dataSet, delfitFile, 1, column, errorThreshold)); + EXPECT_TRUE(testData1D(coeffMinimiser.approximation(), dataSet, delfitFile, 1, column, errorThreshold)); } } diff --git a/tests/nodes/angle.cpp b/tests/nodes/angle.cpp index 2da0146fb8..c9c4577f10 100644 --- a/tests/nodes/angle.cpp +++ b/tests/nodes/angle.cpp @@ -39,9 +39,9 @@ TEST(AngleNodeTest, Water) ASSERT_EQ(iterator->run(), NodeConstants::ProcessResult::Success); EXPECT_TRUE( - checkData1D(angle->rdfBC(), "B-C RDF", "dlpoly/water267-analysis/water-267-298K.aardf_21_23_inter_sum", 1, 2, 4.0e-3)); - EXPECT_TRUE(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)); + 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/averageMolecule.cpp b/tests/nodes/averageMolecule.cpp index 148697d03c..98a213531a 100644 --- a/tests/nodes/averageMolecule.cpp +++ b/tests/nodes/averageMolecule.cpp @@ -31,9 +31,9 @@ TEST(AverageMoleculeNodeTest, Water) ASSERT_EQ(iterator->run(), NodeConstants::ProcessResult::Success); auto &structure = avgMol->structure(); - checkVec3(structure.atom(0)->r(), {-0.83305, 0.0, 0.0}, 1.0e-3); - checkVec3(structure.atom(1)->r(), {0.00016, 0.60443, 0.0}, 1.0e-3); - 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) @@ -59,9 +59,9 @@ TEST(AverageMoleculeNodeTest, BeNDy) ASSERT_EQ(iterator->run(), NodeConstants::ProcessResult::Success); auto &structure = avgMol->structure(); - checkVec3(structure.atom(0)->r(), {2.0, 0.0, 0.0}, 1.0e-3); - checkVec3(structure.atom(1)->r(), {0.0, 0.0, 0.0}, 1.0e-3); - 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/bragg.cpp b/tests/nodes/bragg.cpp index 784fefff38..e5b05d3ffb 100644 --- a/tests/nodes/bragg.cpp +++ b/tests/nodes/bragg.cpp @@ -149,18 +149,18 @@ TEST_F(BraggNodeTest, MgO_Full) auto weightedSQ = neutronSQNode_->getOutputValue("WeightedSQ"); auto weightedTotal = weightedSQ->total(); - EXPECT_TRUE(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(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(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(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 ca2c5a56ba..c55c4a71ce 100644 --- a/tests/nodes/broadening.cpp +++ b/tests/nodes/broadening.cpp @@ -44,9 +44,9 @@ TEST(BroadeningTest, ArgonBroadening) // Get the weighted SQ auto weightedSQ = neutronSQNode->getOutputValue("WeightedSQ"); ASSERT_TRUE(weightedSQ); - EXPECT_TRUE(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 b47a418b88..ebc9dd28a4 100644 --- a/tests/nodes/cif.cpp +++ b/tests/nodes/cif.cpp @@ -139,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)) - 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)) - 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 46d4cc7a30..1c004642f8 100644 --- a/tests/nodes/dAngle.cpp +++ b/tests/nodes/dAngle.cpp @@ -38,9 +38,9 @@ TEST(DAngleNodeTest, Water) ASSERT_EQ(iterator->run(), NodeConstants::ProcessResult::Success); EXPECT_TRUE( - checkData1D(dAngle->rdfBC(), "B-C RDF", "dlpoly/water267-analysis/water-267-298K.aardf_21_23_inter_sum", 1, 2, 4.0e-3)); - EXPECT_TRUE(checkData1D(dAngle->angle(), "Angle Distributions", - "dlpoly/water267-analysis/water-267-298K.dahist1_02_1_01_02.angle.norm", 1, 2, 3.0e-6)); + 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; @@ -49,7 +49,7 @@ TEST(DAngleNodeTest, Water) auto data = dAngle->distanceAngleMap().accumulatedData(); DataOperator2D dAngleNormaliser(data); dAngleNormaliser.divide(267.0); - EXPECT_TRUE(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 6fb9c7ed1e..05e938c2e8 100644 --- a/tests/nodes/epsr.cpp +++ b/tests/nodes/epsr.cpp @@ -76,12 +76,12 @@ TEST(EPSRNodeTest, Water3N) ASSERT_EQ(epsrNode->run(), NodeConstants::ProcessResult::Success); // Estimated Partials - EXPECT_TRUE(checkData1D(epsrNode->estimatedSQ("OW", "OW"), "EPSR01_EstimatedSQ_OW-OW", - "epsr25/water1000-neutron/water.EPSR.q01", 1, 2, 2.0e-4)); - EXPECT_TRUE(checkData1D(epsrNode->estimatedSQ("OW", "HW"), "EPSR01_EstimatedSQ_OW-HW", - "epsr25/water1000-neutron/water.EPSR.q01", 1, 4, 2.0e-4)); - EXPECT_TRUE(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) @@ -152,22 +152,22 @@ TEST(EPSRNodeTest, Water3NX) ASSERT_EQ(epsrNode->run(), NodeConstants::ProcessResult::Success); // Test total neutron-weighted F(r) - EXPECT_TRUE(checkData1D(epsrNode->targetProcessData(D2O).simulatedFR, "EPSR01_SimulatedFR_D2O", - "epsr25/water1000-neutron-xray/water.EPSR.x01", 1, 2, 2.0e-2)); - EXPECT_TRUE(checkData1D(epsrNode->targetProcessData(H2O).simulatedFR, "EPSR01_SimulatedFR_H2O", - "epsr25/water1000-neutron-xray/water.EPSR.x01", 1, 4, 8.0e-3)); - EXPECT_TRUE(checkData1D(epsrNode->targetProcessData(HDO).simulatedFR, "EPSR01_SimulatedFR_HDO", - "epsr25/water1000-neutron-xray/water.EPSR.x01", 1, 6, 2.0e-2)); - EXPECT_TRUE(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(checkData1D(epsrNode->estimatedSQ("OW", "OW"), "EPSR01_EstimatedSQ_OW-OW", - "epsr25/water1000-neutron-xray/water.EPSR.q01", 1, 2, 6.0e-3)); - EXPECT_TRUE(checkData1D(epsrNode->estimatedSQ("OW", "HW"), "EPSR01_EstimatedSQ_OW-HW", - "epsr25/water1000-neutron-xray/water.EPSR.q01", 1, 4, 6.0e-3)); - EXPECT_TRUE(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) @@ -222,20 +222,20 @@ TEST(EPSRNodeTest, Benzene) ASSERT_EQ(epsrNode->run(), NodeConstants::ProcessResult::Success); // Test total neutron-weighted F(r) - EXPECT_TRUE(checkData1D(epsrNode->targetProcessData(C6H6).simulatedFR, "EPSR01//SimulatedFR//C6H6", - "epsr25/benzene200-neutron/benzene.EPSR.x01", 1, 2, 1.5e-3)); - EXPECT_TRUE(checkData1D(epsrNode->targetProcessData(C6D6).simulatedFR, "EPSR01//SimulatedFR//C6D6", - "epsr25/benzene200-neutron/benzene.EPSR.x01", 1, 4, 1.7e-2)); - EXPECT_TRUE(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(checkData1D(epsrNode->estimatedSQ("CA", "CA"), "EPSR01//EstimatedSQ//CA-CA", - "epsr25/benzene200-neutron/benzene.EPSR.q01", 1, 2, 2.0e-2)); - EXPECT_TRUE(checkData1D(epsrNode->estimatedSQ("CA", "HA"), "EPSR01//EstimatedSQ//CA-HA", - "epsr25/benzene200-neutron/benzene.EPSR.q01", 1, 4, 2.0e-2)); - EXPECT_TRUE(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/gr.cpp b/tests/nodes/gr.cpp index d060d21133..9572030836 100644 --- a/tests/nodes/gr.cpp +++ b/tests/nodes/gr.cpp @@ -30,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(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(checkPartialSet(rawGRBaseline, rawGRCells, 1.0e-8)); + ASSERT_TRUE(testPartialSet(rawGRBaseline, rawGRCells, 1.0e-8)); } TEST(GRNodeTest, Water) @@ -60,20 +60,20 @@ TEST(GRNodeTest, Water) auto rawGR = grNode->getOutputValue("RawGR"); // Partial g(r) (unbound terms) - EXPECT_TRUE(checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("OW", "OW")), "OW-OW Unbound Partial", - "epsr25/water1000-neutron/water.EPSR.g01", 1, 2, 6.0e-2)); - EXPECT_TRUE(checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("HW", "OW")), "HW-OW Unbound Partial", - "epsr25/water1000-neutron/water.EPSR.g01", 1, 4, 2.0e-2)); - EXPECT_TRUE(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(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(checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("HW", "OW")), "HW-OW Bound Partial", - "epsr25/water1000-neutron/water.EPSR.y01", 1, 4, 0.1)); - EXPECT_TRUE(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) @@ -105,94 +105,94 @@ TEST(GRNodeTest, WaterMethanol) */ // Partial g(r) (unbound terms - EXPECT_TRUE(checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("OW", "OW")), "OW-OW Unbound Partial", - "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 2, 1.0)); - EXPECT_TRUE(checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("OW", "HW")), "OW-HW Unbound Partial", - "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 4, 0.5)); - EXPECT_TRUE(checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("OW", "CT")), "OW-CT Unbound Partial", - "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 6, 0.2)); - EXPECT_TRUE(checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("OW", "HC")), "OW-HC Unbound Partial", - "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 8, 7.0e-2)); - EXPECT_TRUE(checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("OW", "OH")), "OW-OH Unbound Partial", - "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 10, 0.2)); - EXPECT_TRUE(checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("OW", "HO")), "OW-HO Unbound Partial", - "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 12, 0.3)); - EXPECT_TRUE(checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("HW", "HW")), "HW-HW Unbound Partial", - "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 14, 0.4)); - EXPECT_TRUE(checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("HW", "CT")), "HW-CT Unbound Partial", - "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 16, 0.1)); - EXPECT_TRUE(checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("HW", "HC")), "HW-HC Unbound Partial", - "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 18, 4.0e-2)); - EXPECT_TRUE(checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("HW", "OH")), "HW-OH Unbound Partial", - "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 20, 0.2)); - EXPECT_TRUE(checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("HW", "HO")), "HW-HO Unbound Partial", - "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 22, 0.2)); - EXPECT_TRUE(checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("CT", "CT")), "CT-CT Unbound Partial", - "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 24, 0.2)); - EXPECT_TRUE(checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("CT", "HC")), "CT-HC Unbound Partial", - "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 26, 4.0e-2)); - EXPECT_TRUE(checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("CT", "OH")), "CT-OH Unbound Partial", - "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 28, 0.1)); - EXPECT_TRUE(checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("CT", "HO")), "CT-HO Unbound Partial", - "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 30, 0.1)); - EXPECT_TRUE(checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("HC", "HC")), "HC-HC Unbound Partial", - "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 32, 4.0e-2)); - EXPECT_TRUE(checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("HC", "OH")), "HC-OH Unbound Partial", - "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 34, 4.0e-2)); - EXPECT_TRUE(checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("HC", "HO")), "HC-HO Unbound Partial", - "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 36, 5.0e-2)); - EXPECT_TRUE(checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("OH", "OH")), "OH-OH Unbound Partial", - "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 38, 0.3)); - EXPECT_TRUE(checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("OH", "HO")), "OH-HO Unbound Partial", - "epsr25/water300methanol600/watermeth.EPSR.g01", 1, 40, 0.1)); - EXPECT_TRUE(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(checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("OW", "HW")), "OW-HW Bound Partial", - "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 4, 0.8)); - EXPECT_TRUE(checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("HW", "HW")), "HW-HW Bound Partial", - "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 14, 0.5)); - EXPECT_TRUE(checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("CT", "HC")), "CT-HC Bound Partial", - "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 26, 0.3)); - EXPECT_TRUE(checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("CT", "OH")), "CT-OH Bound Partial", - "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 28, 0.5)); - EXPECT_TRUE(checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("CT", "HO")), "CT-HO Bound Partial", - "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 30, 0.2)); - EXPECT_TRUE(checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("HC", "HC")), "HC-HC Bound Partial", - "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 32, 0.06)); - EXPECT_TRUE(checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("HC", "OH")), "HC-OH Bound Partial", - "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 34, 0.08)); - EXPECT_TRUE(checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("HC", "HO")), "HC-HO Bound Partial", - "epsr25/water300methanol600/watermeth.EPSR.y01", 1, 36, 0.5)); - EXPECT_TRUE(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(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(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(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(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(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(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(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(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(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(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(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(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) @@ -216,20 +216,20 @@ TEST(GRNodeTest, Benzene) auto rawGR = grNode->getOutputValue("RawGR"); // Partial g(r) (unbound terms) - EXPECT_TRUE(checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("CA", "CA")), "CA-CA Unbound Partial", - "epsr25/benzene200-neutron/benzene.EPSR.g01", 1, 2, 3.0e-2)); - EXPECT_TRUE(checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("CA", "HA")), "CA-HA Unbound Partial", - "epsr25/benzene200-neutron/benzene.EPSR.g01", 1, 4, 2.0e-2)); - EXPECT_TRUE(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(checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("CA", "CA")), "CA-CA Bound Partial", - "epsr25/benzene200-neutron/benzene.EPSR.y01", 1, 2, 0.12)); - EXPECT_TRUE(checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("CA", "HA")), "CA-HA Bound Partial", - "epsr25/benzene200-neutron/benzene.EPSR.y01", 1, 4, 0.18)); - EXPECT_TRUE(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/graphArgon.cpp b/tests/nodes/graphArgon.cpp index 26ed8ca7de..ff15ba36b1 100644 --- a/tests/nodes/graphArgon.cpp +++ b/tests/nodes/graphArgon.cpp @@ -48,12 +48,12 @@ TEST(GraphArgonTest, AllCorrelations) // Check total unweighted SQ auto unweightedSQ = sqNode->getOutputValue("UnweightedSQ"); ASSERT_TRUE(unweightedSQ); - ASSERT_TRUE(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(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/intraAngle.cpp b/tests/nodes/intraAngle.cpp index 8c6c57129c..8023f2b988 100644 --- a/tests/nodes/intraAngle.cpp +++ b/tests/nodes/intraAngle.cpp @@ -35,8 +35,8 @@ TEST(IntraAngleNodeTest, Water) ASSERT_TRUE(iterator->setOption("N", 95)); ASSERT_EQ(iterator->run(), NodeConstants::ProcessResult::Success); - EXPECT_TRUE(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 0c59b98dc0..2570ce4a9a 100644 --- a/tests/nodes/intraDistance.cpp +++ b/tests/nodes/intraDistance.cpp @@ -50,12 +50,12 @@ TEST(IntraDistanceNodeTest, Water) ASSERT_TRUE(iterator->setOption("N", 95)); ASSERT_EQ(iterator->run(), NodeConstants::ProcessResult::Success); - EXPECT_TRUE(checkData1D(dOH1->rdfAB(), "D(O-H1)//NormalisedHistogram", "dlpoly/water267-analysis/water-267-298K.01-02.ij", - 1, 3, 6.0e-5)); - EXPECT_TRUE(checkData1D(dOH2->rdfAB(), "D(O-H2)//NormalisedHistogram", "dlpoly/water267-analysis/water-267-298K.02-03.ij", - 1, 3, 7.0e-5)); - EXPECT_TRUE(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/moleculeTorsion.cpp b/tests/nodes/moleculeTorsion.cpp index ffbd40a656..9d74073763 100644 --- a/tests/nodes/moleculeTorsion.cpp +++ b/tests/nodes/moleculeTorsion.cpp @@ -33,8 +33,8 @@ TEST(MoleculeTorsionNodeTest, Benzene) ASSERT_TRUE(iterator->setOption("N", 80)); ASSERT_EQ(iterator->run(), NodeConstants::ProcessResult::Success); - EXPECT_TRUE(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 095a657831..cbbe689945 100644 --- a/tests/nodes/neutronSQ.cpp +++ b/tests/nodes/neutronSQ.cpp @@ -42,12 +42,12 @@ TEST(NeutronSQNodeTest, Water) ASSERT_EQ(HDO->versionIndex(), 0); // Check total F(Q) - EXPECT_TRUE(checkData1D(D2O->getOutputValue("WeightedSQ")->total(), "D2O F(Q)", - "epsr25/water1000-neutron/water.EPSR.u01", 1, 2, 3.0e-4)); - EXPECT_TRUE(checkData1D(H2O->getOutputValue("WeightedSQ")->total(), "H2O F(Q)", - "epsr25/water1000-neutron/water.EPSR.u01", 1, 4, 6.0e-4)); - EXPECT_TRUE(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(checkData1D(D2O->getOutputValue("ReferenceGR"), "D2O Reference G(r)", - "epsr25/water1000-neutron-xray/water.EPSR.w01", 1, 2, 5.0e-5)); - EXPECT_TRUE(checkData1D(H2O->getOutputValue("ReferenceGR"), "H2O Reference G(r)", - "epsr25/water1000-neutron-xray/water.EPSR.w01", 1, 4, 5.0e-5)); - EXPECT_TRUE(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,22 +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(checkData1D(neutronSQ["HHH"]->getOutputValue("WeightedSQ")->total(), "HHH Total F(Q)", - "epsr25/water300methanol600/watermeth.EPSR.u01", 1, 2, 1.0e-4)); - EXPECT_TRUE(checkData1D(neutronSQ["H5H"]->getOutputValue("WeightedSQ")->total(), "H5H Total F(Q)", - "epsr25/water300methanol600/watermeth.EPSR.u01", 1, 4, 1.0e-4)); - EXPECT_TRUE(checkData1D(neutronSQ["DHH"]->getOutputValue("WeightedSQ")->total(), "DHH Total F(Q)", - "epsr25/water300methanol600/watermeth.EPSR.u01", 1, 6, 1.0e-4)); - EXPECT_TRUE(checkData1D(neutronSQ["HDH"]->getOutputValue("WeightedSQ")->total(), "HDH Total F(Q)", - "epsr25/water300methanol600/watermeth.EPSR.u01", 1, 8, 1.0e-4)); - EXPECT_TRUE(checkData1D(neutronSQ["HHD"]->getOutputValue("WeightedSQ")->total(), "HHD Total F(Q)", - "epsr25/water300methanol600/watermeth.EPSR.u01", 1, 10, 5.0e-4)); - EXPECT_TRUE(checkData1D(neutronSQ["DDH"]->getOutputValue("WeightedSQ")->total(), "DDH Total F(Q)", - "epsr25/water300methanol600/watermeth.EPSR.u01", 1, 12, 8.0e-4)); - EXPECT_TRUE(checkData1D(neutronSQ["HDD"]->getOutputValue("WeightedSQ")->total(), "HDD Total F(Q)", - "epsr25/water300methanol600/watermeth.EPSR.u01", 1, 14, 5.0e-4)); - EXPECT_TRUE(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) @@ -185,12 +185,12 @@ TEST(NeutronSQNodeTest, Benzene) ASSERT_EQ(FiftyFifty->versionIndex(), 0); // Total F(Q) - EXPECT_TRUE(checkData1D(C6H6->getOutputValue("WeightedSQ")->total(), "C6H6 Total F(Q)", - "epsr25/benzene200-neutron/benzene.EPSR.u01", 1, 2, 2.0e-3)); - EXPECT_TRUE(checkData1D(C6D6->getOutputValue("WeightedSQ")->total(), "C6D6 Total F(Q)", - "epsr25/benzene200-neutron/benzene.EPSR.u01", 1, 4, 2.0e-3)); - EXPECT_TRUE(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 e9f957f00e..909b1991e0 100644 --- a/tests/nodes/orientedSDF.cpp +++ b/tests/nodes/orientedSDF.cpp @@ -41,6 +41,6 @@ TEST(OrientedSDFNodeTest, Benzene) Data3D referenceData; EXPECT_TRUE(ImportDLPUtilsPDensNode::read(referenceData, "dlpoly/benzene181/benzene181.11.pdens.zOrient0_10")); - EXPECT_TRUE(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/sdf.cpp b/tests/nodes/sdf.cpp index 4bd56da32c..3344e5d1c0 100644 --- a/tests/nodes/sdf.cpp +++ b/tests/nodes/sdf.cpp @@ -37,7 +37,7 @@ TEST(SDFNodeTest, Water) Data3D referenceData; EXPECT_TRUE(ImportDLPUtilsPDensNode::read(referenceData, "dlpoly/water267-analysis/water-267-298K.11.pdens")); - EXPECT_TRUE(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) @@ -68,6 +68,6 @@ TEST(SDFNodeTest, Benzene) Data3D referenceData; EXPECT_TRUE(ImportDLPUtilsPDensNode::read(referenceData, "dlpoly/benzene181/benzene181.11.pdens")); - EXPECT_TRUE(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 88de665efb..29714798cc 100644 --- a/tests/nodes/siteRDF.cpp +++ b/tests/nodes/siteRDF.cpp @@ -81,21 +81,21 @@ TEST_F(SiteRDFNodeTest, Water) // O-O RDF EXPECT_TRUE( - checkData1D(oORDF->dataRDF(), "RDF(OW-OW)//RDF", "dlpoly/water267-analysis/water-267-298K.aardf1_02_02", 1, 2, 9.0e-3)); + 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(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( - checkData1D(comCOMRDF->dataRDF(), "RDF(COM-COM)//RDF", "dlpoly/water267-analysis/water-267-298K.rdf11", 1, 2, 5.0e-4)); + 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(checkSampledDouble("coordination number A", cNA, 4.32359551, 2.0e-3)); - EXPECT_TRUE(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) @@ -117,15 +117,15 @@ TEST_F(SiteRDFNodeTest, WaterNPT) // O-O RDF EXPECT_TRUE( - checkData1D(oORDF->dataRDF(), "RDF(OW-OW)//RDF", "dlpoly/water267-npt/water-267-298K.aardf1_02_02", 1, 2, 2.1e-2)); + 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( - checkData1D(h1H2RDF->dataRDF(), "RDF(H1-H2)//RDF", "dlpoly/water267-npt/water-267-298K.aardf1_01_03", 1, 2, 1.0e-2)); + 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( - checkData1D(comCOMRDF->dataRDF(), "RDF(COM-COM)//RDF", "dlpoly/water267-npt/water-267-298K.rdf11", 1, 2, 4.0e-3)); + testData1D(comCOMRDF->dataRDF(), "RDF(COM-COM)//RDF", "dlpoly/water267-npt/water-267-298K.rdf11", 1, 2, 4.0e-3)); } TEST_F(SiteRDFNodeTest, WaterDynamic) @@ -144,11 +144,11 @@ TEST_F(SiteRDFNodeTest, WaterDynamic) // O-O RDF EXPECT_TRUE( - checkData1D(oORDF->dataRDF(), "RDF(OW-OW)//RDF", "dlpoly/water267-analysis/water-267-298K.aardf1_02_02", 1, 2, 9.0e-3)); + 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( - checkData1D(hHRDF->dataRDF(), "RDF(H-H)//RDF", "dlpoly/water267-analysis/water-267-298K.aardf1_HHsum", 1, 2, 3.0e-3)); + testData1D(hHRDF->dataRDF(), "RDF(H-H)//RDF", "dlpoly/water267-analysis/water-267-298K.aardf1_HHsum", 1, 2, 3.0e-3)); } TEST_F(SiteRDFNodeTest, WaterFragments) @@ -172,21 +172,21 @@ TEST_F(SiteRDFNodeTest, WaterFragments) // O-O RDF EXPECT_TRUE( - checkData1D(oORDF->dataRDF(), "RDF(OW-OW)//RDF", "dlpoly/water267-analysis/water-267-298K.aardf1_02_02", 1, 2, 1.0e-2)); + 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( - checkData1D(hHRDF->dataRDF(), "RDF(H-H)//RDF", "dlpoly/water267-analysis/water-267-298K.aardf1_01_03", 1, 2, 1.0e-2)); + 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( - checkData1D(comCOMRDF->dataRDF(), "RDF(COM-COM)//RDF", "dlpoly/water267-analysis/water-267-298K.rdf11", 1, 2, 5.0e-4)); + 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(checkSampledDouble("coordination number A", cNA, 4.32359551, 2.0e-3)); - EXPECT_TRUE(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 92087c2b28..75f829abf9 100644 --- a/tests/nodes/sq.cpp +++ b/tests/nodes/sq.cpp @@ -31,22 +31,22 @@ TEST(SQNodeTest, Water) ASSERT_TRUE(unweightedSQ); // Partial S(Q) (unbound terms) - EXPECT_TRUE(checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("OW", "OW")), "OW-OW Unbound Partial", - "epsr25/water1000-neutron/water.EPSR.f01", 1, 2, 1.0e-3)); - EXPECT_TRUE(checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("OW", "HW")), "OW-HW Unbound Partial", - "epsr25/water1000-neutron/water.EPSR.f01", 1, 4, 3.0e-3)); - EXPECT_TRUE(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(checkData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("OW", "HW")), "OW-HW Bound Partial", - "epsr25/water1000-neutron/water.EPSR.s01", 1, 4, 1.0e-4)); - EXPECT_TRUE(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(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) @@ -82,94 +82,94 @@ TEST(SQNodeTest, WaterMethanol) */ // Partial g(r) (unbound terms - EXPECT_TRUE(checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("OW", "OW")), "OW-OW Unbound Partial", - "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 2, 4.0e-2)); - EXPECT_TRUE(checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("OW", "HW")), "OW-HW Unbound Partial", - "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 4, 5.0e-2)); - EXPECT_TRUE(checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("OW", "CT")), "OW-CT Unbound Partial", - "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 6)); - EXPECT_TRUE(checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("OW", "HC")), "OW-HC Unbound Partial", - "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 8)); - EXPECT_TRUE(checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("OW", "OH")), "OW-OH Unbound Partial", - "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 10)); - EXPECT_TRUE(checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("OW", "HO")), "OW-HO Unbound Partial", - "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 12)); - EXPECT_TRUE(checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("HW", "HW")), "HW-HW Unbound Partial", - "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 14, 5.0e-2)); - EXPECT_TRUE(checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("HW", "CT")), "HW-CT Unbound Partial", - "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 16)); - EXPECT_TRUE(checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("HW", "HC")), "HW-HC Unbound Partial", - "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 18)); - EXPECT_TRUE(checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("HW", "OH")), "HW-OH Unbound Partial", - "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 20)); - EXPECT_TRUE(checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("HW", "HO")), "HW-HO Unbound Partial", - "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 22)); - EXPECT_TRUE(checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("CT", "CT")), "CT-CT Unbound Partial", - "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 24, 8.0e-3)); - EXPECT_TRUE(checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("CT", "HC")), "CT-HC Unbound Partial", - "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 26)); - EXPECT_TRUE(checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("CT", "OH")), "CT-OH Unbound Partial", - "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 28)); - EXPECT_TRUE(checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("CT", "HO")), "CT-HO Unbound Partial", - "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 30)); - EXPECT_TRUE(checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("HC", "HC")), "HC-HC Unbound Partial", - "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 32)); - EXPECT_TRUE(checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("HC", "OH")), "HC-OH Unbound Partial", - "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 34)); - EXPECT_TRUE(checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("HC", "HO")), "HC-HO Unbound Partial", - "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 36)); - EXPECT_TRUE(checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("OH", "OH")), "OH-OH Unbound Partial", - "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 38)); - EXPECT_TRUE(checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("OH", "HO")), "OH-HO Unbound Partial", - "epsr25/water300methanol600/watermeth.EPSR.f01", 1, 40)); - EXPECT_TRUE(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(checkData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("OW", "HW")), "OW-HW Bound Partial", - "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 4)); - EXPECT_TRUE(checkData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("HW", "HW")), "HW-HW Bound Partial", - "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 14)); - EXPECT_TRUE(checkData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("CT", "HC")), "CT-HC Bound Partial", - "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 26)); - EXPECT_TRUE(checkData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("CT", "OH")), "CT-OH Bound Partial", - "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 28)); - EXPECT_TRUE(checkData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("CT", "HO")), "CT-HO Bound Partial", - "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 30)); - EXPECT_TRUE(checkData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("HC", "HC")), "HC-HC Bound Partial", - "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 32)); - EXPECT_TRUE(checkData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("HC", "OH")), "HC-OH Bound Partial", - "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 34)); - EXPECT_TRUE(checkData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("HC", "HO")), "HC-HO Bound Partial", - "epsr25/water300methanol600/watermeth.EPSR.s01", 1, 36)); - EXPECT_TRUE(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(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(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(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(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(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(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(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(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(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(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(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(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) @@ -196,20 +196,20 @@ TEST(SQNodeTest, Benzene) auto unweightedSQ = sqNode->getOutputValue("UnweightedSQ"); // Partial S(Q) (unbound terms) - EXPECT_TRUE(checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("CA", "CA")), "CA-CA Unbound Partial", - "epsr25/benzene200-neutron/benzene.EPSR.f01", 1, 2, 7.0e-3)); - EXPECT_TRUE(checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("CA", "HA")), "CA-HA Unbound Partial", - "epsr25/benzene200-neutron/benzene.EPSR.f01", 1, 4, 5.0e-3)); - EXPECT_TRUE(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(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(checkData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("CA", "HA")), "CA-HA Bound Partial", - "epsr25/benzene200-neutron/benzene.EPSR.s01", 1, 4, 5.0e-3)); - EXPECT_TRUE(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/xRaySQ.cpp b/tests/nodes/xRaySQ.cpp index fcb6ce8938..3385fcb217 100644 --- a/tests/nodes/xRaySQ.cpp +++ b/tests/nodes/xRaySQ.cpp @@ -35,12 +35,12 @@ TEST(XRaySQNodeTest, WaterReferenceFT) ASSERT_EQ(H2Ox->versionIndex(), 0); // Total F(Q) - EXPECT_TRUE(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(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 1409d13783..bad982d6d1 100644 --- a/tests/pairPotentials/cutoffs.cpp +++ b/tests/pairPotentials/cutoffs.cpp @@ -43,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}); } } @@ -77,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/testing.cpp b/tests/testing.cpp index 272ea0742a..40a3e93965 100644 --- a/tests/testing.cpp +++ b/tests/testing.cpp @@ -15,7 +15,7 @@ namespace UnitTest */ // Test simple double -[[nodiscard]] bool checkDouble(std::string_view quantity, double A, double B, double threshold) +[[nodiscard]] bool testDouble(std::string_view quantity, double A, double B, double threshold) { auto delta = fabs(A - B); auto isOK = delta <= threshold; @@ -24,13 +24,13 @@ namespace UnitTest return isOK; } // Test sampled double -[[nodiscard]] bool checkSampledDouble(std::string_view quantity, SampledDouble A, double B, double threshold) +[[nodiscard]] bool testSampledDouble(std::string_view quantity, SampledDouble A, double B, double threshold) { - return checkDouble(quantity, A.value(), B, threshold); + return testDouble(quantity, A.value(), B, threshold); } // Test Data1D -[[nodiscard]] bool checkData1D(const Data1D &dataA, std::string_view nameA, const Data1D &dataB, std::string_view nameB, - double tolerance, Error::ErrorType errorType) +[[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; @@ -39,8 +39,8 @@ namespace UnitTest notOK ? "NOT OK" : "OK", tolerance); return !notOK; } -[[nodiscard]] bool checkData1D(const Data1D &dataA, std::string_view nameA, std::string filePath, int xColumn, int yColumn, - double tolerance, Error::ErrorType errorType) +[[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)) @@ -49,11 +49,11 @@ namespace UnitTest return false; } - return checkData1D(dataA, nameA, dataB, filePath, tolerance, errorType); + return testData1D(dataA, nameA, dataB, filePath, tolerance, errorType); } // Test Data2D -[[nodiscard]] bool checkData2D(const Data2D &dataA, std::string_view nameA, const Data2D &dataB, std::string_view nameB, - double tolerance, Error::ErrorType errorType) +[[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; @@ -64,8 +64,8 @@ namespace UnitTest return !notOK; } // Test Data3D -[[nodiscard]] bool checkData3D(const Data3D &dataA, std::string_view nameA, const Data3D &dataB, std::string_view nameB, - double tolerance, Error::ErrorType errorType) +[[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; @@ -76,21 +76,21 @@ namespace UnitTest return !notOK; } // Test Vec3 data -void checkVec3(const Vector3 &A, const Vector3 &B, double tolerance) +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 checkVec3Vector(const std::vector &A, const std::vector &B, double tolerance) +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) - checkVec3(A[n], B[n], tolerance); + testVec3(A[n], B[n], tolerance); } // Test species atom type -void checkSpeciesAtomType(Species *sp, const std::map &namesById) +void testSpeciesAtomType(Species *sp, const std::map &namesById) { for (auto &[atomIndex, atomTypeName] : namesById) { @@ -113,8 +113,8 @@ void checkIntramolecularTerms(const std::string &termInfo, const InteractionPote EXPECT_NEAR(current, expected, tolerance); } // Test species bond term -void checkSpeciesIntramolecular(Species *sp, std::vector atoms, const InteractionPotential &expectedParams, - double tolerance) +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]]); @@ -124,8 +124,8 @@ void checkSpeciesIntramolecular(Species *sp, std::vector atoms, const Inter tolerance); } // Test species angle term -void checkSpeciesIntramolecular(Species *sp, std::vector atoms, const InteractionPotential &expectedParams, - double tolerance) +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]]); @@ -135,8 +135,8 @@ void checkSpeciesIntramolecular(Species *sp, std::vector atoms, const Inter tolerance); } // Test species torsion / improper term -void checkSpeciesIntramolecular(Species *sp, std::vector atoms, - const InteractionPotential &expectedParams, double tolerance) +void testSpeciesIntramolecular(Species *sp, std::vector atoms, + const InteractionPotential &expectedParams, double tolerance) { ASSERT_TRUE(atoms.size() == 4); const auto &t = @@ -154,8 +154,8 @@ void checkSpeciesIntramolecular(Species *sp, std::vector atoms, i->get().interactionPotential(), tolerance); } // Test consistency between the two supplied double-keyed Data1D maps -bool checkDoubleKeyedMap(std::string_view mapContents, const DoubleKeyedMap &mapA, const DoubleKeyedMap &mapB, - double testThreshold) +bool testDoubleKeyedMap(std::string_view mapContents, const DoubleKeyedMap &mapA, const DoubleKeyedMap &mapB, + double testThreshold) { // Check map sizes if (mapA.size() != mapB.size()) @@ -191,18 +191,18 @@ bool checkDoubleKeyedMap(std::string_view mapContents, const DoubleKeyedMap &kernel, double testThreshold) +Kernel::EnergyResult testEnergyConsistency(const std::unique_ptr &kernel, double testThreshold) { // Calculate production energies (fully optimised) auto productionEnergy = kernel->totalEnergy(); @@ -248,9 +248,9 @@ Kernel::EnergyResult checkEnergyConsistency(const std::unique_ptr } // Check consistency between production and test forces -void checkForceConsistency(const std::unique_ptr &kernel, std::vector &ppForces, - std::vector &geomForces, Flags flags, double ppMaxDeviation, - double geomMaxDeviation) +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); @@ -280,8 +280,8 @@ void checkForceConsistency(const std::unique_ptr &kernel, std::vect } // Check consistency of supplied forces -void checkReferenceForceConsistency(const std::vector &ppForces, const std::vector &geomForces, - const std::vector &referenceForces, double maxDeviation) +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()); diff --git a/tests/testing.h b/tests/testing.h index ece2b96f36..3d04d7aaec 100644 --- a/tests/testing.h +++ b/tests/testing.h @@ -36,53 +36,53 @@ void exportMermaidGraph(Graph &graph); */ // Test simple double -[[nodiscard]] bool checkDouble(std::string_view quantity, double A, double B, double threshold); +[[nodiscard]] bool testDouble(std::string_view quantity, double A, double B, double threshold); // Test sampled double -[[nodiscard]] bool checkSampledDouble(std::string_view quantity, SampledDouble A, double B, double threshold); +[[nodiscard]] bool testSampledDouble(std::string_view quantity, SampledDouble A, double B, double threshold); // Test Data1D -[[nodiscard]] 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); -[[nodiscard]] 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); +[[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 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); +[[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 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); +[[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 checkVec3(const Vector3 &A, const Vector3 &B, double tolerance = 1.0e-6); +void testVec3(const Vector3 &A, const Vector3 &B, double tolerance = 1.0e-6); // Test Vec3 vector data -void checkVec3Vector(const std::vector &A, const std::vector &B, double tolerance = 1.0e-6); +void testVec3Vector(const std::vector &A, const std::vector &B, double tolerance = 1.0e-6); // Test species atom type -void checkSpeciesAtomType(Species *sp, const std::map &namesById); +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 checkSpeciesIntramolecular(Species *sp, std::vector atoms, const InteractionPotential &expectedParams, - double tolerance = 1.0e-6); +void testSpeciesIntramolecular(Species *sp, std::vector atoms, const InteractionPotential &expectedParams, + double tolerance = 1.0e-6); // Test species angle term -void checkSpeciesIntramolecular(Species *sp, std::vector atoms, const InteractionPotential &expectedParams, - double tolerance = 1.0e-6); +void testSpeciesIntramolecular(Species *sp, std::vector atoms, const InteractionPotential &expectedParams, + double tolerance = 1.0e-6); // Test species torsion / improper term -void checkSpeciesIntramolecular(Species *sp, std::vector atoms, - const InteractionPotential &expectedParams, double tolerance = 1.0e-6); +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 checkDoubleKeyedMap(std::string_view mapContents, const DoubleKeyedMap &mapA, - const DoubleKeyedMap &mapB, double testThreshold); +static bool testDoubleKeyedMap(std::string_view mapContents, const DoubleKeyedMap &mapA, + const DoubleKeyedMap &mapB, double testThreshold); // Test consistency, and error, between supplied partial sets -bool checkPartialSet(const PartialSet &setA, const PartialSet &setB, double testThreshold); +bool testPartialSet(const PartialSet &setA, const PartialSet &setB, double testThreshold); // Check consistency between production, molecular, and test energies, returning production values -Kernel::EnergyResult checkEnergyConsistency(const std::unique_ptr &kernel, double testThreshold = 1.0e-6); +Kernel::EnergyResult testEnergyConsistency(const std::unique_ptr &kernel, double testThreshold = 1.0e-6); // 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); +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 checkReferenceForceConsistency(const std::vector &ppForces, const std::vector &geomForces, - const std::vector &referenceForces, double maxDeviation = 1.0e-3); +void testReferenceForceConsistency(const std::vector &ppForces, const std::vector &geomForces, + const std::vector &referenceForces, double maxDeviation = 1.0e-3); /* * TOML diff --git a/tests/workflows/phantomAtoms.cpp b/tests/workflows/phantomAtoms.cpp index 54aeadcfb4..f8043cfe6d 100644 --- a/tests/workflows/phantomAtoms.cpp +++ b/tests/workflows/phantomAtoms.cpp @@ -95,54 +95,54 @@ TEST(PhantomAtomsTest, Water) auto rawGR = grNode->getOutputValue("RawGR"); // Partial g(r) (unbound terms) - EXPECT_TRUE(checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("OW", "OW")), "OW-OW Unbound Partial", - "epsr25/water1000-neutron/water.EPSR.g01", 1, 2, 6.0e-2)); - EXPECT_TRUE(checkData1D(rawGR->unboundPartials().get(DoubleKeyedMapKey("HW", "OW")), "HW-OW Unbound Partial", - "epsr25/water1000-neutron/water.EPSR.g01", 1, 4, 2.0e-2)); - EXPECT_TRUE(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(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(checkData1D(rawGR->boundPartials().get(DoubleKeyedMapKey("HW", "OW")), "HW-OW Bound Partial", - "epsr25/water1000-neutron/water.EPSR.y01", 1, 4, 0.1)); - EXPECT_TRUE(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(checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("OW", "OW")), "OW-OW Unbound Partial", - "epsr25/water1000-neutron/water.EPSR.f01", 1, 2, 1.0e-3)); - EXPECT_TRUE(checkData1D(unweightedSQ->unboundPartials().get(DoubleKeyedMapKey("OW", "HW")), "OW-HW Unbound Partial", - "epsr25/water1000-neutron/water.EPSR.f01", 1, 4, 3.0e-3)); - EXPECT_TRUE(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(checkData1D(unweightedSQ->boundPartials().get(DoubleKeyedMapKey("OW", "HW")), "OW-HW Bound Partial", - "epsr25/water1000-neutron/water.EPSR.s01", 1, 4, 1.0e-4)); - EXPECT_TRUE(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(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(checkData1D(D2O->getOutputValue("WeightedSQ")->total(), "D2O F(Q)", - "epsr25/water1000-neutron/water.EPSR.u01", 1, 2, 3.0e-4)); - EXPECT_TRUE(checkData1D(H2O->getOutputValue("WeightedSQ")->total(), "H2O F(Q)", - "epsr25/water1000-neutron/water.EPSR.u01", 1, 4, 6.0e-4)); - EXPECT_TRUE(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(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 From 254f7d5d19dec729d6c7c6a6dbdf5ca1eca07037 Mon Sep 17 00:00:00 2001 From: Tristan Youngs Date: Fri, 26 Jun 2026 15:25:05 +0100 Subject: [PATCH 7/7] Revert to simple arg passing. --- tests/testGraph.cpp | 16 ++++++++-------- tests/testGraph.h | 14 ++------------ 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/tests/testGraph.cpp b/tests/testGraph.cpp index 4bddb1dade..57f0d3a5ca 100644 --- a/tests/testGraph.cpp +++ b/tests/testGraph.cpp @@ -240,7 +240,7 @@ std::pair TestGraph::appendGRSQ(bool noAveraging, bool noInt // Create a NeutronSQ node with optional reference data NeutronSQNode *TestGraph::appendNeutronSQ(SQNode *sqNode, std::string name, const std::vector> isotopologues, - TestGraph::Data1DImportFileFormat referenceData) + std::string referenceData, bool isHistogram) { // Construct the isotopologue set IsotopologueSet isotopologueSet; @@ -271,31 +271,31 @@ NeutronSQNode *TestGraph::appendNeutronSQ(SQNode *sqNode, std::string name, EXPECT_TRUE(currentGraph_->addEdge({std::string(sqNode->name()), "UnweightedSQ", name, "UnweightedSQ"})); // Set reference F(Q) data - if (!referenceData.filename.empty()) + if (!referenceData.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(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, TestGraph::Data1DImportFileFormat referenceData) +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.filename.empty()) + if (!referenceData.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(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(); diff --git a/tests/testGraph.h b/tests/testGraph.h index b7ae0b22f6..7c14f9ac3a 100644 --- a/tests/testGraph.h +++ b/tests/testGraph.h @@ -30,16 +30,6 @@ class TestGraph : public DissolveGraph } ~TestGraph() { exportMermaidGraph(*this); } - 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}; @@ -91,9 +81,9 @@ class TestGraph : public DissolveGraph // Create a NeutronSQ node with optional reference data NeutronSQNode *appendNeutronSQ(SQNode *sqNode, std::string name, const std::vector> isotopologues = {}, - TestGraph::Data1DImportFileFormat referenceData = TestGraph::Data1DImportFileFormat{}); + std::string referenceData = {}, bool isHistogram = false); // Create an XRaySQ node with optional reference data XRaySQNode *appendXRaySQ(SQNode *sqNode, std::string name, - TestGraph::Data1DImportFileFormat referenceData = TestGraph::Data1DImportFileFormat{}); + std::string referenceData = {}, bool isHistogram = false); }; }; // namespace UnitTest