SSAGES  0.8.5
Software Suite for Advanced General Ensemble Simulations
Swarm.h
1 
20 #include "StringMethod.h"
21 #include <fstream>
22 #include <iostream>
23 
24 namespace SSAGES
25 {
27 
32  class Swarm : public StringMethod //Calls Method constructor first, then Swarm constructor
33  {
34  private:
35 
37  std::vector<double> cv_drift_;
38 
40  unsigned int initialize_steps_;
41 
43  unsigned int harvest_length_;
44 
46  unsigned int restrained_steps_;
47 
49  unsigned int number_trajectories_;
50 
52  unsigned int swarm_length_;
53 
55  unsigned int unrestrained_steps_;
56 
58  unsigned int index_;
59 
61  std::vector<Label> traj_atomids_;
62 
64  void StringUpdate() override;
65 
67 
72  bool CVInitialized(const CVList& cvs);
73 
76 
79 
82 
85 
86  public:
87 
89 
103  Swarm(const MPI_Comm& world,
104  const MPI_Comm& comm,
105  const std::vector<double>& centers,
106  unsigned int maxiterations,
107  const std::vector<double> cvspring,
108  unsigned int frequency,
109  unsigned int InitialSteps,
110  unsigned int HarvestLength,
111  unsigned int NumberTrajectories,
112  unsigned int SwarmLength) :
113  StringMethod(world, comm, centers, maxiterations, cvspring, frequency),
114  cv_drift_(),
115  initialize_steps_(InitialSteps),
116  harvest_length_(HarvestLength),
117  number_trajectories_(NumberTrajectories),
118  swarm_length_(SwarmLength)
119  {
120  cv_drift_.resize(centers_.size(), 0);
121  prev_positions_.resize(number_trajectories_);
122  prev_velocities_.resize(number_trajectories_);
123  prev_IDs_.resize(number_trajectories_);
124  //Additional initializing
125 
126  index_ = 0;
127  restrained_steps_ = harvest_length_*number_trajectories_;
128  unrestrained_steps_ = swarm_length_*number_trajectories_;
129  sampling_started = false;
130  snapshot_stored = false;
131 
132  iterator_ = 0; //Override default StringMethod.h initializing
133  }
134 
137  void PostIntegration(Snapshot* snapshot, const class CVManager& cvmanager) override;
138 
140  ~Swarm() {}
141  };
142 }
143 
Collective variable manager.
Definition: CVManager.h:42
unsigned int initialize_steps_
Total number of MD steps for initialization for one iteration.
Definition: Swarm.h:40
bool original_initialized
Flag for whether a system was initialized before it checked whether other systems were...
Definition: Swarm.h:84
bool CVInitialized(const CVList &cvs)
Helper function check if CVs are initialized correctly.
Definition: Swarm.cpp:35
std::vector< CollectiveVariable * > CVList
List of Collective Variables.
Definition: types.h:51
String base class for FTS, Swarm, and elastic band.
Definition: StringMethod.h:38
std::vector< std::vector< double > > prev_velocities_
Store velocities for starting trajectories.
Definition: StringMethod.h:88
int initialized
Flag for whether a system is initialized at a given iteration.
Definition: Swarm.h:81
~Swarm()
Destructor.
Definition: Swarm.h:140
Class containing a snapshot of the current simulation in time.
Definition: Snapshot.h:47
std::vector< double > centers_
CV starting location values.
Definition: StringMethod.h:43
std::vector< double > cv_drift_
Drift of CVs for one iteration.
Definition: Swarm.h:37
unsigned int swarm_length_
Length of unrestrained trajectories.
Definition: Swarm.h:52
bool sampling_started
Flag for determing whether to perform initialization or not.
Definition: Swarm.h:75
Swarm of Trajectories String Method.
Definition: Swarm.h:32
void PostIntegration(Snapshot *snapshot, const class CVManager &cvmanager) override
Method call post integration.
Definition: Swarm.cpp:70
Swarm(const MPI_Comm &world, const MPI_Comm &comm, const std::vector< double > &centers, unsigned int maxiterations, const std::vector< double > cvspring, unsigned int frequency, unsigned int InitialSteps, unsigned int HarvestLength, unsigned int NumberTrajectories, unsigned int SwarmLength)
Constructor.
Definition: Swarm.h:103
bool snapshot_stored
Flag for whether a snapshot was stored in the umbrella sampling.
Definition: Swarm.h:78
std::vector< std::vector< int > > prev_IDs_
Store atom IDs for starting trajectories.
Definition: StringMethod.h:91
unsigned int number_trajectories_
Number of trajectories per swarm.
Definition: Swarm.h:49
unsigned int harvest_length_
Length to run before harvesting a trajectory for unrestrained sampling.
Definition: Swarm.h:43
unsigned int restrained_steps_
Total number of restrained MD steps for one iteration.
Definition: Swarm.h:46
std::vector< Label > traj_atomids_
Store atom IDs for starting trajecotires.
Definition: Swarm.h:61
unsigned int iterator_
The local method iterator.
Definition: StringMethod.h:70
unsigned int unrestrained_steps_
Total number of unrestrained MD steps for one iteration.
Definition: Swarm.h:55
unsigned int index_
For indexing trajectory vectors.
Definition: Swarm.h:58
void StringUpdate() override
Updates the positions of the string.
Definition: Swarm.cpp:280
std::vector< std::vector< double > > prev_positions_
Store positions for starting trajectories.
Definition: StringMethod.h:85