httk.atomistic.structure

The Simple structure representation for httk-atomistic.

Classes

Structure

A crystal structure in the Simple representation.

Module Contents

class httk.atomistic.structure.Structure(cell: httk.atomistic.cell_like.CellLike, sites: httk.atomistic.sites_like.SitesLike, species: collections.abc.Sequence[httk.atomistic.species_like.SpeciesLike], species_at_sites: collections.abc.Sequence[str])[source]

A crystal structure in the Simple representation.

A Structure holds a cell (a Cell of 3x3 cell vectors), sites (a Sites of Nx3 reduced coordinates), a list of species (each a Species), and a length-N species_at_sites giving the species name occupying each site. Inputs are normalized on construction through the component families: the cell, sites, and each species are passed through their *Like unions, and every species_at_sites name must match one of the (uniquely named) species.

The numeric model is exact and split by purpose. The fractional frame — reduced coordinates and symmetry — is rational and lives in sites as a FracVector. The Cartesian frame — where radicals such as the hexagonal sqrt(3) appear — is exact in the squarefree-radical field: cell.basis is a SurdVector and cartesian_sites() returns the exact Cartesian positions. Pure magnitudes (bond-length comparisons) stay rational-exact via cell.metric(). Floats appear only at the presentation and JSON boundaries.

property cell: httk.atomistic.cell.Cell[source]

The cell (3x3 cell vectors) as a Cell.

property sites: httk.atomistic.sites.Sites[source]

The site coordinates (Nx3 reduced coordinates) as a Sites.

property species: tuple[httk.atomistic.species.Species, Ellipsis][source]

The distinct species of this structure.

property species_at_sites: tuple[str, Ellipsis][source]

The species name occupying each site, in site order.

cartesian_sites() httk.core.SurdVector[source]

The exact Cartesian site positions as an (N, 3) SurdVector.

Under the row-vector convention this is reduced_coords * cell.basis (each Cartesian position is the sum over lattice vectors sum_k reduced[k] * basis[k]). The reduced coordinates are rational (a FracVector), the cell basis carries the radicals (a SurdVector), so the product is exact in the surd field — the hexagonal sqrt(3) survives into the Cartesian positions.

numeric() httk.atomistic.numeric_structure.NumericStructure[source]

A plain-numpy presentation of this structure (requires the httk-atomistic[numpy] extra).