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

Fix true vacuum at high temperature #161

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

Conversation

vollous
Copy link
Collaborator

@vollous vollous commented Jul 29, 2024

In some models, the BSMPT v2 global minimum does not find the global minimum, just non-global. We added a check to make sure that we always start from the true vacuum.

Copy link

codecov bot commented Jul 29, 2024

Codecov Report

Attention: Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 83.32%. Comparing base (7302d69) to head (9a863d0).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/minimum_tracer/minimum_tracer.cpp 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #161      +/-   ##
==========================================
- Coverage   83.36%   83.32%   -0.04%     
==========================================
  Files          54       54              
  Lines       18770    18774       +4     
  Branches     1847     1849       +2     
==========================================
- Hits        15647    15643       -4     
- Misses       3123     3131       +8     
Flag Coverage Δ
unittests 83.32% <75.00%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -2401,6 +2401,12 @@
PhasesList[i].id = i;
}

// impose that true vacuum at T = Tthigh has id = 0.
for (auto &phase : PhasesList)
if ((phase.T_high == T_high) and

Check notice

Code scanning / CodeQL

Equality test on floating-point values Note

Equality checks on floating point values can yield unexpected results.
@vollous vollous marked this pull request as ready for review July 30, 2024 12:53
for (auto &phase : PhasesList)
if ((phase.T_high == T_high) and
(phase.Get(T_high).potential < PhasesList[0].Get(T_high).potential))
std::swap(PhasesList[0], phase);
Copy link
Owner

Choose a reason for hiding this comment

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

Are you sure this works? You are swapping an iterator with a reference here.
Maybe use an iterator based for loop and use iterator_swap

Copy link
Owner

Choose a reason for hiding this comment

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

Or maybe easier:
You could use min_element with a compare function to get the position of the required element and then use iterator_swap just once.
With this there would only be one swap

@vollous vollous changed the base branch from master to develop November 5, 2024 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants