The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....



MolFormula


Unit:SDL_cform
Class:TMolForm
Declaration:property MolFormula: string;

The property MolFormula can be used to input a molecular formula as a string. This string has to be formatted as follows:

xxssyy xxssyy xxssyy....

Each kind of atom is represented by a three-part substring which consists of

  • an (optional) number defining the atomic weight,
  • the atomic symbol, and
  • the number of atoms.

Blanks have to be inserted where they are needed for clearness. If the atomic weight is left out, it is assumed to be the atomic weight of the most abundant isotope. The number of atoms may be omitted for single atoms.

The atomic symbols may be written with any mixture of upper and lower case letters. Please note that this leads to ambiguous notations which can be resolved only by inserting blanks at the proper places. The string "CO", for example, is interpreted as (cobalt), whereas carbon monoxide has to be written as "C O " (blank between C and O).

Hint: In order to display an arbitrary string instead of a molecular formula, the property ShowAsText can be set to TRUE. In this case, the property MolFormula is not interpreted as molecular formula but is displayed as is.

Example: valid strings: C2H8Cl, 13C2 C4 H9 F, C H3 C O O H, 2H2O, D2O
invalid strings: CH3COOH, C2H4ON

Example: This property is used in the following example program (see http://www.lohninger.com/examples.html for downloading the code): molform



Last Update: 2012-Oct-20