atomlib.mixins
AtomsIOMixin
Bases: _HasAtoms
, ABC
Mix-in to add IO methods to HasAtoms
.
All concrete subclasses of HasAtoms
should also subclass this.
Source code in atomlib/mixins.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
|
read
classmethod
read(path: FileOrPath, ty: FileType) -> HasAtomsT
read(
path: FileOrPath, ty: Optional[FileType] = None
) -> HasAtomsT
Read a structure from a file.
Supported types can be found in the io module.
If no ty
is specified, it is inferred from the file's extension.
Source code in atomlib/mixins.py
read_cif
classmethod
read_cif(
f: Union[FileOrPath, CIF, CIFDataBlock],
block: Union[int, str, None] = None,
) -> HasAtomsT
Read a structure from a CIF file.
If block
is specified, read data from the given block of the CIF file (index or name).
Source code in atomlib/mixins.py
read_xyz
classmethod
read_xyz(f: Union[FileOrPath, XYZ]) -> HasAtomsT
read_xsf
classmethod
read_xsf(f: Union[FileOrPath, XSF]) -> HasAtomsT
read_cfg
classmethod
read_cfg(f: Union[FileOrPath, CFG]) -> HasAtomsT
read_lmp
classmethod
read_lmp(
f: Union[FileOrPath, LMP],
type_map: Optional[Dict[int, Union[str, int]]] = None,
) -> HasAtomsT
Read a structure from a LAAMPS data file.
Source code in atomlib/mixins.py
write_cif
write_cif(f: FileOrPath)
write_xyz
write_xyz(f: FileOrPath, fmt: XYZFormat = 'exyz')
write_xsf
write_xsf(f: FileOrPath)
write_cfg
write_cfg(f: FileOrPath)
write_lmp
write_lmp(f: FileOrPath)
write
write(path: FileOrPath, ty: FileType)
write(path: FileOrPath, ty: Optional[FileType] = None)
Write this structure to a file.
A file type may be specified using ty
.
If no ty
is specified, it is inferred from the path's extension.
Source code in atomlib/mixins.py
AtomCellIOMixin
Bases: _HasAtomCell
, AtomsIOMixin
Mix-in to add IO methods to HasAtomCell
.
All concrete subclasses of HasAtomCell
should also subclass this.
Source code in atomlib/mixins.py
read
classmethod
read(path: FileOrPath, ty: FileType) -> HasAtomsT
read(
path: FileOrPath, ty: Optional[FileType] = None
) -> HasAtomsT
Read a structure from a file.
Supported types can be found in the io module.
If no ty
is specified, it is inferred from the file's extension.
Source code in atomlib/mixins.py
read_cif
classmethod
read_cif(
f: Union[FileOrPath, CIF, CIFDataBlock],
block: Union[int, str, None] = None,
) -> HasAtomsT
Read a structure from a CIF file.
If block
is specified, read data from the given block of the CIF file (index or name).
Source code in atomlib/mixins.py
read_xyz
classmethod
read_xyz(f: Union[FileOrPath, XYZ]) -> HasAtomsT
read_xsf
classmethod
read_xsf(f: Union[FileOrPath, XSF]) -> HasAtomsT
read_cfg
classmethod
read_cfg(f: Union[FileOrPath, CFG]) -> HasAtomsT
read_lmp
classmethod
read_lmp(
f: Union[FileOrPath, LMP],
type_map: Optional[Dict[int, Union[str, int]]] = None,
) -> HasAtomsT
Read a structure from a LAAMPS data file.
Source code in atomlib/mixins.py
write_cif
write_cif(f: FileOrPath)
write_xyz
write_xyz(f: FileOrPath, fmt: XYZFormat = 'exyz')
write_xsf
write_xsf(f: FileOrPath)
write_cfg
write_cfg(f: FileOrPath)
write_lmp
write_lmp(f: FileOrPath)
write
write(path: FileOrPath, ty: FileType)
write(path: FileOrPath, ty: Optional[FileType] = None)
Write this structure to a file.
A file type may be specified using ty
.
If no ty
is specified, it is inferred from the path's extension.
Source code in atomlib/mixins.py
write_mslice
write_mslice(
f: BinaryFileOrPath,
template: Optional[MSliceFile] = None,
*,
slice_thickness: Optional[float] = None,
scan_points: Optional[ArrayLike] = None,
scan_extent: Optional[ArrayLike] = None,
noise_sigma: Optional[float] = None,
conv_angle: Optional[float] = None,
energy: Optional[float] = None,
defocus: Optional[float] = None,
tilt: Optional[Tuple[float, float]] = None,
tds: Optional[bool] = None,
n_cells: Optional[ArrayLike] = None
)
Write a structure to an mslice file.
template
may be a file, path, or ElementTree
containing an existing mslice file.
Its structure will be modified to make the final output. If not specified, a default
template will be used.
Additional options modify simulation properties. If an option is not specified, the template's properties are used.
Source code in atomlib/mixins.py
write_qe
write_qe(
f: FileOrPath,
pseudo: Optional[Mapping[str, str]] = None,
)
Write a structure to a Quantum Espresso pw.x file.
PARAMETER | DESCRIPTION |
---|---|
f
|
File or path to write to
TYPE:
|
pseudo
|
Mapping from atom symbol |