httk.atomistic.models.species¶
Submodules¶
- httk.atomistic.models.species.api
- httk.atomistic.models.species.backend
- httk.atomistic.models.species.like
- httk.atomistic.models.species.plain
- httk.atomistic.models.species.plain_view
- httk.atomistic.models.species.record
- httk.atomistic.models.species.species
- httk.atomistic.models.species.view
- httk.atomistic.models.species.view_base
Attributes¶
Classes¶
Abstract base class for the canonical single-species interface. |
|
Abstract base class for all backends of single-species data. |
|
Backend for a species backed by an OPTIMADE species dict. |
|
A view presenting an underlying species backend as an OPTIMADE species dict. |
|
A chemical species occupying one or more sites, mirroring the OPTIMADE |
|
A view presenting an underlying species backend as a |
|
Abstract base class for all views of single-species data. |
Package Contents¶
- class httk.atomistic.models.species.SpeciesAPI[source]¶
Bases:
abc.ABCAbstract base class for the canonical single-species interface.
It declares the accessors mirroring the OPTIMADE
speciesfields that every species backend produces from its own native representation and every species view builds its presentation from:name,chemical_symbols,concentration, and the optionalmass,attached,nattached, andoriginal_name.- property charges: tuple[fractions.Fraction | None, Ellipsis] | None¶
Assigned charge numbers for the constituents, or
Noneif unstated.A
Noneelement means the charge of that constituent is unstated; whole-Nonemeans no constituent charges are stated. Values use elementary-charge units, for example a formal oxidation state.- Returns:
The constituent charges, or
Nonewhen unstated.- Return type:
tuple[fractions.Fraction | None, Ellipsis] | None
- property spins: tuple[fractions.Fraction | None, Ellipsis] | None¶
Idealized signed spins assigned to the constituents, or
Noneif unstated.A
Noneelement means the spin of that constituent is unstated; whole-Nonemeans no constituent spins are stated. This is distinct from a calculated site magnetic moment.- Returns:
The constituent spins, or
Nonewhen unstated.- Return type:
tuple[fractions.Fraction | None, Ellipsis] | None
- property labels: tuple[str | None, Ellipsis] | None¶
Free-form per-constituent labels, or
Noneif unstated.A
Noneelement means that constituent has no stated label; whole-Nonemeans no constituent labels are stated.
- property concentration: tuple[fractions.Fraction, Ellipsis]¶
- Abstractmethod:
- property is_ordered: bool¶
Return whether every constituent has unit concentration.
- Returns:
Truewhen all concentrations are exactlyFraction(1).- Return type:
- property concentration_precision: tuple[fractions.Fraction | None, Ellipsis] | None¶
- Abstractmethod:
- class httk.atomistic.models.species.SpeciesBackend(backend, **hints)[source]¶
Bases:
httk.core.Backend[SpeciesBackend],httk.atomistic.models.species.api.SpeciesAPIAbstract base class for all backends of single-species data.
Concrete backends carry a native representation and produce the canonical OPTIMADE species accessors declared by
SpeciesAPIfrom it.- backend_classes: ClassVar[list[type[httk.core.Backend[Any]]]]¶
- type httk.atomistic.models.species.SpeciesLike = httk.atomistic.models.species.backend.SpeciesBackend | httk.atomistic.models.species.view_base.SpeciesViewBase | httk.atomistic.models.species.species.Species | dict[str, Any] | str | int[source]¶
- class httk.atomistic.models.species.PlainSpecies(obj, **hints)[source]¶
Bases:
httk.atomistic.models.species.backend.SpeciesBackendBackend for a species backed by an OPTIMADE species dict.
The native representation is a mapping with the OPTIMADE
speciesfields; the requiredname/chemical_symbols/concentrationare validated conservatively on construction. The accessors read the corresponding fields (optional fields absent from the dict read asNone), andunwrapreturns the original dict.- property concentration: tuple[fractions.Fraction, Ellipsis]¶
Return the constituent concentrations.
- Returns:
The concentrations in constituent order.
- Return type:
tuple[fractions.Fraction, Ellipsis]
- property concentration_precision: tuple[fractions.Fraction | None, Ellipsis] | None¶
Return the concentration precision metadata.
- Returns:
Per-constituent precision, or
Nonewhen unavailable.- Return type:
tuple[fractions.Fraction | None, Ellipsis] | None
- property original_name: str | None¶
Return the original source name, if stated.
- Returns:
The original name, or
Nonewhen unstated.- Return type:
str | None
- property charges: tuple[fractions.Fraction | None, Ellipsis] | None¶
Return the constituent charges, if stated.
- Returns:
The charges, or
Nonewhen unstated.- Return type:
tuple[fractions.Fraction | None, Ellipsis] | None
- property spins: tuple[fractions.Fraction | None, Ellipsis] | None¶
Return the constituent spins, if stated.
- Returns:
The spins, or
Nonewhen unstated.- Return type:
tuple[fractions.Fraction | None, Ellipsis] | None
- class httk.atomistic.models.species.PlainSpeciesView(obj, **hints)[source]¶
Bases:
httk.atomistic.models.species.view_base.SpeciesViewBase,dictA view presenting an underlying species backend as an OPTIMADE species dict.
This view is a genuine
dictcarrying the OPTIMADEspeciesfields (optional fields that areNoneare omitted; list-valued fields are plain lists). Unlike the immutable-subclass views, a dict is mutable, so this view is a detached copy: mutating it does not affect the underlying backend.- Parameters:
obj (httk.atomistic.models.species.like.SpeciesLike) – The species-like object to present.
**hints (Any) – Backend-selection hints.
- class httk.atomistic.models.species.Species(name, chemical_symbols, concentration, mass=None, original_name=None, attached=None, nattached=None, concentration_precision=None, charges=None, spins=None, labels=None)[source]¶
Bases:
httk.atomistic.models.species.backend.SpeciesBackendA chemical species occupying one or more sites, mirroring the OPTIMADE
speciesobject.A species has a
name(unique within a structure; it need not be a chemical symbol), a list ofchemical_symbolscomposing it, and a matching list ofconcentrationvalues. Each chemical symbol is an element symbol, or one of the pseudo-symbols"X"(unknown) or"vacancy". The optionalmass,attached,nattached, andoriginal_namefields carry the remaining OPTIMADE species information;attachedandnattachedmust be given together and share their length.charges,spins, andlabelsare optional aligned decorations. An all-Nonedecoration is canonicalized toNone. Repeated chemical symbols are accepted only when the complete decoration distinguishes them.- Parameters:
name (str) – The species name.
chemical_symbols (collections.abc.Sequence[str]) – The constituent chemical symbols.
concentration (collections.abc.Sequence[ExactInput]) – The constituent occupancies.
mass (collections.abc.Sequence[float | int] | None) – The constituent masses, if stated.
original_name (str | None) – The source name, if stated.
attached (collections.abc.Sequence[str] | None) – The attached constituent symbols, if stated.
nattached (collections.abc.Sequence[int] | None) – The counts corresponding to
attached, if stated.concentration_precision (collections.abc.Sequence[PrecisionInput] | None) – The precision of each occupancy, if stated.
charges (collections.abc.Sequence[DecorationInput] | None) – The charge decoration, if stated.
spins (collections.abc.Sequence[DecorationInput] | None) – The spin decoration, if stated.
labels (collections.abc.Sequence[str | None] | None) – The label decoration, if stated.
- concentration: tuple[fractions.Fraction, Ellipsis] = ()¶
- concentration_precision: tuple[fractions.Fraction | None, Ellipsis] | None = None¶
- charges: tuple[fractions.Fraction | None, Ellipsis] | None = None¶
Assigned charge numbers for the constituents, or
Noneif unstated.A
Noneelement means the charge of that constituent is unstated; whole-Nonemeans no constituent charges are stated. Values use elementary-charge units, for example a formal oxidation state.- Returns:
The constituent charges, or
Nonewhen unstated.
- spins: tuple[fractions.Fraction | None, Ellipsis] | None = None¶
Idealized signed spins assigned to the constituents, or
Noneif unstated.A
Noneelement means the spin of that constituent is unstated; whole-Nonemeans no constituent spins are stated. This is distinct from a calculated site magnetic moment.- Returns:
The constituent spins, or
Nonewhen unstated.
- labels: tuple[str | None, Ellipsis] | None = None¶
Free-form per-constituent labels, or
Noneif unstated.A
Noneelement means that constituent has no stated label; whole-Nonemeans no constituent labels are stated.- Returns:
The constituent labels, or
Nonewhen unstated.
- property normalized: bool¶
Whether the stated concentration interval contains one.
- Returns:
Whether the concentrations are normalized within their precision.
- Return type:
- property normalization_status: str¶
Report the concentration normalization status.
- Returns:
exact,within_precision, oroutside_precision.- Return type:
- property normalization_diagnostic: Any¶
Return a structured normalization diagnostic when needed.
- Returns:
The diagnostic, or
Nonewhen the concentrations are normalized.- Return type:
Any
- property is_single_element: bool¶
Whether this species is a single, unattached, real chemical element.
True only for a species composed of exactly one element symbol (not
"X"or"vacancy") with no attached particles. Such species are the ones that can be represented as a bare atomic number in the primitive representation.- Returns:
Whether this is a single real element.
- Return type:
- without_charges()[source]¶
Return an EXPLICIT lossy projection that drops declared oxidation states.
The other species fields, including spins and labels, are preserved. A species without declared charges is returned by identity.
- Returns:
A charge-free species, or this species when already charge-free.
- Return type:
- class httk.atomistic.models.species.SpeciesView(obj, **hints)[source]¶
Bases:
httk.atomistic.models.species.view_base.SpeciesViewBase,httk.atomistic.models.species.species.SpeciesA view presenting an underlying species backend as a
Species.This view is a genuine frozen
Species, so it can be passed anywhere a Species is accepted. Its fields are built eagerly from the backend on construction, with fullSpeciesvalidation applied at that point.- Parameters:
obj (httk.atomistic.models.species.like.SpeciesLike) – The species-like object to present.
**hints (Any) – Backend-selection hints.
- unwrap()[source]¶
Return the raw object behind the backend.
- Returns:
The unwrapped source object.
- Return type:
Any
- class httk.atomistic.models.species.SpeciesViewBase[source]¶
Bases:
httk.core.View[httk.atomistic.models.species.backend.SpeciesBackend]Abstract base class for all views of single-species data.