n2p2 - A neural network potential package
|
Contains element map. More...
#include <ElementMap.h>
Public Member Functions | |
std::string | operator[] (std::size_t const index) const |
Overload [] operator for index search. More... | |
std::size_t | operator[] (std::string const symbol) const |
Overload [] operator for symbol search. More... | |
std::size_t | size () const |
Get element map size. More... | |
std::string | getElementsString () const |
Get sorted list of elements in one string (space separated). More... | |
std::size_t | index (std::string const &symbol) const |
Get index of given element. More... | |
std::string | symbol (std::size_t const index) const |
Get element symbol for given element index. More... | |
std::size_t | atomicNumber (std::size_t index) const |
Get atomic number from element index. More... | |
std::size_t | registerElements (std::string const &elementLine) |
Extract all elements and store in element map. More... | |
void | deregisterElements () |
Clear element map. More... | |
std::vector< std::string > | info () const |
Get map information as a vector of strings. More... | |
Static Public Member Functions | |
static std::string | symbolFromAtomicNumber (std::size_t const atomicNumber) |
Get element symbol from atomic number. More... | |
static std::size_t | atomicNumber (std::string const &symbol) |
Get atomic number from element string. More... | |
Static Private Member Functions | |
static bool | compareAtomicNumber (std::string const &symbol1, std::string const &symbol2) |
Check if arguments are sorted according to atomic number. More... | |
Private Attributes | |
std::map< std::string, std::size_t > | forwardMap |
Map of elements present and corresponding index number. More... | |
std::map< std::size_t, std::string > | reverseMap |
Reverse element map. More... | |
Static Private Attributes | |
static std::string const | knownElements [] |
List of element symbols (e.g. "He" for Helium). More... | |
Contains element map.
Definition at line 29 of file ElementMap.h.
|
inline |
Overload [] operator for index search.
[in] | index | Element index. |
Definition at line 130 of file ElementMap.h.
References index(), and symbol().
|
inline |
|
inline |
Get element map size.
Definition at line 140 of file ElementMap.h.
References forwardMap.
Referenced by nnp::Structure::addAtom(), nnp::SymFnc::addCacheIndex(), nnp::SymFncBaseCompAngWeighted::getCacheIdentifiers(), nnp::SymFncCompRadWeighted::getCacheIdentifiers(), nnp::SymFncExpAngnWeighted::getCacheIdentifiers(), nnp::SymFncExpRadWeighted::getCacheIdentifiers(), getElementsString(), nnp::InterfaceLammps::initialize(), nnp::Structure::reset(), nnp::Structure::setElementMap(), LAMMPS_NS::PairHDNNPExternal::settings(), nnp::Mode::setupElectrostatics(), nnp::Mode::setupElementMap(), nnp::Mode::setupElements(), nnp::Mode::setupNeuralNetwork(), nnp::Element::setupSymmetryFunctionMemory(), nnp::SymFnc::SymFnc(), and nnp::Structure::writeToFilePoscar().
string ElementMap::getElementsString | ( | ) | const |
Get sorted list of elements in one string (space separated).
Definition at line 56 of file ElementMap.cpp.
References size(), nnp::strpr(), and symbol().
Referenced by nnp::Structure::writeToFilePoscar().
size_t ElementMap::index | ( | std::string const & | symbol | ) | const |
Get index of given element.
[in] | symbol | Element symbol. |
Definition at line 71 of file ElementMap.cpp.
References forwardMap, nnp::safeFind(), and symbol().
Referenced by atomicNumber(), operator[](), and symbol().
string ElementMap::symbol | ( | std::size_t const | index | ) | const |
Get element symbol for given element index.
[in] | index | Element index. |
Definition at line 76 of file ElementMap.cpp.
References index(), reverseMap, and nnp::safeFind().
Referenced by atomicNumber(), getElementsString(), index(), and operator[]().
|
inline |
Get atomic number from element index.
[in] | index | Element index in map. |
Definition at line 145 of file ElementMap.h.
References atomicNumber(), index(), and symbol().
Referenced by atomicNumber(), nnp::SymFncCompAngnWeighted::calculate(), nnp::SymFncCompAngwWeighted::calculate(), nnp::SymFncCompRadWeighted::calculate(), nnp::SymFncExpAngnWeighted::calculate(), nnp::SymFncExpRadWeighted::calculate(), nnp::SymGrpCompAngnWeighted::calculate(), nnp::SymGrpCompAngwWeighted::calculate(), nnp::SymGrpCompRadWeighted::calculate(), nnp::SymGrpExpAngnWeighted::calculate(), nnp::SymGrpExpRadWeighted::calculate(), compareAtomicNumber(), nnp::InterfaceLammps::initialize(), main(), LAMMPS_NS::PairHDNNPExternal::settings(), nnp::Mode::setupElementMap(), symbolFromAtomicNumber(), nnp::Dataset::writeNeighborLists(), nnp::Dataset::writeSymmetryFunctionFile(), nnp::Dataset::writeSymmetryFunctionHistograms(), and nnp::Training::writeUpdaterStatus().
size_t ElementMap::registerElements | ( | std::string const & | elementLine | ) |
Extract all elements and store in element map.
[in] | elementLine | String containing all elements, e.g. "Cd S Zn", separated by whitespaces. |
Sorts all elements according to their atomic number and populates forwardMap and reverseMap with the symbol and the corresponding index number.
Definition at line 36 of file ElementMap.cpp.
References compareAtomicNumber(), forwardMap, nnp::reduce(), reverseMap, and nnp::split().
Referenced by main(), LAMMPS_NS::PairHDNNPExternal::settings(), and nnp::Mode::setupElementMap().
void ElementMap::deregisterElements | ( | ) |
Clear element map.
Definition at line 81 of file ElementMap.cpp.
References forwardMap, and reverseMap.
|
static |
Get element symbol from atomic number.
[in] | atomicNumber | Atomic number of element. |
Definition at line 106 of file ElementMap.cpp.
References atomicNumber(), knownElements, and nnp::strpr().
|
static |
Get atomic number from element string.
[in] | symbol | Element symbol (e.g. "He" for Helium). |
Definition at line 89 of file ElementMap.cpp.
References knownElements, and symbol().
vector< string > ElementMap::info | ( | ) | const |
Get map information as a vector of strings.
Definition at line 125 of file ElementMap.cpp.
References forwardMap, reverseMap, and nnp::strpr().
Referenced by nnp::Structure::info().
|
inlinestaticprivate |
Check if arguments are sorted according to atomic number.
true
if atomic number of element 1 is smaller than atomic number of element 2, false
otherwise.Used for sorting in registerElements().
Definition at line 150 of file ElementMap.h.
References atomicNumber().
Referenced by registerElements().
|
private |
Map of elements present and corresponding index number.
Definition at line 107 of file ElementMap.h.
Referenced by deregisterElements(), index(), info(), registerElements(), and size().
|
private |
Reverse element map.
Definition at line 109 of file ElementMap.h.
Referenced by deregisterElements(), info(), registerElements(), and symbol().
|
staticprivate |
List of element symbols (e.g. "He" for Helium).
Definition at line 111 of file ElementMap.h.
Referenced by atomicNumber(), and symbolFromAtomicNumber().