From f859be1d35843e7b239b832cc82ca519eee1115b Mon Sep 17 00:00:00 2001 From: David A Minton Date: Thu, 28 Sep 2023 16:00:35 -0400 Subject: [PATCH] Converted while loop into a do loop --- 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 55c4c771c..2b25ab412 100644 --- a/src/swiftest/swiftest_sph.f90 +++ b/src/swiftest/swiftest_sph.f90 @@ -141,17 +141,16 @@ module subroutine swiftest_sph_g_acc_tp_all(self, nbody_system) aoblcb = cb%aoblend end if - ! do i = 1, ntp, tp%lmask(i) - do while ((i .lt. ntp) .and. tp%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 - - call swiftest_sph_g_acc_one(cb%Gmass, r_mag, phi, theta, rh(:,i), cb%c_lm, g_sph) - tp%ah(:, i) = tp%ah(:, i) + g_sph(:) - aoblcb(:) - tp%aobl(:, i) = g_sph(:) - - i = i + 1 + do i = 1, ntp + if (tp%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 + + call swiftest_sph_g_acc_one(cb%Gmass, r_mag, phi, theta, rh(:,i), cb%c_lm, g_sph) + tp%ah(:, i) = tp%ah(:, i) + g_sph(:) - aoblcb(:) + tp%aobl(:, i) = g_sph(:) + end if end do end associate return