aiida_quantumespresso.workflows.ph.base#

Workchain to run a Quantum ESPRESSO ph.x calculation with automated error handling and restarts.

Module Contents#

Classes#

PhBaseWorkChain

Workchain to run a Quantum ESPRESSO ph.x calculation with automated error handling and restarts.

Attributes#

PhCalculation

PwCalculation

aiida_quantumespresso.workflows.ph.base.PhCalculation[source]#
aiida_quantumespresso.workflows.ph.base.PwCalculation[source]#
class aiida_quantumespresso.workflows.ph.base.PhBaseWorkChain(*args, **kwargs)[source]#

Bases: aiida_quantumespresso.workflows.protocols.utils.ProtocolMixin, aiida.engine.BaseRestartWorkChain

Workchain to run a Quantum ESPRESSO ph.x calculation with automated error handling and restarts.

_process_class[source]#
defaults[source]#
classmethod define(spec)[source]#

Define the process specification.

classmethod validate_inputs(value, port_namespace)[source]#

Validate the top level namespace.

classmethod get_protocol_filepath()[source]#

Return pathlib.Path to the .yaml file that defines the protocols.

classmethod get_builder_from_protocol(code, parent_folder=None, protocol=None, overrides=None, electronic_type=ElectronicType.METAL, options=None, **_)[source]#

Return a builder prepopulated with inputs selected according to the chosen protocol.

Parameters:
  • code – the Code instance configured for the quantumespresso.ph plugin.

  • protocol – protocol to use, if not specified, the default will be used.

  • overrides – optional dictionary of inputs to override the defaults of the protocol.

  • options – A dictionary of options that will be recursively set for the metadata.options input of all the CalcJobs that are nested in this work chain.

  • electronic_type – indicate the electronic character of the system through ElectronicType instance.

Returns:

a process builder instance with all inputs defined ready for launch.

setup()[source]#

Call the setup of the BaseRestartWorkChain and then create the inputs dictionary in self.ctx.inputs.

This self.ctx.inputs dictionary will be used by the BaseRestartWorkChain to submit the calculations in the internal loop.

validate_parameters()[source]#

Validate inputs that might depend on each other and cannot be validated by the spec.

set_qpoints()[source]#

Set the inputs related to qpoints.

Either an explicit KpointsData with given mesh/path, or a desired qpoints distance should be specified. In the case of the latter, the KpointsData will be constructed for the input StructureData from the parent_folder using the create_kpoints_from_distance calculation function.

set_max_seconds(max_wallclock_seconds: None)[source]#

Set the max_seconds to a fraction of max_wallclock_seconds option to prevent out-of-walltime problems.

Parameters:

max_wallclock_seconds – the maximum wallclock time that will be set in the scheduler settings.

prepare_process()[source]#

Prepare the inputs for the next calculation.

If a restart_calc has been set in the context, its remote_folder will be used as the parent_folder input for the next calculation and the restart_mode is set to restart.

create_merged_output()[source]#

Merge outputs from multiple PhCalculation runs called by the workchain if necessary.

get_outputs(node) Mapping[str, aiida.orm.Node][source]#

Return a mapping of the outputs that should be attached as outputs to the work chain.

report_error_handled(calculation, action)[source]#

Report an action taken for a calculation that has failed.

This should be called in a registered error handler if its condition is met and an action was taken.

Parameters:
  • calculation – the failed calculation node

  • action – a string message with the action taken

handle_unrecoverable_failure(node)[source]#

Handle calculations with an exit status below 400 which are unrecoverable, so abort the work chain.

handle_scheduler_out_of_walltime(node)[source]#

Handle ERROR_SCHEDULER_OUT_OF_WALLTIME exit code: decrease the max_secondes and restart from scratch.

handle_diagonalization_errors(calculation)[source]#

Handle known issues related to the diagonalization.

Switch to diagonalization = 'cg' if not already running with this setting, and restart from the charge density. In case the run already used conjugate gradient diagonalization, abort.

handle_out_of_walltime(node)[source]#

Handle ERROR_OUT_OF_WALLTIME exit code: calculation shut down neatly and we can simply restart.

handle_convergence_not_reached(node)[source]#

Handle ERROR_CONVERGENCE_NOT_REACHED exit code: decrease the mixing beta and restart.