Collective Variables Module - Developer Documentation
Loading...
Searching...
No Matches
colvarbias_alb.h
1// -*- c++ -*-
2
3// This file is part of the Collective Variables module (Colvars).
4// The original version of Colvars and its updates are located at:
5// https://github.com/Colvars/colvars
6// Please update all Colvars source files before making any changes.
7// If you wish to distribute your changes, please submit them to the
8// Colvars repository at GitHub.
9
10#ifndef COLVARBIAS_ALB_H
11#define COLVARBIAS_ALB_H
12
13#include "colvar.h"
14#include "colvarbias.h"
15
16
17class colvarbias_alb : public colvarbias {
18
19public:
20
21 colvarbias_alb(char const *key);
22 virtual ~colvarbias_alb();
23 virtual int init(std::string const &conf);
24 virtual int update();
25
26 virtual std::string const get_state_params() const;
27 virtual int set_state_params(std::string const &conf);
28 virtual std::ostream & write_traj_label(std::ostream &os);
29 virtual std::ostream & write_traj(std::ostream &os);
30
31protected:
32
34 std::vector<colvarvalue> colvar_centers;
35
37 std::vector<cvm::real> means;
38 std::vector<cvm::real> ssd; // SSD = sum of squares of differences from mean
39 int update_calls;
40
43
45 std::vector<cvm::real> max_coupling_range;
46
47 //\brief Estimated max for how quickly the rate can change in kT / time
48 std::vector<cvm::real> max_coupling_rate;
49
51 std::vector<cvm::real> coupling_accum;
52
54 std::vector<cvm::real> set_coupling;
55
57 std::vector<cvm::real> current_coupling;
58
60 std::vector<cvm::real> coupling_rate;
61
62 // \brief if we're equilibrating our estimates or collecting data
63 bool b_equilibration;
64
65 // \brief If the coupling range should be increased
66 bool b_hard_coupling_range;
67
68
71
74
77
78 cvm::real restraint_potential(cvm::real k, const colvar* x, const colvarvalue& xcenter) const;
79
81 colvarvalue restraint_force(cvm::real k, const colvar* x, const colvarvalue& xcenter) const;
82
84 cvm::real restraint_convert_k(cvm::real k, cvm::real dist_measure) const;
85
86};
87
88#endif
A collective variable (main class); to be defined, it needs at least one object of a derived class of...
Definition: colvar.h:53
Definition: colvarbias_alb.h:17
std::vector< cvm::real > current_coupling
current coupling constant, which is ramped up during equilibration to coupling
Definition: colvarbias_alb.h:57
std::vector< cvm::real > means
colvar parameters, used for calculating the gradient/variance
Definition: colvarbias_alb.h:37
std::vector< cvm::real > coupling_accum
accumated couping force; used in stochastic online gradient descent algorithm
Definition: colvarbias_alb.h:51
virtual int init(std::string const &conf)
Parse config string and (re)initialize.
Definition: colvarbias_alb.cpp:39
int update_freq
how often to update coupling constant
Definition: colvarbias_alb.h:42
std::vector< colvarvalue > colvar_centers
Restraint centers.
Definition: colvarbias_alb.h:34
bool b_output_grad
flag for outputting current gradient
Definition: colvarbias_alb.h:73
virtual int set_state_params(std::string const &conf)
Read the values of specific mutable properties from a string.
Definition: colvarbias_alb.cpp:258
virtual int update()
Definition: colvarbias_alb.cpp:148
virtual std::ostream & write_traj(std::ostream &os)
Output quantities such as the bias energy to the trajectory file.
Definition: colvarbias_alb.cpp:378
std::vector< cvm::real > coupling_rate
how quickly to change the coupling constant
Definition: colvarbias_alb.h:60
bool b_output_centers
flag for outputting colvar centers
Definition: colvarbias_alb.h:70
virtual std::ostream & write_traj_label(std::ostream &os)
Write a label to the trajectory file (comment line)
Definition: colvarbias_alb.cpp:346
colvarvalue restraint_force(cvm::real k, const colvar *x, const colvarvalue &xcenter) const
Force function.
Definition: colvarbias_alb.cpp:422
cvm::real restraint_convert_k(cvm::real k, cvm::real dist_measure) const
Unit scaling.
Definition: colvarbias_alb.cpp:430
std::vector< cvm::real > set_coupling
coupling constant
Definition: colvarbias_alb.h:54
std::vector< cvm::real > max_coupling_range
Estimated range of coupling constant values in kT.
Definition: colvarbias_alb.h:45
bool b_output_coupling
flag for outputting coupling constant
Definition: colvarbias_alb.h:76
virtual std::string const get_state_params() const
Write the values of specific mutable properties to a string.
Definition: colvarbias_alb.cpp:297
Collective variable bias, base class.
Definition: colvarbias.h:23
double real
Defining an abstract real number allows to switch precision.
Definition: colvarmodule.h:95
Value of a collective variable: this is a metatype which can be set at runtime. By default it is set ...
Definition: colvarvalue.h:43