wulfric.get_spglib_data#

wulfric.get_spglib_data(cell, atoms, spglib_symprec=1e-05, spglib_angle_tolerance=-1)[source]#

Interface to spglib.

The idea is that this is the only way to access the data from spglib. In that way one can associate a dataset with a given cell and atoms and re-use it when necessary.

Parameters:
cell(3, 3) array-like

Matrix of a cell, rows are interpreted as vectors. In the language of spglib the same concept is usually called "basis vectors" or "lattice".

atomsdict

Dictionary with N atoms. Expected keys:

  • "positions" : (N, 3) array-like Positions of the atoms in the basis of lattice vectors (cell). In other words - relative coordinates of atoms.

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

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

  • "spglib_types" (N, ) list of int, optional See Notes

Hint

Pass atoms = dict(positions=[[0, 0, 0]], spglib_types=[1]) if you would like to interpret the cell alone (effectively assuming that the cell is a primitive one).

spglib_symprecfloat, default \(10^{-5}\)

Directly passed to spglib. Tolerance parameter for the symmetry search.

spglib_angle_tolerancefloat, default -1

Directly passed to spglib. Tolerance parameter for the symmetry search.

Returns:
spglib_datadict

A dictionary with the added syntactic sugar (i.e. with the dot access to the keys).

Data that are included:

  • spglib_data.original_cell

    Same as the given cell

  • spglib_data.original_positions

    Same as the given atoms["positions"]

  • spglib_data.original_types

    Same as wulfric.get_spglib_types(atoms=atoms) for given atoms.

  • spglib_data.space_group_number

    Number of the space group. 1 <= spglib_data.space_group_number <= 230.

  • spglib_data.crystal_family

    Crystal family.

    • "c" for cubic

    • "h" for hexagonal

    • "t" for tetragonal

    • "o" for orhorhombic

    • "m" for monoclinic

    • "a" for triclinic

  • spglib_data.centring_type

    Centring type.

    • "P" for primitive

    • "A" for side centered

    • "C" for side centered

    • "I" for body-centered

    • "R" for rhombohedral centring

    • "F" for all faces centered

  • spglib_data.conventional_cell

    Conventional cell associated with the given structure in the same spatial orientation. In other words, it is a choice of the cell for the same crystal. It can contain more than one lattice point. Same as std_lattice of spglib dataset but rotated back with the std_rotation_matrix of spglib dataset.

  • spglib_data.conventional_positions

    N relative positions of the atoms in the basis of spglib_data.conventional_cell. Same as std_positions of spglib dataset.

  • spglib_data.conventional_types

    N types of the atoms. Same as std_types of spglib dataset.

  • spglib_data.primitive_cell

    Primitive cell associated with the given structure in the same spatial orientation. In other words, it is a choice of the cell for the same crystal. It contains exactly one lattice point. Same as primitive_lattice returned by spglib.find_primitive(), but rotated back with the std_rotation_matrix of spglib dataset.

  • spglib_data.primitive_positions

    M relative positions of the atoms in the basis of spglib_data.primitive_cell. Same as primitive_positions returned by spglib.find_primitive().

  • spglib_data.primitive_types

    M types of the atoms. Same as primitive_types returned by spglib.find_primitive().

  • spglib_data.symprec angle_tolerance

    Tolerance parameter that was used to call spglib.

  • spglib_data.angle_tolerance

    Tolerance parameter that was used to call spglib.

Raises:
ValueError

If some input data are not what is expected.

TypeError

If some input data are not what is expected.

RuntimeError

If spglib fail to detect symmetry.

Notes

spglib uses types to distinguish the atoms. To see how wulfric deduces types from given atoms see wulfric.get_spglib_types().