From 4a6b2f860240220d8a21c9519ce3e851f6647abd Mon Sep 17 00:00:00 2001 From: David A Minton Date: Thu, 28 Sep 2023 16:01:42 -0400 Subject: [PATCH] Converted another while loop to a do --- src/swiftest/swiftest_sph.f90 | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/swiftest/swiftest_sph.f90 b/src/swiftest/swiftest_sph.f90 index 2b25ab412..3a561e89a 100644 --- a/src/swiftest/swiftest_sph.f90 +++ b/src/swiftest/swiftest_sph.f90 @@ -101,17 +101,16 @@ module subroutine swiftest_sph_g_acc_pl_all(self, nbody_system) associate(pl => self, npl => self%nbody, cb => nbody_system%cb, rh => self%rh) cb%aobl(:) = 0.0_DP - ! do i = 1, npl, pl%lmask(i) - do while ((i .lt. npl) .and. pl%lmask(i)) - r_mag = .mag. rh(1:3,i) - theta = atan2(sqrt(rh(1,i)**2 + rh(2,i)**2), rh(3,i)) - phi = atan2(rh(2,i), rh(1,i)) - cb%rotphase ! CALCULATE CB PHASE VALUE FOR PHI - - call swiftest_sph_g_acc_one(cb%Gmass, r_mag, phi, theta, rh(:,i), cb%c_lm, g_sph, pl%Gmass, cb%aobl) - pl%ah(:, i) = pl%ah(:, i) + g_sph(:) - cb%aobl(:) - pl%aobl(:, i) = g_sph(:) - - i = i + 1 + do i = 1, npl + if (pl%lmask(i)) then + r_mag = .mag. rh(:,i) + theta = atan2(sqrt(rh(1,i)**2 + rh(2,i)**2), rh(3,i)) + phi = atan2(rh(2,i), rh(1,i)) - cb%rotphase ! CALCULATE CB PHASE VALUE FOR PHI + + call swiftest_sph_g_acc_one(cb%Gmass, r_mag, phi, theta, rh(:,i), cb%c_lm, g_sph, pl%Gmass, cb%aobl) + pl%ah(:, i) = pl%ah(:, i) + g_sph(:) - cb%aobl(:) + pl%aobl(:, i) = g_sph(:) + end if end do end associate return