Skip to content

Commit

Permalink
HpParser: fix q-points/atoms output test case
Browse files Browse the repository at this point in the history
The current raw output parser would miss some corner cases,
when lots of q-points are generated and the number has no more
any space left from the parenthesis.
The solution is to use a more general regex search. As a sanity
check, also the perturbed atom number sites regex search is
changed correspondingly.
  • Loading branch information
bastonero committed Feb 13, 2024
1 parent 31ae4e9 commit a3cad55
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/aiida_quantumespresso_hp/parsers/parse_raw/hp.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ def parse_raw_output(stdout):
detect_important_message(logs, line)

# A calculation that will only perturb a single atom will only print one line
match = re.search(r'.*The grid of q-points.*\s+([0-9]+)+\s+q-points.*', line)
match = re.search(r'.*The grid of q-points.*?(\d+)+\s+q-points.*', line)
if match:
parsed_data['number_of_qpoints'] = int(match.group(1))

# Determine the atomic sites that will be perturbed, or that the calculation expects
# to have been calculated when post-processing the final matrices
match = re.search(r'.*List of\s+([0-9]+)\s+atoms which will be perturbed.*', line)
match = re.search(r'.*List of.*?(\d+)\s+atoms which will be perturbed.*', line)
if match:
hubbard_sites = {}
number_of_perturbed_atoms = int(match.group(1))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
Changing the type of the perturbed atom back to its original type...


The grid of q-points ( 4, 4, 4) ( 18 q-points ) :
The grid of q-points ( 4, 4, 4) (18 q-points ) :
N xq(1) xq(2) xq(3) wq
1 0.000000000 0.000000000 0.000000000 0.015625000
2 0.000000000 0.216131358 -0.211002628 0.062500000
Expand Down

0 comments on commit a3cad55

Please sign in to comment.