File IO#
MOTEP has parsers for the file formats of the MLIP codes developed by Shapeev and co-workers.
.cfg: Atomic configurations.mtp: MTP parameters
.cfg#
Module for MTP formats.
- motep.io.mlip.cfg.read_cfg(fd: TextIO, index: int = -1, species: list[int] | list[str] | None = None) Atoms | list[Atoms]#
Read images from a MTP .cfg file.
- Parameters:
fd (TextIO) – TextIO object.
index (int) – Index of images.
species (list[int] | list[str], optional) – List defining types of chemical symbols. For example, [46, 1] and [‘Pd’, ‘H’] assign Pd for type 0 and H for type 1. If None, dummy symbols ‘X’, ‘H’, ‘He’, etc. are assigned for types 0, 1, 2, etc.
- Return type:
Atoms | list[Atoms]
- motep.io.mlip.cfg.write_cfg(fd: TextIO, images: Atoms | list[Atoms], species: list[int] | list[str] | None = None, key_energy: str | None = None) None#
Write images into the MTP .cfg format.
- Parameters:
fd (TextIO) – TextIO object.
images (Atoms | list[Atoms]) – _description_
species (list[int] | list[str], optional) – List that defines types of chemical symbols (e.g, [‘Pd’, ‘H’] means Pd is type 0 and H type 1), by default None. If None, this list is built by assigning each distinct species to an integer in the order of appearance in
images.key_energy (str | None, default: None) – Key for the energy (either “free_energy” or “energy”) to be printed. If
None, “free_energy” is first considered, followed by “energy”.
.mtp#
Parsers of MLIP .mtp files.
- motep.io.mlip.mtp.read_mmtp(file: PathLike) MTPData | MagMTPData#
Read an MLIP .mtp file with magnetic basis.
- motep.io.mlip.mtp.read_mtp(file: PathLike) MTPData | MagMTPData#
Read an MLIP .mtp file, returning MagMTPData if a magnetic basis is present.
- motep.io.mlip.mtp.write_mmtp(file: PathLike, data: MagMTPData) None#
Write an MLIP .mtp file with magnetic basis.
Deprecated since version Use:
write_mtp()instead.
- motep.io.mlip.mtp.write_mtp(file: PathLike, data: MTPData | MagMTPData, *, legacy: bool = True) None#
Write an MLIP .mtp file.
- Parameters:
legacy (bool) – If True, write non-magnetic files using the old flat keyword format (
min_dist,max_dist,radial_basis_size) instead of the groupedmin/max/sizesection. Ignored for magnetic data.