httk.atomistic.models.cell.api

The minimal canonical cell interface for httk-atomistic.

Classes

CellAPI

Abstract base class for the canonical cell interface.

Module Contents

class httk.atomistic.models.cell.api.CellAPI[source]

Bases: abc.ABC

Abstract base class for the canonical cell interface.

It declares the exact accessors that every cell backend produces from its own native representation and every cell view builds its presentation from: the basis of 3x3 lattice vectors (scale * unscaled_basis), the positive scale, and the unscaled_basis. All three are exact httk-core vectors; this is the single interchange format, with no pairwise conversion between backends.

property basis: httk.core.SurdVector[source]
Abstractmethod:

Return the scaled lattice vectors.

property scale: httk.core.SurdScalar[source]
Abstractmethod:

Return the positive factor applied to unscaled_basis.

property unscaled_basis: httk.core.SurdVector[source]
Abstractmethod:

Return the lattice vectors before applying scale.

property precision: fractions.Fraction | None[source]

How precisely the basis was stated, as an absolute length, or None if unknown.

A backend that knows its source’s precision overrides this; one that does not — a bare matrix of numbers with no provenance — inherits None.

Returns:

The absolute basis precision, or None when it is unknown.

Return type:

fractions.Fraction | None

property periodicity: tuple[bool, bool, bool][source]

Which of the three basis rows is a genuine lattice translation.

A backend that knows its periodicity overrides this; one that does not inherit (True, True, True). A cell described only by six lattice parameters or a bare matrix is interpreted as a fully periodic crystal.

Returns:

Flags identifying the periodic basis rows.

Return type:

tuple[bool, bool, bool]

metric()[source]

Return the exact Gram matrix of the scaled basis.

Returns:

The Gram matrix of the cell vectors.

Return type:

httk.core.SurdVector

property lengths: tuple[httk.core.SurdScalar, Ellipsis][source]

Return exact lengths where representable, with a deterministic rational fallback otherwise.

Returns:

The three cell-vector lengths.

Return type:

tuple[httk.core.SurdScalar, Ellipsis]

property angles: tuple[fractions.Fraction, Ellipsis][source]

Return (alpha, beta, gamma) exactly where representable, with a deterministic rational fallback otherwise.

Returns:

The crystallographic angles in degrees.

Return type:

tuple[fractions.Fraction, Ellipsis]

property volume: httk.core.SurdScalar[source]

Return the exact absolute determinant of the basis.

Returns:

The cell volume.

Raises:

ValueError – If the cell is not periodic in all three directions.

Return type:

httk.core.SurdScalar