1#ifndef COLVARBIAS_OPES_H
2#define COLVARBIAS_OPES_H
25#include "colvarbias.h"
36 std::vector<cvm::real> m_center;
37 std::vector<cvm::real> m_sigma;
40 const std::vector<cvm::real>& s):
41 m_height(h), m_center(c), m_sigma(s) {}
53 int init(std::string
const &conf)
override;
70 cvm::real getProbAndDerivatives(
const std::vector<cvm::real>& cv, std::vector<cvm::real>& der_prob)
const;
71 cvm::real evaluateKernel(
const kernel& G,
const std::vector<cvm::real>& x)
const;
72 cvm::real evaluateKernel(
const kernel& G,
const std::vector<cvm::real>& x, std::vector<cvm::real>& accumulated_derivative, std::vector<cvm::real>& dist)
const;
73 void addKernel(
const double height,
const std::vector<cvm::real>& center,
const std::vector<cvm::real>& sigma,
const double logweight);
74 void addKernel(
const double height,
const std::vector<cvm::real>& center,
const std::vector<cvm::real>& sigma);
75 size_t getMergeableKernel(
const std::vector<cvm::real>& giver_center,
const size_t giver_k)
const;
76 void mergeKernels(kernel& k1,
const kernel& k2)
const;
77 void updateNlist(
const std::vector<cvm::real>& center);
87 void writeTrajBuffer();
88 void showInfo()
const;
89 template <
typename OST> OST &write_state_data_template_(OST &os)
const;
90 template <
typename IST> IST &read_state_data_template_(IST &os);
91 std::string
const traj_file_name(
const std::string& suffix)
const;
92 int collectSampleToPMFGrid();
94 int writePMF(
const std::unique_ptr<colvar_grid_scalar>& pmf_grid,
const std::string &filename,
bool keep_open);
104 unsigned long long m_counter;
107 bool m_adaptive_sigma;
112 bool m_recursive_merge;
113 std::vector<cvm::real> m_nlist_param;
114 std::vector<cvm::real> m_sigma0;
115 std::vector<cvm::real> m_sigma_min;
127 std::vector<kernel> m_kernels;
128 std::vector<kernel> m_delta_kernels;
129 std::vector<cvm::real> m_av_cv;
130 std::vector<cvm::real> m_av_M2;
131 std::ostringstream m_kernels_output;
132 std::vector<cvm::real> m_nlist_center;
133 std::vector<size_t> m_nlist_index;
134 std::vector<cvm::real> m_nlist_dev2;
135 size_t m_nlist_steps;
137 bool m_nlist_pace_reset;
145 size_t m_num_walkers;
147 size_t m_num_threads;
151 std::string m_kernels_output_headers;
154 std::ostringstream m_traj_oss;
155 bool m_is_first_step;
156 std::vector<cvm::real> m_cv;
158 decltype(m_zed) m_saved_zed;
159 decltype(m_sum_weights) m_saved_sum_weights;
160 decltype(m_sum_weights2) m_saved_sum_weights2;
161 decltype(m_kernels) m_saved_kernels;
164 std::vector<colvar*> m_pmf_cvs;
165 std::unique_ptr<colvar_grid_scalar> m_reweight_grid;
166 std::unique_ptr<colvar_grid_scalar> m_pmf_grid;
169 std::unique_ptr<colvar_grid_scalar> m_global_reweight_grid;
170 std::unique_ptr<colvar_grid_scalar> m_global_pmf_grid;
Definition: colvarbias_opes.h:31
int init(std::string const &conf) override
Initializer.
Definition: colvarbias_opes.cpp:62
std::istream & read_state_data(std::istream &is) override
Read the state from a text file for restarting.
Definition: colvarbias_opes.cpp:1412
std::string replica_id
Identifier for this replica.
Definition: colvarbias_opes.h:144
Communication comm
Communication between different replicas.
Definition: colvarbias_opes.h:142
int write_output_files() override
Write to files at restart steps.
Definition: colvarbias_opes.cpp:1694
Communication
Communication between different replicas.
Definition: colvarbias_opes.h:44
@ multiple_replicas
Hills added concurrently by several replicas.
Definition: colvarbias_opes.h:48
@ single_replica
One replica (default)
Definition: colvarbias_opes.h:46
int update() override
Per-timestep update.
Definition: colvarbias_opes.cpp:1138
std::ostream & write_state_data(std::ostream &os) override
Save the state to a text file for restarting.
Definition: colvarbias_opes.cpp:1258
Collective variable bias, base class.
Definition: colvarbias.h:23
double real
Defining an abstract real number allows to switch precision.
Definition: colvarmodule.h:95
long long step_number
Use a 64-bit integer to store the step number.
Definition: colvarmodule.h:92
Definition: colvars_memstream.h:30
The Gaussian kernel data structure.
Definition: colvarbias_opes.h:34
Definition: colvarbias_opes.h:78