From 9ba8f74c53e3b7eecd66484a52fac8b2a4cbdee4 Mon Sep 17 00:00:00 2001 From: anand43 Date: Tue, 12 Dec 2023 16:20:07 -0500 Subject: [PATCH] edited kick to account for no massive bodies --- src/whm/whm_kick.f90 | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/src/whm/whm_kick.f90 b/src/whm/whm_kick.f90 index 2e70a431e..090457f60 100644 --- a/src/whm/whm_kick.f90 +++ b/src/whm/whm_kick.f90 @@ -92,29 +92,31 @@ module subroutine whm_kick_getacch_tp(self, nbody_system, param, t, lbeg) associate(tp => self, pl => nbody_system%pl, cb => nbody_system%cb) npl = nbody_system%pl%nbody ntp = self%nbody - if (ntp == 0 .and. npl == 0) return + if (ntp == 0) return nbody_system%lbeg = lbeg - if (lbeg) then - ah0(:) = whm_kick_getacch_ah0(pl%Gmass(1:npl), pl%rbeg(:, 1:npl), npl) + if(npl > 0) then + if (lbeg) then + ah0(:) = whm_kick_getacch_ah0(pl%Gmass(1:npl), pl%rbeg(:, 1:npl), npl) #ifdef DOCONLOC - do concurrent(i = 1:ntp, tp%lmask(i)) shared(tp,ah0) + do concurrent(i = 1:ntp, tp%lmask(i)) shared(tp,ah0) #else - do concurrent(i = 1:ntp, tp%lmask(i)) + do concurrent(i = 1:ntp, tp%lmask(i)) #endif - tp%ah(:, i) = tp%ah(:, i) + ah0(:) - end do - call tp%accel_int(param, pl%Gmass(1:npl), pl%rbeg(:, 1:npl), npl) - else - ah0(:) = whm_kick_getacch_ah0(pl%Gmass(1:npl), pl%rend(:, 1:npl), npl) + tp%ah(:, i) = tp%ah(:, i) + ah0(:) + end do + call tp%accel_int(param, pl%Gmass(1:npl), pl%rbeg(:, 1:npl), npl) + else + ah0(:) = whm_kick_getacch_ah0(pl%Gmass(1:npl), pl%rend(:, 1:npl), npl) #ifdef DOCONLOC - do concurrent(i = 1:ntp, tp%lmask(i)) shared(tp,ah0) + do concurrent(i = 1:ntp, tp%lmask(i)) shared(tp,ah0) #else - do concurrent(i = 1:ntp, tp%lmask(i)) + do concurrent(i = 1:ntp, tp%lmask(i)) #endif - tp%ah(:, i) = tp%ah(:, i) + ah0(:) - end do - call tp%accel_int(param, pl%Gmass(1:npl), pl%rend(:, 1:npl), npl) + tp%ah(:, i) = tp%ah(:, i) + ah0(:) + end do + call tp%accel_int(param, pl%Gmass(1:npl), pl%rend(:, 1:npl), npl) + end if end if if (param%loblatecb) call tp%accel_obl(nbody_system)