httk.atomistic.models.structure.datastream

Lazy structure loading from files, URLs, and open text streams.

Classes

DatastreamStructure

Represent a structure source parsed only when its data is first accessed.

Module Contents

class httk.atomistic.models.structure.datastream.DatastreamStructure(obj, **hints)[source]

Bases: httk.atomistic.models.structure.backend.StructureBackend

Represent a structure source parsed only when its data is first accessed.

Requests are intentionally reader-only: an OPTIMADE-shaped Request is declined so its headers are never lost by replacing it with fetch(url). Open streams are one-shot sources; a failed parse is not cached, but consumed data cannot be replayed. Network URL strings require core network consent; wrapping a URL in DatastreamURL supplies that consent explicitly.

Parameters:
  • obj (Any) – A path, URL, stream, request, or core datastream source.

  • **hints (Any) – Backend-selection and reader-name hints.

kind: ClassVar[str] = 'datastream'[source]
resolve()[source]

Resolve and return the memoized native structure.

Returns:

The parsed native structure.

Return type:

httk.atomistic.models.structure.backend.StructureBackend

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

Expose the source structure’s cell.

Returns:

The resolved cell.

Return type:

httk.atomistic.models.cell.cell.Cell

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

Expose the source structure’s sites.

Returns:

The resolved sites.

Return type:

httk.atomistic.models.sites.sites.Sites

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

Expose the source structure’s species.

Returns:

The resolved distinct species.

Return type:

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

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

Expose the species occupying each resolved site.

Returns:

Site species names in site order.

Return type:

tuple[str, Ellipsis]

property site_moments: httk.atomistic.models.moments.backend.SiteMomentsBackend | None[source]

Expose optional moments from the resolved structure.

Returns:

Site moments, or None when they are unstated.

Return type:

httk.atomistic.models.moments.backend.SiteMomentsBackend | None

property charge: Any[source]

Expose the resolved structure’s assigned charge.

Returns:

The assigned charge, or None when it is unstated.

Return type:

Any

unwrap()[source]

Return the original lazy source.

Returns:

The path, URL, request, or stream supplied at construction.

Return type:

Any