From 543655ab66d87f29e179c5ce02cf45a03db202cc Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <schaller@strw.leidenuniv.nl>
Date: Mon, 7 Oct 2019 16:54:58 +0200
Subject: [PATCH] Reset the limiter flag at the end of the function.

---
 src/timestep_limiter.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/timestep_limiter.h b/src/timestep_limiter.h
index 01b72daea5..e45d288624 100644
--- a/src/timestep_limiter.h
+++ b/src/timestep_limiter.h
@@ -59,6 +59,8 @@ __attribute__((always_inline)) INLINE static integertime_t timestep_limit_part(
     old_time_bin = -p->wakeup;
   }
 
+  message("Limiting particle %lld wakeup=%d", p->id, p->wakeup);
+
   const integertime_t old_dti = old_ti_end - old_ti_beg;
 
   /* The new fake time-step the particle will be on */
@@ -137,7 +139,10 @@ __attribute__((always_inline)) INLINE static integertime_t timestep_limit_part(
             new_ti_beg + new_dti / 2);
 
   /* Remember the old time-bin */
-  p->wakeup = old_time_bin;
+  if (p->wakeup == time_bin_awake)
+    p->wakeup = old_time_bin;
+  else
+    p->wakeup = time_bin_not_awake;
 
   /* Update the time bin of this particle */
   p->time_bin = e->min_active_bin;
-- 
GitLab