Skip to content

Commit

Permalink
Harmonize error treatment of PropagationUtility::GetUpperLim
Browse files Browse the repository at this point in the history
Fixes #387
  • Loading branch information
Jean1995 committed Jan 31, 2024
1 parent c3b01b7 commit 87e74fb
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ double UtilityIntegral::GetUpperLimit(double energy_initial, double rnd)
auto sum = integral.IntegrateWithRandomRatio(
energy_initial, lower_lim, FunctionToIntegral, 4, -rnd);

assert(sum > rnd); // searched energy is below lower_lim
if (rnd > sum) {
throw std::logic_error("Unable to calculate GetUpperLimit since result"
"is below lower_lim. rnd was " + std::to_string(rnd)
+ " with rnd_max " + std::to_string(sum));
}
(void)sum;

return integral.GetUpperLimit();
Expand Down

0 comments on commit 87e74fb

Please sign in to comment.