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)[source]

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[source]

The cell as a NumericCell.

property sites: httk.atomistic.models.sites.numeric.NumericSites[source]

The sites as a NumericSites.

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

The distinct species, passed through unchanged.

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

The species name occupying each site, passed through unchanged.

property charge: float | None[source]

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

property site_moments: httk.core.NumericVector | None[source]

Expose Cartesian site moments as numeric values.

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

Expose site correlations.

cartesian_sites()[source]

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

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

Expose the cell’s periodic directions.

property nperiodic_dimensions: int[source]

Expose the number of periodic directions.

property site_coordinate_span: str[source]

Expose the presented structure’s coordinate span.

property lattice_vectors: list[list[float]][source]

Expose the cell vectors as numeric coordinates.

property fractional_site_positions: list[list[float]][source]

Expose reduced site positions as numeric coordinates.

property cartesian_site_positions: list[list[float]][source]

Expose Cartesian site positions as numeric coordinates.

property exact: httk.atomistic.models.structure.unitcell.UnitcellStructure[source]

The exact UnitcellStructure this view presents.

unwrap()[source]

Return the raw object wrapped by the backend.

unview()[source]

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