n2p2 - A neural network potential package
|
Storage for a single atom. More...
#include <Atom.h>
Classes | |
struct | Neighbor |
Struct to store information on neighbor atoms. More... | |
Public Member Functions | |
Atom () | |
Atom constructor, initialize to zero. More... | |
void | toNormalizedUnits (double convEnergy, double convLength) |
Switch to normalized length and energy units. More... | |
void | toPhysicalUnits (double convEnergy, double convLength) |
Switch to physical length and energy units. More... | |
void | allocate (bool all) |
Allocate vectors related to symmetry functions (G, dEdG). More... | |
void | free (bool all) |
Free vectors related to symmetry functions, opposite of allocate(). More... | |
void | clearNeighborList () |
Clear neighbor list. More... | |
void | clearNeighborList (std::size_t const numElements) |
Clear neighbor list and change number of elements. More... | |
std::size_t | getNumNeighbors (double cutoffRadius) const |
Calculate number of neighbors for a given cutoff radius. More... | |
void | updateError (std::string const &property, std::map< std::string, double > &error, std::size_t &count) const |
Update property error metrics with data from this atom. More... | |
std::vector< std::string > | getForcesLines () const |
Get reference and NN forces for this atoms. More... | |
std::string | getChargeLine () const |
Get reference and NN charge for this atoms. More... | |
std::vector< std::string > | info () const |
Get atom information as a vector of strings. More... | |
Public Attributes | |
bool | hasNeighborList |
If the neighbor list has been calculated for this atom. More... | |
bool | hasSymmetryFunctions |
If symmetry function values are saved for this atom. More... | |
bool | hasSymmetryFunctionDerivatives |
If symmetry function derivatives are saved for this atom. More... | |
bool | useChargeNeuron |
If an additional charge neuron in the short-range NN is present. More... | |
std::size_t | index |
Index number of this atom. More... | |
std::size_t | indexStructure |
Index number of structure this atom belongs to. More... | |
int64_t | tag |
Tag number of this atom. More... | |
std::size_t | element |
Element index of this atom. More... | |
std::size_t | numNeighbors |
Total number of neighbors. More... | |
std::size_t | numNeighborsUnique |
Number of unique neighbor indices (don't count multiple PBC images). More... | |
std::size_t | numSymmetryFunctions |
Number of symmetry functions used to describe the atom environment. More... | |
double | energy |
Atomic energy determined by neural network. More... | |
double | charge |
Atomic charge determined by neural network. More... | |
double | chargeRef |
Atomic reference charge. More... | |
Vec3D | r |
Cartesian coordinates. More... | |
Vec3D | f |
Force vector calculated by neural network. More... | |
Vec3D | fRef |
Reference force vector from data set. More... | |
std::vector< std::size_t > | neighborsUnique |
List of unique neighbor indices (don't count multiple PBC images). More... | |
std::vector< std::size_t > | numNeighborsPerElement |
Number of neighbors per element. More... | |
std::vector< std::size_t > | numSymmetryFunctionDerivatives |
Number of neighbor atom symmetry function derivatives per element. More... | |
std::vector< std::size_t > | cacheSizePerElement |
Cache size for each element. More... | |
std::vector< double > | G |
Symmetry function values. More... | |
std::vector< double > | dEdG |
Derivative of atomic energy with respect to symmetry functions. More... | |
std::vector< double > | dQdG |
Derivative of atomic charge with respect to symmetry functions. More... | |
std::vector< Vec3D > | dGdr |
Derivative of symmetry functions with respect to this atom's coordinates. More... | |
std::vector< Neighbor > | neighbors |
Neighbor array (maximum number defined in macros.h. More... | |
Atom::Atom | ( | ) |
Atom constructor, initialize to zero.
Definition at line 27 of file Atom.cpp.
void Atom::toNormalizedUnits | ( | double | convEnergy, |
double | convLength | ||
) |
Switch to normalized length and energy units.
[in] | convEnergy | Multiplicative energy unit conversion factor. |
[in] | convLength | Multiplicative length unit conversion factor. |
Definition at line 73 of file Atom.cpp.
References dEdG, dGdr, energy, f, fRef, hasNeighborList, hasSymmetryFunctionDerivatives, neighbors, numSymmetryFunctions, r, and useChargeNeuron.
void Atom::toPhysicalUnits | ( | double | convEnergy, |
double | convLength | ||
) |
Switch to physical length and energy units.
[in] | convEnergy | Multiplicative energy unit conversion factor. |
[in] | convLength | Multiplicative length unit conversion factor. |
Definition at line 113 of file Atom.cpp.
References dEdG, dGdr, energy, f, fRef, hasNeighborList, hasSymmetryFunctionDerivatives, neighbors, numSymmetryFunctions, r, and useChargeNeuron.
void Atom::allocate | ( | bool | all | ) |
Allocate vectors related to symmetry functions (G, dEdG).
[in] | all | If true allocate also vectors corresponding to derivatives of symmetry functions (dEdG, dGdr, #dGdxia and Neighbor::dGdr, neighbors must be present). If false allocate only G. |
Warning: numSymmetryFunctions and numSymmetryFunctionDerivatives need to be set first (the latter only in case of argument all == true.
Definition at line 153 of file Atom.cpp.
References cacheSizePerElement, dEdG, dGdr, dQdG, G, hasSymmetryFunctionDerivatives, hasSymmetryFunctions, neighbors, numSymmetryFunctionDerivatives, numSymmetryFunctions, and useChargeNeuron.
Referenced by nnp::Mode::calculateSymmetryFunctionGroups(), and nnp::Mode::calculateSymmetryFunctions().
void Atom::free | ( | bool | all | ) |
Free vectors related to symmetry functions, opposite of allocate().
[in] | all | If true free all vectors (G, dEdG, dGdr, #dGdxia and Neighbor::dGdr) otherwise free only dEdG, dGdr, #dGdxia and Neighbor::dGdr. |
Definition at line 221 of file Atom.cpp.
References dEdG, dGdr, dQdG, G, hasSymmetryFunctionDerivatives, hasSymmetryFunctions, and neighbors.
void Atom::clearNeighborList | ( | ) |
Clear neighbor list.
Definition at line 259 of file Atom.cpp.
References clearNeighborList(), and numNeighborsPerElement.
Referenced by clearNeighborList(), and nnp::Structure::clearNeighborList().
void nnp::Atom::clearNeighborList | ( | std::size_t const | numElements | ) |
Clear neighbor list and change number of elements.
[in] | numElements | Number of elements present. |
size_t Atom::getNumNeighbors | ( | double | cutoffRadius | ) | const |
Calculate number of neighbors for a given cutoff radius.
[in] | cutoffRadius | Desired cutoff radius. |
This function assumes that the neighbor list has already been calculated for a large cutoff radius and now the number of neighbor atoms for a smaller cutoff is requested.
Definition at line 281 of file Atom.cpp.
References neighbors.
Referenced by nnp::Mode::calculateSymmetryFunctionGroups(), and nnp::Mode::calculateSymmetryFunctions().
void Atom::updateError | ( | std::string const & | property, |
std::map< std::string, double > & | error, | ||
std::size_t & | count | ||
) | const |
Update property error metrics with data from this atom.
[in] | property | One of "force" or "charge". |
[in,out] | error | Input error metric map to be updated. |
[in,out] | count | Input counter to be updated. |
Definition at line 297 of file Atom.cpp.
vector< string > Atom::getForcesLines | ( | ) | const |
Get reference and NN forces for this atoms.
Definition at line 321 of file Atom.cpp.
References f, fRef, index, indexStructure, and nnp::strpr().
string Atom::getChargeLine | ( | ) | const |
Get reference and NN charge for this atoms.
Definition at line 336 of file Atom.cpp.
References charge, chargeRef, index, indexStructure, and nnp::strpr().
vector< string > Atom::info | ( | ) | const |
Get atom information as a vector of strings.
Definition at line 345 of file Atom.cpp.
References cacheSizePerElement, charge, chargeRef, dEdG, dGdr, dQdG, element, energy, f, fRef, G, hasNeighborList, hasSymmetryFunctionDerivatives, hasSymmetryFunctions, index, indexStructure, neighbors, neighborsUnique, numNeighbors, numNeighborsPerElement, numNeighborsUnique, numSymmetryFunctionDerivatives, numSymmetryFunctions, r, nnp::strpr(), tag, and useChargeNeuron.
bool nnp::Atom::hasNeighborList |
If the neighbor list has been calculated for this atom.
Definition at line 90 of file Atom.h.
Referenced by info(), toNormalizedUnits(), and toPhysicalUnits().
bool nnp::Atom::hasSymmetryFunctions |
If symmetry function values are saved for this atom.
Definition at line 92 of file Atom.h.
Referenced by allocate(), nnp::Mode::calculateSymmetryFunctionGroups(), nnp::Mode::calculateSymmetryFunctions(), free(), info(), and nnp::InterfaceLammps::setLocalAtoms().
bool nnp::Atom::hasSymmetryFunctionDerivatives |
If symmetry function derivatives are saved for this atom.
Definition at line 94 of file Atom.h.
Referenced by allocate(), nnp::Mode::calculateSymmetryFunctionGroups(), nnp::Mode::calculateSymmetryFunctions(), free(), info(), nnp::InterfaceLammps::setLocalAtoms(), toNormalizedUnits(), and toPhysicalUnits().
bool nnp::Atom::useChargeNeuron |
If an additional charge neuron in the short-range NN is present.
Definition at line 96 of file Atom.h.
Referenced by allocate(), nnp::Mode::calculateSymmetryFunctionGroups(), nnp::Mode::calculateSymmetryFunctions(), info(), toNormalizedUnits(), and toPhysicalUnits().
std::size_t nnp::Atom::index |
Index number of this atom.
Definition at line 98 of file Atom.h.
Referenced by nnp::Mode::calculateForces(), nnp::Mode::calculateSymmetryFunctionGroups(), nnp::Mode::calculateSymmetryFunctions(), nnp::Training::collectDGdxia(), getChargeLine(), nnp::InterfaceLammps::getForces(), getForcesLines(), nnp::Atom::Neighbor::info(), info(), and nnp::InterfaceLammps::setLocalAtoms().
std::size_t nnp::Atom::indexStructure |
Index number of structure this atom belongs to.
Definition at line 100 of file Atom.h.
Referenced by nnp::Mode::calculateSymmetryFunctionGroups(), nnp::Mode::calculateSymmetryFunctions(), getChargeLine(), getForcesLines(), info(), nnp::InterfaceLammps::setLocalAtoms(), and nnp::Element::updateSymmetryFunctionStatistics().
int64_t nnp::Atom::tag |
Tag number of this atom.
Definition at line 102 of file Atom.h.
Referenced by nnp::Atom::Neighbor::info(), info(), and nnp::Element::updateSymmetryFunctionStatistics().
std::size_t nnp::Atom::element |
Element index of this atom.
Definition at line 104 of file Atom.h.
Referenced by nnp::Mode::calculateForces(), nnp::Mode::calculateSymmetryFunctionGroups(), nnp::Mode::calculateSymmetryFunctions(), nnp::Training::collectDGdxia(), nnp::InterfaceLammps::getAtomicEnergy(), nnp::InterfaceLammps::getForces(), nnp::Atom::Neighbor::info(), info(), nnp::Atom::Neighbor::operator<(), nnp::Atom::Neighbor::operator==(), nnp::InterfaceLammps::setLocalAtoms(), nnp::Training::update(), and nnp::Element::updateSymmetryFunctionStatistics().
std::size_t nnp::Atom::numNeighbors |
Total number of neighbors.
Definition at line 106 of file Atom.h.
Referenced by nnp::InterfaceLammps::addNeighbor(), nnp::SymFncCompAngn::calculate(), nnp::SymFncCompAngnWeighted::calculate(), nnp::SymFncCompAngw::calculate(), nnp::SymFncCompAngwWeighted::calculate(), nnp::SymFncCompRad::calculate(), nnp::SymFncCompRadWeighted::calculate(), nnp::SymFncExpAngn::calculate(), nnp::SymFncExpAngnWeighted::calculate(), nnp::SymFncExpAngw::calculate(), nnp::SymFncExpRad::calculate(), nnp::SymFncExpRadWeighted::calculate(), nnp::SymGrpCompAngn::calculate(), nnp::SymGrpCompAngnWeighted::calculate(), nnp::SymGrpCompAngw::calculate(), nnp::SymGrpCompAngwWeighted::calculate(), nnp::SymGrpCompRad::calculate(), nnp::SymGrpCompRadWeighted::calculate(), nnp::SymGrpExpAngn::calculate(), nnp::SymGrpExpAngnWeighted::calculate(), nnp::SymGrpExpAngw::calculate(), nnp::SymGrpExpRad::calculate(), nnp::SymGrpExpRadWeighted::calculate(), nnp::Training::collectDGdxia(), info(), nnp::InterfaceLammps::setLocalAtoms(), and nnp::Training::update().
std::size_t nnp::Atom::numNeighborsUnique |
std::size_t nnp::Atom::numSymmetryFunctions |
Number of symmetry functions used to describe the atom environment.
Definition at line 110 of file Atom.h.
Referenced by allocate(), nnp::Mode::calculateForces(), nnp::Mode::calculateSymmetryFunctionGroups(), nnp::Mode::calculateSymmetryFunctions(), nnp::Training::collectDGdxia(), nnp::InterfaceLammps::getForces(), info(), toNormalizedUnits(), toPhysicalUnits(), and nnp::Element::updateSymmetryFunctionStatistics().
double nnp::Atom::energy |
Atomic energy determined by neural network.
Definition at line 112 of file Atom.h.
Referenced by nnp::InterfaceLammps::getAtomicEnergy(), info(), toNormalizedUnits(), and toPhysicalUnits().
double nnp::Atom::charge |
Atomic charge determined by neural network.
Definition at line 114 of file Atom.h.
Referenced by getChargeLine(), info(), nnp::Training::sortUpdateCandidates(), nnp::Training::update(), and updateError().
double nnp::Atom::chargeRef |
Atomic reference charge.
Definition at line 116 of file Atom.h.
Referenced by getChargeLine(), info(), nnp::Training::sortUpdateCandidates(), nnp::Training::update(), and updateError().
Vec3D nnp::Atom::r |
Cartesian coordinates.
Definition at line 118 of file Atom.h.
Referenced by info(), nnp::Structure::remap(), toNormalizedUnits(), and toPhysicalUnits().
Vec3D nnp::Atom::f |
Force vector calculated by neural network.
Definition at line 120 of file Atom.h.
Referenced by nnp::Mode::calculateForces(), getForcesLines(), info(), main(), nnp::Training::sortUpdateCandidates(), toNormalizedUnits(), toPhysicalUnits(), nnp::Training::update(), and updateError().
Vec3D nnp::Atom::fRef |
Reference force vector from data set.
Definition at line 122 of file Atom.h.
Referenced by getForcesLines(), info(), main(), nnp::Training::sortUpdateCandidates(), toNormalizedUnits(), toPhysicalUnits(), nnp::Training::update(), and updateError().
std::vector<std::size_t> nnp::Atom::neighborsUnique |
List of unique neighbor indices (don't count multiple PBC images).
Definition at line 124 of file Atom.h.
Referenced by nnp::Mode::calculateForces(), and info().
std::vector<std::size_t> nnp::Atom::numNeighborsPerElement |
Number of neighbors per element.
Definition at line 126 of file Atom.h.
Referenced by nnp::InterfaceLammps::addNeighbor(), clearNeighborList(), nnp::Structure::clearNeighborList(), info(), nnp::InterfaceLammps::setLocalAtoms(), and nnp::Training::update().
std::vector<std::size_t> nnp::Atom::numSymmetryFunctionDerivatives |
Number of neighbor atom symmetry function derivatives per element.
Definition at line 128 of file Atom.h.
Referenced by allocate(), nnp::Mode::calculateSymmetryFunctionGroups(), nnp::Mode::calculateSymmetryFunctions(), and info().
std::vector<std::size_t> nnp::Atom::cacheSizePerElement |
Cache size for each element.
Definition at line 131 of file Atom.h.
Referenced by allocate(), nnp::Mode::calculateSymmetryFunctionGroups(), nnp::Mode::calculateSymmetryFunctions(), and info().
std::vector<double> nnp::Atom::G |
Symmetry function values.
Definition at line 134 of file Atom.h.
Referenced by allocate(), nnp::SymFncCompAngn::calculate(), nnp::SymFncCompAngnWeighted::calculate(), nnp::SymFncCompAngw::calculate(), nnp::SymFncCompAngwWeighted::calculate(), nnp::SymFncCompRad::calculate(), nnp::SymFncCompRadWeighted::calculate(), nnp::SymFncExpAngn::calculate(), nnp::SymFncExpAngnWeighted::calculate(), nnp::SymFncExpAngw::calculate(), nnp::SymFncExpRad::calculate(), nnp::SymFncExpRadWeighted::calculate(), nnp::SymGrpCompAngn::calculate(), nnp::SymGrpCompAngnWeighted::calculate(), nnp::SymGrpCompAngw::calculate(), nnp::SymGrpCompAngwWeighted::calculate(), nnp::SymGrpCompRad::calculate(), nnp::SymGrpCompRadWeighted::calculate(), nnp::SymGrpExpAngn::calculate(), nnp::SymGrpExpAngnWeighted::calculate(), nnp::SymGrpExpAngw::calculate(), nnp::SymGrpExpRad::calculate(), nnp::SymGrpExpRadWeighted::calculate(), free(), info(), nnp::Training::update(), nnp::Element::updateSymmetryFunctionStatistics(), and nnp::Dataset::writeAtomicEnvironmentFile().
std::vector<double> nnp::Atom::dEdG |
Derivative of atomic energy with respect to symmetry functions.
Definition at line 136 of file Atom.h.
Referenced by allocate(), nnp::Mode::calculateForces(), free(), nnp::InterfaceLammps::getForces(), info(), toNormalizedUnits(), and toPhysicalUnits().
std::vector<double> nnp::Atom::dQdG |
Derivative of atomic charge with respect to symmetry functions.
Definition at line 138 of file Atom.h.
Referenced by allocate(), free(), and info().
std::vector<Vec3D> nnp::Atom::dGdr |
Derivative of symmetry functions with respect to this atom's coordinates.
Definition at line 146 of file Atom.h.
Referenced by allocate(), nnp::SymFncCompAngn::calculate(), nnp::SymFncCompAngnWeighted::calculate(), nnp::SymFncCompAngw::calculate(), nnp::SymFncCompAngwWeighted::calculate(), nnp::SymFncCompRad::calculate(), nnp::SymFncCompRadWeighted::calculate(), nnp::SymFncExpAngn::calculate(), nnp::SymFncExpAngnWeighted::calculate(), nnp::SymFncExpAngw::calculate(), nnp::SymFncExpRad::calculate(), nnp::SymFncExpRadWeighted::calculate(), nnp::SymGrpCompAngn::calculate(), nnp::SymGrpCompAngnWeighted::calculate(), nnp::SymGrpCompAngw::calculate(), nnp::SymGrpCompAngwWeighted::calculate(), nnp::SymGrpCompRad::calculate(), nnp::SymGrpCompRadWeighted::calculate(), nnp::SymGrpExpAngn::calculate(), nnp::SymGrpExpAngnWeighted::calculate(), nnp::SymGrpExpAngw::calculate(), nnp::SymGrpExpRad::calculate(), nnp::SymGrpExpRadWeighted::calculate(), nnp::Mode::calculateForces(), nnp::Training::collectDGdxia(), free(), nnp::InterfaceLammps::getForces(), nnp::Atom::Neighbor::info(), info(), toNormalizedUnits(), and toPhysicalUnits().
std::vector<Neighbor> nnp::Atom::neighbors |
Neighbor array (maximum number defined in macros.h.
Definition at line 148 of file Atom.h.
Referenced by nnp::InterfaceLammps::addNeighbor(), allocate(), nnp::SymFncCompAngn::calculate(), nnp::SymFncCompAngnWeighted::calculate(), nnp::SymFncCompAngw::calculate(), nnp::SymFncCompAngwWeighted::calculate(), nnp::SymFncCompRad::calculate(), nnp::SymFncCompRadWeighted::calculate(), nnp::SymFncExpAngn::calculate(), nnp::SymFncExpAngnWeighted::calculate(), nnp::SymFncExpAngw::calculate(), nnp::SymFncExpRad::calculate(), nnp::SymFncExpRadWeighted::calculate(), nnp::SymGrpCompAngn::calculate(), nnp::SymGrpCompAngnWeighted::calculate(), nnp::SymGrpCompAngw::calculate(), nnp::SymGrpCompAngwWeighted::calculate(), nnp::SymGrpCompRad::calculate(), nnp::SymGrpCompRadWeighted::calculate(), nnp::SymGrpExpAngn::calculate(), nnp::SymGrpExpAngnWeighted::calculate(), nnp::SymGrpExpAngw::calculate(), nnp::SymGrpExpRad::calculate(), nnp::SymGrpExpRadWeighted::calculate(), nnp::Mode::calculateForces(), nnp::Training::collectDGdxia(), free(), nnp::InterfaceLammps::getForces(), getNumNeighbors(), info(), nnp::InterfaceLammps::setLocalAtoms(), toNormalizedUnits(), toPhysicalUnits(), and nnp::Dataset::writeAtomicEnvironmentFile().