From 7a66ef12eaa5b10f815ce0403e4c0134459a05a5 Mon Sep 17 00:00:00 2001 From: Luke Shingles Date: Sun, 1 Sep 2024 12:01:22 +0100 Subject: [PATCH] Update update_packets.cc --- update_packets.cc | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/update_packets.cc b/update_packets.cc index d75839306..537ece108 100644 --- a/update_packets.cc +++ b/update_packets.cc @@ -83,11 +83,7 @@ void do_nonthermal_predeposit(Packet &pkt, const int nts, const double t2) { // for endot independent of energy, the next line is trival (for E dependent endot, an integral would be needed) const double t_enzero = ts + (particle_en / endot); // time at which zero energy is reached - if (t_enzero > t2) { - en_deposited = pkt.e_cmf * (t2 - ts) / (particle_en / endot); - } else { - en_deposited = pkt.e_cmf * (t_enzero - ts) / (particle_en / endot); - } + en_deposited = pkt.e_cmf * (std::min(t2, t_enzero) - ts) / (particle_en / endot); // A discrete absorption event should occur somewhere along the // continuous track from initial kinetic energy to zero KE.