:py:mod:`aiida_hubbard.workflows.hp.main`
=========================================

.. py:module:: aiida_hubbard.workflows.hp.main

.. autoapi-nested-parse::

   Work chain to run a Quantum ESPRESSO hp.x calculation.



Module Contents
---------------

Classes
~~~~~~~

.. autoapisummary::

   aiida_hubbard.workflows.hp.main.HpWorkChain



Functions
~~~~~~~~~

.. autoapisummary::

   aiida_hubbard.workflows.hp.main.validate_inputs



Attributes
~~~~~~~~~~

.. autoapisummary::

   aiida_hubbard.workflows.hp.main.HpBaseWorkChain
   aiida_hubbard.workflows.hp.main.HpParallelizeAtomsWorkChain


.. py:data:: HpBaseWorkChain

   

.. py:data:: HpParallelizeAtomsWorkChain

   

.. py:function:: validate_inputs(inputs, _)

   Validate the top level namespace.


.. py:class:: HpWorkChain(inputs: dict | None = None, logger: logging.Logger | None = None, runner: aiida.engine.runners.Runner | None = None, enable_persistence: bool = True)


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

   Work chain to run a Quantum ESPRESSO hp.x calculation.

   If the `parallelize_atoms` input is set to `True`, the calculation will be parallelized over the Hubbard atoms by
   running the `HpParallelizeAtomsWorkChain`. When parallelizing over atoms, if the `parallelize_qpoints` is `True`,
   each `HpParallelizeAtomsWorkChain` will be parallelized over its perturbations (q points) running the
   `HpParallelizeQpointsWorkChain`. Otherwise a single `HpBaseWorkChain` will be launched that will compute
   every Hubbard atom, and every q point in serial.

   .. important:: q point parallelization is only possible when parallelization over atoms is performed.

   .. py:method:: define(spec)
      :classmethod:

      Define the process specification.


   .. py:method:: get_protocol_filepath()
      :classmethod:

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


   .. py:method:: get_builder_from_protocol(code, protocol=None, parent_scf_folder=None, overrides=None, options=None, **_)
      :classmethod:

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

      :param code: the ``Code`` instance configured for the ``quantumespresso.hp`` plugin.
      :param protocol: protocol to use, if not specified, the default will be used.
      :param parent_scf_folder: the parent ``RemoteData`` of the respective SCF calcualtion.
      :param overrides: optional dictionary of inputs to override the defaults of the protocol.
      :param 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.
      :return: a process builder instance with all inputs defined ready for launch.


   .. py:method:: validate_qpoints()

      Validate the inputs related to q-points.

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


   .. py:method:: should_parallelize_atoms()

      Return whether the calculation should be parallelized over atoms.


   .. py:method:: run_base_workchain()

      Run the `HpBaseWorkChain`.


   .. py:method:: run_parallel_workchain()

      Run the `HpParallelizeAtomsWorkChain`.


   .. py:method:: inspect_workchain()

      Verify that the child workchain has finished successfully.


   .. py:method:: results()

      Retrieve the results from the completed sub workchain.


   .. py:method:: on_terminated()

      Clean the working directories of all child calculations if `clean_workdir=True` in the inputs.



