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;