# Periodic Table Functions¶

To simplify the task of dealing with the elements of the periodic table, OEChem contains several functions to obtain useful properties of the elements.

## Atomic Symbol/Atomic Number¶

A common task is to obtain or display the atomic symbol of an atom represented by an OEAtomBase. To save space and reduce redundancy and consistency issues, the OEAtomBase class contains only an unsigned integer representing the atom’s atomic number. This value may be obtained using the OEAtomBase::GetAtomicNum method. This value can be converted into an atomic symbol using the OEGetAtomicSymbol function.

const char *symb = OEGetAtomicSymbol(OEElemNo::C);
cout << "The atomic symbol for carbon is " << symb << endl;


The example above uses the integer constant OEElemNo::C from the OEElemNo namespace. This namespace represents the atomic numbers of the 111 elements as their symbols as a convenience.

The inverse of OEGetAtomicSymbol, i.e. obtaining the atomic numbers from an atomic symbol, is performed by the OEGetAtomicNum function.

cout << "The atomic number for 'Cl' is " << OEGetAtomicNum("Cl") << endl;


## Element Properties¶

OEChem provides several functions for obtaining properties of the elements, all of which take an unsigned integer argument representing the element’s atomic number.

Property Name Return Value Function
Average Atomic Weight double OEGetAverageWeight
Most Abundant Isotope unsigned int OEGetDefaultMass

The OEChem library also provides the following two functions to deal with specific isotopes:

Both functions take an unsigned integer representing the isotope’s atomic number (number of protons), and an unsigned integer representing the isotope’s mass (number of protons plus neutrons).

The following example shows how to calculate molecular weight (OECalculateMolecularWeight) :

double CalculateMolecularWeight(const OEMolBase &mol)
{
OEIter<OEAtomBase> atom;
unsigned int elemno = 0;
unsigned int mass = 0;
unsigned int implicitH = 0;
double weight = 0.0;

for (atom=mol.GetAtoms(); atom; ++atom)
{
elemno = atom->GetAtomicNum();
mass = atom->GetIsotope();
implicitH += atom->GetImplicitHCount();
if ((elemno!=0) && (mass!=0) && OEIsCommonIsotope(elemno,mass))
weight += OEGetIsotopicWeight(elemno,mass);
else
weight += OEGetAverageWeight(elemno);
}
weight += (implicitH * OEGetAverageWeight(OEElemNo::H));
return weight;
}


Property Name Get Method Applied on OEMolBase Reference
Generic Assignment Function N/A [2] OEAssignRadii

Table footnote:

[1] The get method is not available, since the radius value of OEElemNo::O and OEElemNo::N (defined in [Nicholls-2008]) depend on the chemical environment of the given atom.

[2] Can be used to call any of the other methods to assign radii as well as to clear atomic radii.

The following snippet shows how to set and access the “Pauling” van der Waals radius in a given OEMolBase:

OEGraphMol mol;
OESmilesToMol(mol,"c1ccncc1CF");