Collective Variables Module - Developer Documentation
Loading...
Searching...
No Matches
colvarproxy_system.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 COLVARPROXY_SYSTEM_H
11#define COLVARPROXY_SYSTEM_H
12
13
16
17public:
18
21
23 virtual ~colvarproxy_system();
24
32 std::string units;
33
35 virtual int set_unit_system(std::string const &units, bool check_only);
36
39 {
40 return l * angstrom_value_;
41 }
42
45 {
46 return l / angstrom_value_;
47 }
48
50 inline cvm::real boltzmann() const
51 {
52 return boltzmann_;
53 }
54
57 {
59 }
60
62 virtual int set_target_temperature(cvm::real T);
63
65 inline double dt() const
66 {
67 return timestep_;
68 }
69
72
74 virtual cvm::real rand_gaussian(void);
75
77 virtual void add_energy(cvm::real energy);
78
81 cvm::atom_pos const &pos2) const;
82
84 void update_pbc_lattice();
85
87 void reset_pbc_lattice();
88
91 virtual void request_total_force(bool yesno);
92
94 virtual bool total_forces_enabled() const;
95
97 virtual bool total_forces_same_step() const;
98
101 virtual int get_molid(int &molid);
102
104 virtual int get_alch_lambda(cvm::real* lambda);
105
107 void set_alch_lambda(cvm::real lambda);
108
110 virtual int send_alch_lambda();
111
113 virtual int get_dE_dlambda(cvm::real* dE_dlambda);
114
116 virtual int apply_force_dE_dlambda(cvm::real* force);
117
119 virtual int get_d2E_dlambda2(cvm::real* d2E_dlambda2);
120
123
126 cvm::error("Error: accessing the reweighting factor of accelerated MD "
127 "is not yet implemented in the MD engine.\n",
128 COLVARS_NOT_IMPLEMENTED);
129 return 1.0;
130 }
131 virtual bool accelMD_enabled() const {
132 return false;
133 }
134
135protected:
136
139
142
145
148
150 double timestep_;
151
157
160
163
170 boundaries_non_periodic,
171 boundaries_pbc_ortho,
172 boundaries_pbc_triclinic,
173 boundaries_unsupported
174 };
175
178
180 cvm::rvector unit_cell_x, unit_cell_y, unit_cell_z;
181
183 cvm::rvector reciprocal_cell_x, reciprocal_cell_y, reciprocal_cell_z;
184};
185
186#endif
vector of real numbers with three components
Definition: colvartypes.h:727
double real
Defining an abstract real number allows to switch precision.
Definition: colvarmodule.h:95
static int error(std::string const &message, int code=-1)
Print a message to the main log and set global error code.
Definition: colvarmodule.cpp:2032
Methods for accessing the simulation system (PBCs, integrator, etc)
Definition: colvarproxy_system.h:15
virtual ~colvarproxy_system()
Destructor.
Definition: colvarproxy_system.cpp:33
bool total_force_requested
Whether the total forces have been requested.
Definition: colvarproxy_system.h:162
virtual void add_energy(cvm::real energy)
Pass restraint energy value for current timestep to MD engine.
Definition: colvarproxy_system.cpp:64
virtual int set_target_temperature(cvm::real T)
Set the current target temperature of the simulation (K units)
Definition: colvarproxy_system.cpp:43
virtual int set_unit_system(std::string const &units, bool check_only)
Request to set the units used internally by Colvars.
Definition: colvarproxy_system.cpp:36
cvm::real target_temperature_
Most up to date target temperature (K units); default to 0.0 if undefined.
Definition: colvarproxy_system.h:147
Boundaries_type
Type of boundary conditions.
Definition: colvarproxy_system.h:169
cvm::real boltzmann_
Boltzmann constant in internal Colvars units.
Definition: colvarproxy_system.h:144
virtual int apply_force_dE_dlambda(cvm::real *force)
Apply a scalar force on dE_dlambda (back-end distributes it onto atoms)
Definition: colvarproxy_system.cpp:193
cvm::real boltzmann() const
Boltzmann constant, with unit the same as energy / K.
Definition: colvarproxy_system.h:50
cvm::real angstrom_to_internal(cvm::real l) const
Convert a length from Angstrom to internal.
Definition: colvarproxy_system.h:38
void update_pbc_lattice()
Recompute PBC reciprocal lattice (assumes XYZ periodicity)
Definition: colvarproxy_system.cpp:93
void reset_pbc_lattice()
Set the lattice vectors to zero.
Definition: colvarproxy_system.cpp:119
virtual cvm::real get_accelMD_factor() const
Get weight factor from accelMD.
Definition: colvarproxy_system.h:125
colvarproxy_system()
Constructor.
Definition: colvarproxy_system.cpp:17
virtual bool total_forces_enabled() const
Are total forces being used?
Definition: colvarproxy_system.cpp:75
double dt() const
Time step of the simulation (fs units)
Definition: colvarproxy_system.h:65
cvm::rvector reciprocal_cell_x
Reciprocal lattice vectors.
Definition: colvarproxy_system.h:183
cvm::real cached_alch_lambda
Next value of lambda to be sent to back-end.
Definition: colvarproxy_system.h:138
virtual int get_d2E_dlambda2(cvm::real *d2E_dlambda2)
Get energy second derivative with respect to lambda (if available)
Definition: colvarproxy_system.cpp:200
bool cached_alch_lambda_changed
Whether lambda has been set and needs to be updated in backend.
Definition: colvarproxy_system.h:141
virtual int get_alch_lambda(cvm::real *lambda)
Get value of alchemical lambda parameter from back-end (if available)
Definition: colvarproxy_system.cpp:165
std::string units
Name of the unit system used internally by Colvars (by default, that of the back-end)....
Definition: colvarproxy_system.h:32
virtual int send_alch_lambda()
Send cached value of alchemical lambda parameter to back-end (if available)
Definition: colvarproxy_system.cpp:179
void set_alch_lambda(cvm::real lambda)
Set value of alchemical lambda parameter to be sent to back-end at end of timestep.
Definition: colvarproxy_system.cpp:172
cvm::real kcal_mol_value_
Value of 1 kcal/mol in the internal Colvars unit for energy.
Definition: colvarproxy_system.h:159
virtual int set_integration_timestep(cvm::real dt)
Set the current integration timestep of the simulation (fs units)
Definition: colvarproxy_system.cpp:50
cvm::real angstrom_value_
Value of 1 Angstrom in the internal (front-end) Colvars unit for atomic coordinates.
Definition: colvarproxy_system.h:156
cvm::rvector unit_cell_x
Bravais lattice vectors.
Definition: colvarproxy_system.h:180
cvm::real target_temperature() const
Current target temperature of the simulation (K units)
Definition: colvarproxy_system.h:56
double timestep_
Current integration timestep (engine units); default to 1.0 if undefined.
Definition: colvarproxy_system.h:150
virtual int get_molid(int &molid)
Definition: colvarproxy_system.cpp:157
virtual cvm::rvector position_distance(cvm::atom_pos const &pos1, cvm::atom_pos const &pos2) const
Get the PBC-aware distance vector between two positions.
Definition: colvarproxy_system.cpp:130
cvm::real internal_to_angstrom(cvm::real l) const
Convert a length from internal to Angstrom.
Definition: colvarproxy_system.h:44
virtual bool total_forces_same_step() const
Are total forces from the current step available?
Definition: colvarproxy_system.cpp:81
virtual cvm::real rand_gaussian(void)
Pseudo-random number with Gaussian distribution.
Definition: colvarproxy_system.cpp:57
Boundaries_type boundaries_type
Type of boundary conditions.
Definition: colvarproxy_system.h:177
virtual int get_dE_dlambda(cvm::real *dE_dlambda)
Get energy derivative with respect to lambda (if available)
Definition: colvarproxy_system.cpp:186
cvm::real indirect_lambda_biasing_force
Force to be applied onto alch. lambda, propagated from biasing forces on dE_dlambda.
Definition: colvarproxy_system.h:122
virtual void request_total_force(bool yesno)
Tell the proxy whether total forces are needed (they may not always be available)
Definition: colvarproxy_system.cpp:67