Chemical species, within the Chemistry package, are defined using the AssignSpecies function. Each species has a label and a state of matter. The currently supported states are “s”, “l”, “g”, “sol”, and “aq”.


For many chemical species, Mathematica™’s built-in ChemicalData function can provide a great deal of information, including the molar mass.

Unfortunately, the database that drives ChemicalData is not extensible, and on a regular basis we need to work with chemical species that are not present in the database. The Chemistry package includes a function, CaclMolarMass, that calculates the molar mass for any chemical formula that is formatted in standard notation in a string. This function handles all elements, subscripted numbers, parenthetical/bracketed groups with or without subscripts, and solvents of hydration (you must set off the solvents of hydration with the FilledSmallCircle character). Spaces are not allowed. Since we typically use these strings as our labels, and since the Chemistry package keeps track of those labels from our initial assignment using AssignSpecies, we can assign the molar masses by calling the function AssignMolarMassesFromLabels with a list of the symbols we wish to have assigned. We can then query the package for the calculated molar mass using the function MolarMass. If, however, you wish to have the symbols represent species using a notation other than standard chemical formulae, you can assign molar masses manually using the function AssignMolarMasses.