Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions src/base/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@

#pragma once

// Forward Declarations
class CoreData;

// Version Counter
class VersionCounter
{
Expand Down
4 changes: 0 additions & 4 deletions src/classes/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,6 @@ class Configuration : public Serialisable
* Serialisation
*/
public:
// Write through specified LineParser
bool serialise(LineParser &parser) const;
// Read from specified LineParser
bool deserialise(LineParser &parser, const CoreData &coreData, bool hasPotentials);
// Express as a serialisable value
void serialise(std::string tag, SerialisedValue &target) const override;
// Read values from a serialisable value
Expand Down
1 change: 0 additions & 1 deletion src/classes/isotopologue.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
// Forward Declarations
class AtomType;
class Species;
class CoreData;

/*
* Isotopologue Definition
Expand Down
1 change: 0 additions & 1 deletion src/classes/kVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

// Forward Declarations
class BraggReflection;
class CoreData;

// K-Vector
class KVector
Expand Down
1 change: 0 additions & 1 deletion src/classes/speciesAtom.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

// Forward Declarations
class AtomType;
class CoreData;
class SpeciesAngle;
class SpeciesBond;
class SpeciesImproper;
Expand Down
2 changes: 1 addition & 1 deletion src/classes/speciesSite.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ class SpeciesSite : public Serialisable
// Express as a serialisable value
void serialise(std::string tag, SerialisedValue &target) const override;
// Read values from a serialisable value
void deserialise(const SerialisedValue &node);
void deserialise(const SerialisedValue &node) override;
};

template <> struct Context<const SpeciesSite *>
Expand Down
1 change: 0 additions & 1 deletion src/gui/getConfigurationNameDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <QDialog>

// Forward Declarations
class CoreData;
class Configuration;

// Get Configuration Name Dialog
Expand Down
1 change: 0 additions & 1 deletion src/gui/getModuleLayerNameDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <QDialog>

// Forward Declarations
class CoreData;
class ModuleLayer;

// Get Layer Name Dialog
Expand Down
1 change: 0 additions & 1 deletion src/gui/getSpeciesNameDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <QDialog>

// Forward Declarations
class CoreData;
class Species;

// Get Species Name Dialog
Expand Down
1 change: 0 additions & 1 deletion src/gui/getTabNameDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <QDialog>

// Forward Declarations
class CoreData;
class MainTab;

// Get MainTab Name Dialog
Expand Down
1 change: 0 additions & 1 deletion src/math/sampledDouble.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include "base/serialiser.h"

// Forward Declarations
class CoreData;
class LineParser;
class ProcessPool;

Expand Down
1 change: 0 additions & 1 deletion src/math/sampledVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <vector>

// Forward Declarations
class CoreData;
class LineParser;

// Vector of double values with sampling
Expand Down
64 changes: 13 additions & 51 deletions src/nodes/md.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ MDNode::MDNode(Graph *parentGraph) : Node(parentGraph)
addOption("RandomVelocities", "Whether random velocities should always be assigned before beginning MD simulation",
randomVelocities_);

addOption("RestrictToSpecies", "Restrict the calculation to the specified Species", restrictToSpecies_);
addOption("OnlyWhenEnergyStable", "Only run MD when target Configuration energies are stable", onlyWhenEnergyStable_);

addOption("EnergyFrequency", "Frequency at which to calculate total system energy", energyFrequency_);
Expand Down Expand Up @@ -156,9 +155,6 @@ NodeConstants::ProcessResult MDNode::process()
message("Summary will be written every {} step(s).\n", outputFrequency);
else
message("Summary will not be written.\n");
if (!restrictToSpecies_.empty())
message("Calculation will be restricted to species: {}\n",
joinStrings(restrictToSpecies_, " ", [](const auto &sp) { return sp->name(); }));
message("\n");

// Create kernels
Expand Down Expand Up @@ -195,22 +191,6 @@ NodeConstants::ProcessResult MDNode::process()
double tInstant, ke, tScale;
Kernel::EnergyResult pe;

// Determine target molecules from the restrictedSpecies vector (if any)
std::vector<const Molecule *> targetMolecules;
std::vector<int> free(targetConfiguration_->nAtoms(), 0);
if (restrictToSpecies_.empty())
{
std::fill(free.begin(), free.end(), 1);
}
else
for (const auto &mol : targetConfiguration_->molecules())
if (std::find(restrictToSpecies_.begin(), restrictToSpecies_.end(), mol->species()) != restrictToSpecies_.end())
{
targetMolecules.push_back(mol.get());
auto offset = mol->globalAtomOffset();
std::fill(free.begin() + offset, free.begin() + offset + mol->atoms().size(), 1);
}

/*
* Calculation Begins
*/
Expand All @@ -227,12 +207,9 @@ NodeConstants::ProcessResult MDNode::process()

Messenger::print("Random initial velocities will be assigned.\n");
velocities.resize(targetConfiguration_->nAtoms(), Vector3());
for (auto &&[v, iFree] : zip(velocities, free))
for (auto &v : velocities)
{
if (iFree)
v.set(exp(DissolveMath::random() - 0.5), exp(DissolveMath::random() - 0.5), exp(DissolveMath::random() - 0.5));
else
v.zero();
v.set(exp(DissolveMath::random() - 0.5), exp(DissolveMath::random() - 0.5), exp(DissolveMath::random() - 0.5));
v /= sqrt(2.0 * M_PI);
}
}
Expand All @@ -256,23 +233,18 @@ NodeConstants::ProcessResult MDNode::process()
// Calculate total velocity and mass over all atoms
Vector3 vCom;
auto massSum = 0.0;
for (auto &&[v, m, iFree] : zip(velocities, mass, free))
for (auto &&[v, m] : zip(velocities, mass))
{
if (!iFree)
continue;
vCom += v * m;
massSum += m;
}

// Finalise initial velocities (unless considering intramolecular forces only)
if (!intramolecularForcesOnly_)
{
// Remove any velocity shift, and re-zero velocities on fixed atoms
// Remove any velocity shift
vCom /= massSum;
std::transform(velocities.begin(), velocities.end(), velocities.begin(), [vCom](auto vel) { return vel - vCom; });
for (auto &&[v, iFree] : zip(velocities, free))
if (!iFree)
v.zero();

// Calculate instantaneous temperature
ke = 0.0;
Expand Down Expand Up @@ -313,17 +285,11 @@ NodeConstants::ProcessResult MDNode::process()
// If we're not using a fixed timestep the forces need to be available immediately
if (timestepType_ != TimestepType::Fixed)
{
// Calculate forces
if (targetMolecules.empty())
{
if (intramolecularForcesOnly_)
forceKernel->totalForces(pairPotentialForces, geometryForces,
{Kernel::ExcludeInterMolecularPairPotential, Kernel::ExcludeExtended});
else
forceKernel->totalForces(pairPotentialForces, geometryForces);
}
if (intramolecularForcesOnly_)
forceKernel->totalForces(pairPotentialForces, geometryForces,
{Kernel::ExcludeInterMolecularPairPotential, Kernel::ExcludeExtended});
else
throw(std::runtime_error("Forces calculation on a set of molecules is currently not available.\n"));
forceKernel->totalForces(pairPotentialForces, geometryForces);

// Check for suitable timestep
if (!determineTimeStep(timestepType_, fixedTimestep, pairPotentialForces, geometryForces))
Expand Down Expand Up @@ -365,16 +331,12 @@ NodeConstants::ProcessResult MDNode::process()
targetConfiguration_->updateAtomLocations();

// Calculate forces
if (targetMolecules.empty())
{
if (intramolecularForcesOnly_)
forceKernel->totalForces(pairPotentialForces, geometryForces,
{Kernel::ExcludeInterMolecularPairPotential, Kernel::ExcludeExtended});
else
forceKernel->totalForces(pairPotentialForces, geometryForces);
}
if (intramolecularForcesOnly_)
forceKernel->totalForces(pairPotentialForces, geometryForces,
{Kernel::ExcludeInterMolecularPairPotential, Kernel::ExcludeExtended});
else
throw(std::runtime_error("Forces calculation on a set of molecules is currently not available.\n"));
forceKernel->totalForces(pairPotentialForces, geometryForces);

// Cap forces
if (capForces_)
nCapped = capForces(maxForce, pairPotentialForces, geometryForces);
Expand Down
2 changes: 0 additions & 2 deletions src/nodes/md.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ class MDNode : public Node
std::optional<Number> outputFrequency_{5};
// Whether random velocities should always be assigned before beginning MD simulation
bool randomVelocities_{false};
// Species to restrict calculation to
std::vector<const Species *> restrictToSpecies_;
// Write frequency for trajectory file
std::optional<Number> trajectoryFrequency_;
// Velocities
Expand Down
11 changes: 0 additions & 11 deletions src/nodes/parameter.h
Original file line number Diff line number Diff line change
Expand Up @@ -562,10 +562,6 @@ template <typename DataClass> class SerialisableParameter : public Parameter<Dat
{
};

template <serialisablePointer E> struct is_ptr_vector<std::vector<E>> : std::true_type
{
};

/*
* Serialisation
*/
Expand All @@ -587,8 +583,6 @@ template <typename DataClass> class SerialisableParameter : public Parameter<Dat
if (Parameter<DataClass>::data_)
result["data"] = *Parameter<DataClass>::data_;
}
else if constexpr (serialisablePointer<DataClass>)
Parameter<DataClass>::data_->serialise("data", result);
else
result["data"] = Parameter<DataClass>::data_;

Expand Down Expand Up @@ -629,11 +623,6 @@ template <typename DataClass> class SerialisableParameter : public Parameter<Dat
else
Parameter<DataClass>::data_ = {};
}
else if constexpr (serialisablePointer<DataClass>)
{
CoreData coreData; // Temporary patch until we fix up the deserialisation
Parameter<DataClass>::data_->deserialise(node.at("data"), coreData);
}
else
{
Parameter<DataClass>::data_ = toml::find<DataClass>(node, "data");
Expand Down
46 changes: 0 additions & 46 deletions tests/gui/optionalDoubleKeyword.cpp

This file was deleted.

46 changes: 0 additions & 46 deletions tests/gui/optionalIntegerKeyword.cpp

This file was deleted.

1 change: 0 additions & 1 deletion tests/nodes/graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ class GraphCoreTest : public ::testing::Test
}

protected:
// We need a CoreData and Dissolve definition to properly instantiate DissolveGraph at present.
DissolveGraph root_;
AddNode *x_{nullptr}, *y_{nullptr}, *z_{nullptr};
};
Expand Down
1 change: 0 additions & 1 deletion tests/nodes/loop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ class IterableGraphTest : public ::testing::Test
}

protected:
// We need a CoreData and Dissolve definition to properly instantiate DissolveGraph at present.
DissolveGraph root_;
NumberNode *i_{nullptr};
AddNode *x_{nullptr}, *y_{nullptr};
Expand Down
Loading
Loading