#include <RMSD.h>
Public Member Functions | |
RMSD () | |
Constructor. More... | |
double | calc_DDistDRef (const std::vector< Vector > &positions, std::vector< Vector > &DDistDPos, std::vector< Vector > &DDistDRef, const bool squared=false) |
Other convenience methods: calculate the derivative of distance respect to position(DDistDPos) and reference (DDistDPos) More... | |
double | calc_DDistDRef_Rot_DRotDPos (const std::vector< Vector > &positions, std::vector< Vector > &DDistDPos, std::vector< Vector > &DDistDRef, Tensor &Rotation, Matrix< std::vector< Vector > > &DRotDPos, const bool squared=false) |
double | calc_DDistDRef_Rot_DRotDPos_DRotDRef (const std::vector< Vector > &positions, std::vector< Vector > &DDistDPos, std::vector< Vector > &DDistDRef, Tensor &Rotation, Matrix< std::vector< Vector > > &DRotDPos, Matrix< std::vector< Vector > > &DRotDRef, const bool squared=false) |
double | calc_FitElements (const std::vector< Vector > &pos, Tensor &Rotation, Matrix< std::vector< Vector > > &DRotDPos, std::vector< Vector > ¢eredpositions, Vector ¢er_positions, const bool &squared=false) |
convenience method to retrieve all the bits and pieces needed by FitToTemplate More... | |
double | calc_PCAelements (const std::vector< Vector > &pos, std::vector< Vector > &DDistDPos, Tensor &Rotation, Matrix< std::vector< Vector > > &DRotDPos, std::vector< Vector > &alignedpositions, std::vector< Vector > ¢eredpositions, std::vector< Vector > ¢eredreference, const bool &squared=false) const |
convenience method to retrieve all the bits and pieces for PCA More... | |
double | calc_Rot (const std::vector< Vector > &positions, std::vector< Vector > &DDistDPos, Tensor &Rotation, const bool squared=false) |
calculate rotation matrix, derivative of rotation matrix w.r.t. positions More... | |
double | calc_Rot_DRotDRr01 (const std::vector< Vector > &positions, Tensor &Rotation, std::array< std::array< Tensor, 3 >, 3 > &DRotDRr01, const bool squared=false) |
calculate rotation matrix, derivative of rotation matrix w.r.t. positions, derivative of rotation matrix w.r.t. rr01 More... | |
double | calc_SOMA (const std::vector< Vector > &positions, std::vector< Vector > &DDistDPos, std::vector< Vector > &DDistDRef, const bool squared=false) |
calculate the derivative for SOMA (i.e. derivative respect to reference frame without the matrix derivative) More... | |
double | calculate (const std::vector< Vector > &positions, std::vector< Vector > &derivatives, bool squared=false) const |
Compute rmsd: note that this is an intermediate layer which is kept in order to evtl expand with more alignment types/user options to be called while keeping the workhorses separated. More... | |
double | calculateWithCloseStructure (const std::vector< Vector > &positions, std::vector< Vector > &DDistDPos, Tensor &rotationPosClose, Tensor &rotationRefClose, std::array< std::array< Tensor, 3 >, 3 > &drotationPosCloseDrr01, const bool squared=false) |
calculate with close structure, i.e. approximate the RMSD without expensive computation of rotation matrix by reusing saved rotation matrices from previous iterations More... | |
void | clear () |
clear the structure More... | |
std::vector< double > | getAlign () |
std::vector< double > | getDisplace () |
std::string | getMethod () |
std::vector< Vector > | getReference () |
template<bool safe, bool alEqDis> | |
double | optimalAlignment (const std::vector< double > &align, const std::vector< double > &displace, const std::vector< Vector > &positions, const std::vector< Vector > &reference, std::vector< Vector > &DDistDPos, bool squared=false) const |
template<bool safe, bool alEqDis> | |
double | optimalAlignment_DDistDRef (const std::vector< double > &align, const std::vector< double > &displace, const std::vector< Vector > &positions, const std::vector< Vector > &reference, std::vector< Vector > &DDistDPos, std::vector< Vector > &DDistDRef, bool squared=false) const |
template<bool safe, bool alEqDis> | |
double | optimalAlignment_DDistDRef_Rot_DRotDPos (const std::vector< double > &align, const std::vector< double > &displace, const std::vector< Vector > &positions, const std::vector< Vector > &reference, std::vector< Vector > &DDistDPos, std::vector< Vector > &DDistDRef, Tensor &Rotation, Matrix< std::vector< Vector > > &DRotDPos, bool squared=false) const |
template<bool safe, bool alEqDis> | |
double | optimalAlignment_DDistDRef_Rot_DRotDPos_DRotDRef (const std::vector< double > &align, const std::vector< double > &displace, const std::vector< Vector > &positions, const std::vector< Vector > &reference, std::vector< Vector > &DDistDPos, std::vector< Vector > &DDistDRef, Tensor &Rotation, Matrix< std::vector< Vector > > &DRotDPos, Matrix< std::vector< Vector > > &DRotDRef, bool squared=false) const |
template<bool safe, bool alEqDis> | |
double | optimalAlignment_Fit (const std::vector< double > &align, const std::vector< double > &displace, const std::vector< Vector > &positions, const std::vector< Vector > &reference, Tensor &Rotation, Matrix< std::vector< Vector > > &DRotDPos, std::vector< Vector > ¢eredpositions, Vector ¢er_positions, bool squared=false) |
template<bool safe, bool alEqDis> | |
double | optimalAlignment_PCA (const std::vector< double > &align, const std::vector< double > &displace, const std::vector< Vector > &positions, const std::vector< Vector > &reference, std::vector< Vector > &alignedpositions, std::vector< Vector > ¢eredpositions, std::vector< Vector > ¢eredreference, Tensor &Rotation, std::vector< Vector > &DDistDPos, Matrix< std::vector< Vector > > &DRotDPos, bool squared=false) const |
template<bool safe, bool alEqDis> | |
double | optimalAlignment_Rot (const std::vector< double > &align, const std::vector< double > &displace, const std::vector< Vector > &positions, const std::vector< Vector > &reference, std::vector< Vector > &derivatives, Tensor &Rotation, bool squared=false) const |
template<bool safe, bool alEqDis> | |
double | optimalAlignment_Rot_DRotDRr01 (const std::vector< double > &align, const std::vector< double > &displace, const std::vector< Vector > &positions, const std::vector< Vector > &reference, Tensor &Rotation, std::array< std::array< Tensor, 3 >, 3 > &drotationPosCloseDrr01, bool squared=false) const |
template<bool safe, bool alEqDis> | |
double | optimalAlignment_SOMA (const std::vector< double > &align, const std::vector< double > &displace, const std::vector< Vector > &positions, const std::vector< Vector > &reference, std::vector< Vector > &DDistDPos, std::vector< Vector > &DDistDRef, bool squared=false) const |
template<bool safe, bool alEqDis> | |
double | optimalAlignmentWithCloseStructure (const std::vector< double > &align, const std::vector< double > &displace, const std::vector< Vector > &positions, const std::vector< Vector > &reference, std::vector< Vector > &derivatives, Tensor &rotationPosClose, Tensor &rotationRefClose, std::array< std::array< Tensor, 3 >, 3 > &drotationPosCloseDrr01, bool squared=false) const |
void | set (const PDB &, const std::string &mytype, bool remove_center=true, bool normalize_weights=true) |
set reference, align and displace from input pdb structure: evtl remove com from the initial structure and normalize the input weights from the pdb More... | |
void | set (const std::vector< double > &align, const std::vector< double > &displace, const std::vector< Vector > &reference, const std::string &mytype, bool remove_center=true, bool normalize_weights=true) |
set align displace reference and type from input vectors More... | |
void | setAlign (const std::vector< double > &align, bool normalize_weights=true, bool remove_center=true) |
set weights and remove the center from reference with normalized weights. If the com has been removed, it resets to the new value More... | |
void | setDisplace (const std::vector< double > &displace, bool normalize_weights=true) |
set align More... | |
void | setReference (const std::vector< Vector > &reference) |
set reference coordinates, remove the com by using uniform weights More... | |
void | setType (const std::string &mytype) |
set the type of alignment we are doing More... | |
double | simpleAlignment (const std::vector< double > &align, const std::vector< double > &displace, const std::vector< Vector > &positions, const std::vector< Vector > &reference, std::vector< Vector > &derivatives, std::vector< Vector > &displacement, bool squared=false) const |
workhorses More... | |
Static Public Member Functions | |
static Tensor | getMatrixFromDRot (Matrix< std::vector< Vector > > &drotdpos, const unsigned &i, const unsigned &a) |
static convenience method to get the matrix i,a from drotdpos (which is a bit tricky) More... | |
Private Types | |
enum | AlignmentMethod { SIMPLE, OPTIMAL, OPTIMAL_FAST } |
Private Member Functions | |
void | addCenter (std::vector< Vector > &p, Vector &c) |
Vector | calculateCenter (std::vector< Vector > &p, std::vector< double > &w) |
void | removeCenter (std::vector< Vector > &p, Vector &c) |
Private Attributes | |
std::vector< double > | align |
AlignmentMethod | alignmentMethod |
std::vector< double > | displace |
Vector | positions_center |
bool | positions_center_is_calculated |
bool | positions_center_is_removed |
std::vector< Vector > | reference |
Vector | reference_center |
bool | reference_center_is_calculated |
bool | reference_center_is_removed |
A class that implements RMSD calculations This is a class that implements the various infrastructure to calculate the RMSD or MSD respect a given frame. It can be done through an optimal alignment scheme as Kearsley or, more simply, by resetting the center of mass. This is the class that decides this. A very simple use is
#include "tools/PDB.h" #include "tools/RMSD.h" #include "tools/Vector.h" using namespace PLMD; RMSD rmsd; PDB pdb; // get the pdb (see PDB documentation) pdb.read("file.pdb",true,1.0); string type; type.assign("OPTIMAL"); // set the reference and the type rmsd.set(pdb,type); // this calculates the rmsd and the derivatives vector<Vector> derivs; double val; val=rmsd.calculate(getPositions(),derivs,true);
|
private |
PLMD::RMSD::RMSD | ( | ) |
Constructor.
double PLMD::RMSD::calc_DDistDRef | ( | const std::vector< Vector > & | positions, |
std::vector< Vector > & | DDistDPos, | ||
std::vector< Vector > & | DDistDRef, | ||
const bool | squared = false |
||
) |
Other convenience methods: calculate the derivative of distance respect to position(DDistDPos) and reference (DDistDPos)
convenience method for calculating the standard derivatives and the derivative of the rmsd respect to the reference position
double PLMD::RMSD::calc_DDistDRef_Rot_DRotDPos | ( | const std::vector< Vector > & | positions, |
std::vector< Vector > & | DDistDPos, | ||
std::vector< Vector > & | DDistDRef, | ||
Tensor & | Rotation, | ||
Matrix< std::vector< Vector > > & | DRotDPos, | ||
const bool | squared = false |
||
) |
double PLMD::RMSD::calc_DDistDRef_Rot_DRotDPos_DRotDRef | ( | const std::vector< Vector > & | positions, |
std::vector< Vector > & | DDistDPos, | ||
std::vector< Vector > & | DDistDRef, | ||
Tensor & | Rotation, | ||
Matrix< std::vector< Vector > > & | DRotDPos, | ||
Matrix< std::vector< Vector > > & | DRotDRef, | ||
const bool | squared = false |
||
) |
double PLMD::RMSD::calc_FitElements | ( | const std::vector< Vector > & | pos, |
Tensor & | Rotation, | ||
Matrix< std::vector< Vector > > & | DRotDPos, | ||
std::vector< Vector > & | centeredpositions, | ||
Vector & | center_positions, | ||
const bool & | squared = false |
||
) |
convenience method to retrieve all the bits and pieces needed by FitToTemplate
double PLMD::RMSD::calc_PCAelements | ( | const std::vector< Vector > & | pos, |
std::vector< Vector > & | DDistDPos, | ||
Tensor & | Rotation, | ||
Matrix< std::vector< Vector > > & | DRotDPos, | ||
std::vector< Vector > & | alignedpositions, | ||
std::vector< Vector > & | centeredpositions, | ||
std::vector< Vector > & | centeredreference, | ||
const bool & | squared = false |
||
) | const |
convenience method to retrieve all the bits and pieces for PCA
double PLMD::RMSD::calc_Rot | ( | const std::vector< Vector > & | positions, |
std::vector< Vector > & | DDistDPos, | ||
Tensor & | Rotation, | ||
const bool | squared = false |
||
) |
calculate rotation matrix, derivative of rotation matrix w.r.t. positions
double PLMD::RMSD::calc_Rot_DRotDRr01 | ( | const std::vector< Vector > & | positions, |
Tensor & | Rotation, | ||
std::array< std::array< Tensor, 3 >, 3 > & | DRotDRr01, | ||
const bool | squared = false |
||
) |
calculate rotation matrix, derivative of rotation matrix w.r.t. positions, derivative of rotation matrix w.r.t. rr01
double PLMD::RMSD::calc_SOMA | ( | const std::vector< Vector > & | positions, |
std::vector< Vector > & | DDistDPos, | ||
std::vector< Vector > & | DDistDRef, | ||
const bool | squared = false |
||
) |
calculate the derivative for SOMA (i.e. derivative respect to reference frame without the matrix derivative)
convenience method for calculating the standard derivatives and the derivative of the rmsd respect to the reference position without the matrix contribution as required by SOMA
double PLMD::RMSD::calculate | ( | const std::vector< Vector > & | positions, |
std::vector< Vector > & | derivatives, | ||
bool | squared = false |
||
) | const |
Compute rmsd: note that this is an intermediate layer which is kept in order to evtl expand with more alignment types/user options to be called while keeping the workhorses separated.
This is the main workhorse for rmsd that decides to use specific optimal alignment versions.
|
inlineprivate |
double PLMD::RMSD::calculateWithCloseStructure | ( | const std::vector< Vector > & | positions, |
std::vector< Vector > & | DDistDPos, | ||
Tensor & | rotationPosClose, | ||
Tensor & | rotationRefClose, | ||
std::array< std::array< Tensor, 3 >, 3 > & | drotationPosCloseDrr01, | ||
const bool | squared = false |
||
) |
calculate with close structure, i.e. approximate the RMSD without expensive computation of rotation matrix by reusing saved rotation matrices from previous iterations
void PLMD::RMSD::clear | ( | ) |
clear the structure
std::vector< double > PLMD::RMSD::getAlign | ( | ) |
std::vector< double > PLMD::RMSD::getDisplace | ( | ) |
|
inlinestatic |
static convenience method to get the matrix i,a from drotdpos (which is a bit tricky)
string PLMD::RMSD::getMethod | ( | ) |
std::vector< Vector > PLMD::RMSD::getReference | ( | ) |
template double PLMD::RMSD::optimalAlignment< false, false > | ( | const std::vector< double > & | align, |
const std::vector< double > & | displace, | ||
const std::vector< Vector > & | positions, | ||
const std::vector< Vector > & | reference, | ||
std::vector< Vector > & | DDistDPos, | ||
bool | squared = false |
||
) | const |
double PLMD::RMSD::optimalAlignment_DDistDRef | ( | const std::vector< double > & | align, |
const std::vector< double > & | displace, | ||
const std::vector< Vector > & | positions, | ||
const std::vector< Vector > & | reference, | ||
std::vector< Vector > & | DDistDPos, | ||
std::vector< Vector > & | DDistDRef, | ||
bool | squared = false |
||
) | const |
double PLMD::RMSD::optimalAlignment_DDistDRef_Rot_DRotDPos | ( | const std::vector< double > & | align, |
const std::vector< double > & | displace, | ||
const std::vector< Vector > & | positions, | ||
const std::vector< Vector > & | reference, | ||
std::vector< Vector > & | DDistDPos, | ||
std::vector< Vector > & | DDistDRef, | ||
Tensor & | Rotation, | ||
Matrix< std::vector< Vector > > & | DRotDPos, | ||
bool | squared = false |
||
) | const |
double PLMD::RMSD::optimalAlignment_DDistDRef_Rot_DRotDPos_DRotDRef | ( | const std::vector< double > & | align, |
const std::vector< double > & | displace, | ||
const std::vector< Vector > & | positions, | ||
const std::vector< Vector > & | reference, | ||
std::vector< Vector > & | DDistDPos, | ||
std::vector< Vector > & | DDistDRef, | ||
Tensor & | Rotation, | ||
Matrix< std::vector< Vector > > & | DRotDPos, | ||
Matrix< std::vector< Vector > > & | DRotDRef, | ||
bool | squared = false |
||
) | const |
double PLMD::RMSD::optimalAlignment_Fit | ( | const std::vector< double > & | align, |
const std::vector< double > & | displace, | ||
const std::vector< Vector > & | positions, | ||
const std::vector< Vector > & | reference, | ||
Tensor & | Rotation, | ||
Matrix< std::vector< Vector > > & | DRotDPos, | ||
std::vector< Vector > & | centeredpositions, | ||
Vector & | center_positions, | ||
bool | squared = false |
||
) |
double PLMD::RMSD::optimalAlignment_PCA | ( | const std::vector< double > & | align, |
const std::vector< double > & | displace, | ||
const std::vector< Vector > & | positions, | ||
const std::vector< Vector > & | reference, | ||
std::vector< Vector > & | alignedpositions, | ||
std::vector< Vector > & | centeredpositions, | ||
std::vector< Vector > & | centeredreference, | ||
Tensor & | Rotation, | ||
std::vector< Vector > & | DDistDPos, | ||
Matrix< std::vector< Vector > > & | DRotDPos, | ||
bool | squared = false |
||
) | const |
double PLMD::RMSD::optimalAlignment_Rot | ( | const std::vector< double > & | align, |
const std::vector< double > & | displace, | ||
const std::vector< Vector > & | positions, | ||
const std::vector< Vector > & | reference, | ||
std::vector< Vector > & | derivatives, | ||
Tensor & | Rotation, | ||
bool | squared = false |
||
) | const |
double PLMD::RMSD::optimalAlignment_Rot_DRotDRr01 | ( | const std::vector< double > & | align, |
const std::vector< double > & | displace, | ||
const std::vector< Vector > & | positions, | ||
const std::vector< Vector > & | reference, | ||
Tensor & | Rotation, | ||
std::array< std::array< Tensor, 3 >, 3 > & | drotationPosCloseDrr01, | ||
bool | squared = false |
||
) | const |
double PLMD::RMSD::optimalAlignment_SOMA | ( | const std::vector< double > & | align, |
const std::vector< double > & | displace, | ||
const std::vector< Vector > & | positions, | ||
const std::vector< Vector > & | reference, | ||
std::vector< Vector > & | DDistDPos, | ||
std::vector< Vector > & | DDistDRef, | ||
bool | squared = false |
||
) | const |
double PLMD::RMSD::optimalAlignmentWithCloseStructure | ( | const std::vector< double > & | align, |
const std::vector< double > & | displace, | ||
const std::vector< Vector > & | positions, | ||
const std::vector< Vector > & | reference, | ||
std::vector< Vector > & | derivatives, | ||
Tensor & | rotationPosClose, | ||
Tensor & | rotationRefClose, | ||
std::array< std::array< Tensor, 3 >, 3 > & | drotationPosCloseDrr01, | ||
bool | squared = false |
||
) | const |
void PLMD::RMSD::set | ( | const PDB & | pdb, |
const std::string & | mytype, | ||
bool | remove_center = true , |
||
bool | normalize_weights = true |
||
) |
set reference, align and displace from input pdb structure: evtl remove com from the initial structure and normalize the input weights from the pdb
general method to set all the rmsd property at once by using a pdb where occupancy column sets the weights for the atoms involved in the alignment and beta sets the weight that are used for calculating the displacement.
void PLMD::RMSD::set | ( | const std::vector< double > & | align, |
const std::vector< double > & | displace, | ||
const std::vector< Vector > & | reference, | ||
const std::string & | mytype, | ||
bool | remove_center = true , |
||
bool | normalize_weights = true |
||
) |
set align displace reference and type from input vectors
void PLMD::RMSD::setAlign | ( | const std::vector< double > & | align, |
bool | normalize_weights = true , |
||
bool | remove_center = true |
||
) |
set weights and remove the center from reference with normalized weights. If the com has been removed, it resets to the new value
the alignment weights are here normalized to 1 and the center of the reference is removed accordingly
void PLMD::RMSD::setDisplace | ( | const std::vector< double > & | displace, |
bool | normalize_weights = true |
||
) |
set align
here the weigth for normalized weighths are normalized and set
void PLMD::RMSD::setReference | ( | const std::vector< Vector > & | reference | ) |
set reference coordinates, remove the com by using uniform weights
this calculates the center of mass for the reference and removes it from the reference itself considering uniform weights for alignment
void PLMD::RMSD::setType | ( | const std::string & | mytype | ) |
set the type of alignment we are doing
double PLMD::RMSD::simpleAlignment | ( | const std::vector< double > & | align, |
const std::vector< double > & | displace, | ||
const std::vector< Vector > & | positions, | ||
const std::vector< Vector > & | reference, | ||
std::vector< Vector > & | derivatives, | ||
std::vector< Vector > & | displacement, | ||
bool | squared = false |
||
) | const |
workhorses
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
Hosted by GitHub | 1.8.17 |