molMass {biogas}R Documentation

Calculate Molar Mass of Compound

Description

molMass calculates the molar mass of any organic compound (and some salts) based on its chemical formula.

Usage

molMass(form)

Arguments

form

a chemical formula, as a character vector, e.g., "C6H12O6" for glucose or "CH3COOH" for acetic acid, or c("C6H12O6", "CH3COOH") for both at once.

Details

Standard atomic weights are from CIAAW, and were rounded to three or more digits (with the exception of Li) depending on the range of the reported interval for “normal materials”. In general form should follow capitalization rules for elements (i.e., first letter capitalized, second lower-case). However, if form contains single-letter elements only, it is possible to use lower-case letters for all elements (but for clarity this is not recommended). The function is vectorized.

Value

Numeric vector with length equal to length of form with molar mass (g/mol)

Author(s)

Charlotte Rennuit and Sasha D. Hafner

References

CIAAW <http://www.ciaaw.org/atomic-weights.htm>

See Also

calcCOD

Examples

  molMass("C6H12O6")

  molMass("CH3COOH")

  molMass("CH3CH2OH")

  molMass("CH4")

  molMass("ch4")

  molMass(c("C6H12O6", "CH3COOH", "CH3CH2OH"))

  # Case-sentitive for two letter elements
  molMass("NaHCO3")

  # Complex formulas OK
  molMass("H3C(CH2)5COOH")

  molMass("(C6H12O6)0.24999 (H3COOH)0.75001")

  # Database is quite complete 
  molMass('CdSiO3')

  # Use care for, e.g., hydrates
  molMass('FeSO4(H2O)7')


[Package biogas version 1.23.2 Index]