n2p2 - A neural network potential package
|
#include <Prediction.h>
Public Member Functions | |
Prediction () | |
void | readStructureFromFile (std::string const &fileName="input.data") |
void | setup () |
void | predict () |
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... | |
Public Attributes | |
std::string | fileNameSettings |
std::string | fileNameScaling |
std::string | formatWeightsFilesShort |
std::string | formatWeightsFilesCharge |
Structure | structure |
Public Attributes inherited from nnp::Mode | |
ElementMap | elementMap |
Global element map, populated by setupElementMap(). More... | |
Log | log |
Global log file. More... | |
Additional Inherited Members | |
Public Types inherited from nnp::Mode | |
enum class | NNPType { HDNNP_2G = 2 , HDNNP_4G = 4 , HDNNP_Q = 10 } |
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... | |
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 |
Definition at line 27 of file Prediction.h.
Prediction::Prediction | ( | ) |
Definition at line 26 of file Prediction.cpp.
void Prediction::readStructureFromFile | ( | std::string const & | fileName = "input.data" | ) |
Definition at line 48 of file Prediction.cpp.
References nnp::Mode::convCharge, nnp::Mode::convEnergy, nnp::Mode::convLength, nnp::Mode::elementMap, nnp::Mode::meanEnergy, nnp::Mode::normalize, nnp::Structure::readFromFile(), nnp::Mode::removeEnergyOffset(), nnp::Structure::reset(), nnp::Structure::setElementMap(), structure, and nnp::Structure::toNormalizedUnits().
Referenced by main().
void Prediction::setup | ( | ) |
Definition at line 34 of file Prediction.cpp.
References fileNameScaling, fileNameSettings, formatWeightsFilesCharge, formatWeightsFilesShort, nnp::Mode::initialize(), nnp::Mode::loadSettingsFile(), nnp::Mode::setupGeneric(), nnp::Mode::setupNeuralNetworkWeights(), nnp::Mode::setupSymmetryFunctionScaling(), and nnp::Mode::setupSymmetryFunctionStatistics().
Referenced by main().
void Prediction::predict | ( | ) |
Definition at line 65 of file Prediction.cpp.
References nnp::Mode::addEnergyOffset(), nnp::Mode::convCharge, nnp::Mode::convEnergy, nnp::Mode::convLength, nnp::Mode::evaluateNNP(), nnp::Mode::meanEnergy, nnp::Mode::normalize, structure, and nnp::Structure::toPhysicalUnits().
Referenced by main().
std::string nnp::Prediction::fileNameSettings |
Definition at line 35 of file Prediction.h.
Referenced by setup().
std::string nnp::Prediction::fileNameScaling |
Definition at line 36 of file Prediction.h.
Referenced by setup().
std::string nnp::Prediction::formatWeightsFilesShort |
Definition at line 37 of file Prediction.h.
Referenced by setup().
std::string nnp::Prediction::formatWeightsFilesCharge |
Definition at line 38 of file Prediction.h.
Referenced by setup().
Structure nnp::Prediction::structure |
Definition at line 39 of file Prediction.h.
Referenced by main(), predict(), and readStructureFromFile().