This function reads a chemical formula
(formula) and returns the symbols (symbols)
and coefficients (coeffs). Each element
is interpreted according to the rules in the
readElement function.
Currently, formula may not contain parentheses or brackets.
The symbols correspond to chemical/physical elements or electrons ("e-"). Electrons are listed if the charge is nonzero.
Example:
(symbols, coeffs) = readSpecies("C19HF37O5S-") returns
symbols={"C", "H", "F", "O", "S", "e-"} and coeffs={19, 1, 37, 5, 1, 1}.
function readSpecies extends Modelica.Icons.Function; input String formula "Chemical formula"; output String symbols[countElements(formula)] "Symbols of the elements"; output Integer coeffs[countElements(formula)] "Coefficients of the elements"; end readSpecies;