Skip to content

Commit

Permalink
all-pairs should not compute force against self
Browse files Browse the repository at this point in the history
  • Loading branch information
gonzalobg committed Sep 22, 2024
1 parent 3e070c1 commit 0489494
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/all_pairs.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ void all_pairs_force(System<T, N>& system) {
auto ai = vec<T, N>::splat(0);
auto pi = s.x[i];
for (typename System<T, N>::index_t j = 0; j < s.sz; j++) {
if (i == j) continue;
auto pj = s.x[j];
ai += s.m[j] * (pj - pi) / dist3(pi, pj);
}
Expand Down

0 comments on commit 0489494

Please sign in to comment.