aiida_pseudo.data.pseudo
#
Module with data plugins to represent pseudo potentials.
Submodules#
Package Contents#
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. |
Attributes#
- class aiida_pseudo.data.pseudo.JthXmlData#
Bases:
aiida_pseudo.data.pseudo.pseudo.PseudoPotentialData
Data 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
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 theprepare_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.- Parameters:
source – the source pseudopotential content, either a binary stream, or a
str
orPath
to 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.Path
instance 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.
- 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.
- _key_element = 'element'#
- _key_md5 = 'md5'#
- _CLS_NODE_CACHING#
- 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
str
orPath
to 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.Path
instance 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
stream
appears to be a readable filelike object in binary mode, False otherwise.
- classmethod prepare_source(source: str | pathlib.Path | BinaryIO) BinaryIO #
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.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
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 theprepare_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.- Parameters:
source – the source pseudopotential content, either a binary stream, or a
str
orPath
to 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.Path
instance 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.
- class aiida_pseudo.data.pseudo.PsfData#
Bases:
aiida_pseudo.data.pseudo.pseudo.PseudoPotentialData
Data 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
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 theprepare_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.- Parameters:
source – the source pseudopotential content, either a binary stream, or a
str
orPath
to 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.Path
instance 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.PseudoPotentialData
Data plugin to represent a pseudo potential in PSML format.
- property z_valence: int | None#
Return the Z valence.
- Returns:
the Z valence.
- _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
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 theprepare_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.- Parameters:
source – the source pseudopotential content, either a binary stream, or a
str
orPath
to 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.Path
instance 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.Psp8Data#
Bases:
aiida_pseudo.data.pseudo.pseudo.PseudoPotentialData
Data 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
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 theprepare_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.- Parameters:
source – the source pseudopotential content, either a binary stream, or a
str
orPath
to 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.Path
instance 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.PseudoPotentialData
Data plugin to represent a pseudo potential in UPF format.
- property z_valence: int | None#
Return the Z valence.
- Returns:
the Z valence.
- _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
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 theprepare_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.- Parameters:
source – the source pseudopotential content, either a binary stream, or a
str
orPath
to 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.Path
instance 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.VpsData#
Bases:
aiida_pseudo.data.pseudo.pseudo.PseudoPotentialData
Data plugin to represent a pseudo potential in VPS format.
- 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.
- _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
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 theprepare_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.- Parameters:
source – the source pseudopotential content, either a binary stream, or a
str
orPath
to 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.Path
instance or binary stream.FileNotFoundError – if the source is a filepath but does not exist.
ValueError – if the element symbol is invalid.
- aiida_pseudo.data.pseudo.__all__#