From b5e7b69df3e70cc1c55bd7f5ee3f5349251968dd Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <matthieu.schaller@durham.ac.uk>
Date: Fri, 29 Sep 2017 12:51:51 +0100
Subject: [PATCH] Also (uniquely) create gravity pair tasks for pairs that
 involved a foreign neighbour

---
 src/engine.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/src/engine.c b/src/engine.c
index 36e1057d92..e54a85f57a 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -1861,20 +1861,12 @@ void engine_make_self_gravity_tasks_mapper(void *map_data, int num_elements,
           const int cjd = cell_getid(cdim, ii, jj, kk);
           struct cell *cj = &cells[cjd];
 
-          /* /\* Is that neighbour local and does it have particles ? *\/ */
-          /* if (cid <= cjd || cj->count == 0 || */
-          /*     (ci->nodeID != nodeID && cj->nodeID != nodeID)) */
-          /*   continue; */
-
-	  /* Avoid duplicates */
-	  if(cid <= cjd) continue;
+	  /* Avoid duplicates of local pairs*/
+	  if(cid <= cjd && cj->nodeID == nodeID) continue;
 
 	  /* Skip cells without gravity particles */
 	  if (cj->gcount == 0) continue;
 
-	  /* Is that neighbour local ? */
-	  if (cj->nodeID != nodeID) continue;  // MATTHIEU
-
           /* Recover the multipole information */
           const struct gravity_tensors *const multi_j = cj->multipole;
 
-- 
GitLab