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=())

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

Store an immutable projected composition and its formula diagnostics.

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

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] = ()

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

complete: bool = True

Whether the formula accounts for all represented elemental material.

exact: bool = True

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

normalized: bool = True

Whether the formula is normalized within the stated precision.

normalization_status: str = 'exact'

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

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

Non-fatal structured diagnostics associated with the formula.

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

Return the projected amounts as a read-only mapping.

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

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

property elements: tuple[str, Ellipsis]

Return the projected element symbols in amount order.

property nelements: int

Return the number of projected elements.

property elements_ratios: tuple[fractions.Fraction, Ellipsis]

Return the projected amounts normalized by their total.

property chemical_formula_reduced: str | None

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

property chemical_formula_anonymous: str | None

Return the anonymous formula, if the composition is complete.