SSAGES
0.9.3
Software Suite for Advanced General Ensemble Simulations
|
ANN (artifical neural network) collective variables. More...
#include <ANNCV.h>
Public Member Functions | |
ANNCV (Label atomids, double scaling_factor, std::vector< unsigned int > num_nodes, std::string coeff_file, std::vector< std::string > activations, int out_index) | |
Constructor. More... | |
void | Initialize (const Snapshot &snapshot) override |
Initialize necessary variables. More... | |
std::vector< Vector > | forward_prop (Vector &input_vec) |
std::vector< Vector > | back_prop (std::vector< Vector > &output_of_layers) |
void | Evaluate (const Snapshot &snapshot) override |
Evaluate the CV. More... | |
Public Member Functions inherited from SSAGES::CollectiveVariable | |
CollectiveVariable () | |
Constructor. | |
virtual | ~CollectiveVariable () |
Destructor. | |
virtual void | Initialize (const class Snapshot &) |
Initialize CV. More... | |
virtual void | Evaluate (const class Snapshot &)=0 |
Evaluate CV. More... | |
double | GetValue () const |
Get current value of the CV. More... | |
virtual double | GetMinimumImage (double) const |
Returns the minimum image of a CV based on the input location. More... | |
virtual double | GetPeriodicValue (double location) const |
Apply periodic boundaries to a given value. More... | |
const std::vector< Vector3 > & | GetGradient () const |
Get current gradient of the CV. More... | |
const Matrix3 & | GetBoxGradient () const |
Get gradient contribution to box. More... | |
const std::array< double, 2 > & | GetBoundaries () |
Get CV boundaries. More... | |
virtual double | GetDifference (double location) const |
Static Public Member Functions | |
static ANNCV * | Build (const Json::Value &json, const std::string &path) |
Set up collective variable. More... | |
Static Public Member Functions inherited from SSAGES::CollectiveVariable | |
static CollectiveVariable * | BuildCV (const Json::Value &json, const std::string &path) |
Set up collective variable. More... | |
Private Attributes | |
Label | atomids_ |
double | scaling_factor_ |
std::vector< unsigned int > | num_nodes_ |
std::vector< Eigen::MatrixXd > | weight_coeff_ |
std::vector< Vector > | bias_ |
std::vector< std::string > | activations_ |
int | out_index_ |
Additional Inherited Members | |
Protected Attributes inherited from SSAGES::CollectiveVariable | |
std::vector< Vector3 > | grad_ |
Gradient vector dCv/dxi. | |
Matrix3 | boxgrad_ |
Gradient w.r.t box vectors dCv/dHij. | |
double | val_ |
Current value of CV. | |
std::array< double, 2 > | bounds_ |
Bounds on CV. | |
ANN (artifical neural network) collective variables.
This CV takes scaled (specified by "scaling_factor") Cartesian coordinates of a group of atoms (specified by "atomids") as inputs to a neural network (its number of nodes, connection weights, and activation functions are specified by "num_nodes", "coeff_file", "activations", respectively), computes one component (specified by "out_index") of the final neural network outputs as the CV value.
|
inline |
Constructor.
atomids | atom IDs used as inputs to ANN |
scaling_factor | scaling factor for input coordinates (input coordinates will be divided by this factor) |
num_nodes | numbers of nodes for each layer of ANN |
coeff_file | file storing weights and bias of ANN |
activations | activations functions (as strings) of ANN |
out_index | index of output component of ANN |
Definition at line 66 of file ANNCV.h.
Referenced by Build().
|
inlinestatic |
Set up collective variable.
nullptr
in case of unknown error.Builds a CV from a JSON node. Returns a pointer to the built cv. If an unknown error is encountered, this function will return a nullptr
, but generally it will throw a BuildException on failure.
Definition at line 244 of file ANNCV.h.
References ANNCV(), Json::Requirement::GetErrors(), Json::Requirement::HasErrors(), Json::ObjectRequirement::Parse(), and Json::ObjectRequirement::Validate().
Referenced by SSAGES::CollectiveVariable::BuildCV().
|
inlineoverride |
Evaluate the CV.
snapshot | Current simulation snapshot. |
Definition at line 194 of file ANNCV.h.
References SSAGES::Snapshot::CenterOfMass(), SSAGES::Snapshot::GetCommunicator(), SSAGES::Snapshot::GetLocalIndices(), SSAGES::Snapshot::GetNumAtoms(), SSAGES::Snapshot::GetPositions(), SSAGES::CollectiveVariable::grad_, and SSAGES::CollectiveVariable::val_.
|
inlineoverride |
Initialize necessary variables.
snapshot | Current simulation snapshot. |
Definition at line 128 of file ANNCV.h.
References SSAGES::Snapshot::GetCommunicator(), and SSAGES::Snapshot::GetLocalIndices().