functioncountElements
Return the number of elements in a chemical formula
Extends from Modelica.Icons.Function (Icon for functions).
Information
This function returns the number of elements in a chemical formula. Electrons are counted as a present element (or rather particle) if the net charge is nonzero.
Examples:
countElements("C19HF37O5S-") returns 5 and countElements("H+") returns 2.
Please see the readElement function for details about the format of the chemical formula.
Inputs
| Type | Name | Default | Description |
|---|---|---|---|
| String | formula | Chemical formula |
Outputs
| Type | Name | Default | Description |
|---|---|---|---|
| Integer | n | Number of elements |