OpenMD
3.2
Molecular Dynamics in the Open
Toggle main menu visibility
Loading...
Searching...
No Matches
ElementsTable.hpp
Go to the documentation of this file.
1
/**********************************************************************
2
3
This basic Periodic Table class was originally taken from the data.h
4
file in OpenBabel. The code has been modified to match the OpenMD coding style.
5
6
We have retained the OpenBabel copyright and GPL license on this class:
7
8
Copyright (C) 1998-2001 by OpenEye Scientific Software, Inc.
9
Some portions Copyright (C) 2001-2005 by Geoffrey R. Hutchison
10
11
This file is part of the Open Babel project.
12
For more information, see <http://openbabel.sourceforge.net/>
13
14
This program is free software; you can redistribute it and/or modify
15
it under the terms of the GNU General Public License as published by
16
the Free Software Foundation version 2 of the License.
17
18
This program is distributed in the hope that it will be useful,
19
but WITHOUT ANY WARRANTY; without even the implied warranty of
20
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
GNU General Public License for more details.
22
***********************************************************************/
23
24
/**
25
* @file ElementsTable.hpp
26
* @author gezelter
27
* @date 12/21/2007
28
* @version 1.0
29
*/
30
31
#ifndef UTILS_ELEMENTSTABLE_HPP
32
#define UTILS_ELEMENTSTABLE_HPP
33
34
#include <config.h>
35
36
#include <vector>
37
38
#include "
primitives/Element.hpp
"
39
40
namespace
OpenMD
{
41
42
/**
43
* @class ElementsTable
44
* @brief Periodic Table of the Elements
45
* Using element data is a place holder when we lack information about
46
* a specific atom type. In particular, the Langevin algorithms must
47
* assume specific atomic radii to predict drag and random forces on those
48
* atoms. For force fields which do not specify Lennard-Jones radii,
49
* the element's van der Waals radius is used instead.
50
* The ElementsTable class (etab) is declared as external in
51
* ElementsTable.cpp. Source files that include the header file
52
* ElementsTable.hpp automatically have an extern definition to etab.
53
* The following code sample demonstrates the use of the ElementsTable class:
54
* @code
55
* cout << "The symbol for element 6 is " << etab.GetSymbol(6) << endl;
56
* cout << "The atomic number for Sulfur is " << etab.GetAtomicNum(16) <<
57
* endl; cout << "The van der Waal radius for Nitrogen is " <<
58
* etab.GetVdwRad(7);
59
* @endcode
60
* Stored information in the OBElementTable includes elemental:
61
* - symbols
62
* - covalent radii
63
* - van der Waal radii
64
* - expected maximum bonding valence
65
* - molar mass (by IUPAC recommended atomic masses)
66
* - electronegativity
67
* - ionization potential
68
* - electron affinity
69
* - RGB colors for visualization programs
70
* - names (by IUPAC recommendation)
71
*/
72
class
ElementsTable
{
73
public
:
74
/** Constructor */
75
ElementsTable
();
76
/** Destructor */
77
~ElementsTable
();
78
79
/**
80
* Read in the data file.
81
*/
82
void
Init
();
83
/**
84
* Set the directory before calling Init()
85
*/
86
void
SetReadDirectory
(
char
* dir) {
dir_
= dir; }
87
/**
88
* Set the environment variable to use before calling Init()
89
*/
90
void
SetEnvironmentVariable
(
char
* var) {
envvar_
= var; }
91
/**
92
* Specified by particular table classes (parses an individual data line)
93
* @param line the data line to parse
94
*/
95
void
ParseLine
(
const
char
* line);
96
/**
97
* @return the number of elements in the periodic table
98
*/
99
unsigned
int
GetNumberOfElements
();
100
unsigned
int
GetSize() {
return
GetNumberOfElements
(); }
101
/**
102
* @return the atomic number matching the element symbol passed
103
* or 0 if not defined.
104
* @param str the element symbol
105
*/
106
int
GetAtomicNum
(
const
char
* str);
107
/**
108
* @return the atomic number matching the element symbol passed
109
* or 0 if not defined. For 'D' or 'T' hydrogen isotopes, will return
110
* a value in the second argument
111
* @param str the element symbol
112
* @param iso the isotope index for Deuterium or Tritium
113
*/
114
int
GetAtomicNum
(
const
char
* str,
int
& iso);
115
/**
116
* @return the atomic number matching the element symbol passed
117
* or 0 if not defined.
118
* @param name the element name
119
* @param iso the isotope index for Deuterium or Tritium
120
*/
121
int
GetAtomicNum
(std::string name,
int
& iso);
122
/**
123
* @return the element symbol matching the atomic number passed
124
* @param atomicnum the atomic number of the element
125
*/
126
const
char
*
GetSymbol
(
int
atomicnum);
127
/**
128
* @return the van der Waals radius for this atomic number
129
* @param atomicnum the atomic number of the element
130
*/
131
RealType
GetVdwRad
(
int
atomicnum);
132
/**
133
* @return the covalent radius for this atomic number
134
* @param atomicnum the atomic number of the element
135
*/
136
RealType
GetCovalentRad
(
int
atomicnum);
137
/**
138
* @return the average atomic mass for this element.
139
* @param atomicnum the atomic number of the element
140
*/
141
RealType
GetMass
(
int
atomicnum);
142
/**
143
* @return a "corrected" bonding radius based on the hybridization.
144
* Scales the covalent radius by 0.95 for sp2 and 0.90 for sp hybrids
145
* @param atomicnum the atomic number of the element
146
* @param hyb the hybridization of the element
147
*/
148
RealType
CorrectedBondRad
(
int
atomicnum,
int
hyb = 3);
149
/**
150
* @return a "corrected" vdW radius based on the hybridization.
151
* Scales the van der Waals radius by 0.95 for sp2 and 0.90 for sp hybrids
152
* @param atomicnum the atomic number of the element
153
* @param hyb the hybridization of the element
154
*/
155
RealType
CorrectedVdwRad
(
int
atomicnum,
int
hyb = 3);
156
/**
157
* @return the maximum expected number of bonds to this element
158
* @param atomicnum the atomic number of the element
159
*/
160
int
GetMaxBonds
(
int
atomicnum);
161
/**
162
* @return the Pauling electronegativity for this element
163
* @param atomicnum the atomic number of the element
164
*/
165
RealType
GetElectroNeg
(
int
atomicnum);
166
/**
167
* @return the Allred-Rochow electronegativity for this element
168
* @param atomicnum the atomic number of the element
169
*/
170
RealType
GetAllredRochowElectroNeg
(
int
atomicnum);
171
/**
172
* @return the ionization potential (in eV) for this element
173
* @param atomicnum the atomic number of the element
174
*/
175
RealType
GetIonization
(
int
atomicnum);
176
/**
177
* @return the electron affinity (in eV) for this element
178
* @param atomicnum the atomic number of the element
179
*/
180
RealType
GetElectronAffinity
(
int
atomicnum);
181
/**
182
* @return a vector with red, green, blue color values for this element
183
* @param atomicnum the atomic number of the element
184
*/
185
std::vector<RealType>
GetRGB
(
int
atomicnum);
186
187
/**
188
* @return the name of this element
189
* @param atomicnum the atomic number of the element
190
*/
191
std::string
GetName
(
int
atomicnum);
192
193
protected
:
194
bool
init_
;
//!< whether the data been read already
195
std::string
filename_
;
//!< file to search for
196
std::string
dir_
;
//!< data directory for file if _envvar fails
197
std::string
subdir_
;
//!< subdirectory (if using environment variable)
198
std::string
envvar_
;
//!< environment variable to check first
199
std::vector<Element*> elements_;
200
const
char
*
dataptr_
;
//!< default data table if file is unreadable
201
};
202
203
extern
ElementsTable
etab;
204
}
// namespace OpenMD
205
206
#endif
Element.hpp
This basic Element data-holding class was originally taken from the data.h file in OpenBabel.
OpenMD::ElementsTable
Periodic Table of the Elements Using element data is a place holder when we lack information about a ...
Definition
ElementsTable.hpp:72
OpenMD::ElementsTable::dataptr_
const char * dataptr_
default data table if file is unreadable
Definition
ElementsTable.hpp:200
OpenMD::ElementsTable::dir_
std::string dir_
data directory for file if _envvar fails
Definition
ElementsTable.hpp:196
OpenMD::ElementsTable::init_
bool init_
whether the data been read already
Definition
ElementsTable.hpp:194
OpenMD::ElementsTable::CorrectedVdwRad
RealType CorrectedVdwRad(int atomicnum, int hyb=3)
Definition
ElementsTable.cpp:202
OpenMD::ElementsTable::CorrectedBondRad
RealType CorrectedBondRad(int atomicnum, int hyb=3)
Definition
ElementsTable.cpp:185
OpenMD::ElementsTable::GetCovalentRad
RealType GetCovalentRad(int atomicnum)
Definition
ElementsTable.cpp:219
OpenMD::ElementsTable::~ElementsTable
~ElementsTable()
Destructor.
Definition
ElementsTable.cpp:60
OpenMD::ElementsTable::SetReadDirectory
void SetReadDirectory(char *dir)
Set the directory before calling Init().
Definition
ElementsTable.hpp:86
OpenMD::ElementsTable::GetSymbol
const char * GetSymbol(int atomicnum)
Definition
ElementsTable.cpp:93
OpenMD::ElementsTable::GetNumberOfElements
unsigned int GetNumberOfElements()
Definition
ElementsTable.cpp:87
OpenMD::ElementsTable::GetAllredRochowElectroNeg
RealType GetAllredRochowElectroNeg(int atomicnum)
Definition
ElementsTable.cpp:120
OpenMD::ElementsTable::ElementsTable
ElementsTable()
Constructor.
Definition
ElementsTable.cpp:58
OpenMD::ElementsTable::GetRGB
std::vector< RealType > GetRGB(int atomicnum)
Definition
ElementsTable.cpp:147
OpenMD::ElementsTable::filename_
std::string filename_
file to search for
Definition
ElementsTable.hpp:195
OpenMD::ElementsTable::GetMaxBonds
int GetMaxBonds(int atomicnum)
Definition
ElementsTable.cpp:102
OpenMD::ElementsTable::SetEnvironmentVariable
void SetEnvironmentVariable(char *var)
Set the environment variable to use before calling Init().
Definition
ElementsTable.hpp:90
OpenMD::ElementsTable::GetElectronAffinity
RealType GetElectronAffinity(int atomicnum)
Definition
ElementsTable.cpp:138
OpenMD::ElementsTable::GetIonization
RealType GetIonization(int atomicnum)
Definition
ElementsTable.cpp:129
OpenMD::ElementsTable::envvar_
std::string envvar_
environment variable to check first
Definition
ElementsTable.hpp:198
OpenMD::ElementsTable::GetMass
RealType GetMass(int atomicnum)
Definition
ElementsTable.cpp:228
OpenMD::ElementsTable::GetName
std::string GetName(int atomicnum)
Definition
ElementsTable.cpp:167
OpenMD::ElementsTable::Init
void Init()
Read in the data file.
Definition
ElementsTable.cpp:296
OpenMD::ElementsTable::ParseLine
void ParseLine(const char *line)
Specified by particular table classes (parses an individual data line).
Definition
ElementsTable.cpp:66
OpenMD::ElementsTable::subdir_
std::string subdir_
subdirectory (if using environment variable)
Definition
ElementsTable.hpp:197
OpenMD::ElementsTable::GetVdwRad
RealType GetVdwRad(int atomicnum)
Definition
ElementsTable.cpp:176
OpenMD::ElementsTable::GetElectroNeg
RealType GetElectroNeg(int atomicnum)
Definition
ElementsTable.cpp:111
OpenMD::ElementsTable::GetAtomicNum
int GetAtomicNum(const char *str)
Definition
ElementsTable.cpp:237
OpenMD
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.
Definition
ActionCorrFunc.cpp:63
utils
ElementsTable.hpp
Generated on
for OpenMD by
1.17.0