From 529081d306404b085fbcf7c8b61a493ceb27b419 Mon Sep 17 00:00:00 2001 From: "weihong.xu" Date: Thu, 7 Sep 2023 10:00:35 +0800 Subject: [PATCH 1/2] update coordinate matching rule --- cp2kdata/block_parser/coordinates.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cp2kdata/block_parser/coordinates.py b/cp2kdata/block_parser/coordinates.py index 2fb3ff0..717f906 100644 --- a/cp2kdata/block_parser/coordinates.py +++ b/cp2kdata/block_parser/coordinates.py @@ -3,7 +3,7 @@ INIT_ATOMIC_COORDINATES_RE = re.compile( r""" - \sMODULE\sQUICKSTEP:\s\sATOMIC\sCOORDINATES\sIN\sangstrom\s*\n + \sMODULE\sQUICKSTEP:\s+ATOMIC\sCOORDINATES\sIN\sangstrom\s*\n \n \s+Atom\s+Kind\s+Element\s+X\s+Y\s+Z\s+Z\(eff\)\s+Mass\s*\n (\n)? @@ -20,7 +20,7 @@ \n )+ """, - re.VERBOSE + re.VERBOSE | re.IGNORECASE, ) @@ -34,7 +34,7 @@ def parse_init_atomic_coordinates(output_file): init_atomic_coordinates.append([x, y, z]) atom_kind_list = [int(kind) for kind in match.captures("kind")] chemical_symbols = match.captures("element") - + if init_atomic_coordinates: return np.array(init_atomic_coordinates, dtype=float), np.array(atom_kind_list, dtype=int), chemical_symbols else: From 5bb5e78f9f25988329fb34715a8927e6fbbd1069 Mon Sep 17 00:00:00 2001 From: "weihong.xu" Date: Thu, 7 Sep 2023 10:10:12 +0800 Subject: [PATCH 2/2] fix maching rule of coord line --- cp2kdata/block_parser/coordinates.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cp2kdata/block_parser/coordinates.py b/cp2kdata/block_parser/coordinates.py index 717f906..16ba3d5 100644 --- a/cp2kdata/block_parser/coordinates.py +++ b/cp2kdata/block_parser/coordinates.py @@ -12,11 +12,11 @@ \s+(?P\d+) \s+(?P\w+) \s+\d+ - \s+(?P[\s-]\d+\.\d+) - \s+(?P[\s-]\d+\.\d+) - \s+(?P[\s-]\d+\.\d+) - \s+[\s-]\d+\.\d+ - \s+[\s-]\d+\.\d+ + \s+(?P[-]?\d+\.\d+) + \s+(?P[-]?\d+\.\d+) + \s+(?P[-]?\d+\.\d+) + \s+[-]?\d+\.\d+ + \s+[-]?\d+\.\d+ \n )+ """,