From 91e5d8e9f0c4c2385c7ef9247548f03457b1dcaa Mon Sep 17 00:00:00 2001 From: David Sagan Date: Mon, 2 Oct 2023 02:28:01 -0400 Subject: [PATCH] Minor speed improvement for radiation setup. --- bmad/modules/radiation_mod.f90 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bmad/modules/radiation_mod.f90 b/bmad/modules/radiation_mod.f90 index 697596c075..46db0c0ae8 100644 --- a/bmad/modules/radiation_mod.f90 +++ b/bmad/modules/radiation_mod.f90 @@ -78,6 +78,7 @@ subroutine track1_radiation (orbit, ele, edge) real(rp), parameter :: c1_spin = 2.0_rp / 9.0_rp, c2_spin = 8.0_rp / (5.0_rp * sqrt_3) character(*), parameter :: r_name = 'track1_radiation' +logical doit ! @@ -90,7 +91,9 @@ subroutine track1_radiation (orbit, ele, edge) ! Use stochastic and damp mats -call radiation_map_setup(ele) +doit = .not. associated(ele%rad_map) +if (.not. doit) doit = ele%rad_map%stale +if (doit) call radiation_map_setup(ele) if (.not. associated(ele%rad_map)) return if (edge == start_edge$) then