@@ -19,10 +19,6 @@ PartialSet::PartialSet(const std::map<const Species *, double> &realSpeciesPopul
1919
2020PartialSet::~PartialSet ()
2121{
22- fullHistograms_.clear ();
23- boundHistograms_.clear ();
24- unboundHistograms_.clear ();
25-
2622 partials_.clear ();
2723 boundPartials_.clear ();
2824 emptyBoundPartials_.clear ();
@@ -33,21 +29,8 @@ PartialSet::~PartialSet()
3329 * Set of Partials
3430 */
3531
36- // Set up PartialSet
37- bool PartialSet::setUp (const AtomTypeMix &atomTypeMix, double rdfRange, double binWidth)
38- {
39- // Set up partial arrays
40- if (!setUpPartials (atomTypeMix, half_))
41- return false ;
42-
43- // Initialise histograms for g(r) calculation
44- setUpHistograms (rdfRange, binWidth);
45-
46- return true ;
47- }
48-
49- // Set up PartialSet without initialising histogram arrays
50- bool PartialSet::setUpPartials (const AtomTypeMix &atomTypeMix, bool half)
32+ // Initialise
33+ void PartialSet::initialise (const AtomTypeMix &atomTypeMix, bool half)
5134{
5235 // Copy type array
5336 atomTypeMix_ = atomTypeMix;
@@ -78,42 +61,11 @@ bool PartialSet::setUpPartials(const AtomTypeMix &atomTypeMix, bool half)
7861 total_.clear ();
7962 boundTotal_.clear ();
8063 unboundTotal_.clear ();
81-
82- return true ;
83- }
84-
85- // Set up histogram arrays for g(r) calculation
86- void PartialSet::setUpHistograms (double rdfRange, double binWidth)
87- {
88- auto nTypes = atomTypeMix_.nItems ();
89-
90- fullHistograms_.initialise (nTypes, nTypes, half_);
91- boundHistograms_.initialise (nTypes, nTypes, half_);
92- unboundHistograms_.initialise (nTypes, nTypes, half_);
93-
94- dissolve::for_each_pair (
95- ParallelPolicies::par, nTypes,
96- [&](int i, int j)
97- {
98- fullHistograms_[{i, j}].initialise (0.0 , rdfRange, binWidth);
99- boundHistograms_[{i, j}].initialise (0.0 , rdfRange, binWidth);
100- unboundHistograms_[{i, j}].initialise (0.0 , rdfRange, binWidth);
101- },
102- half_);
10364}
10465
10566// Reset partial arrays
10667void PartialSet::reset ()
10768{
108- // Zero histogram bins if present
109- for (auto n = 0 ; n < fullHistograms_.nRows (); ++n)
110- for (auto m = n; m < fullHistograms_.nColumns (); ++m)
111- {
112- fullHistograms_[{n, m}].zeroBins ();
113- boundHistograms_[{n, m}].zeroBins ();
114- unboundHistograms_[{n, m}].zeroBins ();
115- }
116-
11769 // Zero partials
11870 dissolve::for_each_pair (
11971 ParallelPolicies::par, atomTypeMix_.nItems (),
@@ -144,15 +96,6 @@ void PartialSet::setFingerprint(std::string_view fingerprint) { fingerprint_ = f
14496// Return fingerprint of partials
14597std::string_view PartialSet::fingerprint () const { return fingerprint_; }
14698
147- // Return full histogram specified
148- Histogram1D &PartialSet::fullHistogram (int i, int j) { return fullHistograms_[{i, j}]; }
149-
150- // Return bound histogram specified
151- Histogram1D &PartialSet::boundHistogram (int i, int j) { return boundHistograms_[{i, j}]; }
152-
153- // Return unbound histogram specified
154- Histogram1D &PartialSet::unboundHistogram (int i, int j) { return unboundHistograms_[{i, j}]; }
155-
15699// Return full atom-atom partial specified
157100Data1D &PartialSet::partial (int i, int j) { return partials_[{i, j}]; }
158101const Data1D &PartialSet::partial (int i, int j) const { return partials_[{i, j}]; }
@@ -165,6 +108,10 @@ const Data1D &PartialSet::unboundPartial(int i, int j) const { return unboundPar
165108Data1D &PartialSet::boundPartial (int i, int j) { return boundPartials_[{i, j}]; }
166109const Data1D &PartialSet::boundPartial (int i, int j) const { return boundPartials_[{i, j}]; }
167110
111+ // Return emptyBound flag
112+ char &PartialSet::emptyBoundPartial (int i, int j) { return emptyBoundPartials_[{i, j}]; }
113+ const char &PartialSet::emptyBoundPartial (int i, int j) const { return emptyBoundPartials_[{i, j}]; }
114+
168115// Return whether specified bound partial is empty
169116bool PartialSet::isBoundPartialEmpty (int i, int j) const { return emptyBoundPartials_[{i, j}]; }
170117
@@ -344,28 +291,6 @@ void PartialSet::adjust(double delta)
344291 unboundTotal_ += delta;
345292}
346293
347- // Form partials from stored Histogram data
348- void PartialSet::formPartials (double boxVolume)
349- {
350- dissolve::for_each_pair (
351- ParallelPolicies::seq, atomTypeMix_,
352- [&](int n, const AtomTypeData &at1, int m, const AtomTypeData &at2)
353- {
354- // Calculate RDFs from histogram data
355- calculateRDF (partials_[{n, m}], fullHistograms_[{n, m}], boxVolume, at1.population (), at2.population (),
356- &at1 == &at2 ? 2.0 : 1.0 );
357- calculateRDF (boundPartials_[{n, m}], boundHistograms_[{n, m}], boxVolume, at1.population (), at2.population (),
358- &at1 == &at2 ? 2.0 : 1.0 );
359- calculateRDF (unboundPartials_[{n, m}], unboundHistograms_[{n, m}], boxVolume, at1.population (), at2.population (),
360- &at1 == &at2 ? 2.0 : 1.0 );
361-
362- // Set flags for bound partials specifying if they are empty (i.e. there are no
363- // contributions of that type)
364- emptyBoundPartials_[{n, m}] = boundHistograms_[{n, m}].nBinned () == 0 ;
365- },
366- half_);
367- }
368-
369294// Add in partials from source PartialSet to our own
370295bool PartialSet::addPartials (PartialSet &source, double weighting)
371296{
@@ -410,29 +335,6 @@ bool PartialSet::addPartials(PartialSet &source, double weighting)
410335 return true ;
411336}
412337
413- // Calculate RDF from supplied Histogram and normalisation data
414- void PartialSet::calculateRDF (Data1D &destination, const Histogram1D &histogram, double boxVolume, int nCentres,
415- int nSurrounding, double multiplier)
416- {
417- auto nBins = histogram.nBins ();
418- double delta = histogram.binWidth ();
419- const auto &bins = histogram.bins ();
420-
421- destination.clear ();
422-
423- double shellVolume, factor, r = 0.5 * delta, lowerShellLimit = 0.0 , numberDensity = nSurrounding / boxVolume;
424- for (auto n = 0 ; n < nBins; ++n)
425- {
426- shellVolume = (4.0 / 3.0 ) * M_PI * (pow (lowerShellLimit + delta, 3.0 ) - pow (lowerShellLimit, 3.0 ));
427- factor = nCentres * (shellVolume * numberDensity);
428-
429- destination.addPoint (r, bins[n] * (multiplier / factor));
430-
431- r += delta;
432- lowerShellLimit += delta;
433- }
434- }
435-
436338/*
437339 * Operators
438340 */
0 commit comments