SSAGES
0.9.3
Software Suite for Advanced General Ensemble Simulations
|
Artificial Neural Network Method. More...
#include <ANN.h>
Public Member Functions | |
ANN (const MPI_Comm &world, const MPI_Comm &comm, const Eigen::VectorXi &topol, Grid< Eigen::VectorXd > *fgrid, Grid< unsigned int > *hgrid, Grid< double > *ugrid, const std::vector< double > &lowerb, const std::vector< double > &upperb, const std::vector< double > &lowerk, const std::vector< double > &upperk, double temperature, double weight, unsigned int nsweep) | |
Constructor. More... | |
void | PreSimulation (Snapshot *snapshot, const class CVManager &cvmanager) override |
Method call prior to simulation initiation. More... | |
void | PostIntegration (Snapshot *snapshot, const class CVManager &cvmanager) override |
Method call post integration. More... | |
void | PostSimulation (Snapshot *snapshot, const class CVManager &cvmanager) override |
Method call post simulation. More... | |
void | SetPrevWeight (double h) |
Set previous history weight. More... | |
void | SetOutput (const std::string &outfile) |
Set name of output file. More... | |
void | SetOutputOverwrite (bool overwrite) |
Set overwrite flag on output file. More... | |
void | SetConvergeIters (unsigned int citers) |
Set number of iterations after which we turn on full weight. More... | |
void | SetMaxIters (unsigned int iters) |
Set maximum number of training iterations per sweep. More... | |
void | SetMinLoss (double loss) |
Set minimum loss function value (should be zero for production). More... | |
void | ReadBias (const std::string &, const std::string &) |
Load network state and bias from file. | |
Public Member Functions inherited from SSAGES::Method | |
Method (unsigned int frequency, const MPI_Comm &world, const MPI_Comm &comm) | |
Constructor. More... | |
void | SetCVMask (const std::vector< unsigned int > &mask) |
Sets the collective variable mask. More... | |
virtual | ~Method () |
Destructor. | |
Public Member Functions inherited from SSAGES::EventListener | |
EventListener (unsigned int frequency) | |
Constructor. More... | |
unsigned int | GetFrequency () const |
Get frequency of event listener. More... | |
virtual | ~EventListener () |
Destructor. | |
Static Public Member Functions | |
static ANN * | Build (const Json::Value &json, const MPI_Comm &world, const MPI_Comm &comm, const std::string &path) |
Build a derived method from JSON node. More... | |
Static Public Member Functions inherited from SSAGES::Method | |
static Method * | BuildMethod (const Json::Value &json, const MPI_Comm &world, const MPI_Comm &comm, const std::string &path) |
Build a derived method from JSON node. More... | |
Static Public Member Functions inherited from SSAGES::EventListener | |
static unsigned int | GetWalkerID (const MPI_Comm &world, const MPI_Comm &comm) |
Get walker ID number of specified communicator. More... | |
static unsigned int | GetNumWalkers (const MPI_Comm &world, const MPI_Comm &comm) |
Get total number of walkers in the simulation. More... | |
static bool | IsMasterRank (const MPI_Comm &comm) |
Check if current processor is master. More... | |
Private Member Functions | |
void | TrainNetwork () |
Trains the neural network. | |
void | WriteBias () |
Writes out the bias to file. | |
Private Attributes | |
Eigen::VectorXi | topol_ |
Neural network topology. | |
unsigned int | citers_ |
Number of iterations after which we turn on full weight. | |
nnet::neural_net | net_ |
Neural network. | |
Grid< Eigen::VectorXd > * | fgrid_ |
Force grid. | |
Grid< unsigned int > * | hgrid_ |
Histogram grid. | |
Grid< double > * | ugrid_ |
Unbiased histogram grid. | |
std::string | outfile_ |
Output filename. | |
bool | preloaded_ |
Is the network preloaded? | |
bool | overwrite_ |
Overwrite outputs? | |
unsigned int | sweep_ |
unsigned int | nsweep_ |
double | pweight_ |
double | weight_ |
double | temp_ |
double | kbt_ |
Eigen::MatrixXd | hist_ |
Eigen::MatrixXd | bias_ |
Eigen::MatrixXd | rbias_ |
std::vector< double > | lowerb_ |
std::vector< double > | upperb_ |
std::vector< double > | lowerk_ |
std::vector< double > | upperk_ |
Additional Inherited Members | |
Protected Attributes inherited from SSAGES::Method | |
mxx::comm | world_ |
Global MPI communicator. | |
mxx::comm | comm_ |
Local MPI communicator. | |
std::vector< unsigned int > | cvmask_ |
Mask which identifies which CVs to act on. | |
Artificial Neural Network Method.
Implementation of the Artificial Neural Network Method based on [3]
SSAGES::ANN::ANN | ( | const MPI_Comm & | world, |
const MPI_Comm & | comm, | ||
const Eigen::VectorXi & | topol, | ||
Grid< Eigen::VectorXd > * | fgrid, | ||
Grid< unsigned int > * | hgrid, | ||
Grid< double > * | ugrid, | ||
const std::vector< double > & | lowerb, | ||
const std::vector< double > & | upperb, | ||
const std::vector< double > & | lowerk, | ||
const std::vector< double > & | upperk, | ||
double | temperature, | ||
double | weight, | ||
unsigned int | nsweep | ||
) |
Constructor.
world | MPI global communicator. |
comm | MPI local communicator. |
topol | Topology of network. |
fgrid | Grid containing biasing forces. |
hgrid | Grid containing histogram. |
ugrid | Grid containing unbiased histogram. |
lowerb | Lower bounds for CVs. |
upperb | Upper bounds for CVs. |
lowerk | Lower bound restraints for CVs. |
upperk | Upper bound restraints for CVs. |
temperature | Temperature of the simulation. |
weight | Relative weight of the statistics in sweep. |
nsweep | Number of iterations in the sweep. |
Constructs an instance of Artificial Neural Network method.
Definition at line 34 of file ANN.cpp.
References SSAGES::Grid< T >::begin(), SSAGES::Grid< T >::end(), SSAGES::GridBase< T >::GetDimension(), hgrid_, hist_, net_, and SSAGES::GridBase< T >::size().
Referenced by Build().
|
static |
Build a derived method from JSON node.
json | JSON Value containing all input information. |
world | MPI global communicator. |
comm | MPI local communicator. |
path | Path for JSON path specification. |
This function builds a registered method from a JSON node. The difference between this function and "Build" is that this automatically determines the appropriate derived type based on the JSON node information.
Definition at line 287 of file ANN.cpp.
References ANN(), SSAGES::Grid< T >::BuildGrid(), Json::Requirement::GetErrors(), Json::Requirement::HasErrors(), Json::ObjectRequirement::Parse(), and Json::ObjectRequirement::Validate().
|
overridevirtual |
Method call post integration.
snapshot | Pointer to the simulation snapshot. |
cvmanager | Collective variable manager. |
This function will be called after each integration step.
Implements SSAGES::Method.
Definition at line 113 of file ANN.cpp.
References SSAGES::GridBase< T >::at(), citers_, SSAGES::Method::comm_, SSAGES::Method::cvmask_, SSAGES::CVManager::GetCVs(), SSAGES::Snapshot::GetForces(), SSAGES::Snapshot::GetIteration(), SSAGES::GridBase< T >::GetLower(), SSAGES::GridBase< T >::GetUpper(), SSAGES::Snapshot::GetVirial(), hgrid_, SSAGES::EventListener::IsMasterRank(), lowerb_, lowerk_, net_, pweight_, TrainNetwork(), SSAGES::Method::world_, and WriteBias().
|
overridevirtual |
Method call post simulation.
snapshot | Pointer to the simulation snapshot. |
cvmanager | Collective variable manager. |
This function will be called after the end of the simulation run.
Implements SSAGES::Method.
|
overridevirtual |
Method call prior to simulation initiation.
snapshot | Pointer to the simulation snapshot. |
cvmanager | Collective variable manager. |
This function will be called before the simulation is started.
Implements SSAGES::Method.
Definition at line 76 of file ANN.cpp.
References SSAGES::Grid< T >::begin(), SSAGES::Method::cvmask_, SSAGES::Grid< T >::end(), fgrid_, SSAGES::CVManager::GetCVs(), SSAGES::GridBase< T >::GetDimension(), SSAGES::Snapshot::GetKb(), hgrid_, hist_, lowerb_, lowerk_, net_, preloaded_, temp_, TrainNetwork(), and ugrid_.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Set overwrite flag on output file.
overwrite | Boolean if output file should be overwritten |
Definition at line 166 of file ANN.h.
References overwrite_.
|
inline |
|
private |
Eigen matrices of grids.
Definition at line 73 of file ANN.h.
Referenced by ANN(), PreSimulation(), ReadBias(), TrainNetwork(), and WriteBias().
|
private |
|
private |
Bound restraints.
Definition at line 83 of file ANN.h.
Referenced by PostIntegration(), and PreSimulation().
|
private |
Previous and current histogram weight.
Definition at line 54 of file ANN.h.
Referenced by PostIntegration(), SetPrevWeight(), and TrainNetwork().
|
private |
Number of iterations per sweep.
Definition at line 43 of file ANN.h.
Referenced by TrainNetwork(), and WriteBias().
|
private |
System temperature and energy units.
Definition at line 59 of file ANN.h.
Referenced by PreSimulation().