From 552a9c16ba60aa673424fda58827e62902bd23b8 Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <matthieu.schaller@durham.ac.uk>
Date: Sat, 18 Aug 2018 12:03:10 +0100
Subject: [PATCH] Only record that a top-level multipole has interacted via
 long range if it actually found any neighbour within range.

---
 src/runner_doiact_grav.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/runner_doiact_grav.h b/src/runner_doiact_grav.h
index dcc3265f34..812a6e3850 100644
--- a/src/runner_doiact_grav.h
+++ b/src/runner_doiact_grav.h
@@ -1529,7 +1529,6 @@ static INLINE void runner_do_grav_long_range(struct runner *r, struct cell *ci,
 
   /* Flag that contributions will be recieved */
   struct gravity_tensors *const multi_i = ci->multipole;
-  multi_i->pot.interacted = 1;
 
   /* Recover the top-level multipole (for distance checks) */
   struct gravity_tensors *const multi_top = top->multipole;
@@ -1585,6 +1584,9 @@ static INLINE void runner_do_grav_long_range(struct runner *r, struct cell *ci,
       runner_dopair_grav_mm(r, ci, cj);
       // runner_dopair_recursive_grav_pm(r, ci, cj);
 
+      /* Record that this multipole received a contribution */
+      multi_i->pot.interacted = 1;
+
     } /* We are in charge of this pair */
   }   /* Loop over top-level cells */
 
-- 
GitLab