From f4887b4ea931dd89c36aa5d648776fe3889b50cd Mon Sep 17 00:00:00 2001 From: David A Minton Date: Mon, 23 Jan 2023 17:28:17 -0500 Subject: [PATCH] Ensure that bodies that are flagged as a discared outside of swiftest_discard_system (such as when Danby fails) are discarded --- src/swiftest/swiftest_discard.f90 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/swiftest/swiftest_discard.f90 b/src/swiftest/swiftest_discard.f90 index 01a83f5db..bc3d9b1f0 100644 --- a/src/swiftest/swiftest_discard.f90 +++ b/src/swiftest/swiftest_discard.f90 @@ -28,12 +28,14 @@ module subroutine swiftest_discard_system(self, param) associate(nbody_system => self, tp => self%tp, pl => self%pl, tp_discards => self%tp_discards, pl_discards => self%pl_discards, nc => self%system_history%nc) lpl_discards = .false. ltp_discards = .false. - if (lpl_check) then + if (lpl_check .and. pl%nbody > 0) then + pl%ldiscard = pl%status(:) /= ACTIVE call pl%discard(nbody_system, param) lpl_discards = (pl_discards%nbody > 0) end if - if (ltp_check) then + if (ltp_check .and. tp%nbody > 0) then + tp%ldiscard = tp%status(:) /= ACTIVE call tp%discard(nbody_system, param) ltp_discards = (tp_discards%nbody > 0) end if