Structures¶
Module for modifying ASE atoms objects for use in abTEM.
-
abtem.structures.
cut_rectangle
(atoms, origin, extent, margin=0.0)[source]¶ Cuts out a cell starting at the origin to a given extent from a sufficiently repeated copy of atoms.
- Parameters
atoms (ASE atoms object) – This should correspond to a repeatable unit cell.
origin (two float) – Origin of the new cell. Units of Angstrom.
extent (two float) – xy-extent of the new cell. Units of Angstrom.
margin (float) – Atoms within margin from the border of the new cell will be included. Units of Angstrom. Default is 0.
- Returns
- Return type
ASE atoms object
-
abtem.structures.
is_cell_hexagonal
(atoms)[source]¶ Function to check whether the cell of an ASE atoms object is hexagonal.
- Parameters
atoms (ASE atoms object) – The atoms that should be checked.
-
abtem.structures.
is_cell_orthogonal
(atoms, tol=1e-12)[source]¶ Check whether an Atoms object has an orthogonal cell.
- Parameters
atoms (ASE atoms object) – The atoms that should be checked.
tol (float) – Components of the lattice vectors below this value are considered to be zero.
-
abtem.structures.
is_cell_valid
(atoms, tol=1e-12)[source]¶ Check whether the cell of an ASE atoms object can be converted to a structure that is usable by abTEM.
- Parameters
atoms (ASE atoms object) – The atoms that should be checked.
tol (float) – Components of the lattice vectors below this value are considered to be zero.
- Returns
If true, the atomic structure is usable by abTEM.
- Return type
bool
-
abtem.structures.
orthogonalize_cell
(atoms, limit_denominator=10, return_strain=False)[source]¶ Make the cell of an ASE atoms object orthogonal. This is accomplished by repeating the cell until the x-component of the lattice vectors in the xy-plane closely matches. If the ratio between the x-components is irrational this may not be possible without introducing some strain. However, the amount of strain can be made arbitrarily small by using many repetitions.
- Parameters
atoms (ASE atoms object) – The non-orthogonal atoms object.
limit_denominator (int) – The maximum denominator in the rational approximation. Increase this to allow more repetitions and hence less strain.
return_strain (bool) – If true, return the strain tensor that were applied to make the atoms orthogonal.
- Returns
atoms (ASE atoms object) – The orthogonal atoms.
strain_tensor (2x2 array) – The applied strain tensor. Only provided if return_strain is true.
-
abtem.structures.
pad_atoms
(atoms, margin, directions='xy', in_place=False)[source]¶ Repeat the atoms in x and y, retaining only the repeated atoms within the margin distance from the cell boundary.
- Parameters
atoms (ASE Atoms object) – The atoms that should be padded.
margin (float) – The padding margin.
- Returns
Padded atoms.
- Return type
ASE Atoms object
-
abtem.structures.
standardize_cell
(atoms, tol=1e-12)[source]¶ Standardize the cell of an ASE atoms object. The atoms are rotated so one of the lattice vectors in the xy-plane aligns with the x-axis, then all of the lattice vectors are made positive.
- Parameters
atoms (ASE atoms object) – The atoms that should be standardized
tol (float) – Components of the lattice vectors below this value are considered to be zero.
- Returns
atoms – The standardized atoms.
- Return type
ASE atoms object