Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: more control of averaging potentials #1970

Open
wants to merge 17 commits into
base: develop
Choose a base branch
from
Open

Conversation

Danbr4d
Copy link
Contributor

@Danbr4d Danbr4d commented Sep 9, 2024

Added in capability to average over a specified number of iterations instead of each time. The hope is that this will fix an issue of spikes in r-factor when running the averaging of potentials currently.

@Danbr4d Danbr4d added Type: Enhancement Enhancement for existing feature Scope: Modules Related to a specific Module labels Sep 9, 2024
@Danbr4d Danbr4d self-assigned this Sep 9, 2024
src/modules/epsrManager/process.cpp Outdated Show resolved Hide resolved
src/modules/epsrManager/process.cpp Outdated Show resolved Hide resolved
src/modules/epsrManager/process.cpp Outdated Show resolved Hide resolved
src/modules/epsrManager/process.cpp Outdated Show resolved Hide resolved
src/modules/epsrManager/process.cpp Outdated Show resolved Hide resolved
src/modules/epsrManager/process.cpp Outdated Show resolved Hide resolved
Copy link
Member

@trisyoungs trisyoungs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me, I think this PR is valuable as a proof of concept study that the averaging of potentials makes a positive difference, but we shouldn't merge it in in it's current form, simply because if we did we would immediately have to fix it up in a patch release anyway.

I think the best route forward is to introduce a PotentialSet class (distinct from a PartialSet and a PotentialMap, and living somewhere in the middle - we might consider renaming the latter to make the separation clear, since the new PotentialSet class would be based around a std::map) into which we can implement the necessary de/serialisation and += / /= operators necessary for the Averaging functions to work.

@@ -35,6 +36,12 @@ class EPSRManagerModule : public Module
};
// Potential scalings
std::string potentialScalings_;
// Number of historical partial sets to combine into final partials
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Number of historical partial sets to combine into final partials
// Number of historical partial sets to combine into final potentials

@@ -35,6 +36,12 @@ class EPSRManagerModule : public Module
};
// Potential scalings
std::string potentialScalings_;
// Number of historical partial sets to combine into final partials
std::optional<int> averagingLength_;
// Weighting scheme to use when averaging partials
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Weighting scheme to use when averaging partials
// Weighting scheme to use when averaging potentials

Comment on lines 59 to 63
// Check if ran the right amount of iterations before averaging
if (averagedPotentialsStore.size() > averagingLength_)
{
averagedPotentialsStore.pop_back();
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't account for cases where the user changes the averaging length and we need to remove more than one. This curation of data is also handled for us if we move to using the proper Averaging namespace functions.

for (auto &&[key, epData] : pots)
{
averagedPotentials[key].ep += epData.ep;
averagedPotentials[key].ep /= averagingLength_.value();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Careful - the value of averagingLength_ may very well not be equal to the number of potential sets in the averagedPotentialStore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Modules Related to a specific Module Type: Enhancement Enhancement for existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants