wulfric.get_spglib_types#

wulfric.get_spglib_types(atoms)[source]#

Constructs spglib_types for the given atoms.

Changed in version 0.7.0: Rule 3 modified to account for failed deduction of species from names.

First satisfied rule is applied

  1. "spglib_types" in atoms

    Return atoms["spglib_types"].

  2. "species" in atoms.

    spglib_types are deduced from atoms["species"]. If two atoms have the same species, then they will have the same integer assigned to them in spglib_types.

  3. "names" in atoms.

    Species are automatically deduced based on atom's names (via wulfric.crystal.get_atom_species()). Then the new list is constructed as:

    1. If the deduced species is "X", then the atom's name is used.

    2. If the deduced species is not "X", then the deduced species is used.

    If the two atoms have the same entry in that new list, then they have the same integer assigned to them in spglib_types.

Parameters:
atomsdict

Dictionary with N atoms. At least one of the following keys is expected

  • "names" : (N, ) list of str, optional

  • "species" : (N, ) list of str, optional

  • "spglib_types" : (N, ) list of int, optional

Returns:
spglib_types(N, ) list of int

List of integer indices ready to be passed to spglib.

Raises:
ValueError

If neither "spglib_types" nor "species" nor "names" are present in atoms.