~ubuntu-branches/debian/sid/lammps/sid

« back to all changes in this revision

Viewing changes to lib/colvars/colvarbias_restraint.h

  • Committer: Package Import Robot
  • Author(s): Anton Gladky
  • Date: 2015-04-29 23:44:49 UTC
  • mfrom: (5.1.3 experimental)
  • Revision ID: package-import@ubuntu.com-20150429234449-mbhy9utku6hp6oq8
Tags: 0~20150313.gitfa668e1-1
Upload into unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/// -*- c++ -*-
 
2
 
 
3
#ifndef COLVARBIAS_RESTRAINT_H
 
4
#define COLVARBIAS_RESTRAINT_H
 
5
 
 
6
#include "colvarbias.h"
 
7
 
 
8
/// \brief Bias restraint, optionally moving towards a target
 
9
/// (implementation of \link colvarbias \endlink)
 
10
class colvarbias_restraint : public colvarbias {
 
11
 
 
12
public:
 
13
 
 
14
  /// Retrieve colvar values and calculate their biasing forces
 
15
  virtual cvm::real update();
 
16
 
 
17
  /// Load new configuration - force constant and/or centers only
 
18
  virtual void change_configuration(std::string const &conf);
 
19
 
 
20
  /// Calculate change in energy from using alternate configuration
 
21
  virtual cvm::real energy_difference(std::string const &conf);
 
22
 
 
23
  /// Read the bias configuration from a restart file
 
24
  virtual std::istream & read_restart(std::istream &is);
 
25
 
 
26
  /// Write the bias configuration to a restart file
 
27
  virtual std::ostream & write_restart(std::ostream &os);
 
28
 
 
29
  /// Write a label to the trajectory file (comment line)
 
30
  virtual std::ostream & write_traj_label(std::ostream &os);
 
31
 
 
32
  /// Output quantities such as the bias energy to the trajectory file
 
33
  virtual std::ostream & write_traj(std::ostream &os);
 
34
 
 
35
  /// \brief Constructor
 
36
  colvarbias_restraint(std::string const &conf, char const *key);
 
37
 
 
38
  /// Destructor
 
39
  virtual ~colvarbias_restraint();
 
40
 
 
41
 
 
42
protected:
 
43
 
 
44
  /// \brief Potential function
 
45
  virtual cvm::real restraint_potential(cvm::real k, colvar* x, const colvarvalue& xcenter) const = 0;
 
46
 
 
47
  /// \brief Force function
 
48
  virtual colvarvalue restraint_force(cvm::real k, colvar* x, const colvarvalue& xcenter) const = 0;
 
49
 
 
50
  ///\brief Unit scaling
 
51
  virtual cvm::real restraint_convert_k(cvm::real k, cvm::real dist_measure) const = 0;
 
52
 
 
53
  /// \brief Restraint centers
 
54
  std::vector<colvarvalue> colvar_centers;
 
55
 
 
56
  /// \brief Restraint centers without wrapping or constraints applied
 
57
  std::vector<colvarvalue> colvar_centers_raw;
 
58
 
 
59
  /// \brief Moving target?
 
60
  bool b_chg_centers;
 
61
 
 
62
  /// \brief New restraint centers
 
63
  std::vector<colvarvalue> target_centers;
 
64
 
 
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;
 
68
 
 
69
  /// Whether to write the current restraint centers to the trajectory file
 
70
  bool b_output_centers;
 
71
 
 
72
  /// Whether to write the current accumulated work to the trajectory file
 
73
  bool b_output_acc_work;
 
74
 
 
75
  /// \brief Accumulated work
 
76
  cvm::real acc_work;
 
77
 
 
78
  /// \brief Restraint force constant
 
79
  cvm::real force_k;
 
80
 
 
81
  /// \brief Changing force constant?
 
82
  bool b_chg_force_k;
 
83
 
 
84
  /// \brief Restraint force constant (target value)
 
85
  cvm::real target_force_k;
 
86
 
 
87
  /// \brief Restraint force constant (starting value)
 
88
  cvm::real starting_force_k;
 
89
 
 
90
  /// \brief Lambda-schedule for custom varying force constant
 
91
  std::vector<cvm::real> lambda_schedule;
 
92
 
 
93
  /// \brief Exponent for varying the force constant
 
94
  cvm::real force_k_exp;
 
95
 
 
96
  /// \brief Intermediate quantity to compute the restraint free energy
 
97
  /// (in TI, would be the accumulating FE derivative)
 
98
  cvm::real restraint_FE;
 
99
 
 
100
 
 
101
  /// \brief Equilibration steps for restraint FE calculation through TI
 
102
  cvm::real target_equil_steps;
 
103
 
 
104
  /// \brief Number of stages over which to perform the change
 
105
  /// If zero, perform a continuous change
 
106
  int target_nstages;
 
107
 
 
108
  /// \brief Number of current stage of the perturbation
 
109
  int stage;
 
110
 
 
111
  /// \brief Number of steps required to reach the target force constant
 
112
  /// or restraint centers
 
113
  size_t target_nsteps;
 
114
};
 
115
 
 
116
/// \brief Harmonic bias restraint
 
117
/// (implementation of \link colvarbias_restraint \endlink)
 
118
class colvarbias_restraint_harmonic : public colvarbias_restraint {
 
119
 
 
120
public:
 
121
  colvarbias_restraint_harmonic(std::string const &conf, char const *key);
 
122
 
 
123
protected: /// \brief Potential function
 
124
  virtual cvm::real restraint_potential(cvm::real k,  colvar*  x, const colvarvalue& xcenter) const;
 
125
 
 
126
  /// \brief Force function
 
127
  virtual colvarvalue restraint_force(cvm::real k,  colvar* x,  const colvarvalue& xcenter) const;
 
128
 
 
129
  ///\brief Unit scaling
 
130
  virtual cvm::real restraint_convert_k(cvm::real k, cvm::real dist_measure) const;
 
131
 
 
132
};
 
133
 
 
134
/// \brief Linear bias restraint
 
135
/// (implementation of \link colvarbias_restraint \endlink)
 
136
class colvarbias_restraint_linear : public colvarbias_restraint {
 
137
 
 
138
public:
 
139
  colvarbias_restraint_linear(std::string const &conf, char const *key);
 
140
 
 
141
protected: /// \brief Potential function
 
142
  virtual cvm::real restraint_potential(cvm::real k,  colvar*  x, const colvarvalue& xcenter) const;
 
143
 
 
144
  /// \brief Force function
 
145
  virtual colvarvalue restraint_force(cvm::real k,  colvar* x,  const colvarvalue& xcenter) const;
 
146
 
 
147
  ///\brief Unit scaling
 
148
  virtual cvm::real restraint_convert_k(cvm::real k, cvm::real dist_measure) const;
 
149
 
 
150
};
 
151
 
 
152
 
 
153
#endif