Skip to content

PhBaseWorkChain: wrong calculation of calculated number of qpoints. #1216

@ymzhang0

Description

@ymzhang0

In PhBaseWorkChain, the create_merged_output method currently calculates the total number of q-points (num_qpoints_found) by summing the results from all iterations:

   num_qpoints_found = sum(
       len(output['number_of_irr_representations_for_each_q']) for output in output_dict.values()
   )

But actually, ph.x accumulates results into aiida.out during each iteration. Consequently, The PhCalculation parser also accumulates results into output_parameters. The output of the final iteration already contains the q-points computed in previous iterations.

Summing the lengths of the lists from all values in output_dict results in duplication and an incorrect total count of q-points. Then one get this kind of report:

2025-11-16 15:46:42 [84516 | REPORT]: [183079|PhBaseWorkChain|run_process]: launching PhCalculation<183082> iteration #1
2025-11-17 19:15:53 [84668 | REPORT]: [183079|PhBaseWorkChain|inspect_process]: PhCalculation<183082> failed and error was not handled, restarting once more
2025-11-17 19:15:53 [84669 | REPORT]: [183079|PhBaseWorkChain|run_process]: launching PhCalculation<183410> iteration #2
2025-11-19 18:32:32 [84730 | REPORT]: [183079|PhBaseWorkChain|create_merged_output]: Only 9 of 6 q-points were parsed.
2025-11-19 18:32:32 [84731 | REPORT]: [183079|PhBaseWorkChain|on_terminated]: remote folders will not be cleaned

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions