httk.atomistic.models.formula.composition

The immutable canonical elemental composition value.

Classes

Composition

Store an immutable projected composition and its formula diagnostics.

Module Contents

class httk.atomistic.models.formula.composition.Composition(amounts, uncertainties=None, complete=True, exact=None, normalized=True, normalization_status=None, diagnostics=())[source]

Bases: httk.atomistic.models.formula.backend.ChemicalFormulaBackend

Store an immutable projected composition and its formula diagnostics.

Parameters:
amounts: tuple[tuple[str, fractions.Fraction], Ellipsis] = ()[source]

Ordered (label, exact amount) pairs for this chemical formula.

Labels are element symbols in alphabetical order unless is_anonymous, in which case they are OPTIMADE anonymous symbols in canonical (descending-coefficient) order.

uncertainties: tuple[tuple[str, fractions.Fraction | None], Ellipsis] = ()[source]

Per-amount absolute uncertainties, or None where exactness is unstated.

complete: bool = True[source]

Whether the formula accounts for all represented elemental material.

exact: bool = True[source]

Whether all formula amounts are exact rather than precision-bounded.

normalized: bool = True[source]

Whether the formula is normalized within the stated precision.

normalization_status: str = 'exact'[source]

The formula’s normalization status derived from exactness and normalization.

diagnostics: tuple[httk.atomistic.models.formula.diagnostics.CompositionDiagnostic, Ellipsis] = ()[source]

Non-fatal structured diagnostics associated with the formula.

property amount_mapping: collections.abc.Mapping[str, fractions.Fraction][source]

Return the projected amounts as a read-only mapping.

property uncertainty_mapping: collections.abc.Mapping[str, fractions.Fraction | None][source]

Return the projected amount precisions as a read-only mapping.

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

Return the projected element symbols in amount order.

property nelements: int[source]

Return the number of projected elements.

property elements_ratios: tuple[fractions.Fraction, Ellipsis][source]

Return the projected amounts normalized by their total.

property chemical_formula_reduced: str | None[source]

Return the reduced chemical formula, if the composition is complete.

property chemical_formula_anonymous: str | None[source]

Return the anonymous formula, if the composition is complete.