OBElementTable Class Reference

Periodic Table of the Elements. More...

#include <data.h>

Inheritance diagram for OBElementTable:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 OBElementTable (void)
 ~OBElementTable ()
void ParseLine (const char *)
 Specified by particular table classes (parses an individual data line).
unsigned int GetNumberOfElements ()
 
Returns:
the number of elements in the periodic table

unsigned int GetSize ()
 
Returns:
the size of the database (for error checking)

int GetAtomicNum (const char *)
int GetAtomicNum (const char *, int &iso)
char * GetSymbol (int)
 
Returns:
the element symbol matching the atomic number passed

double GetVdwRad (int)
 
Returns:
the van der Waals radius for this atomic number

double GetCovalentRad (int)
 
Returns:
the covalent radius for this atomic number

double GetMass (int)
double CorrectedBondRad (int, int=3)
double CorrectedVdwRad (int, int=3)
int GetMaxBonds (int)
 
Returns:
the maximum expected number of bonds to this element

double GetElectroNeg (int)
 
Returns:
the Pauling electronegativity for this element

double GetIonization (int)
 
Returns:
the ionization potential (in eV) for this element

double GetElectronAffinity (int)
 
Returns:
the electron affinity (in eV) for this element

std::vector< double > GetRGB (int)
 
Returns:
a vector with red, green, blue color values for this element

std::string GetName (int)
 
Returns:
the name of this element

void Init ()
 Read in the data file, falling back as needed.
void SetReadDirectory (char *dir)
 Set the directory before calling Init().
void SetEnvironmentVariable (char *var)
 Set the environment variable to use before calling Init().

Protected Attributes

bool _init
 whether the data been read already
const char * _dataptr
 default data table if file is unreadable
std::string _filename
 file to search for
std::string _dir
 data directory for file if _envvar fails
std::string _subdir
 subdirectory (if using environment variable)
std::string _envvar
 environment variable to check first

Detailed Description

Periodic Table of the Elements.

Translating element data is a common task given that many file formats give either element symbol or atomic number information, but not both. The OBElementTable class facilitates conversion between textual and numeric element information. An instance of the OBElementTable class (etab) is declared as external in data.cpp. Source files that include the header file mol.h automatically have an extern definition to etab. The following code sample demonstrates the use of the OBElementTable class:

      cout << "The symbol for element 6 is " << etab.GetSymbol(6) << endl;
      cout << "The atomic number for Sulfur is " << etab.GetAtomicNum(16) << endl;
      cout << "The van der Waal radius for Nitrogen is " << etab.GetVdwRad(7);

Stored information in the OBElementTable includes elemental:


Constructor & Destructor Documentation

OBElementTable ( void   ) 

~OBElementTable (  ) 


Member Function Documentation

void ParseLine ( const char *  buffer  )  [virtual]

Specified by particular table classes (parses an individual data line).

Reimplemented from OBGlobalDataBase.

unsigned int GetNumberOfElements (  ) 

Returns:
the number of elements in the periodic table

unsigned int GetSize (  )  [inline, virtual]

Returns:
the size of the database (for error checking)

Reimplemented from OBGlobalDataBase.

int GetAtomicNum ( const char *   ) 

Deprecated:
Does not properly handle 'D' or 'T' hydrogen isotopes

int GetAtomicNum ( const char *  ,
int &  iso 
)

Returns:
the atomic number matching the element symbol passed or 0 if not defined. For 'D' or 'T' hydrogen isotopes, will return a value in the second argument

char * GetSymbol ( int   ) 

Returns:
the element symbol matching the atomic number passed

double GetVdwRad ( int   ) 

Returns:
the van der Waals radius for this atomic number

double GetCovalentRad ( int   ) 

Returns:
the covalent radius for this atomic number

double GetMass ( int   ) 

Returns:
the average atomic mass for this element. For exact isotope masses, use OpenBabel::OBIsotopeTable

double CorrectedBondRad ( int  ,
int  = 3 
)

Returns:
a "corrected" bonding radius based on the hybridization. Scales the covalent radius by 0.95 for sp2 and 0.90 for sp hybrids

double CorrectedVdwRad ( int  ,
int  = 3 
)

Returns:
a "corrected" vdW radius based on the hybridization. Scales the van der Waals radius by 0.95 for sp2 and 0.90 for sp hybrids

int GetMaxBonds ( int   ) 

Returns:
the maximum expected number of bonds to this element

double GetElectroNeg ( int   ) 

Returns:
the Pauling electronegativity for this element

double GetIonization ( int   ) 

Returns:
the ionization potential (in eV) for this element

double GetElectronAffinity ( int   ) 

Returns:
the electron affinity (in eV) for this element

vector< double > GetRGB ( int   ) 

Returns:
a vector with red, green, blue color values for this element

string GetName ( int   ) 

Returns:
the name of this element

void Init (  )  [inherited]

Read in the data file, falling back as needed.

void SetReadDirectory ( char *  dir  )  [inline, inherited]

Set the directory before calling Init().

void SetEnvironmentVariable ( char *  var  )  [inline, inherited]

Set the environment variable to use before calling Init().


Member Data Documentation

bool _init [protected, inherited]

whether the data been read already

const char* _dataptr [protected, inherited]

default data table if file is unreadable

std::string _filename [protected, inherited]

file to search for

std::string _dir [protected, inherited]

data directory for file if _envvar fails

std::string _subdir [protected, inherited]

subdirectory (if using environment variable)

std::string _envvar [protected, inherited]

environment variable to check first


The documentation for this class was generated from the following files: