aiida_hubbard.workflows.hubbard

Contents

aiida_hubbard.workflows.hubbard#

Turn-key solution to automatically compute the self-consistent Hubbard parameters for a given structure.

Module Contents#

Classes#

SelfConsistentHubbardWorkChain

Workchain computing the self-consistent Hubbard parameters of a structure.

Functions#

get_separated_parameters(→ tuple[list, list])

Return a tuple with onsites and intersites parameters separated.

validate_positive(value, _)

Validate that the value is positive.

validate_inputs(inputs, _)

Validate the entire inputs.

Attributes#

aiida_hubbard.workflows.hubbard.HubbardStructureData[source]#
aiida_hubbard.workflows.hubbard.PwCalculation[source]#
aiida_hubbard.workflows.hubbard.PwBaseWorkChain[source]#
aiida_hubbard.workflows.hubbard.PwRelaxWorkChain[source]#
aiida_hubbard.workflows.hubbard.HpWorkChain[source]#
aiida_hubbard.workflows.hubbard.get_separated_parameters(hubbard_parameters: list[tuple[int, str, int, str, float, tuple[int, int, int], str]]) tuple[list, list][source]#

Return a tuple with onsites and intersites parameters separated.

Returns:

tuple (list of onsites, list of intersites).

aiida_hubbard.workflows.hubbard.validate_positive(value, _)[source]#

Validate that the value is positive.

aiida_hubbard.workflows.hubbard.validate_inputs(inputs, _)[source]#

Validate the entire inputs.

class aiida_hubbard.workflows.hubbard.SelfConsistentHubbardWorkChain(inputs: dict | None = None, logger: logging.Logger | None = None, runner: aiida.engine.runners.Runner | None = None, enable_persistence: bool = True)[source]#

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

Workchain computing the self-consistent Hubbard parameters of a structure.

It iteratively relaxes the structure (optional) with the PwRelaxWorkChain and computes the Hubbard parameters through the HpWorkChain, using the remote folder of an scf performed via the PwBaseWorkChain, until the Hubbard values are converged within certain tolerance(s).

The procedure in each step of the convergence cycle is slightly different depending on the electronic and magnetic properties of the system. Each cycle will roughly consist of three steps:

  • Relaxing the structure at the current Hubbard values (optional).

  • One or two DFT calculations depending whether the system is metallic or insulating, respectively.

  • A DFPT calculation of the Hubbard parameters, perturbing the ground-state of the last DFT run.

The possible options for the set of DFT SCF calculations that have to be run in the second step look are:

  • Metals:
    • SCF with smearing.

  • Insulators
    • SCF with smearing.

    • SCF with fixed occupations; if magnetic, total magnetization and number of bands

      are fixed to the values found from the previous SCF calculation.

When convergence is achieved a node will be returned containing the final converged HubbardStructureData.

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

Define the specifications of the process.

classmethod get_protocol_filepath()[source]#

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

classmethod get_builder_from_protocol(pw_code, hp_code, hubbard_structure, protocol=None, overrides=None, options_pw=None, options_hp=None, **kwargs)[source]#

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

Parameters:
  • pw_code – the Code instance configured for the quantumespresso.pw plugin.

  • hp_code – the Code instance configured for the quantumespresso.hp plugin.

  • hubbard_structure – the HubbardStructureData instance containing the initialised Hubbard paramters.

  • 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_pw – A dictionary of options that will be recursively set for the metadata.options input of all the pw CalcJobs that are nested in this work chain.

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

Returns:

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

setup()[source]#

Set up Context variables.

should_run_relax()[source]#

Return whether a relax calculation needs to be run, which is true if relax is specified in inputs.

should_check_convergence()[source]#

Return whether to check the convergence of Hubbard parameters.

should_run_iteration()[source]#

Return whether a new process should be run.

update_iteration()[source]#

Update the current iteration index counter.

is_insulator()[source]#

Return whether the current structure is a metal.

is_magnetic()[source]#

Return whether the current structure is magnetic.

get_inputs(cls, namespace)[source]#

Return the inputs for one of the subprocesses whose inputs are exposed in the given namespace.

Parameters:
  • cls – the process class of the subprocess

  • namespace – namespace into which the inputs are exposed.

Returns:

dictionary with inputs.

set_pw_parameters(inputs)[source]#

Set the input parameters for a generic quantumespresso.pw calculation.

Parameters:

inputs – AttributeDict of a PwBaseWorkChain builder input.

get_pseudos() dict[source]#

Return the mapping of pseudos based on the current structure.

Note

this is necessary because during the workchain the kind names of the structure can change, meaning the mapping of the pseudos that is to be passed to the subprocesses also may have to change, since the keys are based on the kind names of the structure.

Returns:

dictionary of pseudos where the keys are the kindnames of self.ctx.current_hubbard_structure.

relabel_hubbard_structure(workchain) None[source]#

Relabel the Hubbard structure if new types have been detected.

run_relax()[source]#

Run the PwRelaxWorkChain to run a relax PwCalculation.

inspect_relax()[source]#

Verify that the PwRelaxWorkChain finished successfully.

run_scf_smearing()[source]#

Run an scf PwBaseWorkChain with smeared occupations.

This step is always needed since we do not a priori whether the material will be metallic or insulating.

run_scf_fixed()[source]#

Run an scf PwBaseWorkChain with fixed occupations on top of the previous calculation.

The nunmber of bands and total magnetization (if magnetic) are set according to those of the previous calculation that was run with smeared occupations.

inspect_scf()[source]#

Verify that the scf PwBaseWorkChain finished successfully.

recon_scf()[source]#

Verify that the scf PwBaseWorkChain finished successfully.

run_hp()[source]#

Run the HpWorkChain restarting from the last completed scf calculation.

inspect_hp()[source]#

Analyze the last completed HpWorkChain.

We check the current Hubbard parameters and compare those with the values computed in the previous iteration. If the difference for all Hubbard sites is smaller than the tolerance(s), the calculation is considered to be converged.

check_convergence()[source]#

Check the convergence of the Hubbard parameters.

run_results()[source]#

Attach the final converged Hubbard U parameters and the corresponding structure.

should_clean_workdir()[source]#

Whether to clean the work directories at each iteration.

clean_iteration()[source]#

Clean all work directiories of the current iteration.