Periodic Table Functions¶

To simplify the task of dealing with the elements of the periodic table, OEChem TK 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.

symbol = oechem.OEGetAtomicSymbol(oechem.OEElemNo_C)
print("The atomic symbol for carbon is", symbol)


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.

print("The atomic number for 'Cl' is", oechem.OEGetAtomicNum("Cl"))


Element Properties¶

OEChem TK 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 TK 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) :

def CalculateMolecularWeight(mol):
implicitH = 0
weight = 0.0
for atom in mol.GetAtoms():
elemno = atom.GetAtomicNum()
mass = atom.GetIsotope()
implicitH += atom.GetImplicitHCount()
if elemno != 0 and mass != 0 and oechem.OEIsCommonIsotope(elemno, mass):
weight += oechem.OEGetIsotopicWeight(elemno, mass)
else:
weight += oechem.OEGetAverageWeight(elemno)
weight += implicitH * oechem.OEGetAverageWeight(oechem.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:

oechem.OEAssignPaulingVdWRadii(mol)
for atom in mol.GetAtoms():