cifkit.utils.formula module

Parses a formula.

cifkit.utils.formula.get_normalized_formula(formula: str, demical_places=3) str[source]

Return a formula with the stoichiometry coefficient sum of 1.

cifkit.utils.formula.get_parsed_formula(formula: str) list[tuple[str, str]][source]

Return a list of tuples, each tuple containing an element and its index.

cifkit.utils.formula.get_parsed_norm_formula(formula: str) list[tuple[str, str]][source]

Return a list of tuples, each tuple containing element and normalized index.

cifkit.utils.formula.get_subscripted_formula(formula: str) str[source]

Return a subscripted formula used for plotting.

cifkit.utils.formula.get_unique_element_count(formula: str) int[source]

Return the number of unique elements in the chemical formula.

cifkit.utils.formula.get_unique_elements(formula: str) list[str][source]

Return a set of elements parsed from a formula.

cifkit.utils.formula.get_unique_elements_from_formulas(formulas: list) set[str][source]

Return unique elements from a list of formulas.

cifkit.utils.formula.get_validated_formula_label(formula: str) str[source]