SSAGES  0.9.3
Software Suite for Advanced General Ensemble Simulations
Public Member Functions | Private Member Functions | Private Attributes | List of all members
SSAGES::ElasticBand Class Reference

Multi-walker Elastic Band. More...

#include <ElasticBand.h>

Inheritance diagram for SSAGES::ElasticBand:
Inheritance graph
[legend]

Public Member Functions

 ElasticBand (const MPI_Comm &world, const MPI_Comm &comm, const std::vector< double > &centers, unsigned int maxiterations, unsigned int nsamples, double tau, const std::vector< double > cvspring, unsigned int equilibrate, unsigned int evolution, double stringspring, unsigned int frequency)
 Constructor. More...
 
void PostIntegration (Snapshot *snapshot, const class CVManager &cvmanager) override
 Post-integration hook. More...
 
 ~ElasticBand ()
 Destructor.
 
- Public Member Functions inherited from SSAGES::StringMethod
 StringMethod (const MPI_Comm &world, const MPI_Comm &comm, const std::vector< double > &centers, unsigned int maxiterations, const std::vector< double > cvspring, unsigned int frequency)
 Constructor. More...
 
void PreSimulation (Snapshot *snapshot, const class CVManager &cvmanager) override
 Method call prior to simulation initiation. More...
 
void PostSimulation (Snapshot *snapshot, const class CVManager &cvmanager) override
 Method call post simulation. More...
 
void SetTolerance (std::vector< double > tol)
 Set the tolerance for quitting method. More...
 
void SetSendRecvNeighbors ()
 Communicate neighbor lists over MPI.
 
virtual ~StringMethod ()
 Destructor.
 
- 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.
 

Private Member Functions

void StringUpdate () override
 Updates the nudged elastic band string.
 

Private Attributes

unsigned int equilibrate_
 
unsigned int evolution_
 
unsigned int nsamples_
 Block iterations.
 
unsigned int nsampled_
 Number samples actually sampled.
 
double tau_
 Time step of string change.
 
double stringspring_
 String spring constant.
 

Additional Inherited Members

- Static Public Member Functions inherited from SSAGES::StringMethod
static StringMethodBuild (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 MethodBuildMethod (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...
 
- Protected Member Functions inherited from SSAGES::StringMethod
double distance (const std::vector< double > &x, const std::vector< double > &y) const
 Helper function for calculating distances. More...
 
void PrintString (const CVList &CV)
 Prints the CV positions to file. More...
 
void GatherNeighbors (std::vector< double > *lcv0, std::vector< double > *ucv0)
 Gather neighbors over MPI. More...
 
void StringReparam (double alpha_star)
 Reparameterize the string. More...
 
void UpdateWorldString (const CVList &cvs)
 Update the world string over MPI. More...
 
bool TolCheck () const
 Check whether tolerance criteria have been met. More...
 
bool CheckEnd (const CVList &CV)
 Check if method reached one of the exit criteria. More...
 
- Protected Attributes inherited from SSAGES::StringMethod
std::vector< double > centers_
 CV starting location values.
 
std::vector< double > newcenters_
 CV starting location values.
 
std::vector< std::vector< double > > worldstring_
 The world's strings centers for each CV. More...
 
int mpiid_
 The node this belongs to.
 
std::vector< double > tol_
 Tolerance criteria for determining when to stop string (default 0 if no tolerance criteria)
 
int numnodes_
 Number of nodes on a string.
 
unsigned int maxiterator_
 Maximum cap on number of string method iterations performed.
 
std::vector< double > cvspring_
 Vector of spring constants.
 
unsigned int iterator_
 The local method iterator.
 
unsigned int iteration_
 The global method iteration.
 
std::ofstream stringout_
 Output stream for string data.
 
int sendneigh_
 Neighbor to send info to.
 
int recneigh_
 Neighbor to gain info from.
 
std::vector< std::vector< double > > prev_positions_
 Store positions for starting trajectories.
 
std::vector< std::vector< double > > prev_velocities_
 Store velocities for starting trajectories.
 
std::vector< std::vector< int > > prev_IDs_
 Store atom IDs for starting trajectories.
 
- 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.
 

Detailed Description

Multi-walker Elastic Band.

Implementation of a multi-walker Elastic Band method with no bells and whistles.

Definition at line 34 of file ElasticBand.h.

Constructor & Destructor Documentation

◆ ElasticBand()

SSAGES::ElasticBand::ElasticBand ( const MPI_Comm &  world,
const MPI_Comm &  comm,
const std::vector< double > &  centers,
unsigned int  maxiterations,
unsigned int  nsamples,
double  tau,
const std::vector< double >  cvspring,
unsigned int  equilibrate,
unsigned int  evolution,
double  stringspring,
unsigned int  frequency 
)
inline

Constructor.

Parameters
worldMPI global communicator.
commMPI local communicator.
centersList of centers.
maxiterationsMaximum number of iterations.
nsamplesNumber of samples to collect before updating string.
tauValue of tau (default: 0.1).
cvspringSpring constants for cvs.
equilibrateNumber of MD steps to allow the system to reequilibrate after updating string.
evolutionNumber of MD steps to allow the system to evolve before gathering statistics.
stringspringSpring constant used between nodes.
frequencyFrequency with which this method is invoked.

Constructs an instance of Elastic Band method.

Definition at line 77 of file ElasticBand.h.

87  :
88  StringMethod(world, comm, centers, maxiterations,
89  cvspring, frequency), equilibrate_(equilibrate),
90  evolution_(evolution), nsamples_(nsamples),
91  nsampled_(0), tau_(tau), stringspring_(stringspring)
92  {
93  }
unsigned int equilibrate_
Definition: ElasticBand.h:39
unsigned int nsampled_
Number samples actually sampled.
Definition: ElasticBand.h:49
double stringspring_
String spring constant.
Definition: ElasticBand.h:55
double tau_
Time step of string change.
Definition: ElasticBand.h:52
unsigned int evolution_
Definition: ElasticBand.h:43
unsigned int nsamples_
Block iterations.
Definition: ElasticBand.h:46
StringMethod(const MPI_Comm &world, const MPI_Comm &comm, const std::vector< double > &centers, unsigned int maxiterations, const std::vector< double > cvspring, unsigned int frequency)
Constructor.
Definition: StringMethod.h:176

Member Function Documentation

◆ PostIntegration()

void SSAGES::ElasticBand::PostIntegration ( Snapshot snapshot,
const class CVManager cvmanager 
)
overridevirtual

Post-integration hook.

Parameters
snapshotCurrent simulation snapshot.
cvmanagerCollective variable manager.

Implements SSAGES::StringMethod.

Definition at line 30 of file ElasticBand.cpp.

31  {
32  auto& forces = snapshot->GetForces();
33  auto cvs = cvmanager.GetCVs(cvmask_);
34 
35  // Apply umbrella to CVs.
36  for(size_t i = 0; i < cvs.size(); ++i)
37  {
38  // Get current CV and gradient.
39  auto& cv = cvs[i];
40  auto& grad = cv->GetGradient();
41 
42  // Compute dV/dCV.
43  auto diff = cv->GetDifference(centers_[i]);
44  auto D = cvspring_[i] * diff;
45 
46  // Update forces.
47  for(size_t j = 0; j < forces.size(); ++j)
48  for(int k = 0; k < forces[j].size(); ++k)
49  forces[j][k] -= D*grad[j][k];
50 
51  // If not equilibrating and has evolved enough steps,
52  // generate the gradient
54  {
55  newcenters_[i] += D;
56  nsampled_++;
57  }
58  }
59 
60  // Restart iteration and zero gradients when moving onto
61  // next elastic band iteration
63  {
64  StringUpdate();
65  CheckEnd(cvs);
66  UpdateWorldString(cvs);
67  PrintString(cvs);
68 
69  iterator_ = 0;
70 
71  for(size_t ii = 0; ii < newcenters_.size(); ii++)
72  newcenters_[ii] = 0;
73 
74  nsampled_ = 0;
75  iteration_++;
76  }
77 
78  iterator_++;
79  }
void StringUpdate() override
Updates the nudged elastic band string.
Definition: ElasticBand.cpp:81
std::vector< unsigned int > cvmask_
Mask which identifies which CVs to act on.
Definition: Method.h:50
std::vector< double > cvspring_
Vector of spring constants.
Definition: StringMethod.h:67
void UpdateWorldString(const CVList &cvs)
Update the world string over MPI.
std::vector< double > centers_
CV starting location values.
Definition: StringMethod.h:43
bool CheckEnd(const CVList &CV)
Check if method reached one of the exit criteria.
unsigned int iteration_
The global method iteration.
Definition: StringMethod.h:73
void PrintString(const CVList &CV)
Prints the CV positions to file.
unsigned int iterator_
The local method iterator.
Definition: StringMethod.h:70
std::vector< double > newcenters_
CV starting location values.
Definition: StringMethod.h:46

References SSAGES::StringMethod::centers_, SSAGES::StringMethod::CheckEnd(), SSAGES::Method::cvmask_, SSAGES::StringMethod::cvspring_, equilibrate_, evolution_, SSAGES::CVManager::GetCVs(), SSAGES::Snapshot::GetForces(), SSAGES::StringMethod::iteration_, SSAGES::StringMethod::iterator_, SSAGES::StringMethod::newcenters_, nsampled_, nsamples_, SSAGES::StringMethod::PrintString(), StringUpdate(), and SSAGES::StringMethod::UpdateWorldString().

Here is the call graph for this function:

Member Data Documentation

◆ equilibrate_

unsigned int SSAGES::ElasticBand::equilibrate_
private

Number Equilibration steps, number of MD steps to allow the system to reequilibrate before evolving.

Definition at line 39 of file ElasticBand.h.

Referenced by PostIntegration().

◆ evolution_

unsigned int SSAGES::ElasticBand::evolution_
private

Number evolution steps, number of MD steps before collecting statistics for gradients.

Definition at line 43 of file ElasticBand.h.

Referenced by PostIntegration().


The documentation for this class was generated from the following files: