From be2f24d23d301d823ab32a42554b34e44123fd89 Mon Sep 17 00:00:00 2001
From: David Hendriks <davidhendriks93@gmail.com>
Date: Tue, 27 Sep 2022 11:28:48 +0100
Subject: [PATCH] updated stopping criterion MC

---
 .../population_extensions/evolution_functions.py  | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/binarycpython/utils/population_extensions/evolution_functions.py b/binarycpython/utils/population_extensions/evolution_functions.py
index edb4b7a58..f2ebea5a1 100644
--- a/binarycpython/utils/population_extensions/evolution_functions.py
+++ b/binarycpython/utils/population_extensions/evolution_functions.py
@@ -556,7 +556,15 @@ class evolution_functions:
             #   this can be set in the _monte_carlo_sampling_check_mass_threshold function or via _monte_carlo_sampling_check_custom_threshold
             if self.grid_options["_monte_carlo_threshold_reached"]:
                 # TODO: Write a correct signalling of stopping the queue while
-                print("_monte_carlo_threshold_reached True. WHAT TO DO NOW??")
+
+                self.verbose_print(
+                    "Monte-Carlo threshold reached. Signaling to stop processing the queue{}",
+                    self.grid_options["verbosity"],
+                    2,
+                )
+
+                # Queue is done:
+                self.grid_options["_queue_done"] = True
 
             ########
             # Put system in the job queue
@@ -573,6 +581,11 @@ class evolution_functions:
                 3,
             )
 
+            ########
+            # Handle stopping
+            if self.grid_options["_queue_done"] == True:
+                break
+
         # Signal queue is done
         self.grid_options["_queue_done"] = True
 
-- 
GitLab