908-788-5550

Exact Mass Calculator, Single Isotope Version

Home
Type in Chemical Formula:
Calculated:
Exact Mass = u
Abundance = %

Overview

This is a very primitive exact mass calculator. Given the formula of a chemical species, the calculator determines the exact mass of a single isotope of that species and the relative abundance of that isotope. The isotope selected has the property that each atom in the species is the most abundant isotope of that element. For low mass chemical species, the chosen isotope is often the most abundant isotope of the species; however, this is often not the case for larger mass species due to the need for a more complex algorithm to make such a determination.

Instructions

Type in the chemical formula. The results will be displayed. (This program requires that JavaScript is enabled in your web browser.)

How to input chemical formulas

Chemical formulas can be inputted according to a straightforward syntax. Include no spaces in input. Element names are case sensitive. Express formulas in terms of atoms (functional group abbreviations are not supported).

Examples:
CH3COOH is written as CH3COOH
H2SO4 is written as H2SO4
Mg(OH)2 is written as Mg(OH)2

Other Tools

For a more advanced isotopic calculator, see the Isotope Distribution Calculator and Mass Spec Plotter.

Implementation Notes

This program is written entirely in JavaScript. You can invoke your browser's "View Source" feature to see the source code. Most of the core code is confined into a separate source file named "exactmass.js".

The architecture of the program can be understood in terms of compiler theory. The program first retrieves the chemical formula as a character string. This string is fed into a lexer, which converts the character string into a stream of tokens (e.g. atom names, numbers, and parenthesis). Invalid tokens (e.g. "Zy" or "%") produce an error. The parser sequentially reads tokens from the token stream. The parser is implemented as a state-machine, and the state of the parser changes as a function of the current parser state and the current token being read. By limiting the set of valid tokens at each state, the parser get make a distinction between syntactically valid (e.g. "Mg(OH)2") and syntactically invalid (e.g. ")MgO(H2") formulas. Note however that a syntactically valid formula ("CH6") is not necessarily semantically valid; this program makes no effort in determining semantic validity. During the parse phase, calculations are performed (i.e. generated). It is convenient that the parse and the generation phases can be closely coupled.

The mathematics is handled according to the following principle. An isotope of the form aAbB, where A and B are functional groups, themselves isotopes, has a mass of a + b and an fractional abundance equal to the product of the fractional abundances of the given functional group isotopes in their respective functional groups. The problem can be solved by recursion.


(c) 1996-2016 Scientific Instrument Services, Inc.
Data is obtained from the CRC Handbook of Chemistry and Physics.
Disclaimer: Scientific Instrument Services is not responsible for any errors which may result from the use of this program.