OpenMD 3.0
Molecular Dynamics in the Open
Loading...
Searching...
No Matches
OpenMD::ElementsTable Class Reference

Periodic Table of the Elements Using element data is a place holder when we lack information about a specific atom type. More...

#include <ElementsTable.hpp>

Public Member Functions

 ElementsTable ()
 Constructor.
 
 ~ElementsTable ()
 Destructor.
 
void Init ()
 Read in the data file.
 
void SetReadDirectory (char *dir)
 Set the directory before calling Init()
 
void SetEnvironmentVariable (char *var)
 Set the environment variable to use before calling Init()
 
void ParseLine (const char *line)
 Specified by particular table classes (parses an individual data line)
 
unsigned int GetNumberOfElements ()
 
unsigned int GetSize ()
 
int GetAtomicNum (const char *str)
 
int GetAtomicNum (const char *str, int &iso)
 
int GetAtomicNum (std::string name, int &iso)
 
const char * GetSymbol (int atomicnum)
 
RealType GetVdwRad (int atomicnum)
 
RealType GetCovalentRad (int atomicnum)
 
RealType GetMass (int atomicnum)
 
RealType CorrectedBondRad (int atomicnum, int hyb=3)
 
RealType CorrectedVdwRad (int atomicnum, int hyb=3)
 
int GetMaxBonds (int atomicnum)
 
RealType GetElectroNeg (int atomicnum)
 
RealType GetAllredRochowElectroNeg (int atomicnum)
 
RealType GetIonization (int atomicnum)
 
RealType GetElectronAffinity (int atomicnum)
 
std::vector< RealType > GetRGB (int atomicnum)
 
std::string GetName (int atomicnum)
 

Protected Attributes

bool init_
 whether the data been read already
 
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
 
std::vector< Element * > elements_
 
const char * dataptr_
 default data table if file is unreadable
 

Detailed Description

Periodic Table of the Elements Using element data is a place holder when we lack information about a specific atom type.

In particular, the Langevin algorithms must assume specific atomic radii to predict drag and random forces on those atoms. For force fields which do not specify Lennard-Jones radii, the element's van der Waals radius is used instead. The ElementsTable class (etab) is declared as external in ElementsTable.cpp. Source files that include the header file ElementsTable.hpp automatically have an extern definition to etab. The following code sample demonstrates the use of the ElementsTable 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);
const char * GetSymbol(int atomicnum)
RealType GetVdwRad(int atomicnum)
int GetAtomicNum(const char *str)

Stored information in the OBElementTable includes elemental:

  • symbols
  • covalent radii
  • van der Waal radii
  • expected maximum bonding valence
  • molar mass (by IUPAC recommended atomic masses)
  • electronegativity
  • ionization potential
  • electron affinity
  • RGB colors for visualization programs
  • names (by IUPAC recommendation)

Definition at line 72 of file ElementsTable.hpp.

Constructor & Destructor Documentation

◆ ElementsTable()

OpenMD::ElementsTable::ElementsTable ( )

Constructor.

Definition at line 58 of file ElementsTable.cpp.

References dir_, envvar_, filename_, and init_.

◆ ~ElementsTable()

OpenMD::ElementsTable::~ElementsTable ( )

Destructor.

Definition at line 65 of file ElementsTable.cpp.

Member Function Documentation

◆ CorrectedBondRad()

RealType OpenMD::ElementsTable::CorrectedBondRad ( int atomicnum,
int hyb = 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
Parameters
atomicnumthe atomic number of the element
hybthe hybridization of the element

Definition at line 190 of file ElementsTable.cpp.

References Init(), and init_.

◆ CorrectedVdwRad()

RealType OpenMD::ElementsTable::CorrectedVdwRad ( int atomicnum,
int hyb = 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
Parameters
atomicnumthe atomic number of the element
hybthe hybridization of the element

Definition at line 207 of file ElementsTable.cpp.

References Init(), and init_.

◆ GetAllredRochowElectroNeg()

RealType OpenMD::ElementsTable::GetAllredRochowElectroNeg ( int atomicnum)
Returns
the Allred-Rochow electronegativity for this element
Parameters
atomicnumthe atomic number of the element

Definition at line 125 of file ElementsTable.cpp.

References GetAllredRochowElectroNeg(), Init(), and init_.

Referenced by GetAllredRochowElectroNeg().

◆ GetAtomicNum() [1/3]

int OpenMD::ElementsTable::GetAtomicNum ( const char * str)
Returns
the atomic number matching the element symbol passed or 0 if not defined.
Parameters
strthe element symbol

Definition at line 242 of file ElementsTable.cpp.

References GetAtomicNum().

Referenced by GetAtomicNum(), and GetAtomicNum().

◆ GetAtomicNum() [2/3]

int OpenMD::ElementsTable::GetAtomicNum ( const char * str,
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
Parameters
strthe element symbol
isothe isotope index for Deuterium or Tritium

Definition at line 247 of file ElementsTable.cpp.

References Init(), and init_.

◆ GetAtomicNum() [3/3]

int OpenMD::ElementsTable::GetAtomicNum ( std::string name,
int & iso )
Returns
the atomic number matching the element symbol passed or 0 if not defined.
Parameters
namethe element name
isothe isotope index for Deuterium or Tritium

Definition at line 297 of file ElementsTable.cpp.

References GetAtomicNum().

◆ GetCovalentRad()

RealType OpenMD::ElementsTable::GetCovalentRad ( int atomicnum)
Returns
the covalent radius for this atomic number
Parameters
atomicnumthe atomic number of the element

Definition at line 224 of file ElementsTable.cpp.

References GetCovalentRad(), Init(), and init_.

Referenced by GetCovalentRad().

◆ GetElectronAffinity()

RealType OpenMD::ElementsTable::GetElectronAffinity ( int atomicnum)
Returns
the electron affinity (in eV) for this element
Parameters
atomicnumthe atomic number of the element

Definition at line 143 of file ElementsTable.cpp.

References GetElectronAffinity(), Init(), and init_.

Referenced by GetElectronAffinity().

◆ GetElectroNeg()

RealType OpenMD::ElementsTable::GetElectroNeg ( int atomicnum)
Returns
the Pauling electronegativity for this element
Parameters
atomicnumthe atomic number of the element

Definition at line 116 of file ElementsTable.cpp.

References GetElectroNeg(), Init(), and init_.

Referenced by GetElectroNeg().

◆ GetIonization()

RealType OpenMD::ElementsTable::GetIonization ( int atomicnum)
Returns
the ionization potential (in eV) for this element
Parameters
atomicnumthe atomic number of the element

Definition at line 134 of file ElementsTable.cpp.

References GetIonization(), Init(), and init_.

Referenced by GetIonization().

◆ GetMass()

RealType OpenMD::ElementsTable::GetMass ( int atomicnum)
Returns
the average atomic mass for this element.
Parameters
atomicnumthe atomic number of the element

Definition at line 233 of file ElementsTable.cpp.

References GetMass(), Init(), and init_.

Referenced by GetMass().

◆ GetMaxBonds()

int OpenMD::ElementsTable::GetMaxBonds ( int atomicnum)
Returns
the maximum expected number of bonds to this element
Parameters
atomicnumthe atomic number of the element

Definition at line 107 of file ElementsTable.cpp.

References GetMaxBonds(), Init(), and init_.

Referenced by GetMaxBonds().

◆ GetName()

std::string OpenMD::ElementsTable::GetName ( int atomicnum)
Returns
the name of this element
Parameters
atomicnumthe atomic number of the element

Definition at line 172 of file ElementsTable.cpp.

References GetName(), Init(), and init_.

Referenced by GetName().

◆ GetNumberOfElements()

unsigned int OpenMD::ElementsTable::GetNumberOfElements ( )
Returns
the number of elements in the periodic table

Definition at line 92 of file ElementsTable.cpp.

References Init(), and init_.

◆ GetRGB()

std::vector< RealType > OpenMD::ElementsTable::GetRGB ( int atomicnum)
Returns
a vector with red, green, blue color values for this element
Parameters
atomicnumthe atomic number of the element

Definition at line 152 of file ElementsTable.cpp.

References Init(), and init_.

◆ GetSize()

unsigned int OpenMD::ElementsTable::GetSize ( )
inline

Definition at line 100 of file ElementsTable.hpp.

◆ GetSymbol()

const char * OpenMD::ElementsTable::GetSymbol ( int atomicnum)
Returns
the element symbol matching the atomic number passed
Parameters
atomicnumthe atomic number of the element

Definition at line 98 of file ElementsTable.cpp.

References GetSymbol(), Init(), and init_.

Referenced by GetSymbol().

◆ GetVdwRad()

RealType OpenMD::ElementsTable::GetVdwRad ( int atomicnum)
Returns
the van der Waals radius for this atomic number
Parameters
atomicnumthe atomic number of the element

Definition at line 181 of file ElementsTable.cpp.

References GetVdwRad(), Init(), and init_.

Referenced by GetVdwRad().

◆ Init()

◆ ParseLine()

void OpenMD::ElementsTable::ParseLine ( const char * line)

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

Parameters
linethe data line to parse

Definition at line 71 of file ElementsTable.cpp.

Referenced by Init().

◆ SetEnvironmentVariable()

void OpenMD::ElementsTable::SetEnvironmentVariable ( char * var)
inline

Set the environment variable to use before calling Init()

Definition at line 90 of file ElementsTable.hpp.

References envvar_.

◆ SetReadDirectory()

void OpenMD::ElementsTable::SetReadDirectory ( char * dir)
inline

Set the directory before calling Init()

Definition at line 86 of file ElementsTable.hpp.

References dir_.

Member Data Documentation

◆ dataptr_

const char* OpenMD::ElementsTable::dataptr_
protected

default data table if file is unreadable

Definition at line 200 of file ElementsTable.hpp.

◆ dir_

std::string OpenMD::ElementsTable::dir_
protected

data directory for file if _envvar fails

Definition at line 196 of file ElementsTable.hpp.

Referenced by ElementsTable(), and SetReadDirectory().

◆ elements_

std::vector<Element*> OpenMD::ElementsTable::elements_
protected

Definition at line 199 of file ElementsTable.hpp.

◆ envvar_

std::string OpenMD::ElementsTable::envvar_
protected

environment variable to check first

Definition at line 198 of file ElementsTable.hpp.

Referenced by ElementsTable(), Init(), and SetEnvironmentVariable().

◆ filename_

std::string OpenMD::ElementsTable::filename_
protected

file to search for

Definition at line 195 of file ElementsTable.hpp.

Referenced by ElementsTable(), and Init().

◆ init_

◆ subdir_

std::string OpenMD::ElementsTable::subdir_
protected

subdirectory (if using environment variable)

Definition at line 197 of file ElementsTable.hpp.

Referenced by Init().


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