From 966e822c64f8f2024ad4f82f8e6f565ba22188f0 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Thu, 20 Jun 2024 09:26:53 -0500 Subject: [PATCH] Make sure time boundary doesn't prevent secondary particle creation (#3043) --- src/simulation.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/simulation.cpp b/src/simulation.cpp index e218cdb2928..2d5d75aa477 100644 --- a/src/simulation.cpp +++ b/src/simulation.cpp @@ -762,13 +762,15 @@ void transport_history_based_single_particle(Particle& p) { while (p.alive()) { p.event_calculate_xs(); - if (!p.alive()) - break; - p.event_advance(); - if (p.collision_distance() > p.boundary().distance) { - p.event_cross_surface(); - } else { - p.event_collide(); + if (p.alive()) { + p.event_advance(); + } + if (p.alive()) { + if (p.collision_distance() > p.boundary().distance) { + p.event_cross_surface(); + } else if (p.alive()) { + p.event_collide(); + } } p.event_revive_from_secondary(); }