-
Notifications
You must be signed in to change notification settings - Fork 15
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
base: develop
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@@ -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
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); |
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.
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
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.
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
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.