OpenMD 3.1
Molecular Dynamics in the Open
|
Public Types | |
using | ElemType = Real |
using | ElemPoinerType = Real* |
Public Types inherited from OpenMD::SquareMatrix< Real, 3 > | |
using | ElemType |
using | ElemPoinerType |
Public Types inherited from OpenMD::RectMatrix< Real, Dim, Dim > | |
using | ElemType |
using | ElemPoinerType |
Public Member Functions | |
SquareMatrix3 () | |
default constructor | |
SquareMatrix3 (Real s) | |
Constructs and initializes every element of this matrix to a scalar. | |
SquareMatrix3 (Real *array) | |
Constructs and initializes from an array. | |
SquareMatrix3 (const SquareMatrix< Real, 3 > &m) | |
copy constructor | |
SquareMatrix3 (const Vector3< Real > &eulerAngles) | |
SquareMatrix3 (Real phi, Real theta, Real psi) | |
SquareMatrix3 (const Quaternion< Real > &q) | |
SquareMatrix3 (Real w, Real x, Real y, Real z) | |
SquareMatrix3< Real > & | operator= (const SquareMatrix< Real, 3 > &m) |
copy assignment operator | |
SquareMatrix3< Real > & | operator= (const Quaternion< Real > &q) |
void | setupRotMat (const Vector3< Real > &eulerAngles) |
Sets this matrix to a rotation matrix by three euler angles @ param euler. | |
void | setupRotMat (Real phi, Real theta, Real psi) |
Sets this matrix to a rotation matrix by three euler angles. | |
void | setupRotMat (const Quaternion< Real > &quat) |
Sets this matrix to a rotation matrix by quaternion. | |
void | setupRotMat (Real w, Real x, Real y, Real z) |
Sets this matrix to a rotation matrix by quaternion. | |
void | setupSkewMat (Vector3< Real > v) |
void | setupSkewMat (Real v1, Real v2, Real v3) |
void | setupVoigtTensor (Vector< Real, 6 > vt) |
Sets this matrix to a symmetric tensor using Voigt Notation. | |
void | setupVoigtTensor (Real v1, Real v2, Real v3, Real v4, Real v5, Real v6) |
void | setupUpperTriangularVoigtTensor (Vector< Real, 6 > vt) |
Sets this matrix to an upper-triangular (asymmetric) tensor using Voigt Notation. | |
void | setupUpperTriangularVoigtTensor (Real v1, Real v2, Real v3, Real v4, Real v5, Real v6) |
void | axisAngle (Vector3d axis, RealType angle) |
Uses Rodrigues' rotation formula for a rotation matrix. | |
Quaternion< Real > | toQuaternion () |
Returns the quaternion from this rotation matrix. | |
Vector3< Real > | toEulerAngles () |
Returns the euler angles from this rotation matrix. | |
bool | closeEnough (const Real &a, const Real &b, const Real &epsilon=std::numeric_limits< Real >::epsilon()) |
Vector3< Real > | toRPY () |
Vector< Real, 6 > | toVoigtTensor () |
Real | determinant () const |
Returns the determinant of this matrix. | |
Real | trace () const |
Returns the trace of this matrix. | |
SquareMatrix3< Real > | inverse () const |
Sets the value of this matrix to the inverse of itself. | |
SquareMatrix3< Real > | transpose () const |
Public Member Functions inherited from OpenMD::SquareMatrix< Real, 3 > | |
SquareMatrix () | |
default constructor | |
SquareMatrix (Real s) | |
Constructs and initializes every element of this matrix to a scalar. | |
SquareMatrix (Real *array) | |
Constructs and initializes from an array. | |
SquareMatrix (const RectMatrix< Real, Dim, Dim > &m) | |
copy constructor | |
SquareMatrix< Real, Dim > & | operator= (const RectMatrix< Real, Dim, Dim > &m) |
copy assignment operator | |
SquareMatrix< Real, Dim > | inverse () |
Returns the inverse of this matrix. | |
Real | determinant () const |
Returns the determinant of this matrix. | |
SquareMatrix< Real, Dim - 1 > | cofactor (int p, int q) |
Real | trace () const |
Returns the trace of this matrix. | |
bool | isSymmetric () const |
Tests if this matrix is symmetrix. | |
bool | isOrthogonal () |
Tests if this matrix is orthogonal. | |
bool | isDiagonal () const |
Tests if this matrix is diagonal. | |
Vector< Real, Dim > | diagonals () const |
Returns a column vector that contains the elements from the diagonal of m in the order R(0) = m(0,0), R(1) = m(1,1), and so on. | |
bool | isUnitMatrix () const |
Tests if this matrix is the unit matrix. | |
SquareMatrix< Real, Dim > | transpose () const |
Return the transpose of this matrix. | |
void | diagonalize () |
Public Member Functions inherited from OpenMD::RectMatrix< Real, Dim, Dim > | |
RectMatrix () | |
default constructor | |
RectMatrix (Real s) | |
Constructs and initializes every element of this matrix to a scalar. | |
RectMatrix (Real *array) | |
RectMatrix (const RectMatrix< Real, Row, Col > &m) | |
copy constructor | |
~RectMatrix () | |
destructor | |
RectMatrix< Real, Row, Col > & | operator= (const RectMatrix< Real, Row, Col > &m) |
copy assignment operator | |
Real & | operator() (unsigned int i, unsigned int j) |
Return the reference of a single element of this matrix. | |
Real | operator() (unsigned int i, unsigned int j) const |
Return the value of a single element of this matrix. | |
void | getArray (Real *array) |
Copy the internal data to an array. | |
Real * | getArrayPointer () |
Returns the pointer of internal array. | |
Vector< Real, Row > | getRow (unsigned int row) |
Returns a row of this matrix as a vector. | |
void | setRow (unsigned int row, const Vector< Real, Row > &v) |
Sets a row of this matrix. | |
Vector< Real, Col > | getColumn (unsigned int col) |
Returns a column of this matrix as a vector. | |
void | setColumn (unsigned int col, const Vector< Real, Col > &v) |
Sets a column of this matrix. | |
void | swapRow (unsigned int i, unsigned int j) |
swap two rows of this matrix | |
void | swapColumn (unsigned int i, unsigned int j) |
swap two Columns of this matrix | |
bool | operator== (const RectMatrix< Real, Row, Col > &m) |
Tests if this matrix is identical to matrix m. | |
bool | operator!= (const RectMatrix< Real, Row, Col > &m) |
Tests if this matrix is not equal to matrix m. | |
void | negate () |
Negates the value of this matrix in place. | |
void | negate (const RectMatrix< Real, Row, Col > &m) |
Sets the value of this matrix to the negation of matrix m. | |
void | add (const RectMatrix< Real, Row, Col > &m) |
Sets the value of this matrix to the sum of itself and m (*this += m). | |
void | add (const RectMatrix< Real, Row, Col > &m1, const RectMatrix< Real, Row, Col > &m2) |
Sets the value of this matrix to the sum of m1 and m2 (*this = m1 + m2). | |
void | sub (const RectMatrix< Real, Row, Col > &m) |
Sets the value of this matrix to the difference of itself and m (*this -= m). | |
void | sub (const RectMatrix< Real, Row, Col > &m1, const RectMatrix< Real, Row, Col > &m2) |
Sets the value of this matrix to the difference of matrix m1 and m2 (*this = m1 - m2). | |
void | mul (Real s) |
Sets the value of this matrix to the scalar multiplication of itself (*this *= s). | |
void | mul (Real s, const RectMatrix< Real, Row, Col > &m) |
Sets the value of this matrix to the scalar multiplication of matrix m (*this = s * m). | |
void | div (Real s) |
Sets the value of this matrix to the scalar division of itself (*this /= s ). | |
void | div (Real s, const RectMatrix< Real, Row, Col > &m) |
Sets the value of this matrix to the scalar division of matrix m (*this = m /s). | |
RectMatrix< Real, Row, Col > & | operator*= (const Real s) |
Multiples a scalar into every element of this matrix. | |
RectMatrix< Real, Row, Col > & | operator/= (const Real s) |
Divides every element of this matrix by a scalar. | |
RectMatrix< Real, Row, Col > & | operator+= (const RectMatrix< Real, Row, Col > &m) |
Sets the value of this matrix to the sum of the other matrix and itself (*this += m). | |
RectMatrix< Real, Row, Col > & | operator-= (const RectMatrix< Real, Row, Col > &m) |
Sets the value of this matrix to the differerence of itself and the other matrix (*this -= m) | |
RectMatrix< Real, Col, Row > | transpose () const |
Return the transpose of this matrix. | |
void | setSubMatrix (unsigned int beginRow, unsigned int beginCol, const MatrixType &m) |
void | getSubMatrix (unsigned int beginRow, unsigned int beginCol, MatrixType &m) |
unsigned int | getNRow () const |
unsigned int | getNCol () const |
Real | frobeniusNorm () |
Static Public Member Functions | |
static void | diagonalize (SquareMatrix3< Real > &a, Vector3< Real > &w, SquareMatrix3< Real > &v) |
Extract the eigenvalues and eigenvectors from a 3x3 matrix. | |
Static Public Member Functions inherited from OpenMD::SquareMatrix< Real, 3 > | |
static SquareMatrix< Real, Dim > | identity () |
Returns an identity matrix. | |
static int | jacobi (SquareMatrix< Real, Dim > &a, Vector< Real, Dim > &d, SquareMatrix< Real, Dim > &v) |
Jacobi iteration routines for computing eigenvalues/eigenvectors of real symmetric matrix. | |
Additional Inherited Members | |
Protected Attributes inherited from OpenMD::RectMatrix< Real, Dim, Dim > | |
Real | data_ [Row][Col] |
Definition at line 68 of file SquareMatrix3.hpp.
using OpenMD::SquareMatrix3< Real >::ElemPoinerType = Real* |
Definition at line 71 of file SquareMatrix3.hpp.
using OpenMD::SquareMatrix3< Real >::ElemType = Real |
Definition at line 70 of file SquareMatrix3.hpp.
|
inline |
default constructor
Definition at line 74 of file SquareMatrix3.hpp.
|
inline |
Constructs and initializes every element of this matrix to a scalar.
Definition at line 77 of file SquareMatrix3.hpp.
|
inline |
Constructs and initializes from an array.
Definition at line 80 of file SquareMatrix3.hpp.
|
inline |
copy constructor
Definition at line 83 of file SquareMatrix3.hpp.
|
inline |
Definition at line 85 of file SquareMatrix3.hpp.
|
inline |
Definition at line 89 of file SquareMatrix3.hpp.
|
inline |
Definition at line 93 of file SquareMatrix3.hpp.
|
inline |
Definition at line 95 of file SquareMatrix3.hpp.
|
inline |
Uses Rodrigues' rotation formula for a rotation matrix.
axis | the axis to rotate around |
angle | the angle to rotate (in radians) |
Definition at line 226 of file SquareMatrix3.hpp.
References OpenMD::SquareMatrix< Real, 3 >::identity(), and OpenMD::Vector< Real, Dim >::normalize().
|
inline |
Definition at line 342 of file SquareMatrix3.hpp.
|
inline |
Returns the determinant of this matrix.
Definition at line 399 of file SquareMatrix3.hpp.
Referenced by OpenMD::MolecularRestraint::calcForce(), OpenMD::SquareMatrix3< Real >::diagonalize(), OpenMD::Thermo::getGyrationalVolume(), OpenMD::Thermo::getGyrationalVolume(), and OpenMD::SquareMatrix3< Real >::inverse().
|
static |
Extract the eigenvalues and eigenvectors from a 3x3 matrix.
The eigenvectors (the columns of V) will be normalized. The eigenvectors are aligned optimally with the x, y, and z axes respectively.
a | symmetric matrix whose eigenvectors are to be computed. On return, the matrix is overwritten |
w | will contain the eigenvalues of the matrix On return of this function |
v | the columns of this matrix will contain the eigenvectors. The eigenvectors are normalized and mutually orthogonal. |
Definition at line 487 of file SquareMatrix3.hpp.
References OpenMD::cross(), OpenMD::SquareMatrix3< Real >::determinant(), OpenMD::RectMatrix< Real, Row, Col >::getRow(), OpenMD::SquareMatrix< Real, 3 >::identity(), OpenMD::SquareMatrix< Real, 3 >::jacobi(), OpenMD::Vector< Real, Dim >::normalize(), OpenMD::RectMatrix< Real, Row, Col >::setRow(), and OpenMD::RectMatrix< Real, Row, Col >::swapRow().
|
inline |
Sets the value of this matrix to the inverse of itself.
Definition at line 422 of file SquareMatrix3.hpp.
References OpenMD::SquareMatrix3< Real >::determinant().
Referenced by OpenMD::Velocitizer::removeAngularDrift(), OpenMD::Snapshot::setBoundingBox(), and OpenMD::Snapshot::setHmat().
|
inline |
Definition at line 104 of file SquareMatrix3.hpp.
|
inline |
copy assignment operator
Definition at line 98 of file SquareMatrix3.hpp.
References OpenMD::SquareMatrix< Real, Dim >::operator=().
|
inline |
Sets this matrix to a rotation matrix by quaternion.
quat |
Definition at line 151 of file SquareMatrix3.hpp.
References OpenMD::SquareMatrix3< Real >::setupRotMat(), OpenMD::Quaternion< Real >::w(), OpenMD::Quaternion< Real >::x(), OpenMD::Quaternion< Real >::y(), and OpenMD::Quaternion< Real >::z().
|
inline |
Sets this matrix to a rotation matrix by three euler angles @ param euler.
Definition at line 113 of file SquareMatrix3.hpp.
References OpenMD::SquareMatrix3< Real >::setupRotMat().
Referenced by OpenMD::SquareMatrix3< Real >::setupRotMat(), and OpenMD::SquareMatrix3< Real >::setupRotMat().
|
inline |
Sets this matrix to a rotation matrix by three euler angles.
phi | |
theta | |
psi |
Definition at line 123 of file SquareMatrix3.hpp.
|
inline |
Sets this matrix to a rotation matrix by quaternion.
w | the first element |
x | the second element |
y | the third element |
z | the fourth element |
Definition at line 162 of file SquareMatrix3.hpp.
References OpenMD::Quaternion< Real >::toRotationMatrix3().
|
inline |
Definition at line 169 of file SquareMatrix3.hpp.
|
inline |
Definition at line 167 of file SquareMatrix3.hpp.
|
inline |
Definition at line 211 of file SquareMatrix3.hpp.
|
inline |
Sets this matrix to an upper-triangular (asymmetric) tensor using Voigt Notation.
vt |
Definition at line 207 of file SquareMatrix3.hpp.
References OpenMD::SquareMatrix3< Real >::setupUpperTriangularVoigtTensor().
Referenced by OpenMD::SquareMatrix3< Real >::setupUpperTriangularVoigtTensor().
|
inline |
Definition at line 189 of file SquareMatrix3.hpp.
|
inline |
Sets this matrix to a symmetric tensor using Voigt Notation.
vt |
Definition at line 185 of file SquareMatrix3.hpp.
References OpenMD::SquareMatrix3< Real >::setupVoigtTensor().
Referenced by OpenMD::SquareMatrix3< Real >::setupVoigtTensor().
|
inline |
Returns the euler angles from this rotation matrix.
invalid | rotation matrix We use so-called "x-convention", which is the most common definition. In this convention, the rotation given by Euler angles (phi, theta, psi), where the first rotation is by an angle phi about the z-axis, the second is by an angle theta (0 <= theta <= 180) about the x-axis, and the third is by an angle psi about the z-axis (again). |
Definition at line 295 of file SquareMatrix3.hpp.
|
inline |
Returns the quaternion from this rotation matrix.
invalid | rotation matrix |
Definition at line 241 of file SquareMatrix3.hpp.
Referenced by OpenMD::MolecularRestraint::calcForce(), and OpenMD::ObjectRestraint::calcForce().
|
inline |
Definition at line 348 of file SquareMatrix3.hpp.
|
inline |
Definition at line 387 of file SquareMatrix3.hpp.
|
inline |
Returns the trace of this matrix.
Definition at line 412 of file SquareMatrix3.hpp.
|
inline |
Definition at line 447 of file SquareMatrix3.hpp.