OpenMD  2.5
Molecular Dynamics in the Open
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. 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: More...

#include <ElementsTable.hpp>

Public Member Functions

 ElementsTable ()
 
 ~ElementsTable ()
 
void Init ()
 
void SetReadDirectory (char *dir)
 
void SetEnvironmentVariable (char *var)
 
void ParseLine (const char *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 More...
 
std::string filename_
 file to search for More...
 
std::string dir_
 data directory for file if _envvar fails More...
 
std::string subdir_
 subdirectory (if using environment variable) More...
 
std::string envvar_
 environment variable to check first More...
 
std::vector< Element * > elements_
 
const char * dataptr_
 default data table if file is unreadable More...
 

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);

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 69 of file ElementsTable.hpp.

Constructor & Destructor Documentation

◆ ElementsTable()

OpenMD::ElementsTable::ElementsTable ( )

Constructor

Definition at line 57 of file ElementsTable.cpp.

References dir_, envvar_, filename_, and init_.

◆ ~ElementsTable()

OpenMD::ElementsTable::~ElementsTable ( )

Destructor

Definition at line 64 of file ElementsTable.cpp.

References elements_.

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 212 of file ElementsTable.cpp.

References elements_, Init(), and init_.

Referenced by GetSize().

◆ 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 230 of file ElementsTable.cpp.

References elements_, Init(), and init_.

Referenced by GetSize().

◆ 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 140 of file ElementsTable.cpp.

References elements_, Init(), and init_.

Referenced by GetSize().

◆ 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 268 of file ElementsTable.cpp.

Referenced by OpenMD::BeadModel::createSingleBead(), GetAtomicNum(), GetSize(), OpenMD::ShapeBuilder::internalCreateShape(), and OpenMD::LDForceManager::LDForceManager().

◆ 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 273 of file ElementsTable.cpp.

References elements_, errorStruct::errMsg, Init(), init_, errorStruct::isFatal, OPENMD_WARNING, painCave, errorStruct::severity, and simError().

◆ 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

Definition at line 322 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 248 of file ElementsTable.cpp.

References elements_, Init(), and init_.

Referenced by GetSize().

◆ 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 161 of file ElementsTable.cpp.

References elements_, Init(), and init_.

Referenced by GetSize().

◆ GetElectroNeg()

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

Definition at line 130 of file ElementsTable.cpp.

References elements_, Init(), and init_.

Referenced by GetSize().

◆ 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 150 of file ElementsTable.cpp.

References elements_, Init(), and init_.

Referenced by GetSize().

◆ 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 258 of file ElementsTable.cpp.

References elements_, Init(), and init_.

Referenced by GetSize().

◆ 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 120 of file ElementsTable.cpp.

References elements_, Init(), and init_.

Referenced by GetSize().

◆ GetName()

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

Definition at line 192 of file ElementsTable.cpp.

References elements_, Init(), and init_.

Referenced by GetSize().

◆ GetNumberOfElements()

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

Definition at line 103 of file ElementsTable.cpp.

References elements_, Init(), and init_.

Referenced by GetSize(), and SetEnvironmentVariable().

◆ 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 171 of file ElementsTable.cpp.

References elements_, Init(), and init_.

Referenced by GetSize().

◆ GetSize()

◆ 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 110 of file ElementsTable.cpp.

References elements_, Init(), and init_.

Referenced by GetSize().

◆ 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 202 of file ElementsTable.cpp.

References elements_, Init(), and init_.

Referenced by OpenMD::BeadModel::createSingleBead(), GetSize(), OpenMD::ShapeBuilder::internalCreateShape(), and OpenMD::LDForceManager::LDForceManager().

◆ 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 70 of file ElementsTable.cpp.

References elements_.

Referenced by Init(), and SetEnvironmentVariable().

◆ SetEnvironmentVariable()

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

Set the environment variable to use before calling Init()

Definition at line 87 of file ElementsTable.hpp.

References envvar_, GetNumberOfElements(), and ParseLine().

◆ SetReadDirectory()

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

Set the directory before calling Init()

Definition at line 83 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 196 of file ElementsTable.hpp.

◆ dir_

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

data directory for file if _envvar fails

Definition at line 192 of file ElementsTable.hpp.

Referenced by ElementsTable(), and SetReadDirectory().

◆ elements_

◆ envvar_

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

environment variable to check first

Definition at line 194 of file ElementsTable.hpp.

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

◆ filename_

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

file to search for

Definition at line 191 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 193 of file ElementsTable.hpp.

Referenced by Init().


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