From d430ca818e62aeae82f75cf3687093f1f63bf28a Mon Sep 17 00:00:00 2001 From: jrudz Date: Tue, 26 Mar 2024 15:34:22 +0100 Subject: [PATCH 1/2] fixed regex to skip lines in log with variables --- atomisticparsers/lammps/parser.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/atomisticparsers/lammps/parser.py b/atomisticparsers/lammps/parser.py index 77c2bbd8..dea95aac 100644 --- a/atomisticparsers/lammps/parser.py +++ b/atomisticparsers/lammps/parser.py @@ -658,6 +658,8 @@ def __init__(self): def init_quantities(self): def str_op(val): + if "${" in val: + return None val = val.split("#")[0] val = val.replace("&\n", " ").split() val = val if len(val) > 1 else val[0] @@ -666,7 +668,7 @@ def str_op(val): self._quantities = [ Quantity( name, - r"\n\s*%s\s+([\w\. \/\#\-]+)(\&\n[\w\. \/\#\-]*)*" % name, + r"\n\s*%s\s+(?!.*\$\{)([${}\w\. \/\#\-]+)(\&\n[\w\. \/\#\-]*)*" % name, str_operation=str_op, comment="#", repeats=True, From 4b0f139dcf098778f6d087dfa768a295e1c344de Mon Sep 17 00:00:00 2001 From: jrudz Date: Tue, 26 Mar 2024 15:37:13 +0100 Subject: [PATCH 2/2] removed if statement in str to op --- atomisticparsers/lammps/parser.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/atomisticparsers/lammps/parser.py b/atomisticparsers/lammps/parser.py index dea95aac..3896d2c1 100644 --- a/atomisticparsers/lammps/parser.py +++ b/atomisticparsers/lammps/parser.py @@ -658,8 +658,6 @@ def __init__(self): def init_quantities(self): def str_op(val): - if "${" in val: - return None val = val.split("#")[0] val = val.replace("&\n", " ").split() val = val if len(val) > 1 else val[0]