spglib.cell module

spglib.cell module#

Cell operations and standardizations.

spglib.cell.find_primitive(cell, symprec=1e-05, angle_tolerance=-1.0)[source]#

Primitive cell is searched in the input cell. If it fails, None is returned.

The primitive cell is returned by a tuple of (lattice, positions, numbers).

Return type:

tuple[Sequence[Sequence[float]], Sequence[Sequence[float]], Sequence[int]] | None

Notes#

Changed in version 1.8.

The detailed control of standardization of unit cell can be done using standardize_cell().

spglib.cell.refine_cell(cell, symprec=1e-05, angle_tolerance=-1.0)[source]#

Return refined cell. When the search failed, None is returned.

The standardized unit cell is returned by a tuple of (lattice, positions, numbers).

Return type:

tuple[Sequence[Sequence[float]], Sequence[Sequence[float]], Sequence[int]] | None

Notes#

Changed in version 1.8.

The detailed control of standardization of unit cell can be done using standardize_cell().

spglib.cell.standardize_cell(cell, to_primitive=False, no_idealize=False, symprec=1e-05, angle_tolerance=-1.0)[source]#

Return standardized cell. When the search failed, None is returned.

Return type:

tuple[Sequence[Sequence[float]], Sequence[Sequence[float]], Sequence[int]] | None

Parameters#

cell, symprec, angle_tolerance:

See the docstring of get_symmetry.

to_primitivebool

If True, the standardized primitive cell is created.

no_idealizebool

If True, it is disabled to idealize lengths and angles of basis vectors and positions of atoms according to crystal symmetry.

Returns#

The standardized unit cell or primitive cell is returned by a tuple of (lattice, positions, numbers). If it fails, None is returned.

Notes#

Added in version 1.8.

Now refine_cell() and find_primitive() are shorthands of this method with combinations of these options. About the default choice of the setting, see the documentation of hall_number argument of get_symmetry_dataset(). More detailed explanation is shown in the spglib (C-API) document.