httk.atomistic.models.structure.numeric_view

A plain-numpy presentation of a structure backend.

Classes

NumericUnitcellStructureView

A plain-numpy presentation of a UnitcellStructure.

Module Contents

class httk.atomistic.models.structure.numeric_view.NumericUnitcellStructureView(obj, **hints)

Bases: httk.atomistic.models.structure.semantics.StructureSemanticsMixin, httk.atomistic.models.structure.view.StructureView

A plain-numpy presentation of a UnitcellStructure.

Where a UnitcellStructure holds its geometry exactly (a surd cell basis, rational reduced coordinates, and an exact Cartesian frame), this view mirrors that interface but returns plain numpy numbers: its cell is a NumericCell, its sites a NumericSites, and cartesian_sites() a float64 numpy array. The species/species_at_sites are passed through unchanged. It is for callers who do not need exact arithmetic and just want numpy arrays.

The presentation is numpy-backed, so constructing it requires numpy (the httk-atomistic[numpy] extra) and raises ImportError eagerly when it is unavailable. The exact object is always one hop away via exact.

This is a view, not a UnitcellStructure subclass. Its exact UnitcellStructure is built lazily on first access to exact geometry.

Parameters:
property cell: httk.atomistic.models.cell.numeric.NumericCell

The cell as a NumericCell.

property sites: httk.atomistic.models.sites.numeric.NumericSites

The sites as a NumericSites.

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

The distinct species, passed through unchanged.

property species_at_sites: tuple[str, Ellipsis]

The species name occupying each site, passed through unchanged.

property charge: float | None

Expose the explicitly assigned charge as a floating-point value.

property site_moments: httk.core.NumericVector | None

Expose Cartesian site moments as numeric values.

property assemblies: tuple[httk.atomistic.composition.Assembly, Ellipsis] | None

Expose site correlations.

cartesian_sites()

The Cartesian site positions as an (N, 3) float64 numpy array.

property periodicity: tuple[bool, bool, bool]

Expose the cell’s periodic directions.

property nperiodic_dimensions: int

Expose the number of periodic directions.

property site_coordinate_span: str

Expose the presented structure’s coordinate span.

property lattice_vectors: list[list[float]]

Expose the cell vectors as numeric coordinates.

property fractional_site_positions: list[list[float]]

Expose reduced site positions as numeric coordinates.

property cartesian_site_positions: list[list[float]]

Expose Cartesian site positions as numeric coordinates.

property exact: httk.atomistic.models.structure.unitcell.UnitcellStructure

The exact UnitcellStructure this view presents.

unwrap()

Return the raw object wrapped by the backend.

unview()

Reject conversion to a standalone plain numeric value.

Returns:

Never; this view has no standalone plain value.

Raises:

TypeError – Always, because this view has no standalone plain value.

Return type:

Any