3
#ifndef COLVARBIAS_RESTRAINT_H
4
#define COLVARBIAS_RESTRAINT_H
6
#include "colvarbias.h"
8
/// \brief Bias restraint, optionally moving towards a target
9
/// (implementation of \link colvarbias \endlink)
10
class colvarbias_restraint : public colvarbias {
14
/// Retrieve colvar values and calculate their biasing forces
15
virtual cvm::real update();
17
/// Load new configuration - force constant and/or centers only
18
virtual void change_configuration(std::string const &conf);
20
/// Calculate change in energy from using alternate configuration
21
virtual cvm::real energy_difference(std::string const &conf);
23
/// Read the bias configuration from a restart file
24
virtual std::istream & read_restart(std::istream &is);
26
/// Write the bias configuration to a restart file
27
virtual std::ostream & write_restart(std::ostream &os);
29
/// Write a label to the trajectory file (comment line)
30
virtual std::ostream & write_traj_label(std::ostream &os);
32
/// Output quantities such as the bias energy to the trajectory file
33
virtual std::ostream & write_traj(std::ostream &os);
35
/// \brief Constructor
36
colvarbias_restraint(std::string const &conf, char const *key);
39
virtual ~colvarbias_restraint();
44
/// \brief Potential function
45
virtual cvm::real restraint_potential(cvm::real k, colvar* x, const colvarvalue& xcenter) const = 0;
47
/// \brief Force function
48
virtual colvarvalue restraint_force(cvm::real k, colvar* x, const colvarvalue& xcenter) const = 0;
50
///\brief Unit scaling
51
virtual cvm::real restraint_convert_k(cvm::real k, cvm::real dist_measure) const = 0;
53
/// \brief Restraint centers
54
std::vector<colvarvalue> colvar_centers;
56
/// \brief Restraint centers without wrapping or constraints applied
57
std::vector<colvarvalue> colvar_centers_raw;
59
/// \brief Moving target?
62
/// \brief New restraint centers
63
std::vector<colvarvalue> target_centers;
65
/// \brief Amplitude of the restraint centers' increment at each step
66
/// (or stage) towards the new values (calculated from target_nsteps)
67
std::vector<colvarvalue> centers_incr;
69
/// Whether to write the current restraint centers to the trajectory file
70
bool b_output_centers;
72
/// Whether to write the current accumulated work to the trajectory file
73
bool b_output_acc_work;
75
/// \brief Accumulated work
78
/// \brief Restraint force constant
81
/// \brief Changing force constant?
84
/// \brief Restraint force constant (target value)
85
cvm::real target_force_k;
87
/// \brief Restraint force constant (starting value)
88
cvm::real starting_force_k;
90
/// \brief Lambda-schedule for custom varying force constant
91
std::vector<cvm::real> lambda_schedule;
93
/// \brief Exponent for varying the force constant
94
cvm::real force_k_exp;
96
/// \brief Intermediate quantity to compute the restraint free energy
97
/// (in TI, would be the accumulating FE derivative)
98
cvm::real restraint_FE;
101
/// \brief Equilibration steps for restraint FE calculation through TI
102
cvm::real target_equil_steps;
104
/// \brief Number of stages over which to perform the change
105
/// If zero, perform a continuous change
108
/// \brief Number of current stage of the perturbation
111
/// \brief Number of steps required to reach the target force constant
112
/// or restraint centers
113
size_t target_nsteps;
116
/// \brief Harmonic bias restraint
117
/// (implementation of \link colvarbias_restraint \endlink)
118
class colvarbias_restraint_harmonic : public colvarbias_restraint {
121
colvarbias_restraint_harmonic(std::string const &conf, char const *key);
123
protected: /// \brief Potential function
124
virtual cvm::real restraint_potential(cvm::real k, colvar* x, const colvarvalue& xcenter) const;
126
/// \brief Force function
127
virtual colvarvalue restraint_force(cvm::real k, colvar* x, const colvarvalue& xcenter) const;
129
///\brief Unit scaling
130
virtual cvm::real restraint_convert_k(cvm::real k, cvm::real dist_measure) const;
134
/// \brief Linear bias restraint
135
/// (implementation of \link colvarbias_restraint \endlink)
136
class colvarbias_restraint_linear : public colvarbias_restraint {
139
colvarbias_restraint_linear(std::string const &conf, char const *key);
141
protected: /// \brief Potential function
142
virtual cvm::real restraint_potential(cvm::real k, colvar* x, const colvarvalue& xcenter) const;
144
/// \brief Force function
145
virtual colvarvalue restraint_force(cvm::real k, colvar* x, const colvarvalue& xcenter) const;
147
///\brief Unit scaling
148
virtual cvm::real restraint_convert_k(cvm::real k, cvm::real dist_measure) const;