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
6 changes: 3 additions & 3 deletions src/classes/histogramSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ void HistogramSet::initialise(const std::vector<const AtomType *> &types, double
{
atomTypes_ = types;

fullHistograms_.clear(triangular_);
boundHistograms_.clear(triangular_);
unboundHistograms_.clear(triangular_);
fullHistograms_ = DoubleKeyedMap<Histogram1D>(triangular_);
boundHistograms_ = DoubleKeyedMap<Histogram1D>(triangular_);
unboundHistograms_ = DoubleKeyedMap<Histogram1D>(triangular_);

dissolve::for_each_pair(
ParallelPolicies::seq, atomTypes_,
Expand Down
8 changes: 4 additions & 4 deletions src/classes/neutronWeights.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ void NeutronWeights::calculateWeightingMatrices(const std::map<const Species *,
{
// Create weights matrices and calculate average scattering lengths
// Note: Multiplier of 0.1 on b terms converts from units of fm (1e-11 m) to barn (1e-12 m)
concentrationProducts_.clear(true);
boundCoherentProducts_.clear(true);
weights_.clear(true);
intramolecularWeights_.clear(true);
concentrationProducts_.clear();
boundCoherentProducts_.clear();
weights_.clear();
intramolecularWeights_.clear();
boundCoherentAverageOfSquares_ = 0.0;
boundCoherentSquareOfAverage_ = 0.0;
double ci, cj, bi, bj;
Expand Down
8 changes: 4 additions & 4 deletions src/classes/neutronWeights.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ class NeutronWeights
// Isotope mix
IsotopeMix isotopeMix_;
// Concentration product matrix (ci * cj)
DoubleKeyedMap<double> concentrationProducts_;
DoubleKeyedMap<double> concentrationProducts_{true};
// Bound coherent product matrix (bi * bj)
DoubleKeyedMap<double> boundCoherentProducts_;
DoubleKeyedMap<double> boundCoherentProducts_{true};
// Full scattering weights
DoubleKeyedMap<double> weights_;
DoubleKeyedMap<double> weights_{true};
// Intramolecular scattering weights
DoubleKeyedMap<double> intramolecularWeights_;
DoubleKeyedMap<double> intramolecularWeights_{true};
// Bound coherent average squared scattering (<b>**2)
double boundCoherentSquareOfAverage_;
// Bound coherent squared average scattering (<b**2>)
Expand Down
24 changes: 12 additions & 12 deletions src/classes/partialSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ void PartialSet::initialise(const KeyedVector<const Species *, int> &speciesPopu

triangular_ = triangular;

partials_.clear(triangular_);
boundPartials_.clear(triangular_);
unboundPartials_.clear(triangular_);
partials_ = DoubleKeyedMap<Data1D>(triangular_);
boundPartials_ = DoubleKeyedMap<Data1D>(triangular_);
unboundPartials_ = DoubleKeyedMap<Data1D>(triangular_);

// Create data for partials and set tags
dissolve::for_each_pair(
Expand Down Expand Up @@ -58,9 +58,9 @@ void PartialSet::initialise(const KeyedVector<const Species *, double> &realSpec

triangular_ = triangular;

partials_.clear(triangular_);
boundPartials_.clear(triangular_);
unboundPartials_.clear(triangular_);
partials_ = DoubleKeyedMap<Data1D>(triangular_);
boundPartials_ = DoubleKeyedMap<Data1D>(triangular_);
unboundPartials_ = DoubleKeyedMap<Data1D>(triangular_);

// Create data for partials and set tags
dissolve::for_each_pair(
Expand Down Expand Up @@ -90,9 +90,9 @@ void PartialSet::initialise(const PartialSet &partialSet)
triangular_ = partialSet.triangular_;
rho_ = partialSet.rho_;

partials_.clear(triangular_);
boundPartials_.clear(triangular_);
unboundPartials_.clear(triangular_);
partials_ = DoubleKeyedMap<Data1D>(triangular_);
boundPartials_ = DoubleKeyedMap<Data1D>(triangular_);
unboundPartials_ = DoubleKeyedMap<Data1D>(triangular_);

// Template data from source PartialSet and set tags
dissolve::for_each_pair(
Expand Down Expand Up @@ -491,9 +491,9 @@ bool PartialSet::deserialise(LineParser &parser, const CoreData &coreData)
}

// Clear partials
partials_.clear(triangular_);
boundPartials_.clear(triangular_);
unboundPartials_.clear(triangular_);
partials_ = DoubleKeyedMap<Data1D>(triangular_);
boundPartials_ = DoubleKeyedMap<Data1D>(triangular_);
unboundPartials_ = DoubleKeyedMap<Data1D>(triangular_);

if (parser.getArgsDelim(LineParser::Defaults) != LineParser::Success)
return false;
Expand Down
12 changes: 6 additions & 6 deletions src/classes/partialSetAccumulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ void PartialSetAccumulator::operator+=(const PartialSet &source)
// If this is the first accumulation, initialise our maps with the "mirrored" state of the source
if (nAccumulated_ == 0)
{
partials_.clear(source.partials().mirroredAreEquivalent());
boundPartials_.clear(source.boundPartials().mirroredAreEquivalent());
unboundPartials_.clear(source.unboundPartials().mirroredAreEquivalent());
partials_ = DoubleKeyedMap<SampledData1D>(source.partials().mirroredAreEquivalent());
boundPartials_ = DoubleKeyedMap<SampledData1D>(source.boundPartials().mirroredAreEquivalent());
unboundPartials_ = DoubleKeyedMap<SampledData1D>(source.unboundPartials().mirroredAreEquivalent());
}

// Full partials
Expand Down Expand Up @@ -144,9 +144,9 @@ bool PartialSetAccumulator::deserialise(LineParser &parser)
auto mirroredEquivalent = parser.argb(2);

// Clear data
partials_.clear(mirroredEquivalent);
boundPartials_.clear(mirroredEquivalent);
unboundPartials_.clear(mirroredEquivalent);
partials_ = DoubleKeyedMap<SampledData1D>(mirroredEquivalent);
boundPartials_ = DoubleKeyedMap<SampledData1D>(mirroredEquivalent);
unboundPartials_ = DoubleKeyedMap<SampledData1D>(mirroredEquivalent);

if (nAccumulated_ == 0)
return true;
Expand Down
4 changes: 2 additions & 2 deletions src/classes/xRayWeights.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ bool XRayWeights::setUp(const std::map<const Species *, double> &speciesPopulati

// Set up weights matrices
auto nTypes = typeFractions_.size();
concentrationProducts_.clear(true);
preFactors_.clear(true);
concentrationProducts_.clear();
preFactors_.clear();

// Determine atomic concentration products and full pre-factor
dissolve::for_each_pair(ParallelPolicies::seq, typeFractions_,
Expand Down
4 changes: 2 additions & 2 deletions src/classes/xRayWeights.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ class XRayWeights
// Form factor data for atom types
std::map<const AtomType *, std::reference_wrapper<const FormFactorData>> formFactorData_;
// Concentration product matrix (ci * cj)
DoubleKeyedMap<double> concentrationProducts_;
DoubleKeyedMap<double> concentrationProducts_{true};
// Pre-factors matrix (ci * cj * [2-dij])
DoubleKeyedMap<double> preFactors_;
DoubleKeyedMap<double> preFactors_{true};

public:
// Set-up from supplied species populations and form factors
Expand Down
2 changes: 1 addition & 1 deletion src/modules/epsr/functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ void EPSRModule::updateDeltaSQ(GenericList &processingData,

// Realise the DeltaSQ array
auto deltaSQ = processingData.realise<DoubleKeyedMap<Data1D>>("DeltaSQ", name_, GenericItem::ItemFlag::NoFlags);
deltaSQ.clear(true);
deltaSQ = DoubleKeyedMap<Data1D>(true);

for (auto &[key, calcSQ] : calculatedSQ)
{
Expand Down
2 changes: 1 addition & 1 deletion src/modules/epsr/process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ Module::ExecutionResult EPSRModule::process(Dissolve &dissolve)

// Create storage for our summed UnweightedSQ
auto &calculatedUnweightedSQ = moduleData.realise<DoubleKeyedMap<Data1D>>("UnweightedSQ", name_);
calculatedUnweightedSQ.clear(true);
calculatedUnweightedSQ = DoubleKeyedMap<Data1D>(true);
dissolve::for_each_pair(
ParallelPolicies::par, atomTypes, [&](int indexI, auto atI, int indexJ, auto atJ)
{ calculatedUnweightedSQ[{atI->name(), atJ->name()}].setTag(std::format("{}-{}", atI->name(), atJ->name())); });
Expand Down
6 changes: 1 addition & 5 deletions src/templates/doubleKeyedMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,7 @@ template <typename ValueClass> class DoubleKeyedMap : public Serialisable<>

public:
// Clear data
void clear(bool mirrored = false)
{
data_.clear();
mirroredAreEquivalent_ = mirrored;
}
void clear() { data_.clear(); }
// Return whether the mirrored key pairs A-B and B-A are equivalent
bool mirroredAreEquivalent() const { return mirroredAreEquivalent_; }
// Set / overwrite key
Expand Down
88 changes: 88 additions & 0 deletions tests/data/species/ppScaleFactorTest.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@

[species]
name = "Unnamed"

[species.atomTypes]

[species.atomTypes.C1]
z = "C"
charge = -0.1
form = "LJ"

[species.atomTypes.C1.parameters]
epsilon = 1.0
sigma = 3.0

[species.atomTypes.C2]
z = "C"
charge = 0.1
form = "LJ"

[species.atomTypes.C2.parameters]
epsilon = 1.0
sigma = 3.0


[[species.atoms]]
index = 1
z = "C"
r = [
-1.39,
0.0,
0.0,
]
q = -0.2
type = "C1"
[[species.atoms]]
index = 2
z = "C"
r = [
-0.695,
1.20378,
0.0,
]
q = 0.2
type = "C2"
[[species.atoms]]
index = 3
z = "C"
r = [
0.695,
1.20378,
0.0,
]
q = 0.2
type = "C2"
[[species.atoms]]
index = 4
z = "C"
r = [
1.39,
0.0,
0.0,
]
q = -0.2
type = "C1"

[[species.bonds]]
form = "None"
i = 1
j = 2
[[species.bonds]]
form = "None"
i = 2
j = 3
[[species.bonds]]
form = "None"
i = 3
j = 4

[[species.torsions]]
form = "None"
i = 1
j = 2
k = 3
l = 4
q14 = 0.5
v14 = 0.5

Loading