Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

colvar::distance_dir Class Reference

Colvar component: distance unit vector (direction) between centers of mass of two groups (colvarvalue::type_unitvector type, range [-1:1]x[-1:1]x[-1:1]). More...

#include <colvarcomp.h>

Inheritance diagram for colvar::distance_dir:

colvar::distance colvar::cvc colvarparse List of all members.

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).

Detailed Description

Colvar component: distance unit vector (direction) between centers of mass of two groups (colvarvalue::type_unitvector type, range [-1:1]x[-1:1]x[-1:1]).

Definition at line 362 of file colvarcomp.h.


Constructor & Destructor Documentation

colvar::distance_dir::distance_dir std::string const &  conf  ) 
 

Definition at line 412 of file colvarcomp_distances.C.

References colvarvalue::type().

00413   : distance (conf)
00414 {
00415   function_type = "distance_dir";
00416   x.type (colvarvalue::type_unitvector);
00417 }

colvar::distance_dir::distance_dir  ) 
 

Definition at line 420 of file colvarcomp_distances.C.

References colvarvalue::type().

00421   : distance()
00422 {
00423   function_type = "distance_dir";
00424   x.type (colvarvalue::type_unitvector);
00425 }

virtual colvar::distance_dir::~distance_dir  )  [inline, virtual]
 

Definition at line 368 of file colvarcomp.h.

00368 {}


Member Function Documentation

void colvar::distance_dir::apply_force colvarvalue const &  force  )  [virtual]
 

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

Parameters:
cvforce The collective variable force, usually coming from the biases and eventually manipulated by the parent object

Reimplemented from colvar::distance.

Definition at line 448 of file colvarcomp_distances.C.

References colvarmodule::atom_group::apply_force(), colvarmodule::atom_group::noforce, and colvarvalue::rvector_value.

00449 {
00450   // remove the radial force component
00451   cvm::real const iprod = force.rvector_value * x.rvector_value;
00452   cvm::rvector const force_tang = (1.0 - iprod) * force.rvector_value;
00453 
00454   if (!group1.noforce)
00455     group1.apply_force (-1.0 * force_tang);
00456 
00457   if (!group2.noforce)
00458     group2.apply_force (       force_tang);
00459 }

void colvar::distance_dir::calc_gradients  )  [virtual]
 

Calculate the atomic gradients, to be reused later in order to apply forces.

Reimplemented from colvar::distance.

Definition at line 442 of file colvarcomp_distances.C.

00443 {
00444   // gradients are computed on the fly within apply_force()
00445 }

void colvar::distance_dir::calc_value  )  [virtual]
 

Calculate the variable.

Reimplemented from colvar::distance.

Definition at line 428 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().

00429 {
00430   group1.reset_atoms_data();
00431   group2.reset_atoms_data();
00432 
00433   group1.read_positions();
00434   group2.read_positions();
00435 
00436   dist_v = cvm::position_distance (group1.center_of_mass(),
00437                                    group2.center_of_mass());
00438   x.rvector_value = dist_v.unit();
00439 }


The documentation for this class was generated from the following files:
Generated on Mon Nov 23 04:59:32 2009 for NAMD by  doxygen 1.3.9.1