#include <colvarcomp.h>
Inheritance diagram for colvar::cvc:
Public Methods | |||
cvc (std::string const &conf) | |||
\brief Constructor Calls the init() function of the class. More... | |||
int | set_function_type (std::string const &type) | ||
Set the value of function_type and its dependencies. More... | |||
virtual int | init (std::string const &conf) | ||
An init function should be defined for every class inheriting from cvc
| |||
virtual int | init_dependencies () | ||
\brief Initialize dependency tree. More... | |||
cvm::atom_group * | parse_group (std::string const &conf, char const *group_key, bool optional=false) | ||
\brief Within the constructor, make a group parse its own options from the provided configuration string Returns reference to new group. More... | |||
virtual int | init_total_force_params (std::string const &conf) | ||
\brief Parse options pertaining to total force calculation. More... | |||
int | setup () | ||
\brief After construction, set data related to dependency handling. More... | |||
cvc () | |||
\brief Default constructor (used when colvar::cvc objects are declared within other ones). More... | |||
virtual | ~cvc () | ||
Destructor. More... | |||
virtual const std::vector< feature * > & | features () const | ||
\brief Implementation of the feature list accessor for colvar. More... | |||
virtual std::vector< feature * > & | modify_features () | ||
virtual std::vector< std::vector< int > > | get_atom_lists () | ||
\brief Get vector of vectors of atom IDs for all atom groups. More... | |||
virtual void | read_data () | ||
\brief Obtain data needed for the calculation for the backend. More... | |||
virtual void | calc_value ()=0 | ||
\brief Calculate the variable. More... | |||
virtual void | calc_gradients () | ||
\brief Calculate the atomic gradients, to be reused later in order to apply forces. More... | |||
void | calc_fit_gradients () | ||
\brief Calculate the atomic fit gradients. More... | |||
virtual void | debug_gradients () | ||
\brief Calculate finite-difference gradients alongside the analytical ones, for each Cartesian component. More... | |||
virtual void | collect_gradients (std::vector< int > const &atom_ids, std::vector< cvm::rvector > &atomic_gradients) | ||
\brief Calculate atomic gradients and add them to the corresponding item in gradient vector May be overridden by CVCs that do not store their gradients in the classic way, see dihedPC. More... | |||
virtual void | calc_force_invgrads () | ||
\brief Calculate the total force from the system using the inverse atomic gradients. More... | |||
virtual void | calc_Jacobian_derivative () | ||
\brief Calculate the divergence of the inverse atomic gradients. More... | |||
colvarvalue const & | value () const | ||
\brief Return the previously calculated value. More... | |||
colvarvalue const & | total_force () const | ||
\brief Return the previously calculated total force. More... | |||
colvarvalue const & | Jacobian_derivative () const | ||
\brief Return the previously calculated divergence of the inverse atomic gradients. More... | |||
virtual void | apply_force (colvarvalue const &cvforce)=0 | ||
\brief Apply the collective variable force, by communicating the atomic forces to the simulation program (Note: the ft member is not altered by this function) Note: multiple calls to this function within the same simulation step will add the forces altogether
| |||
virtual cvm::real | dist2 (colvarvalue const &x1, colvarvalue const &x2) const | ||
\brief Square distance between x1 and x2 (can be redefined to transparently implement constraints, symmetries and periodicities) colvar::cvc::dist2() and the related functions are declared as "const" functions, but not "static", because additional parameters defining the metrics (e.g. the periodicity) may be specific to each colvar::cvc object. If symmetries or periodicities are present, the colvar::cvc::dist2() should be redefined to return the "closest distance" value and colvar::cvc::dist2_lgrad(), colvar::cvc::dist2_rgrad() to return its gradients. If constraints are present (and not already implemented by any of the colvarvalue types), the colvar::cvc::dist2_lgrad() and colvar::cvc::dist2_rgrad() functions should be redefined to provide a gradient which is compatible with the constraint, i.e. already deprived of its component normal to the constraint hypersurface. Finally, another useful application, if you are performing very many operations with these functions, could be to override the colvarvalue member functions and access directly its member data. For instance: to define dist2(x1,x2) as (x2.real_value-x1.real_value)*(x2.real_value-x1.real_value) in case of a scalar colvarvalue type. More... | |||
virtual colvarvalue | dist2_lgrad (colvarvalue const &x1, colvarvalue const &x2) const | ||
\brief Gradient(with respect to x1) of the square distance (can be redefined to transparently implement constraints, symmetries and periodicities). More... | |||
virtual colvarvalue | dist2_rgrad (colvarvalue const &x1, colvarvalue const &x2) const | ||
\brief Gradient(with respect to x2) of the square distance (can be redefined to transparently implement constraints, symmetries and periodicities). More... | |||
virtual void | wrap (colvarvalue &x_unwrapped) const | ||
\brief Wrap value (for periodic/symmetric cvcs). More... | |||
void | register_atom_group (cvm::atom_group *ag) | ||
\brief Store a pointer to new atom group, and list as child for dependencies. More... | |||
virtual colvarvalue const * | get_param_grad (std::string const ¶m_name) | ||
Pointer to the gradient of parameter param_name. More... | |||
virtual int | set_param (std::string const ¶m_name, void const *new_value) | ||
Set the named parameter to the given value. More... | |||
void | set_value (colvarvalue const &new_value) | ||
Forcibly set value of CVC - useful for driving an external coordinate, eg. lambda dynamics. More... | |||
Static Public Methods | |||
void | delete_features () | ||
Public Attributes | |||
std::string | name | ||
\brief The name of the object (helps to identify this cvc instance when debugging). More... | |||
std::string | function_type | ||
\brief Description of the type of collective variable Normally this string is set by the parent colvar object within its constructor, when all colvar::cvc objects are initialized; therefore the main "config string" constructor does not need to define it. If a colvar::cvc is initialized and/or a different constructor is used, this variable definition should be set within the constructor. More... | |||
std::string | config_key | ||
Keyword used in the input to denote this CVC. More... | |||
cvm::real | sup_coeff | ||
\brief Coefficient in the polynomial combination (default: 1.0). More... | |||
int | sup_np | ||
\brief Exponent in the polynomial combination (default: 1). More... | |||
cvm::real | period | ||
\brief Period of the values of this CVC (default: 0.0, non periodic). More... | |||
cvm::real | wrap_center | ||
\brief If the component is periodic, wrap around this value (default: 0.0). More... | |||
std::vector< cvm::atom_group * > | atom_groups | ||
\brief Pointers to all atom groups, to let colvars collect info e.g. atomic gradients. More... | |||
bool | b_try_scalable | ||
\brief Whether or not this CVC will be computed in parallel whenever possible. More... | |||
Static Public Attributes | |||
std::vector< feature * > | cvc_features | ||
\brief Implementation of the feature list for colvar. More... | |||
Protected Methods | |||
void | init_as_distance () | ||
\brief Set data types for a scalar distance (convenience function). More... | |||
void | init_as_angle () | ||
\brief Set data types for a bounded angle (0° to 180°). More... | |||
void | init_as_periodic_angle () | ||
\brief Set data types for a periodic angle (-180° to 180°). More... | |||
void | init_scalar_boundaries (cvm::real lb, cvm::real ub) | ||
\brief Set two scalar boundaries (convenience function). More... | |||
Protected Attributes | |||
std::vector< std::string > | function_types | ||
Record the type of this class as well as those it is derived from. More... | |||
colvarvalue | x | ||
\brief Cached value. More... | |||
colvarvalue | x_old | ||
\brief Value at the previous step. More... | |||
colvarvalue | ft | ||
\brief Calculated total force (Note: this is calculated from the total atomic forces read from the program, subtracting fromt the "internal" forces of the system the "external" forces from the colvar biases). More... | |||
colvarvalue | jd | ||
\brief Calculated Jacobian derivative (divergence of the inverse gradients): serves to calculate the phase space correction. More... | |||
colvarvalue | lower_boundary | ||
\brief Location of the lower boundary (not defined by user choice). More... | |||
colvarvalue | upper_boundary | ||
\brief Location of the upper boundary (not defined by user choice). More... | |||
cvm::real | width | ||
\brief CVC-specific default colvar width. More... |
Definition at line 76 of file colvarcomp.h.
|
\brief Constructor Calls the init() function of the class.
Definition at line 32 of file colvarcomp.C. References b_try_scalable, conf, colvardeps::description, init, init_dependencies, period, sup_coeff, sup_np, width, and wrap_center. |
|
\brief Default constructor (used when colvar::cvc objects are declared within other ones).
Definition at line 19 of file colvarcomp.C. References b_try_scalable, colvardeps::description, period, sup_coeff, sup_np, width, and wrap_center. |
|
Destructor.
Definition at line 322 of file colvarcomp.C. References atom_groups, colvardeps::free_children_deps, NULL, and colvardeps::remove_all_children. |
|
\brief Apply the collective variable force, by communicating the atomic forces to the simulation program (Note: the ft member is not altered by this function) Note: multiple calls to this function within the same simulation step will add the forces altogether
Implemented in colvar::distance. |
|
\brief Calculate the atomic fit gradients.
Definition at line 510 of file colvarcomp.C. References atom_groups. |
|
\brief Calculate the total force from the system using the inverse atomic gradients.
Reimplemented in colvar::distance. Definition at line 494 of file colvarcomp.C. References COLVARS_NOT_IMPLEMENTED, colvarmodule::error, and function_type. |
|
\brief Calculate the atomic gradients, to be reused later in order to apply forces.
Reimplemented in colvar::distance. Definition at line 175 of file colvarcomp.h. |
|
\brief Calculate the divergence of the inverse atomic gradients.
Reimplemented in colvar::distance. Definition at line 502 of file colvarcomp.C. References COLVARS_NOT_IMPLEMENTED, colvarmodule::error, and function_type. |
|
\brief Calculate the variable.
Implemented in colvar::distance. Referenced by debug_gradients. |
|
\brief Calculate atomic gradients and add them to the corresponding item in gradient vector May be overridden by CVCs that do not store their gradients in the classic way, see dihedPC.
Reimplemented in colvar::alpha_angles. Definition at line 452 of file colvarcomp.C. References atom_groups, colvar::atom_ids, colvar::atomic_gradients, colvardeps::f_ag_fit_gradients, colvardeps::f_ag_fitting_group, colvardeps::f_ag_rotate, colvarmodule::integer_power, colvarmodule::real, sup_coeff, sup_np, and value. |
|
\brief Calculate finite-difference gradients alongside the analytical ones, for each Cartesian component.
Definition at line 518 of file colvarcomp.C. References atom_groups, calc_value, colvardeps::description, colvardeps::f_ag_center, colvardeps::f_ag_fit_gradients, colvardeps::f_ag_rotate, colvarmodule::log, NULL, colvarvalue::real_value, colvarvalue::size, colvarmodule::to_str, colvarvalue::type, colvarvalue::type_vector, and x. |
|
Definition at line 157 of file colvarcomp.h. Referenced by colvarmodule::~colvarmodule. |
|
\brief Square distance between x1 and x2 (can be redefined to transparently implement constraints, symmetries and periodicities) colvar::cvc::dist2() and the related functions are declared as "const" functions, but not "static", because additional parameters defining the metrics (e.g. the periodicity) may be specific to each colvar::cvc object. If symmetries or periodicities are present, the colvar::cvc::dist2() should be redefined to return the "closest distance" value and colvar::cvc::dist2_lgrad(), colvar::cvc::dist2_rgrad() to return its gradients. If constraints are present (and not already implemented by any of the colvarvalue types), the colvar::cvc::dist2_lgrad() and colvar::cvc::dist2_rgrad() functions should be redefined to provide a gradient which is compatible with the constraint, i.e. already deprived of its component normal to the constraint hypersurface. Finally, another useful application, if you are performing very many operations with these functions, could be to override the colvarvalue member functions and access directly its member data. For instance: to define dist2(x1,x2) as (x2.real_value-x1.real_value)*(x2.real_value-x1.real_value) in case of a scalar colvarvalue type.
Reimplemented in colvar::distance. Definition at line 637 of file colvarcomp.C. References colvarvalue::dist2. |
|
\brief Gradient(with respect to x1) of the square distance (can be redefined to transparently implement constraints, symmetries and periodicities).
Reimplemented in colvar::distance. Definition at line 644 of file colvarcomp.C. References colvarvalue::dist2_grad. |
|
\brief Gradient(with respect to x2) of the square distance (can be redefined to transparently implement constraints, symmetries and periodicities).
Reimplemented in colvar::distance. Definition at line 651 of file colvarcomp.C. References colvarvalue::dist2_grad. |
|
\brief Implementation of the feature list accessor for colvar.
Implements colvardeps. Definition at line 149 of file colvarcomp.h. Referenced by init_dependencies. |
|
\brief Get vector of vectors of atom IDs for all atom groups.
Definition at line 434 of file colvarcomp.C. References atom_groups, colvardeps::f_ag_fit_gradients, and colvardeps::f_ag_fitting_group. |
|
Pointer to the gradient of parameter param_name.
Definition at line 378 of file colvarcomp.C. References colvarparams::get_param_grad_ptr, and NULL. |
|
An init function should be defined for every class inheriting from cvc
Reimplemented in colvar::orientation. Definition at line 65 of file colvarcomp.C. References b_try_scalable, colvarmodule::cite_feature, COLVARS_INPUT_ERROR, conf, colvarmodule::debug, colvardeps::description, colvardeps::disable, colvardeps::enable, colvarmodule::error, colvardeps::f_cvc_debug_gradient, colvardeps::f_cvc_pbc_minimum_image, function_type, colvarmodule::get_error, colvarparse::get_keyval, colvardeps::get_keyval_feature, colvardeps::is_enabled, colvarmodule::log, colvarmodule::main, name, colvarparse::parse_silent, period, colvarparams::register_param, sup_coeff, sup_np, and wrap_center. Referenced by cvc. |
|
\brief Set data types for a bounded angle (0° to 180°).
Definition at line 342 of file colvarcomp.C. References init_scalar_boundaries, colvarvalue::type, colvarvalue::type_scalar, and x. Referenced by colvar::angle::angle, colvar::dipole_angle::dipole_angle, colvar::euler_theta::euler_theta, and colvar::orientation_angle::orientation_angle. |
|
\brief Set data types for a scalar distance (convenience function).
Definition at line 332 of file colvarcomp.C. References colvardeps::enable, colvardeps::f_cvc_lower_boundary, lower_boundary, colvarvalue::real_value, colvarparams::register_param, colvarvalue::type, colvarvalue::type_scalar, and x. Referenced by colvar::distance::distance, colvar::distance_inv::distance_inv, and colvar::distance_xy::distance_xy. |
|
\brief Set data types for a periodic angle (-180° to 180°).
Definition at line 349 of file colvarcomp.C. References colvardeps::enable, colvardeps::f_cvc_periodic, init_scalar_boundaries, period, colvarvalue::type, colvarvalue::type_scalar, and x. Referenced by colvar::dihedral::dihedral, colvar::euler_phi::euler_phi, colvar::euler_psi::euler_psi, and colvar::polar_phi::polar_phi. |
|
|
\brief Set two scalar boundaries (convenience function).
Definition at line 358 of file colvarcomp.C. References colvardeps::enable, colvardeps::f_cvc_lower_boundary, colvardeps::f_cvc_upper_boundary, lower_boundary, colvarvalue::real_value, colvarparams::register_param, colvarvalue::type, colvarvalue::type_scalar, and upper_boundary. Referenced by colvar::coordnum::coordnum, colvar::h_bond::h_bond, init_as_angle, and init_as_periodic_angle. |
|
\brief Parse options pertaining to total force calculation.
Definition at line 126 of file colvarcomp.C. References atom_groups, COLVARS_ERROR, conf, colvardeps::f_cvc_inv_gradient, colvardeps::f_cvc_Jacobian, colvardeps::f_cvc_one_site_total_force, colvarmodule::get_error, colvardeps::get_keyval_feature, colvardeps::is_enabled, colvarmodule::log, and colvardeps::provide. Referenced by colvar::angle::angle, colvar::dipole_magnitude::dipole_magnitude, colvar::distance::distance, colvar::distance_z::distance_z, and colvar::polar_theta::polar_theta. |
|
\brief Return the previously calculated divergence of the inverse atomic gradients.
Definition at line 340 of file colvarcomp.h. References jd. |
|
Implements colvardeps. Definition at line 153 of file colvarcomp.h. Referenced by init_dependencies. |
|
\brief Within the constructor, make a group parse its own options from the provided configuration string Returns reference to new group.
Definition at line 156 of file colvarcomp.C. References colvarmodule::atom_group, COLVARS_INPUT_ERROR, conf, colvarmodule::decrease_depth, colvardeps::disable, colvardeps::enable, colvarmodule::error, colvardeps::f_ag_scalable_com, colvardeps::f_cvc_com_based, colvardeps::f_cvc_debug_gradient, colvardeps::f_cvc_explicit_gradient, colvardeps::f_cvc_scalable_com, colvarmodule::get_error, colvarmodule::increase_depth, colvardeps::is_available, colvardeps::is_enabled, colvarparse::key_lookup, NULL, and register_atom_group. Referenced by colvar::angle::angle, colvar::coordnum::coordnum, colvar::dipole_magnitude::dipole_magnitude, colvar::distance::distance, colvar::distance_inv::distance_inv, colvar::distance_z::distance_z, colvar::map_total::init, colvar::orientation::init, and colvar::polar_theta::polar_theta. |
|
\brief Obtain data needed for the calculation for the backend.
Definition at line 412 of file colvarcomp.C. References atom_groups, and atoms. |
|
\brief Store a pointer to new atom group, and list as child for dependencies.
Definition at line 371 of file colvarcomp.C. References colvardeps::add_child, and atom_groups. Referenced by colvar::alpha_angles::alpha_angles, colvar::angle::angle, colvar::dihedral::dihedral, colvar::dipole_angle::dipole_angle, colvar::dipole_magnitude::dipole_magnitude, colvar::h_bond::h_bond, and parse_group. |
|
|
Set the named parameter to the given value.
Reimplemented from colvarparams. Definition at line 386 of file colvarcomp.C. References colvardeps::f_cvc_periodic, colvardeps::is_enabled, colvarparams::param_map, period, colvarparams::set_param, sup_coeff, sup_np, and wrap_center. |
|
Forcibly set value of CVC - useful for driving an external coordinate, eg. lambda dynamics.
Definition at line 280 of file colvarcomp.h. References colvar::x. |
|
\brief After construction, set data related to dependency handling.
Definition at line 315 of file colvarcomp.C. References colvardeps::description, and name. |
|
\brief Return the previously calculated total force.
Definition at line 334 of file colvarcomp.h. References ft. |
|
\brief Return the previously calculated value.
Definition at line 328 of file colvarcomp.h. References x. Referenced by colvar::rmsd::calc_value, colvar::dihedPC::collect_gradients, colvar::alpha_angles::collect_gradients, and collect_gradients. |
|
\brief Wrap value (for periodic/symmetric cvcs).
Reimplemented in colvar::distance_z. Definition at line 658 of file colvarcomp.C. |
|
\brief Pointers to all atom groups, to let colvars collect info e.g. atomic gradients.
Definition at line 264 of file colvarcomp.h. Referenced by colvar::h_bond::apply_force, calc_fit_gradients, colvar::h_bond::calc_gradients, colvar::h_bond::calc_value, collect_gradients, debug_gradients, get_atom_lists, colvar::h_bond::h_bond, init_total_force_params, read_data, register_atom_group, colvar::alpha_angles::~alpha_angles, ~cvc, and colvar::dihedPC::~dihedPC. |
|
\brief Whether or not this CVC will be computed in parallel whenever possible.
Definition at line 276 of file colvarcomp.h. |
|
Keyword used in the input to denote this CVC.
Definition at line 96 of file colvarcomp.h. |
|
\brief Implementation of the feature list for colvar.
Definition at line 667 of file colvarcomp.C. |
|
\brief Calculated total force (Note: this is calculated from the total atomic forces read from the program, subtracting fromt the "internal" forces of the system the "external" forces from the colvar biases).
Definition at line 299 of file colvarcomp.h. Referenced by colvar::eigenvector::calc_force_invgrads, colvar::rmsd::calc_force_invgrads, colvar::gyration::calc_force_invgrads, colvar::distance_xy::calc_force_invgrads, colvar::distance_z::calc_force_invgrads, colvar::distance::calc_force_invgrads, colvar::dihedral::calc_force_invgrads, colvar::angle::calc_force_invgrads, colvar::alch_lambda::calc_value, and total_force. |
|
\brief Description of the type of collective variable Normally this string is set by the parent colvar object within its constructor, when all colvar::cvc objects are initialized; therefore the main "config string" constructor does not need to define it. If a colvar::cvc is initialized and/or a different constructor is used, this variable definition should be set within the constructor.
Definition at line 93 of file colvarcomp.h. Referenced by calc_force_invgrads, calc_Jacobian_derivative, init, and set_function_type. |
|
Record the type of this class as well as those it is derived from.
Definition at line 287 of file colvarcomp.h. Referenced by set_function_type. |
|
\brief Calculated Jacobian derivative (divergence of the inverse gradients): serves to calculate the phase space correction.
Definition at line 303 of file colvarcomp.h. Referenced by colvar::eigenvector::calc_Jacobian_derivative, colvar::rmsd::calc_Jacobian_derivative, colvar::gyration::calc_Jacobian_derivative, colvar::distance_xy::calc_Jacobian_derivative, colvar::distance_z::calc_Jacobian_derivative, colvar::distance::calc_Jacobian_derivative, colvar::dihedral::calc_Jacobian_derivative, colvar::angle::calc_Jacobian_derivative, and Jacobian_derivative. |
|
\brief Location of the lower boundary (not defined by user choice).
Definition at line 318 of file colvarcomp.h. Referenced by init_as_distance, and init_scalar_boundaries. |
|
\brief The name of the object (helps to identify this cvc instance when debugging).
Definition at line 83 of file colvarcomp.h. Referenced by colvar::compare_cvc, init, and setup. |
|
\brief Period of the values of this CVC (default: 0.0, non periodic).
Definition at line 104 of file colvarcomp.h. Referenced by cvc, colvar::distance_z::dist2, colvar::distance_z::dist2_lgrad, colvar::distance_z::dist2_rgrad, colvar::distance_z::distance_z, init, init_as_periodic_angle, set_param, colvar::spin_angle::spin_angle, and colvar::distance_z::wrap. |
|
\brief Coefficient in the polynomial combination (default: 1.0).
Definition at line 99 of file colvarcomp.h. Referenced by colvar::dihedPC::collect_gradients, colvar::alpha_angles::collect_gradients, collect_gradients, cvc, init, and set_param. |
|
\brief Exponent in the polynomial combination (default: 1).
Definition at line 101 of file colvarcomp.h. Referenced by colvar::dihedPC::collect_gradients, colvar::alpha_angles::collect_gradients, collect_gradients, cvc, init, and set_param. |
|
\brief Location of the upper boundary (not defined by user choice).
Definition at line 321 of file colvarcomp.h. Referenced by init_scalar_boundaries. |
|
\brief CVC-specific default colvar width.
Definition at line 324 of file colvarcomp.h. Referenced by cvc. |
|
\brief If the component is periodic, wrap around this value (default: 0.0).
Definition at line 107 of file colvarcomp.h. Referenced by cvc, colvar::distance_z::distance_z, init, set_param, colvar::euler_psi::wrap, colvar::euler_phi::wrap, colvar::spin_angle::wrap, colvar::distance_z::wrap, colvar::polar_phi::wrap, and colvar::dihedral::wrap. |
|
|
\brief Value at the previous step.
Definition at line 293 of file colvarcomp.h. |