httk.atomistic.compat

ASE interoperability for the httk.atomistic structure family.

The protocol deliberately describes only the four ASE Atoms methods needed for conversion. ASE is optional: duck-typed objects can be converted without installing ASE, while ASEAtomsView is available only when ASE itself is installed.

Classes

ASEAtomsProtocol

The minimal method surface needed to treat an object as ASE Atoms.

ASEAtomsBackend

Backend for ASE Atoms and compatible duck-typed objects.

Module Contents

class httk.atomistic.compat.ASEAtomsProtocol[source]

Bases: Protocol

The minimal method surface needed to treat an object as ASE Atoms.

This is a runtime-checkable, duck-typed protocol. ASE is not required: any object providing these four methods qualifies for ASEAtomsBackend.

get_cell() Any[source]

Return the cell vectors as rows.

get_scaled_positions() Any[source]

Return the reduced positions.

get_atomic_numbers() Any[source]

Return one atomic number per site.

get_pbc() Any[source]

Return one periodicity flag per cell row.

class httk.atomistic.compat.ASEAtomsBackend(obj: ASEAtomsProtocol, **hints: Any)[source]

Bases: httk.atomistic.structure_backend.StructureBackend

Backend for ASE Atoms and compatible duck-typed objects.

Conversion is eager because reading the four methods and normalizing their values is real work. The original object remains available through unwrap().

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

The exact cell converted from the native cell rows.

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

The exact reduced coordinates converted from the native positions.

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

The distinct single-element species in first-appearance order.

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

The species name occupying each site.

unwrap() Any[source]

Return the original Atoms-like object.