#include <colvarbias.h>
Inheritance diagram for colvarbias:

Public Member Functions | |
| void | add_colvar (std::string const &cv_name) |
| Add a new collective variable to this bias. | |
| virtual void | update ()=0 |
| Retrieve colvar values and calculate their biasing forces. | |
| virtual void | analyse () |
| Perform analysis tasks. | |
| void | communicate_forces () |
| Send forces to the collective variables. | |
| colvarbias (std::string const &conf, char const *key) | |
| Constructor. | |
| virtual | ~colvarbias () |
| Destructor. | |
| virtual std::istream & | read_restart (std::istream &is)=0 |
| Read the bias configuration from a restart file. | |
| virtual std::ostream & | write_restart (std::ostream &os)=0 |
| Write the bias configuration to a restart file. | |
Public Attributes | |
| int | id |
| Numeric id of this bias. | |
| std::string | name |
| Name of this bias. | |
Protected Attributes | |
| std::vector< colvar * > | colvars |
| Pointers to collective variables to which the bias is applied; current values and metric functions will be obtained through each colvar object. | |
| std::vector< colvarvalue > | colvar_forces |
| Current forces from this bias to the colvars. | |
| cvm::real | colvar_energy |
| Current energy of this bias (colvar_forces should be obtained by deriving this). | |
Definition at line 9 of file colvarbias.h.
|
||||||||||||
|
Constructor. Constructor of the base class colvarbias is protected, so that it can only be called from inherited classes Definition at line 6 of file colvarbias.C. References add_colvar(), colvars, colvarmodule::fatal_error(), colvarmodule::log(), name, and colvarparse::to_lower_cppstr(). 00007 : colvarparse() 00008 { 00009 cvm::log ("Initializing a new \""+std::string (key)+"\" instance.\n"); 00010 00011 size_t rank = 1; 00012 std::string const key_str (key); 00013 00014 if (colvarparse::to_lower_cppstr (key_str) == std::string ("abf")) { 00015 rank = cvm::n_abf_biases+1; 00016 } 00017 if (colvarparse::to_lower_cppstr (key_str) == std::string ("harmonic")) { 00018 rank = cvm::n_harm_biases+1; 00019 } 00020 if (colvarparse::to_lower_cppstr (key_str) == std::string ("histogram")) { 00021 rank = cvm::n_histo_biases+1; 00022 } 00023 if (colvarparse::to_lower_cppstr (key_str) == std::string ("metadynamics")) { 00024 rank = cvm::n_meta_biases+1; 00025 } 00026 00027 get_keyval (conf, "name", name, key_str+cvm::to_str (rank)); 00028 00029 // lookup the associated colvars 00030 std::vector<std::string> colvars_str; 00031 if (get_keyval (conf, "colvars", colvars_str)) { 00032 for (size_t i = 0; i < colvars_str.size(); i++) { 00033 add_colvar (colvars_str[i]); 00034 } 00035 } 00036 00037 if (!colvars.size()) { 00038 cvm::fatal_error ("Error: no collective variables specified.\n"); 00039 } 00040 }
|
|
|
Destructor.
Definition at line 37 of file colvarbias.h. 00037 {}
|
|
|
Add a new collective variable to this bias.
Definition at line 43 of file colvarbias.C. References colvar_forces, colvarmodule::colvar_p(), colvars, colvarmodule::debug(), colvar::enable(), colvarmodule::fatal_error(), colvarmodule::log(), colvar::name, and colvar::type(). Referenced by colvarbias(). 00044 {
00045 if (colvar *cvp = cvm::colvar_p (cv_name)) {
00046 cvp->enable (colvar::task_gradients);
00047 if (cvm::debug())
00048 cvm::log ("Applying this bias to collective variable \""+
00049 cvp->name+"\".\n");
00050 colvars.push_back (cvp);
00051 colvar_forces.push_back (colvarvalue (cvp->type()));
00052 } else {
00053 cvm::fatal_error ("Error: cannot find a colvar named \""+
00054 cv_name+"\".\n");
00055 }
00056 }
|
|
|
Perform analysis tasks.
Reimplemented in colvarbias_meta. Definition at line 25 of file colvarbias.h. 00025 {}
|
|
|
Send forces to the collective variables.
Definition at line 59 of file colvarbias.C. References colvar::add_bias_force(), colvar_forces, colvars, colvarmodule::debug(), colvarmodule::log(), and name. 00060 {
00061 for (size_t i = 0; i < colvars.size(); i++) {
00062 if (cvm::debug()) {
00063 cvm::log ("Communicating a force to colvar \""+
00064 colvars[i]->name+"\", of type \""+
00065 colvarvalue::type_desc[colvars[i]->type()]+"\".\n");
00066 }
00067 colvars[i]->add_bias_force (colvar_forces[i]);
00068 }
00069 }
|
|
|
Read the bias configuration from a restart file.
Implemented in colvarbias_harmonic, and colvarbias_meta. |
|
|
Retrieve colvar values and calculate their biasing forces.
Implemented in colvarbias_harmonic, colvarbias_abf, colvarbias_histogram, and colvarbias_meta. |
|
|
Write the bias configuration to a restart file.
Implemented in colvarbias_harmonic, and colvarbias_meta. |
|
|
Current energy of this bias (colvar_forces should be obtained by deriving this).
Definition at line 57 of file colvarbias.h. |
|
|
Current forces from this bias to the colvars.
Definition at line 53 of file colvarbias.h. Referenced by add_colvar(), and communicate_forces(). |
|
|
Pointers to collective variables to which the bias is applied; current values and metric functions will be obtained through each colvar object.
Definition at line 50 of file colvarbias.h. Referenced by add_colvar(), colvarbias(), and communicate_forces(). |
|
|
Numeric id of this bias.
Definition at line 13 of file colvarbias.h. |
|
|
Name of this bias.
Definition at line 16 of file colvarbias.h. Referenced by colvarbias(), and communicate_forces(). |
1.3.9.1