#include <colvarcomp.h>
Inheritance diagram for colvar::distance:

Public Member Functions | |
| distance (std::string const &conf) | |
| distance () | |
| virtual | ~distance () |
| virtual void | calc_value () |
| Calculate the variable. | |
| virtual void | calc_gradients () |
| Calculate the atomic gradients, to be reused later in order to apply forces. | |
| virtual void | calc_force_invgrads () |
| Calculate the total force from the system using the inverse atomic gradients. | |
| virtual void | calc_Jacobian_derivative () |
| Calculate the divergence of the inverse atomic gradients. | |
| virtual void | apply_force (colvarvalue const &force) |
| Apply the collective variable force, by communicating the atomic forces to the simulation program (Note: the member is not altered by this function). | |
| virtual cvm::real | dist2 (colvarvalue const &x1, colvarvalue const &x2) const |
| Square distance between x1 and x2 (can be redefined to transparently implement constraints, symmetries and periodicities). | |
| virtual colvarvalue | dist2_lgrad (colvarvalue const &x1, colvarvalue const &x2) const |
| Gradient (with respect to x1) of the square distance (can be redefined to transparently implement constraints, symmetries and periodicities). | |
| virtual colvarvalue | dist2_rgrad (colvarvalue const &x1, colvarvalue const &x2) const |
| Gradient (with respect to x2) of the square distance (can be redefined to transparently implement constraints, symmetries and periodicities). | |
| virtual cvm::real | compare (colvarvalue const &x1, colvarvalue const &x2) const |
| Return a positive number if x2>x1, zero if x2==x1, negative otherwise (can be redefined to transparently implement constraints, symmetries and periodicities) Note: it only works with scalar variables, otherwise raises an error. | |
Protected Attributes | |
| cvm::atom_group | group1 |
| First atom group. | |
| cvm::atom_group | group2 |
| Second atom group. | |
| cvm::rvector | dist_v |
| Vector distance, cached to be recycled. | |
| bool | b_1site_force |
This class also serves as the template for many collective variables with two atom groups: in this case, the distance::distance() constructor should be called on the same configuration string, to make the same member data and functions available to the derived object
Definition at line 298 of file colvarcomp.h.
|
|
Definition at line 15 of file colvarcomp_distances.C. References b_1site_force, group1, group2, colvarmodule::log(), colvar::cvc::parse_group(), and colvarvalue::type(). 00016 : cvc (conf) 00017 { 00018 function_type = "distance"; 00019 b_inverse_gradients = true; 00020 b_Jacobian_derivative = true; 00021 if (get_keyval (conf, "oneSiteSystemForce", b_1site_force, false)) { 00022 cvm::log ("Computing system force on group 1 only"); 00023 } 00024 parse_group (conf, "group1", group1); 00025 parse_group (conf, "group2", group2); 00026 x.type (colvarvalue::type_scalar); 00027 }
|
|
|
Definition at line 29 of file colvarcomp_distances.C. References b_1site_force, and colvarvalue::type(). 00030 : cvc () 00031 { 00032 function_type = "distance"; 00033 b_inverse_gradients = true; 00034 b_Jacobian_derivative = true; 00035 b_1site_force = false; 00036 x.type (colvarvalue::type_scalar); 00037 }
|
|
|
Definition at line 314 of file colvarcomp.h. 00314 {}
|
|
|
Apply the collective variable force, by communicating the atomic forces to the simulation program (Note: the member is not altered by this function). Note: multiple calls to this function within the same simulation step will add the forces altogether
Implements colvar::cvc. Reimplemented in colvar::distance_dir, colvar::min_distance, and colvar::coordnum. Definition at line 75 of file colvarcomp_distances.C. References colvarmodule::atom_group::apply_colvar_force(), group1, group2, and colvarmodule::atom_group::noforce. 00076 {
00077 if (!group1.noforce)
00078 group1.apply_colvar_force (force);
00079
00080 if (!group2.noforce)
00081 group2.apply_colvar_force (force);
00082 }
|
|
|
Calculate the total force from the system using the inverse atomic gradients.
Reimplemented from colvar::cvc. Definition at line 59 of file colvarcomp_distances.C. References dist_v, group1, group2, colvarmodule::atom_group::read_system_forces(), colvarvalue::real_value, colvarmodule::atom_group::system_force(), and colvarmodule::rvector::unit(). 00060 {
00061 group1.read_system_forces();
00062 if ( b_1site_force ) {
00063 ft.real_value = -1.0 * (group1.system_force() * dist_v.unit());
00064 } else {
00065 group2.read_system_forces();
00066 ft.real_value = 0.5 * ((group2.system_force() - group1.system_force()) * dist_v.unit());
00067 }
00068 }
|
|
|
Calculate the atomic gradients, to be reused later in order to apply forces.
Implements colvar::cvc. Reimplemented in colvar::distance_dir, colvar::min_distance, and colvar::coordnum. Definition at line 52 of file colvarcomp_distances.C. References dist_v, group1, group2, colvarmodule::atom_group::set_weighted_gradient(), and colvarmodule::rvector::unit(). 00053 {
00054 cvm::rvector const u = dist_v.unit();
00055 group1.set_weighted_gradient (-1.0 * u);
00056 group2.set_weighted_gradient ( u);
00057 }
|
|
|
Calculate the divergence of the inverse atomic gradients.
Reimplemented from colvar::cvc. Definition at line 70 of file colvarcomp_distances.C. References colvarvalue::real_value. 00071 {
00072 jd.real_value = x.real_value ? (2.0 / x.real_value) : 0.0;
00073 }
|
|
|
Calculate the variable.
Implements colvar::cvc. Reimplemented in colvar::distance_dir, colvar::min_distance, and colvar::coordnum. Definition at line 39 of file colvarcomp_distances.C. References colvarmodule::atom_group::center_of_mass(), dist_v, group1, group2, colvarmodule::rvector::norm(), colvarmodule::position_distance(), colvarmodule::atom_group::read_positions(), colvarvalue::real_value, and colvarmodule::atom_group::reset_atoms_data(). 00040 {
00041 group1.reset_atoms_data();
00042 group2.reset_atoms_data();
00043
00044 group1.read_positions();
00045 group2.read_positions();
00046
00047 dist_v = cvm::position_distance (group1.center_of_mass(),
00048 group2.center_of_mass());
00049 x.real_value = dist_v.norm();
00050 }
|
|
||||||||||||
|
Return a positive number if x2>x1, zero if x2==x1, negative otherwise (can be redefined to transparently implement constraints, symmetries and periodicities) Note: it only works with scalar variables, otherwise raises an error.
Reimplemented from colvar::cvc. Reimplemented in colvar::min_distance, and colvar::coordnum. |
|
||||||||||||
|
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 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 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 type. Reimplemented from colvar::cvc. Reimplemented in colvar::min_distance, and colvar::coordnum. |
|
||||||||||||
|
Gradient (with respect to x1) of the square distance (can be redefined to transparently implement constraints, symmetries and periodicities).
Reimplemented from colvar::cvc. Reimplemented in colvar::min_distance, and colvar::coordnum. |
|
||||||||||||
|
Gradient (with respect to x2) of the square distance (can be redefined to transparently implement constraints, symmetries and periodicities).
Reimplemented from colvar::cvc. Reimplemented in colvar::min_distance, and colvar::coordnum. |
|
|
Compute system force on first site only to avoid unwanted coupling to other colvars (see e.g. Ciccotti et al., 2005) Definition at line 310 of file colvarcomp.h. Referenced by distance(). |
|
|
Vector distance, cached to be recycled.
Definition at line 307 of file colvarcomp.h. Referenced by calc_force_invgrads(), calc_gradients(), and calc_value(). |
|
|
First atom group.
Definition at line 303 of file colvarcomp.h. Referenced by apply_force(), calc_force_invgrads(), calc_gradients(), calc_value(), and distance(). |
|
|
Second atom group.
Definition at line 305 of file colvarcomp.h. Referenced by apply_force(), calc_force_invgrads(), calc_gradients(), calc_value(), and distance(). |
1.3.9.1