Skip to content
2 changes: 1 addition & 1 deletion electronicparsers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class EntryPoint(ParserEntryPoint):
metadata: Optional[dict] = Field(
None,
description="""
Metadata passed to the UI. Deprecated. """
Metadata passed to the UI. Deprecated. """,
)

def load(self):
Expand Down
9 changes: 5 additions & 4 deletions electronicparsers/abacus/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ def extract_data(val_in, nks):
data = []
for i in range(nks):
kx, ky, kz, npws = re.search(
rf'{i+1}/{nks} kpoint \(Cartesian\)\s*=\s*({re_float})\s*({re_float})\s*({re_float})\s*\((\d+)\s*pws\)',
rf'{i + 1}/{nks} kpoint \(Cartesian\)\s*=\s*({re_float})\s*({re_float})\s*({re_float})\s*\((\d+)\s*pws\)',
val_in,
).groups()
# TODO pylinit error, unbalanced-tuple-unpacking
Expand All @@ -324,7 +324,7 @@ def extract_data(val_in, nks):
map(
lambda x: x.strip().split(),
re.search(
rf'{i+1}/{nks} kpoint \(Cartesian\)\s*=.*\n([\s\S]+?)\n\n',
rf'{i + 1}/{nks} kpoint \(Cartesian\)\s*=.*\n([\s\S]+?)\n\n',
val_in,
)
.group(1)
Expand Down Expand Up @@ -368,15 +368,16 @@ def extract_data(val_in, nks):
data = []
for i in range(nks):
kx, ky, kz = re.search(
rf'k\-points{i+1}\(\d+\):\s*({re_float})\s*({re_float})\s*({re_float})',
rf'k\-points{i + 1}\(\d+\):\s*({re_float})\s*({re_float})\s*({re_float})',
val_in,
).groups()
res = np.array(
list(
map(
lambda x: x.strip().split(),
re.search(
rf'k\-points{i+1}\(\d+\):.*\n([\s\S]+?)\n\n', val_in
rf'k\-points{i + 1}\(\d+\):.*\n([\s\S]+?)\n\n',
val_in,
)
.group(1)
.split('\n'),
Expand Down
8 changes: 4 additions & 4 deletions electronicparsers/edmft/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -848,8 +848,8 @@ def parse(self, filepath: str, archive: EntryArchive, logger):
if params_files:
if len(params_files) > 1:
self.logger.warning(
'Multiple *params.dat files found; we will parse the last one.',
data={'files': params_files},
f'Multiple *params.dat files found: {params_files};',
'we will parse the last one.',
)
self.params_parser.mainfile = params_files[-1]

Expand All @@ -875,8 +875,8 @@ def parse(self, filepath: str, archive: EntryArchive, logger):
if indmfl_files:
if len(indmfl_files) > 1:
self.logger.warning(
'Multiple *.indmfl files found; we will parse the last one.',
data={'files': indmfl_files},
f'Multiple *.indmfl files found ({indmfl_files});',
'we will parse the last one.',
)
self.indmfl_parser.mainfile = indmfl_files[-1]
if self.general_parameters and self.impurity_parameters:
Expand Down
2 changes: 1 addition & 1 deletion electronicparsers/exciting/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -3254,7 +3254,7 @@ def parse_configuration(section):
volume_index = 1
while True:
info_volume = get_files(
f"run_dir{str(volume_index).rjust(2, '0')}/INFO.OUT",
f'run_dir{str(volume_index).rjust(2, "0")}/INFO.OUT',
self.filepath,
'INFO.OUT',
)
Expand Down
29 changes: 14 additions & 15 deletions electronicparsers/magres/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def init_quantities(self):
),
Quantity(
'kpoint_mp_offset',
rf'calc\_kpoint\_mp\_offset({re_float*3})$',
rf'calc\_kpoint\_mp\_offset({re_float * 3})$',
),
]
),
Expand All @@ -115,11 +115,11 @@ def init_quantities(self):
r'([\[\<]*atoms[\>\]]*[\s\S]+?)(?:[\[\<]*\/atoms[\>\]]*)',
sub_parser=TextParser(
quantities=[
Quantity('lattice', rf'lattice({re_float*9})'),
Quantity('lattice', rf'lattice({re_float * 9})'),
Quantity('symmetry', r'symmetry *([\w\-\+\,]+)', repeats=True),
Quantity(
'atom',
rf'atom *([a-zA-Z]+) *[a-zA-Z\d]* *([\d]+) *({re_float*3})',
rf'atom *([a-zA-Z]+) *[a-zA-Z\d]* *([\d]+) *({re_float * 3})',
repeats=True,
),
]
Expand All @@ -131,47 +131,47 @@ def init_quantities(self):
sub_parser=TextParser(
quantities=[
Quantity(
'ms', rf'ms *(\w+) *(\d+)({re_float*9})', repeats=True
'ms', rf'ms *(\w+) *(\d+)({re_float * 9})', repeats=True
),
Quantity(
'efg', rf'efg *(\w+) *(\d+)({re_float*9})', repeats=True
'efg', rf'efg *(\w+) *(\d+)({re_float * 9})', repeats=True
),
Quantity(
'efg_local',
rf'efg_local *(\w+) *(\d+)({re_float*9})',
rf'efg_local *(\w+) *(\d+)({re_float * 9})',
repeats=True,
),
Quantity(
'efg_nonlocal',
rf'efg_nonlocal *(\w+) *(\d+)({re_float*9})',
rf'efg_nonlocal *(\w+) *(\d+)({re_float * 9})',
repeats=True,
),
Quantity(
'isc',
rf'isc *(\w+) *(\d+) *(\w+) *(\d+)({re_float*9})',
rf'isc *(\w+) *(\d+) *(\w+) *(\d+)({re_float * 9})',
repeats=True,
),
Quantity(
'isc_fc',
rf'isc_fc *(\w+) *(\d+) *(\w+) *(\d+)({re_float*9})',
rf'isc_fc *(\w+) *(\d+) *(\w+) *(\d+)({re_float * 9})',
repeats=True,
),
Quantity(
'isc_orbital_p',
rf'isc_orbital_p *(\w+) *(\d+) *(\w+) *(\d+)({re_float*9})',
rf'isc_orbital_p *(\w+) *(\d+) *(\w+) *(\d+)({re_float * 9})',
repeats=True,
),
Quantity(
'isc_orbital_d',
rf'isc_orbital_d *(\w+) *(\d+) *(\w+) *(\d+)({re_float*9})',
rf'isc_orbital_d *(\w+) *(\d+) *(\w+) *(\d+)({re_float * 9})',
repeats=True,
),
Quantity(
'isc_spin',
rf'isc_spin *(\w+) *(\d+) *(\w+) *(\d+)({re_float*9})',
rf'isc_spin *(\w+) *(\d+) *(\w+) *(\d+)({re_float * 9})',
repeats=True,
),
Quantity('sus', rf'sus *({re_float*9})', repeats=True),
Quantity('sus', rf'sus *({re_float * 9})', repeats=True),
]
),
),
Expand Down Expand Up @@ -443,8 +443,7 @@ def parse(self, filepath, archive, logger):
program_name = calculation_params.get('code', '')
if program_name != 'CASTEP':
self.logger.error(
'Only CASTEP-based NMR simulations are supported by the '
'magres parser.'
'Only CASTEP-based NMR simulations are supported by the magres parser.'
)
return
sec_run.program = Program(
Expand Down
Loading
Loading