Skip to content

Commit

Permalink
PwBaseWorkChain: Add ERROR_IONIC_INTERRUPTED_PARTIAL_TRAJECTORY h…
Browse files Browse the repository at this point in the history
…andler

Since the cause for this exit code is most likely transient, we can
simply restart from the latest output structure. The restart has to be
from scratch since the charge density is likely to be corrupt since the
calculation was interrupted.
  • Loading branch information
sphuber committed Apr 18, 2023
1 parent 92a6c6f commit 9291f84
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/aiida_quantumespresso/workflows/pw/base.py
Expand Up @@ -449,6 +449,21 @@ def handle_out_of_walltime(self, calculation):

return ProcessHandlerReport(True)

@process_handler(priority=575, exit_codes=[
PwCalculation.exit_codes.ERROR_IONIC_INTERRUPTED_PARTIAL_TRAJECTORY,
])
def handle_ionic_interrupted_partial_trajectory(self, calculation):
"""Handle `ERROR_IONIC_INTERRUPTED_PARTIAL_TRAJECTORY` exit code.
In this case the calculation got interrupted during an ionic optimization due to a problem that is likely
transient, so we can restart from the last output structure. Note that since the job got interrupted the charge
density and wave functions are likely corrupt so those cannot be used in the restart.
"""
self.ctx.inputs.structure = calculation.outputs.output_structure
self.set_restart_type(RestartType.FROM_SCRATCH)
self.report_error_handled(calculation, 'restarting from scratch from the last output structure')
return ProcessHandlerReport(True)

@process_handler(
priority=570, exit_codes=[
PwCalculation.exit_codes.ERROR_IONIC_CONVERGENCE_REACHED_EXCEPT_IN_FINAL_SCF,
Expand Down

0 comments on commit 9291f84

Please sign in to comment.