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

Public Member Functions | |
| distance_dir (std::string const &conf) | |
| distance_dir () | |
| virtual | ~distance_dir () |
| 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 | 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. | |
Definition at line 378 of file colvarcomp.h.
|
|
Definition at line 474 of file colvarcomp_distances.C. References colvarvalue::type(). 00475 : distance (conf) 00476 { 00477 function_type = "distance_dir"; 00478 x.type (colvarvalue::type_unitvector); 00479 }
|
|
|
Definition at line 482 of file colvarcomp_distances.C. References colvarvalue::type(). 00483 : distance() 00484 { 00485 function_type = "distance_dir"; 00486 x.type (colvarvalue::type_unitvector); 00487 }
|
|
|
Definition at line 384 of file colvarcomp.h. 00384 {}
|
|
|
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
Reimplemented from colvar::distance. Definition at line 516 of file colvarcomp_distances.C. References colvarmodule::atom_group::apply_force(), colvarmodule::atom_group::noforce, and colvarvalue::rvector_value. 00517 {
00518 // remove the radial force component
00519 cvm::real const iprod = force.rvector_value * x.rvector_value;
00520 cvm::rvector const force_tang = force.rvector_value - iprod * x.rvector_value;
00521
00522 if (!group1.noforce)
00523 group1.apply_force (-1.0 * force_tang);
00524
00525 if (!group2.noforce)
00526 group2.apply_force ( force_tang);
00527 }
|
|
|
Calculate the atomic gradients, to be reused later in order to apply forces.
Reimplemented from colvar::distance. Definition at line 508 of file colvarcomp_distances.C. 00509 {
00510 // gradients are computed on the fly within apply_force()
00511 // Note: could be a problem if a future bias relies on gradient
00512 // calculations...
00513 }
|
|
|
Calculate the variable.
Reimplemented from colvar::distance. Definition at line 490 of file colvarcomp_distances.C. References colvarmodule::atom_group::center_of_mass(), colvarmodule::position_distance(), colvarmodule::atom_group::read_positions(), colvarmodule::atom_group::reset_atoms_data(), colvarvalue::rvector_value, and colvarmodule::rvector::unit(). 00491 {
00492 group1.reset_atoms_data();
00493 group2.reset_atoms_data();
00494
00495 group1.read_positions();
00496 group2.read_positions();
00497
00498 if (b_no_PBC) {
00499 dist_v = group2.center_of_mass() - group1.center_of_mass();
00500 } else {
00501 dist_v = cvm::position_distance (group1.center_of_mass(),
00502 group2.center_of_mass());
00503 }
00504 x.rvector_value = dist_v.unit();
00505 }
|
|
||||||||||||
|
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::distance. Definition at line 1339 of file colvarcomp.h. References colvarmodule::fatal_error(). 01341 {
01342 cvm::fatal_error ("Error: cannot compare() two distance directions.\n");
01343 return 0.0;
01344 }
|
|
||||||||||||
|
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::distance. Definition at line 1321 of file colvarcomp.h. References colvarvalue::norm2(), and colvarvalue::rvector_value. 01323 {
01324 return (x1.rvector_value - x2.rvector_value).norm2();
01325 }
|
|
||||||||||||
|
Gradient (with respect to x1) of the square distance (can be redefined to transparently implement constraints, symmetries and periodicities).
Reimplemented from colvar::distance. Definition at line 1327 of file colvarcomp.h. References colvarvalue::rvector_value. 01329 {
01330 return colvarvalue ((x1.rvector_value - x2.rvector_value), colvarvalue::type_unitvector);
01331 }
|
|
||||||||||||
|
Gradient (with respect to x2) of the square distance (can be redefined to transparently implement constraints, symmetries and periodicities).
Reimplemented from colvar::distance. Definition at line 1333 of file colvarcomp.h. References colvarvalue::rvector_value. 01335 {
01336 return colvarvalue ((x2.rvector_value - x1.rvector_value), colvarvalue::type_unitvector);
01337 }
|
1.3.9.1