httk.atomistic.symmetry.primitive

Express a structure in the fixed primitive cell of its standard setting.

The primitive basis is obtained from the IT standard-setting conventional cell with the centring-dependent matrices documented by spglib. The matrices are stated here in their column-vector convention and transposed for httk’s row-vector cell representation.

Classes

PrimitiveCellResult

Store a structure in the fixed primitive cell of its conventional cell.

Functions

primitive_cell(structure, *[, tolerance, ...])

Return structure in the spglib-convention primitive cell.

Module Contents

class httk.atomistic.symmetry.primitive.PrimitiveCellResult

Store a structure in the fixed primitive cell of its conventional cell.

transform is the row-convention matrix actually applied to the conventional basis: basis_primitive = transform * basis_conventional. The matrices are the transposes of spglib’s documented column-vector matrices, where B_p = B_s P_c; fractional row coordinates therefore transform as f_p = f_s * transform.inv() and are wrapped into [0, 1). See the spglib primitive-cell definition.

multiplier is the exact ratio of primitive-cell site count to input site count.

Parameters:
  • structure – The resulting primitive-cell structure.

  • spacegroup – The space group of the standardized input.

  • conventional – The conventional-cell result used as input.

  • transform – The row-convention matrix applied to the conventional basis.

  • multiplier – The exact ratio of result site count to input site count.

structure: httk.atomistic.models.structure.unitcell.UnitcellStructure
spacegroup: httk.atomistic.symmetry.spacegroup.Spacegroup
conventional: httk.atomistic.symmetry.standardization.ConventionalCellResult
transform: httk.core.FracVector
multiplier: fractions.Fraction
httk.atomistic.symmetry.primitive.primitive_cell(structure, *, tolerance=None, limit_denominator=None)

Return structure in the spglib-convention primitive cell.

The input is first recognized or, when it already contains an asymmetric unit, used exactly as stored. Recognition arguments are rejected for an existing ASU. The recognized structure is converted to its IT standard-setting conventional cell by conventional_cell(), then the fixed matrix for its centring type is applied exactly. Site moments are carried through as per-site data: Cartesian and collinear moments are unchanged by the basis recombination, and translation images that collapse onto one primitive site must agree, or the magnetic order needs the larger cell. Assemblies are refused because the centring collapse cannot preserve correlated site groups. This operation does not perform Niggli reduction.

Parameters:
  • structure (httk.atomistic.models.structure.like.StructureLike) – The structure to express in a primitive cell.

  • tolerance (float | None) – The Cartesian recognition tolerance, or None to derive it.

  • limit_denominator (int | None) – The maximum denominator for idealised free parameters, or None to retain their exact stated values.

Returns:

The primitive-cell structure and transform metadata.

Raises:
  • ImportError – If recognition is needed and the optional spglib dependency is unavailable.

  • ValueError – If recognition arguments are invalid for the input, the structure has assemblies or crystal-axis moments, its magnetic order is incompatible with the primitive cell, it is not fully periodic, or it has an unsupported centring type.

Return type:

PrimitiveCellResult