Collective Variables Module - Developer Documentation
Searching...
No Matches
colvarmodule::rotation Class Reference

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

`#include <colvartypes.h>`

Collaboration diagram for colvarmodule::rotation:
[legend]

## Public Member Functions

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

void calc_optimal_rotation (std::vector< cvm::atom > const &pos1, std::vector< atom_pos > const &pos2)

int init ()
Initialize member data.

rotation ()
Default constructor.

rotation (cvm::quaternion const &qi)
Constructor after a quaternion.

rotation (cvm::real 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.

cvm::real spin_angle (cvm::rvector const &axis) const
Return the spin angle (in degrees) with respect to the provided axis (which MUST be normalized)

cvm::quaternion dspin_angle_dq (cvm::rvector const &axis) const
Return the derivative of the spin angle with respect to the quaternion.

cvm::real cos_theta (cvm::rvector const &axis) const
Return the projection of the orientation vector onto a predefined axis.

cvm::quaternion dcos_theta_dq (cvm::rvector const &axis) const
Return the derivative of the tilt wrt the quaternion.

## Public Attributes

cvm::quaternion q
The rotation itself (implemented as a quaternion)

## Static Public Attributes

static bool monitor_crossings = false
Whether to test for eigenvalue crossing.

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

## Protected Member Functions

void build_correlation_matrix (std::vector< cvm::atom_pos > const &pos1, std::vector< cvm::atom_pos > const &pos2)
Build the correlation matrix C (used by calc_optimal_rotation())

void build_correlation_matrix (std::vector< cvm::atom > const &pos1, std::vector< cvm::atom_pos > const &pos2)

void calc_optimal_rotation_impl ()
Actual implementation of `calc_optimal_rotation` (and called by it)

void compute_overlap_matrix ()
Compute 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)

void * jacobi
Pointer to instance of Jacobi solver.

## Private Attributes

cvm::rmatrix C
Correlation matrix C (3, 3)

cvm::real S [4][4]
Overlap matrix S (4, 4)

cvm::real S_eigval [4]
Eigenvalues of S.

cvm::real S_eigvec [4][4]
Eigenvectors of S.

cvm::real S_backup [4][4]

## Friends

template<typename T1 , typename T2 >
struct rotation_derivative

template<typename T1 , typename T2 >
void debug_gradients (cvm::rotation &rot, const std::vector< T1 > &pos1, const std::vector< T2 > &pos2)
Function for debugging gradients (allow using either std::vector<cvm::atom_pos> or std::vector<cvm::atom> for pos1 and pos2) More...

## Detailed Description

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

## ◆ 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