From 8f499b8579488594654d0626b6b2e4ec5d7f8ce2 Mon Sep 17 00:00:00 2001 From: Luke Shingles Date: Mon, 2 Sep 2024 00:24:35 +0100 Subject: [PATCH] Update nonthermal.cc --- nonthermal.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nonthermal.cc b/nonthermal.cc index 4b9d4115b..c011f512a 100644 --- a/nonthermal.cc +++ b/nonthermal.cc @@ -914,9 +914,9 @@ auto calculate_frac_heating(const int modelgridindex, const std::array(SF_EMIN / DELTA_E) + 1) * 10; static_assert(nsteps > 0); - const double delta_endash = SF_EMIN / nsteps; - for (int j = 0; j < nsteps; j++) { - const double endash = SF_EMIN * j / nsteps; + constexpr double delta_endash = SF_EMIN / nsteps; + for (int j = 1; j < nsteps; j++) { + const double endash = delta_endash * j; N_e_contrib += N_e(modelgridindex, endash * EV, yfunc) * endash * delta_endash; } frac_heating_Einit += N_e_contrib;