From a5034b299aa852f0ca058037778870fc1d49c08d Mon Sep 17 00:00:00 2001
From: Cristian C Lalescu <Cristian.Lalescu@ds.mpg.de>
Date: Tue, 25 Jun 2019 17:51:18 +0200
Subject: [PATCH] fix stopping mechanism

if stop_<simname> exists, script removes it.
---
 TurTLE/_code.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/TurTLE/_code.py b/TurTLE/_code.py
index ec11fd4c..da57b63f 100644
--- a/TurTLE/_code.py
+++ b/TurTLE/_code.py
@@ -253,6 +253,10 @@ class _code(_base):
             no_submit = False,
             no_debug = True):
         self.read_parameters()
+        # check if stop_<simname> exists, remove if it does
+        if os.path.exists(os.path.join(self.work_dir, 'stop_' + self.simname)):
+            warnings.warn("Found stop_<simname> file, I will remove it.")
+            os.remove(os.path.join(self.work_dir, 'stop_' + self.simname))
         with h5py.File(os.path.join(self.work_dir, self.simname + '.h5'), 'r') as data_file:
             iter0 = data_file['iteration'][...]
         if not os.path.isdir(self.work_dir):
-- 
GitLab