23 #include "Grids/Grid.h"
24 #include "nnet/nnet.h"
73 Eigen::MatrixXd
hist_, bias_, rbias_;
120 ANN(
const MPI_Comm& world,
121 const MPI_Comm& comm,
122 const Eigen::VectorXi& topol,
126 const std::vector<double>& lowerb,
127 const std::vector<double>& upperb,
128 const std::vector<double>& lowerk,
129 const std::vector<double>& upperk,
186 auto params =
net_.get_train_params();
187 params.max_iter = iters;
188 net_.set_train_params(params);
197 auto params =
net_.get_train_params();
198 params.min_loss = loss;
199 net_.set_train_params(params);
203 void ReadBias(
const std::string&,
const std::string&);
207 const Json::Value& json,
208 const MPI_Comm& world,
209 const MPI_Comm& comm,
210 const std::string& path);
Artificial Neural Network Method.
std::vector< double > lowerb_
void SetMinLoss(double loss)
Set minimum loss function value (should be zero for production).
void PostSimulation(Snapshot *snapshot, const class CVManager &cvmanager) override
Method call post simulation.
Grid< unsigned int > * hgrid_
Histogram grid.
std::vector< double > lowerk_
void SetConvergeIters(unsigned int citers)
Set number of iterations after which we turn on full weight.
void SetMaxIters(unsigned int iters)
Set maximum number of training iterations per sweep.
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.
void SetOutput(const std::string &outfile)
Set name of output file.
bool preloaded_
Is the network preloaded?
void TrainNetwork()
Trains the neural network.
void PreSimulation(Snapshot *snapshot, const class CVManager &cvmanager) override
Method call prior to simulation initiation.
Grid< Eigen::VectorXd > * fgrid_
Force grid.
nnet::neural_net net_
Neural network.
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.
void ReadBias(const std::string &, const std::string &)
Load network state and bias from file.
void SetPrevWeight(double h)
Set previous history weight.
unsigned int citers_
Number of iterations after which we turn on full weight.
Eigen::VectorXi topol_
Neural network topology.
void WriteBias()
Writes out the bias to file.
void PostIntegration(Snapshot *snapshot, const class CVManager &cvmanager) override
Method call post integration.
std::string outfile_
Output filename.
Grid< double > * ugrid_
Unbiased histogram grid.
bool overwrite_
Overwrite outputs?
void SetOutputOverwrite(bool overwrite)
Set overwrite flag on output file.
Collective variable manager.
Interface for Method implementations.
Class containing a snapshot of the current simulation in time.