diff --git a/src/feedback/GEAR/stellar_evolution.c b/src/feedback/GEAR/stellar_evolution.c index 98b0436700d71ba58bf9d1c9a691fe1883049cd4..fd6ec03f193cd1b549cd02409bf43287dcf8c0a8 100644 --- a/src/feedback/GEAR/stellar_evolution.c +++ b/src/feedback/GEAR/stellar_evolution.c @@ -492,16 +492,25 @@ void stellar_evolution_evolve_spart( /* Star particles representing only the continuous part of the IMF need a special treatment. They do not contain stars above the mass that separate the IMF into two parts (variable called minimal_discrete_mass_Msun in the sink - module). So, if m_beg_step > minimal_discrete_mass_Msun, you don't do + module). So, if m_end_step > minimal_discrete_mass_Msun, you don't do feedback. Note that the sm structure contains different information for the 'first stars' and the 'late stars'. The right sm data is passed to this function so we do not need any special treatment here. */ if (sp->star_type == star_population_continuous_IMF) { /* If it's not time yet for feedback, exit. Notice that both masses are in solar mass. */ - if (m_beg_step > sm->imf.minimal_discrete_mass_Msun) { + if (m_end_step > sm->imf.minimal_discrete_mass_Msun) { return; } + + /* If we are in a case where + m_beg_step > minimal_discrete_mass_Msun > m_end_step, + then we need to be careful. We don't want feedback from the discrete + part, only the continuous part. Hence, we need to update m_beg_step. + */ + if (m_beg_step > sm->imf.minimal_discrete_mass_Msun) { + m_beg_step = sm->imf.minimal_discrete_mass_Msun; + } } /* Check if the star can produce a supernovae */