httk.atomistic.reduction

Exact Niggli reduction of three-dimensional periodic cells and structures.

Classes

NiggliReductionResult

Store a cell in exact Niggli-reduced form.

NiggliReducedStructureResult

Store a structure whose cell and fractional coordinates are in Niggli form.

Functions

niggli_reduce(cell)

Return the exact Niggli reduction of a fully periodic cell.

is_niggli_reduced(cell)

Return whether a fully periodic cell satisfies the complete exact Niggli conditions.

niggli_reduced(structure)

Return a structure remapped into the exact Niggli-reduced cell.

Module Contents

class httk.atomistic.reduction.NiggliReductionResult[source]

Store a cell in exact Niggli-reduced form.

transform uses the row-vector convention basis_reduced = transform * basis. Its entries are integers and its determinant is +1. parameters contains the reduced (A, B, C, xi, eta, zeta) metric parameters as exact fractions.

Parameters:
  • cell – The reduced cell.

  • transform – The integer row-convention transform from the source basis.

  • parameters – The reduced exact metric parameters.

cell: httk.atomistic.models.cell.cell.Cell[source]
transform: httk.core.FracVector[source]
parameters: tuple[fractions.Fraction, Ellipsis][source]
class httk.atomistic.reduction.NiggliReducedStructureResult[source]

Store a structure whose cell and fractional coordinates are in Niggli form.

transform uses the row-vector convention basis_reduced = transform * basis; site coordinates are remapped by its exact inverse and wrapped into [0, 1).

Parameters:
  • structure – The structure expressed in the reduced cell.

  • cell – The reduced cell.

  • transform – The integer row-convention transform from the source basis.

structure: httk.atomistic.models.structure.unitcell.UnitcellStructure[source]
cell: httk.atomistic.models.cell.cell.Cell[source]
transform: httk.core.FracVector[source]
httk.atomistic.reduction.niggli_reduce(cell)[source]

Return the exact Niggli reduction of a fully periodic cell.

The calculation uses the rational Gram matrix with no tolerance. The returned integer transform follows basis_reduced = transform * basis and has determinant +1.

Parameters:

cell (httk.atomistic.models.cell.like.CellLike) – The fully periodic cell to reduce.

Returns:

The reduced cell, transform, and exact metric parameters.

Raises:

ValueError – If the cell is not fully periodic or its Gram matrix is not rational.

Return type:

NiggliReductionResult

httk.atomistic.reduction.is_niggli_reduced(cell)[source]

Return whether a fully periodic cell satisfies the complete exact Niggli conditions.

Parameters:

cell (httk.atomistic.models.cell.like.CellLike) – The cell to inspect.

Returns:

Whether the cell satisfies the exact Niggli conditions.

Raises:

ValueError – If the cell is not fully periodic or its Gram matrix is not rational.

Return type:

bool

httk.atomistic.reduction.niggli_reduced(structure)[source]

Return a structure remapped into the exact Niggli-reduced cell.

The site order and count are unchanged. With row-vector fractional coordinates, the exact remapping is f_reduced = f_original * transform.inv() followed by periodic normalization. Species, species-at-sites order, Cartesian site moments, molecular information, assemblies, chemical composition, formulas, optimization type, charge, and precision are carried unchanged or propagated. Symmetry is invalidated because its operations are basis-relative; immutable identifiers and last-modified metadata are invalidated because this operation creates a derived structure.

Parameters:

structure (httk.atomistic.models.structure.like.StructureLike) – The structure to express in a Niggli-reduced cell.

Returns:

The reduced structure and its exact reduction metadata.

Raises:

ValueError – If the structure cell is not fully periodic or its Gram matrix is not rational.

Return type:

NiggliReducedStructureResult