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

Commit

Permalink
Browse files Browse the repository at this point in the history
Experimenting with swapping array order
  • Loading branch information
daminton committed Apr 14, 2021
1 parent f3e821d commit 2af2274
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/whm/whm_getacch.f90
Original file line number Diff line number Diff line change
Expand Up @@ -215,23 +215,21 @@ pure subroutine whm_getacch_ah3_tp(cb, pl, tp, xh)
! Internals
integer(I4B) :: i, j
real(DP) :: rji2, irij3, fac
real(DP), dimension(NDIM) :: dx, acc
real(DP), dimension(NDIM) :: dx

associate(ntp => tp%nbody, npl => pl%nbody, msun => cb%Gmass, Gmpl => pl%Gmass, &
xht => tp%xh, aht => tp%ah)

if (ntp == 0) return
do i = 1, ntp
acc(:) = 0.0_DP
!$omp simd private(dx,rji2,irij3,fac) reduction(-:acc)
do j = 1, npl
do j = 1, npl
!$omp simd private(dx,rji2,irij3,fac) reduction(-:aht)
do i = 1, ntp
dx(:) = xht(:, i) - xh(:, j)
rji2 = dot_product(dx(:), dx(:))
irij3 = 1.0_DP / (rji2 * sqrt(rji2))
fac = Gmpl(j) * irij3
acc(:) = acc(:) - fac * dx(:)
aht(:, i) = aht(:, i) - fac * dx(:)
end do
aht(:, i) = aht(:, i) + acc(:)
end do
end associate
return
Expand Down

0 comments on commit 2af2274

Please sign in to comment.