aiida_pseudo.data.pseudo#
Module with data plugins to represent pseudo potentials.
Submodules#
Attributes#
Classes#
Data plugin to represent a pseudo potential in JTH XML format. |
|
Base class for data types representing pseudo potentials. |
|
Data plugin to represent a pseudo potential in PSF format. |
|
Data plugin to represent a pseudo potential in PSML format. |
|
Data plugin to represent a pseudo potential in Psp8 (Abinit) format. |
|
Data plugin to represent a pseudo potential in UPF format. |
|
Data plugin to represent a pseudo potential in VPS format. |
Package Contents#
- class aiida_pseudo.data.pseudo.JthXmlData#
Bases:
aiida_pseudo.data.pseudo.pseudo.PseudoPotentialDataData plugin to represent a pseudo potential in JTH XML format.
- set_file(source: str | pathlib.Path | BinaryIO, filename: str | None = None, **kwargs)#
Set the file content and parse other optional attributes from the content.
Note
this method will first analyse the type of the
sourceand 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 theprepare_sourceis 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.- Parameters:
source – the source pseudopotential content, either a binary stream, or a
strorPathto the path of the file on disk, which can be relative or absolute.filename – optional explicit filename to give to the file stored in the repository.
- Raises:
TypeError – if the source is not a
str,pathlib.Pathinstance or binary stream.FileNotFoundError – if the source is a filepath but does not exist.
ValueError – if the element symbol is invalid.
- class aiida_pseudo.data.pseudo.PseudoPotentialData#
Bases:
plugins.DataFactory('core.singlefile')Base class for data types representing pseudo potentials.
- _key_element = 'element'#
- _key_md5 = 'md5'#
- _CLS_NODE_CACHING#
- __repr__() str#
- get_description() str#
Returns a string that describes the pseudopotential
- classmethod get_or_create(source: str | pathlib.Path | BinaryIO, filename: str | None = None)#
Get pseudopotenial data node from database with matching md5 checksum or create a new one if not existent.
- Parameters:
source – the source pseudopotential content, either a binary stream, or a
strorPathto the path of the file on disk, which can be relative or absolute.filename – optional explicit filename to give to the file stored in the repository.
- Returns:
instance of
PseudoPotentialData, stored if taken from database, unstored otherwise.- Raises:
TypeError – if the source is not a
str,pathlib.Pathinstance or binary stream.FileNotFoundError – if the source is a filepath but does not exist.
- classmethod get_entry_point_name()#
Return the entry point name associated with this data class.
- Returns:
the entry point name.
- static is_readable_byte_stream(stream) bool#
Return whether an object appears to be a readable filelike object in binary mode or stream of bytes.
- Parameters:
stream – the object to analyse.
- Returns:
True if
streamappears to be a readable filelike object in binary mode, False otherwise.
- classmethod prepare_source(source: str | pathlib.Path | BinaryIO) BinaryIO#
Validate the
sourcerepresenting a file on disk or a byte stream.Note
if the
sourceis 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.Pathinstance or binary stream.FileNotFoundError – if the source is a filepath but does not exist.
- classmethod validate_element(element: str)#
Validate the given element symbol.
- Parameters:
element – the symbol of the element following the IUPAC naming standard.
- Raises:
ValueError – if the element symbol is invalid.
- validate_md5(md5: str)#
Validate that the md5 checksum matches that of the currently stored file.
- Parameters:
value – the md5 checksum.
- Raises:
ValueError – if the md5 does not match that of the currently stored file.
- set_file(source: str | pathlib.Path | BinaryIO, filename: str | None = None, **kwargs)#
Set the file content.
Note
this method will first analyse the type of the
sourceand 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 theprepare_sourceis 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.- Parameters:
source – the source pseudopotential content, either a binary stream, or a
strorPathto the path of the file on disk, which can be relative or absolute.filename – optional explicit filename to give to the file stored in the repository.
- Raises:
TypeError – if the source is not a
str,pathlib.Pathinstance or binary stream.FileNotFoundError – if the source is a filepath but does not exist.
- store(**kwargs)#
Store the node verifying first that all required attributes are set.
:raises
StoringNotAllowed: if no valid element has been defined.
- property element: int | None#
Return the element symbol.
- Returns:
the symbol of the element following the IUPAC naming standard or None if not defined.
- property md5: int | None#
Return the md5.
- Returns:
the md5 of the stored file.
- class aiida_pseudo.data.pseudo.PsfData#
Bases:
aiida_pseudo.data.pseudo.pseudo.PseudoPotentialDataData plugin to represent a pseudo potential in PSF format.
- set_file(source: str | pathlib.Path | BinaryIO, filename: str | None = None, **kwargs)#
Set the file content and parse other optional attributes from the content.
Note
this method will first analyse the type of the
sourceand 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 theprepare_sourceis 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.- Parameters:
source – the source pseudopotential content, either a binary stream, or a
strorPathto the path of the file on disk, which can be relative or absolute.filename – optional explicit filename to give to the file stored in the repository.
- Raises:
TypeError – if the source is not a
str,pathlib.Pathinstance or binary stream.FileNotFoundError – if the source is a filepath but does not exist.
ValueError – if the element symbol is invalid.
- class aiida_pseudo.data.pseudo.PsmlData#
Bases:
aiida_pseudo.data.pseudo.pseudo.PseudoPotentialDataData plugin to represent a pseudo potential in PSML format.
- _key_z_valence = 'z_valence'#
- set_file(source: str | pathlib.Path | BinaryIO, filename: str | None = None, **kwargs)#
Set the file content and parse other optional attributes from the content.
Note
this method will first analyse the type of the
sourceand 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 theprepare_sourceis 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.- Parameters:
source – the source pseudopotential content, either a binary stream, or a
strorPathto the path of the file on disk, which can be relative or absolute.filename – optional explicit filename to give to the file stored in the repository.
- Raises:
TypeError – if the source is not a
str,pathlib.Pathinstance or binary stream.FileNotFoundError – if the source is a filepath but does not exist.
ValueError – if the element symbol is invalid.
- property z_valence: int | None#
Return the Z valence.
- Returns:
the Z valence.
- class aiida_pseudo.data.pseudo.Psp8Data#
Bases:
aiida_pseudo.data.pseudo.pseudo.PseudoPotentialDataData plugin to represent a pseudo potential in Psp8 (Abinit) format.
- set_file(source: str | pathlib.Path | BinaryIO, filename: str | None = None, **kwargs)#
Set the file content and parse other optional attributes from the content.
Note
this method will first analyse the type of the
sourceand 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 theprepare_sourceis 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.- Parameters:
source – the source pseudopotential content, either a binary stream, or a
strorPathto the path of the file on disk, which can be relative or absolute.filename – optional explicit filename to give to the file stored in the repository.
- Raises:
TypeError – if the source is not a
str,pathlib.Pathinstance or binary stream.FileNotFoundError – if the source is a filepath but does not exist.
ValueError – if the element symbol is invalid.
- class aiida_pseudo.data.pseudo.UpfData#
Bases:
aiida_pseudo.data.pseudo.pseudo.PseudoPotentialDataData plugin to represent a pseudo potential in UPF format.
- _key_z_valence = 'z_valence'#
- set_file(source: str | pathlib.Path | BinaryIO, filename: str | None = None, **kwargs)#
Set the file content and parse other optional attributes from the content.
Note
this method will first analyse the type of the
sourceand 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 theprepare_sourceis 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.- Parameters:
source – the source pseudopotential content, either a binary stream, or a
strorPathto the path of the file on disk, which can be relative or absolute.filename – optional explicit filename to give to the file stored in the repository.
- Raises:
TypeError – if the source is not a
str,pathlib.Pathinstance or binary stream.FileNotFoundError – if the source is a filepath but does not exist.
ValueError – if the element symbol is invalid.
- property z_valence: int | None#
Return the Z valence.
- Returns:
the Z valence.
- class aiida_pseudo.data.pseudo.VpsData#
Bases:
aiida_pseudo.data.pseudo.pseudo.PseudoPotentialDataData plugin to represent a pseudo potential in VPS format.
- _key_z_valence = 'z_valence'#
- _key_xc_type = 'xc_type'#
- set_file(source: str | pathlib.Path | BinaryIO, filename: str | None = None, **kwargs)#
Set the file content and parse other optional attributes from the content.
Note
this method will first analyse the type of the
sourceand 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 theprepare_sourceis 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.- Parameters:
source – the source pseudopotential content, either a binary stream, or a
strorPathto the path of the file on disk, which can be relative or absolute.filename – optional explicit filename to give to the file stored in the repository.
- Raises:
TypeError – if the source is not a
str,pathlib.Pathinstance or binary stream.FileNotFoundError – if the source is a filepath but does not exist.
ValueError – if the element symbol is invalid.
- property z_valence: int | None#
Return the Z valence.
- Returns:
the Z valence.
- property xc_type: int | None#
Return the exchange-correlation type.
- Returns:
the exchange-correlation type.
- aiida_pseudo.data.pseudo.__all__#