Utility functions

 On this page

Utility functions#

A module containing utility functions for internal use that are not related to Models specifically.

unique_vacancies

Returns a list of unique random lattice sites to be removed in the model using the method add_vacancies().

strawberrypy.utils.unique_vacancies(num, Lx, Ly, basis, atom_type=None, same_number=False, seed=None)[source]#

Returns a list of unique random lattice sites to be removed in the model using the method add_vacancies().

Parameters:
  • num (int) – Number of lattice positions to generate.

  • Lx (int) – Number of unit cells of the model along the \(\mathbf{a}_1\) direction.

  • Ly (int) – Number of unit cells of the model along the \(\mathbf{a}_2\) direction.

  • basis (int) – Number of atoms per unit cell.

  • atom_type (int | None) – Index of the atom to be removed.

  • same_number (bool) – If True, the same number of each type of atom is removed.

  • seed (int | None) – Seed for the random number generation. Default is None.

Returns:

unique_list – List of unique random lattice site.

Return type:

list