aiida_mlip.helpers package¶
Submodules¶
aiida_mlip.helpers.converters module¶
Some helpers to convert between different formats.
- aiida_mlip.helpers.converters.convert_numpy(dictionary: dict) dict [source]¶
Convert numpy ndarrays in dictionary into lists.
- Parameters:
- dictionarydict
A dictionary with numpy array values to be converted into lists.
- Returns:
- dict
Converted dictionary.
- aiida_mlip.helpers.converters.convert_to_nodes(dictionary: dict, convert_all: bool = False) dict [source]¶
Convert each key of the config file to a aiida node.
- Parameters:
- dictionarydict
The dictionary obtained from the config file.
- convert_allbool
Define if you want to convert all the parameters or only the main ones.
- Returns:
- dict
Returns the converted dictionary.
- aiida_mlip.helpers.converters.xyz_to_aiida_traj(traj_file: str | Path) tuple[StructureData, TrajectoryData] [source]¶
Convert xyz trajectory file to TrajectoryData data type.
- Parameters:
- traj_fileUnion[str, Path]
The path to the XYZ file.
- Returns:
- Tuple[StructureData, TrajectoryData]
A tuple containing the last structure in the trajectory and a TrajectoryData object containing all structures from the trajectory.
aiida_mlip.helpers.help_load module¶
Helper functions for automatically loading models and strucutres as data nodes.
- aiida_mlip.helpers.help_load.load_model(model: str | Path | None, architecture: str, cache_dir: str | Path | None = None) ModelData [source]¶
Load a model from a file path or URI.
If the string represents a file path, the model will be loaded from that path. If it’s a URI, the model will be downloaded from the specified location. If the input model is None it returns a default model corresponding to the default used in the Calcjobs.
- Parameters:
- modelOptional[Union[str, Path]]
Model file path or a URI for downloading the model or None to use the default.
- architecturestr
The architecture of the model.
- cache_dirOptional[Union[str, Path]]
Directory where to save the dowloaded model.
- Returns:
- ModelData
The loaded model.
- aiida_mlip.helpers.help_load.load_structure(struct: str | Path | int | None = None) StructureData [source]¶
Load a StructureData instance from the given input.
The input can be either a path to a structure file, a node PK (int), or None. If the input is None, a default StructureData instance for NaCl with a rocksalt structure will be created.
- Parameters:
- structOptional[Union[str, Path, int]]
The input value representing either a path to a structure file, a node PK, or None.
- Returns:
- StructureData
The loaded or created StructureData instance.
- Raises:
- click.BadParameter
If the input is not a valid path to a structure file or a node PK.
Module contents¶
Helpers for running calculations.