aiida_pseudo.data.pseudo
========================

.. py:module:: aiida_pseudo.data.pseudo

.. autoapi-nested-parse::

   Module with data plugins to represent pseudo potentials.



Submodules
----------

.. toctree::
   :maxdepth: 1

   /autoapi/aiida_pseudo/data/pseudo/jthxml/index
   /autoapi/aiida_pseudo/data/pseudo/pseudo/index
   /autoapi/aiida_pseudo/data/pseudo/psf/index
   /autoapi/aiida_pseudo/data/pseudo/psml/index
   /autoapi/aiida_pseudo/data/pseudo/psp8/index
   /autoapi/aiida_pseudo/data/pseudo/upf/index
   /autoapi/aiida_pseudo/data/pseudo/vps/index


Attributes
----------

.. autoapisummary::

   aiida_pseudo.data.pseudo.__all__


Classes
-------

.. autoapisummary::

   aiida_pseudo.data.pseudo.JthXmlData
   aiida_pseudo.data.pseudo.PseudoPotentialData
   aiida_pseudo.data.pseudo.PsfData
   aiida_pseudo.data.pseudo.PsmlData
   aiida_pseudo.data.pseudo.Psp8Data
   aiida_pseudo.data.pseudo.UpfData
   aiida_pseudo.data.pseudo.VpsData


Package Contents
----------------

.. py:class:: JthXmlData

   Bases: :py:obj:`aiida_pseudo.data.pseudo.pseudo.PseudoPotentialData`


   Data plugin to represent a pseudo potential in JTH XML format.


   .. py:method:: set_file(source: Union[str, pathlib.Path, BinaryIO], filename: Optional[str] = None, **kwargs)

      Set the file content and parse other optional attributes from the content.

      .. note:: this method will first analyse the type of the ``source`` and if it is a filepath will convert it
          to a binary stream of the content located at that filepath, which is then passed on to the superclass. This
          needs to be done first, because it will properly set the file and filename attributes that are expected by
          other methods. Straight after the superclass call, the source seeker needs to be reset to zero if it needs
          to be read again, because the superclass most likely will have read the stream to the end. Finally it is
          important that the ``prepare_source`` is called here before the superclass invocation, because this way the
          conversion from filepath to byte stream will be performed only once. Otherwise, each subclass would perform
          the conversion over and over again.

      :param source: the source pseudopotential content, either a binary stream, or a ``str`` or ``Path`` to the path
          of the file on disk, which can be relative or absolute.
      :param filename: optional explicit filename to give to the file stored in the repository.
      :raises TypeError: if the source is not a ``str``, ``pathlib.Path`` instance or binary stream.
      :raises FileNotFoundError: if the source is a filepath but does not exist.
      :raises ValueError: if the element symbol is invalid.



.. py:class:: PseudoPotentialData

   Bases: :py:obj:`plugins.DataFactory`\ (\ :py:obj:`'core.singlefile'`\ )


   Base class for data types representing pseudo potentials.


   .. py:attribute:: _key_element
      :value: 'element'



   .. py:attribute:: _key_md5
      :value: 'md5'



   .. py:attribute:: _CLS_NODE_CACHING


   .. py:method:: __repr__() -> str


   .. py:method:: get_description() -> str

      Returns a string that describes the pseudopotential



   .. py:method:: get_or_create(source: Union[str, pathlib.Path, BinaryIO], filename: Optional[str] = None)
      :classmethod:


      Get pseudopotenial data node from database with matching md5 checksum or create a new one if not existent.

      :param source: the source pseudopotential content, either a binary stream, or a ``str`` or ``Path`` to the path
          of the file on disk, which can be relative or absolute.
      :param filename: optional explicit filename to give to the file stored in the repository.
      :return: instance of ``PseudoPotentialData``, stored if taken from database, unstored otherwise.
      :raises TypeError: if the source is not a ``str``, ``pathlib.Path`` instance or binary stream.
      :raises FileNotFoundError: if the source is a filepath but does not exist.



   .. py:method:: get_entry_point_name()
      :classmethod:


      Return the entry point name associated with this data class.

      :return: the entry point name.



   .. py:method:: is_readable_byte_stream(stream) -> bool
      :staticmethod:


      Return whether an object appears to be a readable filelike object in binary mode or stream of bytes.

      :param stream: the object to analyse.
      :returns: True if ``stream`` appears to be a readable filelike object in binary mode, False otherwise.



   .. py:method:: prepare_source(source: Union[str, pathlib.Path, BinaryIO]) -> BinaryIO
      :classmethod:


      Validate the ``source`` representing a file on disk or a byte stream.

      .. note:: if the ``source`` is a valid file on disk, its content is read and returned as a stream of bytes.

      :raises TypeError: if the source is not a ``str``, ``pathlib.Path`` instance or binary stream.
      :raises FileNotFoundError: if the source is a filepath but does not exist.



   .. py:method:: validate_element(element: str)
      :classmethod:


      Validate the given element symbol.

      :param element: the symbol of the element following the IUPAC naming standard.
      :raises ValueError: if the element symbol is invalid.



   .. py:method:: validate_md5(md5: str)

      Validate that the md5 checksum matches that of the currently stored file.

      :param value: the md5 checksum.
      :raises ValueError: if the md5 does not match that of the currently stored file.



   .. py:method:: set_file(source: Union[str, pathlib.Path, BinaryIO], filename: Optional[str] = None, **kwargs)

      Set the file content.

      .. note:: this method will first analyse the type of the ``source`` and if it is a filepath will convert it
          to a binary stream of the content located at that filepath, which is then passed on to the superclass. This
          needs to be done first, because it will properly set the file and filename attributes that are expected by
          other methods. Straight after the superclass call, the source seeker needs to be reset to zero if it needs
          to be read again, because the superclass most likely will have read the stream to the end. Finally it is
          important that the ``prepare_source`` is called here before the superclass invocation, because this way the
          conversion from filepath to byte stream will be performed only once. Otherwise, each subclass would perform
          the conversion over and over again.

      :param source: the source pseudopotential content, either a binary stream, or a ``str`` or ``Path`` to the path
          of the file on disk, which can be relative or absolute.
      :param filename: optional explicit filename to give to the file stored in the repository.
      :raises TypeError: if the source is not a ``str``, ``pathlib.Path`` instance or binary stream.
      :raises FileNotFoundError: if the source is a filepath but does not exist.



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

      Store the node verifying first that all required attributes are set.

      :raises :py:exc:`~aiida.common.StoringNotAllowed`: if no valid element has been defined.



   .. py:property:: element
      :type: Optional[int]


      Return the element symbol.

      :return: the symbol of the element following the IUPAC naming standard or None if not defined.



   .. py:property:: md5
      :type: Optional[int]


      Return the md5.

      :return: the md5 of the stored file.



.. py:class:: PsfData

   Bases: :py:obj:`aiida_pseudo.data.pseudo.pseudo.PseudoPotentialData`


   Data plugin to represent a pseudo potential in PSF format.


   .. py:method:: set_file(source: Union[str, pathlib.Path, BinaryIO], filename: Optional[str] = None, **kwargs)

      Set the file content and parse other optional attributes from the content.

      .. note:: this method will first analyse the type of the ``source`` and if it is a filepath will convert it
          to a binary stream of the content located at that filepath, which is then passed on to the superclass. This
          needs to be done first, because it will properly set the file and filename attributes that are expected by
          other methods. Straight after the superclass call, the source seeker needs to be reset to zero if it needs
          to be read again, because the superclass most likely will have read the stream to the end. Finally it is
          important that the ``prepare_source`` is called here before the superclass invocation, because this way the
          conversion from filepath to byte stream will be performed only once. Otherwise, each subclass would perform
          the conversion over and over again.

      :param source: the source pseudopotential content, either a binary stream, or a ``str`` or ``Path`` to the path
          of the file on disk, which can be relative or absolute.
      :param filename: optional explicit filename to give to the file stored in the repository.
      :raises TypeError: if the source is not a ``str``, ``pathlib.Path`` instance or binary stream.
      :raises FileNotFoundError: if the source is a filepath but does not exist.
      :raises ValueError: if the element symbol is invalid.



.. py:class:: PsmlData

   Bases: :py:obj:`aiida_pseudo.data.pseudo.pseudo.PseudoPotentialData`


   Data plugin to represent a pseudo potential in PSML format.


   .. py:attribute:: _key_z_valence
      :value: 'z_valence'



   .. py:method:: set_file(source: Union[str, pathlib.Path, BinaryIO], filename: Optional[str] = None, **kwargs)

      Set the file content and parse other optional attributes from the content.

      .. note:: this method will first analyse the type of the ``source`` and if it is a filepath will convert it
          to a binary stream of the content located at that filepath, which is then passed on to the superclass. This
          needs to be done first, because it will properly set the file and filename attributes that are expected by
          other methods. Straight after the superclass call, the source seeker needs to be reset to zero if it needs
          to be read again, because the superclass most likely will have read the stream to the end. Finally it is
          important that the ``prepare_source`` is called here before the superclass invocation, because this way the
          conversion from filepath to byte stream will be performed only once. Otherwise, each subclass would perform
          the conversion over and over again.

      :param source: the source pseudopotential content, either a binary stream, or a ``str`` or ``Path`` to the path
          of the file on disk, which can be relative or absolute.
      :param filename: optional explicit filename to give to the file stored in the repository.
      :raises TypeError: if the source is not a ``str``, ``pathlib.Path`` instance or binary stream.
      :raises FileNotFoundError: if the source is a filepath but does not exist.
      :raises ValueError: if the element symbol is invalid.



   .. py:property:: z_valence
      :type: Optional[int]


      Return the Z valence.

      :return: the Z valence.



.. py:class:: Psp8Data

   Bases: :py:obj:`aiida_pseudo.data.pseudo.pseudo.PseudoPotentialData`


   Data plugin to represent a pseudo potential in Psp8 (Abinit) format.


   .. py:method:: set_file(source: Union[str, pathlib.Path, BinaryIO], filename: Optional[str] = None, **kwargs)

      Set the file content and parse other optional attributes from the content.

      .. note:: this method will first analyse the type of the ``source`` and if it is a filepath will convert it
          to a binary stream of the content located at that filepath, which is then passed on to the superclass. This
          needs to be done first, because it will properly set the file and filename attributes that are expected by
          other methods. Straight after the superclass call, the source seeker needs to be reset to zero if it needs
          to be read again, because the superclass most likely will have read the stream to the end. Finally it is
          important that the ``prepare_source`` is called here before the superclass invocation, because this way the
          conversion from filepath to byte stream will be performed only once. Otherwise, each subclass would perform
          the conversion over and over again.

      :param source: the source pseudopotential content, either a binary stream, or a ``str`` or ``Path`` to the path
          of the file on disk, which can be relative or absolute.
      :param filename: optional explicit filename to give to the file stored in the repository.
      :raises TypeError: if the source is not a ``str``, ``pathlib.Path`` instance or binary stream.
      :raises FileNotFoundError: if the source is a filepath but does not exist.
      :raises ValueError: if the element symbol is invalid.



.. py:class:: UpfData

   Bases: :py:obj:`aiida_pseudo.data.pseudo.pseudo.PseudoPotentialData`


   Data plugin to represent a pseudo potential in UPF format.


   .. py:attribute:: _key_z_valence
      :value: 'z_valence'



   .. py:method:: set_file(source: Union[str, pathlib.Path, BinaryIO], filename: Optional[str] = None, **kwargs)

      Set the file content and parse other optional attributes from the content.

      .. note:: this method will first analyse the type of the ``source`` and if it is a filepath will convert it
          to a binary stream of the content located at that filepath, which is then passed on to the superclass. This
          needs to be done first, because it will properly set the file and filename attributes that are expected by
          other methods. Straight after the superclass call, the source seeker needs to be reset to zero if it needs
          to be read again, because the superclass most likely will have read the stream to the end. Finally it is
          important that the ``prepare_source`` is called here before the superclass invocation, because this way the
          conversion from filepath to byte stream will be performed only once. Otherwise, each subclass would perform
          the conversion over and over again.

      :param source: the source pseudopotential content, either a binary stream, or a ``str`` or ``Path`` to the path
          of the file on disk, which can be relative or absolute.
      :param filename: optional explicit filename to give to the file stored in the repository.
      :raises TypeError: if the source is not a ``str``, ``pathlib.Path`` instance or binary stream.
      :raises FileNotFoundError: if the source is a filepath but does not exist.
      :raises ValueError: if the element symbol is invalid.



   .. py:property:: z_valence
      :type: Optional[int]


      Return the Z valence.

      :return: the Z valence.



.. py:class:: VpsData

   Bases: :py:obj:`aiida_pseudo.data.pseudo.pseudo.PseudoPotentialData`


   Data plugin to represent a pseudo potential in VPS format.


   .. py:attribute:: _key_z_valence
      :value: 'z_valence'



   .. py:attribute:: _key_xc_type
      :value: 'xc_type'



   .. py:method:: set_file(source: Union[str, pathlib.Path, BinaryIO], filename: Optional[str] = None, **kwargs)

      Set the file content and parse other optional attributes from the content.

      .. note:: this method will first analyse the type of the ``source`` and if it is a filepath will convert it
          to a binary stream of the content located at that filepath, which is then passed on to the superclass. This
          needs to be done first, because it will properly set the file and filename attributes that are expected by
          other methods. Straight after the superclass call, the source seeker needs to be reset to zero if it needs
          to be read again, because the superclass most likely will have read the stream to the end. Finally it is
          important that the ``prepare_source`` is called here before the superclass invocation, because this way the
          conversion from filepath to byte stream will be performed only once. Otherwise, each subclass would perform
          the conversion over and over again.

      :param source: the source pseudopotential content, either a binary stream, or a ``str`` or ``Path`` to the path
          of the file on disk, which can be relative or absolute.
      :param filename: optional explicit filename to give to the file stored in the repository.
      :raises TypeError: if the source is not a ``str``, ``pathlib.Path`` instance or binary stream.
      :raises FileNotFoundError: if the source is a filepath but does not exist.
      :raises ValueError: if the element symbol is invalid.



   .. py:property:: z_valence
      :type: Optional[int]


      Return the Z valence.

      :return: the Z valence.



   .. py:property:: xc_type
      :type: Optional[int]


      Return the exchange-correlation type.

      :return: the exchange-correlation type.



.. py:data:: __all__

