-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Tristan Youngs <tristan.youngs@stfc.ac.uk>
- Loading branch information
1 parent
bd6df12
commit 2919e3d
Showing
15 changed files
with
214 additions
and
188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
// Copyright (c) 2024 Team Dissolve and contributors | ||
|
||
#include "analyser/dataNormaliser1D.h" | ||
#include "classes/configuration.h" | ||
#include "math/data1D.h" | ||
|
||
DataNormaliser1D::DataNormaliser1D(Data1D &targetData) : targetData_(targetData) {} | ||
|
||
void DataNormaliser1D::normaliseByNumberDensity(double population, Configuration *targetConfiguration) | ||
{ | ||
targetData_ /= (population / targetConfiguration->box()->volume()); | ||
} | ||
|
||
void DataNormaliser1D::normaliseBySitePopulation(double population) { targetData_ /= population; } | ||
|
||
void DataNormaliser1D::normaliseBySphericalShell() | ||
{ | ||
// We expect x values to be centre-bin values, and regularly spaced | ||
const auto &xAxis = targetData_.xAxis(); | ||
auto &values = targetData_.values(); | ||
|
||
if (xAxis.size() < 2) | ||
return; | ||
|
||
// Derive first left-bin boundary from the delta between points 0 and 1 | ||
auto leftBin = xAxis[0] - (xAxis[1] - xAxis[0]) * 0.5; | ||
auto r1Cubed = pow(leftBin, 3); | ||
for (auto n = 0; n < xAxis.size(); ++n) | ||
{ | ||
// Get new right-bin from existing left bin boundary and current bin centre | ||
auto rightBin = leftBin + 2 * (xAxis[n] - leftBin); | ||
auto r2Cubed = pow(rightBin, 3); | ||
|
||
// Calculate divisor for normalisation | ||
auto divisor = (4.0 / 3.0) * PI * (r2Cubed - r1Cubed); | ||
|
||
// Peform normalisation step | ||
values[n] /= divisor; | ||
if (targetData_.valuesHaveErrors()) | ||
targetData_.error(n) /= divisor; | ||
|
||
// Overwrite old values for next iteration | ||
r1Cubed = r2Cubed; | ||
leftBin = rightBin; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
// Copyright (c) 2024 Team Dissolve and contributors | ||
|
||
#pragma once | ||
|
||
#include "analyser/typeDefs.h" | ||
|
||
class Configuration; | ||
class Data1D; | ||
|
||
class DataNormaliser1D | ||
{ | ||
public: | ||
DataNormaliser1D(Data1D &targetData); | ||
|
||
/* | ||
* Target | ||
*/ | ||
private: | ||
// Target data to normalise | ||
Data1D &targetData_; | ||
|
||
/* | ||
* Normalisation functions | ||
*/ | ||
public: | ||
void normaliseByNumberDensity(double population, Configuration *targetConfiguration); | ||
void normaliseBySitePopulation(double population); | ||
void normaliseBySphericalShell(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
2919e3d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold
2
.BM_Box_MinimumImage<CubicBox>
39.55454359659407
ns/iter6.202165007550857
ns/iter6.38
BM_Box_MinimumVector<CubicBox>
31.938426733544283
ns/iter5.261617919974424
ns/iter6.07
BM_Box_MinimumImage<OrthorhombicBox>
27.042191533306415
ns/iter6.204526405497374
ns/iter4.36
BM_Box_MinimumVector<OrthorhombicBox>
29.48749737790919
ns/iter9.99941578866412
ns/iter2.95
BM_Box_MinimumImage<MonoclinicAlphaBox>
18.240729813620856
ns/iter6.499030608797734
ns/iter2.81
This comment was automatically generated by workflow using github-action-benchmark.
CC: @disorderedmaterials/dissolve-devs