n2p2 - A neural network potential package
|
Contains element-specific data. More...
#include <Element.h>
Classes | |
struct | SFCacheList |
List of symmetry functions corresponding to one cache identifier. More... | |
Public Member Functions | |
Element () | |
Default constructor. More... | |
Element (std::size_t const index, ElementMap const &elementMap) | |
Constructor using index. More... | |
virtual | ~Element () |
Destructor. More... | |
void | clearSymmetryFunctions () |
Clear all symmetry functions and groups. More... | |
void | setAtomicEnergyOffset (double atomicEnergyOffset) |
Set atomicEnergyOffset. More... | |
void | setHardness (double hardness) |
Set hardness. More... | |
void | setQsigma (double qsigma) |
Set qsigma. More... | |
std::size_t | getIndex () const |
Get index. More... | |
std::size_t | getAtomicNumber () const |
Get atomicNumber. More... | |
double | getAtomicEnergyOffset () const |
Get atomicEnergyOffset. More... | |
double | getHardness () const |
Get hardness. More... | |
double | getQsigma () const |
Get qsigma. More... | |
std::string | getSymbol () const |
Get symbol. More... | |
void | addSymmetryFunction (std::string const ¶meters, std::size_t const &lineNumber) |
Add one symmetry function. More... | |
void | changeLengthUnitSymmetryFunctions (double convLength) |
Change length unit for all symmetry functions. More... | |
void | sortSymmetryFunctions () |
Sort all symmetry function. More... | |
std::vector< std::string > | infoSymmetryFunctionParameters () const |
Print symmetry function parameter value information. More... | |
std::vector< std::string > | infoSymmetryFunction (std::size_t index) const |
Print symmetry function parameter names and values. More... | |
std::vector< std::string > | infoSymmetryFunctionScaling () const |
Print symmetry function scaling information. More... | |
void | setupSymmetryFunctionGroups () |
Set up symmetry function groups. More... | |
void | setupSymmetryFunctionMemory () |
Extract relevant symmetry function combinations for derivative memory. More... | |
std::vector< std::string > | infoSymmetryFunctionGroups () const |
Print symmetry function group info. More... | |
void | setCutoffFunction (CutoffFunction::CutoffType const cutoffType, double const cutoffAlpha) |
Set cutoff function for all symmetry functions. More... | |
void | setScalingNone () const |
Set no scaling of symmetry function. More... | |
void | setScaling (SymFnc::ScalingType scalingType, std::vector< std::string > const &statisticsLine, double minS, double maxS) const |
Set scaling of all symmetry functions. More... | |
std::size_t | numSymmetryFunctions () const |
Get number of symmetry functions. More... | |
std::size_t | getMinNeighbors () const |
Get maximum of required minimum number of neighbors for all symmetry functions for this element. More... | |
double | getMinCutoffRadius () const |
Get minimum cutoff radius of all symmetry functions. More... | |
double | getMaxCutoffRadius () const |
Get maximum cutoff radius of all symmetry functions. More... | |
void | getCutoffRadii (std::vector< double > &cutoffs) const |
Get all different cutoff radii belonging to this element. More... | |
std::vector< std::size_t > const & | getSymmetryFunctionNumTable () const |
Get number of relevant symmetry functions per element. More... | |
std::vector< std::vector< std::size_t > > const & | getSymmetryFunctionTable () const |
Get symmetry function element relevance table. More... | |
void | calculateSymmetryFunctions (Atom &atom, bool const derivatives) const |
Calculate symmetry functions. More... | |
void | calculateSymmetryFunctionGroups (Atom &atom, bool const derivatives) const |
Calculate symmetry functions via groups. More... | |
std::size_t | updateSymmetryFunctionStatistics (Atom const &atom) |
Update symmetry function statistics. More... | |
SymFnc const & | getSymmetryFunction (std::size_t index) const |
Get symmetry function instance. More... | |
void | setCacheIndices (std::vector< std::vector< SFCacheList > > cacheLists) |
Set cache indices for all symmetry functions of this element. More... | |
std::vector< std::size_t > | getCacheSizes () const |
Get cache sizes for each neighbor atom element. More... | |
Public Attributes | |
std::map< std::string, NeuralNetwork > | neuralNetworks |
Neural networks for this element. More... | |
SymFncStatistics | statistics |
Symmetry function statistics. More... | |
Protected Attributes | |
ElementMap | elementMap |
Copy of element map. More... | |
std::size_t | index |
Global index of this element. More... | |
std::size_t | atomicNumber |
Atomic number of this element. More... | |
double | atomicEnergyOffset |
Offset energy for every atom of this element. More... | |
double | hardness |
Atomic hardness for global charge equilibration. More... | |
double | qsigma |
Gaussian width of charge distribution. More... | |
std::string | symbol |
Element symbol. More... | |
std::vector< std::size_t > | symmetryFunctionNumTable |
Number of relevant symmetry functions for each neighbor element. More... | |
std::vector< std::vector< std::size_t > > | symmetryFunctionTable |
List of symmetry function indices relevant for each neighbor element. More... | |
std::vector< std::vector< SFCacheList > > | cacheLists |
Symmetry function cache lists. More... | |
std::vector< SymFnc * > | symmetryFunctions |
Vector of pointers to symmetry functions. More... | |
std::vector< SymGrp * > | symmetryFunctionGroups |
Vector of pointers to symmetry function groups. More... | |
nnp::Element::Element | ( | std::size_t const | index, |
ElementMap const & | elementMap | ||
) |
Constructor using index.
|
virtual |
Destructor.
Necessary because of symmetryFunctions vector of pointers.
Definition at line 67 of file Element.cpp.
References clearSymmetryFunctions().
void Element::clearSymmetryFunctions | ( | ) |
Clear all symmetry functions and groups.
Definition at line 72 of file Element.cpp.
References symmetryFunctionGroups, and symmetryFunctions.
Referenced by ~Element().
|
inline |
Set atomicEnergyOffset.
Definition at line 284 of file Element.h.
References atomicEnergyOffset.
|
inline |
Set hardness.
Definition at line 291 of file Element.h.
References hardness.
|
inline |
|
inline |
Get index.
Definition at line 305 of file Element.h.
References index.
Referenced by nnp::Mode::calculateSymmetryFunctionGroups(), and nnp::Mode::calculateSymmetryFunctions().
|
inline |
Get atomicNumber.
Definition at line 310 of file Element.h.
References atomicNumber.
Referenced by nnp::SetupAnalysis::writeSymmetryFunctionShape().
|
inline |
Get atomicEnergyOffset.
Definition at line 315 of file Element.h.
References atomicEnergyOffset.
Referenced by nnp::InterfaceLammps::getAtomicEnergy().
|
inline |
|
inline |
|
inline |
Get symbol.
Definition at line 330 of file Element.h.
References symbol.
Referenced by nnp::Mode::setupNeuralNetwork(), and nnp::Mode::setupSymmetryFunctionCache().
void Element::addSymmetryFunction | ( | std::string const & | parameters, |
std::size_t const & | lineNumber | ||
) |
Add one symmetry function.
[in] | parameters | String containing settings for symmetry function. |
[in] | lineNumber | Line number of symmetry function in settings file. |
Definition at line 82 of file Element.cpp.
References elementMap, nnp::reduce(), nnp::split(), and symmetryFunctions.
void Element::changeLengthUnitSymmetryFunctions | ( | double | convLength | ) |
Change length unit for all symmetry functions.
[in] | convLength | Length unit conversion factor. |
Definition at line 143 of file Element.cpp.
References symmetryFunctions.
void Element::sortSymmetryFunctions | ( | ) |
Sort all symmetry function.
Definition at line 154 of file Element.cpp.
References symmetryFunctions.
vector< string > Element::infoSymmetryFunctionParameters | ( | ) | const |
Print symmetry function parameter value information.
Definition at line 168 of file Element.cpp.
References symmetryFunctions.
|
inline |
Print symmetry function parameter names and values.
Definition at line 348 of file Element.h.
References index, and symmetryFunctions.
Referenced by nnp::SetupAnalysis::writeSymmetryFunctionShape().
vector< string > Element::infoSymmetryFunctionScaling | ( | ) | const |
Print symmetry function scaling information.
Definition at line 181 of file Element.cpp.
References symmetryFunctions.
void Element::setupSymmetryFunctionGroups | ( | ) |
Set up symmetry function groups.
Definition at line 194 of file Element.cpp.
References elementMap, symmetryFunctionGroups, and symmetryFunctions.
void Element::setupSymmetryFunctionMemory | ( | ) |
Extract relevant symmetry function combinations for derivative memory.
Definition at line 289 of file Element.cpp.
References elementMap, nnp::ElementMap::size(), symmetryFunctionNumTable, symmetryFunctions, and symmetryFunctionTable.
vector< string > Element::infoSymmetryFunctionGroups | ( | ) | const |
Print symmetry function group info.
Definition at line 313 of file Element.cpp.
References symmetryFunctionGroups.
void Element::setCutoffFunction | ( | CutoffFunction::CutoffType const | cutoffType, |
double const | cutoffAlpha | ||
) |
Set cutoff function for all symmetry functions.
[in] | cutoffType | Type of cutoff function. |
[in] | cutoffAlpha | Cutoff parameter for all functions. |
Definition at line 328 of file Element.cpp.
References nnp::SymFncBaseCutoff::setCutoffFunction(), and symmetryFunctions.
void Element::setScalingNone | ( | ) | const |
Set no scaling of symmetry function.
Still scaling factors need to be initialized.
Definition at line 344 of file Element.cpp.
References nnp::SymFnc::ST_NONE, nnp::strpr(), symmetryFunctionGroups, and symmetryFunctions.
void Element::setScaling | ( | SymFnc::ScalingType | scalingType, |
std::vector< std::string > const & | statisticsLine, | ||
double | minS, | ||
double | maxS | ||
) | const |
Set scaling of all symmetry functions.
[in] | scalingType | Type of scaling, see SymFnc::ScalingType. |
[in] | statisticsLine | Vector of strings containing statistics for all symmetry functions. |
[in] | minS | Minimum for scaling range. |
[in] | maxS | Maximum for scaling range. |
Definition at line 364 of file Element.cpp.
References symmetryFunctionGroups, and symmetryFunctions.
|
inline |
Get number of symmetry functions.
Definition at line 353 of file Element.h.
References symmetryFunctions.
Referenced by nnp::Mode::calculateSymmetryFunctionGroups(), nnp::Mode::calculateSymmetryFunctions(), nnp::Mode::setupSymmetryFunctionCache(), and nnp::SetupAnalysis::writeSymmetryFunctionShape().
size_t Element::getMinNeighbors | ( | ) | const |
Get maximum of required minimum number of neighbors for all symmetry functions for this element.
Definition at line 384 of file Element.cpp.
References symmetryFunctions.
double Element::getMinCutoffRadius | ( | ) | const |
Get minimum cutoff radius of all symmetry functions.
Definition at line 397 of file Element.cpp.
References symmetryFunctions.
double Element::getMaxCutoffRadius | ( | ) | const |
Get maximum cutoff radius of all symmetry functions.
Definition at line 414 of file Element.cpp.
References symmetryFunctions.
void Element::getCutoffRadii | ( | std::vector< double > & | cutoffs | ) | const |
Get all different cutoff radii belonging to this element.
[in] | cutoffs | Vector to append the result. |
Definition at line 427 of file Element.cpp.
References symmetryFunctions, and nnp::vectorContains().
|
inline |
Get number of relevant symmetry functions per element.
Definition at line 336 of file Element.h.
References symmetryFunctionNumTable.
Referenced by nnp::Mode::calculateSymmetryFunctionGroups(), and nnp::Mode::calculateSymmetryFunctions().
|
inline |
Get symmetry function element relevance table.
Definition at line 342 of file Element.h.
References symmetryFunctionTable.
void Element::calculateSymmetryFunctions | ( | Atom & | atom, |
bool const | derivatives | ||
) | const |
Calculate symmetry functions.
[in] | atom | Atom whose symmetry functions are calculated. |
[in] | derivatives | If symmetry function derivatives will be calculated. |
Definition at line 436 of file Element.cpp.
References symmetryFunctions.
Referenced by nnp::Mode::calculateSymmetryFunctions().
void Element::calculateSymmetryFunctionGroups | ( | Atom & | atom, |
bool const | derivatives | ||
) | const |
Calculate symmetry functions via groups.
[in] | atom | Atom whose symmetry functions are calculated. |
[in] | derivatives | If symmetry function derivatives will be calculated. |
Definition at line 449 of file Element.cpp.
References symmetryFunctionGroups.
Referenced by nnp::Mode::calculateSymmetryFunctionGroups().
size_t Element::updateSymmetryFunctionStatistics | ( | Atom const & | atom | ) |
Update symmetry function statistics.
[in] | atom | Atom with symmetry function values. |
This function checks also for extrapolation warnings.
Definition at line 462 of file Element.cpp.
References nnp::SymFncStatistics::addExtrapolationWarning(), nnp::SymFncStatistics::addValue(), nnp::SymFncStatistics::collectExtrapolationWarnings, nnp::SymFncStatistics::collectStatistics, nnp::Atom::element, nnp::Atom::G, index, nnp::Atom::indexStructure, nnp::Atom::numSymmetryFunctions, statistics, nnp::SymFncStatistics::stopOnExtrapolationWarnings, nnp::strpr(), symbol, symmetryFunctions, nnp::Atom::tag, and nnp::SymFncStatistics::writeExtrapolationWarnings.
Referenced by nnp::Mode::calculateSymmetryFunctionGroups(), and nnp::Mode::calculateSymmetryFunctions().
|
inline |
Get symmetry function instance.
[in] | index | Symmetry function index. |
Definition at line 358 of file Element.h.
References index, and symmetryFunctions.
Referenced by nnp::Mode::setupSymmetryFunctionCache(), and nnp::SetupAnalysis::writeSymmetryFunctionShape().
void Element::setCacheIndices | ( | std::vector< std::vector< SFCacheList > > | cacheLists | ) |
Set cache indices for all symmetry functions of this element.
[in] | cacheLists | List of cache identifier strings and corresponding SF indices for each neighbor element. |
Definition at line 544 of file Element.cpp.
References nnp::SymFnc::addCacheIndex(), cacheLists, nnp::Element::SFCacheList::element, nnp::Element::SFCacheList::identifier, nnp::Element::SFCacheList::indices, and symmetryFunctions.
Referenced by nnp::Mode::setupSymmetryFunctionCache().
vector< size_t > Element::getCacheSizes | ( | ) | const |
Get cache sizes for each neighbor atom element.
Definition at line 563 of file Element.cpp.
References cacheLists.
Referenced by nnp::Mode::calculateSymmetryFunctionGroups(), and nnp::Mode::calculateSymmetryFunctions().
std::map<std::string, NeuralNetwork> nnp::Element::neuralNetworks |
Neural networks for this element.
Definition at line 247 of file Element.h.
Referenced by nnp::Mode::setupNeuralNetwork().
SymFncStatistics nnp::Element::statistics |
Symmetry function statistics.
Definition at line 249 of file Element.h.
Referenced by updateSymmetryFunctionStatistics().
|
protected |
Copy of element map.
Definition at line 253 of file Element.h.
Referenced by addSymmetryFunction(), setupSymmetryFunctionGroups(), and setupSymmetryFunctionMemory().
|
protected |
Global index of this element.
Definition at line 255 of file Element.h.
Referenced by getIndex(), getSymmetryFunction(), infoSymmetryFunction(), and updateSymmetryFunctionStatistics().
|
protected |
Atomic number of this element.
Definition at line 257 of file Element.h.
Referenced by getAtomicNumber().
|
protected |
Offset energy for every atom of this element.
Definition at line 259 of file Element.h.
Referenced by getAtomicEnergyOffset(), and setAtomicEnergyOffset().
|
protected |
Atomic hardness for global charge equilibration.
Definition at line 261 of file Element.h.
Referenced by getHardness(), and setHardness().
|
protected |
Gaussian width of charge distribution.
Definition at line 263 of file Element.h.
Referenced by getQsigma(), and setQsigma().
|
protected |
Element symbol.
Definition at line 265 of file Element.h.
Referenced by getSymbol(), and updateSymmetryFunctionStatistics().
|
protected |
Number of relevant symmetry functions for each neighbor element.
Definition at line 267 of file Element.h.
Referenced by getSymmetryFunctionNumTable(), and setupSymmetryFunctionMemory().
|
protected |
List of symmetry function indices relevant for each neighbor element.
Definition at line 269 of file Element.h.
Referenced by getSymmetryFunctionTable(), and setupSymmetryFunctionMemory().
|
protected |
Symmetry function cache lists.
Definition at line 272 of file Element.h.
Referenced by getCacheSizes(), and setCacheIndices().
|
protected |
Vector of pointers to symmetry functions.
Definition at line 275 of file Element.h.
Referenced by addSymmetryFunction(), calculateSymmetryFunctions(), changeLengthUnitSymmetryFunctions(), clearSymmetryFunctions(), getCutoffRadii(), getMaxCutoffRadius(), getMinCutoffRadius(), getMinNeighbors(), getSymmetryFunction(), infoSymmetryFunction(), infoSymmetryFunctionParameters(), infoSymmetryFunctionScaling(), numSymmetryFunctions(), setCacheIndices(), setCutoffFunction(), setScaling(), setScalingNone(), setupSymmetryFunctionGroups(), setupSymmetryFunctionMemory(), sortSymmetryFunctions(), and updateSymmetryFunctionStatistics().
|
protected |
Vector of pointers to symmetry function groups.
Definition at line 277 of file Element.h.
Referenced by calculateSymmetryFunctionGroups(), clearSymmetryFunctions(), infoSymmetryFunctionGroups(), setScaling(), setScalingNone(), and setupSymmetryFunctionGroups().