Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Converted while loop into a do loop
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Sep 28, 2023
1 parent d420ad6 commit f859be1
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions src/swiftest/swiftest_sph.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f859be1

Please sign in to comment.