otter.parse_formula_composition
- otter.parse_formula_composition(formula: str) tuple[list[str], list[float]][source]
Parse one simple chemical formula into distinct species and counts.
- Parameters:
formula – Chemical formula such as Al, CH2, or C10H8O4.
- Returns:
list[str], list[float] – Distinct species symbols and their stoichiometric counts.
Notes
This parser intentionally targets the compact formulas used by the current AA/mixture workflows. Parentheses and charge annotations are rejected. Repeated symbols are accumulated while preserving first appearance order, so structural formulas such as CH3COOH become C2H4O2.