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

colvarmodule::rotation Class Reference

A rotation between two sets of coordinates (for the moment a wrapper for colvarmodule::quaternion). More...

#include <colvartypes.h>

List of all members.

Public Member Functions

void request_group1_gradients (size_t const &n)
 Allocate space for the derivatives of the rotation.
void request_group2_gradients (size_t const &n)
void calc_optimal_rotation (std::vector< atom_pos > const &pos1, std::vector< atom_pos > const &pos2)
 Calculate the optimal rotation and store the corresponding eigenvalue and eigenvector in the arguments l0 and q0; if the gradients have been previously requested, calculate them as well.
 rotation ()
 Default constructor.
 rotation (cvm::quaternion const &qi)
 Constructor after a quaternion.
 rotation (cvm::real const &angle, cvm::rvector const &axis)
 Constructor after an axis of rotation and an angle (in radians).
 ~rotation ()
 Destructor.
cvm::rvector rotate (cvm::rvector const &v) const
 Return the rotated vector.
cvm::rotation inverse () const
 Return the inverse of this rotation.
cvm::rmatrix matrix () const
 Return the associated 3x3 matrix.

Public Attributes

cvm::quaternion q
 The rotation itself (implemented as a quaternion).
cvm::real lambda
 Eigenvalue corresponding to the optimal rotation.
bool b_debug_gradients
 Perform gradient tests.
std::vector< cvm::atom_pospos1
 Positions to superimpose: the rotation should brings pos1 into pos2.
std::vector< cvm::atom_pospos2
 Positions to superimpose: the rotation should brings pos1 into pos2.
std::vector< cvm::matrix2d<
cvm::rvector, 4, 4 > > 
dS_1
 Derivatives of S.
std::vector< cvm::matrix2d<
cvm::rvector, 4, 4 > > 
dS_2
 Derivatives of S.
std::vector< cvm::rvectordL0_1
 Derivatives of leading eigenvalue.
std::vector< cvm::rvectordL0_2
 Derivatives of leading eigenvalue.
std::vector< cvm::vector1d<
cvm::rvector, 4 > > 
dQ0_1
 Derivatives of leading eigenvector.
std::vector< cvm::vector1d<
cvm::rvector, 4 > > 
dQ0_2
 Derivatives of leading eigenvector.

Static Public Attributes

cvm::real crossing_threshold = 1.0E-04
 Threshold for the eigenvalue crossing test.

Protected Member Functions

void build_matrix (std::vector< cvm::atom_pos > const &pos1, std::vector< cvm::atom_pos > const &pos2, cvm::matrix2d< real, 4, 4 > &S)
 Build the overlap matrix S (used by calc_optimal_rotation()).
void diagonalize_matrix (cvm::matrix2d< cvm::real, 4, 4 > &S, cvm::real S_eigval[4], cvm::matrix2d< cvm::real, 4, 4 > &S_eigvec)
 Diagonalize the overlap matrix S (used by calc_optimal_rotation()).

Protected Attributes

cvm::quaternion q_old
 Previous value of the rotation (used to warn the user when the structure changes too much, and there may be an eigenvalue crossing).


Detailed Description

A rotation between two sets of coordinates (for the moment a wrapper for colvarmodule::quaternion).

Definition at line 884 of file colvartypes.h.


Constructor & Destructor Documentation

colvarmodule::rotation::rotation  )  [inline]
 

Default constructor.

Definition at line 937 of file colvartypes.h.

00938     : b_debug_gradients (false)
00939   {}

colvarmodule::rotation::rotation cvm::quaternion const &  qi  )  [inline]
 

Constructor after a quaternion.

Definition at line 942 of file colvartypes.h.

00943     : b_debug_gradients (false)
00944   {
00945     q = qi;
00946   }

colvarmodule::rotation::rotation cvm::real const &  angle,
cvm::rvector const &  axis
[inline]
 

Constructor after an axis of rotation and an angle (in radians).

Definition at line 949 of file colvartypes.h.

References colvarmodule::rvector::unit(), colvarmodule::rvector::x, colvarmodule::rvector::y, and colvarmodule::rvector::z.

00950     : b_debug_gradients (false)
00951   {
00952     cvm::rvector const axis_n = axis.unit();
00953     cvm::real const sina = ::sin (angle/2.0);
00954     q = cvm::quaternion (::cos (angle/2.0),
00955                          sina * axis_n.x, sina * axis_n.y, sina * axis_n.z);
00956   }

colvarmodule::rotation::~rotation  )  [inline]
 

Destructor.

Definition at line 959 of file colvartypes.h.

00960   {}


Member Function Documentation

void colvarmodule::rotation::build_matrix std::vector< cvm::atom_pos > const &  pos1,
std::vector< cvm::atom_pos > const &  pos2,
cvm::matrix2d< real, 4, 4 > &  S
[protected]
 

Build the overlap matrix S (used by calc_optimal_rotation()).

void colvarmodule::rotation::calc_optimal_rotation std::vector< atom_pos > const &  pos1,
std::vector< atom_pos > const &  pos2
 

Calculate the optimal rotation and store the corresponding eigenvalue and eigenvector in the arguments l0 and q0; if the gradients have been previously requested, calculate them as well.

The method to derive the optimal rotation is defined in: Coutsias EA, Seok C, Dill KA. Using quaternions to calculate RMSD. J Comput Chem. 25(15):1849-57 (2004) DOI: 10.1002/jcc.20110 PubMed: 15376254

Referenced by colvar::orientation_angle::calc_value(), colvar::orientation::calc_value(), colvar::logmsd::calc_value(), colvar::rmsd::calc_value(), and colvarmodule::atom_group::read_positions().

void colvarmodule::rotation::diagonalize_matrix cvm::matrix2d< cvm::real, 4, 4 > &  S,
cvm::real  S_eigval[4],
cvm::matrix2d< cvm::real, 4, 4 > &  S_eigvec
[protected]
 

Diagonalize the overlap matrix S (used by calc_optimal_rotation()).

cvm::rotation colvarmodule::rotation::inverse  )  const [inline]
 

Return the inverse of this rotation.

Definition at line 969 of file colvartypes.h.

Referenced by colvarmodule::atom_group::apply_colvar_force(), colvarmodule::atom_group::apply_force(), and colvarmodule::atom_group::apply_forces().

00970   {
00971     return cvm::rotation (this->q.conjugate());
00972   }

cvm::rmatrix colvarmodule::rotation::matrix  )  const [inline]
 

Return the associated 3x3 matrix.

Definition at line 975 of file colvartypes.h.

References colvarmodule::quaternion::rotation_matrix().

00976   {
00977     return q.rotation_matrix();
00978   }

void colvarmodule::rotation::request_group1_gradients size_t const &  n  )  [inline]
 

Allocate space for the derivatives of the rotation.

Definition at line 909 of file colvartypes.h.

Referenced by colvar::eigenvector::eigenvector().

00910   {
00911     dS_1.resize  (n, cvm::matrix2d<cvm::rvector, 4, 4>());
00912     dL0_1.resize (n, cvm::rvector (0.0, 0.0, 0.0));
00913     dQ0_1.resize (n, cvm::vector1d<cvm::rvector, 4>());
00914   }

void colvarmodule::rotation::request_group2_gradients size_t const &  n  )  [inline]
 

Definition at line 916 of file colvartypes.h.

Referenced by colvar::eigenvector::eigenvector(), and colvar::orientation::orientation().

00917   {
00918     dS_2.resize  (n, cvm::matrix2d<cvm::rvector, 4, 4>());
00919     dL0_2.resize (n, cvm::rvector (0.0, 0.0, 0.0));
00920     dQ0_2.resize (n, cvm::vector1d<cvm::rvector, 4>());
00921   }

cvm::rvector colvarmodule::rotation::rotate cvm::rvector const &  v  )  const [inline]
 

Return the rotated vector.

Definition at line 963 of file colvartypes.h.

References colvarmodule::quaternion::rotate().

Referenced by colvarmodule::atom_group::apply_colvar_force(), colvarmodule::atom_group::apply_force(), colvarmodule::atom_group::apply_forces(), colvarmodule::atom_group::apply_rotation(), colvarmodule::atom_group::read_positions(), colvarmodule::atom_group::read_system_forces(), and colvarmodule::atom_group::read_velocities().

00964   {
00965     return q.rotate (v);
00966   }


Member Data Documentation

bool colvarmodule::rotation::b_debug_gradients
 

Perform gradient tests.

Definition at line 895 of file colvartypes.h.

Referenced by colvar::orientation::orientation().

cvm::real colvarmodule::rotation::crossing_threshold = 1.0E-04 [static]
 

Threshold for the eigenvalue crossing test.

Definition at line 715 of file colvarmodule.C.

std::vector< cvm::rvector > colvarmodule::rotation::dL0_1
 

Derivatives of leading eigenvalue.

Definition at line 904 of file colvartypes.h.

std::vector< cvm::rvector > colvarmodule::rotation::dL0_2
 

Derivatives of leading eigenvalue.

Definition at line 904 of file colvartypes.h.

Referenced by colvar::logmsd::calc_gradients().

std::vector< cvm::vector1d<cvm::rvector, 4> > colvarmodule::rotation::dQ0_1
 

Derivatives of leading eigenvector.

Definition at line 906 of file colvartypes.h.

Referenced by colvar::eigenvector::calc_Jacobian_derivative().

std::vector< cvm::vector1d<cvm::rvector, 4> > colvarmodule::rotation::dQ0_2
 

Derivatives of leading eigenvector.

Definition at line 906 of file colvartypes.h.

Referenced by colvar::orientation::apply_force(), colvar::orientation_angle::calc_gradients(), colvar::logmsd::calc_Jacobian_derivative(), and colvar::rmsd::calc_Jacobian_derivative().

std::vector< cvm::matrix2d<cvm::rvector, 4, 4> > colvarmodule::rotation::dS_1
 

Derivatives of S.

Definition at line 902 of file colvartypes.h.

std::vector< cvm::matrix2d<cvm::rvector, 4, 4> > colvarmodule::rotation::dS_2
 

Derivatives of S.

Definition at line 902 of file colvartypes.h.

cvm::real colvarmodule::rotation::lambda
 

Eigenvalue corresponding to the optimal rotation.

Definition at line 892 of file colvartypes.h.

Referenced by colvar::logmsd::calc_value(), and colvar::rmsd::calc_value().

std::vector< cvm::atom_pos > colvarmodule::rotation::pos1
 

Positions to superimpose: the rotation should brings pos1 into pos2.

Definition at line 899 of file colvartypes.h.

std::vector< cvm::atom_pos > colvarmodule::rotation::pos2
 

Positions to superimpose: the rotation should brings pos1 into pos2.

Definition at line 899 of file colvartypes.h.

cvm::quaternion colvarmodule::rotation::q
 

The rotation itself (implemented as a quaternion).

Definition at line 889 of file colvartypes.h.

Referenced by colvar::orientation_angle::calc_gradients(), colvar::rmsd::calc_gradients(), colvar::eigenvector::calc_Jacobian_derivative(), colvar::logmsd::calc_Jacobian_derivative(), colvar::rmsd::calc_Jacobian_derivative(), colvar::orientation_angle::calc_value(), and colvar::orientation::calc_value().

cvm::quaternion colvarmodule::rotation::q_old [protected]
 

Previous value of the rotation (used to warn the user when the structure changes too much, and there may be an eigenvalue crossing).

Definition at line 988 of file colvartypes.h.


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