ChemicalFormula
Represent the elemental composition of a chemical species.
ChemicalFormula[chem] returns the chemical formula corresponding to chem.
ChemicalFormula[<|element1 -> count1, element2 -> count2, ...|>] constructs a formula from element counts. Elements can be specified with atomic-symbol strings such as "C" and "O".
Examples
Create a formula from a string:
formula = ChemicalFormula["C6H12O6"]Construct the same formula from element counts:
ChemicalFormula[<|"C" -> 6, "H" -> 12, "O" -> 6|>]Get the formula of a molecule:
ChemicalFormula[Molecule["caffeine"]]Access formula properties:
{
formula["ElementCounts"],
formula["HillFormulaString"],
formula["MolecularMass"]
}Use ChemicalFormulaQ to test whether an expression is a valid formula object. Chemical formulas can also be used as species in a ChemicalReaction.
Something isn't working? Report an issue.
Please visit the official Wolfram Language Reference for more details.