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

colvar::orientation_angle Class Reference

Colvar component: angle of rotation with respect to a set of reference coordinates (colvarvalue::type_scalar type, range [0:PI)). More...

#include <colvarcomp.h>

Inheritance diagram for colvar::orientation_angle:

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

Public Member Functions

 orientation_angle (std::string const &conf)
 orientation_angle ()
virtual ~orientation_angle ()
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.

Detailed Description

Colvar component: angle of rotation with respect to a set of reference coordinates (colvarvalue::type_scalar type, range [0:PI)).

Definition at line 874 of file colvarcomp.h.


Constructor & Destructor Documentation

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

Definition at line 124 of file colvarcomp_rotations.C.

References colvarvalue::type().

00125   : orientation (conf)
00126 {
00127   function_type = "orientation_angle";
00128   x.type (colvarvalue::type_scalar);
00129 }

colvar::orientation_angle::orientation_angle  ) 
 

Definition at line 132 of file colvarcomp_rotations.C.

References colvarvalue::type().

00133   : orientation()
00134 {
00135   function_type = "orientation_angle";
00136   x.type (colvarvalue::type_scalar);
00137 }

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

Definition at line 881 of file colvarcomp.h.

00881 {}


Member Function Documentation

void colvar::orientation_angle::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::orientation.

Definition at line 170 of file colvarcomp_rotations.C.

References colvarmodule::atom_group::apply_colvar_force(), colvarmodule::atom_group::noforce, and colvarvalue::real_value.

00171 {
00172   cvm::real const &fw = force.real_value;
00173 
00174   if (!atoms.noforce) {
00175     atoms.apply_colvar_force (fw);
00176   }
00177 }

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

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

Reimplemented from colvar::orientation.

Definition at line 157 of file colvarcomp_rotations.C.

References colvarmodule::rotation::dQ0_2, and colvarmodule::rotation::q.

00158 {
00159   cvm::real const dxdq0 =
00160     ( ((rot.q).q0 * (rot.q).q0 < 1.0) ? 
00161       ((180.0 / PI) * (-2.0) / ::sqrt (1.0 - ((rot.q).q0 * (rot.q).q0))) :
00162       0.0 );
00163 
00164   for (size_t ia = 0; ia < atoms.size(); ia++) {
00165     atoms[ia].grad = (dxdq0 * (rot.dQ0_2[ia])[0]);
00166   }
00167 }

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

Calculate the variable.

Reimplemented from colvar::orientation.

Definition at line 140 of file colvarcomp_rotations.C.

References colvarmodule::rotation::calc_optimal_rotation(), colvarmodule::atom_group::center_of_geometry(), colvarmodule::atom_group::positions_shifted(), colvarmodule::rotation::q, colvarmodule::atom_group::read_positions(), colvarvalue::real_value, and colvarmodule::atom_group::reset_atoms_data().

00141 {
00142   atoms.reset_atoms_data();
00143   atoms.read_positions();
00144 
00145   atoms_cog = atoms.center_of_geometry();
00146 
00147   rot.calc_optimal_rotation (ref_pos, atoms.positions_shifted (-1.0 * atoms_cog));
00148 
00149   if ((rot.q).q0 >= 0.0) {
00150     x.real_value = (180.0/PI) * 2.0 * ::acos ((rot.q).q0);
00151   } else {
00152     x.real_value = (180.0/PI) * 2.0 * ::acos (-1.0 * (rot.q).q0);
00153   }
00154 }

virtual cvm::real colvar::orientation_angle::compare colvarvalue const &  x1,
colvarvalue const &  x2
const [virtual]
 

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::orientation.

virtual cvm::real colvar::orientation_angle::dist2 colvarvalue const &  x1,
colvarvalue const &  x2
const [virtual]
 

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::orientation.

virtual colvarvalue colvar::orientation_angle::dist2_lgrad colvarvalue const &  x1,
colvarvalue const &  x2
const [virtual]
 

Gradient (with respect to x1) of the square distance (can be redefined to transparently implement constraints, symmetries and periodicities).

Reimplemented from colvar::orientation.

virtual colvarvalue colvar::orientation_angle::dist2_rgrad colvarvalue const &  x1,
colvarvalue const &  x2
const [virtual]
 

Gradient (with respect to x2) of the square distance (can be redefined to transparently implement constraints, symmetries and periodicities).

Reimplemented from colvar::orientation.


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