diff --git a/src/gui/icons/modules/Analyse.svg b/src/gui/icons/modules/Analyse.svg deleted file mode 100644 index cc52b1aa9e..0000000000 --- a/src/gui/icons/modules/Analyse.svg +++ /dev/null @@ -1,125 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/gui/icons/nodes/calculateAngle.svg b/src/gui/icons/nodes/calculateAngle.svg deleted file mode 100644 index 3aae9beffc..0000000000 --- a/src/gui/icons/nodes/calculateAngle.svg +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - image/svg+xml - - - - - - - - diff --git a/src/gui/icons/nodes/calculateAxisAngle.svg b/src/gui/icons/nodes/calculateAxisAngle.svg deleted file mode 100644 index 3cd54cff0f..0000000000 --- a/src/gui/icons/nodes/calculateAxisAngle.svg +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - diff --git a/src/gui/icons/nodes/calculateDistance.svg b/src/gui/icons/nodes/calculateDistance.svg deleted file mode 100644 index 7ae7f92b98..0000000000 --- a/src/gui/icons/nodes/calculateDistance.svg +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - - - - - - - image/svg+xml - - - - - - - - diff --git a/src/gui/icons/nodes/calculateExpression.svg b/src/gui/icons/nodes/calculateExpression.svg deleted file mode 100644 index e2f1294d90..0000000000 --- a/src/gui/icons/nodes/calculateExpression.svg +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - - - - - - - image/svg+xml - - - - - - - - - f(x) - - diff --git a/src/gui/icons/nodes/calculateVector.svg b/src/gui/icons/nodes/calculateVector.svg deleted file mode 100644 index a64e59bd95..0000000000 --- a/src/gui/icons/nodes/calculateVector.svg +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - - - - v - - - - - diff --git a/src/gui/icons/nodes/collect1D.svg b/src/gui/icons/nodes/collect1D.svg deleted file mode 100644 index 3764d3ce01..0000000000 --- a/src/gui/icons/nodes/collect1D.svg +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - - - - - - - - image/svg+xml - - - - - - - - diff --git a/src/gui/icons/nodes/collect2D.svg b/src/gui/icons/nodes/collect2D.svg deleted file mode 100644 index 3a82d081d7..0000000000 --- a/src/gui/icons/nodes/collect2D.svg +++ /dev/null @@ -1,250 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/gui/icons/nodes/collect3D.svg b/src/gui/icons/nodes/collect3D.svg deleted file mode 100644 index 05eb4b9163..0000000000 --- a/src/gui/icons/nodes/collect3D.svg +++ /dev/null @@ -1,212 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - diff --git a/src/gui/icons/nodes/fit1D.svg b/src/gui/icons/nodes/fit1D.svg deleted file mode 100644 index d715b89262..0000000000 --- a/src/gui/icons/nodes/fit1D.svg +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - image/svg+xml - - - - - - - - - - diff --git a/src/gui/icons/nodes/integerCollect1D.svg b/src/gui/icons/nodes/integerCollect1D.svg deleted file mode 100644 index 3764d3ce01..0000000000 --- a/src/gui/icons/nodes/integerCollect1D.svg +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - - - - - - - - image/svg+xml - - - - - - - - diff --git a/src/gui/icons/nodes/integrate1D.svg b/src/gui/icons/nodes/integrate1D.svg deleted file mode 100644 index d3f3a7a080..0000000000 --- a/src/gui/icons/nodes/integrate1D.svg +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - diff --git a/src/gui/icons/nodes/operateDivide.svg b/src/gui/icons/nodes/operateDivide.svg deleted file mode 100644 index d4fe487492..0000000000 --- a/src/gui/icons/nodes/operateDivide.svg +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - - - - - - diff --git a/src/gui/icons/nodes/operateExpression.svg b/src/gui/icons/nodes/operateExpression.svg deleted file mode 100644 index e4ae38950d..0000000000 --- a/src/gui/icons/nodes/operateExpression.svg +++ /dev/null @@ -1,83 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - - f(x) - - f(x) - - - diff --git a/src/gui/icons/nodes/operateGridNormalise.svg b/src/gui/icons/nodes/operateGridNormalise.svg deleted file mode 100644 index d715b89262..0000000000 --- a/src/gui/icons/nodes/operateGridNormalise.svg +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - image/svg+xml - - - - - - - - - - diff --git a/src/gui/icons/nodes/operateMultiply.svg b/src/gui/icons/nodes/operateMultiply.svg deleted file mode 100644 index 278affd81f..0000000000 --- a/src/gui/icons/nodes/operateMultiply.svg +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - - diff --git a/src/gui/icons/nodes/operateNormalise.svg b/src/gui/icons/nodes/operateNormalise.svg deleted file mode 100644 index 24689563cc..0000000000 --- a/src/gui/icons/nodes/operateNormalise.svg +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - - N - N - - diff --git a/src/gui/icons/nodes/operateNumberDensityNormalise.svg b/src/gui/icons/nodes/operateNumberDensityNormalise.svg deleted file mode 100644 index 1f4a529843..0000000000 --- a/src/gui/icons/nodes/operateNumberDensityNormalise.svg +++ /dev/null @@ -1,114 +0,0 @@ - - - - - 𝜌 - - 𝜌 - - - - N - N - - - - - - image/svg+xml - - - - - - - - diff --git a/src/gui/icons/nodes/operateSitePopulationNormalise.svg b/src/gui/icons/nodes/operateSitePopulationNormalise.svg deleted file mode 100644 index b9a5f75d9a..0000000000 --- a/src/gui/icons/nodes/operateSitePopulationNormalise.svg +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - N - N - - - - - - image/svg+xml - - - - - - - - diff --git a/src/gui/icons/nodes/operateSphericalShellNormalise.svg b/src/gui/icons/nodes/operateSphericalShellNormalise.svg deleted file mode 100644 index 090e45ea27..0000000000 --- a/src/gui/icons/nodes/operateSphericalShellNormalise.svg +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - - - - - - - - - image/svg+xml - - - - - - - - diff --git a/src/gui/icons/nodes/process1D.svg b/src/gui/icons/nodes/process1D.svg deleted file mode 100644 index 6ca18423ac..0000000000 --- a/src/gui/icons/nodes/process1D.svg +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - diff --git a/src/gui/icons/nodes/process2D.svg b/src/gui/icons/nodes/process2D.svg deleted file mode 100644 index c2c2661cb6..0000000000 --- a/src/gui/icons/nodes/process2D.svg +++ /dev/null @@ -1,260 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - diff --git a/src/gui/icons/nodes/process3D.svg b/src/gui/icons/nodes/process3D.svg deleted file mode 100644 index 0bf491f0bb..0000000000 --- a/src/gui/icons/nodes/process3D.svg +++ /dev/null @@ -1,219 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/gui/icons/nodes/sum1D.svg b/src/gui/icons/nodes/sum1D.svg deleted file mode 100644 index 7aca7dfc6f..0000000000 --- a/src/gui/icons/nodes/sum1D.svg +++ /dev/null @@ -1,107 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - diff --git a/src/gui/main.qrc b/src/gui/main.qrc index 553a86cbf8..5ce912bcd5 100644 --- a/src/gui/main.qrc +++ b/src/gui/main.qrc @@ -6,42 +6,18 @@ icons/nodes/restraintPotential.svg icons/nodes/cylindricalGlobalPotential.svg icons/nodes/box.svg - icons/nodes/calculateAngle.svg - icons/nodes/calculateAxisAngle.svg - icons/nodes/calculateDistance.svg - icons/nodes/calculateExpression.svg - icons/nodes/calculateVector.svg - icons/nodes/collect1D.svg - icons/nodes/integerCollect1D.svg icons/nodes/customRegion.svg - icons/nodes/collect2D.svg - icons/nodes/collect3D.svg icons/nodes/coordinateSets.svg icons/nodes/addPair.svg icons/nodes/cylindricalRegion.svg icons/nodes/copy.svg - icons/nodes/fit1D.svg icons/nodes/generalRegion.svg - icons/nodes/integrate1D.svg - icons/nodes/operateDivide.svg - icons/nodes/operateExpression.svg - icons/nodes/operateGridNormalise.svg - icons/nodes/operateMultiply.svg - icons/nodes/operateNormalise.svg - icons/nodes/operateNumberDensityNormalise.svg - icons/nodes/operateSitePopulationNormalise.svg - icons/nodes/operateSphericalShellNormalise.svg icons/nodes/parameters.svg icons/nodes/pick.svg icons/nodes/pickProximity.svg icons/nodes/pickRegion.svg - icons/nodes/process1D.svg - icons/nodes/process2D.svg - icons/nodes/process3D.svg - icons/nodes/ifValueInRange.svg icons/nodes/remove.svg icons/nodes/select.svg - icons/nodes/sum1D.svg icons/nodes/transmute.svg icons/nodes/temperature.svg icons/nodes/sizeFactor.svg @@ -76,7 +52,6 @@ icons/modules/SiteRDF.svg icons/modules/SDF.svg icons/modules/MolShake.svg - icons/modules/Analyse.svg icons/modules/Forces.svg icons/modules/Benchmark.svg icons/modules/EPSR.svg diff --git a/src/gui/nodeControlWidget.h b/src/gui/nodeControlWidget.h index 134e1a27ce..3e8d269a98 100644 --- a/src/gui/nodeControlWidget.h +++ b/src/gui/nodeControlWidget.h @@ -5,7 +5,6 @@ #include "base/lock.h" #include "gui/ui_nodeControlWidget.h" -#include "procedure/nodes/nodeReference.h" // Forward Declarations class Dissolve; diff --git a/src/keywords/node.h b/src/keywords/node.h index 58d7f7184f..f4f768e7b5 100644 --- a/src/keywords/node.h +++ b/src/keywords/node.h @@ -12,12 +12,8 @@ class NodeKeywordBase : public NodeKeywordUnderlay, public KeywordBase { public: - NodeKeywordBase(ProcedureNode *parentNode, ProcedureNode::NodeType nodeType, bool onlyInScope) - : NodeKeywordUnderlay(parentNode, nodeType, onlyInScope), KeywordBase(typeid(this)) - { - } - NodeKeywordBase(ProcedureNode *parentNode, ProcedureNode::NodeClass nodeClass, bool onlyInScope) - : NodeKeywordUnderlay(parentNode, nodeClass, onlyInScope), KeywordBase(typeid(this)) + NodeKeywordBase(ProcedureNode *parentNode, const ProcedureNode::NodeTypeVector &allowedNodeTypes, bool onlyInScope) + : NodeKeywordUnderlay(parentNode, allowedNodeTypes, onlyInScope), KeywordBase(typeid(this)) { } ~NodeKeywordBase() override = default; @@ -46,12 +42,9 @@ class NodeKeywordBase : public NodeKeywordUnderlay, public KeywordBase template class NodeKeyword : public NodeKeywordBase { public: - NodeKeyword(std::shared_ptr &data, ProcedureNode *parentNode, ProcedureNode::NodeType nodeType, bool onlyInScope) - : NodeKeywordBase(parentNode, nodeType, onlyInScope), data_(data) - { - } - NodeKeyword(std::shared_ptr &data, ProcedureNode *parentNode, ProcedureNode::NodeClass nodeClass, bool onlyInScope) - : NodeKeywordBase(parentNode, nodeClass, onlyInScope), data_(data) + NodeKeyword(std::shared_ptr &data, ProcedureNode *parentNode, + const ProcedureNode::NodeTypeVector &allowedNodeTypes, bool onlyInScope) + : NodeKeywordBase(parentNode, allowedNodeTypes, onlyInScope), data_(data) { } ~NodeKeyword() override = default; diff --git a/src/keywords/nodeAndInteger.h b/src/keywords/nodeAndInteger.h index 130b81d6f6..dccb31c82c 100644 --- a/src/keywords/nodeAndInteger.h +++ b/src/keywords/nodeAndInteger.h @@ -13,12 +13,9 @@ class NodeAndIntegerKeywordBase : public NodeKeywordUnderlay, public KeywordBase { public: - NodeAndIntegerKeywordBase(ProcedureNode *parentNode, ProcedureNode::NodeType nodeType, bool onlyInScope) - : NodeKeywordUnderlay(parentNode, nodeType, onlyInScope), KeywordBase(typeid(this)) - { - } - NodeAndIntegerKeywordBase(ProcedureNode *parentNode, ProcedureNode::NodeClass nodeClass, bool onlyInScope) - : NodeKeywordUnderlay(parentNode, nodeClass, onlyInScope), KeywordBase(typeid(this)) + NodeAndIntegerKeywordBase(ProcedureNode *parentNode, const ProcedureNode::NodeTypeVector &allowedNodeTypes, + bool onlyInScope) + : NodeKeywordUnderlay(parentNode, allowedNodeTypes, onlyInScope), KeywordBase(typeid(this)) { } ~NodeAndIntegerKeywordBase() override = default; @@ -67,13 +64,8 @@ template class NodeAndIntegerKeyword : public NodeAndIntegerKeywordBas { public: NodeAndIntegerKeyword(std::pair, int> &data, ProcedureNode *parentNode, - ProcedureNode::NodeType nodeType, bool onlyInScope) - : NodeAndIntegerKeywordBase(parentNode, nodeType, onlyInScope), data_(data) - { - } - NodeAndIntegerKeyword(std::pair, int> &data, ProcedureNode *parentNode, - ProcedureNode::NodeClass nodeClass, bool onlyInScope) - : NodeAndIntegerKeywordBase(parentNode, nodeClass, onlyInScope), data_(data) + const ProcedureNode::NodeTypeVector &allowedNodeTypes, bool onlyInScope) + : NodeAndIntegerKeywordBase(parentNode, allowedNodeTypes, onlyInScope), data_(data) { } ~NodeAndIntegerKeyword() override = default; diff --git a/src/keywords/nodeUnderlay.cpp b/src/keywords/nodeUnderlay.cpp index 1aa4d12faa..0afb36e9df 100644 --- a/src/keywords/nodeUnderlay.cpp +++ b/src/keywords/nodeUnderlay.cpp @@ -3,14 +3,11 @@ #include "keywords/nodeUnderlay.h" #include "procedure/procedure.h" +#include "templates/algorithms.h" -NodeKeywordUnderlay::NodeKeywordUnderlay(ProcedureNode *parentNode, ProcedureNode::NodeType nodeType, bool onlyInScope) - : parentNode_(parentNode), nodeType_(nodeType), onlyInScope_(onlyInScope) -{ -} - -NodeKeywordUnderlay::NodeKeywordUnderlay(ProcedureNode *parentNode, ProcedureNode::NodeClass nodeClass, bool onlyInScope) - : parentNode_(parentNode), nodeClass_(nodeClass), onlyInScope_(onlyInScope) +NodeKeywordUnderlay::NodeKeywordUnderlay(ProcedureNode *parentNode, const ProcedureNode::NodeTypeVector &allowedNodeTypes, + bool onlyInScope) + : parentNode_(parentNode), allowedNodeTypes_(allowedNodeTypes), onlyInScope_(onlyInScope) { } @@ -21,11 +18,8 @@ NodeKeywordUnderlay::NodeKeywordUnderlay(ProcedureNode *parentNode, ProcedureNod // Parent ProcedureNode NodeRef NodeKeywordUnderlay::parentNode() const { return parentNode_; } -// Return optional target node type to allow -std::optional NodeKeywordUnderlay::nodeType() const { return nodeType_; } - -// Return optional target node class to allow -std::optional NodeKeywordUnderlay::nodeClass() const { return nodeClass_; } +// Return optional target node types to allow +const ProcedureNode::NodeTypeVector &NodeKeywordUnderlay::allowedNodeTypes() const { return allowedNodeTypes_; } // Return whether to accept nodes within scope only bool NodeKeywordUnderlay::onlyInScope() const { return onlyInScope_; } @@ -34,7 +28,7 @@ bool NodeKeywordUnderlay::onlyInScope() const { return onlyInScope_; } std::vector NodeKeywordUnderlay::allowedNodes() const { assert(parentNode_); - return parentNode_->getNodes(onlyInScope_, nodeType_, nodeClass_); + return parentNode_->getNodes(onlyInScope_, allowedNodeTypes_); } // Find the named node, obeying scope @@ -44,25 +38,21 @@ ConstNodeRef NodeKeywordUnderlay::findNode(std::string_view name) const return parentNode_->getNode(name, onlyInScope_); } -// Return whether the node has valid class or type +// Return whether the node has valid type bool NodeKeywordUnderlay::validNode(const ProcedureNode *node, std::string_view keywordName) const { // A null node is valid if (!node) return true; - // Check class (if specified) then type (if specified) - if (nodeClass_ && node->nodeClass() != nodeClass_.value()) - return Messenger::error("Node '{}' is of class {}, but the {} keyword requires a node of class {}.\n", node->name(), - ProcedureNode::nodeClasses().keyword(node->nodeClass()), keywordName, - ProcedureNode::nodeClasses().keyword(nodeClass_.value())); - - if (nodeType_ && node->type() != nodeType_.value()) - return Messenger::error("Node '{}' is of type {}, but the {} keyword requires a node of type {}.\n", node->name(), + if (!allowedNodeTypes_.empty() && + std::find(allowedNodeTypes_.begin(), allowedNodeTypes_.end(), node->type()) == allowedNodeTypes_.end()) + return Messenger::error("Node '{}' is of type {}, but the {} keyword requires: {}.\n", node->name(), ProcedureNode::nodeTypes().keyword(node->type()), keywordName, - ProcedureNode::nodeTypes().keyword(nodeType_.value())); + joinStrings(allowedNodeTypes_, ", ", + [](const auto nodeType) { return ProcedureNode::nodeTypes().keyword(nodeType); })); - if (!parentNode_->getNode(node->name(), onlyInScope_, {}, nodeType_, nodeClass_)) + if (!parentNode_->getNode(node->name(), onlyInScope_, {}, allowedNodeTypes_)) return Messenger::error("Node '{}' does not exist (in scope), so the {} keyword cannot reference it.\n", node->name(), keywordName); diff --git a/src/keywords/nodeUnderlay.h b/src/keywords/nodeUnderlay.h index 76fae919f7..c21db36ec1 100644 --- a/src/keywords/nodeUnderlay.h +++ b/src/keywords/nodeUnderlay.h @@ -9,8 +9,7 @@ class NodeKeywordUnderlay { public: - NodeKeywordUnderlay(ProcedureNode *parentNode, ProcedureNode::NodeType nodeType, bool onlyInScope); - NodeKeywordUnderlay(ProcedureNode *parentNode, ProcedureNode::NodeClass nodeClass, bool onlyInScope); + NodeKeywordUnderlay(ProcedureNode *parentNode, const ProcedureNode::NodeTypeVector &allowedNodeTypes, bool onlyInScope); virtual ~NodeKeywordUnderlay() = default; /* @@ -19,27 +18,23 @@ class NodeKeywordUnderlay protected: // Parent ProcedureNode NodeRef parentNode_; - // Optional target node type to allow - std::optional nodeType_; - // Optional target node class to allow - std::optional nodeClass_; + // Optional target node types to allow + ProcedureNode::NodeTypeVector allowedNodeTypes_; // Whether to accept nodes within scope only bool onlyInScope_; public: // Return parent ProcedureNode NodeRef parentNode() const; - // Return optional target node type to allow - std::optional nodeType() const; - // Return optional target node class to allow - std::optional nodeClass() const; + // Return optional target nodes type to allow + const ProcedureNode::NodeTypeVector &allowedNodeTypes() const; // Return whether to accept nodes within scope only bool onlyInScope() const; // Return vector of possible nodes allowed based on class and type definitions std::vector allowedNodes() const; // Find the named node, obeying scope ConstNodeRef findNode(std::string_view name) const; - // Return whether the supplied node has valid class or type + // Return whether the supplied node has valid type bool validNode(const ProcedureNode *node, std::string_view keywordName) const; // Validate current data, returning false if invalid data had to be pruned virtual bool validate() = 0; diff --git a/src/keywords/nodeVector.h b/src/keywords/nodeVector.h index 22daa438c3..5a86c1cfa4 100644 --- a/src/keywords/nodeVector.h +++ b/src/keywords/nodeVector.h @@ -13,12 +13,8 @@ class NodeVectorKeywordBase : public NodeKeywordUnderlay, public KeywordBase { public: - NodeVectorKeywordBase(ProcedureNode *parentNode, ProcedureNode::NodeType nodeType, bool onlyInScope) - : NodeKeywordUnderlay(parentNode, nodeType, onlyInScope), KeywordBase(typeid(this)) - { - } - NodeVectorKeywordBase(ProcedureNode *parentNode, ProcedureNode::NodeClass nodeClass, bool onlyInScope) - : NodeKeywordUnderlay(parentNode, nodeClass, onlyInScope), KeywordBase(typeid(this)) + NodeVectorKeywordBase(ProcedureNode *parentNode, const ProcedureNode::NodeTypeVector &allowedNodeTypes, bool onlyInScope) + : NodeKeywordUnderlay(parentNode, allowedNodeTypes, onlyInScope), KeywordBase(typeid(this)) { } ~NodeVectorKeywordBase() override = default; @@ -52,12 +48,9 @@ class NodeVectorKeywordBase : public NodeKeywordUnderlay, public KeywordBase template class NodeVectorKeyword : public NodeVectorKeywordBase { public: - NodeVectorKeyword(ConstNodeVector &data, ProcedureNode *parentNode, ProcedureNode::NodeType nodeType, bool onlyInScope) - : NodeVectorKeywordBase(parentNode, nodeType, onlyInScope), data_(data) - { - } - NodeVectorKeyword(ConstNodeVector &data, ProcedureNode *parentNode, ProcedureNode::NodeClass nodeClass, bool onlyInScope) - : NodeVectorKeywordBase(parentNode, nodeType, onlyInScope), data_(data) + NodeVectorKeyword(ConstNodeVector &data, ProcedureNode *parentNode, + const ProcedureNode::NodeTypeVector &allowedNodeTypes, bool onlyInScope) + : NodeVectorKeywordBase(parentNode, allowedNodeTypes, onlyInScope), data_(data) { } ~NodeVectorKeyword() override = default; @@ -193,12 +186,5 @@ template class NodeVectorKeyword : public NodeVectorKeywordBase */ protected: // Prune any references to the supplied ProcedureNode in the contained data - void removeReferencesTo(NodeRef node) override - { - // Check the node type - if (node->type() != nodeType()) - return; - - data_.erase(std::remove(data_.begin(), data_.end(), node), data_.end()); - } + void removeReferencesTo(NodeRef node) override { data_.erase(std::remove(data_.begin(), data_.end(), node), data_.end()); } }; diff --git a/src/keywords/store.cpp b/src/keywords/store.cpp index 9a664c2810..4a3c316a84 100644 --- a/src/keywords/store.cpp +++ b/src/keywords/store.cpp @@ -21,7 +21,6 @@ #include "keywords/vec3Double.h" #include "keywords/vec3Integer.h" #include "keywords/vec3NodeValue.h" -#include "procedure/nodes/collect1D.h" #include "procedure/nodes/regionBase.h" #include "procedure/nodes/select.h" @@ -186,19 +185,11 @@ bool KeywordStore::set(std::string_view name, const int value) { return getKeyword(name, find(name))->setData(value); } -bool KeywordStore::set(std::string_view name, const std::shared_ptr value) -{ - return getKeyword>(name, find(name))->setData(value); -} bool KeywordStore::set(std::string_view name, const std::vector value) { getKeyword(name, find(name))->data() = value; return true; } -bool KeywordStore::set(std::string_view name, const std::vector> value) -{ - return getKeyword>(name, find(name))->setData(value); -} bool KeywordStore::set(std::string_view name, const std::shared_ptr value) { return getKeyword>(name, find(name))->setData(value); diff --git a/src/keywords/store.h b/src/keywords/store.h index f185b35211..689267449d 100644 --- a/src/keywords/store.h +++ b/src/keywords/store.h @@ -15,7 +15,6 @@ #include class SelectProcedureNode; -class Collect1DProcedureNode; class RegionProcedureNodeBase; class SQModule; class RDFModule; @@ -174,9 +173,7 @@ class KeywordStore bool set(std::string_view name, const Vec3 value); bool set(std::string_view name, const Vec3 value); bool set(std::string_view name, const Range value); - bool set(std::string_view name, const std::shared_ptr value); bool set(std::string_view name, const std::vector value); - bool set(std::string_view name, const std::vector> value); bool set(std::string_view name, const std::shared_ptr value); bool set(std::string_view name, const std::shared_ptr value); bool set(std::string_view name, const ConstNodeVector value); diff --git a/src/module/module.cpp b/src/module/module.cpp index e00db51689..51256a455f 100644 --- a/src/module/module.cpp +++ b/src/module/module.cpp @@ -15,7 +15,6 @@ namespace ModuleTypes { // ENumerated Options for ModuleTypes EnumOptions moduleTypes_("ModuleType", {{ModuleTypes::Accumulate, "Accumulate"}, - {ModuleTypes::Analyse, "Analyse"}, {ModuleTypes::Angle, "Angle"}, {ModuleTypes::AtomShake, "AtomShake"}, {ModuleTypes::AvgMol, "AvgMol"}, diff --git a/src/module/types.h b/src/module/types.h index 7d2d550512..5dfed308b0 100644 --- a/src/module/types.h +++ b/src/module/types.h @@ -9,7 +9,6 @@ namespace ModuleTypes enum ModuleType { Accumulate, - Analyse, Angle, AtomShake, AvgMol, diff --git a/src/modules/analyse/CMakeLists.txt b/src/modules/analyse/CMakeLists.txt deleted file mode 100644 index 4cb90b46c1..0000000000 --- a/src/modules/analyse/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -dissolve_add_module(analyse.h analyse) diff --git a/src/modules/analyse/analyse.cpp b/src/modules/analyse/analyse.cpp deleted file mode 100644 index 2f409773a3..0000000000 --- a/src/modules/analyse/analyse.cpp +++ /dev/null @@ -1,17 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#include "modules/analyse/analyse.h" -#include "keywords/configuration.h" -#include "keywords/procedure.h" - -AnalyseModule::AnalyseModule() : Module(ModuleTypes::Analyse), analyser_(ProcedureNode::AnalysisContext, "Analyser") -{ - keywords_.addTarget("Configuration", "Set target configuration for the module", targetConfiguration_) - ->setEditSignals({KeywordBase::ClearModuleData, KeywordBase::RecreateRenderables}); - - keywords_.addHidden("Analyser", "Analysis procedure to run", analyser_); -} - -// Return the analyser -Procedure &AnalyseModule::analyser() { return analyser_; } diff --git a/src/modules/analyse/analyse.h b/src/modules/analyse/analyse.h deleted file mode 100644 index 8e7ebcf8aa..0000000000 --- a/src/modules/analyse/analyse.h +++ /dev/null @@ -1,35 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#pragma once - -#include "module/module.h" -#include "procedure/procedure.h" - -// Analyse Module -class AnalyseModule : public Module -{ - public: - AnalyseModule(); - ~AnalyseModule() override = default; - - /* - * Definition - */ - private: - // Target configuration - Configuration *targetConfiguration_{nullptr}; - // Analysis procedure to be run - Procedure analyser_; - - public: - // Return the analyser - Procedure &analyser(); - - /* - * Processing - */ - private: - // Run main processing - Module::ExecutionResult process(ModuleContext &moduleContext) override; -}; diff --git a/src/modules/analyse/gui/CMakeLists.txt b/src/modules/analyse/gui/CMakeLists.txt deleted file mode 100644 index d521c6d819..0000000000 --- a/src/modules/analyse/gui/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -dissolve_add_module_gui(analyse) diff --git a/src/modules/analyse/gui/analyseWidget.h b/src/modules/analyse/gui/analyseWidget.h deleted file mode 100644 index a58372a81a..0000000000 --- a/src/modules/analyse/gui/analyseWidget.h +++ /dev/null @@ -1,33 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#pragma once - -#include "modules/analyse/gui/ui_analyseWidget.h" -#include "modules/widget.h" - -// Forward Declarations -class AnalyseModule; -class Dissolve; - -// Module Widget -class AnalyseModuleWidget : public ModuleWidget -{ - // All Qt declarations derived from QObject must include this macro - Q_OBJECT - - public: - AnalyseModuleWidget(QWidget *parent, AnalyseModule *module, Dissolve &dissolve); - ~AnalyseModuleWidget() override = default; - - private: - // Associated Module - AnalyseModule *module_; - - /* - * UI - */ - private: - // Main form declaration - Ui::AnalyseModuleWidget ui_; -}; diff --git a/src/modules/analyse/gui/analyseWidget.ui b/src/modules/analyse/gui/analyseWidget.ui deleted file mode 100644 index b376976aeb..0000000000 --- a/src/modules/analyse/gui/analyseWidget.ui +++ /dev/null @@ -1,47 +0,0 @@ - - - AnalyseModuleWidget - - - - 0 - 0 - 473 - 395 - - - - - 0 - 0 - - - - - 8 - - - - AnalyseModule Controls - - - - 4 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - diff --git a/src/modules/analyse/gui/analyseWidgetFuncs.cpp b/src/modules/analyse/gui/analyseWidgetFuncs.cpp deleted file mode 100644 index 864edb7540..0000000000 --- a/src/modules/analyse/gui/analyseWidgetFuncs.cpp +++ /dev/null @@ -1,15 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#include "main/dissolve.h" -#include "modules/analyse/analyse.h" -#include "modules/analyse/gui/analyseWidget.h" - -AnalyseModuleWidget::AnalyseModuleWidget(QWidget *parent, AnalyseModule *module, Dissolve &dissolve) - : ModuleWidget(parent, dissolve), module_(module) -{ - // Set up user interface - ui_.setupUi(this); - - refreshing_ = false; -} diff --git a/src/modules/analyse/process.cpp b/src/modules/analyse/process.cpp deleted file mode 100644 index 31b43189fd..0000000000 --- a/src/modules/analyse/process.cpp +++ /dev/null @@ -1,20 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#include "base/sysFunc.h" -#include "main/dissolve.h" -#include "module/context.h" -#include "modules/analyse/analyse.h" - -// Run main processing -Module::ExecutionResult AnalyseModule::process(ModuleContext &moduleContext) -{ - // Execute the analysis - if (!analyser_.execute({moduleContext.dissolve(), targetConfiguration_, name()})) - { - Messenger::error("Analysis ExecutionResult::Failed.\n"); - return ExecutionResult::Failed; - } - - return ExecutionResult::Success; -} diff --git a/src/modules/modifierOSites/modifierOSites.cpp b/src/modules/modifierOSites/modifierOSites.cpp index 5d724068ec..6405c730ed 100644 --- a/src/modules/modifierOSites/modifierOSites.cpp +++ b/src/modules/modifierOSites/modifierOSites.cpp @@ -8,12 +8,6 @@ #include "keywords/range.h" #include "keywords/speciesSiteVector.h" #include "keywords/vec3Double.h" -#include "procedure/nodes/calculateExpression.h" -#include "procedure/nodes/ifValueInRange.h" -#include "procedure/nodes/integerCollect1D.h" -#include "procedure/nodes/iterateData1D.h" -#include "procedure/nodes/operateNormalise.h" -#include "procedure/nodes/process1D.h" #include "procedure/nodes/select.h" ModifierOSitesModule::ModifierOSitesModule() : Module(ModuleTypes::ModifierOSites) diff --git a/src/modules/qSpecies/qSpecies.cpp b/src/modules/qSpecies/qSpecies.cpp index 34f469c343..30f134dbda 100644 --- a/src/modules/qSpecies/qSpecies.cpp +++ b/src/modules/qSpecies/qSpecies.cpp @@ -8,12 +8,6 @@ #include "keywords/range.h" #include "keywords/speciesSiteVector.h" #include "keywords/vec3Double.h" -#include "procedure/nodes/calculateExpression.h" -#include "procedure/nodes/ifValueInRange.h" -#include "procedure/nodes/integerCollect1D.h" -#include "procedure/nodes/iterateData1D.h" -#include "procedure/nodes/operateNormalise.h" -#include "procedure/nodes/process1D.h" #include "procedure/nodes/select.h" QSpeciesModule::QSpeciesModule() : Module(ModuleTypes::QSpecies) diff --git a/src/modules/registry.cpp b/src/modules/registry.cpp index f4b613530b..4e1dc0faf5 100644 --- a/src/modules/registry.cpp +++ b/src/modules/registry.cpp @@ -3,7 +3,6 @@ #include "modules/registry.h" #include "modules/accumulate/accumulate.h" -#include "modules/analyse/analyse.h" #include "modules/angle/angle.h" #include "modules/atomShake/atomShake.h" #include "modules/avgMol/avgMol.h" @@ -43,7 +42,6 @@ ModuleRegistry::ModuleRegistry() { registerProducer(ModuleTypes::Accumulate, "Accumulate partials data to form an average", "Correlation Functions"); - registerProducer(ModuleTypes::Analyse, "Perform custom analysis of one or more Configurations", "Analysis"); registerProducer(ModuleTypes::Angle, "Calculate distance/angle maps", "Analysis"); registerProducer(ModuleTypes::AtomShake, "Perform atomic Monte Carlo on all atoms", "Evolution"); registerProducer(ModuleTypes::AvgMol, diff --git a/src/modules/widgetProducer.cpp b/src/modules/widgetProducer.cpp index 941756f004..5f2a17a1ae 100644 --- a/src/modules/widgetProducer.cpp +++ b/src/modules/widgetProducer.cpp @@ -4,8 +4,6 @@ #include "modules/widgetProducer.h" #include "modules/accumulate/accumulate.h" #include "modules/accumulate/gui/accumulateWidget.h" -#include "modules/analyse/analyse.h" -#include "modules/analyse/gui/analyseWidget.h" #include "modules/angle/angle.h" #include "modules/angle/gui/angleWidget.h" #include "modules/atomShake/atomShake.h" @@ -63,7 +61,6 @@ ModuleWidgetProducer::ModuleWidgetProducer() { registerProducer(); - registerProducer(); registerProducer(); registerProducer(); registerProducer(); diff --git a/src/procedure/nodes/CMakeLists.txt b/src/procedure/nodes/CMakeLists.txt index bc1162e242..dfb95538c1 100644 --- a/src/procedure/nodes/CMakeLists.txt +++ b/src/procedure/nodes/CMakeLists.txt @@ -3,15 +3,6 @@ add_library( add.cpp addPair.cpp box.cpp - calculateAngle.cpp - calculateAxisAngle.cpp - calculateBase.cpp - calculateDistance.cpp - calculateExpression.cpp - calculateVector.cpp - collect1D.cpp - collect2D.cpp - collect3D.cpp context.cpp coordinateSets.cpp copy.cpp @@ -19,31 +10,14 @@ add_library( cylindricalGlobalPotential.cpp cylindricalRegion.cpp generalRegion.cpp - ifValueInRange.cpp importCoordinates.cpp - integerCollect1D.cpp - integrate1D.cpp - iterateData1D.cpp iterateSelection.cpp node.cpp - nodeReference.cpp - operateBase.cpp - operateDivide.cpp - operateExpression.cpp - operateGridNormalise.cpp - operateMultiply.cpp - operateNormalise.cpp - operateNumberDensityNormalise.cpp - operateSitePopulationNormalise.cpp - operateSphericalShellNormalise.cpp parameters.cpp pick.cpp pickBase.cpp pickProximity.cpp pickRegion.cpp - process1D.cpp - process2D.cpp - process3D.cpp regionBase.cpp regionalGlobalPotential.cpp registry.cpp @@ -55,21 +29,11 @@ add_library( sequence.cpp sphericalGlobalPotential.cpp sizeFactor.cpp - sum1D.cpp temperature.cpp transmute.cpp add.h addPair.h box.h - calculateAngle.h - calculateAxisAngle.h - calculateBase.h - calculateDistance.h - calculateExpression.h - calculateVector.h - collect1D.h - collect2D.h - collect3D.h context.h coordinateSets.h copy.h @@ -77,31 +41,14 @@ add_library( cylindricalGlobalPotential.h cylindricalRegion.h generalRegion.h - ifValueInRange.h importCoordinates.h - integerCollect1D.h - integrate1D.h - iterateData1D.h iterateSelection.h node.h - nodeReference.h - operateBase.h - operateDivide.h - operateExpression.h - operateGridNormalise.h - operateMultiply.h - operateNormalise.h - operateNumberDensityNormalise.h - operateSitePopulationNormalise.h - operateSphericalShellNormalise.h parameters.h pick.h pickBase.h pickProximity.h pickRegion.h - process1D.h - process2D.h - process3D.h regionBase.h regionalGlobalPotential.h registry.h @@ -113,7 +60,6 @@ add_library( sequence.h sphericalGlobalPotential.h sizeFactor.h - sum1D.h temperature.h transmute.h ) diff --git a/src/procedure/nodes/add.cpp b/src/procedure/nodes/add.cpp index 6b5709fdb7..454348c311 100644 --- a/src/procedure/nodes/add.cpp +++ b/src/procedure/nodes/add.cpp @@ -5,7 +5,6 @@ #include "base/randomBuffer.h" #include "classes/box.h" #include "classes/configuration.h" -#include "classes/coreData.h" #include "classes/species.h" #include "keywords/bool.h" #include "keywords/node.h" @@ -13,7 +12,6 @@ #include "keywords/nodeValueEnumOptions.h" #include "keywords/species.h" #include "procedure/nodes/coordinateSets.h" -#include "procedure/nodes/generalRegion.h" #include "procedure/nodes/regionBase.h" AddProcedureNode::AddProcedureNode(const Species *sp, const NodeValue &population, const NodeValue &density, @@ -38,7 +36,7 @@ void AddProcedureNode::setUpKeywords() keywords_.setOrganisation("Options", "Target"); keywords_.add("Species", "Target species to add", species_); keywords_.add>("CoordinateSets", "Target coordinate sets to add", coordinateSets_, - this, ProcedureNode::NodeType::CoordinateSets, true); + this, NodeTypeVector{NodeType::CoordinateSets}, true); keywords_.add("Population", "Population of the target species to add", population_, this); keywords_.add>("Density", "Density at which to add the target species", density_, this, Units::densityUnits()); @@ -53,8 +51,9 @@ void AddProcedureNode::setUpKeywords() keywords_.setOrganisation("Options", "Target"); keywords_.add>( "Positioning", "Positioning type for individual molecules", positioningType_, positioningTypes()); - keywords_.add>("Region", "Region into which to add the species", region_, this, - ProcedureNode::NodeClass::Region, true); + keywords_.add>( + "Region", "Region into which to add the species", region_, this, + NodeTypeVector{NodeType::CustomRegion, NodeType::CylindricalRegion, NodeType::GeneralRegion}, true); keywords_.add("Rotate", "Whether to randomly rotate molecules on insertion", rotate_); } diff --git a/src/procedure/nodes/addPair.cpp b/src/procedure/nodes/addPair.cpp index 69bfc1dd6e..8024dc2558 100644 --- a/src/procedure/nodes/addPair.cpp +++ b/src/procedure/nodes/addPair.cpp @@ -42,8 +42,9 @@ void AddPairProcedureNode::setUpKeywords() keywords_.setOrganisation("Options", "Target"); keywords_.add>( "Positioning", "Positioning type for individual molecules", positioningType_, positioningTypes()); - keywords_.add>("Region", "Region into which to add the species", region_, this, - ProcedureNode::NodeClass::Region, true); + keywords_.add>( + "Region", "Region into which to add the species", region_, this, + NodeTypeVector{NodeType::CustomRegion, NodeType::CylindricalRegion, NodeType::GeneralRegion}, true); keywords_.add("Rotate", "Whether to randomly rotate molecules on insertion", rotate_); } diff --git a/src/procedure/nodes/calculateAngle.cpp b/src/procedure/nodes/calculateAngle.cpp deleted file mode 100644 index 858dc24c4c..0000000000 --- a/src/procedure/nodes/calculateAngle.cpp +++ /dev/null @@ -1,59 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#include "procedure/nodes/calculateAngle.h" -#include "classes/box.h" -#include "classes/configuration.h" -#include "classes/species.h" -#include "keywords/bool.h" -#include "procedure/nodes/select.h" - -CalculateAngleProcedureNode::CalculateAngleProcedureNode(std::shared_ptr site0, - std::shared_ptr site1, - std::shared_ptr site2) - : CalculateProcedureNodeBase(ProcedureNode::NodeType::CalculateAngle, site0, site1, site2) -{ - keywords_.setOrganisation("Options", "Sites"); - keywords_.add>("I", "Site that represents 'i' in the angle i-j-k", sites_[0], this, - ProcedureNode::NodeType::Select, true); - keywords_.add>("J", "Site that represents 'j' in the angle i-j-k", sites_[1], this, - ProcedureNode::NodeType::Select, true); - keywords_.add>("K", "Site that represents 'k' in the angle i-j-k", sites_[2], this, - ProcedureNode::NodeType::Select, true); - - keywords_.setOrganisation("Options", "Control"); - keywords_.add( - "Symmetric", "Whether to consider angles as symmetric about 90, mapping all angles to the range 0 - 90", symmetric_); -} - -/* - * Observable Target - */ - -// Return number of sites required to calculate observable -int CalculateAngleProcedureNode::nSitesRequired() const { return 3; } - -// Return dimensionality of calculated observable -int CalculateAngleProcedureNode::dimensionality() const { return 1; } - -/* - * Execute - */ - -// Execute node -bool CalculateAngleProcedureNode::execute(const ProcedureContext &procedureContext) -{ - assert(sites_[0] && sites_[0]->currentSite()); - assert(sites_[1] && sites_[1]->currentSite()); - assert(sites_[2] && sites_[2]->currentSite()); - - // Determine the value of the observable - value_.x = procedureContext.configuration()->box()->angleInDegrees(sites_[0]->currentSite()->get().origin(), - sites_[1]->currentSite()->get().origin(), - sites_[2]->currentSite()->get().origin()); - - if (symmetric_ && value_.x > 90.0) - value_.x = 180.0 - value_.x; - - return true; -} diff --git a/src/procedure/nodes/calculateAngle.h b/src/procedure/nodes/calculateAngle.h deleted file mode 100644 index 25ad486943..0000000000 --- a/src/procedure/nodes/calculateAngle.h +++ /dev/null @@ -1,42 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#pragma once - -#include "procedure/nodes/calculateBase.h" - -// Forward Declarations -class SelectProcedureNode; - -// Calculate Angle Node -class CalculateAngleProcedureNode : public CalculateProcedureNodeBase -{ - public: - CalculateAngleProcedureNode(std::shared_ptr site0 = nullptr, - std::shared_ptr site1 = nullptr, - std::shared_ptr site2 = nullptr); - ~CalculateAngleProcedureNode() override = default; - - /* - * Data - */ - private: - // Whether the angle should be considered symmetric about 90 (i.e. 0 == 180) - bool symmetric_{false}; - - /* - * Observable Target (implements virtuals in CalculateProcedureNodeBase) - */ - public: - // Return number of sites required to calculate observable - int nSitesRequired() const override; - // Return dimensionality of calculated observable - int dimensionality() const override; - - /* - * Execute - */ - public: - // Execute node - bool execute(const ProcedureContext &procedureContext) override; -}; diff --git a/src/procedure/nodes/calculateAxisAngle.cpp b/src/procedure/nodes/calculateAxisAngle.cpp deleted file mode 100644 index 250477010f..0000000000 --- a/src/procedure/nodes/calculateAxisAngle.cpp +++ /dev/null @@ -1,89 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#include "procedure/nodes/calculateAxisAngle.h" -#include "base/lineParser.h" -#include "base/sysFunc.h" -#include "classes/box.h" -#include "classes/configuration.h" -#include "classes/species.h" -#include "expression/variable.h" -#include "keywords/bool.h" -#include "keywords/enumOptions.h" -#include "procedure/nodes/select.h" - -CalculateAxisAngleProcedureNode::CalculateAxisAngleProcedureNode(std::shared_ptr site0, - OrientedSite::SiteAxis axis0, - std::shared_ptr site1, - OrientedSite::SiteAxis axis1) - : CalculateProcedureNodeBase(ProcedureNode::NodeType::CalculateAxisAngle, site0, site1), axes_{axis0, axis1} -{ - keywords_.setOrganisation("Options", "Sites"); - keywords_.add>("I", "Site that contains the first set of axes", sites_[0], this, - ProcedureNode::NodeType::Select, true); - keywords_.add>("J", "Site that contains the second set of axes", sites_[1], this, - ProcedureNode::NodeType::Select, true); - keywords_.add>("AxisI", "Axis to use from site I", axes_[0], - OrientedSite::siteAxis()); - keywords_.add>("AxisJ", "Axis to use from site J", axes_[1], - OrientedSite::siteAxis()); - - keywords_.setOrganisation("Options", "Control"); - keywords_.add( - "Symmetric", "Whether to consider angles as symmetric about 90, mapping all angles to the range 0 - 90", symmetric_); - - // Create parameters - angleParameter_ = addParameter("theta"); -} - -/* - * Data - */ - -// Return axis specified -OrientedSite::SiteAxis &CalculateAxisAngleProcedureNode::axis(int n) -{ - assert(n >= 0 && n < 2); - return axes_[n]; -} - -/* - * Observable Target - */ - -// Return number of sites required to calculate observable -int CalculateAxisAngleProcedureNode::nSitesRequired() const { return 2; } - -// Return dimensionality of calculated observable -int CalculateAxisAngleProcedureNode::dimensionality() const { return 1; } - -/* - * Execute - */ - -// Prepare any necessary data, ready for execution -bool CalculateAxisAngleProcedureNode::prepare(const ProcedureContext &procedureContext) -{ - // Call the base class function - if (!CalculateProcedureNodeBase::prepare(procedureContext)) - return false; - - return true; -} - -// Execute node -bool CalculateAxisAngleProcedureNode::execute(const ProcedureContext &procedureContext) -{ - assert(sites_[0] && sites_[0]->currentSite()); - assert(sites_[1] && sites_[1]->currentSite()); - - value_.x = Box::angleInDegrees(sites_[0]->currentSite()->get().axes().columnAsVec3(axes_[0]), - sites_[1]->currentSite()->get().axes().columnAsVec3(axes_[1])); - - if (symmetric_ && value_.x > 90.0) - value_.x = 180.0 - value_.x; - - angleParameter_->setValue(value_.x); - - return true; -} diff --git a/src/procedure/nodes/calculateAxisAngle.h b/src/procedure/nodes/calculateAxisAngle.h deleted file mode 100644 index 69db206eaf..0000000000 --- a/src/procedure/nodes/calculateAxisAngle.h +++ /dev/null @@ -1,59 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#pragma once - -#include "classes/site.h" -#include "procedure/nodes/calculateBase.h" - -// Forward Declarations -class SelectProcedureNode; - -// Calculate AxisAngle Node -class CalculateAxisAngleProcedureNode : public CalculateProcedureNodeBase -{ - public: - CalculateAxisAngleProcedureNode(std::shared_ptr site0 = nullptr, - OrientedSite::SiteAxis axis0 = OrientedSite::XAxis, - std::shared_ptr site1 = nullptr, - OrientedSite::SiteAxis axis1 = OrientedSite::XAxis); - ~CalculateAxisAngleProcedureNode() override = default; - - /* - * Parameters - */ - private: - // Pointers to individual parameters - std::shared_ptr angleParameter_; - - /* - * Data - */ - private: - // Axes to use for sites - OrientedSite::SiteAxis axes_[2]; - // Whether the angle should be considered symmetric about 90 (i.e. 0 == 180) - bool symmetric_{false}; - - public: - // Return axis specified - OrientedSite::SiteAxis &axis(int n); - - /* - * Observable Target (implements virtuals in CalculateProcedureNodeBase) - */ - public: - // Return number of sites required to calculate observable - int nSitesRequired() const override; - // Return dimensionality of calculated observable - int dimensionality() const override; - - /* - * Execute - */ - public: - // Prepare any necessary data, ready for execution - bool prepare(const ProcedureContext &procedureContext) override; - // Execute node - bool execute(const ProcedureContext &procedureContext) override; -}; diff --git a/src/procedure/nodes/calculateBase.cpp b/src/procedure/nodes/calculateBase.cpp deleted file mode 100644 index 69a122f1a8..0000000000 --- a/src/procedure/nodes/calculateBase.cpp +++ /dev/null @@ -1,42 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#include "procedure/nodes/calculateBase.h" -#include "base/lineParser.h" -#include "base/sysFunc.h" -#include "procedure/nodes/select.h" - -CalculateProcedureNodeBase::CalculateProcedureNodeBase(ProcedureNode::NodeType nodeType, - std::shared_ptr site0, - std::shared_ptr site1, - std::shared_ptr site2, - std::shared_ptr site3) - : ProcedureNode(nodeType, {ProcedureNode::AnalysisContext}, ProcedureNode::NodeClass::Calculate), - sites_{site0, site1, site2, site3}, value_{0.0, 0.0, 0.0} -{ -} - -/* - * Observable Target - */ - -// Return last calculated value of observable -double CalculateProcedureNodeBase::value(int id) const { return value_.get(id); } - -// Return last calculated value of observable -Vec3 CalculateProcedureNodeBase::values() const { return value_; } - -/* - * Execute - */ - -// Prepare any necessary data, ready for execution -bool CalculateProcedureNodeBase::prepare(const ProcedureContext &procedureContext) -{ - // Check that the sites have been properly defined - for (auto n = 0; n < nSitesRequired(); ++n) - if (!sites_[n]) - return Messenger::error("Observable site {} is not set.\n", n); - - return true; -} diff --git a/src/procedure/nodes/calculateBase.h b/src/procedure/nodes/calculateBase.h deleted file mode 100644 index ae2b70726a..0000000000 --- a/src/procedure/nodes/calculateBase.h +++ /dev/null @@ -1,48 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#pragma once - -#include "keywords/node.h" -#include "procedure/nodes/node.h" -#include - -// Forward Declarations -class SelectProcedureNode; - -// Calculate Node Base -class CalculateProcedureNodeBase : public ProcedureNode -{ - public: - CalculateProcedureNodeBase(ProcedureNode::NodeType nodeType, std::shared_ptr site0 = nullptr, - std::shared_ptr site1 = nullptr, - std::shared_ptr site2 = nullptr, - std::shared_ptr site3 = nullptr); - ~CalculateProcedureNodeBase() override = default; - - /* - * Observable Target - */ - protected: - // Sites (SelectProcedureNodes) to use for calculation of observable (retrieved from keywords) - std::array, 4> sites_; - // Last calculate value(s) of observable (as Vec3) - Vec3 value_; - - public: - // Return last calculated value of observable - double value(int id) const; - // Return last calculated value as vector - Vec3 values() const; - // Return number of sites required to calculate observable - virtual int nSitesRequired() const = 0; - // Return dimensionality of calculated observable - virtual int dimensionality() const = 0; - - /* - * Execute - */ - public: - // Prepare any necessary data, ready for execution - bool prepare(const ProcedureContext &procedureContext) override; -}; diff --git a/src/procedure/nodes/calculateDistance.cpp b/src/procedure/nodes/calculateDistance.cpp deleted file mode 100644 index fa2adda72c..0000000000 --- a/src/procedure/nodes/calculateDistance.cpp +++ /dev/null @@ -1,48 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#include "procedure/nodes/calculateDistance.h" -#include "base/lineParser.h" -#include "base/sysFunc.h" -#include "classes/box.h" -#include "classes/configuration.h" -#include "classes/species.h" -#include "procedure/nodes/select.h" - -CalculateDistanceProcedureNode::CalculateDistanceProcedureNode(std::shared_ptr site0, - std::shared_ptr site1) - : CalculateProcedureNodeBase(ProcedureNode::NodeType::CalculateDistance, site0, site1) -{ - keywords_.setOrganisation("Options", "Sites"); - keywords_.add>("I", "Site that represents 'i' in the distance i-j", sites_[0], this, - ProcedureNode::NodeType::Select, true); - keywords_.add>("J", "Site that represents 'j' in the distance i-j", sites_[1], this, - ProcedureNode::NodeType::Select, true); -} - -/* - * Observable Target - */ - -// Return number of sites required to calculate observable -int CalculateDistanceProcedureNode::nSitesRequired() const { return 2; } - -// Return dimensionality of calculated observable -int CalculateDistanceProcedureNode::dimensionality() const { return 1; } - -/* - * Execute - */ - -// Execute node -bool CalculateDistanceProcedureNode::execute(const ProcedureContext &procedureContext) -{ - assert(sites_[0] && sites_[0]->currentSite()); - assert(sites_[1] && sites_[1]->currentSite()); - - // Determine the value of the observable - value_.x = procedureContext.configuration()->box()->minimumDistance(sites_[0]->currentSite()->get().origin(), - sites_[1]->currentSite()->get().origin()); - - return true; -} diff --git a/src/procedure/nodes/calculateDistance.h b/src/procedure/nodes/calculateDistance.h deleted file mode 100644 index a043b8eb11..0000000000 --- a/src/procedure/nodes/calculateDistance.h +++ /dev/null @@ -1,34 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#pragma once - -#include "procedure/nodes/calculateBase.h" - -// Forward Declarations -class SelectProcedureNode; - -// Calculate Distance Node -class CalculateDistanceProcedureNode : public CalculateProcedureNodeBase -{ - public: - CalculateDistanceProcedureNode(std::shared_ptr site0 = nullptr, - std::shared_ptr site1 = nullptr); - ~CalculateDistanceProcedureNode() override = default; - - /* - * Observable Target (implements virtuals in CalculateProcedureNodeBase) - */ - public: - // Return number of sites required to calculate observable - int nSitesRequired() const override; - // Return dimensionality of calculated observable - int dimensionality() const override; - - /* - * Execute - */ - public: - // Execute node - bool execute(const ProcedureContext &procedureContext) override; -}; diff --git a/src/procedure/nodes/calculateExpression.cpp b/src/procedure/nodes/calculateExpression.cpp deleted file mode 100644 index 2c7929ef29..0000000000 --- a/src/procedure/nodes/calculateExpression.cpp +++ /dev/null @@ -1,46 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#include "procedure/nodes/calculateExpression.h" -#include "base/lineParser.h" -#include "base/sysFunc.h" -#include "classes/box.h" -#include "classes/configuration.h" -#include "classes/species.h" -#include "keywords/nodeValue.h" -#include "procedure/nodes/select.h" - -CalculateExpressionProcedureNode::CalculateExpressionProcedureNode() - : CalculateProcedureNodeBase(ProcedureNode::NodeType::CalculateExpression) -{ - keywords_.add("Expression", "Expression to evaluate", expression_, this); -} - -/* - * Observable Target - */ - -// Set expression to evaluate -bool CalculateExpressionProcedureNode::setExpression(std::string_view expression) -{ - auto vars = getParameters(); - - return expression_.set(expression, vars); -} - -// Return number of sites required to calculate observable -int CalculateExpressionProcedureNode::nSitesRequired() const { return 0; } - -// Return dimensionality of calculated observable -int CalculateExpressionProcedureNode::dimensionality() const { return 1; } - -/* - * Execute - */ - -// Execute node -bool CalculateExpressionProcedureNode::execute(const ProcedureContext &procedureContext) -{ - value_.x = expression_.asDouble(); - return true; -} diff --git a/src/procedure/nodes/calculateExpression.h b/src/procedure/nodes/calculateExpression.h deleted file mode 100644 index 9656d55a62..0000000000 --- a/src/procedure/nodes/calculateExpression.h +++ /dev/null @@ -1,39 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#pragma once - -#include "procedure/nodeValue.h" -#include "procedure/nodes/calculateBase.h" - -// Calculate Expression -class CalculateExpressionProcedureNode : public CalculateProcedureNodeBase -{ - public: - CalculateExpressionProcedureNode(); - ~CalculateExpressionProcedureNode() override = default; - - /* - * Observable Target (implements virtuals in CalculateProcedureNodeBase) - */ - private: - // Expression to evaluate - NodeValue expression_; - - public: - // Set expression to evaluate - bool setExpression(std::string_view expression); - - public: - // Return number of sites required to calculate observable - int nSitesRequired() const override; - // Return dimensionality of calculated observable - int dimensionality() const override; - - /* - * Execute - */ - public: - // Execute node - bool execute(const ProcedureContext &procedureContext) override; -}; diff --git a/src/procedure/nodes/calculateVector.cpp b/src/procedure/nodes/calculateVector.cpp deleted file mode 100644 index aba6022695..0000000000 --- a/src/procedure/nodes/calculateVector.cpp +++ /dev/null @@ -1,67 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#include "procedure/nodes/calculateVector.h" -#include "base/lineParser.h" -#include "base/sysFunc.h" -#include "classes/box.h" -#include "classes/configuration.h" -#include "classes/species.h" -#include "keywords/bool.h" -#include "procedure/nodes/select.h" - -CalculateVectorProcedureNode::CalculateVectorProcedureNode(std::shared_ptr site0, - std::shared_ptr site1, bool rotateIntoFrame) - : CalculateProcedureNodeBase(ProcedureNode::NodeType::CalculateVector, site0, site1), rotateIntoFrame_(rotateIntoFrame) -{ - keywords_.setOrganisation("Options", "Sites"); - keywords_.add>("I", "Site that represents 'i' in the vector i->j", sites_[0], this, - ProcedureNode::NodeType::Select, true); - keywords_.add>("J", "Site that represents 'j' in the vector i->j", sites_[1], this, - ProcedureNode::NodeType::Select, true); - - keywords_.setOrganisation("Options", "Control"); - keywords_.add("RotateIntoFrame", "Whether to rotate the calculated vector into the local frame defined on 'I'", - rotateIntoFrame_); -} - -/* - * Observable Target - */ - -// Return number of sites required to calculate observable -int CalculateVectorProcedureNode::nSitesRequired() const { return 2; } - -// Return dimensionality of calculated observable -int CalculateVectorProcedureNode::dimensionality() const { return 3; } - -/* - * Execute - */ - -// Prepare any necessary data, ready for execution -bool CalculateVectorProcedureNode::prepare(const ProcedureContext &procedureContext) -{ - // Call the base class function - if (!CalculateProcedureNodeBase::prepare(procedureContext)) - return false; - - return true; -} - -// Execute node -bool CalculateVectorProcedureNode::execute(const ProcedureContext &procedureContext) -{ - assert(sites_[0] && sites_[0]->currentSite()); - assert(sites_[1] && sites_[1]->currentSite()); - - // Determine the value of the observable - value_ = procedureContext.configuration()->box()->minimumVector(sites_[0]->currentSite()->get().origin(), - sites_[1]->currentSite()->get().origin()); - - // Rotate the vector into the local frame defined on the first site? - if (rotateIntoFrame_) - value_ = sites_[0]->currentSite()->get().axes().transposeMultiply(value_); - - return true; -} diff --git a/src/procedure/nodes/calculateVector.h b/src/procedure/nodes/calculateVector.h deleted file mode 100644 index ce6471ea66..0000000000 --- a/src/procedure/nodes/calculateVector.h +++ /dev/null @@ -1,43 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#pragma once - -#include "procedure/nodes/calculateBase.h" - -// Forward Declarations -class SelectProcedureNode; - -// Calculate Vector Node -class CalculateVectorProcedureNode : public CalculateProcedureNodeBase -{ - public: - CalculateVectorProcedureNode(std::shared_ptr site0 = nullptr, - std::shared_ptr site1 = nullptr, bool rotateIntoFrame = false); - ~CalculateVectorProcedureNode() override = default; - - /* - * Data - */ - private: - // Whether to rotate into the frame of the first site - bool rotateIntoFrame_; - - /* - * Observable Target (implements virtuals in CalculateProcedureNodeBase) - */ - public: - // Return number of sites required to calculate observable - int nSitesRequired() const override; - // Return dimensionality of calculated observable - int dimensionality() const override; - - /* - * Execute - */ - public: - // Prepare any necessary data, ready for execution - bool prepare(const ProcedureContext &procedureContext) override; - // Execute node - bool execute(const ProcedureContext &procedureContext) override; -}; diff --git a/src/procedure/nodes/collect1D.cpp b/src/procedure/nodes/collect1D.cpp deleted file mode 100644 index 0b92c95a24..0000000000 --- a/src/procedure/nodes/collect1D.cpp +++ /dev/null @@ -1,121 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#include "procedure/nodes/collect1D.h" -#include "base/lineParser.h" -#include "base/sysFunc.h" -#include "classes/configuration.h" -#include "keywords/nodeAndInteger.h" -#include "keywords/nodeBranch.h" -#include "keywords/vec3Double.h" -#include "math/data1D.h" -#include "procedure/nodes/calculateBase.h" -#include "procedure/nodes/sequence.h" - -Collect1DProcedureNode::Collect1DProcedureNode(std::shared_ptr observable, - ProcedureNode::NodeContext subCollectContext, double rMin, double rMax, - double binWidth) - : ProcedureNode(ProcedureNode::NodeType::Collect1D, {ProcedureNode::AnalysisContext}), - xObservable_{observable, 0}, rangeX_{rMin, rMax, binWidth}, subCollectBranch_(subCollectContext, *this, "SubCollect") -{ - keywords_.setOrganisation("Options", "Quantity / Range"); - keywords_.add>( - "QuantityX", "Calculated observable to collect", xObservable_, this, ProcedureNode::NodeClass::Calculate, true); - keywords_.add("RangeX", "Range and binwidth of the x-axis of the histogram", rangeX_, - Vec3(0.0, 0.0, 1.0e-5), std::nullopt, Vec3Labels::MinMaxBinwidthlabels); - - keywords_.addHidden("SubCollect", "Branch which runs if the target quantity was binned successfully", - subCollectBranch_); -} - -/* - * Data - */ - -// Return current data -Data1D Collect1DProcedureNode::data() const -{ - assert(histogram_); - - return histogram_->get().data(); -} - -// Return accumulated data -const Data1D &Collect1DProcedureNode::accumulatedData() const -{ - assert(histogram_); - - return histogram_->get().accumulatedData(); -} - -/* - * Branches - */ - -// Return the branch from this node (if it has one) -OptionalReferenceWrapper Collect1DProcedureNode::branch() { return subCollectBranch_; } - -/* - * Execute - */ - -// Prepare any necessary data, ready for execution -bool Collect1DProcedureNode::prepare(const ProcedureContext &procedureContext) -{ - // Construct our data name, and search for it in the supplied list - std::string dataName = fmt::format("{}_{}_Bins", name(), procedureContext.configuration()->niceName()); - auto [target, status] = procedureContext.processingModuleData().realiseIf( - dataName, procedureContext.processingModuleDataPrefix(), GenericItem::InRestartFileFlag); - if (status == GenericItem::ItemStatus::Created) - { - Messenger::printVerbose("One-dimensional histogram data for '{}' was not in the target list, so it will now be " - "initialised...\n", - name()); - target.initialise(rangeX_.x, rangeX_.y, rangeX_.z); - } - - // Zero the current bins, ready for the new pass - target.zeroBins(); - - // Store a reference to the data - histogram_ = target; - - // Check target observable - if (!xObservable_.first) - return Messenger::error("No valid x quantity set in '{}'.\n", name()); - - // Prepare any branches - if (!subCollectBranch_.prepare(procedureContext)) - return false; - - return true; -} - -// Execute node -bool Collect1DProcedureNode::execute(const ProcedureContext &procedureContext) -{ - auto [observable, index] = xObservable_; - - assert(observable && histogram_); - - // Bin the current value of the observable, and execute sub-collection branch on success - if (histogram_->get().bin(observable->value(index))) - return subCollectBranch_.execute(procedureContext); - - return true; -} - -// Finalise any necessary data after execution -bool Collect1DProcedureNode::finalise(const ProcedureContext &procedureContext) -{ - assert(histogram_); - - // Accumulate the current binned data - histogram_->get().accumulate(); - - // Finalise any branches - if (!subCollectBranch_.finalise(procedureContext)) - return false; - - return true; -} diff --git a/src/procedure/nodes/collect1D.h b/src/procedure/nodes/collect1D.h deleted file mode 100644 index d8fb183893..0000000000 --- a/src/procedure/nodes/collect1D.h +++ /dev/null @@ -1,61 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#pragma once - -#include "math/histogram1D.h" -#include "procedure/nodes/node.h" -#include "procedure/nodes/sequence.h" - -// Forward Declarations -class CalculateProcedureNodeBase; -class LineParser; - -// Procedure Node - Collect1D -class Collect1DProcedureNode : public ProcedureNode -{ - public: - Collect1DProcedureNode(std::shared_ptr observable = nullptr, - ProcedureNode::NodeContext subCollectContext = ProcedureNode::AnalysisContext, double rMin = 0.0, - double rMax = 10.0, double binWidth = 0.05); - ~Collect1DProcedureNode() override = default; - - /* - * Data - */ - private: - // Observable (and associated index thereof) to bin along x - std::pair, int> xObservable_{nullptr, 0}; - // Histogram in which to accumulate data - OptionalReferenceWrapper histogram_; - // Range and binwidth of the histogram for QuantityX - Vec3 rangeX_{0.0, 10.0, 0.05}; - - public: - // Return current data - Data1D data() const; - // Return accumulated data - const Data1D &accumulatedData() const; - - /* - * Branches - */ - private: - // Branch for subcollection, run if the target quantity is successfully binned - ProcedureNodeSequence subCollectBranch_; - - public: - // Return the branch from this node (if it has one) - OptionalReferenceWrapper branch() override; - - /* - * Execute - */ - public: - // Prepare any necessary data, ready for execution - bool prepare(const ProcedureContext &procedureContext) override; - // Execute node - bool execute(const ProcedureContext &procedureContext) override; - // Finalise any necessary data after execution - bool finalise(const ProcedureContext &procedureContext) override; -}; diff --git a/src/procedure/nodes/collect2D.cpp b/src/procedure/nodes/collect2D.cpp deleted file mode 100644 index 3854414d5e..0000000000 --- a/src/procedure/nodes/collect2D.cpp +++ /dev/null @@ -1,122 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#include "procedure/nodes/collect2D.h" -#include "classes/configuration.h" -#include "keywords/nodeAndInteger.h" -#include "keywords/nodeBranch.h" -#include "keywords/vec3Double.h" -#include "math/data2D.h" -#include "procedure/nodes/calculateBase.h" -#include "procedure/nodes/sequence.h" - -Collect2DProcedureNode::Collect2DProcedureNode(std::shared_ptr xObservable, - std::shared_ptr yObservable, - ProcedureNode::NodeContext subCollectContext, double xMin, double xMax, - double xBinWidth, double yMin, double yMax, double yBinWidth) - : ProcedureNode(ProcedureNode::NodeType::Collect2D, {ProcedureNode::AnalysisContext}), xObservable_{xObservable, 0}, - yObservable_{yObservable, 0}, rangeX_{xMin, xMax, xBinWidth}, rangeY_{yMin, yMax, yBinWidth}, - subCollectBranch_(subCollectContext, *this, "SubCollect") -{ - keywords_.setOrganisation("Options", "Quantities / Ranges"); - keywords_.add>("QuantityX", "Calculated observable to collect for x axis", - xObservable_, this, ProcedureNode::NodeClass::Calculate, - true); - keywords_.add>("QuantityY", "Calculated observable to collect for y axis", - yObservable_, this, ProcedureNode::NodeClass::Calculate, - true); - keywords_.add("RangeX", "Range and binwidth of the x-axis of the histogram", rangeX_, - Vec3(0.0, 0.0, 1.0e-5), std::nullopt, Vec3Labels::MinMaxBinwidthlabels); - keywords_.add("RangeY", "Range and binwidth of the y-axis of the histogram", rangeY_, - Vec3(0.0, 0.0, 1.0e-5), std::nullopt, Vec3Labels::MinMaxBinwidthlabels); - - keywords_.addHidden("SubCollect", "Branch which runs if the target quantities were binned successfully", - subCollectBranch_); -} - -/* - * Data - */ - -// Return accumulated data -const Data2D &Collect2DProcedureNode::accumulatedData() const -{ - assert(histogram_); - - return histogram_->get().accumulatedData(); -} - -/* - * Branches - */ - -// Return the branch from this node (if it has one) -OptionalReferenceWrapper Collect2DProcedureNode::branch() { return subCollectBranch_; } - -/* - * Execute - */ - -// Prepare any necessary data, ready for execution -bool Collect2DProcedureNode::prepare(const ProcedureContext &procedureContext) -{ - // Construct our data name, and search for it in the supplied list - std::string dataName = fmt::format("{}_{}_Bins", name(), procedureContext.configuration()->niceName()); - auto [target, status] = procedureContext.processingModuleData().realiseIf( - dataName, procedureContext.processingModuleDataPrefix(), GenericItem::InRestartFileFlag); - if (status == GenericItem::ItemStatus::Created) - { - Messenger::printVerbose("Two-dimensional histogram data for '{}' was not in the target list, so it will now be " - "initialised...\n", - name()); - target.initialise(rangeX_.x, rangeX_.y, rangeX_.z, rangeY_.x, rangeY_.y, rangeY_.z); - } - - // Zero the current bins, ready for the new pass - target.zeroBins(); - - // Store a reference to the data - histogram_ = target; - - // Check target observables - if (!xObservable_.first) - return Messenger::error("No valid x quantity set in '{}'.\n", name()); - if (!yObservable_.first) - return Messenger::error("No valid y quantity set in '{}'.\n", name()); - - // Prepare any branches - if (!subCollectBranch_.prepare(procedureContext)) - return false; - - return true; -} - -// Execute node -bool Collect2DProcedureNode::execute(const ProcedureContext &procedureContext) -{ - auto [xObs, xIndex] = xObservable_; - auto [yObs, yIndex] = yObservable_; - - assert(xObs && yObs && histogram_); - - // Bin the current value of the observable - if (histogram_->get().bin(xObs->value(xIndex), yObs->value(yIndex))) - return subCollectBranch_.execute(procedureContext); - - return true; -} - -// Finalise any necessary data after execution -bool Collect2DProcedureNode::finalise(const ProcedureContext &procedureContext) -{ - assert(histogram_); - - // Accumulate the current binned data - histogram_->get().accumulate(); - - // Finalise any branches - if (!subCollectBranch_.finalise(procedureContext)) - return false; - - return true; -} diff --git a/src/procedure/nodes/collect2D.h b/src/procedure/nodes/collect2D.h deleted file mode 100644 index aacbed322b..0000000000 --- a/src/procedure/nodes/collect2D.h +++ /dev/null @@ -1,65 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#pragma once - -#include "math/histogram2D.h" -#include "procedure/nodes/node.h" -#include "procedure/nodes/sequence.h" - -// Forward Declarations -class CalculateProcedureNodeBase; -class LineParser; - -// Procedure Node - Collect2D -class Collect2DProcedureNode : public ProcedureNode -{ - public: - explicit Collect2DProcedureNode(std::shared_ptr xObservable = nullptr, - std::shared_ptr yObservable = nullptr, - ProcedureNode::NodeContext subCollectContext = ProcedureNode::AnalysisContext, - double xMin = 0.0, double xMax = 10.0, double xBinWidth = 0.05, double yMin = 0.0, - double yMax = 10.0, double yBinWidth = 0.05); - ~Collect2DProcedureNode() override = default; - - /* - * Data - */ - private: - // Observable (and associated index thereof) to bin along x - std::pair, int> xObservable_{nullptr, 0}; - // Observable (and associated index thereof) to bin along y - std::pair, int> yObservable_{nullptr, 0}; - // Histogram in which to accumulate data - OptionalReferenceWrapper histogram_; - // Range and binwidth of the histogram for QuantityX - Vec3 rangeX_{0.0, 10.0, 0.05}; - // Range and binwidth of the histogram for QuantityY - Vec3 rangeY_{0.0, 10.0, 0.05}; - - public: - // Return accumulated data - const Data2D &accumulatedData() const; - - /* - * Branches - */ - private: - // Branch for subcollection, run if the target quantity is successfully binned - ProcedureNodeSequence subCollectBranch_; - - public: - // Return the branch from this node (if it has one) - OptionalReferenceWrapper branch() override; - - /* - * Execute - */ - public: - // Prepare any necessary data, ready for execution - bool prepare(const ProcedureContext &procedureContext) override; - // Execute node - bool execute(const ProcedureContext &procedureContext) override; - // Finalise any necessary data after execution - bool finalise(const ProcedureContext &procedureContext) override; -}; diff --git a/src/procedure/nodes/collect3D.cpp b/src/procedure/nodes/collect3D.cpp deleted file mode 100644 index ac3f538a2c..0000000000 --- a/src/procedure/nodes/collect3D.cpp +++ /dev/null @@ -1,161 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#include "procedure/nodes/collect3D.h" -#include "base/lineParser.h" -#include "base/sysFunc.h" -#include "classes/configuration.h" -#include "keywords/nodeAndInteger.h" -#include "keywords/nodeBranch.h" -#include "keywords/vec3Double.h" -#include "math/data3D.h" -#include "procedure/nodes/calculateBase.h" -#include "procedure/nodes/sequence.h" - -Collect3DProcedureNode::Collect3DProcedureNode(std::shared_ptr xObservable, - std::shared_ptr yObservable, - std::shared_ptr zObservable, - ProcedureNode::NodeContext subCollectContext, Vec3 xMinMaxBin, - Vec3 yMinMaxBin, Vec3 zMinMaxBin) - : ProcedureNode(ProcedureNode::NodeType::Collect3D, {ProcedureNode::AnalysisContext}), xObservable_{xObservable, 0}, - yObservable_{yObservable, 0}, zObservable_{zObservable, 0}, rangeX_{xMinMaxBin}, rangeY_{yMinMaxBin}, rangeZ_{zMinMaxBin}, - subCollectBranch_(subCollectContext, *this, "SubCollect") -{ - keywords_.setOrganisation("Options", "Quantities / Ranges"); - keywords_.add>("QuantityX", "Calculated observable to collect for x axis", - xObservable_, this, ProcedureNode::NodeClass::Calculate, - true); - keywords_.add>("QuantityY", "Calculated observable to collect for y axis", - yObservable_, this, ProcedureNode::NodeClass::Calculate, - true); - keywords_.add>("QuantityZ", "Calculated observable to collect for z axis", - zObservable_, this, ProcedureNode::NodeClass::Calculate, - true); - keywords_.add("RangeX", "Range and binwidth of the x-axis of the histogram", rangeX_, - Vec3(-1.0e6, -1.0e6, 1.0e-5), std::nullopt, Vec3Labels::MinMaxBinwidthlabels); - keywords_.add("RangeY", "Range and binwidth of the y-axis of the histogram", rangeY_, - Vec3(-1.0e6, -1.0e6, 1.0e-5), std::nullopt, Vec3Labels::MinMaxBinwidthlabels); - keywords_.add("RangeZ", "Range and binwidth of the z-axis of the histogram", rangeZ_, - Vec3(-1.0e6, -1.0e6, 1.0e-5), std::nullopt, Vec3Labels::MinMaxBinwidthlabels); - - keywords_.addHidden("SubCollect", "Branch which runs if the target quantities were binned successfully", - subCollectBranch_); -} -Collect3DProcedureNode::Collect3DProcedureNode(std::shared_ptr xyzObservable, - ProcedureNode::NodeContext subCollectContext, Vec3 xMinMaxBin, - Vec3 yMinMaxBin, Vec3 zMinMaxBin) - : ProcedureNode(ProcedureNode::NodeType::Collect3D, {ProcedureNode::AnalysisContext}), xObservable_{xyzObservable, 0}, - yObservable_{xyzObservable, 1}, - zObservable_{xyzObservable, 2}, rangeX_{xMinMaxBin}, rangeY_{yMinMaxBin}, rangeZ_{zMinMaxBin}, - subCollectBranch_(subCollectContext, *this, "SubCollect") -{ - keywords_.setOrganisation("Options", "Quantities / Ranges"); - keywords_.add>("QuantityX", "Calculated observable to collect for x axis", - xObservable_, this, ProcedureNode::NodeClass::Calculate, - true); - keywords_.add>("QuantityY", "Calculated observable to collect for y axis", - yObservable_, this, ProcedureNode::NodeClass::Calculate, - true); - keywords_.add>("QuantityZ", "Calculated observable to collect for z axis", - zObservable_, this, ProcedureNode::NodeClass::Calculate, - true); - keywords_.add("RangeX", "Range and binwidth of the x-axis of the histogram", rangeX_, - Vec3(-1.0e6, -1.0e6, 1.0e-5), std::nullopt, Vec3Labels::MinMaxBinwidthlabels); - keywords_.add("RangeY", "Range and binwidth of the y-axis of the histogram", rangeY_, - Vec3(-1.0e6, -1.0e6, 1.0e-5), std::nullopt, Vec3Labels::MinMaxBinwidthlabels); - keywords_.add("RangeZ", "Range and binwidth of the z-axis of the histogram", rangeZ_, - Vec3(-1.0e6, -1.0e6, 1.0e-5), std::nullopt, Vec3Labels::MinMaxBinwidthlabels); - - keywords_.addHidden("SubCollect", "Branch which runs if the target quantities were binned successfully", - subCollectBranch_); -} - -/* - * Data - */ - -// Return accumulated data -const Data3D &Collect3DProcedureNode::accumulatedData() const -{ - assert(histogram_); - - return histogram_->get().accumulatedData(); -} - -/* - * Branches - */ - -// Return the branch from this node (if it has one) -OptionalReferenceWrapper Collect3DProcedureNode::branch() { return subCollectBranch_; } - -/* - * Execute - */ - -// Prepare any necessary data, ready for execution -bool Collect3DProcedureNode::prepare(const ProcedureContext &procedureContext) -{ - // Construct our data name, and search for it in the supplied list - std::string dataName = fmt::format("{}_{}_Bins", name(), procedureContext.configuration()->niceName()); - auto [target, status] = procedureContext.processingModuleData().realiseIf( - dataName, procedureContext.processingModuleDataPrefix(), GenericItem::InRestartFileFlag); - if (status == GenericItem::ItemStatus::Created) - { - Messenger::printVerbose("Three-dimensional histogram data for '{}' was not in the target list, so it will now " - "be initialised...\n", - name()); - target.initialise(rangeX_.x, rangeX_.y, rangeX_.z, rangeY_.x, rangeY_.y, rangeY_.z, rangeZ_.x, rangeZ_.y, rangeZ_.z); - } - - // Zero the current bins, ready for the new pass - target.zeroBins(); - - // Store a reference to the data - histogram_ = target; - - // Check target observables - if (!xObservable_.first) - return Messenger::error("No valid x quantity set in '{}'.\n", name()); - if (!yObservable_.first) - return Messenger::error("No valid y quantity set in '{}'.\n", name()); - if (!zObservable_.first) - return Messenger::error("No valid z quantity set in '{}'.\n", name()); - - // Prepare any branches - if (!subCollectBranch_.prepare(procedureContext)) - return false; - - return true; -} - -// Execute node -bool Collect3DProcedureNode::execute(const ProcedureContext &procedureContext) -{ - auto [xObs, xIndex] = xObservable_; - auto [yObs, yIndex] = yObservable_; - auto [zObs, zIndex] = zObservable_; - - assert(xObs && yObs && zObs && histogram_); - - // Bin the current value of the observable - if (histogram_->get().bin(xObs->value(xIndex), yObs->value(yIndex), zObs->value(zIndex))) - return subCollectBranch_.execute(procedureContext); - - return true; -} - -// Finalise any necessary data after execution -bool Collect3DProcedureNode::finalise(const ProcedureContext &procedureContext) -{ - assert(histogram_); - - // Accumulate the current binned data - histogram_->get().accumulate(); - - // Finalise any branches - if (!subCollectBranch_.finalise(procedureContext)) - return false; - - return true; -} diff --git a/src/procedure/nodes/collect3D.h b/src/procedure/nodes/collect3D.h deleted file mode 100644 index 7e8804967c..0000000000 --- a/src/procedure/nodes/collect3D.h +++ /dev/null @@ -1,74 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#pragma once - -#include "math/histogram3D.h" -#include "procedure/nodes/node.h" -#include "procedure/nodes/sequence.h" - -// Forward Declarations -class CalculateProcedureNodeBase; -class LineParser; - -// Procedure Node - Collect3D -class Collect3DProcedureNode : public ProcedureNode -{ - public: - explicit Collect3DProcedureNode(std::shared_ptr xObservable = nullptr, - std::shared_ptr yObservable = nullptr, - std::shared_ptr zObservable = nullptr, - ProcedureNode::NodeContext subCollectContext = ProcedureNode::AnalysisContext, - Vec3 xMinMaxBin = {0.0, 10.0, 0.05}, Vec3 yMinMaxBin = {0.0, 10.0, 0.05}, - Vec3 zMinMaxBin = {0.0, 10.0, 0.05}); - explicit Collect3DProcedureNode(std::shared_ptr xyzObservable, - ProcedureNode::NodeContext subCollectContext = ProcedureNode::AnalysisContext, - Vec3 xMinMaxBin = {0.0, 10.0, 0.05}, Vec3 yMinMaxBin = {0.0, 10.0, 0.05}, - Vec3 zMinMaxBin = {0.0, 10.0, 0.05}); - ~Collect3DProcedureNode() override = default; - - /* - * Data - */ - private: - // Observable (and associated index thereof) to bin along x - std::pair, int> xObservable_{nullptr, 0}; - // Observable (and associated index thereof) to bin along y - std::pair, int> yObservable_{nullptr, 0}; - // Observable (and associated index thereof) to bin along z - std::pair, int> zObservable_{nullptr, 0}; - // Histogram in which to accumulate data - OptionalReferenceWrapper histogram_; - // Range and binwidth of the histogram for QuantityX - Vec3 rangeX_{0.0, 10.0, 0.05}; - // Range and binwidth of the histogram for QuantityY - Vec3 rangeY_{0.0, 10.0, 0.05}; - // Range and binwidth of the histogram for QuantityZ - Vec3 rangeZ_{0.0, 10.0, 0.05}; - - public: - // Return accumulated data - const Data3D &accumulatedData() const; - - /* - * Branches - */ - private: - // Branch for subcollection, run if the target quantity is successfully binned - ProcedureNodeSequence subCollectBranch_; - - public: - // Return the branch from this node (if it has one) - OptionalReferenceWrapper branch() override; - - /* - * Execute - */ - public: - // Prepare any necessary data, ready for execution - bool prepare(const ProcedureContext &procedureContext) override; - // Execute node - bool execute(const ProcedureContext &procedureContext) override; - // Finalise any necessary data after execution - bool finalise(const ProcedureContext &procedureContext) override; -}; diff --git a/src/procedure/nodes/ifValueInRange.cpp b/src/procedure/nodes/ifValueInRange.cpp deleted file mode 100644 index 332ecbdf33..0000000000 --- a/src/procedure/nodes/ifValueInRange.cpp +++ /dev/null @@ -1,63 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#include "procedure/nodes/ifValueInRange.h" -#include "expression/variable.h" -#include "keywords/node.h" -#include "keywords/nodeBranch.h" -#include "keywords/nodeValue.h" -#include "keywords/range.h" -#include "procedure/nodes/sequence.h" -#include - -IfValueInRangeProcedureNode::IfValueInRangeProcedureNode() - : ProcedureNode(ProcedureNode::NodeType::IfValueInRange, {NodeContext::AnyContext}), - thenBranch_(NodeContext::InheritContext, *this, "Then") -{ - keywords_.setOrganisation("Options", "Condition"); - keywords_.add("Value", "Value expression to test", value_, this); - keywords_.add("ValidRange", "Valid acceptance range for value", valueRange_, - Vec3Labels::MinMaxBinwidthlabels); - - keywords_.addHidden("Then", "Branch to run on valid value", thenBranch_); -} - -/* - * Identity - */ - -// Return whether a name for the node must be provided -bool IfValueInRangeProcedureNode::mustBeNamed() const { return false; } - -/* - * Branch - */ - -// Return the branch from this node (if it has one) -OptionalReferenceWrapper IfValueInRangeProcedureNode::branch() { return thenBranch_; } - -/* - * Execute - */ - -// Prepare any necessary data, ready for execution -bool IfValueInRangeProcedureNode::prepare(const ProcedureContext &procedureContext) -{ - return thenBranch_.prepare(procedureContext); -} - -// Execute node -bool IfValueInRangeProcedureNode::execute(const ProcedureContext &procedureContext) -{ - // Evaluate and check - if (valueRange_.contains(value_.asDouble())) - return thenBranch_.execute(procedureContext); - - return true; -} - -// Finalise any necessary data after execution -bool IfValueInRangeProcedureNode::finalise(const ProcedureContext &procedureContext) -{ - return thenBranch_.finalise(procedureContext); -} diff --git a/src/procedure/nodes/ifValueInRange.h b/src/procedure/nodes/ifValueInRange.h deleted file mode 100644 index 6965c7d651..0000000000 --- a/src/procedure/nodes/ifValueInRange.h +++ /dev/null @@ -1,62 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#pragma once - -#include "math/range.h" -#include "procedure/nodes/node.h" -#include "procedure/nodes/sequence.h" -#include -#include - -// IfValueInRange Node -class IfValueInRangeProcedureNode : public ProcedureNode -{ - public: - explicit IfValueInRangeProcedureNode(); - - /* - * Identity - */ - public: - // Return whether a name for the node must be provided - bool mustBeNamed() const override; - - /* - * Parameters - */ - private: - // Pointers to individual parameters - std::shared_ptr currentValueParameter_; - - /* - * Value & Acceptable Range - */ - private: - // Value that we are testing - NodeValue value_; - // Range of acceptable values - Range valueRange_{0.0, 5.0}; - - /* - * Branch - */ - private: - // Branch for Then - ProcedureNodeSequence thenBranch_; - - public: - // Return the branch from this node (if it has one) - OptionalReferenceWrapper branch() override; - - /* - * Execute - */ - public: - // Prepare any necessary data, ready for execution - bool prepare(const ProcedureContext &procedureContext) override; - // Execute node - bool execute(const ProcedureContext &procedureContext) override; - // Finalise any necessary data after execution - bool finalise(const ProcedureContext &procedureContext) override; -}; diff --git a/src/procedure/nodes/integerCollect1D.cpp b/src/procedure/nodes/integerCollect1D.cpp deleted file mode 100644 index b1e2218fbd..0000000000 --- a/src/procedure/nodes/integerCollect1D.cpp +++ /dev/null @@ -1,121 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#include "procedure/nodes/integerCollect1D.h" -#include "base/lineParser.h" -#include "base/sysFunc.h" -#include "classes/configuration.h" -#include "keywords/nodeAndInteger.h" -#include "keywords/nodeBranch.h" -#include "keywords/optionalInt.h" -#include "math/data1D.h" -#include "procedure/nodes/calculateBase.h" -#include "procedure/nodes/sequence.h" - -IntegerCollect1DProcedureNode::IntegerCollect1DProcedureNode(std::shared_ptr observable, - ProcedureNode::NodeContext subCollectContext) - : ProcedureNode(ProcedureNode::NodeType::IntegerCollect1D, {ProcedureNode::AnalysisContext}), xObservable_{observable, 0}, - subCollectBranch_(subCollectContext, *this, "SubCollect") -{ - keywords_.setOrganisation("Options", "Quantity / Range"); - keywords_.add>( - "QuantityX", "Calculated observable to collect", xObservable_, this, ProcedureNode::NodeClass::Calculate, true); - keywords_.add("Minimum", "Minimum allowed bin value for the histogram", minimum_, 0, std::nullopt, - 1, "No Limit"); - keywords_.add("Maximum", "Maximum allowed bin value for the histogram", maximum_, 0, std::nullopt, - 1, "No Limit"); - keywords_.addHidden("SubCollect", "Branch which runs if the target quantity was binned successfully", - subCollectBranch_); -} - -/* - * Data - */ - -// Return current data -Data1D IntegerCollect1DProcedureNode::data() const -{ - assert(histogram_); - - return histogram_->get().data(); -} - -// Return accumulated data -const Data1D &IntegerCollect1DProcedureNode::accumulatedData() const -{ - assert(histogram_); - - return histogram_->get().accumulatedData(); -} - -/* - * Branches - */ - -// Return the branch from this node (if it has one) -OptionalReferenceWrapper IntegerCollect1DProcedureNode::branch() { return subCollectBranch_; } - -/* - * Execute - */ - -// Prepare any necessary data, ready for execution -bool IntegerCollect1DProcedureNode::prepare(const ProcedureContext &procedureContext) -{ - // Construct our data name, and search for it in the supplied list - std::string dataName = fmt::format("{}_{}_Bins", name(), procedureContext.configuration()->niceName()); - auto [target, status] = procedureContext.processingModuleData().realiseIf( - dataName, procedureContext.processingModuleDataPrefix(), GenericItem::InRestartFileFlag); - if (status == GenericItem::ItemStatus::Created) - { - Messenger::printVerbose("One-dimensional histogram data for '{}' was not in the target list, so it will now be " - "initialised...\n", - name()); - target.initialise(minimum_, maximum_); - } - - // Zero the current bins, ready for the new pass - target.zeroBins(); - - // Store a reference to the data - histogram_ = target; - - // Check target observable - if (!xObservable_.first) - return Messenger::error("No valid x quantity set in '{}'.\n", name()); - - // Prepare any branches - if (!subCollectBranch_.prepare(procedureContext)) - return false; - - return true; -} - -// Execute node -bool IntegerCollect1DProcedureNode::execute(const ProcedureContext &procedureContext) -{ - auto [observable, index] = xObservable_; - - assert(observable && histogram_); - - // Bin the current value of the observable, and execute sub-collection branch on success - if (histogram_->get().bin(observable->value(index))) - return subCollectBranch_.execute(procedureContext); - - return true; -} - -// Finalise any necessary data after execution -bool IntegerCollect1DProcedureNode::finalise(const ProcedureContext &procedureContext) -{ - assert(histogram_); - - // Accumulate the current binned data - histogram_->get().accumulate(); - - // Finalise any branches - if (!subCollectBranch_.finalise(procedureContext)) - return false; - - return true; -} diff --git a/src/procedure/nodes/integerCollect1D.h b/src/procedure/nodes/integerCollect1D.h deleted file mode 100644 index 04ad28bf50..0000000000 --- a/src/procedure/nodes/integerCollect1D.h +++ /dev/null @@ -1,61 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#pragma once - -#include "math/integerHistogram1D.h" -#include "procedure/nodes/node.h" -#include "procedure/nodes/sequence.h" - -// Forward Declarations -class CalculateProcedureNodeBase; -class LineParser; - -// Procedure Node - Collect1D -class IntegerCollect1DProcedureNode : public ProcedureNode -{ - public: - IntegerCollect1DProcedureNode(std::shared_ptr observable = nullptr, - ProcedureNode::NodeContext subCollectContext = ProcedureNode::AnalysisContext); - ~IntegerCollect1DProcedureNode() override = default; - - /* - * Data - */ - private: - // Observable (and associated index thereof) to bin along x - std::pair, int> xObservable_{nullptr, 0}; - // Histogram in which to accumulate data - OptionalReferenceWrapper histogram_; - // Range of the histogram for QuantityX - std::optional minimum_; - std::optional maximum_; - - public: - // Return current data - Data1D data() const; - // Return accumulated data - const Data1D &accumulatedData() const; - - /* - * Branches - */ - private: - // Branch for subcollection, run if the target quantity is successfully binned - ProcedureNodeSequence subCollectBranch_; - - public: - // Return the branch from this node (if it has one) - OptionalReferenceWrapper branch() override; - - /* - * Execute - */ - public: - // Prepare any necessary data, ready for execution - bool prepare(const ProcedureContext &procedureContext) override; - // Execute node - bool execute(const ProcedureContext &procedureContext) override; - // Finalise any necessary data after execution - bool finalise(const ProcedureContext &procedureContext) override; -}; diff --git a/src/procedure/nodes/integrate1D.cpp b/src/procedure/nodes/integrate1D.cpp deleted file mode 100644 index f3d87de735..0000000000 --- a/src/procedure/nodes/integrate1D.cpp +++ /dev/null @@ -1,64 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#include "procedure/nodes/integrate1D.h" -#include "classes/box.h" -#include "classes/configuration.h" -#include "io/export/data1D.h" -#include "keywords/range.h" -#include "math/integrator.h" -#include "modules/analyse/analyse.h" -#include "procedure/nodes/operateBase.h" -#include "procedure/nodes/process1D.h" - -Integrate1DProcedureNode::Integrate1DProcedureNode(std::shared_ptr target) - : ProcedureNode(ProcedureNode::NodeType::Integrate1D, {ProcedureNode::AnalysisContext}), sourceData_(target) -{ - keywords_.setOrganisation("Options", "Target"); - keywords_.add>("SourceData", "Process1D node containing the data to integrate", - sourceData_, this, ProcedureNode::NodeType::Process1D, false); - - keywords_.setOrganisation("Options", "Ranges"); - keywords_.add("RangeA", "X range for first integration region", range_[0], Vec3Labels::MinMaxDeltaLabels); - keywords_.add("RangeB", "X range for second integration region", range_[1], Vec3Labels::MinMaxDeltaLabels); - keywords_.add("RangeC", "X range for third integration region", range_[2], Vec3Labels::MinMaxDeltaLabels); -} - -/* - * Data - */ - -// Return calculated integral -const SampledDouble &Integrate1DProcedureNode::integral(int index) const { return integral_[index]; } - -/* - * Execute - */ - -// Prepare any necessary data, ready for execution -bool Integrate1DProcedureNode::prepare(const ProcedureContext &procedureContext) -{ - if (!sourceData_) - return Messenger::error("No source Process1D node set in '{}'.\n", name()); - - return true; -} - -// Finalise any necessary data after execution -bool Integrate1DProcedureNode::finalise(const ProcedureContext &procedureContext) -{ - // Calculate integrals - integral_[0] += Integrator::trapezoid(sourceData_->processedData(), range_[0]); - integral_[1] += Integrator::trapezoid(sourceData_->processedData(), range_[1]); - integral_[2] += Integrator::trapezoid(sourceData_->processedData(), range_[2]); - - // Print info - Messenger::print("Integrate1D - Range A: {:e} +/- {:e} over {:e} < x < {:e}.\n", integral_[0].value(), integral_[0].stDev(), - range_[0].minimum(), range_[0].maximum()); - Messenger::print("Integrate1D - Range B: {:e} +/- {:e} over {:e} < x < {:e}.\n", integral_[1].value(), integral_[1].stDev(), - range_[1].minimum(), range_[1].maximum()); - Messenger::print("Integrate1D - Range C: {:e} +/- {:e} over {:e} < x < {:e}.\n", integral_[2].value(), integral_[2].stDev(), - range_[2].minimum(), range_[2].maximum()); - - return true; -} diff --git a/src/procedure/nodes/integrate1D.h b/src/procedure/nodes/integrate1D.h deleted file mode 100644 index af345ce890..0000000000 --- a/src/procedure/nodes/integrate1D.h +++ /dev/null @@ -1,44 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#pragma once - -#include "math/range.h" -#include "math/sampledDouble.h" -#include "procedure/nodes/node.h" - -// Forward Declarations -class Process1DProcedureNode; -class LineParser; - -// Procedure Node - Integrate1D -class Integrate1DProcedureNode : public ProcedureNode -{ - public: - Integrate1DProcedureNode(std::shared_ptr target = nullptr); - ~Integrate1DProcedureNode() override = default; - - /* - * Data - */ - private: - // Process1D node that we are targetting - std::shared_ptr sourceData_; - // Ranges for integration regions - Range range_[3] = {{0.0, 3.0}, {3.0, 6.0}, {6.0, 9.0}}; - // Calculated integral (stored in processing data list) - SampledDouble integral_[3]; - - public: - // Return calculated integral specified - const SampledDouble &integral(int index) const; - - /* - * Execute - */ - public: - // Prepare any necessary data, ready for execution - bool prepare(const ProcedureContext &procedureContext) override; - // Finalise any necessary data after execution - bool finalise(const ProcedureContext &procedureContext) override; -}; diff --git a/src/procedure/nodes/iterateData1D.cpp b/src/procedure/nodes/iterateData1D.cpp deleted file mode 100644 index c3cd30f4a3..0000000000 --- a/src/procedure/nodes/iterateData1D.cpp +++ /dev/null @@ -1,108 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#include "procedure/nodes/iterateData1D.h" -#include "classes/configuration.h" -#include "expression/variable.h" -#include "io/export/data1D.h" -#include "keywords/bool.h" -#include "keywords/fileAndFormat.h" -#include "keywords/nodeBranch.h" -#include "keywords/stdString.h" -#include "math/integrator.h" -#include "modules/analyse/analyse.h" -#include "procedure/nodes/collect1D.h" -#include "procedure/nodes/integerCollect1D.h" -#include "procedure/nodes/operateBase.h" - -IterateData1DProcedureNode::IterateData1DProcedureNode(std::shared_ptr target, - ProcedureNode::NodeContext forEachContext) - : ProcedureNode(ProcedureNode::NodeType::IterateData1D, {ProcedureNode::AnalysisContext}), sourceData_(target), - forEachBranch_(forEachContext, *this, "ForEach") -{ - setUpKeywords(); -} - -IterateData1DProcedureNode::IterateData1DProcedureNode(std::shared_ptr intTarget, - ProcedureNode::NodeContext forEachContext) - : ProcedureNode(ProcedureNode::NodeType::IterateData1D, {ProcedureNode::AnalysisContext}), sourceIntegerData_(intTarget), - forEachBranch_(forEachContext, *this, "ForEach") -{ - setUpKeywords(); -} - -// Set up keywords for node -void IterateData1DProcedureNode::setUpKeywords() -{ - keywords_.setOrganisation("Options", "Source"); - keywords_.add>("SourceData", "Collect1D node containing the histogram data to process", - sourceData_, this, ProcedureNode::NodeType::Collect1D, false); - keywords_.add>( - "SourceIntegerData", "IntegerCollect1D node containing the histogram data to process", sourceIntegerData_, this, - ProcedureNode::NodeType::IntegerCollect1D, false); - keywords_.addHidden("ForEach", "Branch to run on each site selected", forEachBranch_); - - xParameter_ = addParameter("x"); - valueParameter_ = addParameter("value"); -} - -/* - * Branch - */ -// Return the branch from this node (if it has one) -OptionalReferenceWrapper IterateData1DProcedureNode::branch() { return forEachBranch_; } - -/* - * Execute - */ - -// Prepare any necessary data, ready for execution -bool IterateData1DProcedureNode::prepare(const ProcedureContext &procedureContext) -{ - if (sourceData_ && sourceIntegerData_) - { - return Messenger::error("Specify either SourceData or SourceIntegerData, not both.\n"); - } - else if (sourceData_ || sourceIntegerData_) - { - return forEachBranch_.prepare(procedureContext); - } - else - return Messenger::error("No source data node set in '{}'.\n", name()); -} - -bool IterateData1DProcedureNode::execute(const ProcedureContext &procedureContext) -{ - // If a ForEach branch has been defined, process it for each of our sites in turn. Otherwise, we're done. - if (!forEachBranch_.empty()) - { - // Retrieve / realise the normalised data from the supplied list - auto &data = procedureContext.processingModuleData().realise(fmt::format("Process1D//{}", name()), - procedureContext.processingModuleDataPrefix(), - GenericItem::InRestartFileFlag); - data.setTag(name()); - - // Copy the averaged data from the associated Process1D node - if (instantaneous_) - data = sourceData_ ? sourceData_->data() : sourceIntegerData_->data(); - else - data = sourceData_ ? sourceData_->accumulatedData() : sourceIntegerData_->accumulatedData(); - - for (const auto &&[x, value] : zip(data.xAxis(), data.values())) - { - xParameter_->setValue(x); - valueParameter_->setValue(value); - - // If the branch fails at any point, return failure here. Otherwise, continue the loop - if (!forEachBranch_.execute(procedureContext)) - return false; - } - } - return true; -} - -// Finalise any necessary data after execution -bool IterateData1DProcedureNode::finalise(const ProcedureContext &procedureContext) -{ - return forEachBranch_.finalise(procedureContext); -} diff --git a/src/procedure/nodes/iterateData1D.h b/src/procedure/nodes/iterateData1D.h deleted file mode 100644 index 4256cf433b..0000000000 --- a/src/procedure/nodes/iterateData1D.h +++ /dev/null @@ -1,68 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#pragma once - -#include "io/export/data1D.h" -#include "procedure/nodes/node.h" -#include "procedure/nodes/sequence.h" - -// Forward Declarations -class Collect1DProcedureNode; -class Data1D; -class IntegerCollect1DProcedureNode; -class LineParser; - -// Procedure Node - IterateData1D -class IterateData1DProcedureNode : public ProcedureNode -{ - public: - IterateData1DProcedureNode(std::shared_ptr target = nullptr, - ProcedureNode::NodeContext forEachContext = ProcedureNode::NodeContext::AnalysisContext); - IterateData1DProcedureNode(std::shared_ptr intTarget, - ProcedureNode::NodeContext forEachContext = ProcedureNode::NodeContext::AnalysisContext); - ~IterateData1DProcedureNode() override = default; - - private: - // Set up keywords for node - void setUpKeywords(); - - /* - * Data - */ - private: - // Whether to use instantaneous data rather than accumulated data - bool instantaneous_{true}; - // Collect1D node that we are processing - std::shared_ptr sourceData_; - std::shared_ptr sourceIntegerData_; - - /* - * Parameters - */ - private: - // Pointers to individual parameters - std::shared_ptr xParameter_, valueParameter_; - - /* - * Branch - */ - private: - // Branch for ForEach - ProcedureNodeSequence forEachBranch_; - - public: - // Return the branch from this node (if it has one) - OptionalReferenceWrapper branch() override; - - /* - * Execute - */ - public: - // Prepare any necessary data, ready for execution - bool prepare(const ProcedureContext &procedureContext) override; - // Execute Node - bool execute(const ProcedureContext &procedureContect) override; - // Finalise any necessary data after execution - bool finalise(const ProcedureContext &procedureContext) override; -}; diff --git a/src/procedure/nodes/iterateSelection.cpp b/src/procedure/nodes/iterateSelection.cpp index bc5aca5a76..b5f5c8dc9c 100644 --- a/src/procedure/nodes/iterateSelection.cpp +++ b/src/procedure/nodes/iterateSelection.cpp @@ -23,7 +23,7 @@ IterateSelectionProcedureNode::IterateSelectionProcedureNode(ProcedureNode::Node { // Keywords keywords_.add>("Selection", "Target selection to iterate over", selection_, this, - ProcedureNode::NodeType::Select, true); + NodeTypeVector{NodeType::Select}, true); nSelectedParameter_ = addParameter("nSelected"); siteIndexParameter_ = addParameter("siteIndex"); diff --git a/src/procedure/nodes/node.cpp b/src/procedure/nodes/node.cpp index 36fc92caf3..ff1568af60 100644 --- a/src/procedure/nodes/node.cpp +++ b/src/procedure/nodes/node.cpp @@ -2,7 +2,6 @@ // Copyright (c) 2024 Team Dissolve and contributors #include "procedure/nodes/node.h" - #include "base/lineParser.h" #include "base/messenger.h" #include "base/sysFunc.h" @@ -13,15 +12,6 @@ #include #include -// Return enum option info for NodeClass -EnumOptions ProcedureNode::nodeClasses() -{ - return EnumOptions("NodeClass", {{ProcedureNode::NodeClass::None, "None"}, - {ProcedureNode::NodeClass::Calculate, "Calculate"}, - {ProcedureNode::NodeClass::Operate, "Operate"}, - {ProcedureNode::NodeClass::Region, "Region"}}); -} - // Return enum option info for NodeType EnumOptions ProcedureNode::nodeTypes() { @@ -29,14 +19,6 @@ EnumOptions ProcedureNode::nodeTypes() "NodeType", {{ProcedureNode::NodeType::Add, "Add"}, {ProcedureNode::NodeType::AddPair, "AddPair"}, {ProcedureNode::NodeType::Box, "Box"}, - {ProcedureNode::NodeType::CalculateAngle, "CalculateAngle"}, - {ProcedureNode::NodeType::CalculateAxisAngle, "CalculateAxisAngle"}, - {ProcedureNode::NodeType::CalculateDistance, "CalculateDistance"}, - {ProcedureNode::NodeType::CalculateExpression, "CalculateExpression"}, - {ProcedureNode::NodeType::CalculateVector, "CalculateVector"}, - {ProcedureNode::NodeType::Collect1D, "Collect1D"}, - {ProcedureNode::NodeType::Collect2D, "Collect2D"}, - {ProcedureNode::NodeType::Collect3D, "Collect3D"}, {ProcedureNode::NodeType::CoordinateSets, "CoordinateSets"}, {ProcedureNode::NodeType::Copy, "Copy"}, {ProcedureNode::NodeType::CustomRegion, "CustomRegion"}, @@ -45,26 +27,11 @@ EnumOptions ProcedureNode::nodeTypes() {ProcedureNode::NodeType::DynamicSite, "DynamicSite"}, {ProcedureNode::NodeType::GeneralRegion, "GeneralRegion"}, {ProcedureNode::NodeType::ImportCoordinates, "ImportCoordinates"}, - {ProcedureNode::NodeType::IntegerCollect1D, "IntegerCollect1D"}, {ProcedureNode::NodeType::IterateSelection, "IterateSelection"}, - {ProcedureNode::NodeType::IfValueInRange, "IfValueInRange"}, - {ProcedureNode::NodeType::Integrate1D, "Integrate1D"}, - {ProcedureNode::NodeType::IterateData1D, "IterateData1D"}, - {ProcedureNode::NodeType::OperateDivide, "OperateDivide"}, - {ProcedureNode::NodeType::OperateExpression, "OperateExpression"}, - {ProcedureNode::NodeType::OperateGridNormalise, "OperateGridNormalise"}, - {ProcedureNode::NodeType::OperateMultiply, "OperateMultiply"}, - {ProcedureNode::NodeType::OperateNormalise, "OperateNormalise"}, - {ProcedureNode::NodeType::OperateNumberDensityNormalise, "OperateNumberDensityNormalise"}, - {ProcedureNode::NodeType::OperateSitePopulationNormalise, "OperateSitePopulationNormalise"}, - {ProcedureNode::NodeType::OperateSphericalShellNormalise, "OperateSphericalShellNormalise"}, {ProcedureNode::NodeType::Parameters, "Parameters"}, {ProcedureNode::NodeType::Pick, "Pick"}, {ProcedureNode::NodeType::PickProximity, "PickProximity"}, {ProcedureNode::NodeType::PickRegion, "PickRegion"}, - {ProcedureNode::NodeType::Process1D, "Process1D"}, - {ProcedureNode::NodeType::Process2D, "Process2D"}, - {ProcedureNode::NodeType::Process3D, "Process3D"}, {ProcedureNode::NodeType::RegionalGlobalPotential, "RegionalGlobalPotential"}, {ProcedureNode::NodeType::Remove, "Remove"}, {ProcedureNode::NodeType::RestraintPotential, "RestraintPotential"}, @@ -74,7 +41,6 @@ EnumOptions ProcedureNode::nodeTypes() {ProcedureNode::NodeType::Sequence, "Sequence"}, {ProcedureNode::NodeType::SphericalGlobalPotential, "SphericalGlobalPotential"}, {ProcedureNode::NodeType::SizeFactor, "SizeFactor"}, - {ProcedureNode::NodeType::Sum1D, "Sum1D"}, {ProcedureNode::NodeType::Temperature, "Temperature"}, {ProcedureNode::NodeType::Transmute, "Transmute"}}); } @@ -99,9 +65,8 @@ EnumOptions ProcedureNode::nodeContexts() {ProcedureNode::InheritContext, "Inherit"}}); } -ProcedureNode::ProcedureNode(ProcedureNode::NodeType nodeType, std::vector relevantContexts, - ProcedureNode::NodeClass classType) - : type_(nodeType), relevantContexts_(std::move(relevantContexts)), class_(classType) +ProcedureNode::ProcedureNode(ProcedureNode::NodeType nodeType, std::vector relevantContexts) + : type_(nodeType), relevantContexts_(std::move(relevantContexts)) { } @@ -129,9 +94,6 @@ bool ProcedureNode::isContextRelevant(NodeContext targetContext) const return std::find(relevantContexts_.begin(), relevantContexts_.end(), targetContext) != relevantContexts_.end(); } -// Return whether the node is of the specified class -ProcedureNode::NodeClass ProcedureNode::nodeClass() const { return class_; } - // Return whether a name for the node must be provided bool ProcedureNode::mustBeNamed() const { return true; } @@ -185,33 +147,31 @@ ProcedureNode::NodeContext ProcedureNode::scopeContext() const // Return named node, optionally matching the type / class given, in or out of scope ConstNodeRef ProcedureNode::getNode(std::string_view name, bool onlyInScope, ConstNodeRef excludeNode, - std::optional optNodeType, - std::optional optNodeClass) const + const NodeTypeVector &allowedNodeTypes) const { if (!scope_) return nullptr; const auto &scope = (*scope_).get(); - return onlyInScope ? scope.nodeInScope(shared_from_this(), name, excludeNode, optNodeType, optNodeClass) - : scope.nodeExists(name, excludeNode, optNodeType, optNodeClass); + return onlyInScope ? scope.nodeInScope(shared_from_this(), name, excludeNode, allowedNodeTypes) + : scope.nodeExists(name, excludeNode, allowedNodeTypes); } // Return nodes, optionally matching the type / class given, in or out of scope -std::vector ProcedureNode::getNodes(bool onlyInScope, std::optional optNodeType, - std::optional optNodeClass) const +std::vector ProcedureNode::getNodes(bool onlyInScope, const NodeTypeVector &allowedNodeTypes) const { if (!scope_) return {}; if (onlyInScope) - return (*scope_).get().nodesInScope(shared_from_this(), optNodeType, optNodeClass); + return (*scope_).get().nodesInScope(shared_from_this(), allowedNodeTypes); // Find the topmost (root) scope and search from there. auto optScope = scope_; while (optScope->get().owner() && optScope->get().owner()->get().scope()) optScope = optScope->get().owner()->get().scope(); - return optScope->get().nodes(optNodeType, optNodeClass); + return optScope->get().nodes(allowedNodeTypes); } // Return the named parameter, in or out of scope diff --git a/src/procedure/nodes/node.h b/src/procedure/nodes/node.h index e1fc3be924..74979752b4 100644 --- a/src/procedure/nodes/node.h +++ b/src/procedure/nodes/node.h @@ -24,31 +24,12 @@ class Site; class ProcedureNode : public std::enable_shared_from_this, public Serialisable { public: - // Node Classes - enum class NodeClass - { - None, - Calculate, - Operate, - Pick, - Region - }; - // Return enum option info for NodeClass - static EnumOptions nodeClasses(); // Node Types enum class NodeType { Add, AddPair, Box, - CalculateAngle, - CalculateAxisAngle, - CalculateDistance, - CalculateExpression, - CalculateVector, - Collect1D, - Collect2D, - Collect3D, CoordinateSets, Copy, CustomRegion, @@ -57,26 +38,11 @@ class ProcedureNode : public std::enable_shared_from_this, public DynamicSite, GeneralRegion, ImportCoordinates, - IntegerCollect1D, - IfValueInRange, - Integrate1D, - IterateData1D, IterateSelection, - OperateDivide, - OperateExpression, - OperateGridNormalise, - OperateMultiply, - OperateNormalise, - OperateNumberDensityNormalise, - OperateSitePopulationNormalise, - OperateSphericalShellNormalise, Parameters, Pick, PickProximity, PickRegion, - Process1D, - Process2D, - Process3D, RegionalGlobalPotential, Remove, RestraintPotential, @@ -86,10 +52,11 @@ class ProcedureNode : public std::enable_shared_from_this, public Sequence, SphericalGlobalPotential, SizeFactor, - Sum1D, Temperature, Transmute }; + // Typedef for node type vector + using NodeTypeVector = std::vector; // Return enum option info for NodeType static EnumOptions nodeTypes(); // Return the lowerCamelCase name of the node type provided @@ -107,7 +74,7 @@ class ProcedureNode : public std::enable_shared_from_this, public }; // Return enum option info for NodeContext static EnumOptions nodeContexts(); - ProcedureNode(NodeType nodeType, std::vector relevantContexts, NodeClass nodeClass = NodeClass::None); + ProcedureNode(NodeType nodeType, std::vector relevantContexts); virtual ~ProcedureNode() = default; /* @@ -118,8 +85,6 @@ class ProcedureNode : public std::enable_shared_from_this, public NodeType type_; // Relevant contexts for node std::vector relevantContexts_; - // Node class - NodeClass class_; // Node name std::string name_; @@ -128,8 +93,6 @@ class ProcedureNode : public std::enable_shared_from_this, public NodeType type() const; // Return whether the supplied context is relevant for the current node bool isContextRelevant(NodeContext targetContext) const; - // Return node class - NodeClass nodeClass() const; // Return whether a name for the node must be provided virtual bool mustBeNamed() const; // Set node name @@ -167,11 +130,9 @@ class ProcedureNode : public std::enable_shared_from_this, public ProcedureNode::NodeContext scopeContext() const; // Return named node, optionally matching the type / class given, in or out of scope ConstNodeRef getNode(std::string_view name, bool onlyInScope, ConstNodeRef excludeNode = nullptr, - std::optional optNodeType = std::nullopt, - std::optional optNodeClass = std::nullopt) const; + const NodeTypeVector &allowedNodeTypes = {}) const; // Return nodes, optionally matching the type / class given, in or out of scope - std::vector getNodes(bool onlyInScope, std::optional optNodeType = std::nullopt, - std::optional optNodeClass = std::nullopt) const; + std::vector getNodes(bool onlyInScope, const NodeTypeVector &allowedNodeTypes = {}) const; // Return the named parameter, in or out of scope std::shared_ptr getParameter(std::string_view name, bool onlyInScope, std::shared_ptr excludeParameter = nullptr) const; diff --git a/src/procedure/nodes/nodeReference.cpp b/src/procedure/nodes/nodeReference.cpp deleted file mode 100644 index 66d817b815..0000000000 --- a/src/procedure/nodes/nodeReference.cpp +++ /dev/null @@ -1,100 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#include "procedure/nodes/nodeReference.h" -#include "base/lineParser.h" -#include "base/sysFunc.h" -#include "classes/coreData.h" -#include "modules/analyse/analyse.h" - -ProcedureNodeReference::ProcedureNodeReference(ConstNodeRef node) -{ - node_ = node; - - analyseModuleParent_ = nullptr; -} - -/* - * Data - */ - -// Return target node -ConstNodeRef ProcedureNodeReference::node() { return node_; } - -// Return node type -ProcedureNode::NodeType ProcedureNodeReference::type() const -{ - assert(node_); - return node_->type(); -} - -// Add allowable node type -void ProcedureNodeReference::addAllowableNodeType(ProcedureNode::NodeType nt) { allowedTypes_.push_back(nt); } - -// Return if node pointer is NULL -bool ProcedureNodeReference::isNull() const { return (node_ == nullptr); } - -/* - * Operators - */ - -void ProcedureNodeReference::operator=(ConstNodeRef node) { node_ = node; } - -void ProcedureNodeReference::operator=(const ProcedureNodeReference &nodeRef) -{ - node_ = nodeRef.node_; - allowedTypes_ = nodeRef.allowedTypes_; -} - -/* - * Read / Write second argument was provided we assume this is the name of an AnalyseModule - */ - -// Read structure from specified LineParser -bool ProcedureNodeReference::read(LineParser &parser, int startArg, const CoreData &coreData, const Procedure *procedure) -{ - node_ = nullptr; - - // If two arguments are provided, the second is the identifying name of an AnalyseModule - if (parser.nArgs() == (startArg + 2)) - { - Module *module = coreData.findModule(parser.argsv(startArg + 1)); - if (!module) - return Messenger::error("No Analyse module named '{}' exists.\n", parser.argsv(startArg + 1)); - if (module->type() != ModuleTypes::Analyse) - return Messenger::error("Specified module '{}' must be an Analyse module.\n", parser.argsv(startArg + 1)); - - // Found the target AnalyseModule, so cast it up and search for the named node in its Analyser - analyseModuleParent_ = dynamic_cast(module); - if (!analyseModuleParent_) - return Messenger::error("Couldn't cast module into an AnalyseModule.\n"); - - node_ = analyseModuleParent_->analyser().node(parser.argsv(startArg)); - - if (!node_) - return Messenger::error("No node named '{}' exists in the Analyse module specified ({}).\n", parser.argsv(startArg), - parser.argsv(startArg + 1)); - } - else - { - node_ = procedure->node(parser.argsv(startArg)); - - if (!node_) - return Messenger::error("No node named '{}' exists in the current Procedure.\n", parser.argsv(startArg)); - } - - // Check the type of the node - if (std::find(allowedTypes_.begin(), allowedTypes_.end(), node_->type()) == allowedTypes_.end()) - return Messenger::error("Node '{}' is not of the correct type.\n", node_->name()); - - return (node_ != nullptr); -} - -// Write structure to specified LineParser -bool ProcedureNodeReference::write(LineParser &parser, std::string_view prefix) -{ - if (analyseModuleParent_) - return parser.writeLineF("{} '{}' '{}'\n", prefix, node_->name(), analyseModuleParent_->name()); - else - return parser.writeLineF("{} '{}'\n", prefix, node_->name()); -} diff --git a/src/procedure/nodes/nodeReference.h b/src/procedure/nodes/nodeReference.h deleted file mode 100644 index 85145f9d3f..0000000000 --- a/src/procedure/nodes/nodeReference.h +++ /dev/null @@ -1,56 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#pragma once - -#include "procedure/nodes/node.h" - -// Forward Declarations -class AnalyseModule; -class CoreData; -class Procedure; - -// Procedure Node Reference -class ProcedureNodeReference -{ - public: - ProcedureNodeReference(ConstNodeRef node = nullptr); - ~ProcedureNodeReference() = default; - - /* - * Data - */ - private: - // Target node - ConstNodeRef node_; - // Parent AnalyseModule owning the node (if relevant) - AnalyseModule *analyseModuleParent_; - // Allowable node types (when reading / setting) - std::vector allowedTypes_; - - public: - // Return target node - ConstNodeRef node(); - // Return node type - ProcedureNode::NodeType type() const; - // Add allowable node type - void addAllowableNodeType(ProcedureNode::NodeType nt); - // Return if node pointer is NULL - bool isNull() const; - - /* - * Operators - */ - public: - void operator=(ConstNodeRef node); - void operator=(const ProcedureNodeReference &nodeRef); - - /* - * Read / Write - */ - public: - // Read structure from specified LineParser - bool read(LineParser &parser, int startArg, const CoreData &coreData, const Procedure *procedure); - // Write structure to specified LineParser - bool write(LineParser &parser, std::string_view prefix); -}; diff --git a/src/procedure/nodes/operateBase.cpp b/src/procedure/nodes/operateBase.cpp deleted file mode 100644 index 18e18ca98f..0000000000 --- a/src/procedure/nodes/operateBase.cpp +++ /dev/null @@ -1,88 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#include "procedure/nodes/operateBase.h" -#include "base/lineParser.h" -#include "base/sysFunc.h" - -OperateProcedureNodeBase::OperateProcedureNodeBase(ProcedureNode::NodeType nodeType) - : ProcedureNode(nodeType, {ProcedureNode::OperateContext}, ProcedureNode::NodeClass::Operate) -{ - targetData1D_ = nullptr; - targetData2D_ = nullptr; - targetData3D_ = nullptr; -} - -/* - * Identity - */ - -// Return whether a name for the node must be provided -bool OperateProcedureNodeBase::mustBeNamed() const { return false; } - -/* - * Data Target - */ - -// Set target Data1D -void OperateProcedureNodeBase::setTarget(Data1D *target) -{ - targetData1D_ = target; - targetData2D_ = nullptr; - targetData3D_ = nullptr; -} - -// Set target Data2D -void OperateProcedureNodeBase::setTarget(Data2D *target) -{ - targetData1D_ = nullptr; - targetData2D_ = target; - targetData3D_ = nullptr; -} - -// Set target Data3D -void OperateProcedureNodeBase::setTarget(Data3D *target) -{ - targetData1D_ = nullptr; - targetData2D_ = nullptr; - targetData3D_ = target; -} - -// Operate on Data1D target -bool OperateProcedureNodeBase::operateData1D(const ProcessPool &procPool, Configuration *cfg) -{ - return Messenger::error("The {} node can't operate on 1-dimensional data.\n", ProcedureNode::nodeTypes().keyword(type_)); -} - -// Operate on Data2D target -bool OperateProcedureNodeBase::operateData2D(const ProcessPool &procPool, Configuration *cfg) -{ - return Messenger::error("The {} node can't operate on 2-dimensional data.\n", ProcedureNode::nodeTypes().keyword(type_)); -} - -// Operate on Data3D target -bool OperateProcedureNodeBase::operateData3D(const ProcessPool &procPool, Configuration *cfg) -{ - return Messenger::error("The {} node can't operate on 3-dimensional data.\n", ProcedureNode::nodeTypes().keyword(type_)); -} - -/* - * Execute - */ - -// Prepare any necessary data, ready for execution -bool OperateProcedureNodeBase::prepare(const ProcedureContext &procedureContext) { return true; } - -// Execute node -bool OperateProcedureNodeBase::execute(const ProcedureContext &procedureContext) -{ - // Run the operation on any data target that exists - if (targetData1D_ && (!operateData1D(procedureContext.processPool(), procedureContext.configuration()))) - return false; - if (targetData2D_ && (!operateData2D(procedureContext.processPool(), procedureContext.configuration()))) - return false; - if (targetData3D_ && (!operateData3D(procedureContext.processPool(), procedureContext.configuration()))) - return false; - - return true; -} diff --git a/src/procedure/nodes/operateBase.h b/src/procedure/nodes/operateBase.h deleted file mode 100644 index c489c589f8..0000000000 --- a/src/procedure/nodes/operateBase.h +++ /dev/null @@ -1,61 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#pragma once - -#include "keywords/node.h" -#include "procedure/nodes/node.h" - -// Forward Declarations -class Data1D; -class Data2D; -class Data3D; - -// Operate Node Base -class OperateProcedureNodeBase : public ProcedureNode -{ - public: - OperateProcedureNodeBase(ProcedureNode::NodeType nodeType); - ~OperateProcedureNodeBase() override = default; - - /* - * Identity - */ - public: - // Return whether a name for the node must be provided - bool mustBeNamed() const override; - - /* - * Data Target - */ - protected: - // Target Data1D (if relevant) - Data1D *targetData1D_; - // Target Data2D (if relevant) - Data2D *targetData2D_; - // Target Data3D (if relevant) - Data3D *targetData3D_; - - public: - // Set target Data1D - void setTarget(Data1D *target); - // Set target Data2D - void setTarget(Data2D *target); - // Set target Data3D - void setTarget(Data3D *target); - // Operate on Data1D target - virtual bool operateData1D(const ProcessPool &procPool, Configuration *cfg); - // Operate on Data2D target - virtual bool operateData2D(const ProcessPool &procPool, Configuration *cfg); - // Operate on Data3D target - virtual bool operateData3D(const ProcessPool &procPool, Configuration *cfg); - - /* - * Execute - */ - public: - // Prepare any necessary data, ready for execution - bool prepare(const ProcedureContext &procedureContext) override; - // Execute node - bool execute(const ProcedureContext &procedureContext) override; -}; diff --git a/src/procedure/nodes/operateDivide.cpp b/src/procedure/nodes/operateDivide.cpp deleted file mode 100644 index 1aba955a9a..0000000000 --- a/src/procedure/nodes/operateDivide.cpp +++ /dev/null @@ -1,42 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#include "procedure/nodes/operateDivide.h" -#include "keywords/nodeValue.h" -#include "math/data1D.h" -#include "math/data2D.h" -#include "math/data3D.h" - -OperateDivideProcedureNode::OperateDivideProcedureNode() : OperateProcedureNodeBase(ProcedureNode::NodeType::OperateDivide) -{ - keywords_.setOrganisation("Options", "Inputs"); - keywords_.add("Value", "Constant value to use as the divisor", value_, this); -} - -/* - * Data Target (implements virtuals in OperateProcedureNodeBase) - */ - -// Operate on Data1D target -bool OperateDivideProcedureNode::operateData1D(const ProcessPool &procPool, Configuration *cfg) -{ - (*targetData1D_) /= value_.asDouble(); - - return true; -} - -// Operate on Data2D target -bool OperateDivideProcedureNode::operateData2D(const ProcessPool &procPool, Configuration *cfg) -{ - (*targetData2D_) /= value_.asDouble(); - - return true; -} - -// Operate on Data3D target -bool OperateDivideProcedureNode::operateData3D(const ProcessPool &procPool, Configuration *cfg) -{ - (*targetData3D_) /= value_.asDouble(); - - return true; -} diff --git a/src/procedure/nodes/operateDivide.h b/src/procedure/nodes/operateDivide.h deleted file mode 100644 index 0c64f12d31..0000000000 --- a/src/procedure/nodes/operateDivide.h +++ /dev/null @@ -1,33 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#pragma once - -#include "procedure/nodeValue.h" -#include "procedure/nodes/operateBase.h" - -// Operate Divide Node -class OperateDivideProcedureNode : public OperateProcedureNodeBase -{ - public: - OperateDivideProcedureNode(); - ~OperateDivideProcedureNode() override = default; - - /* - * Data - */ - private: - // Operating value - NodeValue value_{1.0}; - - /* - * Data Target (implements virtuals in OperateProcedureNodeBase) - */ - public: - // Operate on Data1D target - bool operateData1D(const ProcessPool &procPool, Configuration *cfg) override; - // Operate on Data2D target - bool operateData2D(const ProcessPool &procPool, Configuration *cfg) override; - // Operate on Data3D target - bool operateData3D(const ProcessPool &procPool, Configuration *cfg) override; -}; diff --git a/src/procedure/nodes/operateExpression.cpp b/src/procedure/nodes/operateExpression.cpp deleted file mode 100644 index 0e2608b8a5..0000000000 --- a/src/procedure/nodes/operateExpression.cpp +++ /dev/null @@ -1,169 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#include "procedure/nodes/operateExpression.h" -#include "expression/variable.h" -#include "keywords/expression.h" -#include "math/data1D.h" -#include "math/data2D.h" -#include "math/data3D.h" -#include "math/integrator.h" - -OperateExpressionProcedureNode::OperateExpressionProcedureNode(std::string_view expressionText) - : OperateProcedureNodeBase(ProcedureNode::NodeType::OperateExpression) -{ - // Create variables, and add them to the vector - x_ = expression_.addLocalVariable("x"); - y_ = expression_.addLocalVariable("y"); - z_ = expression_.addLocalVariable("z"); - xDelta_ = expression_.addLocalVariable("xDelta"); - yDelta_ = expression_.addLocalVariable("yDelta"); - zDelta_ = expression_.addLocalVariable("zDelta"); - value_ = expression_.addLocalVariable("value"); - - expression_.create(expressionText); - - keywords_.setOrganisation("Options", "Inputs"); - keywords_.add("Expression", "Expression to apply to values", expression_); -} - -// Set the expression -bool OperateExpressionProcedureNode::setExpression(std::string_view expressionText) -{ - return expression_.create(expressionText); -} - -// Zero all variables -void OperateExpressionProcedureNode::zeroVariables() -{ - x_->setValue(0.0); - y_->setValue(0.0); - z_->setValue(0.0); - xDelta_->setValue(0.0); - yDelta_->setValue(0.0); - zDelta_->setValue(0.0); - value_->setValue(0.0); -} - -/* - * Data Target (implements virtuals in OperateProcedureNodeBase) - */ - -// Operate on Data1D target -bool OperateExpressionProcedureNode::operateData1D(const ProcessPool &procPool, Configuration *cfg) -{ - zeroVariables(); - - const auto &x = targetData1D_->xAxis(); - auto &values = targetData1D_->values(); - - // Set data-related quantities - if (x.size() > 1) - xDelta_->setValue(x[1] - x[0]); - else - Messenger::warn("OperateExpression: Not enough data to calculate x delta ({}).\n", targetData1D_->tag()); - - // Evaluate the expression over all values - for (auto i = 0; i < x.size(); ++i) - { - // Set variables in expression - x_->setValue(x[i]); - value_->setValue(values.at(i)); - - // Evaluate and store new value - values.at(i) = expression_.asDouble(); - } - - return true; -} - -// Operate on Data2D target -bool OperateExpressionProcedureNode::operateData2D(const ProcessPool &procPool, Configuration *cfg) -{ - zeroVariables(); - - const auto &x = targetData2D_->xAxis(); - const auto &y = targetData2D_->yAxis(); - auto &values = targetData2D_->values(); - - // Set data-related quantities - if (x.size() > 1) - xDelta_->setValue(x[1] - x[0]); - else - Messenger::warn("OperateExpression: Not enough data to calculate x delta ({}).\n", targetData2D_->tag()); - if (y.size() > 1) - yDelta_->setValue(y[1] - y[0]); - else - Messenger::warn("OperateExpression: Not enough data to calculate y delta ({}).\n", targetData2D_->tag()); - - // Evaluate the expression over all values - for (auto i = 0; i < x.size(); ++i) - { - // Set x value in expression - x_->setValue(x[i]); - - for (auto j = 0; j < y.size(); ++j) - { - // Set y and value in expression - y_->setValue(y[j]); - value_->setValue(values[{i, j}]); - - // Evaluate and store new value - values[{i, j}] = expression_.asDouble(); - } - } - - return true; -} - -// Operate on Data3D target -bool OperateExpressionProcedureNode::operateData3D(const ProcessPool &procPool, Configuration *cfg) -{ - zeroVariables(); - - const auto &x = targetData3D_->xAxis(); - const auto &y = targetData3D_->yAxis(); - const auto &z = targetData3D_->zAxis(); - auto &values = targetData3D_->values(); - - // Set data-related quantities - if (x.size() > 1) - xDelta_->setValue(x[1] - x[0]); - else - Messenger::warn("OperateExpression: Not enough data to calculate x delta ({}).\n", targetData3D_->tag()); - if (y.size() > 1) - yDelta_->setValue(y[1] - y[0]); - else - Messenger::warn("OperateExpression: Not enough data to calculate y delta ({}).\n", targetData3D_->tag()); - if (z.size() > 1) - zDelta_->setValue(y[1] - y[0]); - else - Messenger::warn("OperateExpression: Not enough data to calculate z delta ({}).\n", targetData3D_->tag()); - - // Evaluate the expression over all values - for (auto i = 0; i < x.size(); ++i) - { - // Set x value in expression - x_->setValue(x[i]); - - for (auto j = 0; j < y.size(); ++j) - { - // Set y value in expression - y_->setValue(y[j]); - - for (auto k = 0; k < z.size(); ++k) - { - // Set z and value in expression - z_->setValue(z[k]); - // TODO: Convert to a single loop when we have the - // iterator combiner - value_->setValue(values[std::tuple{i, j, k}]); - - // Evaluate and store new value - values[std::tuple{i, j, k}] = expression_.asDouble(); - } - } - } - - return true; -} diff --git a/src/procedure/nodes/operateExpression.h b/src/procedure/nodes/operateExpression.h deleted file mode 100644 index 8e3512d546..0000000000 --- a/src/procedure/nodes/operateExpression.h +++ /dev/null @@ -1,43 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#pragma once - -#include "expression/expression.h" -#include "procedure/nodes/operateBase.h" - -// Operate Expression Node -class OperateExpressionProcedureNode : public OperateProcedureNodeBase -{ - public: - OperateExpressionProcedureNode(std::string_view expressionText = ""); - ~OperateExpressionProcedureNode() override = default; - - /* - * Expression and Variables - */ - private: - // Expression - Expression expression_; - // Local variables for the transform equation - std::shared_ptr x_, y_, z_, xDelta_, yDelta_, zDelta_, value_; - - private: - // Zero all variables - void zeroVariables(); - - public: - // Set the expression - bool setExpression(std::string_view expressionText); - - /* - * Data Target (implements virtuals in OperateProcedureNodeBase) - */ - public: - // Operate on Data1D target - bool operateData1D(const ProcessPool &procPool, Configuration *cfg) override; - // Operate on Data2D target - bool operateData2D(const ProcessPool &procPool, Configuration *cfg) override; - // Operate on Data3D target - bool operateData3D(const ProcessPool &procPool, Configuration *cfg) override; -}; diff --git a/src/procedure/nodes/operateGridNormalise.cpp b/src/procedure/nodes/operateGridNormalise.cpp deleted file mode 100644 index 8d67942220..0000000000 --- a/src/procedure/nodes/operateGridNormalise.cpp +++ /dev/null @@ -1,75 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#include "procedure/nodes/operateGridNormalise.h" -#include "base/lineParser.h" -#include "classes/configuration.h" -#include "classes/species.h" -#include "math/data2D.h" -#include "math/data3D.h" -#include "procedure/nodes/select.h" - -OperateGridNormaliseProcedureNode::OperateGridNormaliseProcedureNode() - : OperateProcedureNodeBase(ProcedureNode::NodeType::OperateGridNormalise) -{ -} - -/* - * Data Target (implements virtuals in OperateProcedureNodeBase) - */ - -// Operate on Data1D target -bool OperateGridNormaliseProcedureNode::operateData1D(const ProcessPool &procPool, Configuration *cfg) -{ - if (targetData1D_->xAxis().size() < 2) - return Messenger::error("Not enough data to determine 1D grid spacing for normalisation.\n"); - - // Determine bin width from first points of data - double xBinWidth = targetData1D_->xAxis().at(1) - targetData1D_->xAxis().at(0); - Messenger::print("OperateGridNormalise - Grid point spacing is {:e}.\n", xBinWidth); - - (*targetData1D_) /= xBinWidth; - - return true; -} - -// Operate on Data2D target -bool OperateGridNormaliseProcedureNode::operateData2D(const ProcessPool &procPool, Configuration *cfg) -{ - if (targetData2D_->xAxis().size() < 2) - return Messenger::error("Not enough data to determine 2D grid spacing for normalisation.\n"); - if (targetData2D_->yAxis().size() < 2) - return Messenger::error("Not enough data to determine 2D grid spacing for normalisation.\n"); - - // Determine bin area from first points of data - double xBinWidth = targetData2D_->xAxis().at(1) - targetData2D_->xAxis().at(0); - double yBinWidth = targetData2D_->yAxis().at(1) - targetData2D_->yAxis().at(0); - double binArea = xBinWidth * yBinWidth; - Messenger::print("OperateGridNormalise - Grid pixel area is {:e}.\n", binArea); - - (*targetData2D_) /= binArea; - - return true; -} - -// Operate on Data3D target -bool OperateGridNormaliseProcedureNode::operateData3D(const ProcessPool &procPool, Configuration *cfg) -{ - if (targetData3D_->xAxis().size() < 2) - return Messenger::error("Not enough data to determine 3D grid spacing for normalisation.\n"); - if (targetData3D_->yAxis().size() < 2) - return Messenger::error("Not enough data to determine 3D grid spacing for normalisation.\n"); - if (targetData3D_->zAxis().size() < 2) - return Messenger::error("Not enough data to determine 3D grid spacing for normalisation.\n"); - - // Determine bin area from first points of data - double xBinWidth = targetData3D_->xAxis().at(1) - targetData3D_->xAxis().at(0); - double yBinWidth = targetData3D_->yAxis().at(1) - targetData3D_->yAxis().at(0); - double zBinWidth = targetData3D_->zAxis().at(1) - targetData3D_->zAxis().at(0); - double binVolume = xBinWidth * yBinWidth * zBinWidth; - Messenger::print("OperateGridNormalise - Grid voxel volume is {:e}.\n", binVolume); - - (*targetData3D_) /= binVolume; - - return true; -} diff --git a/src/procedure/nodes/operateGridNormalise.h b/src/procedure/nodes/operateGridNormalise.h deleted file mode 100644 index 61c866fb86..0000000000 --- a/src/procedure/nodes/operateGridNormalise.h +++ /dev/null @@ -1,25 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#pragma once - -#include "procedure/nodes/operateBase.h" - -// Operate Grid Normalise Node -class OperateGridNormaliseProcedureNode : public OperateProcedureNodeBase -{ - public: - OperateGridNormaliseProcedureNode(); - ~OperateGridNormaliseProcedureNode() override = default; - - /* - * Data Target (implements virtuals in OperateProcedureNodeBase) - */ - public: - // Operate on Data1D target - bool operateData1D(const ProcessPool &procPool, Configuration *cfg) override; - // Operate on Data2D target - bool operateData2D(const ProcessPool &procPool, Configuration *cfg) override; - // Operate on Data3D target - bool operateData3D(const ProcessPool &procPool, Configuration *cfg) override; -}; diff --git a/src/procedure/nodes/operateMultiply.cpp b/src/procedure/nodes/operateMultiply.cpp deleted file mode 100644 index 1ed9acf030..0000000000 --- a/src/procedure/nodes/operateMultiply.cpp +++ /dev/null @@ -1,43 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#include "procedure/nodes/operateMultiply.h" -#include "keywords/nodeValue.h" -#include "math/data1D.h" -#include "math/data2D.h" -#include "math/data3D.h" - -OperateMultiplyProcedureNode::OperateMultiplyProcedureNode() - : OperateProcedureNodeBase(ProcedureNode::NodeType::OperateMultiply) -{ - keywords_.setOrganisation("Options", "Inputs"); - keywords_.add("Value", "Constant value to use as the multiplier", value_, this); -} - -/* - * Data Target (implements virtuals in OperateProcedureNodeBase) - */ - -// Operate on Data1D target -bool OperateMultiplyProcedureNode::operateData1D(const ProcessPool &procPool, Configuration *cfg) -{ - (*targetData1D_) *= value_.asDouble(); - - return true; -} - -// Operate on Data2D target -bool OperateMultiplyProcedureNode::operateData2D(const ProcessPool &procPool, Configuration *cfg) -{ - (*targetData2D_) *= value_.asDouble(); - - return true; -} - -// Operate on Data3D target -bool OperateMultiplyProcedureNode::operateData3D(const ProcessPool &procPool, Configuration *cfg) -{ - (*targetData3D_) *= value_.asDouble(); - - return true; -} diff --git a/src/procedure/nodes/operateMultiply.h b/src/procedure/nodes/operateMultiply.h deleted file mode 100644 index 0f1e3499b7..0000000000 --- a/src/procedure/nodes/operateMultiply.h +++ /dev/null @@ -1,33 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#pragma once - -#include "procedure/nodeValue.h" -#include "procedure/nodes/operateBase.h" - -// Operate Multiply Node -class OperateMultiplyProcedureNode : public OperateProcedureNodeBase -{ - public: - OperateMultiplyProcedureNode(); - ~OperateMultiplyProcedureNode() override = default; - - /* - * Data - */ - private: - // Operating value - NodeValue value_{1.0}; - - /* - * Data Target (implements virtuals in OperateProcedureNodeBase) - */ - public: - // Operate on Data1D target - bool operateData1D(const ProcessPool &procPool, Configuration *cfg) override; - // Operate on Data2D target - bool operateData2D(const ProcessPool &procPool, Configuration *cfg) override; - // Operate on Data3D target - bool operateData3D(const ProcessPool &procPool, Configuration *cfg) override; -}; diff --git a/src/procedure/nodes/operateNormalise.cpp b/src/procedure/nodes/operateNormalise.cpp deleted file mode 100644 index eecd1136af..0000000000 --- a/src/procedure/nodes/operateNormalise.cpp +++ /dev/null @@ -1,57 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#include "procedure/nodes/operateNormalise.h" -#include "keywords/bool.h" -#include "keywords/nodeValue.h" -#include "math/data1D.h" -#include "math/data2D.h" -#include "math/data3D.h" -#include "math/integrator.h" - -OperateNormaliseProcedureNode::OperateNormaliseProcedureNode(double value) - : OperateProcedureNodeBase(ProcedureNode::NodeType::OperateNormalise), value_{value} -{ - keywords_.setOrganisation("Options", "Inputs"); - keywords_.add("Value", "Constant value to normalise to", value_, this); - keywords_.add("Absolute", "Normalise absolute sum of values rather than direct sum", absolute_); -} - -/* - * Data Target (implements virtuals in OperateProcedureNodeBase) - */ - -// Operate on Data1D target -bool OperateNormaliseProcedureNode::operateData1D(const ProcessPool &procPool, Configuration *cfg) -{ - // Get sum of absolute values - auto sum = absolute_ ? Integrator::absSum(*targetData1D_) : Integrator::sum(*targetData1D_); - - (*targetData1D_) /= sum; - (*targetData1D_) *= value_.asDouble(); - - return true; -} - -// Operate on Data2D target -bool OperateNormaliseProcedureNode::operateData2D(const ProcessPool &procPool, Configuration *cfg) -{ - // Get sum of absolute values - auto sum = absolute_ ? Integrator::absSum(*targetData2D_) : Integrator::sum(*targetData2D_); - (*targetData2D_) /= sum; - (*targetData2D_) *= value_.asDouble(); - - return true; -} - -// Operate on Data3D target -bool OperateNormaliseProcedureNode::operateData3D(const ProcessPool &procPool, Configuration *cfg) -{ - // Get sum of absolute values - auto sum = absolute_ ? Integrator::absSum(*targetData3D_) : Integrator::sum(*targetData3D_); - - (*targetData3D_) /= sum; - (*targetData3D_) *= value_.asDouble(); - - return true; -} diff --git a/src/procedure/nodes/operateNormalise.h b/src/procedure/nodes/operateNormalise.h deleted file mode 100644 index 374ca763de..0000000000 --- a/src/procedure/nodes/operateNormalise.h +++ /dev/null @@ -1,35 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#pragma once - -#include "procedure/nodeValue.h" -#include "procedure/nodes/operateBase.h" - -// Operate Value Normalise Node -class OperateNormaliseProcedureNode : public OperateProcedureNodeBase -{ - public: - explicit OperateNormaliseProcedureNode(double value = 1.0); - ~OperateNormaliseProcedureNode() override = default; - - /* - * Data - */ - private: - // Operating value - NodeValue value_{1.0}; - // Whether to normalise absolute sum of values rather than direct sum - bool absolute_{true}; - - /* - * Data Target (implements virtuals in OperateProcedureNodeBase) - */ - public: - // Operate on Data1D target - bool operateData1D(const ProcessPool &procPool, Configuration *cfg) override; - // Operate on Data2D target - bool operateData2D(const ProcessPool &procPool, Configuration *cfg) override; - // Operate on Data3D target - bool operateData3D(const ProcessPool &procPool, Configuration *cfg) override; -}; diff --git a/src/procedure/nodes/operateNumberDensityNormalise.cpp b/src/procedure/nodes/operateNumberDensityNormalise.cpp deleted file mode 100644 index 340f05b95e..0000000000 --- a/src/procedure/nodes/operateNumberDensityNormalise.cpp +++ /dev/null @@ -1,66 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#include "procedure/nodes/operateNumberDensityNormalise.h" -#include "classes/configuration.h" -#include "classes/species.h" -#include "keywords/enumOptions.h" -#include "keywords/nodeVector.h" -#include "math/data1D.h" -#include "math/data2D.h" -#include "math/data3D.h" -#include "procedure/nodes/select.h" - -OperateNumberDensityNormaliseProcedureNode::OperateNumberDensityNormaliseProcedureNode( - ConstNodeVector nodes, SelectProcedureNode::SelectionPopulation populationTarget) - : OperateProcedureNodeBase(ProcedureNode::NodeType::OperateNumberDensityNormalise), - normalisationSites_(std::move(nodes)), targetPopulation_{populationTarget} -{ - keywords_.setOrganisation("Options", "Inputs"); - keywords_.add>("Site", - "Site(s) by which to normalise data based on their population", - normalisationSites_, this, ProcedureNode::NodeType::Select, false); - keywords_.add>( - "Population", "Target population quantity to use in normalisation", targetPopulation_, - SelectProcedureNode::selectionPopulations()); -} - -/* - * Data Target (implements virtuals in OperateProcedureNodeBase) - */ - -// Operate on Data1D target -bool OperateNumberDensityNormaliseProcedureNode::operateData1D(const ProcessPool &procPool, Configuration *cfg) -{ - for (const auto &node : normalisationSites_) - if (targetPopulation_ == SelectProcedureNode::SelectionPopulation::Average) - (*targetData1D_) /= (node->nAverageSites() / cfg->box()->volume()); - else if (targetPopulation_ == SelectProcedureNode::SelectionPopulation::Available) - (*targetData1D_) /= (node->nAvailableSitesAverage() / cfg->box()->volume()); - - return true; -} - -// Operate on Data2D target -bool OperateNumberDensityNormaliseProcedureNode::operateData2D(const ProcessPool &procPool, Configuration *cfg) -{ - for (const auto &node : normalisationSites_) - if (targetPopulation_ == SelectProcedureNode::SelectionPopulation::Average) - (*targetData2D_) /= (node->nAverageSites() / cfg->box()->volume()); - else if (targetPopulation_ == SelectProcedureNode::SelectionPopulation::Available) - (*targetData2D_) /= (node->nAvailableSitesAverage() / cfg->box()->volume()); - - return true; -} - -// Operate on Data3D target -bool OperateNumberDensityNormaliseProcedureNode::operateData3D(const ProcessPool &procPool, Configuration *cfg) -{ - for (const auto &node : normalisationSites_) - if (targetPopulation_ == SelectProcedureNode::SelectionPopulation::Average) - (*targetData3D_) /= (node->nAverageSites() / cfg->box()->volume()); - else if (targetPopulation_ == SelectProcedureNode::SelectionPopulation::Available) - (*targetData3D_) /= (node->nAvailableSitesAverage() / cfg->box()->volume()); - - return true; -} diff --git a/src/procedure/nodes/operateNumberDensityNormalise.h b/src/procedure/nodes/operateNumberDensityNormalise.h deleted file mode 100644 index 74d0ace520..0000000000 --- a/src/procedure/nodes/operateNumberDensityNormalise.h +++ /dev/null @@ -1,37 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#pragma once - -#include "procedure/nodes/operateBase.h" -#include "procedure/nodes/select.h" - -// Operate Number Density Normalise Node -class OperateNumberDensityNormaliseProcedureNode : public OperateProcedureNodeBase -{ - public: - OperateNumberDensityNormaliseProcedureNode( - ConstNodeVector nodes = {}, - SelectProcedureNode::SelectionPopulation populationTarget = SelectProcedureNode::SelectionPopulation::Available); - ~OperateNumberDensityNormaliseProcedureNode() override = default; - - /* - * Control - */ - private: - // Select nodes containing sites for normalisation - ConstNodeVector normalisationSites_; - // Target population to normalise against - SelectProcedureNode::SelectionPopulation targetPopulation_; - - /* - * Data Target (implements virtuals in OperateProcedureNodeBase) - */ - public: - // Operate on Data1D target - bool operateData1D(const ProcessPool &procPool, Configuration *cfg) override; - // Operate on Data2D target - bool operateData2D(const ProcessPool &procPool, Configuration *cfg) override; - // Operate on Data3D target - bool operateData3D(const ProcessPool &procPool, Configuration *cfg) override; -}; diff --git a/src/procedure/nodes/operateSitePopulationNormalise.cpp b/src/procedure/nodes/operateSitePopulationNormalise.cpp deleted file mode 100644 index 01343a0f26..0000000000 --- a/src/procedure/nodes/operateSitePopulationNormalise.cpp +++ /dev/null @@ -1,51 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#include "procedure/nodes/operateSitePopulationNormalise.h" -#include "classes/configuration.h" -#include "classes/species.h" -#include "keywords/nodeVector.h" -#include "math/data2D.h" -#include "math/data3D.h" -#include "procedure/nodes/select.h" - -OperateSitePopulationNormaliseProcedureNode::OperateSitePopulationNormaliseProcedureNode( - ConstNodeVector sites) - : OperateProcedureNodeBase(ProcedureNode::NodeType::OperateSitePopulationNormalise), normalisationSites_(std::move(sites)) -{ - keywords_.setOrganisation("Options", "Inputs"); - keywords_.add>("Site", - "Site(s) by which to normalise data based on their population", - normalisationSites_, this, ProcedureNode::NodeType::Select, false); -} - -/* - * Data Target (implements virtuals in OperateProcedureNodeBase) - */ - -// Operate on Data1D target -bool OperateSitePopulationNormaliseProcedureNode::operateData1D(const ProcessPool &procPool, Configuration *cfg) -{ - for (const auto node : normalisationSites_) - (*targetData1D_) /= node->nAverageSites(); - - return true; -} - -// Operate on Data2D target -bool OperateSitePopulationNormaliseProcedureNode::operateData2D(const ProcessPool &procPool, Configuration *cfg) -{ - for (const auto node : normalisationSites_) - (*targetData2D_) /= node->nAverageSites(); - - return true; -} - -// Operate on Data3D target -bool OperateSitePopulationNormaliseProcedureNode::operateData3D(const ProcessPool &procPool, Configuration *cfg) -{ - for (const auto node : normalisationSites_) - (*targetData3D_) /= node->nAverageSites(); - - return true; -} diff --git a/src/procedure/nodes/operateSitePopulationNormalise.h b/src/procedure/nodes/operateSitePopulationNormalise.h deleted file mode 100644 index a25e713ff5..0000000000 --- a/src/procedure/nodes/operateSitePopulationNormalise.h +++ /dev/null @@ -1,35 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#pragma once - -#include "procedure/nodes/operateBase.h" - -// Forward Declarations -class SelectProcedureNode; - -// Operate Site Population Normalise Node -class OperateSitePopulationNormaliseProcedureNode : public OperateProcedureNodeBase -{ - public: - OperateSitePopulationNormaliseProcedureNode(ConstNodeVector sites = {}); - ~OperateSitePopulationNormaliseProcedureNode() override = default; - - /* - * Control - */ - private: - // Select nodes containing sites for normalisation - ConstNodeVector normalisationSites_; - - /* - * Data Target (implements virtuals in OperateProcedureNodeBase) - */ - public: - // Operate on Data1D target - bool operateData1D(const ProcessPool &procPool, Configuration *cfg) override; - // Operate on Data2D target - bool operateData2D(const ProcessPool &procPool, Configuration *cfg) override; - // Operate on Data3D target - bool operateData3D(const ProcessPool &procPool, Configuration *cfg) override; -}; diff --git a/src/procedure/nodes/operateSphericalShellNormalise.cpp b/src/procedure/nodes/operateSphericalShellNormalise.cpp deleted file mode 100644 index 7de9b3a14f..0000000000 --- a/src/procedure/nodes/operateSphericalShellNormalise.cpp +++ /dev/null @@ -1,84 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#include "procedure/nodes/operateSphericalShellNormalise.h" -#include "base/lineParser.h" -#include "base/sysFunc.h" -#include "classes/box.h" -#include "classes/configuration.h" -#include "classes/species.h" -#include "math/data2D.h" -#include "procedure/nodes/select.h" - -OperateSphericalShellNormaliseProcedureNode::OperateSphericalShellNormaliseProcedureNode() - : OperateProcedureNodeBase(ProcedureNode::NodeType::OperateSphericalShellNormalise) -{ -} - -/* - * Data Target (implements virtuals in OperateProcedureNodeBase) - */ - -// Operate on Data1D target -bool OperateSphericalShellNormaliseProcedureNode::operateData1D(const ProcessPool &procPool, Configuration *cfg) -{ - // We expect x values to be centre-bin values, and regularly spaced - const auto &xAxis = targetData1D_->xAxis(); - auto &values = targetData1D_->values(); - if (xAxis.size() < 2) - return true; - - // Derive first left-bin boundary from the delta between points 0 and 1 - double leftBin = xAxis[0] - (xAxis[1] - xAxis[0]) * 0.5, rightBin, divisor; - double r1Cubed = pow(leftBin, 3), r2Cubed; - for (auto n = 0; n < xAxis.size(); ++n) - { - // Get new right-bin from existing left bin boundary and current bin centre - rightBin = leftBin + 2 * (xAxis[n] - leftBin); - r2Cubed = pow(rightBin, 3); - divisor = (4.0 / 3.0) * PI * (r2Cubed - r1Cubed); - values[n] /= divisor; - if (targetData1D_->valuesHaveErrors()) - targetData1D_->error(n) /= divisor; - - // Overwrite old values - r1Cubed = r2Cubed; - leftBin = rightBin; - } - - return true; -} - -// Operate on Data2D target -bool OperateSphericalShellNormaliseProcedureNode::operateData2D(const ProcessPool &procPool, Configuration *cfg) -{ - // We expect x values to be centre-bin values, and regularly spaced - const auto &xAxis = targetData2D_->xAxis(); - const auto &yAxis = targetData2D_->yAxis(); - auto &values = targetData2D_->values(); - if (xAxis.size() < 2) - return true; - - // Derive first left-bin boundary from the delta between points 0 and 1 - double leftBin = xAxis[0] - (xAxis[1] - xAxis[0]) * 0.5, rightBin, divisor; - double r1Cubed = pow(leftBin, 3), r2Cubed; - for (auto n = 0; n < xAxis.size(); ++n) - { - for (auto m = 0; m < yAxis.size(); ++m) - { - // Get new right-bin from existing left bin boundary and current bin centre - rightBin = leftBin + 2 * (xAxis[n] - leftBin); - r2Cubed = pow(rightBin, 3); - divisor = (4.0 / 3.0) * PI * (r2Cubed - r1Cubed); - values[{n, m}] /= divisor; - if (targetData2D_->valuesHaveErrors()) - targetData2D_->error(n, m) /= divisor; - } - - // Overwrite old values - r1Cubed = r2Cubed; - leftBin = rightBin; - } - - return true; -} diff --git a/src/procedure/nodes/operateSphericalShellNormalise.h b/src/procedure/nodes/operateSphericalShellNormalise.h deleted file mode 100644 index 1c18d7bd89..0000000000 --- a/src/procedure/nodes/operateSphericalShellNormalise.h +++ /dev/null @@ -1,23 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#pragma once - -#include "procedure/nodes/operateBase.h" - -// Operate Spherical Shell Normalise Node -class OperateSphericalShellNormaliseProcedureNode : public OperateProcedureNodeBase -{ - public: - OperateSphericalShellNormaliseProcedureNode(); - ~OperateSphericalShellNormaliseProcedureNode() override = default; - - /* - * Data Target (implements virtuals in OperateProcedureNodeBase) - */ - public: - // Operate on Data1D target - bool operateData1D(const ProcessPool &procPool, Configuration *cfg) override; - // Operate on Data2D target - bool operateData2D(const ProcessPool &procPool, Configuration *cfg) override; -}; diff --git a/src/procedure/nodes/pickBase.cpp b/src/procedure/nodes/pickBase.cpp index 4bcf47d061..a49a3175cd 100644 --- a/src/procedure/nodes/pickBase.cpp +++ b/src/procedure/nodes/pickBase.cpp @@ -6,11 +6,12 @@ #include "keywords/node.h" PickProcedureNodeBase::PickProcedureNodeBase(ProcedureNode::NodeType nodeType) - : ProcedureNode(nodeType, {ProcedureNode::GenerationContext}, ProcedureNode::NodeClass::Pick), selection_(nullptr) + : ProcedureNode(nodeType, {ProcedureNode::GenerationContext}), selection_(nullptr) { keywords_.setOrganisation("Options", "Restrictions"); - keywords_.add>("From", "Existing picked selection of molecules from which to pick", - selection_, this, ProcedureNode::NodeClass::Pick, true); + keywords_.add>( + "From", "Existing picked selection of molecules from which to pick", selection_, this, + NodeTypeVector{NodeType::Pick, NodeType::PickProximity, NodeType::PickRegion}, true); } /* diff --git a/src/procedure/nodes/pickRegion.cpp b/src/procedure/nodes/pickRegion.cpp index 145a25145a..e41869b56d 100644 --- a/src/procedure/nodes/pickRegion.cpp +++ b/src/procedure/nodes/pickRegion.cpp @@ -11,8 +11,9 @@ PickRegionProcedureNode::PickRegionProcedureNode(std::shared_ptr>("Region", "Region containing molecules that should be picked", region_, - this, ProcedureNode::NodeClass::Region, true); + keywords_.add>( + "Region", "Region containing molecules that should be picked", region_, this, + NodeTypeVector{NodeType::CylindricalRegion, NodeType::GeneralRegion, NodeType::CustomRegion}, true); } /* diff --git a/src/procedure/nodes/process1D.cpp b/src/procedure/nodes/process1D.cpp deleted file mode 100644 index ca4d3880c1..0000000000 --- a/src/procedure/nodes/process1D.cpp +++ /dev/null @@ -1,163 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#include "procedure/nodes/process1D.h" -#include "classes/configuration.h" -#include "io/export/data1D.h" -#include "keywords/bool.h" -#include "keywords/fileAndFormat.h" -#include "keywords/nodeBranch.h" -#include "keywords/stdString.h" -#include "math/integrator.h" -#include "modules/analyse/analyse.h" -#include "procedure/nodes/collect1D.h" -#include "procedure/nodes/integerCollect1D.h" -#include "procedure/nodes/operateBase.h" - -Process1DProcedureNode::Process1DProcedureNode(std::shared_ptr target, - ProcedureNode::NodeContext normalisationContext) - : ProcedureNode(ProcedureNode::NodeType::Process1D, {ProcedureNode::AnalysisContext}), sourceData_(target), - normalisationBranch_(normalisationContext, *this, "Normalisation") -{ - setUpKeywords(); -} - -Process1DProcedureNode::Process1DProcedureNode(std::shared_ptr intTarget, - ProcedureNode::NodeContext normalisationContext) - : ProcedureNode(ProcedureNode::NodeType::Process1D, {ProcedureNode::AnalysisContext}), sourceIntegerData_(intTarget), - normalisationBranch_(normalisationContext, *this, "Normalisation") -{ - setUpKeywords(); -} - -// Set up keywords for node -void Process1DProcedureNode::setUpKeywords() -{ - keywords_.setOrganisation("Options", "Source"); - keywords_.add>("SourceData", "Collect1D node containing the histogram data to process", - sourceData_, this, ProcedureNode::NodeType::Collect1D, false); - keywords_.add>( - "SourceIntegerData", "IntegerCollect1D node containing the histogram data to process", sourceIntegerData_, this, - ProcedureNode::NodeType::IntegerCollect1D, false); - keywords_.add( - "Instantaneous", "Whether to use only the current binned data of the histogram, rather than the accumulated average", - instantaneous_); - - keywords_.setOrganisation("Options", "Labels"); - keywords_.add("LabelValue", "Label for the value axis", labelValue_); - keywords_.add("LabelX", "Label for the x axis", labelX_); - - keywords_.setOrganisation("Options", "Export"); - keywords_.add("Export", "File format and file name under which to save processed data", - exportFileAndFormat_, "EndExport"); - - keywords_.addHidden("Normalisation", "Branch providing normalisation operations for the data", - normalisationBranch_); -} - -/* - * Data - */ - -// Return whether processed data exists -bool Process1DProcedureNode::hasProcessedData() const { return (processedData_ != nullptr); } - -// Return processed data -const Data1D &Process1DProcedureNode::processedData() const -{ - if (!processedData_) - { - Messenger::error("No processed data pointer set in Process1DProcedureNode, so nothing to return.\n"); - static Data1D dummy; - return dummy; - } - - return (*processedData_); -} - -// Return export file and format for processed data -Data1DExportFileFormat &Process1DProcedureNode::exportFileAndFormat() { return exportFileAndFormat_; } - -// Return value label -std::string Process1DProcedureNode::valueLabel() const { return labelValue_; } - -// Return x axis label -std::string Process1DProcedureNode::xAxisLabel() const { return labelX_; } - -/* - * Branches - */ - -// Return the branch from this node (if it has one) -OptionalReferenceWrapper Process1DProcedureNode::branch() { return normalisationBranch_; } - -/* - * Execute - */ - -// Prepare any necessary data, ready for execution -bool Process1DProcedureNode::prepare(const ProcedureContext &procedureContext) -{ - if (sourceData_ && sourceIntegerData_) - { - return Messenger::error("Specify either SourceData or SourceIntegerData, not both.\n"); - } - else if (sourceData_ || sourceIntegerData_) - { - normalisationBranch_.prepare(procedureContext); - - return true; - } - else - return Messenger::error("No source data node set in '{}'.\n", name()); -} - -// Finalise any necessary data after execution -bool Process1DProcedureNode::finalise(const ProcedureContext &procedureContext) -{ - // Retrieve / realise the normalised data from the supplied list - auto &data = procedureContext.processingModuleData().realise( - fmt::format("Process1D//{}", name()), procedureContext.processingModuleDataPrefix(), GenericItem::InRestartFileFlag); - processedData_ = &data; - data.setTag(name()); - - // Copy the averaged data from the associated Process1D node - if (instantaneous_) - data = sourceData_ ? sourceData_->data() : sourceIntegerData_->data(); - else - data = sourceData_ ? sourceData_->accumulatedData() : sourceIntegerData_->accumulatedData(); - - // Run normalisation on the data - // Set data targets in the normalisation nodes - for (auto &node : normalisationBranch_.sequence()) - { - if (node->nodeClass() != ProcedureNode::NodeClass::Operate) - continue; - - // Cast the node - auto operateNode = std::dynamic_pointer_cast(node); - operateNode->setTarget(processedData_); - } - - if (!normalisationBranch_.execute(procedureContext)) - return false; - - // Save data? - if (exportFileAndFormat_.hasFilename()) - { - if (procedureContext.processPool().isMaster()) - { - if (exportFileAndFormat_.exportData(data)) - procedureContext.processPool().decideTrue(); - else - { - procedureContext.processPool().decideFalse(); - return false; - } - } - else if (!procedureContext.processPool().decision()) - return false; - } - - return true; -} diff --git a/src/procedure/nodes/process1D.h b/src/procedure/nodes/process1D.h deleted file mode 100644 index 3cdfe59db3..0000000000 --- a/src/procedure/nodes/process1D.h +++ /dev/null @@ -1,78 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#pragma once - -#include "io/export/data1D.h" -#include "procedure/nodes/node.h" -#include "procedure/nodes/sequence.h" - -// Forward Declarations -class Collect1DProcedureNode; -class Data1D; -class IntegerCollect1DProcedureNode; -class LineParser; - -// Procedure Node - Process1D -class Process1DProcedureNode : public ProcedureNode -{ - public: - Process1DProcedureNode(std::shared_ptr target = nullptr, - ProcedureNode::NodeContext normalisationContext = ProcedureNode::OperateContext); - Process1DProcedureNode(std::shared_ptr intTarget, - ProcedureNode::NodeContext normalisationContext = ProcedureNode::OperateContext); - ~Process1DProcedureNode() override = default; - - private: - // Set up keywords for node - void setUpKeywords(); - - /* - * Data - */ - // Whether to use only the current binned data of the histogram, rather than the accumulated average - bool instantaneous_{false}; - // Collect1D node that we are processing - std::shared_ptr sourceData_; - std::shared_ptr sourceIntegerData_; - // Export file and format for processed data - Data1DExportFileFormat exportFileAndFormat_; - // Label for the value axis - std::string labelValue_; - // Label for the x axis - std::string labelX_{"X"}; - // Pointer to processed data (stored in processing data list) - Data1D *processedData_{nullptr}; - - public: - // Return whether processed data exists - bool hasProcessedData() const; - // Return processed data - const Data1D &processedData() const; - // Return export file and format for processed data - Data1DExportFileFormat &exportFileAndFormat(); - // Return value label - std::string valueLabel() const; - // Return x axis label - std::string xAxisLabel() const; - - /* - * Branches - */ - private: - // Branch for normalisation of data - ProcedureNodeSequence normalisationBranch_; - - public: - // Return the branch from this node (if it has one) - OptionalReferenceWrapper branch() override; - - /* - * Execute - */ - public: - // Prepare any necessary data, ready for execution - bool prepare(const ProcedureContext &procedureContext) override; - // Finalise any necessary data after execution - bool finalise(const ProcedureContext &procedureContext) override; -}; diff --git a/src/procedure/nodes/process2D.cpp b/src/procedure/nodes/process2D.cpp deleted file mode 100644 index 8a3227de38..0000000000 --- a/src/procedure/nodes/process2D.cpp +++ /dev/null @@ -1,134 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#include "procedure/nodes/process2D.h" -#include "classes/configuration.h" -#include "io/export/data2D.h" -#include "keywords/fileAndFormat.h" -#include "keywords/nodeBranch.h" -#include "keywords/stdString.h" -#include "math/integrator.h" -#include "procedure/nodes/collect2D.h" -#include "procedure/nodes/operateBase.h" - -Process2DProcedureNode::Process2DProcedureNode(std::shared_ptr target, - ProcedureNode::NodeContext normalisationContext) - : ProcedureNode(ProcedureNode::NodeType::Process2D, {ProcedureNode::AnalysisContext}), sourceData_(target), - normalisationBranch_(normalisationContext, *this, "Normalisation") -{ - keywords_.setOrganisation("Options", "Control"); - keywords_.add>("SourceData", "Collect2D node containing the histogram data to process", - sourceData_, this, ProcedureNode::NodeType::Collect2D, false); - keywords_.setOrganisation("Options", "Labels"); - keywords_.add("LabelValue", "Label for the value axis", labelValue_); - keywords_.add("LabelX", "Label for the x axis", labelX_); - keywords_.add("LabelY", "Label for the y axis", labelY_); - - keywords_.setOrganisation("Options", "Export"); - keywords_.add("Export", "File format and file name under which to save processed data", - exportFileAndFormat_, "EndExport"); - - keywords_.addHidden("Normalisation", "Branch providing normalisation operations for the data", - normalisationBranch_); - - // Initialise data pointer - processedData_ = nullptr; -} - -/* - * Data - */ - -// Return processed data -const Data2D &Process2DProcedureNode::processedData() const -{ - if (!processedData_) - { - Messenger::error("No processed data pointer set in Process2DProcedureNode, so nothing to return.\n"); - static Data2D dummy; - return dummy; - } - - return (*processedData_); -} - -// Return export file and format for processed data -Data2DExportFileFormat &Process2DProcedureNode::exportFileAndFormat() { return exportFileAndFormat_; } - -// Return value label -std::string Process2DProcedureNode::valueLabel() const { return labelValue_; } - -// Return x axis label -std::string Process2DProcedureNode::xAxisLabel() const { return labelX_; } - -// Return y axis label -std::string Process2DProcedureNode::yAxisLabel() const { return labelY_; } - -/* - * Branches - */ - -// Return the branch from this node (if it has one) -OptionalReferenceWrapper Process2DProcedureNode::branch() { return normalisationBranch_; } - -/* - * Execute - */ - -// Prepare any necessary data, ready for execution -bool Process2DProcedureNode::prepare(const ProcedureContext &procedureContext) -{ - if (!sourceData_) - return Messenger::error("No source Collect2D node set in '{}'.\n", name()); - - normalisationBranch_.prepare(procedureContext); - - return true; -} - -// Finalise any necessary data after execution -bool Process2DProcedureNode::finalise(const ProcedureContext &procedureContext) -{ - // Retrieve / realise the normalised data from the supplied list - auto &data = procedureContext.processingModuleData().realise( - fmt::format("Process2D//{}", name()), procedureContext.processingModuleDataPrefix(), GenericItem::InRestartFileFlag); - processedData_ = &data; - data.setTag(name()); - - // Copy the averaged data from the associated Process1D node - data = sourceData_->accumulatedData(); - - // Run normalisation on the data - // Set data targets in the normalisation nodes - for (auto &node : normalisationBranch_.sequence()) - { - if (node->nodeClass() != ProcedureNode::NodeClass::Operate) - continue; - - // Cast the node - auto operateNode = std::dynamic_pointer_cast(node); - operateNode->setTarget(processedData_); - } - - if (!normalisationBranch_.execute(procedureContext)) - return false; - - // Save data? - if (exportFileAndFormat_.hasFilename()) - { - if (procedureContext.processPool().isMaster()) - { - if (exportFileAndFormat_.exportData(data)) - procedureContext.processPool().decideTrue(); - else - { - procedureContext.processPool().decideFalse(); - return false; - } - } - else if (!procedureContext.processPool().decision()) - return false; - } - - return true; -} diff --git a/src/procedure/nodes/process2D.h b/src/procedure/nodes/process2D.h deleted file mode 100644 index 186e9da0b4..0000000000 --- a/src/procedure/nodes/process2D.h +++ /dev/null @@ -1,71 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#pragma once - -#include "io/export/data2D.h" -#include "procedure/nodes/node.h" -#include "procedure/nodes/sequence.h" - -// Forward Declarations -class Collect2DProcedureNode; -class Data2D; -class LineParser; - -// Procedure Node - Process2D -class Process2DProcedureNode : public ProcedureNode -{ - public: - Process2DProcedureNode(std::shared_ptr target = nullptr, - ProcedureNode::NodeContext forEachContext = ProcedureNode::OperateContext); - ~Process2DProcedureNode() override = default; - - /* - * Data - */ - private: - // Collect2D node that we are processing - std::shared_ptr sourceData_; - // Export file and format for processed data - Data2DExportFileFormat exportFileAndFormat_; - // Label for the value axis - std::string labelValue_{"Counts"}; - // Label for the x axis - std::string labelX_{"X"}; - // Label for the y axis - std::string labelY_{"Y"}; - // Pointer to processed data (stored in processing data list) - Data2D *processedData_{nullptr}; - - public: - // Return processed data - const Data2D &processedData() const; - // Return export file and format for processed data - Data2DExportFileFormat &exportFileAndFormat(); - // Return value label - std::string valueLabel() const; - // Return x axis label - std::string xAxisLabel() const; - // Return y axis label - std::string yAxisLabel() const; - - /* - * Branches - */ - private: - // Branch for normalisation of data - ProcedureNodeSequence normalisationBranch_; - - public: - // Return the branch from this node (if it has one) - OptionalReferenceWrapper branch() override; - - /* - * Execute - */ - public: - // Prepare any necessary data, ready for execution - bool prepare(const ProcedureContext &procedureContext) override; - // Finalise any necessary data after execution - bool finalise(const ProcedureContext &procedureContext) override; -}; diff --git a/src/procedure/nodes/process3D.cpp b/src/procedure/nodes/process3D.cpp deleted file mode 100644 index f1df540da9..0000000000 --- a/src/procedure/nodes/process3D.cpp +++ /dev/null @@ -1,139 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#include "procedure/nodes/process3D.h" -#include "classes/box.h" -#include "classes/configuration.h" -#include "keywords/fileAndFormat.h" -#include "keywords/nodeBranch.h" -#include "keywords/stdString.h" -#include "procedure/nodes/collect3D.h" -#include "procedure/nodes/operateBase.h" -#include "procedure/nodes/select.h" - -Process3DProcedureNode::Process3DProcedureNode(std::shared_ptr target, - ProcedureNode::NodeContext normalisationContext) - : ProcedureNode(ProcedureNode::NodeType::Process3D, {ProcedureNode::AnalysisContext}), sourceData_(target), - normalisationBranch_(normalisationContext, *this, "Normalisation") -{ - keywords_.setOrganisation("Options", "Control"); - keywords_.add>("SourceData", "Collect2D node containing the histogram data to process", - sourceData_, this, ProcedureNode::NodeType::Collect3D, false); - - keywords_.setOrganisation("Options", "Labels"); - keywords_.add("LabelValue", "Label for the value axis", labelValue_); - keywords_.add("LabelX", "Label for the x axis", labelX_); - keywords_.add("LabelY", "Label for the y axis", labelY_); - keywords_.add("LabelZ", "Label for the z axis", labelZ_); - - keywords_.setOrganisation("Options", "Export"); - keywords_.add("Export", "File format and file name under which to save processed data", - exportFileAndFormat_, "EndExport"); - - keywords_.addHidden("Normalisation", "Branch providing normalisation operations for the data", - normalisationBranch_); - - // Initialise data pointer - processedData_ = nullptr; -} - -/* - * Data - */ - -// Return processed data -const Data3D &Process3DProcedureNode::processedData() const -{ - if (!processedData_) - { - Messenger::error("No processed data pointer set in Process3DProcedureNode, so nothing to return.\n"); - static Data3D dummy; - return dummy; - } - - return (*processedData_); -} - -// Return export file and format for processed data -Data3DExportFileFormat &Process3DProcedureNode::exportFileAndFormat() { return exportFileAndFormat_; } - -// Return value label -std::string Process3DProcedureNode::valueLabel() const { return labelValue_; } - -// Return x axis label -std::string Process3DProcedureNode::xAxisLabel() const { return labelX_; } - -// Return y axis label -std::string Process3DProcedureNode::yAxisLabel() const { return labelY_; } - -// Return z axis label -std::string Process3DProcedureNode::zAxisLabel() const { return labelZ_; } - -/* - * Branches - */ - -// Return the branch from this node (if it has one) -OptionalReferenceWrapper Process3DProcedureNode::branch() { return normalisationBranch_; } - -/* - * Execute - */ - -// Prepare any necessary data, ready for execution -bool Process3DProcedureNode::prepare(const ProcedureContext &procedureContext) -{ - if (!sourceData_) - return Messenger::error("No source Collect3D node set in '{}'.\n", name()); - - normalisationBranch_.prepare(procedureContext); - - return true; -} - -// Finalise any necessary data after execution -bool Process3DProcedureNode::finalise(const ProcedureContext &procedureContext) -{ - // Retrieve / realise the normalised data from the supplied list - auto &data = procedureContext.processingModuleData().realise( - fmt::format("Process3D//{}", name()), procedureContext.processingModuleDataPrefix(), GenericItem::InRestartFileFlag); - processedData_ = &data; - data.setTag(name()); - - // Copy the averaged data from the associated Process3D node - data = sourceData_->accumulatedData(); - - // Run normalisation on the data - // Set data targets in the normalisation nodes - for (auto &node : normalisationBranch_.sequence()) - { - if (node->nodeClass() != ProcedureNode::NodeClass::Operate) - continue; - - // Cast the node - auto operateNode = std::dynamic_pointer_cast(node); - operateNode->setTarget(processedData_); - } - - if (!normalisationBranch_.execute(procedureContext)) - return false; - - // Save data? - if (exportFileAndFormat_.hasFilename()) - { - if (procedureContext.processPool().isMaster()) - { - if (exportFileAndFormat_.exportData(data)) - procedureContext.processPool().decideTrue(); - else - { - procedureContext.processPool().decideFalse(); - return false; - } - } - else if (!procedureContext.processPool().decision()) - return false; - } - - return true; -} diff --git a/src/procedure/nodes/process3D.h b/src/procedure/nodes/process3D.h deleted file mode 100644 index f017b674af..0000000000 --- a/src/procedure/nodes/process3D.h +++ /dev/null @@ -1,76 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#pragma once - -#include "io/export/data3D.h" -#include "procedure/nodes/node.h" -#include "procedure/nodes/nodeReference.h" -#include "procedure/nodes/sequence.h" - -// Forward Declarations -class Collect3DProcedureNode; -class Data3D; -class LineParser; - -// Procedure Node - Process3D -class Process3DProcedureNode : public ProcedureNode -{ - public: - Process3DProcedureNode(std::shared_ptr target = nullptr, - ProcedureNode::NodeContext forEachContext = ProcedureNode::OperateContext); - ~Process3DProcedureNode() override = default; - - /* - * Data - */ - private: - // Collect3D node that we are processing - std::shared_ptr sourceData_; - // Export file and format - Data3DExportFileFormat exportFileAndFormat_; - // Label for the value axis - std::string labelValue_{"Counts"}; - // Label for the x axis - std::string labelX_{"X"}; - // Label for the y axis - std::string labelY_{"Y"}; - // Label for the z axis - std::string labelZ_{"Z"}; - // Pointer to processed data (stored in processing data list) - Data3D *processedData_; - - public: - // Return processed data - const Data3D &processedData() const; - // Return export file and format for processed data - Data3DExportFileFormat &exportFileAndFormat(); - // Return value label - std::string valueLabel() const; - // Return x axis label - std::string xAxisLabel() const; - // Return y axis label - std::string yAxisLabel() const; - // Return z axis label - std::string zAxisLabel() const; - - /* - * Branches - */ - private: - // Branch for normalisation of data - ProcedureNodeSequence normalisationBranch_; - - public: - // Return the branch from this node (if it has one) - OptionalReferenceWrapper branch() override; - - /* - * Execute - */ - public: - // Prepare any necessary data, ready for execution - bool prepare(const ProcedureContext &procedureContext) override; - // Finalise any necessary data after execution - bool finalise(const ProcedureContext &procedureContext) override; -}; diff --git a/src/procedure/nodes/regionBase.cpp b/src/procedure/nodes/regionBase.cpp index 62a018897e..71a75b9d62 100644 --- a/src/procedure/nodes/regionBase.cpp +++ b/src/procedure/nodes/regionBase.cpp @@ -6,7 +6,7 @@ #include "keywords/double.h" RegionProcedureNodeBase::RegionProcedureNodeBase(ProcedureNode::NodeType nodeType) - : ProcedureNode(nodeType, {ProcedureNode::GenerationContext}, ProcedureNode::NodeClass::Region) + : ProcedureNode(nodeType, {ProcedureNode::GenerationContext}) { keywords_.setOrganisation("Options", "Grid"); keywords_.add("VoxelSize", "Voxel size (length) guiding the coarseness / detail of the region", voxelSize_, diff --git a/src/procedure/nodes/registry.cpp b/src/procedure/nodes/registry.cpp index 82795c0156..8831095d7b 100644 --- a/src/procedure/nodes/registry.cpp +++ b/src/procedure/nodes/registry.cpp @@ -5,39 +5,17 @@ #include "procedure/nodes/add.h" #include "procedure/nodes/addPair.h" #include "procedure/nodes/box.h" -#include "procedure/nodes/calculateAngle.h" -#include "procedure/nodes/calculateAxisAngle.h" -#include "procedure/nodes/calculateDistance.h" -#include "procedure/nodes/calculateExpression.h" -#include "procedure/nodes/calculateVector.h" -#include "procedure/nodes/collect1D.h" -#include "procedure/nodes/collect2D.h" -#include "procedure/nodes/collect3D.h" #include "procedure/nodes/coordinateSets.h" #include "procedure/nodes/copy.h" #include "procedure/nodes/customRegion.h" #include "procedure/nodes/cylindricalGlobalPotential.h" #include "procedure/nodes/cylindricalRegion.h" #include "procedure/nodes/generalRegion.h" -#include "procedure/nodes/ifValueInRange.h" #include "procedure/nodes/importCoordinates.h" -#include "procedure/nodes/integerCollect1D.h" -#include "procedure/nodes/integrate1D.h" -#include "procedure/nodes/operateDivide.h" -#include "procedure/nodes/operateExpression.h" -#include "procedure/nodes/operateGridNormalise.h" -#include "procedure/nodes/operateMultiply.h" -#include "procedure/nodes/operateNormalise.h" -#include "procedure/nodes/operateNumberDensityNormalise.h" -#include "procedure/nodes/operateSitePopulationNormalise.h" -#include "procedure/nodes/operateSphericalShellNormalise.h" #include "procedure/nodes/parameters.h" #include "procedure/nodes/pick.h" #include "procedure/nodes/pickProximity.h" #include "procedure/nodes/pickRegion.h" -#include "procedure/nodes/process1D.h" -#include "procedure/nodes/process2D.h" -#include "procedure/nodes/process3D.h" #include "procedure/nodes/regionalGlobalPotential.h" #include "procedure/nodes/remove.h" #include "procedure/nodes/restraintPotential.h" @@ -46,7 +24,6 @@ #include "procedure/nodes/select.h" #include "procedure/nodes/sizeFactor.h" #include "procedure/nodes/sphericalGlobalPotential.h" -#include "procedure/nodes/sum1D.h" #include "procedure/nodes/temperature.h" #include "procedure/nodes/transmute.h" @@ -70,37 +47,6 @@ ProcedureNodeRegistry::ProcedureNodeRegistry() registerProducer(ProcedureNode::NodeType::Transmute, "Turn molecules from one species type into another", "Build"); - // Calculate - registerProducer(ProcedureNode::NodeType::CalculateAngle, - "Calculate angle between three sites", "Calculate"); - registerProducer(ProcedureNode::NodeType::CalculateAxisAngle, - "Calculate angle between specified axes of two oriented sites", - "Calculate"); - registerProducer(ProcedureNode::NodeType::CalculateDistance, - "Calculate distance between two sites", "Calculate"); - registerProducer(ProcedureNode::NodeType::CalculateExpression, - "Evaluate an arbitrary expression", "Calculate"); - registerProducer(ProcedureNode::NodeType::CalculateVector, - "Calculate vector between two sites", "Calculate"); - registerProducer(ProcedureNode::NodeType::Select, "Select sites for consideration", "Calculate"); - - // Control - registerProducer(ProcedureNode::NodeType::IfValueInRange, - "Conditionally execute other nodes if a value is within range", "Control"); - - // Data - registerProducer(ProcedureNode::NodeType::Collect1D, "Bin 1D quantity into a histogram", "Data"); - registerProducer(ProcedureNode::NodeType::Collect2D, "Bin 2D quantity into a histogram", "Data"); - registerProducer(ProcedureNode::NodeType::Collect3D, "Bin 3D quantity into a histogram", "Data"); - registerProducer(ProcedureNode::NodeType::IntegerCollect1D, - "Bin integer 1D value into a histogram", "Data"); - registerProducer(ProcedureNode::NodeType::Integrate1D, "Integrate the data in a 1D dataset", - "Data"); - registerProducer(ProcedureNode::NodeType::Process1D, "Process 1D histogram data", "Data"); - registerProducer(ProcedureNode::NodeType::Process2D, "Process 2D histogram data", "Data"); - registerProducer(ProcedureNode::NodeType::Process3D, "Process 3D histogram data", "Data"); - registerProducer(ProcedureNode::NodeType::Sum1D, "Sum the data in a 1D dataset", "Data"); - // General registerProducer(ProcedureNode::NodeType::Parameters, "Define parameters for use in expressions", "General"); @@ -113,24 +59,6 @@ ProcedureNodeRegistry::ProcedureNodeRegistry() registerProducer(ProcedureNode::NodeType::GeneralRegion, "Define a general region in a configuration", "Regions"); - // Operate - registerProducer(ProcedureNode::NodeType::OperateDivide, "Perform a division on data", - "Operate"); - registerProducer(ProcedureNode::NodeType::OperateExpression, "Apply an expression to data", - "Operate"); - registerProducer(ProcedureNode::NodeType::OperateGridNormalise, - "Normalise data by bin widths, areas, or volumes", "Operate"); - registerProducer(ProcedureNode::NodeType::OperateMultiply, "Perform a multiplication on data", - "Operate"); - registerProducer(ProcedureNode::NodeType::OperateNormalise, "Normalise data to a value", - "Operate"); - registerProducer(ProcedureNode::NodeType::OperateNumberDensityNormalise, - "Normalise data to a reference number density", "Operate"); - registerProducer(ProcedureNode::NodeType::OperateSitePopulationNormalise, - "Normalise data to a reference site population", "Operate"); - registerProducer(ProcedureNode::NodeType::OperateSphericalShellNormalise, - "Normalise data to spherical shell volumes", "Operate"); - // Pick registerProducer(ProcedureNode::NodeType::Pick, "Pick all molecules of a given species", "Pick"); registerProducer(ProcedureNode::NodeType::PickProximity, @@ -151,6 +79,7 @@ ProcedureNodeRegistry::ProcedureNodeRegistry() "Potentials"); // Sites + registerProducer(ProcedureNode::NodeType::Select, "Rotate fragment sites", "Sites"); registerProducer(ProcedureNode::NodeType::RotateFragment, "Rotate fragment sites", "Sites"); // Control diff --git a/src/procedure/nodes/remove.cpp b/src/procedure/nodes/remove.cpp index a6cec99e09..eb8f50d937 100644 --- a/src/procedure/nodes/remove.cpp +++ b/src/procedure/nodes/remove.cpp @@ -13,8 +13,9 @@ RemoveProcedureNode::RemoveProcedureNode() : ProcedureNode(ProcedureNode::NodeTy { keywords_.setOrganisation("Options", "Targets"); keywords_.add("Species", "Target species to remove", speciesToRemove_); - keywords_.add>("Selection", "Picked selection of molecules to remove", selection_, this, - ProcedureNode::NodeClass::Pick, true); + keywords_.add>( + "Selection", "Picked selection of molecules to remove", selection_, this, + NodeTypeVector{NodeType::Pick, NodeType::PickProximity, NodeType::PickRegion}, true); } /* diff --git a/src/procedure/nodes/restraintPotential.cpp b/src/procedure/nodes/restraintPotential.cpp index 10c2414291..f6ea330eb8 100644 --- a/src/procedure/nodes/restraintPotential.cpp +++ b/src/procedure/nodes/restraintPotential.cpp @@ -17,9 +17,9 @@ RestraintPotentialProcedureNode::RestraintPotentialProcedureNode() keywords_.setOrganisation("Options", "Targets"); keywords_.add("Species", "Target species to apply atomic restraints to", speciesToRestrain_); - keywords_.add>("Selection", - "Picked selection of molecules to apply atomic restraints to", - selectionToRestrain_, this, ProcedureNode::NodeClass::Pick, true); + keywords_.add>( + "Selection", "Picked selection of molecules to apply atomic restraints to", selectionToRestrain_, this, + NodeTypeVector{NodeType::Pick, NodeType::PickProximity, NodeType::PickRegion}, true); } /* diff --git a/src/procedure/nodes/rotateFragment.cpp b/src/procedure/nodes/rotateFragment.cpp index 20e754164c..f210afa850 100644 --- a/src/procedure/nodes/rotateFragment.cpp +++ b/src/procedure/nodes/rotateFragment.cpp @@ -20,7 +20,7 @@ RotateFragmentProcedureNode::RotateFragmentProcedureNode(std::shared_ptr>("Site", "Site to be rotated", site_, this, ProcedureNode::NodeType::Select, + keywords_.add>("Site", "Site to be rotated", site_, this, NodeTypeVector{NodeType::Select}, true); keywords_.add("Rotation", "Rotation to perform", rotation_, this); keywords_.add>("Axis", "Axis for rotation", axis_, OrientedSite::siteAxis()); diff --git a/src/procedure/nodes/select.cpp b/src/procedure/nodes/select.cpp index b2015d02d0..f623238add 100644 --- a/src/procedure/nodes/select.cpp +++ b/src/procedure/nodes/select.cpp @@ -28,18 +28,18 @@ SelectProcedureNode::SelectProcedureNode(std::vector sites, "SameMoleculeAsSite", "Request that the selected site comes from the molecule containing the current site in the specified " "SelectNode", - sameMolecule_, this, ProcedureNode::NodeType::Select, true); + sameMolecule_, this, NodeTypeVector{NodeType::Select}, true); keywords_.add>( "ExcludeSameMolecule", "Exclude sites from selection if they are present in the same molecule as the current site in the specified " "SelectNode(s)", - sameMoleculeExclusions_, this, ProcedureNode::NodeType::Select, true); + sameMoleculeExclusions_, this, NodeTypeVector{NodeType::Select}, true); keywords_.add>( "ExcludeSameSite", "Exclude sites from selection if they are the current site in the specified SelectNode(s)", - sameSiteExclusions_, this, ProcedureNode::NodeType::Select, true); + sameSiteExclusions_, this, NodeTypeVector{NodeType::Select}, true); keywords_.add>("ReferenceSite", "Site to use as reference point when determining inclusions / exclusions", - distanceReferenceSite_, this, ProcedureNode::NodeType::Select, true); + distanceReferenceSite_, this, NodeTypeVector{NodeType::Select}, true); keywords_.add( "InclusiveRange", "Distance range (from reference site) within which sites are selected (only if ReferenceSite is defined)", diff --git a/src/procedure/nodes/sequence.cpp b/src/procedure/nodes/sequence.cpp index 44173a7785..1b904f766b 100644 --- a/src/procedure/nodes/sequence.cpp +++ b/src/procedure/nodes/sequence.cpp @@ -97,8 +97,7 @@ bool ProcedureNodeSequence::removeNode(NodeRef node) // Return named node if it exists anywhere in our sequence or below, and optionally matches the type given NodeRef ProcedureNodeSequence::searchNodes(std::string_view name, ConstNodeRef excludeNode, - std::optional optNodeType, - std::optional optNodeClass) const + const ProcedureNode::NodeTypeVector &allowedNodeTypes) const { for (const auto &node : sequence_) { @@ -107,9 +106,9 @@ NodeRef ProcedureNodeSequence::searchNodes(std::string_view name, ConstNodeRef e { if (DissolveSys::sameString(node->name(), name)) { - // Check type / class - if ((!optNodeType && !optNodeClass) || (optNodeType && optNodeType.value() == node->type()) || - (optNodeClass && optNodeClass.value() == node->nodeClass())) + // Check type + if (allowedNodeTypes.empty() || + std::find(allowedNodeTypes.begin(), allowedNodeTypes.end(), node->type()) != allowedNodeTypes.end()) return node; } } @@ -117,7 +116,7 @@ NodeRef ProcedureNodeSequence::searchNodes(std::string_view name, ConstNodeRef e // If the node has a branch, descend into it if (node->branch()) { - auto result = node->branch()->get().searchNodes(name, excludeNode, optNodeType, optNodeClass); + auto result = node->branch()->get().searchNodes(name, excludeNode, allowedNodeTypes); if (result) return result; } @@ -161,23 +160,22 @@ ProcedureNode::NodeContext ProcedureNodeSequence::context() const // Return named node if present in this sequence, and which matches the (optional) type given ConstNodeRef ProcedureNodeSequence::node(std::string_view name, ConstNodeRef excludeNode, - std::optional optNodeType, - std::optional optNodeClass) const + const ProcedureNode::NodeTypeVector &allowedNodeTypes) const { for (const auto &node : sequence_) { if (node != excludeNode && DissolveSys::sameString(node->name(), name)) { - // Check type / class - if ((!optNodeType && !optNodeClass) || (optNodeType && optNodeType.value() == node->type()) || - (optNodeClass && optNodeClass.value() == node->nodeClass())) + // Check type + if (allowedNodeTypes.empty() || + std::find(allowedNodeTypes.begin(), allowedNodeTypes.end(), node->type()) != allowedNodeTypes.end()) return node; } // If the node has a branch, recurse in to that if (node->branch()) { - auto branchNode = node->branch()->get().node(name, excludeNode, optNodeType, optNodeClass); + auto branchNode = node->branch()->get().node(name, excludeNode, allowedNodeTypes); if (branchNode) return branchNode; } @@ -187,22 +185,21 @@ ConstNodeRef ProcedureNodeSequence::node(std::string_view name, ConstNodeRef exc } // Return list of nodes (of specified type / class) present in the Procedure -std::vector ProcedureNodeSequence::nodes(std::optional optNodeType, - std::optional optNodeClass) const +std::vector ProcedureNodeSequence::nodes(const ProcedureNode::NodeTypeVector &allowedNodeTypes) const { std::vector matches; for (const auto &node : sequence_) { - // Check type / class - if ((!optNodeType && !optNodeClass) || (optNodeType && optNodeType.value() == node->type()) || - (optNodeClass && optNodeClass.value() == node->nodeClass())) + // Check type + if (allowedNodeTypes.empty() || + std::find(allowedNodeTypes.begin(), allowedNodeTypes.end(), node->type()) != allowedNodeTypes.end()) matches.push_back(node); // If the node has a branch, recurse in to that if (node->branch()) { - auto branchNodes = node->branch()->get().nodes(optNodeType, optNodeClass); + auto branchNodes = node->branch()->get().nodes(allowedNodeTypes); std::copy(branchNodes.begin(), branchNodes.end(), std::back_inserter(matches)); } } @@ -212,8 +209,7 @@ std::vector ProcedureNodeSequence::nodes(std::optional optNodeType, - std::optional optNodeClass) const + const ProcedureNode::NodeTypeVector &allowedNodeTypes) const { // If one was given, start from the querying node and work backwards... if (queryingNode) @@ -228,9 +224,9 @@ ConstNodeRef ProcedureNodeSequence::nodeInScope(ConstNodeRef queryingNode, std:: if (DissolveSys::sameString(node->name(), name)) { - // Check type / class - if ((!optNodeType && !optNodeClass) || (optNodeType && optNodeType.value() == node->type()) || - (optNodeClass && optNodeClass.value() == node->nodeClass())) + // Check type + if (allowedNodeTypes.empty() || + std::find(allowedNodeTypes.begin(), allowedNodeTypes.end(), node->type()) != allowedNodeTypes.end()) return node; } } @@ -238,7 +234,7 @@ ConstNodeRef ProcedureNodeSequence::nodeInScope(ConstNodeRef queryingNode, std:: // Not in our list. Recursively check our owner if (owner_) - return owner_->get().getNode(name, true, excludeNode, optNodeType, optNodeClass); + return owner_->get().getNode(name, true, excludeNode, allowedNodeTypes); // Not found return nullptr; @@ -246,8 +242,7 @@ ConstNodeRef ProcedureNodeSequence::nodeInScope(ConstNodeRef queryingNode, std:: // Return list of nodes in scope (and matching the type / class given) std::vector ProcedureNodeSequence::nodesInScope(ConstNodeRef queryingNode, - std::optional optNodeType, - std::optional optNodeClass) const + const ProcedureNode::NodeTypeVector &allowedNodeTypes) const { std::vector matches; @@ -259,9 +254,9 @@ std::vector ProcedureNodeSequence::nodesInScope(ConstNodeRef query for (const auto &node : range) { - // Check type / class - if ((!optNodeType && !optNodeClass) || (optNodeType && optNodeType.value() == node->type()) || - (optNodeClass && optNodeClass.value() == node->nodeClass())) + // Check type + if (allowedNodeTypes.empty() || + std::find(allowedNodeTypes.begin(), allowedNodeTypes.end(), node->type()) != allowedNodeTypes.end()) matches.push_back(node); } } @@ -269,7 +264,7 @@ std::vector ProcedureNodeSequence::nodesInScope(ConstNodeRef query // Not in our list. Recursively check our owner if (owner_) { - auto parentMatches = owner_->get().getNodes(true, optNodeType, optNodeClass); + auto parentMatches = owner_->get().getNodes(true, allowedNodeTypes); std::copy(parentMatches.begin(), parentMatches.end(), std::back_inserter(matches)); } @@ -278,15 +273,14 @@ std::vector ProcedureNodeSequence::nodesInScope(ConstNodeRef query // Return named node if it exists anywhere in the same Procedure (and matches the type / class given) ConstNodeRef ProcedureNodeSequence::nodeExists(std::string_view name, ConstNodeRef excludeNode, - std::optional optNodeType, - std::optional optNodeClass) const + const ProcedureNode::NodeTypeVector &allowedNodeTypes) const { // First, bubble up to the topmost sequence (which should be the Procedure's rootSequence_) if (owner_) - return owner_->get().scope()->get().nodeExists(name, excludeNode, optNodeType, optNodeClass); + return owner_->get().scope()->get().nodeExists(name, excludeNode, allowedNodeTypes); // No parent node, so we must be the topmost sequence - run the search from here - return searchNodes(name, excludeNode, optNodeType, optNodeClass); + return searchNodes(name, excludeNode, allowedNodeTypes); } // Return the named parameter if it is currently in scope diff --git a/src/procedure/nodes/sequence.h b/src/procedure/nodes/sequence.h index 3b55912444..8a1296a27b 100644 --- a/src/procedure/nodes/sequence.h +++ b/src/procedure/nodes/sequence.h @@ -78,8 +78,7 @@ class ProcedureNodeSequence : public Serialisable private: // Return named node if it exists anywhere in our sequence or below (and matches the type / class given) NodeRef searchNodes(std::string_view name, ConstNodeRef excludeNode = nullptr, - std::optional optNodeType = std::nullopt, - std::optional optNodeClass = std::nullopt) const; + const ProcedureNode::NodeTypeVector &allowedNodeTypes = {}) const; // Search through the Procedure for the named parameter std::shared_ptr searchParameters(std::string_view name, const std::shared_ptr &excludeParameter = nullptr) const; @@ -91,23 +90,18 @@ class ProcedureNodeSequence : public Serialisable ProcedureNode::NodeContext context() const; // Return named node if present (and matches the type / class given) ConstNodeRef node(std::string_view name, ConstNodeRef excludeNode = nullptr, - std::optional optNodeType = std::nullopt, - std::optional optNodeClass = std::nullopt) const; + const ProcedureNode::NodeTypeVector &allowedNodeTypes = {}) const; // Return list of nodes (of specified type / class) present in the Procedure - std::vector nodes(std::optional optNodeType = std::nullopt, - std::optional optNodeClass = std::nullopt) const; + std::vector nodes(const ProcedureNode::NodeTypeVector &allowedNodeTypes = {}) const; // Return named node if it is currently in scope (and matches the type / class given) ConstNodeRef nodeInScope(ConstNodeRef queryingNode, std::string_view name, ConstNodeRef excludeNode = nullptr, - std::optional optNodeType = std::nullopt, - std::optional optNodeClass = std::nullopt) const; + const ProcedureNode::NodeTypeVector &allowedNodeTypes = {}) const; // Return list of nodes in scope (and matching the type / class given) std::vector nodesInScope(ConstNodeRef queryingNode, - std::optional optNodeType = std::nullopt, - std::optional optNodeClass = std::nullopt) const; + const ProcedureNode::NodeTypeVector &allowedNodeTypes = {}) const; // Return named node if it exists anywhere in the same Procedure (and matches the type / class given) ConstNodeRef nodeExists(std::string_view name, ConstNodeRef excludeNode = nullptr, - std::optional optNodeType = std::nullopt, - std::optional optNodeClass = std::nullopt) const; + const ProcedureNode::NodeTypeVector &allowedNodeTypes = {}) const; // Return the named parameter if it is currently in scope std::shared_ptr parameterInScope(ConstNodeRef queryingNode, std::string_view name, const std::shared_ptr &excludeParameter = nullptr); diff --git a/src/procedure/nodes/sum1D.cpp b/src/procedure/nodes/sum1D.cpp deleted file mode 100644 index f8160d54c0..0000000000 --- a/src/procedure/nodes/sum1D.cpp +++ /dev/null @@ -1,94 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#include "procedure/nodes/sum1D.h" -#include "classes/configuration.h" -#include "io/export/data1D.h" -#include "keywords/bool.h" -#include "keywords/range.h" -#include "math/integrator.h" -#include "modules/analyse/analyse.h" -#include "procedure/nodes/operateBase.h" -#include "procedure/nodes/process1D.h" - -Sum1DProcedureNode::Sum1DProcedureNode(std::shared_ptr target) - : ProcedureNode(ProcedureNode::NodeType::Sum1D, {ProcedureNode::AnalysisContext}), sourceData_(target) -{ - keywords_.setOrganisation("Options", "Source"); - keywords_.add>("SourceData", "Process1D node containing the data to sum", sourceData_, - this, ProcedureNode::NodeType::Process1D, false); - keywords_.add("Instantaneous", "Calculate instantaneous sums rather than averages", instantaneous_); - - keywords_.setOrganisation("Options", "Ranges"); - keywords_.add("RangeA", "X range for first summation region", range_[0], Vec3Labels::MinMaxDeltaLabels); - keywords_.add("RangeBEnabled", "Whether the second summation region is enabled", rangeEnabled_[1]); - keywords_.add("RangeB", "X range for second summation region", range_[1], Vec3Labels::MinMaxDeltaLabels); - keywords_.add("RangeCEnabled", "Whether the second summation region is enabled", rangeEnabled_[2]); - keywords_.add("RangeC", "X range for third summation region", range_[2], Vec3Labels::MinMaxDeltaLabels); -} - -/* - * Data - */ - -// Return calculated sum -SampledDouble Sum1DProcedureNode::sum(int index) const -{ - if (sum_[index].has_value()) - return sum_[index].value(); - return {}; -} - -// Return reference to specified range for calculation -Range &Sum1DProcedureNode::range(int n) -{ - assert(n >= 0 && n < 3); - return range_[n]; -} - -// Return reference to range enabled flag -bool &Sum1DProcedureNode::rangeEnabled(int n) -{ - assert(n >= 0 && n < 3); - return rangeEnabled_[n]; -} - -/* - * Execute - */ - -// Prepare any necessary data, ready for execution -bool Sum1DProcedureNode::prepare(const ProcedureContext &procedureContext) -{ - if (!sourceData_) - return Messenger::error("No source Process1D node set in '{}'.\n", name()); - - return true; -} - -// Finalise any necessary data after execution -bool Sum1DProcedureNode::finalise(const ProcedureContext &procedureContext) -{ - // Calculate integrals - const std::vector rangeNames = {"A", "B", "C"}; - for (int i = 0; i < 3; ++i) - if (rangeEnabled_[i]) - { - if (!sum_[i].has_value()) - sum_[i] = procedureContext.processingModuleData().realise( - fmt::format("Sum1D//{}//{}", name(), rangeNames[i]), procedureContext.processingModuleDataPrefix(), - GenericItem::InRestartFileFlag); - if (instantaneous_) - sum_[i]->get() = Integrator::sum(sourceData_->processedData(), range_[i]); - else - sum_[i]->get() += Integrator::sum(sourceData_->processedData(), range_[i]); - } - - // Print info - for (int i = 0; i < 3; ++i) - if (rangeEnabled_[i]) - Messenger::print("Sum1D - Range {}: {:e} +/- {:e} over {:e} < x < {:e}.\n", rangeNames[i], sum_[i]->get().value(), - sum_[i]->get().stDev(), range_[i].minimum(), range_[i].maximum()); - - return true; -} diff --git a/src/procedure/nodes/sum1D.h b/src/procedure/nodes/sum1D.h deleted file mode 100644 index 2da1dbf6fa..0000000000 --- a/src/procedure/nodes/sum1D.h +++ /dev/null @@ -1,53 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#pragma once - -#include "math/range.h" -#include "math/sampledDouble.h" -#include "procedure/nodes/node.h" - -// Forward Declarations -class Process1DProcedureNode; -class LineParser; - -// Procedure Node - Sum1D -class Sum1DProcedureNode : public ProcedureNode -{ - public: - Sum1DProcedureNode(std::shared_ptr target = nullptr); - ~Sum1DProcedureNode() override = default; - - /* - * Data - */ - private: - // Process1D node that we are targetting - std::shared_ptr sourceData_{nullptr}; - // Whether to calculate the instantaneous sum rather than forming an average - bool instantaneous_{false}; - // Ranges for sums - Range range_[3] = {{0.0, 3.0}, {3.0, 6.0}, {6.0, 9.0}}; - // Flags for ranges - bool rangeEnabled_[3] = {true, false, false}; - // Calculated sums (stored in processing data list) - OptionalReferenceWrapper sum_[3]; - - public: - // Return calculated sum specified - SampledDouble sum(int index) const; - // Return reference to specified range for calculation - Range &range(int n); - // Return reference to range enabled flag - bool &rangeEnabled(int n); - bool rangeEnabled(int n) const; - - /* - * Execute - */ - public: - // Prepare any necessary data, ready for execution - bool prepare(const ProcedureContext &procedureContext) override; - // Finalise any necessary data after execution - bool finalise(const ProcedureContext &procedureContext) override; -}; diff --git a/src/procedure/nodes/transmute.cpp b/src/procedure/nodes/transmute.cpp index 7c834c214d..0032c7ec95 100644 --- a/src/procedure/nodes/transmute.cpp +++ b/src/procedure/nodes/transmute.cpp @@ -15,8 +15,9 @@ TransmuteProcedureNode::TransmuteProcedureNode() { keywords_.setOrganisation("Options", "Source"); keywords_.add("Species", "Species types to transmute into the target species", speciesToTransmute_); - keywords_.add>("Selection", "Picked selection of molecules to transmute", selection_, - this, ProcedureNode::NodeClass::Pick, true); + keywords_.add>( + "Selection", "Picked selection of molecules to transmute", selection_, this, + NodeTypeVector{NodeType::Pick, NodeType::PickProximity, NodeType::PickRegion}, true); keywords_.setOrganisation("Options", "Target"); keywords_.add("Target", "Target species to transmute selected molecules in to", targetSpecies_); diff --git a/src/procedure/procedure.cpp b/src/procedure/procedure.cpp index e75636a7e9..4543f406cf 100644 --- a/src/procedure/procedure.cpp +++ b/src/procedure/procedure.cpp @@ -29,17 +29,15 @@ ProcedureNodeSequence &Procedure::rootSequence() { return rootSequence_; } // Return named node if present (and matches the type / class given) ConstNodeRef Procedure::node(std::string_view name, ConstNodeRef excludeNode, - std::optional optNodeType, - std::optional optNodeClass) const + const ProcedureNode::NodeTypeVector &allowedNodeTypes) const { - return rootSequence_.node(name, std::move(excludeNode), optNodeType, optNodeClass); + return rootSequence_.node(name, std::move(excludeNode), allowedNodeTypes); } // Return all nodes (matching the type / class given) -std::vector Procedure::nodes(std::optional optNodeType, - std::optional optNodeClass) const +std::vector Procedure::nodes(const ProcedureNode::NodeTypeVector &allowedNodeTypes) const { - return rootSequence_.nodes(optNodeType, optNodeClass); + return rootSequence_.nodes(allowedNodeTypes); } // Remove a node diff --git a/src/procedure/procedure.h b/src/procedure/procedure.h index 6b45db89e8..9d28067236 100644 --- a/src/procedure/procedure.h +++ b/src/procedure/procedure.h @@ -41,12 +41,9 @@ class Procedure : public Serialisable ProcedureNodeSequence &rootSequence(); // Return named node if present (and matches the type / class given) ConstNodeRef node(std::string_view name, ConstNodeRef excludeNode = nullptr, - std::optional optNodeType = std::nullopt, - std::optional optNodeClass = std::nullopt) const; - // Return all nodes (matching the type / class given) - std::vector nodes(std::optional optNodeType = std::nullopt, - std::optional optNodeClass = std::nullopt) const; - + const ProcedureNode::NodeTypeVector &allowedNodeTypes = {}) const; + // Return all nodes matching the optional type(s) given + std::vector nodes(const ProcedureNode::NodeTypeVector &allowedNodeTypes = {}) const; // Remove a node bool removeNode(NodeRef node); diff --git a/tests/data/dissolve/input/dAngle.txt b/tests/data/dissolve/input/dAngle.txt index c96fa3dd27..ded890e88b 100755 --- a/tests/data/dissolve/input/dAngle.txt +++ b/tests/data/dissolve/input/dAngle.txt @@ -113,117 +113,4 @@ Module DAngle 'DAngle(X-H...O)' ExcludeSameMolecule true EndModule -# Distance-Angle Map X-H...O (using manual analyser) -Module Analyse 'DAngle(X-H...O)-Analyser' - Configuration 'Bulk' - Analyser - - # Distance-Angle Map X-H / X-H...O - Select 'X' - - Site Water 'O' - - ForEach - - Select 'H' - - Site Water 'H' - - SameMoleculeAsSite 'X' - - ForEach - - Select 'O' - - Site Water 'O' - ExcludeSameMolecule 'X' - - ForEach - - CalculateDistance 'rHO' - I 'H' - J 'O' - EndCalculateDistance - - CalculateAngle 'aXHO' - I 'X' - J 'H' - K 'O' - EndCalculateAngle - - Collect2D 'DAngle(X-HO)' - QuantityX 'rHO' - QuantityY 'aXHO' - RangeX 0.0 5.0 0.01 - RangeY 0.0 180.0 1.0 - SubCollect - Collect1D 'RDF(BC)' - QuantityX 'rHO' - RangeX 0.0 5.0 0.01 - EndCollect1D - Collect1D 'ANGLE(ABC)' - QuantityX 'aXHO' - RangeX 0.0 180.0 1.0 - EndCollect1D - EndSubCollect - EndCollect2D - - EndForEach - - EndSelect - - EndForEach - - EndSelect - - EndForEach - - EndSelect - - Process1D 'RDF' - SourceData 'RDF(BC)' - LabelValue 'gBC(r)' - LabelX 'r, Angstroms' - Normalisation - OperateSitePopulationNormalise - Site 'X' 'H' - EndOperateSitePopulationNormalise - OperateNumberDensityNormalise - Site 'O' - EndOperateNumberDensityNormalise - OperateSphericalShellNormalise - EndOperateSphericalShellNormalise - EndNormalisation - EndProcess1D - - Process1D 'Angle' - SourceData 'ANGLE(ABC)' - Normalisation - OperateExpression - Expression "value/sin(toRad(x))" - EndOperateExpression - OperateNormalise - Value 1.0 - EndOperateNormalise - EndNormalisation - LabelValue 'Probability' - LabelX 'Angle, \\sym{degree}' - EndProcess1D - - Process2D 'RDF-Angle' - SourceData 'DAngle(X-HO)' - Normalisation - OperateNormalise - Value 1.0 - EndOperateNormalise - EndNormalisation - LabelX '\\it{r}, \\sym{Angstrom}' - LabelY 'Angle, \\sym{degree}' - LabelValue 'Probability' - EndProcess2D - - EndAnalyser - -EndModule - EndLayer diff --git a/tests/data/dissolve/input/histogramCN-simple.txt b/tests/data/dissolve/input/histogramCN-simple.txt index ff69dfca70..e3aa16af21 100755 --- a/tests/data/dissolve/input/histogramCN-simple.txt +++ b/tests/data/dissolve/input/histogramCN-simple.txt @@ -91,30 +91,4 @@ Module HistogramCN 'CN(X-Y)' DistanceRange 0.0 2 EndModule -# Oxygen-oxygen coordination number (using Analysis module) -Module Analyse 'CN(X-Y)-Analyser' - Configuration 'Bulk' - Analyser - Select 'X' - Site Central 'X - ForEach - Select 'Y' - Site Other 'Y' - ReferenceSite 'X' - InclusiveRange 0.0 2.0 - EndSelect - CalculateExpression count - Expression Y.nSelected - EndCalculateExpression - IntegerCollect1D 'HistoCN' - QuantityX 'count' - EndIntegerCollect1D - EndForEach - EndSelect - Process1D 'CN' - SourceIntegerData 'HistoCN' - EndProcess1D - EndAnalyser -EndModule - EndLayer diff --git a/tests/data/dissolve/input/histogramCN-water.txt b/tests/data/dissolve/input/histogramCN-water.txt index 95d0e06282..5098a5eb50 100755 --- a/tests/data/dissolve/input/histogramCN-water.txt +++ b/tests/data/dissolve/input/histogramCN-water.txt @@ -109,37 +109,4 @@ Module HistogramCN 'CN(COM-COM)' DistanceRange 0.0 3.4 EndModule -# Oxygen-oxygen coordination number (using Analysis module) -Module Analyse 'CN(COM-COM)-Analyser' - Configuration 'Bulk' - Analyser - Select 'COM1' - Site Water 'COM' - ForEach - Select 'COM2' - Site Water 'COM' - ExcludeSameMolecule 'COM1' - ReferenceSite 'COM1' - InclusiveRange 0.0 3.4 - EndSelect - CalculateExpression count - Expression COM2.nSelected - EndCalculateExpression - IntegerCollect1D 'HistoCN' - QuantityX 'count' - EndIntegerCollect1D - EndForEach - EndSelect - Process1D 'CN' - SourceIntegerData 'HistoCN' - LabelValue 'gOO(r)' - LabelX 'r, Angstroms' - Normalisation - OperateNormalise - EndOperateNormalise - EndNormalisation - EndProcess1D - EndAnalyser -EndModule - EndLayer diff --git a/tests/data/dissolve/input/orientedSDF-benzene.txt b/tests/data/dissolve/input/orientedSDF-benzene.txt index 01150777e7..3603dd7122 100755 --- a/tests/data/dissolve/input/orientedSDF-benzene.txt +++ b/tests/data/dissolve/input/orientedSDF-benzene.txt @@ -177,58 +177,4 @@ Module OrientedSDF 'OrientedSDF(R-R)' RangeZ -10.25 10.25 0.5 EndModule -# Center-of-mass radial distribution function, with analyser -Module Analyse 'OrientedSDF(R-R)_Analyser' - Configuration 'Bulk' - Analyser - Select 'A' - Site Benzene 'Ring' - ForEach - Select 'B' - Site Benzene 'Ring' - ExcludeSameMolecule 'A' - ForEach - CalculateAxisAngle 'angleRR' - I 'A' - AxisI 'Z' - J 'B' - AxisJ 'Z' - Symmetric True - EndCalculateAxisAngle - IfValueInRange - Value 'angleRR.theta' - ValidRange -10.0 10.0 - Then - CalculateVector 'vRR' - I 'A' - J 'B' - RotateIntoFrame True - EndCalculateVector - Collect3D 'OSDF' - QuantityX 'vRR' 0 - QuantityY 'vRR' 1 - QuantityZ 'vRR' 2 - RangeX -10.25 10.25 0.5 - RangeY -10.25 10.25 0.5 - RangeZ -10.25 10.25 0.5 - EndCollect3D - EndThen - EndIfValueInRange - EndForEach - EndSelect - EndForEach - EndSelect - Process3D 'SDF' - SourceData 'OSDF' - Normalisation - OperateSitePopulationNormalise - Site 'A' - EndOperateSitePopulationNormalise - OperateGridNormalise - EndOperateGridNormalise - EndNormalisation - EndProcess3D - EndAnalyser -EndModule - EndLayer diff --git a/tests/data/dissolve/input/sdf-benzene.txt b/tests/data/dissolve/input/sdf-benzene.txt index 48118f351b..cd545f7277 100755 --- a/tests/data/dissolve/input/sdf-benzene.txt +++ b/tests/data/dissolve/input/sdf-benzene.txt @@ -173,46 +173,4 @@ Module SDF 'SDF(R-R) RangeZ -10.25 10.25 0.5 EndModule -# Spatial distribution of ring centres, with analyser -Module Analyse 'SDF(R-R)_Analyser' - Configuration 'Bulk' - Analyser - Select 'A' - Site Benzene 'Ring' - ForEach - Select 'B' - Site Benzene 'Ring' - ExcludeSameMolecule 'A' - ExcludeSameSite 'A' - ForEach - CalculateVector 'vRR' - I 'A' - J 'B' - RotateIntoFrame True - EndCalculateVector - Collect3D 'OSDF' - QuantityX 'vRR' 0 - QuantityY 'vRR' 1 - QuantityZ 'vRR' 2 - RangeX -10.25 10.25 0.5 - RangeY -10.25 10.25 0.5 - RangeZ -10.25 10.25 0.5 - EndCollect3D - EndForEach - EndSelect - EndForEach - EndSelect - Process3D 'SDF' - SourceData 'OSDF' - Normalisation - OperateSitePopulationNormalise - Site 'A' - EndOperateSitePopulationNormalise - OperateGridNormalise - EndOperateGridNormalise - EndNormalisation - EndProcess3D - EndAnalyser -EndModule - EndLayer diff --git a/tests/data/dissolve/input/siteRDF-water.txt b/tests/data/dissolve/input/siteRDF-water.txt index d393b06abc..ed45799523 100755 --- a/tests/data/dissolve/input/siteRDF-water.txt +++ b/tests/data/dissolve/input/siteRDF-water.txt @@ -113,47 +113,6 @@ Module SiteRDF 'RDF(OW-OW)' DistanceRange 0.0 20.0 0.01 EndModule -# Oxygen-oxygen radial distribution function (using Analysis module) -Module Analyse 'RDF(OW-OW)-Analyser' - Configuration 'Bulk' - Analyser - Select 'O1' - Site Water 'O' - ForEach - Select 'O2' - Site Water 'O' - ExcludeSameMolecule 'O1' - ForEach - CalculateDistance 'rOO' - I 'O1' - J 'O2' - EndCalculateDistance - Collect1D 'HistoOO' - QuantityX 'rOO' - RangeX 0.0 20.0 0.01 - EndCollect1D - EndForEach - EndSelect - EndForEach - EndSelect - Process1D 'RDF' - SourceData 'HistoOO' - LabelValue 'gOO(r)' - LabelX 'r, Angstroms' - Normalisation - OperateSitePopulationNormalise - Site 'O1' - EndOperateSitePopulationNormalise - OperateNumberDensityNormalise - Site 'O2' - EndOperateNumberDensityNormalise - OperateSphericalShellNormalise - EndOperateSphericalShellNormalise - EndNormalisation - EndProcess1D - EndAnalyser -EndModule - # Hydrogen-hydrogen (H1-H2, 1-3) radial distribution function, excluding intramolecular correlations Module SiteRDF 'RDF(H1-H2)' Configuration 'Bulk' @@ -163,47 +122,6 @@ Module SiteRDF 'RDF(H1-H2)' DistanceRange 0.0 20.0 0.01 EndModule -# Hydrogen-hydrogen (H1-H2, 1-3) radial distribution function, excluding intramolecular correlations, using analyser -Module Analyse 'RDF(H1-H2)-Analyser' - Configuration 'Bulk' - Analyser - Select 'A' - Site Water 'H1' - ForEach - Select 'B' - Site Water 'H2' - ExcludeSameMolecule 'A' - ForEach - CalculateDistance 'rHH' - I 'A' - J 'B' - EndCalculateDistance - Collect1D 'HistoHH' - QuantityX 'rHH' - RangeX 0.0 20.0 0.01 - EndCollect1D - EndForEach - EndSelect - EndForEach - EndSelect - Process1D 'RDF' - SourceData 'HistoHH' - LabelValue 'gHH(r)' - LabelX 'r, Angstroms' - Normalisation - OperateSitePopulationNormalise - Site 'A' - EndOperateSitePopulationNormalise - OperateNumberDensityNormalise - Site 'B' - EndOperateNumberDensityNormalise - OperateSphericalShellNormalise - EndOperateSphericalShellNormalise - EndNormalisation - EndProcess1D - EndAnalyser -EndModule - # Center-of-mass radial distribution function Module SiteRDF 'RDF(COM-COM)' Configuration 'Bulk' @@ -216,45 +134,4 @@ Module SiteRDF 'RDF(COM-COM)' RangeBEnabled True EndModule -# Center-of-mass radial distribution function, with analyser -Module Analyse 'RDF(COM-COM)-Analyser' - Configuration 'Bulk' - Analyser - Select 'A' - Site Water 'COM' - ForEach - Select 'B' - Site Water 'COM' - ExcludeSameMolecule 'A' - ForEach - CalculateDistance 'rCOMCOM' - I 'A' - J 'B' - EndCalculateDistance - Collect1D 'HistoCOMCOM' - QuantityX 'rCOMCOM' - RangeX 0.0 20.0 0.05 - EndCollect1D - EndForEach - EndSelect - EndForEach - EndSelect - Process1D 'RDF' - SourceData 'HistoCOMCOM' - LabelValue 'gCOMCOM(r)' - LabelX 'r, Angstroms' - Normalisation - OperateSitePopulationNormalise - Site 'A' - EndOperateSitePopulationNormalise - OperateNumberDensityNormalise - Site 'B' - EndOperateNumberDensityNormalise - OperateSphericalShellNormalise - EndOperateSphericalShellNormalise - EndNormalisation - EndProcess1D - EndAnalyser -EndModule - EndLayer diff --git a/tests/data/dissolve/input/siteRDF-waterDynamic.txt b/tests/data/dissolve/input/siteRDF-waterDynamic.txt index b408f847a8..5a3ea3391b 100755 --- a/tests/data/dissolve/input/siteRDF-waterDynamic.txt +++ b/tests/data/dissolve/input/siteRDF-waterDynamic.txt @@ -103,47 +103,6 @@ Module SiteRDF 'RDF(OW-OW)' DistanceRange 0.0 20.0 0.01 EndModule -# Oxygen-oxygen radial distribution function (using Analysis module) -Module Analyse 'RDF(OW-OW)-Analyser' - Configuration 'Bulk' - Analyser - Select 'O1' - Site Water 'O' - ForEach - Select 'O2' - Site Water 'O' - ExcludeSameMolecule 'O1' - ForEach - CalculateDistance 'rOO' - I 'O1' - J 'O2' - EndCalculateDistance - Collect1D 'HistoOO' - QuantityX 'rOO' - RangeX 0.0 20.0 0.01 - EndCollect1D - EndForEach - EndSelect - EndForEach - EndSelect - Process1D 'RDF' - SourceData 'HistoOO' - LabelValue 'gOO(r)' - LabelX 'r, Angstroms' - Normalisation - OperateSitePopulationNormalise - Site 'O1' - EndOperateSitePopulationNormalise - OperateNumberDensityNormalise - Site 'O2' - EndOperateNumberDensityNormalise - OperateSphericalShellNormalise - EndOperateSphericalShellNormalise - EndNormalisation - EndProcess1D - EndAnalyser -EndModule - # Hydrogen-hydrogen (H-H, 1-3) radial distribution function, excluding intramolecular correlations Module SiteRDF 'RDF(H-H)' Configuration 'Bulk' @@ -153,45 +112,4 @@ Module SiteRDF 'RDF(H-H)' DistanceRange 0.0 20.0 0.01 EndModule -# Hydrogen-hydrogen (H-H, 1-3) radial distribution function, excluding intramolecular correlations, using analyser -Module Analyse 'RDF(H-H)-Analyser' - Configuration 'Bulk' - Analyser - Select 'A' - Site Water 'H' - ForEach - Select 'B' - Site Water 'H' - ExcludeSameMolecule 'A' - ForEach - CalculateDistance 'rHH' - I 'A' - J 'B' - EndCalculateDistance - Collect1D 'HistoHH' - QuantityX 'rHH' - RangeX 0.0 20.0 0.01 - EndCollect1D - EndForEach - EndSelect - EndForEach - EndSelect - Process1D 'RDF' - SourceData 'HistoHH' - LabelValue 'gHH(r)' - LabelX 'r, Angstroms' - Normalisation - OperateSitePopulationNormalise - Site 'A' - EndOperateSitePopulationNormalise - OperateNumberDensityNormalise - Site 'B' - EndOperateNumberDensityNormalise - OperateSphericalShellNormalise - EndOperateSphericalShellNormalise - EndNormalisation - EndProcess1D - EndAnalyser -EndModule - EndLayer diff --git a/tests/data/dissolve/input/siteRDF-waterFragments.txt b/tests/data/dissolve/input/siteRDF-waterFragments.txt index f8e8b77a6e..8d7c690868 100755 --- a/tests/data/dissolve/input/siteRDF-waterFragments.txt +++ b/tests/data/dissolve/input/siteRDF-waterFragments.txt @@ -101,47 +101,6 @@ Layer 'Processing' DistanceRange 0.000000e+00 2.000000e+01 1.000000e-02 EndModule - Module Analyse 'RDF(OW-OW)-Analyser' - Configuration 'Bulk' - Analyser - Select 'O1' - Site 'Water' 'O' - ForEach - Select 'O2' - Site 'Water' 'O' - ExcludeSameMolecule 'O1' - ForEach - CalculateDistance 'rOO' - I 'O1' - J 'O2' - EndCalculateDistance - Collect1D 'HistoOO' - QuantityX 'rOO' 0 - RangeX 0.000000e+00 2.000000e+01 1.000000e-02 - EndCollect1D - EndForEach - EndSelect - EndForEach - EndSelect - Process1D 'RDF' - SourceData 'HistoOO' - LabelValue 'gOO(r)' - LabelX 'r, Angstroms' - Normalisation - OperateSitePopulationNormalise 'OperateSitePopulationNormalise01' - Site 'O1' - EndOperateSitePopulationNormalise - OperateNumberDensityNormalise 'OperateNumberDensityNormalise01' - Site 'O2' - Population Available - EndOperateNumberDensityNormalise - OperateSphericalShellNormalise 'OperateSphericalShellNormalise01' - EndOperateSphericalShellNormalise - EndNormalisation - EndProcess1D - EndAnalyser - EndModule - Module SiteRDF 'RDF(H1-H2)' Frequency 1 Configuration 'Bulk' @@ -150,50 +109,6 @@ Layer 'Processing' ExcludeSameMolecule True EndModule - Module Analyse 'RDF(H1-H2)-Analyser' - Frequency 1 - Configuration 'Bulk' - Analyser - Select 'A' - Site 'Water' 'H' - InclusiveRange 0.000000e+00 5.000000e+00 - ForEach - Select 'B' - Site 'Water' 'H' - ExcludeSameMolecule 'A' - InclusiveRange 0.000000e+00 5.000000e+00 - ForEach - CalculateDistance 'rHH' - I 'A' - J 'B' - EndCalculateDistance - Collect1D 'HistoHH' - QuantityX 'rHH' 0 - RangeX 0.000000e+00 2.000000e+01 1.000000e-02 - EndCollect1D - EndForEach - EndSelect - EndForEach - EndSelect - Process1D 'RDF' - SourceData 'HistoHH' - LabelValue 'gHH(r)' - LabelX 'r, Angstroms' - Normalisation - OperateSitePopulationNormalise 'OperateSitePopulationNormalise01' - Site 'A' - EndOperateSitePopulationNormalise - OperateNumberDensityNormalise 'OperateNumberDensityNormalise01' - Site 'B' - Population Available - EndOperateNumberDensityNormalise - OperateSphericalShellNormalise 'OperateSphericalShellNormalise01' - EndOperateSphericalShellNormalise - EndNormalisation - EndProcess1D - EndAnalyser - EndModule - Module SiteRDF 'RDF(COM-COM)' Frequency 1 Configuration 'Bulk' @@ -206,46 +121,4 @@ Layer 'Processing' ExcludeSameMolecule On EndModule - Module Analyse 'RDF(COM-COM)-Analyser' - Frequency 1 - Configuration 'Bulk' - Analyser - Select 'A' - Site 'Water' 'COM' - ForEach - Select 'B' - Site 'Water' 'COM' - ExcludeSameMolecule 'A' - ForEach - CalculateDistance 'rCOMCOM' - I 'A' - J 'B' - EndCalculateDistance - Collect1D 'HistoCOMCOM' - QuantityX 'rCOMCOM' 0 - RangeX 0.000000e+00 2.000000e+01 5.000000e-02 - EndCollect1D - EndForEach - EndSelect - EndForEach - EndSelect - Process1D 'RDF' - SourceData 'HistoCOMCOM' - LabelValue 'gCOMCOM(r)' - LabelX 'r, Angstroms' - Normalisation - OperateSitePopulationNormalise 'OperateSitePopulationNormalise01' - Site 'A' - EndOperateSitePopulationNormalise - OperateNumberDensityNormalise 'OperateNumberDensityNormalise01' - Site 'B' - Population Available - EndOperateNumberDensityNormalise - OperateSphericalShellNormalise 'OperateSphericalShellNormalise01' - EndOperateSphericalShellNormalise - EndNormalisation - EndProcess1D - EndAnalyser - EndModule - EndLayer diff --git a/tests/data/dissolve/input/siteRDF-waterNPT.txt b/tests/data/dissolve/input/siteRDF-waterNPT.txt index 53d083cb82..8c52be9189 100755 --- a/tests/data/dissolve/input/siteRDF-waterNPT.txt +++ b/tests/data/dissolve/input/siteRDF-waterNPT.txt @@ -113,47 +113,6 @@ Module SiteRDF 'RDF(OW-OW)' DistanceRange 0.0 20.0 0.01 EndModule -# Oxygen-oxygen radial distribution function (using Analysis module) -Module Analyse 'RDF(OW-OW)-Analyser' - Configuration 'Bulk' - Analyser - Select 'O1' - Site Water 'O' - ForEach - Select 'O2' - Site Water 'O' - ExcludeSameMolecule 'O1' - ForEach - CalculateDistance 'rOO' - I 'O1' - J 'O2' - EndCalculateDistance - Collect1D 'HistoOO' - QuantityX 'rOO' - RangeX 0.0 20.0 0.01 - EndCollect1D - EndForEach - EndSelect - EndForEach - EndSelect - Process1D 'RDF' - SourceData 'HistoOO' - LabelValue 'gOO(r)' - LabelX 'r, Angstroms' - Normalisation - OperateSitePopulationNormalise - Site 'O1' - EndOperateSitePopulationNormalise - OperateNumberDensityNormalise - Site 'O2' - EndOperateNumberDensityNormalise - OperateSphericalShellNormalise - EndOperateSphericalShellNormalise - EndNormalisation - EndProcess1D - EndAnalyser -EndModule - # Hydrogen-hydrogen (H1-H2, 1-3) radial distribution function, excluding intramolecular correlations Module SiteRDF 'RDF(H1-H2)' Configuration 'Bulk' @@ -163,47 +122,6 @@ Module SiteRDF 'RDF(H1-H2)' DistanceRange 0.0 20.0 0.01 EndModule -# Hydrogen-hydrogen (H1-H2, 1-3) radial distribution function, excluding intramolecular correlations, using analyser -Module Analyse 'RDF(H1-H2)-Analyser' - Configuration 'Bulk' - Analyser - Select 'A' - Site Water 'H1' - ForEach - Select 'B' - Site Water 'H2' - ExcludeSameMolecule 'A' - ForEach - CalculateDistance 'rHH' - I 'A' - J 'B' - EndCalculateDistance - Collect1D 'HistoHH' - QuantityX 'rHH' - RangeX 0.0 20.0 0.01 - EndCollect1D - EndForEach - EndSelect - EndForEach - EndSelect - Process1D 'RDF' - SourceData 'HistoHH' - LabelValue 'gHH(r)' - LabelX 'r, Angstroms' - Normalisation - OperateSitePopulationNormalise - Site 'A' - EndOperateSitePopulationNormalise - OperateNumberDensityNormalise - Site 'B' - EndOperateNumberDensityNormalise - OperateSphericalShellNormalise - EndOperateSphericalShellNormalise - EndNormalisation - EndProcess1D - EndAnalyser -EndModule - # Center-of-mass radial distribution function Module SiteRDF 'RDF(COM-COM)' Configuration 'Bulk' @@ -213,45 +131,4 @@ Module SiteRDF 'RDF(COM-COM)' DistanceRange 0.0 20.0 0.05 EndModule -# Center-of-mass radial distribution function, with analyser -Module Analyse 'RDF(COM-COM)-Analyser' - Configuration 'Bulk' - Analyser - Select 'A' - Site Water 'COM' - ForEach - Select 'B' - Site Water 'COM' - ExcludeSameMolecule 'A' - ForEach - CalculateDistance 'rCOMCOM' - I 'A' - J 'B' - EndCalculateDistance - Collect1D 'HistoCOMCOM' - QuantityX 'rCOMCOM' - RangeX 0.0 20.0 0.05 - EndCollect1D - EndForEach - EndSelect - EndForEach - EndSelect - Process1D 'RDF' - SourceData 'HistoCOMCOM' - LabelValue 'gCOMCOM(r)' - LabelX 'r, Angstroms' - Normalisation - OperateSitePopulationNormalise - Site 'A' - EndOperateSitePopulationNormalise - OperateNumberDensityNormalise - Site 'B' - EndOperateNumberDensityNormalise - OperateSphericalShellNormalise - EndOperateSphericalShellNormalise - EndNormalisation - EndProcess1D - EndAnalyser -EndModule - EndLayer diff --git a/tests/gui/procedure.cpp b/tests/gui/procedure.cpp index 4bdde1505b..3014d6578c 100644 --- a/tests/gui/procedure.cpp +++ b/tests/gui/procedure.cpp @@ -6,8 +6,6 @@ #include "gui/models/procedureModel.h" #include "main/dissolve.h" #include "procedure/nodes/add.h" -#include "procedure/nodes/calculateDistance.h" -#include "procedure/nodes/collect1D.h" #include "procedure/nodes/select.h" #include @@ -25,15 +23,14 @@ TEST(ProcedureModelTest, Basic) auto selectB = forEachA.create("B"); auto &forEachB = selectB->branch()->get(); auto selectC = forEachB.create("C"); - auto calcAB = procedure.createRootNode({}, selectA, selectB); - auto collect = procedure.createRootNode({}, calcAB); + EXPECT_TRUE(procedure.rootSequence().check()); ProcedureModel model(procedure); // Check out model root EXPECT_EQ(model.columnCount(QModelIndex()), 2); - EXPECT_EQ(model.rowCount(QModelIndex()), 3); + EXPECT_EQ(model.rowCount(QModelIndex()), 1); // Check out "SelectA" child in root sequence auto selectAChild = model.index(0, 0); @@ -55,15 +52,6 @@ TEST(ProcedureModelTest, Basic) EXPECT_EQ(model.rowCount(selectCChild), 0); EXPECT_EQ(model.data(selectCChild, Qt::DisplayRole).toString().toStdString(), "C (Select)"); EXPECT_EQ(model.data(selectCChild, Qt::UserRole).value(), selectC); - - // Check out "Collect1D" child in root sequence - auto collectChild = model.index(2, 0); - EXPECT_EQ(model.columnCount(collectChild), 2); - EXPECT_EQ(model.rowCount(collectChild), 0); - EXPECT_EQ(model.data(collectChild, Qt::DisplayRole).toString().toStdString(), "Collect1D01 (Collect1D)"); - EXPECT_EQ(model.data(collectChild, Qt::UserRole).value(), collect); - - EXPECT_EQ(model.parent(collectChild).isValid(), QModelIndex().isValid()); } } // namespace UnitTest diff --git a/tests/modules/dAngle.cpp b/tests/modules/dAngle.cpp index b469e4873f..015026d7ce 100644 --- a/tests/modules/dAngle.cpp +++ b/tests/modules/dAngle.cpp @@ -22,18 +22,10 @@ TEST_F(DAngleModuleTest, Water) "DAngle(X-H...O)//RDF(BC)", {"dlpoly/water267-analysis/water-267-298K.aardf_21_23_inter_sum", Data1DImportFileFormat::Data1DImportFormat::XY}, 3.0e-3)); - EXPECT_TRUE(systemTest.checkData1D( - "DAngle(X-H...O)-Analyser//Process1D//RDF", - {"dlpoly/water267-analysis/water-267-298K.aardf_21_23_inter_sum", Data1DImportFileFormat::Data1DImportFormat::XY}, - 3.0e-3)); EXPECT_TRUE(systemTest.checkData1D("DAngle(X-H...O)//Angle(ABC)", {"dlpoly/water267-analysis/water-267-298K.dahist1_02_1_01_02.angle.norm", Data1DImportFileFormat::Data1DImportFormat::XY}, 6.0e-5)); - EXPECT_TRUE(systemTest.checkData1D("DAngle(X-H...O)-Analyser//Process1D//Angle", - {"dlpoly/water267-analysis/water-267-298K.dahist1_02_1_01_02.angle.norm", - Data1DImportFileFormat::Data1DImportFormat::XY}, - 6.0e-5)); } } // namespace UnitTest diff --git a/tests/modules/histogramCN.cpp b/tests/modules/histogramCN.cpp index 1be1c4a0ff..a0706a2685 100644 --- a/tests/modules/histogramCN.cpp +++ b/tests/modules/histogramCN.cpp @@ -21,9 +21,6 @@ TEST_F(HistogramCNModuleTest, Simple) EXPECT_TRUE(systemTest.checkData1D( "CN(X-Y)//Histogram", {"dissolve/input/histogramCN-simple.dat", Data1DImportFileFormat::Data1DImportFormat::XY, 1, 3}, 1.0e-8)); - EXPECT_TRUE(systemTest.checkData1D( - "CN(X-Y)-Analyser//Process1D//CN", - {"dissolve/input/histogramCN-simple.dat", Data1DImportFileFormat::Data1DImportFormat::XY, 1, 2}, 1.0e-8)); } TEST_F(HistogramCNModuleTest, Water) @@ -34,9 +31,6 @@ TEST_F(HistogramCNModuleTest, Water) EXPECT_TRUE(systemTest.checkData1D( "CN(COM-COM)//Histogram", {"dlpoly/water267-analysis/water-267-298K.cn11", Data1DImportFileFormat::Data1DImportFormat::XY, 1, 3}, 1.0e-8)); - EXPECT_TRUE(systemTest.checkData1D( - "CN(COM-COM)-Analyser//Process1D//CN", - {"dlpoly/water267-analysis/water-267-298K.cn11", Data1DImportFileFormat::Data1DImportFormat::XY, 1, 3}, 1.0e-8)); } } // namespace UnitTest diff --git a/tests/modules/orientedSDF.cpp b/tests/modules/orientedSDF.cpp index b0ccc2bfd4..2b09187597 100644 --- a/tests/modules/orientedSDF.cpp +++ b/tests/modules/orientedSDF.cpp @@ -21,6 +21,5 @@ TEST_F(OrientedSDFModuleTest, Benzene) EXPECT_TRUE(systemTest.checkData3D( "OrientedSDF(R-R)//SDF", {"dlpoly/benzene181/benzene181.11.pdens.zOrient0_10", Data3DImportFileFormat::Data3DImportFormat::PDens}, 0.09)); - EXPECT_TRUE(systemTest.checkData3D("OrientedSDF(R-R)//SDF", "OrientedSDF(R-R)_Analyser//Process3D//SDF", 1.0e-5)); } } // namespace UnitTest diff --git a/tests/modules/sdf.cpp b/tests/modules/sdf.cpp index 4e35b80295..ed4d53dbb5 100644 --- a/tests/modules/sdf.cpp +++ b/tests/modules/sdf.cpp @@ -31,6 +31,5 @@ TEST_F(SDFModuleTest, Benzene) EXPECT_TRUE(systemTest.checkData3D( "SDF(R-R)//SDF", {"dlpoly/benzene181/benzene181.11.pdens", Data3DImportFileFormat::Data3DImportFormat::PDens}, 0.3)); - EXPECT_TRUE(systemTest.checkData3D("SDF(R-R)//SDF", "SDF(R-R)_Analyser//Process3D//SDF", 1.0e-5)); } } // namespace UnitTest diff --git a/tests/modules/siteRDF.cpp b/tests/modules/siteRDF.cpp index 0afedb8c22..bd370bdd8c 100644 --- a/tests/modules/siteRDF.cpp +++ b/tests/modules/siteRDF.cpp @@ -23,28 +23,17 @@ TEST_F(SiteRDFModuleTest, Water) "RDF(OW-OW)//RDF", {"dlpoly/water267-analysis/water-267-298K.aardf1_02_02", Data1DImportFileFormat::Data1DImportFormat::XY, 1, 2}, 1.0e-2)); - EXPECT_TRUE(systemTest.checkData1D( - "RDF(OW-OW)-Analyser//Process1D//RDF", - {"dlpoly/water267-analysis/water-267-298K.aardf1_02_02", Data1DImportFileFormat::Data1DImportFormat::XY, 1, 2}, - 1.0e-2)); // H1-H2 RDF, excluding intramolecular interactions EXPECT_TRUE(systemTest.checkData1D( "RDF(H1-H2)//RDF", {"dlpoly/water267-analysis/water-267-298K.aardf1_01_03", Data1DImportFileFormat::Data1DImportFormat::XY, 1, 2}, 5.0e-3)); - EXPECT_TRUE(systemTest.checkData1D( - "RDF(H1-H2)-Analyser//Process1D//RDF", - {"dlpoly/water267-analysis/water-267-298K.aardf1_01_03", Data1DImportFileFormat::Data1DImportFormat::XY, 1, 2}, - 5.0e-3)); // COM-COM RDF EXPECT_TRUE(systemTest.checkData1D( "RDF(COM-COM)//RDF", {"dlpoly/water267-analysis/water-267-298K.rdf11", Data1DImportFileFormat::Data1DImportFormat::XY, 1, 2}, 5.0e-4)); - EXPECT_TRUE(systemTest.checkData1D( - "RDF(COM-COM)-Analyser//Process1D//RDF", - {"dlpoly/water267-analysis/water-267-298K.rdf11", Data1DImportFileFormat::Data1DImportFormat::XY, 1, 2}, 5.0e-4)); // Coordination numbers EXPECT_TRUE(systemTest.checkSampledDouble("coordination number A", "RDF(COM-COM)//CN//A", 4.32359551, 5.0e-3)); @@ -60,25 +49,16 @@ TEST_F(SiteRDFModuleTest, WaterNPT) EXPECT_TRUE(systemTest.checkData1D( "RDF(OW-OW)//RDF", {"dlpoly/water267-npt/water-267-298K.aardf1_02_02", Data1DImportFileFormat::Data1DImportFormat::XY, 1, 2}, 2.0e-2)); - EXPECT_TRUE(systemTest.checkData1D( - "RDF(OW-OW)-Analyser//Process1D//RDF", - {"dlpoly/water267-npt/water-267-298K.aardf1_02_02", Data1DImportFileFormat::Data1DImportFormat::XY, 1, 2}, 2.0e-2)); // H1-H2 RDF, excluding intramolecular interactions EXPECT_TRUE(systemTest.checkData1D( "RDF(H1-H2)//RDF", {"dlpoly/water267-npt/water-267-298K.aardf1_01_03", Data1DImportFileFormat::Data1DImportFormat::XY, 1, 2}, 2.0e-2)); - EXPECT_TRUE(systemTest.checkData1D( - "RDF(H1-H2)-Analyser//Process1D//RDF", - {"dlpoly/water267-npt/water-267-298K.aardf1_01_03", Data1DImportFileFormat::Data1DImportFormat::XY, 1, 2}, 2.0e-2)); // COM-COM RDF EXPECT_TRUE(systemTest.checkData1D( "RDF(COM-COM)//RDF", {"dlpoly/water267-npt/water-267-298K.rdf11", Data1DImportFileFormat::Data1DImportFormat::XY, 1, 2}, 7.0e-3)); - EXPECT_TRUE(systemTest.checkData1D( - "RDF(COM-COM)-Analyser//Process1D//RDF", - {"dlpoly/water267-npt/water-267-298K.rdf11", Data1DImportFileFormat::Data1DImportFormat::XY, 1, 2}, 7.0e-3)); } TEST_F(SiteRDFModuleTest, WaterDynamic) @@ -91,20 +71,12 @@ TEST_F(SiteRDFModuleTest, WaterDynamic) "RDF(OW-OW)//RDF", {"dlpoly/water267-analysis/water-267-298K.aardf1_02_02", Data1DImportFileFormat::Data1DImportFormat::XY, 1, 2}, 9.0e-3)); - EXPECT_TRUE(systemTest.checkData1D( - "RDF(OW-OW)-Analyser//Process1D//RDF", - {"dlpoly/water267-analysis/water-267-298K.aardf1_02_02", Data1DImportFileFormat::Data1DImportFormat::XY, 1, 2}, - 9.0e-2)); // H1-H2 RDF, excluding intramolecular interactions EXPECT_TRUE(systemTest.checkData1D( "RDF(H-H)//RDF", {"dlpoly/water267-analysis/water-267-298K.aardf1_HHsum", Data1DImportFileFormat::Data1DImportFormat::XY, 1, 2}, 3.0e-3)); - EXPECT_TRUE(systemTest.checkData1D( - "RDF(H-H)-Analyser//Process1D//RDF", - {"dlpoly/water267-analysis/water-267-298K.aardf1_HHsum", Data1DImportFileFormat::Data1DImportFormat::XY, 1, 2}, - 3.0e-3)); } TEST_F(SiteRDFModuleTest, WaterFragments) @@ -117,28 +89,17 @@ TEST_F(SiteRDFModuleTest, WaterFragments) "RDF(OW-OW)//RDF", {"dlpoly/water267-analysis/water-267-298K.aardf1_02_02", Data1DImportFileFormat::Data1DImportFormat::XY, 1, 2}, 1.0e-2)); - EXPECT_TRUE(systemTest.checkData1D( - "RDF(OW-OW)-Analyser//Process1D//RDF", - {"dlpoly/water267-analysis/water-267-298K.aardf1_02_02", Data1DImportFileFormat::Data1DImportFormat::XY, 1, 2}, - 1.0e-2)); // H1-H2 RDF, excluding intramolecular interactions EXPECT_TRUE(systemTest.checkData1D( "RDF(H1-H2)//RDF", {"dlpoly/water267-analysis/water-267-298K.aardf1_HHsum", Data1DImportFileFormat::Data1DImportFormat::XY, 1, 2}, 5.0e-3)); - EXPECT_TRUE(systemTest.checkData1D( - "RDF(H1-H2)-Analyser//Process1D//RDF", - {"dlpoly/water267-analysis/water-267-298K.aardf1_HHsum", Data1DImportFileFormat::Data1DImportFormat::XY, 1, 2}, - 5.0e-3)); // COM-COM RDF EXPECT_TRUE(systemTest.checkData1D( "RDF(COM-COM)//RDF", {"dlpoly/water267-analysis/water-267-298K.rdf11", Data1DImportFileFormat::Data1DImportFormat::XY, 1, 2}, 5.0e-4)); - EXPECT_TRUE(systemTest.checkData1D( - "RDF(COM-COM)-Analyser//Process1D//RDF", - {"dlpoly/water267-analysis/water-267-298K.rdf11", Data1DImportFileFormat::Data1DImportFormat::XY, 1, 2}, 5.0e-4)); // Coordination numbers EXPECT_TRUE(systemTest.checkSampledDouble("coordination number A", "RDF(COM-COM)//CN//A", 4.32359551, 5.0e-3)); diff --git a/tests/procedure/CMakeLists.txt b/tests/procedure/CMakeLists.txt index b149ec118f..dc41cfe287 100644 --- a/tests/procedure/CMakeLists.txt +++ b/tests/procedure/CMakeLists.txt @@ -1,4 +1,3 @@ -dissolve_add_test(SRC calculateExpression.cpp) dissolve_add_test(SRC procedure.cpp) dissolve_add_test(SRC rotateFragment.cpp) dissolve_add_test(SRC select.cpp) diff --git a/tests/procedure/calculateExpression.cpp b/tests/procedure/calculateExpression.cpp deleted file mode 100644 index 2821d984d5..0000000000 --- a/tests/procedure/calculateExpression.cpp +++ /dev/null @@ -1,50 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (c) 2024 Team Dissolve and contributors - -#include "procedure/nodes/calculateExpression.h" -#include "procedure/nodes/select.h" -#include "procedure/procedure.h" -#include "src/math/constants.h" -#include -#include - -namespace UnitTest -{ - -TEST(CalculateExpressionProcedureNodeTest, Basic) -{ - Procedure procedure(ProcedureNode::AnalysisContext); - - // No expression set - auto expressionNode = procedure.createRootNode("X"); - EXPECT_TRUE(procedure.rootSequence().check()); - - // Simple number - expressionNode->keywords().set("Expression", NodeValueProxy(4)); - expressionNode->execute({}); - EXPECT_DOUBLE_EQ(expressionNode->value(0), 4.0); - - // Expressions - expressionNode->keywords().set("Expression", NodeValueProxy("3.8 * sin(1.2)")); - expressionNode->execute({}); - EXPECT_DOUBLE_EQ(expressionNode->value(0), 3.8 * sin(1.2)); -} - -TEST(CalculateExpressionProcedureNodeTest, NodeParameters) -{ - Procedure procedure(ProcedureNode::AnalysisContext); - auto A = procedure.createRootNode("A"); - - // Create a CalculateExpression node to play with - auto expressionNode = procedure.createRootNode("X"); - EXPECT_TRUE(procedure.rootSequence().check()); - - // Access parameter in Select node - EXPECT_TRUE(expressionNode->setExpression("A.nSelected")); - EXPECT_DOUBLE_EQ(expressionNode->value(0), 0); - - // Invalid parameter - EXPECT_FALSE(expressionNode->setExpression("B.nSelected")); -} - -} // namespace UnitTest diff --git a/tests/procedure/procedure.cpp b/tests/procedure/procedure.cpp index 21b2aa41d5..94dd3dcc2e 100644 --- a/tests/procedure/procedure.cpp +++ b/tests/procedure/procedure.cpp @@ -5,7 +5,6 @@ #include "keywords/node.h" #include "procedure/nodes/add.h" #include "procedure/nodes/box.h" -#include "procedure/nodes/ifValueInRange.h" #include "procedure/nodes/parameters.h" #include "procedure/nodes/select.h" #include @@ -44,13 +43,6 @@ TEST(ProcedureTest, Context) // Node with same name as an existing one EXPECT_THROW(procedure.createRootNode("A"), std::runtime_error); - - // Create a new node with an InheritContext type - auto ifValue = forEachB.create("IfValue"); - auto &ifThen = ifValue->branch()->get(); - EXPECT_TRUE(procedure.rootSequence().check()); - EXPECT_EQ(ifThen.context(), ProcedureNode::NodeContext::AnalysisContext); - EXPECT_TRUE(ifValue->isContextRelevant(forEachB.context())); } TEST(ProcedureTest, Scope)