diff --git a/update_packets.cc b/update_packets.cc index f1af51f1f..05804f815 100644 --- a/update_packets.cc +++ b/update_packets.cc @@ -109,20 +109,24 @@ void do_nonthermal_predeposit(Packet &pkt, const int nts, const double t2) { pkt.prop_time = t_new; } - if (priortype == TYPE_NONTHERMAL_PREDEPOSIT_BETAMINUS) { - atomicadd(globals::dep_estimator_electron[nonemptymgi], en_deposited); - if (pkt.type == TYPE_NTLEPTON_DEPOSITED) { - atomicadd(globals::timesteps[nts].electron_dep_discrete, pkt.e_cmf); - } - } else if (priortype == TYPE_NONTHERMAL_PREDEPOSIT_BETAPLUS) { - atomicadd(globals::dep_estimator_positron[nonemptymgi], en_deposited); - if (pkt.type == TYPE_NTLEPTON_DEPOSITED) { - atomicadd(globals::timesteps[nts].positron_dep_discrete, pkt.e_cmf); - } - } else if (priortype == TYPE_NONTHERMAL_PREDEPOSIT_ALPHA) { - atomicadd(globals::dep_estimator_alpha[nonemptymgi], en_deposited); - if (pkt.type == TYPE_NTLEPTON_DEPOSITED) { - atomicadd(globals::timesteps[nts].alpha_dep_discrete, pkt.e_cmf); + // gamma-ray deposition (which then gave energy to a beta particle) was already counted so only count the beta decay + // products + if (pkt.originated_from_particlenotgamma) { + if (priortype == TYPE_NONTHERMAL_PREDEPOSIT_BETAMINUS) { + atomicadd(globals::dep_estimator_electron[nonemptymgi], en_deposited); + if (pkt.type == TYPE_NTLEPTON_DEPOSITED) { + atomicadd(globals::timesteps[nts].electron_dep_discrete, pkt.e_cmf); + } + } else if (priortype == TYPE_NONTHERMAL_PREDEPOSIT_BETAPLUS) { + atomicadd(globals::dep_estimator_positron[nonemptymgi], en_deposited); + if (pkt.type == TYPE_NTLEPTON_DEPOSITED) { + atomicadd(globals::timesteps[nts].positron_dep_discrete, pkt.e_cmf); + } + } else if (priortype == TYPE_NONTHERMAL_PREDEPOSIT_ALPHA) { + atomicadd(globals::dep_estimator_alpha[nonemptymgi], en_deposited); + if (pkt.type == TYPE_NTLEPTON_DEPOSITED) { + atomicadd(globals::timesteps[nts].alpha_dep_discrete, pkt.e_cmf); + } } } }