From b0bd8eb5dafff48e4788c2db875985a0041f4af7 Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <matthieu.schaller@durham.ac.uk>
Date: Wed, 9 Aug 2017 18:20:10 +0100
Subject: [PATCH] Make sure the exact calculation matches the Gadget one when
 the same kernel function is used.

---
 examples/EAGLE_12/eagle_12.yml | 2 +-
 src/gravity.c                  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/examples/EAGLE_12/eagle_12.yml b/examples/EAGLE_12/eagle_12.yml
index d2192b68e1..f56c330590 100644
--- a/examples/EAGLE_12/eagle_12.yml
+++ b/examples/EAGLE_12/eagle_12.yml
@@ -26,7 +26,7 @@ Statistics:
 # Parameters for the self-gravity scheme
 Gravity:
   eta:                   0.025    # Constant dimensionless multiplier for time integration.
-  epsilon:               0.0000001   # Softening length (in internal units).
+  epsilon:               0.001    # Softening length (in internal units).
   theta:                 0.7      # Opening angle (Multipole acceptance criterion)
   
 # Parameters for the hydrodynamics scheme
diff --git a/src/gravity.c b/src/gravity.c
index de42d58f87..f308262274 100644
--- a/src/gravity.c
+++ b/src/gravity.c
@@ -436,7 +436,7 @@ void gravity_exact_force_compute_mapper(void *map_data, int nr_gparts,
         a_grav[2] += f * dz;
 
         /* Apply Ewald correction for periodic BC */
-        if (periodic) {
+        if (periodic && r > 1e-5 * hi) {
 
           double corr[3];
 	  gravity_exact_force_ewald_evaluate(dx, dy, dz, corr);
-- 
GitLab