Skip to content

Commit 6ff3804

Browse files
committed
Fix the ph tests
1 parent 2da26f5 commit 6ff3804

File tree

10 files changed

+57
-2
lines changed

10 files changed

+57
-2
lines changed

src/aiida_quantumespresso/parsers/parse_raw/ph.py

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,48 @@ def parse_ph_text_output(lines, logs):
146146
:return: dictionary with parsed values
147147
"""
148148

149+
def parse_qpoints(lines):
150+
"""Parse the q-points from the corresponding lines in the stdout."""
151+
152+
return {int(line.split()[0]): [float(coord) for coord in line.split()[1:4]] for line in lines}
153+
154+
def parse_mode_symmetries(lines, num_atoms):
155+
"""Parse the mode symmetries from the block after diagonalization of the dynamical matrix."""
156+
157+
q_data = {}
158+
symlabel_q_point = [float(i) for i in lines[2].split('q = (')[-1].split(')')[0].split()]
159+
160+
q_data['mode_symmetry'] = []
161+
162+
for line in lines:
163+
164+
if 'Mode symmetry' in line:
165+
q_data['point_group'] = line.split('Mode symmetry,')[1].split('point group:')[0].strip()
166+
167+
if '-->' in line:
168+
freq_start = int(line.split('(')[1].split(')')[0].split('-')[0])
169+
freq_end = int(line.split('(')[1].split(')')[0].split('-')[1])
170+
171+
if line.split()[-1] == 'I':
172+
symm_label = line.split()[-2]
173+
else:
174+
symm_label = line.split()[-1]
175+
176+
q_data['mode_symmetry'].extend([symm_label] * (freq_end - freq_start + 1))
177+
178+
# If the mode symmetries are not printed, set those for the non-symmetry case
179+
if 'point_group' not in q_data:
180+
q_data['point_group'] = 'C_1'
181+
q_data['mode_symmetry'] = ['A'] * (3 * num_atoms)
182+
183+
return symlabel_q_point, q_data
184+
149185
parsed_data = {}
150186

187+
parsed_data['num_q_found'] = 0
188+
151189
# Parse number of q-points and number of atoms
152-
for line in lines:
190+
for count, line in enumerate(lines):
153191

154192
if 'q-points for this run' in line:
155193
try:

src/aiida_quantumespresso/parsers/ph.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,14 @@ def parse_stdout(cls, stdout: str, tensor_file: str, dynmat_files: list) -> tupl
6767
from aiida_quantumespresso.parsers.parse_raw.ph import parse_raw_ph_output as parse_stdout
6868

6969
parsed_base, logs_base = super().parse_stdout(stdout)
70+
71+
# if logs_base['error']:
72+
# return parsed_base, logs_base
73+
7074
parsed_data, logs = parse_stdout(stdout, tensor_file, dynmat_files)
7175

76+
77+
7278
parsed_data.update(parsed_base)
7379
for log_level, log_items in logs_base.items():
7480
logs[log_level].extend(log_items)

tests/parsers/test_ph.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def test_ph_default(test_name, fixture_localhost, generate_calc_job_node, genera
2222

2323
assert calcfunction.is_finished, calcfunction.exception
2424
assert calcfunction.is_finished_ok, calcfunction.exit_message
25-
assert not orm.Log.collection.get_logs_for(node)
25+
assert not [log for log in orm.Log.objects.get_logs_for(node) if log.levelname == 'ERROR']
2626
assert 'output_parameters' in results
2727
data_regression.check(results['output_parameters'].get_dict())
2828

tests/parsers/test_ph/test_ph_default_default_.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,5 @@ number_of_atoms: 2
5656
number_of_irr_representations_for_each_q:
5757
- 2
5858
number_of_qpoints: 1
59+
wall_time: 15.25s
5960
wall_time_seconds: 15.25

tests/parsers/test_ph/test_ph_default_no_modes_printed_.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
code_version: v.6.8
12
dynamical_matrix_1:
23
frequencies:
34
- 147.433165
@@ -24,4 +25,5 @@ number_of_atoms: 2
2425
number_of_irr_representations_for_each_q:
2526
- 6
2627
number_of_qpoints: 1
28+
wall_time: 26.71s
2729
wall_time_seconds: 26.71

tests/parsers/test_ph/test_ph_default_single_qpoint_.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
code_version: v.7.0
12
dynamical_matrix_1:
23
frequencies:
34
- -3.206051
@@ -18,4 +19,5 @@ number_of_atoms: 1
1819
number_of_irr_representations_for_each_q:
1920
- 2
2021
number_of_qpoints: 1
22+
wall_time: 23.37s
2123
wall_time_seconds: 23.37

tests/parsers/test_ph/test_ph_not_converged.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ number_of_atoms: 2
33
number_of_irr_representations_for_each_q:
44
- 2
55
number_of_qpoints: 8
6+
wall_time: 3m21.58s
67
wall_time_seconds: 201.57999999999998

tests/parsers/test_ph/test_ph_out_of_walltime.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ number_of_atoms: 2
33
number_of_irr_representations_for_each_q:
44
- 2
55
number_of_qpoints: 3
6+
wall_time: 7.13s
67
wall_time_seconds: 7.13

tests/workflows/ph/test_base/test_merge_outputs_merge_outputs_.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
code_version: v.7.0
12
dynamical_matrix_1:
23
frequencies:
34
- -3.205876
@@ -53,4 +54,5 @@ number_of_irr_representations_for_each_q:
5354
- 3
5455
- 3
5556
number_of_qpoints: 4
57+
wall_time: 55.47s
5658
wall_time_seconds: 113.61

tests/workflows/ph/test_base/test_merge_outputs_merge_outputs_singleq_.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
code_version: v.7.0
12
dynamical_matrix_1:
23
frequencies:
34
- -3.151844
@@ -18,4 +19,5 @@ number_of_atoms: 1
1819
number_of_irr_representations_for_each_q:
1920
- 2
2021
number_of_qpoints: 1
22+
wall_time: 7.40s
2123
wall_time_seconds: 27.53

0 commit comments

Comments
 (0)