ccu.structure.defects

Functions for creating defects within structures.

ccu.structure.defects._convert_occupancies_to_occupants(*, occupancies: list[tuple[str, int]]) list[str][source]

Convert occupancies and counts into a list of chemical symbols.

ccu.structure.defects._convert_symbols(*, structure: Atoms, sites: list[int | str]) list[int][source]

Convert chemical symbols into structure indices.

ccu.structure.defects._filter_for_uniqueness(structures: list[Atoms]) list[Atoms][source]

Filter out duplicate structures.

ccu.structure.defects._validate_occupancies(*, sites: list[int], occupancies: list[tuple[str, int]]) bool[source]

Ensure that occupancies do not exceed sites.

Parameters:
  • sites – The indices of sites to permute.

  • occupancies – A list of 2-tuples, whose first entry indicates the chemical symbol of a dopant and whose second entry indicates the number of sites to fill with that dopant.

Returns:

True if the number of occupanies do not exceed the number sites. False, otherwise.

ccu.structure.defects.permute(*, structure: Atoms, sites: Iterable[int | str] | None = None, occupancies: Iterable[tuple[str, int]] | None = None) list[Atoms][source]

Create permutations of a structure considering a number of sites.

Parameters:
  • structure – an ase.atoms.Atoms object to permutate.

  • sites – an optional list of integers and strings representing the sites to permute. Integers are interpreted as structure indices. Strings are interpreted as all sites of a given element. Defaults to all the indices of the structure.

  • occupancies – an optional list of 2-tuples whose first elements are strings representing chemical symbols and whose second elements are integers indicating the number of sites to fill with the given element. Empty strings can be passed to denote vacancy defects. Defaults to the occupancies of the sites defined in sites.

Example

Permute all atoms in a structure

>>> from ase import Atoms
>>> from ase.build import bulk
>>> from ccu.structure.defects import permute
>>> structure = bulk("NiO", "rocksalt", a=0.352) * (2, 1, 1)
>>> permuted_nios = permute(structure=structure)
>>> len(permuted_nios)
2

Example

Create Ni-M bimetallics

>>> from ase import Atoms
>>> from ase.build import bulk
>>> from ccu.structure.defects import permute
>>> ni = bulk("Ni", "fcc", a=0.352) * (2, 1, 1)
>>> metals = ["Co", "Cr", "Cu", "Fe", "Ti"]
>>> bimetallics = [ni]
>>> for metal in metals:
...     for atom in ni:
...         bimetallics.extend(
...             permute(structure=ni, occupancies=[(metal, atom.index + 1)])
...         )
>>> bimetallics[1].get_chemical_formula()
'CoNi'
>>> len(bimetallics)
11