Skip to content

Commit 26b8603

Browse files
committed
Fix parsing of SIRIUS stdout
1 parent cdcc0b0 commit 26b8603

File tree

1 file changed

+15
-5
lines changed
  • src/aiida_quantumespresso/parsers/parse_raw

1 file changed

+15
-5
lines changed

src/aiida_quantumespresso/parsers/parse_raw/pw.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,9 @@ def parse_stdout(stdout, input_parameters, parser_options=None, parsed_xml=None,
328328
# Determine whether the input switched on an electric field
329329
lelfield = input_parameters.get('CONTROL', {}).get('lelfield', False)
330330

331+
# Determine whether SIRIUS is used
332+
uses_sirius = 'SIRIUS' in ' '.join(data_lines[:50])
333+
331334
# Find some useful quantities.
332335
if not parsed_xml.get('number_of_bands', None):
333336
try:
@@ -513,11 +516,14 @@ def parse_stdout(stdout, input_parameters, parser_options=None, parsed_xml=None,
513516
# (cell, initial positions, kpoints, ...) and I skip them.
514517
# In case, parse for them before this point.
515518
# Put everything in a trajectory_data dictionary
516-
relax_steps = stdout.split('Self-consistent Calculation')[1:]
519+
if uses_sirius:
520+
relax_steps = stdout.split('* running SCF ground state *')[1:]
521+
else:
522+
relax_steps = stdout.split('Self-consistent Calculation')[1:]
523+
517524
relax_steps = [i.split('\n') for i in relax_steps]
518525

519526
# now I create a bunch of arrays for every step.
520-
521527
for data_step in relax_steps:
522528
trajectory_frame = {}
523529

@@ -677,9 +683,9 @@ def parse_stdout(stdout, input_parameters, parser_options=None, parsed_xml=None,
677683
pass
678684

679685
# grep energy and possibly, magnetization
680-
elif '!' in line:
686+
elif re.search(r'^\s*!\s+total energy\s*', line, re.IGNORECASE):
681687
try:
682-
688+
breakpoint()
683689
En = float(line.split('=')[1].split('Ry')[0]) * CONSTANTS.ry_to_ev
684690

685691
# Up till v6.5, the line after total energy would be the Harris-Foulkes estimate, followed by the
@@ -876,7 +882,11 @@ def parse_stdout(stdout, input_parameters, parser_options=None, parsed_xml=None,
876882
trajectory_data.setdefault('ionic_dipole_cartesian_axes', []).append(id_axes)
877883

878884
# check consistency of scf_accuracy and scf_iterations
879-
if 'scf_accuracy' in trajectory_data:
885+
886+
# we skip the skip is SIRIUS is used, as SIRIUS does not print the scf_accuracy
887+
# for all scf steps per default, only at the end of each ionic step. Therefore,
888+
# the lenghts will typically not match
889+
if 'scf_accuracy' in trajectory_data and not uses_sirius:
880890
if 'scf_iterations' in trajectory_data:
881891
if len(trajectory_data['scf_accuracy']) != sum(trajectory_data['scf_iterations']):
882892
logs.warning.append(

0 commit comments

Comments
 (0)