:py:mod:`aiida_hubbard.parsers.hp`
==================================

.. py:module:: aiida_hubbard.parsers.hp

.. autoapi-nested-parse::

   Parser implementation for the `HpCalculation` plugin.



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

Classes
~~~~~~~

.. autoapisummary::

   aiida_hubbard.parsers.hp.HpParser




.. py:class:: HpParser(node: aiida.orm.CalcJobNode)


   Bases: :py:obj:`aiida.parsers.Parser`

   Parser implementation for the `HpCalculation` plugin.

   .. py:property:: is_initialization_only

      Return whether the calculation was an `initialization_only` run.

      This is the case if the `determin_num_pert_only` flag was set to `True` in the `INPUTHP` namelist.
      In this case, there will only be a stdout file. All other output files will be missing, but that is expected.


   .. py:property:: is_partial_mesh

      Return whether the calculation was a run on a qpoint subset.

      This is the case if the `determine_q_mesh_only` flag was set to `True` in the `INPUTHP` namelist.
      In this case, there will only be a stdout file. All other output files will be missing, but that is expected.


   .. py:property:: is_partial_site

      Return whether the calculation computed just a sub set of all sites to be perturbed.

      A complete run means that all perturbations were calculated and the final matrices were computed.


   .. py:property:: is_complete_calculation

      Return whether the calculation was a complete run.

      A complete run means that all perturbations were performed and the final matrices were computed.


   .. py:method:: parse(**kwargs)

      Parse the contents of the output files retrieved in the `FolderData`.


   .. py:method:: parse_stdout()

      Parse the stdout output file.

      Parse the output parameters from the output of a Hp calculation written to standard out.

      :return: log messages


   .. py:method:: validate_premature_exit(logs)

      Analyze problems that will cause a pre-mature termination of the calculation, controlled or not.


   .. py:method:: parse_hubbard()

      Parse the hubbard output file.

      :return: optional exit code in case of an error


   .. py:method:: parse_hubbard_chi()

      Parse the hubbard chi output file.

      :return: optional exit code in case of an error


   .. py:method:: parse_hubbard_parameters()

      Parse the hubbard parameters output file.

      :return: optional exit code in case of an error


   .. py:method:: parse_hubbard_dat(folder_path)

      Parse the Hubbard parameters output file.

      :return: optional exit code in case of an error


   .. py:method:: get_hubbard_structure()

      Set in output an ``HubbardStructureData`` with standard Hubbard U formulation.


   .. py:method:: parse_chi_content(handle)

      Parse the contents of the file {prefix}.chi.dat as written by a HpCalculation.

      :param filepath: absolute filepath to the chi.dat output file
      :returns: dictionary with parsed contents


   .. py:method:: parse_hubbard_content(handle)

      Parse the contents of the file {prefix}.Hubbard_parameters.dat as written by a HpCalculation.

      :param filepath: absolute filepath to the Hubbard_parameters.dat output file
      :returns: dictionary with parsed contents


   .. py:method:: parse_hubbard_matrix(data)
      :staticmethod:

      Parse one of the matrices that are written to the {prefix}.Hubbard_parameters.dat files.

      Each matrix should be square of size N, which is given by the product of the number of q-points and the number
      of Hubbard species. Each matrix row is printed with a maximum number of 8 elements per line and each line is
      followed by an empty line. In the parsing of the data, we will use the empty line to detect the end of the
      current matrix row.

      :param data: a list of strings representing lines in the Hubbard_parameters.dat file of a certain matrix
      :returns: square numpy matrix of floats representing the parsed matrix



