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

Commit

Permalink
Merge branch 'debug'
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Nov 24, 2021
2 parents 8eac6a0 + 733e68e commit 74c2621
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/util/util_get_energy_momentum.f90
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,17 @@ subroutine util_get_energy_potential_triangular(npl, lmask, GMcb, Gmass, mass, x
pecb(i) = -GMcb * mass(i) / norm2(xb(:,i))
end do

pe = sum(pecb(1:npl), lmask(1:npl))
do concurrent(i = 1:npl, j = 1:npl, (j > i) .and. lmask(i) .and. lmask(j))
pe = pe - (Gmass(i) * mass(j)) / norm2(xb(:, i) - xb(:, j))
pe = 0.0_DP
!$omp parallel do default(private) schedule(static)&
!$omp shared(npl, lmask, Gmass, mass, xb) &
!$omp reduction(-:pe)
do i = 1, npl
do concurrent(j = i+1:npl, lmask(i) .and. lmask(j))
pe = pe - (Gmass(i) * mass(j)) / norm2(xb(:, i) - xb(:, j))
end do
end do
!$omp end parallel do
pe = pe + sum(pecb(1:npl), lmask(1:npl))

return
end subroutine util_get_energy_potential_triangular
Expand Down

0 comments on commit 74c2621

Please sign in to comment.