Computing Hubbard parameters self-consistently

Computing Hubbard parameters self-consistently#

In this tutorial you will learn how to compute iteratively the Hubbard parameters through the SelfConsistentHubbardWorkChain.

Hide code cell content

from local_module import load_temp_profile
from aiida_quantumespresso.data.hubbard_structure import HubbardStructureData

# If you download this file, you can run it with your own profile.
# Put these lines instead:
# from aiida import load_profile
# load_profile()
data = load_temp_profile(
    name="hubbard-selfconsistent-tutorial",
    add_computer=True,
    add_pw_code=True,
    add_hp_code=True,
    add_sssp=True,
)

# We initialize only the U, so that `hp.x` will understand it
# needs to compute only the onsite parameters.
a, b, c, d = 1.40803, 0.81293, 4.68453, 1.62585
cell = [[a, -b, c], [0.0, d, c], [-a, -b, c]]
sites = [
    ['Co', 'Co', (0, 0, 0)],
    ['O',   'O', (0, 0, 3.6608)], 
    ['O',   'O', (0, 0, 10.392)], 
    ['Li', 'Li', (0, 0, 7.0268)],
]

hubbard_structure = HubbardStructureData(cell=cell, sites=sites)
hubbard_structure.initialize_onsites_hubbard("Co", "3d")
hubbard_structure.store()
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:46: AiidaDeprecationWarning: The `Code` class is deprecated. To create an instance, use the `aiida.orm.nodes.data.code.installed.InstalledCode` or `aiida.orm.nodes.data.code.portable.PortableCode` for a "remote" or "local" code, respectively. If you are using this class to compare type, e.g. in `isinstance`, use `aiida.orm.nodes.data.code.abstract.AbstractCode`. (this will be removed in v3)
  warn_deprecation(
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:58: AiidaDeprecationWarning: The `Code` plugin is deprecated, use the `InstalledCode` (`core.code.remote`) instead. (this will be removed in v3)
  warn_deprecation(
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:493: AiidaDeprecationWarning: `Code.set_remote_computer_exec` method is deprecated, use `InstalledCode`. (this will be removed in v3)
  warn_deprecation('`Code.set_remote_computer_exec` method is deprecated, use `InstalledCode`.', version=3)
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:406: AiidaDeprecationWarning: `Code.set_input_plugin_name` method is deprecated, use the `default_calc_job_plugin` property instead. (this will be removed in v3)
  warn_deprecation(
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:386: AiidaDeprecationWarning: `Code.set_prepend_text` method is deprecated, use the `prepend_text` property instead. (this will be removed in v3)
  warn_deprecation(
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:565: AiidaDeprecationWarning: `Code.is_local` method is deprecated, use a `PortableCode` instance and check the type. (this will be removed in v3)
  warn_deprecation(
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:523: AiidaDeprecationWarning: `Code.get_remote_computer` method is deprecated, use the `computer` attribute instead. (this will be removed in v3)
  warn_deprecation(
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:513: AiidaDeprecationWarning: `Code.get_remote_exec_path` method is deprecated, use `InstalledCode.filepath_executable` instead. (this will be removed in v3)
  warn_deprecation(
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:46: AiidaDeprecationWarning: The `Code` class is deprecated. To create an instance, use the `aiida.orm.nodes.data.code.installed.InstalledCode` or `aiida.orm.nodes.data.code.portable.PortableCode` for a "remote" or "local" code, respectively. If you are using this class to compare type, e.g. in `isinstance`, use `aiida.orm.nodes.data.code.abstract.AbstractCode`. (this will be removed in v3)
  warn_deprecation(
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:58: AiidaDeprecationWarning: The `Code` plugin is deprecated, use the `InstalledCode` (`core.code.remote`) instead. (this will be removed in v3)
  warn_deprecation(
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:493: AiidaDeprecationWarning: `Code.set_remote_computer_exec` method is deprecated, use `InstalledCode`. (this will be removed in v3)
  warn_deprecation('`Code.set_remote_computer_exec` method is deprecated, use `InstalledCode`.', version=3)
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:406: AiidaDeprecationWarning: `Code.set_input_plugin_name` method is deprecated, use the `default_calc_job_plugin` property instead. (this will be removed in v3)
  warn_deprecation(
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:386: AiidaDeprecationWarning: `Code.set_prepend_text` method is deprecated, use the `prepend_text` property instead. (this will be removed in v3)
  warn_deprecation(
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:565: AiidaDeprecationWarning: `Code.is_local` method is deprecated, use a `PortableCode` instance and check the type. (this will be removed in v3)
  warn_deprecation(
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:523: AiidaDeprecationWarning: `Code.get_remote_computer` method is deprecated, use the `computer` attribute instead. (this will be removed in v3)
  warn_deprecation(
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:513: AiidaDeprecationWarning: `Code.get_remote_exec_path` method is deprecated, use `InstalledCode.filepath_executable` instead. (this will be removed in v3)
  warn_deprecation(
<HubbardStructureData: uuid: 92ee7a92-955a-418f-9bbf-421c5fa9026a (pk: 106)>

The cycle#

To have a full ab-initio calculation of Hubbard parameters, an iterative procedure should be employed. This forsees the following steps, to do in a cyclic way till the parameters don’t differ from the previous ones by a certain threshold, i.e. self-consistently.

The steps to do in order are:

  1. Perform a volume relaxation of the structure, starting from a zero value of Hubbard parameters (i.e. if it was a ‘non-Hubbard’ calculation).

  2. Perform the ground-state calculation (SCF) of the relaxed structure.

  3. Perform the linear response calculation to predict the new Hubbard values.

  4. If all U (and V) are within the desired threshold, stop, otherwise restart with the new values from (1).

Note for SCF (step 2)

Tipically, as these are electronic responses, the gound-state SCF can be performed with looser energy cutoffs and k poit density, and still retain the same accuracy on the prediction of Hubbard parameters.

Important

Before any production run, you should make sure to have converged such parameters.

Note for thresholds

Threshold for U and V may depend on the final goal, or property, of your research. From our experience, good values are of the order of 0.1 eV for the onsite parameters (U) and 0.01 eV for the intersites (V).

Automating the cycle#

As we already learnt from the previous tutorials (1,2), we can simply fill the builder of the work chain using the get_builder_from_protocol to get to know what the workflow is doing, and how this can help and speed up our research.

Warning

In this tutorial we will compute only the U on Co, and not the V for Co-O. This is to speed up the simulation, which on only a handful of cores would take tens of minutes, if not more.

This workflow may take 5 minutes (or more) to complete depending on your local resources.

from aiida.engine import run_get_node
from aiida_hubbard.workflows.hubbard import SelfConsistentHubbardWorkChain

builder = SelfConsistentHubbardWorkChain.get_builder_from_protocol(
    pw_code=data.pw_code, 
    hp_code=data.hp_code, 
    hubbard_structure=hubbard_structure,
    protocol="fast",
    overrides={
        "clean_workdir": False,
        "tolerance_onsite": 0.5,
        "tolerance_intersite": 0.1,
        "relax":{
            "base":{
                "kpoints_distance":100.0,
                "pw":{
                    "parameters":{
                        "SYSTEM":{
                            "ecutwfc": 60.0, # to speed up the tutorial
                            "ecutrho": 60.0 * 8,
                        },
                    },
                },
            }
        }, # to speed up the tutorial
        "scf":{
            "kpoints_distance":100.0, 
            "pw":{
                "parameters":{
                    "SYSTEM":{
                        "ecutwfc": 30.0, # to speed up the tutorial
                        "ecutrho": 30.0 * 8,
                    },
                },
            },
        }, 
        "hubbard":{"qpoints_distance":100.0, "parallelize_atoms":False, "parallelize_qpoints":False}}, # to speed up the tutorial
)

results, node = run_get_node(builder)

Hide code cell output

02/18/2025 09:47:37 AM <48624> aiida.engine.processes.functions: [WARNING] function `structure_relabel_kinds` has invalid type hints: unsupported operand type(s) for |: 'type' and 'NoneType'
02/18/2025 09:47:38 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [130|SelfConsistentHubbardWorkChain|setup]: system is treated to be non-magnetic because `nspin == 1` in `scf.pw.parameters` input.
02/18/2025 09:47:39 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [130|SelfConsistentHubbardWorkChain|run_relax]: launching PwRelaxWorkChain<132> iteration #1
02/18/2025 09:47:39 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [132|PwRelaxWorkChain|run_relax]: launching PwBaseWorkChain<135>
02/18/2025 09:47:39 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [135|PwBaseWorkChain|run_process]: launching PwCalculation<140> iteration #1
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:565: AiidaDeprecationWarning: `Code.is_local` method is deprecated, use a `PortableCode` instance and check the type. (this will be removed in v3)
  warn_deprecation(
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:523: AiidaDeprecationWarning: `Code.get_remote_computer` method is deprecated, use the `computer` attribute instead. (this will be removed in v3)
  warn_deprecation(
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:565: AiidaDeprecationWarning: `Code.is_local` method is deprecated, use a `PortableCode` instance and check the type. (this will be removed in v3)
  warn_deprecation(
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:513: AiidaDeprecationWarning: `Code.get_remote_exec_path` method is deprecated, use `InstalledCode.filepath_executable` instead. (this will be removed in v3)
  warn_deprecation(
02/18/2025 09:48:57 AM <48624> aiida.parser.PwParser: [ERROR] Then ionic minimization cycle converged but the thresholds are exceeded in the final SCF.
02/18/2025 09:48:57 AM <48624> aiida.orm.nodes.process.calculation.calcjob.CalcJobNode: [WARNING] output parser returned exit code<501>: Then ionic minimization cycle converged but the thresholds are exceeded in the final SCF.
02/18/2025 09:48:58 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [135|PwBaseWorkChain|report_error_handled]: PwCalculation<140> failed with exit status 501: Then ionic minimization cycle converged but the thresholds are exceeded in the final SCF.
02/18/2025 09:48:58 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [135|PwBaseWorkChain|report_error_handled]: Action taken: ionic convergence thresholds met except in final scf: consider structure relaxed.
02/18/2025 09:48:58 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [135|PwBaseWorkChain|results]: work chain completed after 1 iterations
02/18/2025 09:48:58 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [135|PwBaseWorkChain|inspect_process]: PwCalculation<140> failed but a handler detected an unrecoverable problem, aborting
02/18/2025 09:48:58 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [135|PwBaseWorkChain|on_terminated]: remote folders will not be cleaned
02/18/2025 09:48:59 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [132|PwRelaxWorkChain|inspect_relax]: after iteration 1 cell volume of relaxed structure is 39.73526676170027
02/18/2025 09:49:00 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [132|PwRelaxWorkChain|run_relax]: launching PwBaseWorkChain<149>
02/18/2025 09:49:00 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [149|PwBaseWorkChain|run_process]: launching PwCalculation<154> iteration #1
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:565: AiidaDeprecationWarning: `Code.is_local` method is deprecated, use a `PortableCode` instance and check the type. (this will be removed in v3)
  warn_deprecation(
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:523: AiidaDeprecationWarning: `Code.get_remote_computer` method is deprecated, use the `computer` attribute instead. (this will be removed in v3)
  warn_deprecation(
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:565: AiidaDeprecationWarning: `Code.is_local` method is deprecated, use a `PortableCode` instance and check the type. (this will be removed in v3)
  warn_deprecation(
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:513: AiidaDeprecationWarning: `Code.get_remote_exec_path` method is deprecated, use `InstalledCode.filepath_executable` instead. (this will be removed in v3)
  warn_deprecation(
02/18/2025 09:49:16 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [149|PwBaseWorkChain|results]: work chain completed after 1 iterations
02/18/2025 09:49:16 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [149|PwBaseWorkChain|on_terminated]: remote folders will not be cleaned
02/18/2025 09:49:17 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [132|PwRelaxWorkChain|inspect_relax]: after iteration 2 cell volume of relaxed structure is 39.70324991346442
02/18/2025 09:49:17 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [132|PwRelaxWorkChain|inspect_relax]: relative cell volume difference 0.0008057539522223223 smaller than threshold 0.05
02/18/2025 09:49:17 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [132|PwRelaxWorkChain|results]: workchain completed after 2 iterations
02/18/2025 09:49:17 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [132|PwRelaxWorkChain|on_terminated]: remote folders will not be cleaned
02/18/2025 09:49:18 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [130|SelfConsistentHubbardWorkChain|run_scf_smearing]: launching PwBaseWorkChain<163> with smeared occupations
02/18/2025 09:49:18 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [163|PwBaseWorkChain|run_process]: launching PwCalculation<168> iteration #1
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:565: AiidaDeprecationWarning: `Code.is_local` method is deprecated, use a `PortableCode` instance and check the type. (this will be removed in v3)
  warn_deprecation(
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:523: AiidaDeprecationWarning: `Code.get_remote_computer` method is deprecated, use the `computer` attribute instead. (this will be removed in v3)
  warn_deprecation(
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:565: AiidaDeprecationWarning: `Code.is_local` method is deprecated, use a `PortableCode` instance and check the type. (this will be removed in v3)
  warn_deprecation(
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:513: AiidaDeprecationWarning: `Code.get_remote_exec_path` method is deprecated, use `InstalledCode.filepath_executable` instead. (this will be removed in v3)
  warn_deprecation(
02/18/2025 09:49:25 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [163|PwBaseWorkChain|results]: work chain completed after 1 iterations
02/18/2025 09:49:25 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [163|PwBaseWorkChain|on_terminated]: remote folders will not be cleaned
02/18/2025 09:49:26 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [130|SelfConsistentHubbardWorkChain|recon_scf]: after relaxation, system is determined to be an insulator
02/18/2025 09:49:26 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [130|SelfConsistentHubbardWorkChain|run_scf_fixed]: launching PwBaseWorkChain<176> with fixed occupations
02/18/2025 09:49:27 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [176|PwBaseWorkChain|run_process]: launching PwCalculation<181> iteration #1
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:565: AiidaDeprecationWarning: `Code.is_local` method is deprecated, use a `PortableCode` instance and check the type. (this will be removed in v3)
  warn_deprecation(
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:523: AiidaDeprecationWarning: `Code.get_remote_computer` method is deprecated, use the `computer` attribute instead. (this will be removed in v3)
  warn_deprecation(
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:565: AiidaDeprecationWarning: `Code.is_local` method is deprecated, use a `PortableCode` instance and check the type. (this will be removed in v3)
  warn_deprecation(
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:513: AiidaDeprecationWarning: `Code.get_remote_exec_path` method is deprecated, use `InstalledCode.filepath_executable` instead. (this will be removed in v3)
  warn_deprecation(
02/18/2025 09:49:35 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [176|PwBaseWorkChain|results]: work chain completed after 1 iterations
02/18/2025 09:49:35 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [176|PwBaseWorkChain|on_terminated]: remote folders will not be cleaned
02/18/2025 09:49:37 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [130|SelfConsistentHubbardWorkChain|run_hp]: launching HpWorkChain<189> iteration #1
02/18/2025 09:49:38 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [189|HpWorkChain|run_base_workchain]: running in serial, launching HpBaseWorkChain<195>
02/18/2025 09:49:38 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [195|HpBaseWorkChain|run_process]: launching HpCalculation<198> iteration #1
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:565: AiidaDeprecationWarning: `Code.is_local` method is deprecated, use a `PortableCode` instance and check the type. (this will be removed in v3)
  warn_deprecation(
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:523: AiidaDeprecationWarning: `Code.get_remote_computer` method is deprecated, use the `computer` attribute instead. (this will be removed in v3)
  warn_deprecation(
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:565: AiidaDeprecationWarning: `Code.is_local` method is deprecated, use a `PortableCode` instance and check the type. (this will be removed in v3)
  warn_deprecation(
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:513: AiidaDeprecationWarning: `Code.get_remote_exec_path` method is deprecated, use `InstalledCode.filepath_executable` instead. (this will be removed in v3)
  warn_deprecation(
02/18/2025 09:49:42 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [195|HpBaseWorkChain|results]: work chain completed after 1 iterations
02/18/2025 09:49:42 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [195|HpBaseWorkChain|on_terminated]: remote folders will not be cleaned
02/18/2025 09:49:42 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [195|HpBaseWorkChain|on_terminated]: remote folders will not be cleaned
02/18/2025 09:49:43 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [189|HpWorkChain|on_terminated]: remote folders will not be cleaned
02/18/2025 09:49:44 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [130|SelfConsistentHubbardWorkChain|check_convergence]: Hubbard onsites parameters are not converged. Max difference is 8.05849999.
02/18/2025 09:49:44 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [130|SelfConsistentHubbardWorkChain|run_relax]: launching PwRelaxWorkChain<207> iteration #2
02/18/2025 09:49:44 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [207|PwRelaxWorkChain|run_relax]: launching PwBaseWorkChain<210>
02/18/2025 09:49:45 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [210|PwBaseWorkChain|run_process]: launching PwCalculation<215> iteration #1
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:565: AiidaDeprecationWarning: `Code.is_local` method is deprecated, use a `PortableCode` instance and check the type. (this will be removed in v3)
  warn_deprecation(
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:523: AiidaDeprecationWarning: `Code.get_remote_computer` method is deprecated, use the `computer` attribute instead. (this will be removed in v3)
  warn_deprecation(
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:565: AiidaDeprecationWarning: `Code.is_local` method is deprecated, use a `PortableCode` instance and check the type. (this will be removed in v3)
  warn_deprecation(
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:513: AiidaDeprecationWarning: `Code.get_remote_exec_path` method is deprecated, use `InstalledCode.filepath_executable` instead. (this will be removed in v3)
  warn_deprecation(
02/18/2025 09:50:22 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [210|PwBaseWorkChain|results]: work chain completed after 1 iterations
02/18/2025 09:50:23 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [210|PwBaseWorkChain|on_terminated]: remote folders will not be cleaned
02/18/2025 09:50:23 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [207|PwRelaxWorkChain|inspect_relax]: after iteration 1 cell volume of relaxed structure is 41.098653115003856
02/18/2025 09:50:24 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [207|PwRelaxWorkChain|run_relax]: launching PwBaseWorkChain<224>
02/18/2025 09:50:24 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [224|PwBaseWorkChain|run_process]: launching PwCalculation<229> iteration #1
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:565: AiidaDeprecationWarning: `Code.is_local` method is deprecated, use a `PortableCode` instance and check the type. (this will be removed in v3)
  warn_deprecation(
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:523: AiidaDeprecationWarning: `Code.get_remote_computer` method is deprecated, use the `computer` attribute instead. (this will be removed in v3)
  warn_deprecation(
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:565: AiidaDeprecationWarning: `Code.is_local` method is deprecated, use a `PortableCode` instance and check the type. (this will be removed in v3)
  warn_deprecation(
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:513: AiidaDeprecationWarning: `Code.get_remote_exec_path` method is deprecated, use `InstalledCode.filepath_executable` instead. (this will be removed in v3)
  warn_deprecation(
02/18/2025 09:50:32 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [224|PwBaseWorkChain|results]: work chain completed after 1 iterations
02/18/2025 09:50:32 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [224|PwBaseWorkChain|on_terminated]: remote folders will not be cleaned
02/18/2025 09:50:32 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [207|PwRelaxWorkChain|inspect_relax]: after iteration 2 cell volume of relaxed structure is 41.09865257522646
02/18/2025 09:50:32 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [207|PwRelaxWorkChain|inspect_relax]: relative cell volume difference 1.3133700381935236e-08 smaller than threshold 0.05
02/18/2025 09:50:32 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [207|PwRelaxWorkChain|results]: workchain completed after 2 iterations
02/18/2025 09:50:32 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [207|PwRelaxWorkChain|on_terminated]: remote folders will not be cleaned
02/18/2025 09:50:33 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [130|SelfConsistentHubbardWorkChain|run_scf_smearing]: launching PwBaseWorkChain<238> with smeared occupations
02/18/2025 09:50:33 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [238|PwBaseWorkChain|run_process]: launching PwCalculation<243> iteration #1
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:565: AiidaDeprecationWarning: `Code.is_local` method is deprecated, use a `PortableCode` instance and check the type. (this will be removed in v3)
  warn_deprecation(
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:523: AiidaDeprecationWarning: `Code.get_remote_computer` method is deprecated, use the `computer` attribute instead. (this will be removed in v3)
  warn_deprecation(
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:565: AiidaDeprecationWarning: `Code.is_local` method is deprecated, use a `PortableCode` instance and check the type. (this will be removed in v3)
  warn_deprecation(
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:513: AiidaDeprecationWarning: `Code.get_remote_exec_path` method is deprecated, use `InstalledCode.filepath_executable` instead. (this will be removed in v3)
  warn_deprecation(
02/18/2025 09:50:37 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [238|PwBaseWorkChain|results]: work chain completed after 1 iterations
02/18/2025 09:50:37 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [238|PwBaseWorkChain|on_terminated]: remote folders will not be cleaned
02/18/2025 09:50:37 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [130|SelfConsistentHubbardWorkChain|recon_scf]: after relaxation, system is determined to be an insulator
02/18/2025 09:50:38 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [130|SelfConsistentHubbardWorkChain|run_scf_fixed]: launching PwBaseWorkChain<251> with fixed occupations
02/18/2025 09:50:38 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [251|PwBaseWorkChain|run_process]: launching PwCalculation<256> iteration #1
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:565: AiidaDeprecationWarning: `Code.is_local` method is deprecated, use a `PortableCode` instance and check the type. (this will be removed in v3)
  warn_deprecation(
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:523: AiidaDeprecationWarning: `Code.get_remote_computer` method is deprecated, use the `computer` attribute instead. (this will be removed in v3)
  warn_deprecation(
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:565: AiidaDeprecationWarning: `Code.is_local` method is deprecated, use a `PortableCode` instance and check the type. (this will be removed in v3)
  warn_deprecation(
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:513: AiidaDeprecationWarning: `Code.get_remote_exec_path` method is deprecated, use `InstalledCode.filepath_executable` instead. (this will be removed in v3)
  warn_deprecation(
02/18/2025 09:50:41 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [251|PwBaseWorkChain|results]: work chain completed after 1 iterations
02/18/2025 09:50:41 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [251|PwBaseWorkChain|on_terminated]: remote folders will not be cleaned
02/18/2025 09:50:42 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [130|SelfConsistentHubbardWorkChain|run_hp]: launching HpWorkChain<264> iteration #2
02/18/2025 09:50:43 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [264|HpWorkChain|run_base_workchain]: running in serial, launching HpBaseWorkChain<270>
02/18/2025 09:50:43 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [270|HpBaseWorkChain|run_process]: launching HpCalculation<273> iteration #1
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:565: AiidaDeprecationWarning: `Code.is_local` method is deprecated, use a `PortableCode` instance and check the type. (this will be removed in v3)
  warn_deprecation(
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:523: AiidaDeprecationWarning: `Code.get_remote_computer` method is deprecated, use the `computer` attribute instead. (this will be removed in v3)
  warn_deprecation(
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:565: AiidaDeprecationWarning: `Code.is_local` method is deprecated, use a `PortableCode` instance and check the type. (this will be removed in v3)
  warn_deprecation(
/opt/conda/lib/python3.9/site-packages/aiida/orm/nodes/data/code/legacy.py:513: AiidaDeprecationWarning: `Code.get_remote_exec_path` method is deprecated, use `InstalledCode.filepath_executable` instead. (this will be removed in v3)
  warn_deprecation(
02/18/2025 09:50:46 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [270|HpBaseWorkChain|results]: work chain completed after 1 iterations
02/18/2025 09:50:46 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [270|HpBaseWorkChain|on_terminated]: remote folders will not be cleaned
02/18/2025 09:50:46 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [270|HpBaseWorkChain|on_terminated]: remote folders will not be cleaned
02/18/2025 09:50:47 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [264|HpWorkChain|on_terminated]: remote folders will not be cleaned
02/18/2025 09:50:47 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [130|SelfConsistentHubbardWorkChain|check_convergence]: Hubbard parameters are converged. Stopping the cycle.
02/18/2025 09:50:48 AM <48624> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [130|SelfConsistentHubbardWorkChain|run_results]: Hubbard parameters self-consistently converged in 2 iterations

Let’s inspect the status of the work chain to see the full self-consistency on screen!

%verdi process status {node.pk}
SelfConsistentHubbardWorkChain<130> Finished [0] [2:run_results]
    ├── PwRelaxWorkChain<132> Finished [0] [3:results]
    │   ├── PwBaseWorkChain<135> Finished [501] [2:while_(should_run_process)(2:inspect_process)]
    │   │   ├── create_kpoints_from_distance<136> Finished [0]
    │   │   └── PwCalculation<140> Finished [501]
    │   └── PwBaseWorkChain<149> Finished [0] [3:results]
    │       ├── create_kpoints_from_distance<150> Finished [0]
    │       └── PwCalculation<154> Finished [0]
    ├── PwBaseWorkChain<163> Finished [0] [3:results]
    │   ├── create_kpoints_from_distance<164> Finished [0]
    │   └── PwCalculation<168> Finished [0]
    ├── PwBaseWorkChain<176> Finished [0] [3:results]
    │   ├── create_kpoints_from_distance<177> Finished [0]
    │   └── PwCalculation<181> Finished [0]
    ├── HpWorkChain<189> Finished [0] [3:results]
    │   ├── create_kpoints_from_distance<191> Finished [0]
    │   └── HpBaseWorkChain<195> Finished [0] [3:results]
    │       └── HpCalculation<198> Finished [0]
    ├── PwRelaxWorkChain<207> Finished [0] [3:results]
    │   ├── PwBaseWorkChain<210> Finished [0] [3:results]
    │   │   ├── create_kpoints_from_distance<211> Finished [0]
    │   │   └── PwCalculation<215> Finished [0]
    │   └── PwBaseWorkChain<224> Finished [0] [3:results]
    │       ├── create_kpoints_from_distance<225> Finished [0]
    │       └── PwCalculation<229> Finished [0]
    ├── PwBaseWorkChain<238> Finished [0] [3:results]
    │   ├── create_kpoints_from_distance<239> Finished [0]
    │   └── PwCalculation<243> Finished [0]
    ├── PwBaseWorkChain<251> Finished [0] [3:results]
    │   ├── create_kpoints_from_distance<252> Finished [0]
    │   └── PwCalculation<256> Finished [0]
    └── HpWorkChain<264> Finished [0] [3:results]
        ├── create_kpoints_from_distance<266> Finished [0]
        └── HpBaseWorkChain<270> Finished [0] [3:results]
            └── HpCalculation<273> Finished [0]

And of course, here you have the final relaxed structure with fully self-consistent ab-initio Hubbard parameters! 🎉

from aiida_quantumespresso.utils.hubbard import HubbardUtils
print(HubbardUtils(results['hubbard_structure']).get_hubbard_card())
HUBBARD	ortho-atomic
 U	Co-3d	7.861

Final considerations#

We managed to compute the Hubbard parameters self-consistently with a series of relaxations, scfs, and hp calculations, all fully automated! 🎉

Learn more and in details

To learn the full sets of inputs, to use proficiently the get_builder_from_protocol and more, have a look at the following sections: