SSAGES  0.8.5
Software Suite for Advanced General Ensemble Simulations
Meta.h
1 
22 #pragma once
23 
24 #include "Method.h"
25 #include "Grids/Grid.h"
26 #include <fstream>
27 #include <vector>
28 
29 namespace SSAGES
30 {
32 
37  struct Hill
38  {
40  std::vector<double> center;
41 
43  std::vector<double> width;
44 
46  double height;
47 
49 
54  Hill(const std::vector<double>& center,
55  const std::vector<double>& sigma,
56  double height) :
57  center(center), width(sigma), height(height)
58  {}
59  };
60 
62 
68  class Meta : public Method
69  {
70  private:
72  std::vector<Hill> hills_;
73 
75  double height_;
76 
78  std::vector<double> widths_;
79 
82  std::vector<double> derivatives_, tder_, dx_;
84 
86  unsigned int hillfreq_;
87 
90 
93  std::vector<double> upperb_, lowerb_;
95 
98  std::vector<double> upperk_, lowerk_;
100 
102 
106  void AddHill(const CVList& cvs, int iteration);
107 
109 
112  void CalcBiasForce(const CVList& cvs);
113 
115 
119  void PrintHill(const Hill& hill, int iteration);
120 
122  std::ofstream hillsout_;
123 
124  public:
126 
143  Meta(const MPI_Comm& world,
144  const MPI_Comm& comm,
145  double height,
146  const std::vector<double>& widths,
147  const std::vector<double>& lowerb,
148  const std::vector<double>& upperb,
149  const std::vector<double>& lowerk,
150  const std::vector<double>& upperk,
151  Grid<Vector>* grid,
152  unsigned int hillfreq,
153  unsigned int frequency) :
154  Method(frequency, world, comm), hills_(), height_(height), widths_(widths),
155  derivatives_(0), tder_(0), dx_(0), hillfreq_(hillfreq), grid_(grid),
156  upperb_(upperb), lowerb_(lowerb), upperk_(upperk), lowerk_(lowerk)
157  {
158  }
159 
161 
165  void PreSimulation(Snapshot* snapshot, const class CVManager& cvmanager) override;
166 
168 
172  void PostIntegration(Snapshot* snapshot, const class CVManager& cvmanager) override;
173 
175 
179  void PostSimulation(Snapshot* snapshot, const class CVManager& cvmanager) override;
180 
182 
189  void LoadHills(const std::string& filename);
190 
192  static Meta* Build(const Json::Value& json,
193  const MPI_Comm& world,
194  const MPI_Comm& comm,
195  const std::string& path);
196 
198  ~Meta() {}
199  };
200 }
201 
Collective variable manager.
Definition: CVManager.h:42
std::vector< CollectiveVariable * > CVList
List of Collective Variables.
Definition: types.h:51
~Meta()
Destructor.
Definition: Meta.h:198
Class containing a snapshot of the current simulation in time.
Definition: Snapshot.h:47
unsigned int hillfreq_
Frequency of new hills.
Definition: Meta.h:86
Interface for Method implementations.
Definition: Method.h:43
std::vector< double > upperb_
Definition: Meta.h:93
Meta(const MPI_Comm &world, const MPI_Comm &comm, double height, const std::vector< double > &widths, const std::vector< double > &lowerb, const std::vector< double > &upperb, const std::vector< double > &lowerk, const std::vector< double > &upperk, Grid< Vector > *grid, unsigned int hillfreq, unsigned int frequency)
Constructor.
Definition: Meta.h:143
std::vector< Hill > hills_
Hills.
Definition: Meta.h:72
"Vanilla" multi-dimensional Metadynamics.
Definition: Meta.h:68
std::vector< double > upperk_
Definition: Meta.h:98
Multidimensional hill.
Definition: Meta.h:37
std::vector< double > center
Hill center.
Definition: Meta.h:40
std::vector< double > derivatives_
Definition: Meta.h:82
Grid< Vector > * grid_
CV Grid.
Definition: Meta.h:89
double height
Hill height.
Definition: Meta.h:46
Hill(const std::vector< double > &center, const std::vector< double > &sigma, double height)
Constructs a multidimensional Hill (Gaussian)
Definition: Meta.h:54
std::vector< double > width
Hill width.
Definition: Meta.h:43
std::vector< double > widths_
Hill widths.
Definition: Meta.h:78
std::ofstream hillsout_
Output stream for hill data.
Definition: Meta.h:122
double height_
Hill height.
Definition: Meta.h:75