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, max_repetitions=5, return_transform=False, transform=True, tolerance=0.01)[source]

Make the cell of an ASE atoms object orthogonal. This is accomplished by repeating the cell until lattice vectors are close to the three principal Cartesian directions. If the structure is not exactly orthogonal after the structure is repeated by a given maximum the remaining difference will be made up by applying strain.

Parameters
  • atoms (ASE atoms object) – The non-orthogonal atoms object.

  • max_repetitions (int) – The maximum number of repetions allowed. Increase this to allow more repetitions and hence less strain.

  • return_transform (bool) – If true, return the transformations that were applied to make the atoms orthogonal.

  • transform (bool) – If false no transformation is applied to make the cell orthogonal, hence a non-orthogonal cell may be returned.

Returns

  • atoms (ASE atoms object) – The orthogonal atoms.

  • transform (tuple of arrays) – The applied transform in the form the euler angles

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.plane_to_axes(plane)[source]

Internal function for extracting axes from a plane.

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