aiida_mlip.data package¶
Submodules¶
aiida_mlip.data.config module¶
Define Model Data type in AiiDA.
- class aiida_mlip.data.config.JanusConfigfile(file: str | Path, filename: str | None = None, **kwargs: Any)[source]¶
Bases:
SinglefileData
Define config file type in AiiDA in yaml.
- Parameters:
- fileUnion[str, Path]
Absolute path to the file.
- filenameOptional[str], optional
Name to be used for the file (defaults to the name of provided file).
- Attributes:
filepath
strReturn the filepath.
Methods
set_file(file, filename=None, architecture=None, **kwargs)
Set the file for the node.
read_yaml()
Reads the config file from yaml format.
store_content(store_all: bool = False, skip: list = None) -> dict:
Converts keys in dictionary to nodes and store them
as_dictionary(self) -> dict
Returns the config file as a dictionary.
- Other Parameters:
- **kwargsAny
Additional keyword arguments.
- __abstractmethods__ = frozenset({})¶
- __annotations__ = {'_CLS_COLLECTION': 'Type[CollectionType]', '__plugin_type_string': 'ClassVar[str]', '__qb_fields__': 'Sequence[QbField]', '__query_type_string': 'ClassVar[str]', '_export_format_replacements': 'Dict[str, str]', '_hash_ignored_attributes': 'Tuple[str, ...]', '_logger': 'Optional[Logger]', '_updatable_attributes': 'Tuple[str, ...]', 'fields': 'QbFields'}¶
- __contains__(key)[source]¶
Check if a key exists in the config file.
- Parameters:
- keystr
Key to check.
- Returns:
- bool
True if the key exists in the config file, False otherwise.
- __init__(file: str | Path, filename: str | None = None, **kwargs: Any) None [source]¶
Initialize the ModelData object.
- Parameters:
- fileUnion[str, Path]
Absolute path to the file.
- filenameOptional[str], optional
Name to be used for the file (defaults to the name of provided file).
- Other Parameters:
- **kwargsAny
Additional keyword arguments.
- __module__ = 'aiida_mlip.data.config'¶
- __parameters__ = ()¶
- _abc_impl = <_abc._abc_data object>¶
- fields: QbFields = {'attributes': 'QbDictField(attributes.*) -> Dict[str, Any]', 'ctime': 'QbNumericField(ctime) -> datetime', 'description': 'QbStrField(description) -> str', 'extras': 'QbDictField(extras.*) -> Dict[str, Any]', 'label': 'QbStrField(label) -> str', 'mtime': 'QbNumericField(mtime) -> datetime', 'node_type': 'QbStrField(node_type) -> str', 'pk': 'QbNumericField(pk) -> int', 'repository_metadata': 'QbDictField(repository_metadata) -> Dict[str, Any]', 'source': 'QbDictField(attributes.source.*) -> Optional[dict]', 'user_pk': 'QbNumericField(user_pk) -> int', 'uuid': 'QbStrField(uuid) -> str'}¶
- read_yaml() dict [source]¶
Convert yaml file to dictionary.
- Returns:
- dict
Returns the converted dictionary with the stored parameters.
- set_file(file: str | Path, filename: str | None = None, **kwargs: Any) None [source]¶
Set the file for the node.
- Parameters:
- fileUnion[str, Path]
Absolute path to the file.
- filenameOptional[str], optional
Name to be used for the file (defaults to the name of provided file).
- Other Parameters:
- **kwargsAny
Additional keyword arguments.
- store_content(store_all: bool = False, skip: list = None) dict [source]¶
Store the content of the config file in the database.
- Parameters:
- store_allbool
Define if you want to store all the parameters or only the main ones.
- skiplist
List of parameters that do not have to be stored.
- Returns:
- dict
Returns the converted dictionary with the stored parameters.
aiida_mlip.data.model module¶
Define Model Data type in AiiDA.
- class aiida_mlip.data.model.ModelData(file: str | Path, architecture: str, filename: str | None = None, **kwargs: Any)[source]¶
Bases:
SinglefileData
Define Model Data type in AiiDA.
- Parameters:
- fileUnion[str, Path]
Absolute path to the file.
- architecturestr
Architecture of the mlip model.
- filenameOptional[str], optional
Name to be used for the file (defaults to the name of provided file).
- Attributes:
architecture
strReturn the architecture.
model_hash
strReturn hash of the architecture.
Methods
set_file(file, filename=None, architecture=None, **kwargs)
Set the file for the node.
from_local(file, architecture, filename=None):
Create a ModelData instance from a local file.
from_uri(uri, architecture, filename=None, cache_dir=None, keep_file=False)
Download a file from a URI and save it as ModelData.
- Other Parameters:
- **kwargsAny
Additional keyword arguments.
- __abstractmethods__ = frozenset({})¶
- __annotations__ = {'_CLS_COLLECTION': 'Type[CollectionType]', '__plugin_type_string': 'ClassVar[str]', '__qb_fields__': 'Sequence[QbField]', '__query_type_string': 'ClassVar[str]', '_export_format_replacements': 'Dict[str, str]', '_hash_ignored_attributes': 'Tuple[str, ...]', '_logger': 'Optional[Logger]', '_updatable_attributes': 'Tuple[str, ...]', 'fields': 'QbFields'}¶
- __init__(file: str | Path, architecture: str, filename: str | None = None, **kwargs: Any) None [source]¶
Initialize the ModelData object.
- Parameters:
- fileUnion[str, Path]
Absolute path to the file.
- architecture[str]
Architecture of the mlip model.
- filenameOptional[str], optional
Name to be used for the file (defaults to the name of provided file).
- Other Parameters:
- **kwargsAny
Additional keyword arguments.
- __module__ = 'aiida_mlip.data.model'¶
- __parameters__ = ()¶
- _abc_impl = <_abc._abc_data object>¶
- static _calculate_hash(file: str | Path) str [source]¶
Calculate the hash of a file.
- Parameters:
- fileUnion[str, Path]
Path to the file for which hash needs to be calculated.
- Returns:
- str
The SHA-256 hash of the file.
- fields: QbFields = {'attributes': 'QbDictField(attributes.*) -> Dict[str, Any]', 'ctime': 'QbNumericField(ctime) -> datetime', 'description': 'QbStrField(description) -> str', 'extras': 'QbDictField(extras.*) -> Dict[str, Any]', 'label': 'QbStrField(label) -> str', 'mtime': 'QbNumericField(mtime) -> datetime', 'node_type': 'QbStrField(node_type) -> str', 'pk': 'QbNumericField(pk) -> int', 'repository_metadata': 'QbDictField(repository_metadata) -> Dict[str, Any]', 'source': 'QbDictField(attributes.source.*) -> Optional[dict]', 'user_pk': 'QbNumericField(user_pk) -> int', 'uuid': 'QbStrField(uuid) -> str'}¶
- classmethod from_local(file: str | Path, architecture: str, filename: str | None = None)[source]¶
Create a ModelData instance from a local file.
- Parameters:
- fileUnion[str, Path]
Path to the file.
- architecture[str]
Architecture of the mlip model.
- filenameOptional[str], optional
Name to be used for the file (defaults to the name of provided file).
- Returns:
- ModelData
A ModelData instance.
- classmethod from_uri(uri: str, architecture: str, filename: str | None = 'tmp_file.model', cache_dir: str | Path | None = None, keep_file: bool | None = False)[source]¶
Download a file from a URI and save it as ModelData.
- Parameters:
- uristr
URI of the file to download.
- architecture[str]
Architecture of the mlip model.
- filenameOptional[str], optional
Name to be used for the file defaults to tmp_file.model.
- cache_dirOptional[Union[str, Path]], optional
Path to the folder where the file has to be saved (defaults to “~/.cache/mlips/”).
- keep_fileOptional[bool], optional
True to keep the downloaded model, even if there are duplicates. (default: False, the file is deleted and only saved in the database).
- Returns:
- ModelData
A ModelData instance.
- set_file(file: str | Path, filename: str | None = None, architecture: str | None = None, **kwargs: Any) None [source]¶
Set the file for the node.
- Parameters:
- fileUnion[str, Path]
Absolute path to the file.
- filenameOptional[str], optional
Name to be used for the file (defaults to the name of provided file).
- architectureOptional[str], optional
Architecture of the mlip model.
- Other Parameters:
- **kwargsAny
Additional keyword arguments.
Module contents¶
Data types for MLIPs calculations.