n2p2 - A neural network potential package
|
#include <InterfaceLammps.h>
Public Member Functions | |
InterfaceLammps () | |
void | initialize (char const *const &directory, char const *const &emap, bool showew, bool resetew, int showewsum, int maxew, double cflength, double cfenergy, double lammpsCutoff, int lammpsNtypes, int myRank) |
Initialize the LAMMPS interface. More... | |
void | setGlobalStructureStatus (bool const status) |
Specify whether n2p2 knows about global structure or only local structure. More... | |
bool | getGlobalStructureStatus () |
Check if n2p2 knows about global structure. More... | |
void | setLocalAtoms (int numAtomsLocal, int const *const atomType) |
(Re)set structure to contain only local LAMMPS atoms. More... | |
void | setLocalAtomPositions (double const *const *const atomPos) |
Set absolute atom positions from LAMMPS (nnp/develop only). More... | |
void | setLocalTags (int const *const atomTag) |
Set atom tags (int version, -DLAMMPS_SMALLBIG). More... | |
void | setLocalTags (int64_t const *const atomTag) |
Set atom tags (int64_t version, -DLAMMPS_BIGBIG). More... | |
void | setBoxVectors (double const *boxlo, double const *boxhi, double const xy, double const xz, double const yz) |
Set box vectors of structure stored in LAMMPS (nnp/develop only). More... | |
void | allocateNeighborlists (int const *const numneigh) |
Allocate neighbor lists. More... | |
void | addNeighbor (int i, int j, int64_t tag, int type, double dx, double dy, double dz, double d2) |
Add one neighbor to atom (int64_t version, -DLAMMPS_BIGBIG). More... | |
void | finalizeNeighborList () |
Sorts neighbor list and creates cutoff map if necessary. More... | |
void | process () |
Calculate symmetry functions, atomic neural networks and sum of local energy contributions. More... | |
double | getEnergy () const |
Return sum of local energy contributions. More... | |
double | getAtomicEnergy (int index) const |
Return energy contribution of one atom. More... | |
void | getForces (double *const *const &atomF) const |
Calculate forces and add to LAMMPS atomic force arrays. More... | |
void | getCharges (double *const &atomQ) const |
Transfer charges (in units of e) to LAMMPS atomic charge vector. More... | |
bool | isInitialized () const |
Check if this interface is correctly initialized. More... | |
double | getMaxCutoffRadius () const |
Get largest cutoff of symmetry functions. More... | |
double | getMaxCutoffRadiusOverall () |
Get largest cutoff including structure specific cutoff and screening cutoff. More... | |
long | getEWBufferSize () const |
Calculate buffer size for extrapolation warning communication. More... | |
void | fillEWBuffer (char *const &buf, int bs) const |
Fill provided buffer with extrapolation warning entries. More... | |
void | extractEWBuffer (char const *const &buf, int bs) |
Extract given buffer to symmetry function statistics class. More... | |
void | writeExtrapolationWarnings () |
Write extrapolation warnings to log. More... | |
void | clearExtrapolationWarnings () |
Clear extrapolation warnings storage. More... | |
void | writeToFile (std::string const fileName, bool const append) |
Write current structure to file in units used in training data. More... | |
void | add3DVecToArray (double *const &arr, Vec3D const &v) const |
Add a Vec3D vector to a 3D array in place. More... | |
Public Member Functions inherited from nnp::Mode | |
Mode () | |
void | initialize () |
Write welcome message with version information. More... | |
void | loadSettingsFile (std::string const &fileName="input.nn") |
Open settings file and load all keywords into memory. More... | |
void | setupGeneric (std::string const &nnpDir="", bool skipNormalize=false, bool initialHardness=false) |
Combine multiple setup routines and provide a basic NNP setup. More... | |
void | setupNormalization (bool standalone=true) |
Set up normalization. More... | |
virtual void | setupElementMap () |
Set up the element map. More... | |
virtual void | setupElements () |
Set up all Element instances. More... | |
void | setupCutoff () |
Set up cutoff function for all symmetry functions. More... | |
virtual void | setupSymmetryFunctions () |
Set up all symmetry functions. More... | |
void | setupSymmetryFunctionScalingNone () |
Set up "empy" symmetry function scaling. More... | |
virtual void | setupSymmetryFunctionScaling (std::string const &fileName="scaling.data") |
Set up symmetry function scaling from file. More... | |
virtual void | setupSymmetryFunctionGroups () |
Set up symmetry function groups. More... | |
virtual void | setupSymmetryFunctionCache (bool verbose=false) |
Set up symmetry function cache. More... | |
void | setupSymmetryFunctionMemory (bool verbose=false) |
Extract required memory dimensions for symmetry function derivatives. More... | |
void | setupSymmetryFunctionStatistics (bool collectStatistics, bool collectExtrapolationWarnings, bool writeExtrapolationWarnings, bool stopOnExtrapolationWarnings) |
Set up symmetry function statistics collection. More... | |
void | setupCutoffMatrix () |
Setup matrix storing all symmetry function cut-offs for each element. More... | |
virtual void | setupNeuralNetwork () |
Set up neural networks for all elements. More... | |
virtual void | setupNeuralNetworkWeights (std::map< std::string, std::string > fileNameFormats=std::map< std::string, std::string >()) |
Set up neural network weights from files with given name format. More... | |
virtual void | setupNeuralNetworkWeights (std::string directoryPrefix, std::map< std::string, std::string > fileNameFormats=std::map< std::string, std::string >()) |
Set up neural network weights from files with given name format. More... | |
virtual void | setupElectrostatics (bool initialHardness=false, std::string directoryPrefix="", std::string fileNameFormat="hardness.%03zu.data") |
Set up electrostatics related stuff (hardness, screening, ...). More... | |
void | calculateSymmetryFunctions (Structure &structure, bool const derivatives) |
Calculate all symmetry functions for all atoms in given structure. More... | |
void | calculateSymmetryFunctionGroups (Structure &structure, bool const derivatives) |
Calculate all symmetry function groups for all atoms in given structure. More... | |
void | calculateAtomicNeuralNetworks (Structure &structure, bool const derivatives, std::string id="") |
Calculate atomic neural networks for all atoms in given structure. More... | |
void | chargeEquilibration (Structure &structure, bool const derivativesElec) |
Perform global charge equilibration method. More... | |
void | calculateEnergy (Structure &structure) const |
Calculate potential energy for a given structure. More... | |
void | calculateCharge (Structure &structure) const |
Calculate total charge for a given structure. More... | |
void | calculateForces (Structure &structure) const |
Calculate forces for all atoms in given structure. More... | |
void | evaluateNNP (Structure &structure, bool useForces=true, bool useDEdG=true) |
Evaluate neural network potential (includes total energy, optionally forces and in some cases charges. More... | |
void | addEnergyOffset (Structure &structure, bool ref=true) |
Add atomic energy offsets to reference energy. More... | |
void | removeEnergyOffset (Structure &structure, bool ref=true) |
Remove atomic energy offsets from reference energy. More... | |
double | getEnergyOffset (Structure const &structure) const |
Get atomic energy offset for given structure. More... | |
double | getEnergyWithOffset (Structure const &structure, bool ref=true) const |
Add atomic energy offsets and return energy. More... | |
double | normalized (std::string const &property, double value) const |
Apply normalization to given property. More... | |
double | normalizedEnergy (Structure const &structure, bool ref=true) const |
Apply normalization to given energy of structure. More... | |
double | physical (std::string const &property, double value) const |
Undo normalization for a given property. More... | |
double | physicalEnergy (Structure const &structure, bool ref=true) const |
Undo normalization for a given energy of structure. More... | |
void | convertToNormalizedUnits (Structure &structure) const |
Convert one structure to normalized units. More... | |
void | convertToPhysicalUnits (Structure &structure) const |
Convert one structure to physical units. More... | |
void | logEwaldCutoffs () |
Logs Ewald params whenever they change. More... | |
std::size_t | getNumExtrapolationWarnings () const |
Count total number of extrapolation warnings encountered for all elements and symmetry functions. More... | |
void | resetExtrapolationWarnings () |
Erase all extrapolation warnings and reset counters. More... | |
NNPType | getNnpType () const |
Getter for Mode::nnpType. More... | |
double | getMeanEnergy () const |
Getter for Mode::meanEnergy. More... | |
double | getConvEnergy () const |
Getter for Mode::convEnergy. More... | |
double | getConvLength () const |
Getter for Mode::convLength. More... | |
double | getConvCharge () const |
Getter for Mode::convCharge. More... | |
double | getMaxCutoffRadius () const |
Getter for Mode::maxCutoffRadius. More... | |
std::size_t | getNumElements () const |
Getter for Mode::numElements. More... | |
std::vector< std::size_t > | getNumSymmetryFunctions () const |
Get number of symmetry functions per element. More... | |
bool | useNormalization () const |
Check if normalization is enabled. More... | |
bool | settingsKeywordExists (std::string const &keyword) const |
Check if keyword was found in settings file. More... | |
std::string | settingsGetValue (std::string const &keyword) const |
Get value for given keyword in Settings instance. More... | |
std::vector< std::size_t > | pruneSymmetryFunctionsRange (double threshold) |
Prune symmetry functions according to their range and write settings file. More... | |
std::vector< std::size_t > | pruneSymmetryFunctionsSensitivity (double threshold, std::vector< std::vector< double > > sensitivity) |
Prune symmetry functions with sensitivity analysis data. More... | |
void | writePrunedSettingsFile (std::vector< std::size_t > prune, std::string fileName="output.nn") const |
Copy settings file but comment out lines provided. More... | |
void | writeSettingsFile (std::ofstream *const &file) const |
Write complete settings file. More... | |
Protected Attributes | |
int | myRank |
Process rank. More... | |
bool | initialized |
Initialization state. More... | |
bool | hasGlobalStructure |
Whether n2p2 knows about the global structure or only a local part. More... | |
bool | showew |
Corresponds to LAMMPS showew keyword. More... | |
bool | resetew |
Corresponds to LAMMPS resetew keyword. More... | |
int | showewsum |
Corresponds to LAMMPS showewsum keyword. More... | |
int | maxew |
Corresponds to LAMMPS maxew keyword. More... | |
double | cflength |
Corresponds to LAMMPS cflength keyword. More... | |
double | cfenergy |
Corresponds to LAMMPS cfenergy keyword. More... | |
std::string | emap |
Corresponds to LAMMPS map keyword. More... | |
std::vector< size_t > | indexMap |
Map from LAMMPS index to n2p2 atom index. More... | |
std::map< int, bool > | ignoreType |
True if atoms of this LAMMPS type will be ignored. More... | |
std::map< int, std::size_t > | mapTypeToElement |
Map from LAMMPS type to n2p2 element index. More... | |
std::map< std::size_t, int > | mapElementToType |
Map from n2p2 element index to LAMMPS type. More... | |
Structure | structure |
Structure containing local atoms. More... | |
Protected Attributes inherited from nnp::Mode | |
NNPType | nnpType |
bool | normalize |
bool | checkExtrapolationWarnings |
std::size_t | numElements |
std::vector< std::size_t > | minNeighbors |
std::vector< double > | minCutoffRadius |
double | maxCutoffRadius |
double | cutoffAlpha |
double | meanEnergy |
double | convEnergy |
double | convLength |
double | convCharge |
double | fourPiEps |
EwaldSetup | ewaldSetup |
settings::Settings | settings |
SymFnc::ScalingType | scalingType |
CutoffFunction::CutoffType | cutoffType |
ScreeningFunction | screeningFunction |
std::vector< Element > | elements |
std::vector< std::string > | nnk |
std::map< std::string, NNSetup > | nns |
std::vector< std::vector< double > > | cutoffs |
Matrix storing all symmetry function cut-offs for all elements. More... | |
ErfcBuf | erfcBuf |
Additional Inherited Members | |
Public Types inherited from nnp::Mode | |
enum class | NNPType { HDNNP_2G = 2 , HDNNP_4G = 4 , HDNNP_Q = 10 } |
Public Attributes inherited from nnp::Mode | |
ElementMap | elementMap |
Global element map, populated by setupElementMap(). More... | |
Log | log |
Global log file. More... | |
Protected Member Functions inherited from nnp::Mode | |
void | readNeuralNetworkWeights (std::string const &id, std::string const &fileName) |
Read in weights for a specific type of neural network. More... | |
Definition at line 30 of file InterfaceLammps.h.
InterfaceLammps::InterfaceLammps | ( | ) |
Definition at line 38 of file InterfaceLammps.cpp.
void InterfaceLammps::initialize | ( | char const *const & | directory, |
char const *const & | emap, | ||
bool | showew, | ||
bool | resetew, | ||
int | showewsum, | ||
int | maxew, | ||
double | cflength, | ||
double | cfenergy, | ||
double | lammpsCutoff, | ||
int | lammpsNtypes, | ||
int | myRank | ||
) |
Initialize the LAMMPS interface.
[in] | directory | Directory containing NNP data files (weights, scaling, settings). |
[in] | emap | Element mapping from LAMMPS to n2p2. |
[in] | showew | If detailed extrapolation warnings for all atoms are shown. |
[in] | resetew | If extrapolation warnings counter is reset every timestep. |
[in] | showewsum | Show number of warnings every this many timesteps. |
[in] | maxew | Abort simulation if more than this many warnings are encountered. |
[in] | cflength | Length unit conversion factor. |
[in] | cfenergy | Energy unit conversion factor. |
[in] | lammpsCutoff | Cutoff radius from LAMMPS (via pair_coeff). |
[in] | lammpsNtypes | Number of atom types in LAMMPS. |
[in] | myRank | MPI process rank (passed on to structure index). |
Definition at line 51 of file InterfaceLammps.cpp.
References nnp::ElementMap::atomicNumber(), cfenergy, cflength, nnp::Mode::elementMap, emap, getMaxCutoffRadius(), ignoreType, nnp::Mode::initialize(), initialized, nnp::Mode::loadSettingsFile(), nnp::Mode::log, mapElementToType, mapTypeToElement, maxew, myRank, nnp::reduce(), resetew, nnp::Structure::setElementMap(), nnp::Mode::setupGeneric(), nnp::Mode::setupNeuralNetworkWeights(), nnp::Mode::setupSymmetryFunctionScaling(), nnp::Mode::setupSymmetryFunctionStatistics(), showew, showewsum, nnp::ElementMap::size(), nnp::split(), nnp::strpr(), structure, TOLCUTOFF, nnp::trim(), writeExtrapolationWarnings(), and nnp::Log::writeToStdout.
Referenced by LAMMPS_NS::PairHDNNP::init_style().
void InterfaceLammps::setGlobalStructureStatus | ( | bool const | status | ) |
Specify whether n2p2 knows about global structure or only local structure.
[in] | status | true if n2p2 has global structure. |
Definition at line 257 of file InterfaceLammps.cpp.
References hasGlobalStructure.
Referenced by LAMMPS_NS::PairHDNNPDevelop::init_style().
bool InterfaceLammps::getGlobalStructureStatus | ( | ) |
Check if n2p2 knows about global structure.
Definition at line 262 of file InterfaceLammps.cpp.
References hasGlobalStructure.
Referenced by LAMMPS_NS::PairHDNNPDevelop::transferNeighborList().
void InterfaceLammps::setLocalAtoms | ( | int | numAtomsLocal, |
int const *const | atomType | ||
) |
(Re)set structure to contain only local LAMMPS atoms.
[in] | numAtomsLocal | Number of local atoms. |
[in] | atomType | LAMMPS atom type. |
Definition at line 267 of file InterfaceLammps.cpp.
References nnp::Structure::atoms, nnp::Atom::element, nnp::Structure::energy, nnp::Structure::hasNeighborList, nnp::Atom::hasSymmetryFunctionDerivatives, nnp::Structure::hasSymmetryFunctionDerivatives, nnp::Atom::hasSymmetryFunctions, nnp::Structure::hasSymmetryFunctions, ignoreType, nnp::Atom::index, nnp::Structure::index, indexMap, nnp::Atom::indexStructure, mapTypeToElement, myRank, nnp::Atom::neighbors, nnp::Structure::numAtoms, nnp::Structure::numAtomsPerElement, nnp::Mode::numElements, nnp::Atom::numNeighbors, nnp::Atom::numNeighborsPerElement, and structure.
Referenced by LAMMPS_NS::PairHDNNP::compute(), and LAMMPS_NS::PairHDNNPDevelop::compute().
void InterfaceLammps::setLocalAtomPositions | ( | double const *const *const | atomPos | ) |
Set absolute atom positions from LAMMPS (nnp/develop only).
[in] | atomPos | Atom coordinate array in LAMMPS units. |
Definition at line 306 of file InterfaceLammps.cpp.
References nnp::Structure::atoms, cflength, nnp::Mode::convLength, nnp::Mode::normalize, nnp::Structure::numAtoms, nnp::Atom::r, and structure.
Referenced by LAMMPS_NS::PairHDNNPDevelop::compute().
void InterfaceLammps::setLocalTags | ( | int const *const | atomTag | ) |
Set atom tags (int version, -DLAMMPS_SMALLBIG).
[in] | atomTag | LAMMPS atom tag. |
Definition at line 325 of file InterfaceLammps.cpp.
References nnp::Structure::atoms, and structure.
Referenced by LAMMPS_NS::PairHDNNP::compute(), and LAMMPS_NS::PairHDNNPDevelop::compute().
void InterfaceLammps::setLocalTags | ( | int64_t const *const | atomTag | ) |
Set atom tags (int64_t version, -DLAMMPS_BIGBIG).
[in] | atomTag | LAMMPS atom tag. |
Definition at line 336 of file InterfaceLammps.cpp.
References nnp::Structure::atoms, and structure.
void InterfaceLammps::setBoxVectors | ( | double const * | boxlo, |
double const * | boxhi, | ||
double const | xy, | ||
double const | xz, | ||
double const | yz | ||
) |
Set box vectors of structure stored in LAMMPS (nnp/develop only).
[in] | boxlo | Array containing coordinates of origin xlo, ylo, zlo. |
[in] | boxhi | Array containing coordinates xhi, yhi, zhi. |
[in] | xy | Tilt factor for box vector b. |
[in] | xz | First tilt factor for box vector c. |
[in] | yz | Second tilt factor for box vector c. |
Definition at line 346 of file InterfaceLammps.cpp.
References nnp::Structure::box, nnp::Structure::calculateInverseBox(), nnp::Structure::calculateVolume(), cflength, nnp::Mode::convLength, nnp::Structure::isPeriodic, nnp::Structure::isTriclinic, nnp::Mode::normalize, and structure.
Referenced by LAMMPS_NS::PairHDNNPDevelop::compute().
void InterfaceLammps::allocateNeighborlists | ( | int const *const | numneigh | ) |
Allocate neighbor lists.
[in] | numneigh | Array containing number of neighbors for each local atom. |
Definition at line 401 of file InterfaceLammps.cpp.
References nnp::Structure::atoms, nnp::Structure::numAtoms, and structure.
Referenced by LAMMPS_NS::PairHDNNPDevelop::transferNeighborList().
void InterfaceLammps::addNeighbor | ( | int | i, |
int | j, | ||
int64_t | tag, | ||
int | type, | ||
double | dx, | ||
double | dy, | ||
double | dz, | ||
double | d2 | ||
) |
Add one neighbor to atom (int64_t version, -DLAMMPS_BIGBIG).
[in] | i | Local atom index. |
[in] | j | Neighbor atom index. |
[in] | tag | Neighbor atom tag. |
[in] | type | Neighbor atom type. |
[in] | dx | Neighbor atom distance in x direction. |
[in] | dy | Neighbor atom distance in y direction. |
[in] | dz | Neighbor atom distance in z direction. |
[in] | d2 | Square of neighbor atom distance. |
If -DLAMMPS_SMALLBIG implicit conversion is applied for tag.
Definition at line 410 of file InterfaceLammps.cpp.
References nnp::Structure::atoms, cflength, nnp::Mode::convLength, nnp::Atom::Neighbor::d, nnp::Atom::Neighbor::dr, nnp::Atom::Neighbor::element, ignoreType, nnp::Atom::Neighbor::index, indexMap, mapTypeToElement, nnp::Atom::neighbors, nnp::Mode::normalize, nnp::Atom::numNeighbors, nnp::Atom::numNeighborsPerElement, structure, and nnp::Atom::Neighbor::tag.
Referenced by LAMMPS_NS::PairHDNNP::transferNeighborList(), and LAMMPS_NS::PairHDNNPDevelop::transferNeighborList().
void InterfaceLammps::finalizeNeighborList | ( | ) |
Sorts neighbor list and creates cutoff map if necessary.
If structure is periodic, this function needs to be called after setBoxVectors!
Definition at line 444 of file InterfaceLammps.cpp.
References nnp::Structure::atoms, nnp::Structure::calculateMaxCutoffRadiusOverall(), nnp::Mode::cutoffs, nnp::Mode::ewaldSetup, nnp::ScreeningFunction::getOuter(), nnp::Mode::HDNNP_4G, nnp::Mode::maxCutoffRadius, nnp::Mode::nnpType, nnp::Mode::screeningFunction, nnp::Structure::setupNeighborCutoffMap(), nnp::Structure::sortNeighborList(), and structure.
Referenced by LAMMPS_NS::PairHDNNPDevelop::transferNeighborList().
void InterfaceLammps::process | ( | ) |
Calculate symmetry functions, atomic neural networks and sum of local energy contributions.
Definition at line 463 of file InterfaceLammps.cpp.
References nnp::Mode::addEnergyOffset(), nnp::Mode::calculateAtomicNeuralNetworks(), nnp::Mode::calculateCharge(), nnp::Mode::calculateEnergy(), nnp::Mode::calculateSymmetryFunctionGroups(), nnp::Mode::calculateSymmetryFunctions(), cflength, nnp::Mode::chargeEquilibration(), nnp::Mode::convLength, nnp::Structure::energy, nnp::Mode::ewaldSetup, nnp::Mode::HDNNP_4G, nnp::Mode::HDNNP_Q, nnp::Mode::log, nnp::EwaldSetup::logEwaldCutoffs(), nnp::Mode::nnpType, nnp::Mode::normalize, nnp::Mode::physicalEnergy(), and structure.
Referenced by LAMMPS_NS::PairHDNNP::compute(), and LAMMPS_NS::PairHDNNPDevelop::compute().
double InterfaceLammps::getEnergy | ( | ) | const |
Return sum of local energy contributions.
Definition at line 511 of file InterfaceLammps.cpp.
References cfenergy, nnp::Structure::energy, and structure.
Referenced by LAMMPS_NS::PairHDNNP::compute(), and LAMMPS_NS::PairHDNNPDevelop::compute().
double InterfaceLammps::getAtomicEnergy | ( | int | index | ) | const |
Return energy contribution of one atom.
[in] | index | Atom index. |
Definition at line 516 of file InterfaceLammps.cpp.
References nnp::Structure::atoms, cfenergy, nnp::Atom::element, nnp::Mode::elements, nnp::Atom::energy, nnp::Element::getAtomicEnergyOffset(), nnp::Mode::meanEnergy, nnp::Mode::normalize, nnp::Mode::physical(), and structure.
Referenced by LAMMPS_NS::PairHDNNP::compute(), and LAMMPS_NS::PairHDNNPDevelop::compute().
void InterfaceLammps::getForces | ( | double *const *const & | atomF | ) | const |
Calculate forces and add to LAMMPS atomic force arrays.
[in,out] | atomF | LAMMPS force array for local and ghost atoms. |
Definition at line 533 of file InterfaceLammps.cpp.
References add3DVecToArray(), nnp::Structure::atoms, nnp::Structure::calculateForceLambdaTotal(), cfenergy, cflength, nnp::Mode::convEnergy, nnp::Mode::convLength, nnp::Mode::elements, nnp::Mode::HDNNP_4G, nnp::Atom::Neighbor::index, nnp::Mode::maxCutoffRadius, nnp::Mode::nnpType, nnp::Mode::normalize, nnp::Structure::numAtoms, and structure.
Referenced by LAMMPS_NS::PairHDNNP::compute(), and LAMMPS_NS::PairHDNNPDevelop::compute().
void InterfaceLammps::getCharges | ( | double *const & | atomQ | ) | const |
Transfer charges (in units of e) to LAMMPS atomic charge vector.
Call after getAtomicEnergy().
[in,out] | atomQ | LAMMPS charge vector. |
Definition at line 623 of file InterfaceLammps.cpp.
References nnp::Structure::atoms, nnp::Mode::HDNNP_4G, nnp::Mode::nnpType, nnp::Structure::numAtoms, and structure.
Referenced by LAMMPS_NS::PairHDNNPDevelop::compute().
|
inline |
Check if this interface is correctly initialized.
True
if initialized, False
otherwise. Definition at line 256 of file InterfaceLammps.h.
References initialized.
Referenced by LAMMPS_NS::PairHDNNP::init_style().
double InterfaceLammps::getMaxCutoffRadius | ( | ) | const |
Get largest cutoff of symmetry functions.
Definition at line 489 of file InterfaceLammps.cpp.
References cflength, nnp::Mode::convLength, nnp::Mode::maxCutoffRadius, and nnp::Mode::normalize.
Referenced by getMaxCutoffRadiusOverall(), and initialize().
double InterfaceLammps::getMaxCutoffRadiusOverall | ( | ) |
Get largest cutoff including structure specific cutoff and screening cutoff.
Definition at line 495 of file InterfaceLammps.cpp.
References nnp::Structure::calculateMaxCutoffRadiusOverall(), cflength, nnp::Mode::convLength, nnp::Mode::ewaldSetup, getMaxCutoffRadius(), nnp::ScreeningFunction::getOuter(), nnp::Mode::HDNNP_4G, nnp::Mode::maxCutoffRadius, nnp::Structure::maxCutoffRadiusOverall, nnp::Mode::nnpType, nnp::Mode::normalize, nnp::Mode::screeningFunction, and structure.
Referenced by LAMMPS_NS::PairHDNNPDevelop::updateNeighborlistCutoff().
long InterfaceLammps::getEWBufferSize | ( | ) | const |
Calculate buffer size for extrapolation warning communication.
Definition at line 638 of file InterfaceLammps.cpp.
References nnp::Mode::elements, and MPI_SIZE_T.
Referenced by LAMMPS_NS::PairHDNNP::handleExtrapolationWarnings().
void InterfaceLammps::fillEWBuffer | ( | char *const & | buf, |
int | bs | ||
) | const |
Fill provided buffer with extrapolation warning entries.
[in,out] | buf | Communication buffer to fill. |
[in] | bs | Buffer size. |
Definition at line 675 of file InterfaceLammps.cpp.
References nnp::Mode::elements, MPI_SIZE_T, and p.
Referenced by LAMMPS_NS::PairHDNNP::handleExtrapolationWarnings().
void InterfaceLammps::extractEWBuffer | ( | char const *const & | buf, |
int | bs | ||
) |
Extract given buffer to symmetry function statistics class.
[in] | buf | Buffer with extrapolation warnings data. |
[in] | bs | Buffer size. |
Definition at line 708 of file InterfaceLammps.cpp.
References d, nnp::Mode::elements, MPI_SIZE_T, and p.
Referenced by LAMMPS_NS::PairHDNNP::handleExtrapolationWarnings().
void InterfaceLammps::writeExtrapolationWarnings | ( | ) |
Write extrapolation warnings to log.
Definition at line 751 of file InterfaceLammps.cpp.
References nnp::Mode::elements, and nnp::Mode::log.
Referenced by LAMMPS_NS::PairHDNNP::handleExtrapolationWarnings(), and initialize().
void InterfaceLammps::clearExtrapolationWarnings | ( | ) |
Clear extrapolation warnings storage.
Definition at line 767 of file InterfaceLammps.cpp.
References nnp::Mode::elements.
Referenced by LAMMPS_NS::PairHDNNP::handleExtrapolationWarnings().
void InterfaceLammps::writeToFile | ( | std::string const | fileName, |
bool const | append | ||
) |
Write current structure to file in units used in training data.
fileName | File name of the output structure file. |
append | true if structure should be appended to existing file. |
Definition at line 778 of file InterfaceLammps.cpp.
References nnp::Mode::convCharge, nnp::Mode::convEnergy, nnp::Mode::convLength, nnp::Mode::meanEnergy, structure, nnp::Structure::toNormalizedUnits(), nnp::Structure::toPhysicalUnits(), and nnp::Structure::writeToFile().
void InterfaceLammps::add3DVecToArray | ( | double *const & | arr, |
Vec3D const & | v | ||
) | const |
Add a Vec3D vector to a 3D array in place.
[in,out] | arr | Array which is edited in place. |
[in] | v | Vector which is added to arr. |
Definition at line 786 of file InterfaceLammps.cpp.
Referenced by getForces().
|
protected |
Process rank.
Definition at line 221 of file InterfaceLammps.h.
Referenced by initialize(), and setLocalAtoms().
|
protected |
Initialization state.
Definition at line 223 of file InterfaceLammps.h.
Referenced by initialize(), and isInitialized().
|
protected |
Whether n2p2 knows about the global structure or only a local part.
Definition at line 225 of file InterfaceLammps.h.
Referenced by getGlobalStructureStatus(), and setGlobalStructureStatus().
|
protected |
Corresponds to LAMMPS showew
keyword.
Definition at line 227 of file InterfaceLammps.h.
Referenced by initialize().
|
protected |
Corresponds to LAMMPS resetew
keyword.
Definition at line 229 of file InterfaceLammps.h.
Referenced by initialize().
|
protected |
Corresponds to LAMMPS showewsum
keyword.
Definition at line 231 of file InterfaceLammps.h.
Referenced by initialize().
|
protected |
Corresponds to LAMMPS maxew
keyword.
Definition at line 233 of file InterfaceLammps.h.
Referenced by initialize().
|
protected |
Corresponds to LAMMPS cflength
keyword.
Definition at line 235 of file InterfaceLammps.h.
Referenced by addNeighbor(), getForces(), getMaxCutoffRadius(), getMaxCutoffRadiusOverall(), initialize(), process(), setBoxVectors(), and setLocalAtomPositions().
|
protected |
Corresponds to LAMMPS cfenergy
keyword.
Definition at line 237 of file InterfaceLammps.h.
Referenced by getAtomicEnergy(), getEnergy(), getForces(), and initialize().
|
protected |
Corresponds to LAMMPS map
keyword.
Definition at line 239 of file InterfaceLammps.h.
Referenced by initialize().
|
protected |
Map from LAMMPS index to n2p2 atom index.
Definition at line 241 of file InterfaceLammps.h.
Referenced by addNeighbor(), and setLocalAtoms().
|
protected |
True if atoms of this LAMMPS type will be ignored.
Definition at line 243 of file InterfaceLammps.h.
Referenced by addNeighbor(), initialize(), and setLocalAtoms().
|
protected |
Map from LAMMPS type to n2p2 element index.
Definition at line 245 of file InterfaceLammps.h.
Referenced by addNeighbor(), initialize(), and setLocalAtoms().
|
protected |
Map from n2p2 element index to LAMMPS type.
Definition at line 247 of file InterfaceLammps.h.
Referenced by initialize().
|
protected |
Structure containing local atoms.
Definition at line 249 of file InterfaceLammps.h.
Referenced by addNeighbor(), allocateNeighborlists(), finalizeNeighborList(), getAtomicEnergy(), getCharges(), getEnergy(), getForces(), getMaxCutoffRadiusOverall(), initialize(), process(), setBoxVectors(), setLocalAtomPositions(), setLocalAtoms(), setLocalTags(), and writeToFile().