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

Commit

Permalink
Fixed NaN issue in potential energy computation. Inconsistent array b…
Browse files Browse the repository at this point in the history
…ounds on mask (this may be the core reason why fraggle fails sometimes)
  • Loading branch information
daminton committed Oct 21, 2022
1 parent 36a69b3 commit 40232d2
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/util/util_get_energy_momentum.f90
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,12 @@ subroutine util_get_energy_potential_triangular(npl, lmask, GMcb, Gmass, mass, x
!$omp firstprivate(npl) &
!$omp reduction(+:pe)
do i = 1, npl
do concurrent(j = i+1:npl, lmask(i) .and. lmask(j))
pepl(j) = - (Gmass(i) * mass(j)) / norm2(xb(:, i) - xb(:, j))
end do
pe = pe + sum(pepl(i+1:npl), lmask(i))
if (lmask(i)) then
do concurrent(j = i+1:npl, lmask(i) .and. lmask(j))
pepl(j) = - (Gmass(i) * mass(j)) / norm2(xb(:, i) - xb(:, j))
end do
pe = pe + sum(pepl(i+1:npl), lmask(i+1:npl))
end if
end do
!$omp end parallel do
pe = pe + sum(pecb(1:npl), lmask(1:npl))
Expand Down

0 comments on commit 40232d2

Please sign in to comment.