From 03e709c106f4fbb351fa4ea544c4dfec2e54c182 Mon Sep 17 00:00:00 2001
From: loikki <loic.hausammann@protonmail.ch>
Date: Fri, 18 Oct 2019 08:42:18 +0200
Subject: [PATCH] Stars: improve skip criterion

---
 src/runner_doiact_functions_stars.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/runner_doiact_functions_stars.h b/src/runner_doiact_functions_stars.h
index 34b1280420..63bb76169b 100644
--- a/src/runner_doiact_functions_stars.h
+++ b/src/runner_doiact_functions_stars.h
@@ -299,7 +299,7 @@ void DO_SYM_PAIR1_STARS(struct runner *r, struct cell *ci, struct cell *cj,
 #endif
     const double dj_min = sort_j[0].d;
     const float dx_max = (ci->stars.dx_max_sort + cj->hydro.dx_max_sort);
-    const float dx_max_rshift = dx_max - rshift;
+    const float hydro_dx_max_rshift = cj->hydro.dx_max_sort - rshift;
 
     /* Loop over the sparts in ci. */
     for (int pid = count_i - 1;
@@ -321,7 +321,7 @@ void DO_SYM_PAIR1_STARS(struct runner *r, struct cell *ci, struct cell *cj,
                    px[2] * runner_shift[sid][2];
 
       /* Is there anything we need to interact with ? */
-      const double di = dist + hi * kernel_gamma + dx_max_rshift;
+      const double di = dist + hi * kernel_gamma + hydro_dx_max_rshift;
       if (di < dj_min) continue;
 
       /* Get some additional information about pi */
@@ -428,7 +428,7 @@ void DO_SYM_PAIR1_STARS(struct runner *r, struct cell *ci, struct cell *cj,
     struct spart *restrict sparts_j = cj->stars.parts;
     const double di_max = sort_i[count_i - 1].d - rshift;
     const float dx_max = (ci->hydro.dx_max_sort + cj->stars.dx_max_sort);
-    const float dx_max_rshift = dx_max - rshift;
+    const float hydro_dx_max_rshift = ci->hydro.dx_max_sort - rshift;
 
     /* Loop over the parts in cj. */
     for (int pjd = 0; pjd < count_j && sort_j[pjd].d - hj_max - dx_max < di_max;
@@ -450,7 +450,7 @@ void DO_SYM_PAIR1_STARS(struct runner *r, struct cell *ci, struct cell *cj,
                    px[2] * runner_shift[sid][2];
 
       /* Is there anything we need to interact with ? */
-      const double dj = dist - hj * kernel_gamma - dx_max_rshift;
+      const double dj = dist - hj * kernel_gamma - hydro_dx_max_rshift;
       if (dj - rshift > di_max) continue;
 
       /* Get some additional information about pj */
-- 
GitLab