File: colvarbias_alb.h

package info (click to toggle)
lammps 0~20181211.gitad1b1897d%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 318,860 kB
  • sloc: cpp: 729,569; python: 40,508; xml: 14,919; fortran: 12,142; ansic: 7,454; sh: 5,565; perl: 4,105; f90: 2,700; makefile: 2,117; objc: 238; lisp: 163; tcl: 61; csh: 16; awk: 14
file content (88 lines) | stat: -rw-r--r-- 2,644 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// -*- c++ -*-

// This file is part of the Collective Variables module (Colvars).
// The original version of Colvars and its updates are located at:
// https://github.com/colvars/colvars
// Please update all Colvars source files before making any changes.
// If you wish to distribute your changes, please submit them to the
// Colvars repository at GitHub.

#ifndef COLVARBIAS_ALB_H
#define COLVARBIAS_ALB_H

#include "colvar.h"
#include "colvarbias.h"


class colvarbias_alb : public colvarbias {

public:

  colvarbias_alb(char const *key);
  virtual ~colvarbias_alb();
  virtual int init(std::string const &conf);
  virtual int update();

  virtual std::string const get_state_params() const;
  virtual int set_state_params(std::string const &conf);
  virtual std::ostream & write_traj_label(std::ostream &os);
  virtual std::ostream & write_traj(std::ostream &os);

protected:

  /// \brief Restraint centers
  std::vector<colvarvalue> colvar_centers;

  /// \brief colvar parameters, used for calculating the gradient/variance
  std::vector<cvm::real> means;
  std::vector<cvm::real> ssd; // SSD = sum of squares of differences from mean
  int update_calls;

  ///\brief how often to update coupling constant
  int update_freq;

  ///\brief Estimated range of coupling constant values in kT
  std::vector<cvm::real> max_coupling_range;

  //\brief Estimated max for how quickly the rate can change in kT / time
  std::vector<cvm::real> max_coupling_rate;

  /// \brief accumated couping force; used in stochastic online gradient descent algorithm
  std::vector<cvm::real> coupling_accum;

  /// \brief coupling constant
  std::vector<cvm::real> set_coupling;

  /// \brief current coupling constant, which is ramped up during equilibration to coupling
  std::vector<cvm::real> current_coupling;

  /// \brief how quickly to change the coupling constant
  std::vector<cvm::real> coupling_rate;

  // \brief if we're equilibrating our estimates or collecting data
  bool b_equilibration;

  // \brief If the coupling range should be increased
  bool b_hard_coupling_range;


  /// \brief flag for outputting colvar centers
  bool b_output_centers;

  /// \brief flag for outputting current gradient
  bool b_output_grad;

  /// \brief flag for outputting coupling constant
  bool b_output_coupling;

  cvm::real restraint_potential(cvm::real k,  const colvar*  x, const colvarvalue& xcenter) const;

  /// \brief Force function
  colvarvalue restraint_force(cvm::real k,  const colvar* x,  const colvarvalue& xcenter) const;

  ///\brief Unit scaling
  cvm::real restraint_convert_k(cvm::real k, cvm::real dist_measure) const;

};

#endif