From c935c9210110f4000a9b4b389c40c15d7cc28472 Mon Sep 17 00:00:00 2001 From: Jacob Wilkins Date: Fri, 20 Oct 2023 17:40:21 +0100 Subject: [PATCH] Add parsing for restart --- castep_outputs/castep_file_parser.py | 10 ++++++++++ castep_outputs/test/test_castep_parser.py | 6 +++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/castep_outputs/castep_file_parser.py b/castep_outputs/castep_file_parser.py index 09e8478..ee74186 100644 --- a/castep_outputs/castep_file_parser.py +++ b/castep_outputs/castep_file_parser.py @@ -123,6 +123,16 @@ def parse_castep_file(castep_file_in: TextIO, curr_run["parallel_efficiency"] = float(get_numbers(line)[0]) + # Continuation + elif line.startswith("Reading continuation data"): + + if "sys_info" not in to_parse: + continue + + logger("Found continuation block") + + curr_run["continuation"] = line.split()[-1] + # Warnings elif block := get_block(line, castep_file, gen_table_re("", r"\?+"), diff --git a/castep_outputs/test/test_castep_parser.py b/castep_outputs/test/test_castep_parser.py index 09abc15..0587485 100644 --- a/castep_outputs/test/test_castep_parser.py +++ b/castep_outputs/test/test_castep_parser.py @@ -3286,10 +3286,10 @@ def test_get_continuation(self): test_text = io.StringIO(""" Reading continuation data from model file BN.check """) - self.skipTest("Not implemented yet") + test_dict = parse_castep_file(test_text)[0] - pprint.pprint(test_dict) - self.assertEqual(test_dict, {}) + + self.assertEqual(test_dict, {'continuation': 'BN.check'}) class test_pspot_parser: