Skip to content

Commit 3f44a3a

Browse files
committed
Match INFOXS.OUT in favor of INFO_SCR.OUT
1 parent ddb04b5 commit 3f44a3a

3 files changed

Lines changed: 25 additions & 18 deletions

File tree

‎electronicparsers/__init__.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,8 +392,9 @@ def load(self):
392392
aliases=['parsers/exciting'],
393393
description='NOMAD parser for EXCITING.',
394394
python_package='electronicparsers.exciting',
395-
mainfile_contents_re=r'EXCITING.*started[\s\S]+?All units are atomic ',
396-
mainfile_name_re=r'^.*.OUT(\.[^/]*)?$',
395+
mainfile_contents_re=r'(?:EXCITING.*started[\s\S]+?All units are atomic)|(?:EXCITING.*started)',
396+
mainfile_name_re=r'^.*INFO.OUT(\.[^/]*)?$',
397+
mainfile_alternative=True,
397398
parser_class_name='electronicparsers.exciting.ExcitingParser',
398399
code_name='exciting',
399400
code_homepage='http://exciting-code.org/',

‎electronicparsers/exciting/parser.py‎

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3291,30 +3291,33 @@ def get_mainfile_keys(self, **kwargs):
32913291
filepath = kwargs.get('filename')
32923292
basename = os.path.basename(filepath)
32933293
gs_file = 'INFO.OUT' in basename
3294-
# parse xs for screening files if ground state file is missing
3295-
no_gs_file = re.match(r'INFO_SCR.OUT.*', basename) and not get_files(
3296-
'INFO.OUT', filepath
3297-
)
3294+
if re.match(r'INFO_SCR.OUT.*', basename):
3295+
# do not parse screening files
3296+
return False
32983297

32993298
dirname = os.path.dirname(filepath)
3300-
if os.path.isfile(os.path.join(dirname, f'GW_{basename}')):
3299+
if os.path.isfile(os.path.join(dirname, f'GW_{basename}')) and gs_file:
33013300
return ['GW', 'GW_workflow']
33023301

33033302
xs_files = get_files('*INFOXS*.OUT*', filepath, 'INFO.OUT')
3304-
if xs_files and (gs_file or no_gs_file):
3303+
# parse xs for screening files if ground state file is missing
3304+
no_gs_file = len(get_files('INFO.OUT', filepath)) == 0
3305+
print('NNN', no_gs_file, basename)
3306+
if (xs_files and gs_file) or ('INFOXS.OUT' in basename and no_gs_file):
33053307
re_xs_mainfile = re.compile(r'.+\d\d\d\.OUT')
33063308
spectra_files = []
33073309
for prefix in self._xs_spectra_types:
33083310
spectra_files = get_files(f'{prefix}_*.OUT', filepath, 'INFO.OUT')
33093311
if spectra_files:
33103312
# remove files for qpoints other than first
3311-
files = ['XS_workflow'] + xs_files
3313+
files = (['XS_workflow'] + xs_files) if gs_file else []
33123314
for f in spectra_files:
33133315
if re_xs_mainfile.match(f):
33143316
if '001' in f:
33153317
files.append(f)
33163318
else:
33173319
files.append(f)
3320+
print('FFFF', files)
33183321
return files
33193322
return True
33203323

@@ -3407,5 +3410,5 @@ def parse(self, filepath, archive, logger, **kwargs):
34073410
if xs_workflow_archive:
34083411
try:
34093412
self.parse_xs_workflow(xs_archives, xs_workflow_archive)
3410-
except Exception:
3411-
self.logger.error('Error parsing the automatic XS workflow')
3413+
except Exception as e:
3414+
self.logger.error(f'Error parsing the automatic XS workflow {e}')

‎electronicparsers/utils/utils.py‎

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -375,14 +375,17 @@ def extract_polarization_outputs():
375375
index = 0
376376
for path, archive in self._child_archives.items():
377377
if os.path.basename(path).split('_')[0] in self._xs_spectra_types:
378-
output_polarization = extract_section(archive, ['run', 'calculation'])
379-
output.append(
380-
Link(
381-
name=f'Output polarization {index + 1}',
382-
section=output_polarization,
383-
)
378+
output_polarization = extract_section(
379+
archive, ['run', 'calculation']
384380
)
385-
index += 1
381+
if output_polarization:
382+
output.append(
383+
Link(
384+
name=f'Output polarization {index + 1}',
385+
section=output_polarization,
386+
)
387+
)
388+
index += 1
386389
return output
387390

388391
workflow = XS(method=XSMethod())

0 commit comments

Comments
 (0)