From 96e1484ad30b24217853ccda1c76e78a661df7a3 Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <schaller@strw.leidenuniv.nl>
Date: Tue, 5 Nov 2019 15:40:32 +0100
Subject: [PATCH] Do *NOT* use the default values as optional parameters when
 re-reading the space global variables when resuming a simulation!

---
 src/engine.c | 42 ++++++++++++++++++------------------------
 1 file changed, 18 insertions(+), 24 deletions(-)

diff --git a/src/engine.c b/src/engine.c
index 32190ecdbf..5119b2e31e 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -4064,38 +4064,32 @@ void engine_config(int restart, int fof, struct engine *e,
 
     /* Overwrite the constants for the scheduler */
     space_maxsize = parser_get_opt_param_int(params, "Scheduler:cell_max_size",
-                                             space_maxsize_default);
-    space_subsize_pair_hydro =
-        parser_get_opt_param_int(params, "Scheduler:cell_sub_size_pair_hydro",
-                                 space_subsize_pair_hydro_default);
-    space_subsize_self_hydro =
-        parser_get_opt_param_int(params, "Scheduler:cell_sub_size_self_hydro",
-                                 space_subsize_self_hydro_default);
-    space_subsize_pair_stars =
-        parser_get_opt_param_int(params, "Scheduler:cell_sub_size_pair_stars",
-                                 space_subsize_pair_stars_default);
-    space_subsize_self_stars =
-        parser_get_opt_param_int(params, "Scheduler:cell_sub_size_self_stars",
-                                 space_subsize_self_stars_default);
-    space_subsize_pair_grav =
-        parser_get_opt_param_int(params, "Scheduler:cell_sub_size_pair_grav",
-                                 space_subsize_pair_grav_default);
-    space_subsize_self_grav =
-        parser_get_opt_param_int(params, "Scheduler:cell_sub_size_self_grav",
-                                 space_subsize_self_grav_default);
+                                             space_maxsize);
+    space_subsize_pair_hydro = parser_get_opt_param_int(
+        params, "Scheduler:cell_sub_size_pair_hydro", space_subsize_pair_hydro);
+    space_subsize_self_hydro = parser_get_opt_param_int(
+        params, "Scheduler:cell_sub_size_self_hydro", space_subsize_self_hydro);
+    space_subsize_pair_stars = parser_get_opt_param_int(
+        params, "Scheduler:cell_sub_size_pair_stars", space_subsize_pair_stars);
+    space_subsize_self_stars = parser_get_opt_param_int(
+        params, "Scheduler:cell_sub_size_self_stars", space_subsize_self_stars);
+    space_subsize_pair_grav = parser_get_opt_param_int(
+        params, "Scheduler:cell_sub_size_pair_grav", space_subsize_pair_grav);
+    space_subsize_self_grav = parser_get_opt_param_int(
+        params, "Scheduler:cell_sub_size_self_grav", space_subsize_self_grav);
     space_splitsize = parser_get_opt_param_int(
-        params, "Scheduler:cell_split_size", space_splitsize_default);
+        params, "Scheduler:cell_split_size", space_splitsize);
     space_subdepth_diff_grav =
         parser_get_opt_param_int(params, "Scheduler:cell_subdepth_diff_grav",
                                  space_subdepth_diff_grav_default);
     space_extra_parts = parser_get_opt_param_int(
-        params, "Scheduler:cell_extra_parts", space_extra_parts_default);
+        params, "Scheduler:cell_extra_parts", space_extra_parts);
     space_extra_sparts = parser_get_opt_param_int(
-        params, "Scheduler:cell_extra_sparts", space_extra_sparts_default);
+        params, "Scheduler:cell_extra_sparts", space_extra_sparts);
     space_extra_gparts = parser_get_opt_param_int(
-        params, "Scheduler:cell_extra_gparts", space_extra_gparts_default);
+        params, "Scheduler:cell_extra_gparts", space_extra_gparts);
     space_extra_bparts = parser_get_opt_param_int(
-        params, "Scheduler:cell_extra_bparts", space_extra_bparts_default);
+        params, "Scheduler:cell_extra_bparts", space_extra_bparts);
 
     engine_max_parts_per_ghost =
         parser_get_opt_param_int(params, "Scheduler:engine_max_parts_per_ghost",
-- 
GitLab