From c94c828b112875a4e15dd87bad9a0b719f66d503 Mon Sep 17 00:00:00 2001 From: David Minton Date: Wed, 29 Nov 2023 12:31:08 -0500 Subject: [PATCH] Added a check in the system mass calcualtion to cover the case where there are no massive bodies other than the central body. --- src/swiftest/swiftest_util.f90 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/swiftest/swiftest_util.f90 b/src/swiftest/swiftest_util.f90 index 94813be38..196b29835 100644 --- a/src/swiftest/swiftest_util.f90 +++ b/src/swiftest/swiftest_util.f90 @@ -2112,7 +2112,9 @@ module subroutine swiftest_util_set_msys(self) ! Arguments class(swiftest_nbody_system), intent(inout) :: self !! Swiftest nobdy nbody_system object - self%Gmtot = self%cb%Gmass + sum(self%pl%Gmass(1:self%pl%nbody), self%pl%status(1:self%pl%nbody) /= INACTIVE) + self%Gmtot = self%cb%Gmass + if (self%pl%nbody > 0) self%Gmtot = self%Gmtot + sum(self%pl%Gmass(1:self%pl%nbody), & + self%pl%status(1:self%pl%nbody) /= INACTIVE) return end subroutine swiftest_util_set_msys