From 2eeba89992ee8832147957ec0e330aa363bf189e Mon Sep 17 00:00:00 2001 From: John Tramm Date: Wed, 11 Jun 2025 12:41:38 -0500 Subject: [PATCH] Apply Max Number of Events Check to Random Rays (#3438) Co-authored-by: Jonathan Shimwell --- src/random_ray/random_ray.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/random_ray/random_ray.cpp b/src/random_ray/random_ray.cpp index 27819591cd..36eab06284 100644 --- a/src/random_ray/random_ray.cpp +++ b/src/random_ray/random_ray.cpp @@ -265,6 +265,12 @@ uint64_t RandomRay::transport_history_based_single_ray() if (!alive()) break; event_cross_surface(); + // If ray has too many events, display warning and kill it + if (n_event() >= settings::max_particle_events) { + warning("Ray " + std::to_string(id()) + + " underwent maximum number of events, terminating ray."); + wgt() = 0.0; + } } return n_event();