Rosetta  2019.07
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Functions
numeric::model_quality Namespace Reference

Classes

class  RmsData
 RmsData is a class intended to replace the global rms_obj namespace from rosetta++. Initial implementation is with a singleton design pattern to mimic a global namespace from rosetta++. More...
 

Functions

numeric::Real calculate_dihedral_distance (numeric::Real dih1, numeric::Real dih2)
 Calculate the dihedral angle distance from directional statistics. More...
 
void maxsub (int &nsup, ObjexxFCL::FArray1A_double xe, ObjexxFCL::FArray1A_double xp, double &rms, double &psi, int &nali, double &zscore, double &evalue, double &score, double rmstol, double distance_tolerance)
 identify the largest subset of CA atoms of a model that superimposes "well" (under certain rms cutoff) over the experimental structure More...
 
double erfcc (double x)
 
void COMAS (ObjexxFCL::FArray1A_double C, ObjexxFCL::FArray1A_double WT, int NAT, double &XC, double &YC, double &ZC)
 
numeric::Real calc_rms (utility::vector1< xyzVector< Real > > p1_coords, utility::vector1< xyzVector< Real > > p2_coords)
 
numeric::Real rms_wrapper_slow_and_correct (int natoms, FArray2D< numeric::Real > p1a, FArray2D< numeric::Real > p2a)
 
numeric::Real rms_wrapper (int natoms, FArray2D< numeric::Real > p1a, FArray2D< numeric::Real > p2a)
 
void calc_rms_fast (float &rms_out, FArray2A< numeric::Real > xx, FArray2A< numeric::Real > yy, FArray1A< numeric::Real > ww, int npoints, numeric::Real ctx)
 companion function for findUU ( it is optional ) computes the minimum RMS deviation beteen XX and YY as though it rotated the arrays, without actually rotating them. More...
 
void findUU (FArray2< numeric::Real > &XX, FArray2< numeric::Real > &YY, FArray1< numeric::Real > const &WW, int Npoints, FArray2< numeric::Real > &UU, numeric::Real &sigma3)
 intended to rotate one protein xyz array onto another one such that the point-by-point rms is minimized. More...
 
void findUU (utility::vector1< numeric::xyzVector< numeric::Real > > &XX, utility::vector1< numeric::xyzVector< numeric::Real > > &YY, utility::vector1< numeric::Real > const &WW, int Npoints, numeric::xyzMatrix< numeric::Real > &UU, numeric::Real &sigma3)
 This is a helper function for using the above implementation of findUU. There is some cost to the conversion but everything else is probably slower and also you don't have to use FArrays everywhere. More...
 
void BlankMatrixMult (FArray2A< numeric::Real > A, int n, int np, int transposeA, FArray2A< numeric::Real > B, int m, int transposeB, FArray2A< numeric::Real > AxB_out)
 
void MatrixMult (FArray2A< numeric::Real > A, int n, int np, int transposeA, FArray2A< numeric::Real > B, int m, int transposeB, FArray2A< numeric::Real > AxB_out)
 
void fixEigenvector (FArray2A< numeric::Real > m_v)
 
void rms_fit (int npoints, ObjexxFCL::FArray2D< double > xx, ObjexxFCL::FArray2D< double > &yy, ObjexxFCL::FArray1D< double > ww, int natsel, double &esq)
 
void rmsfitca2 (int npoints, ObjexxFCL::FArray2A< double > xx, ObjexxFCL::FArray2A< double > yy, ObjexxFCL::FArray1A< double > ww, int natsel, double &esq, double const &offset_val=1.0e-7, bool const realign=false)
 computes the rms between two weighted point vectors. More...
 
void rmsfitca3 (int npoints, ObjexxFCL::FArray2A< double > xx0, ObjexxFCL::FArray2A< double > xx, ObjexxFCL::FArray2A< double > yy0, ObjexxFCL::FArray2A< double > yy, double &esq)
 
double det3 (ObjexxFCL::FArray2A< double > m)
 determinant of a 3x3 matrix More...
 
void rsym_eigenval (ObjexxFCL::FArray2A< double > m, ObjexxFCL::FArray1A< double > ev)
 computes the eigen values of a real symmetric 3x3 matrix More...
 
void rsym_rotation (ObjexxFCL::FArray2A< double > mm, ObjexxFCL::FArray2A< double > m, ObjexxFCL::FArray1A< double > ev, ObjexxFCL::FArray2A< double > rot)
 finds a (proper) rotation matrix that minimizes the rms. More...
 
void rsym_evector (ObjexxFCL::FArray2A< double > m, ObjexxFCL::FArray1A< double > ev, ObjexxFCL::FArray2A< double > mvec)
 Author: charlie strauss (cems) 2001 given original matrix plus its eigen values compute the eigen vectors. USAGE notice: for computing min rms rotations be sure to call this with the lowest eigen value in Ev(3). More...
 

Function Documentation

void numeric::model_quality::BlankMatrixMult ( FArray2A< numeric::Real A,
int  n,
int  np,
int  transposeA,
FArray2A< numeric::Real B,
int  m,
int  transposeB,
FArray2A< numeric::Real AxB_out 
)
Parameters
A- [in/out]? -
n- [in/out]? -
np- [in/out]? -
transposeA- [in/out]? -
B- [in/out]? -
m- [in/out]? -
transposeB- [in/out]? -
AxB_out- [in/out]? -
Global Read:
Global Write:
Remarks
References:
Author

References ObjexxFCL::FArray2A< typename >::dimension(), and MatrixMult().

Referenced by findUU().

numeric::Real numeric::model_quality::calc_rms ( utility::vector1< xyzVector< Real > >  p1_coords,
utility::vector1< xyzVector< Real > >  p2_coords 
)

References rms_wrapper().

Referenced by main(), my_main(), and SphereGrinder().

void numeric::model_quality::calc_rms_fast ( float rms_out,
FArray2A< numeric::Real xx,
FArray2A< numeric::Real yy,
FArray1A< numeric::Real ww,
int  npoints,
numeric::Real  ctx 
)

companion function for findUU ( it is optional ) computes the minimum RMS deviation beteen XX and YY as though it rotated the arrays, without actually rotating them.

Parameters
rms_out[in/out]? - the real-valued output value of the rms deviation
XX- [in/out]? - first set of points representing xyz coordinates
YY- [in/out]? - second set of points representing xyz coordinates
WW- [in/out]? - relative weight for each point
npoints- [in/out]? - number of points
ctx- [in/out]? - magic number computed during find UU that is needed for this calculation
Global Read:
Global Write:
Remarks
the XX, YY, WW must be the same as call to findUU (remember that findUU offsets the XX and YY weighted COM to the origin!)
References:
Author

References ObjexxFCL::abs(), ObjexxFCL::FArray1A< typename >::dimension(), ObjexxFCL::FArray2A< typename >::dimension(), basic::options::OptionKeys::frags::j, and loops_kic::rms.

Referenced by rms_wrapper().

numeric::Real numeric::model_quality::calculate_dihedral_distance ( numeric::Real  dih1,
numeric::Real  dih2 
)

Calculate the dihedral angle distance from directional statistics.

Metric described in: North B, Lehmann A, Dunbrack RL. A new clustering of antibody CDR loop conformations. J Mol Biol 2011; 406:228-256.

void numeric::model_quality::COMAS ( ObjexxFCL::FArray1A_double  C,
ObjexxFCL::FArray1A_double  WT,
int  NAT,
double &  XC,
double &  YC,
double &  ZC 
)
Parameters
C- [in/out]? -
WT- [in/out]? -
NAT- [in/out]? -
XC- [in/out]? -
YC- [in/out]? -
ZC- [in/out]? -
Global Read:
Global Write:
Remarks
References:
Author

References C, ObjexxFCL::FArray1A< typename >::dimension(), and basic::options::OptionKeys::abinitio::star::star.

Referenced by rms_fit(), and rmsfitca2().

double numeric::model_quality::det3 ( ObjexxFCL::FArray2A< double m)

determinant of a 3x3 matrix

cute factoid: det of a 3x3 is the dot product of one row with the cross product of the other two. This explains why a right hand coordinate system has a positive determinant. cute huh?

Parameters
m- [in/out]? -
Returns
Global Read:
Global Write:
Remarks
References:
Author
charlie strauss 2001

References ObjexxFCL::FArray2A< typename >::dimension(), and test.T110_Numeric::m.

Referenced by rms_fit(), rmsfitca2(), and rmsfitca3().

double numeric::model_quality::erfcc ( double  x)
Parameters
x- [in/out]? -
Returns
Global Read:
Global Write:
Remarks
References:
(C) Copr. 1986-92 Numerical Recipes Software
Author

References ObjexxFCL::abs(), basic::options::OptionKeys::in::file::t, and numeric::crick_equations::z().

Referenced by maxsub().

void numeric::model_quality::findUU ( FArray2< numeric::Real > &  XX,
FArray2< numeric::Real > &  YY,
FArray1< numeric::Real > const &  WW,
int  Npoints,
FArray2< numeric::Real > &  UU,
numeric::Real sigma3 
)

intended to rotate one protein xyz array onto another one such that the point-by-point rms is minimized.

1) ORIGINAL PAPER HAD ERROR IN HANDEDNESS OF VECTORS, LEADING TO INVERSION MATRICIES ON OCCASION. OOPS. NOW FIXED. SEE ACTA CRYST(1978) A34 PAGE 827 FOR REVISED MATH 2) TRAP DIVIDE BY ZERO ERRORS WHEN NO ROTATIONS REQUIRED. 3) ADDED WEIGHTS (WEIGHTS NOW WORK) 4) ADDED FAST RMS CALC AUXILIRARY ROUTINE. 5) CHANGED TO numeric::Real TO DEAL WITH HIGHLY DISSIMILAR BUT LARGE PROTEINS.

switched order of array subscripts so that can use logical array sizes XX and YY are lists of Npoints XYZ vectors (3xNpoint matrix) to be co-aligned these matrices are returned slightly modified: they are translated so their origins are at the center of mass (see Weights below ). WW is the weight or importance of each point (weighted RMS) vector of size Npoints The center of mass is figured including this variable. UU is a 3x3 symmetric orthonornal rotation matrix that will rotate YY onto XX such that the weighted RMS distance is minimized.

Parameters
[in]XX- in - XX,YY are 2D arrays of x,y,z position of each atom
[in]YY- in -
[in]WW- in - a weight matrix for the points
[in]Npoints- in - the number of XYZ points (need not be physical array size)
[out]UU- out - 3x3 rotation matrix.
[out]sigma3- out - TO BE PASSED TO OPTIONAL FAST_RMS CALC ROUTINE.
Global Read:
Global Write:
Remarks
SIDEEFECTS: the Matrices XX, YY are Modified so that their weighted center of mass is moved to (0,0,0).

CAVEATS: 1) it is CRITICAL that the first physical dimension of XX and YY is 3

2) an iterative approx algorithm computes the diagonalization of a 3x3 matrix. if this program needs a speed up this could be made into an analytic but uggggly diagonalization function.

References:
Mathethematical Basis from paper: (Wolfgang Kabsch) acta Cryst (1976) A32 page 922
Author
Charlie Strauss 1999 Revised april 22

References ObjexxFCL::abs(), BlankMatrixMult(), ObjexxFCL::format::E(), numeric::eigenvector_jacobi(), fixEigenvector(), and basic::options::OptionKeys::frags::j.

Referenced by findUU(), and rms_wrapper().

void numeric::model_quality::findUU ( utility::vector1< numeric::xyzVector< numeric::Real > > &  XX,
utility::vector1< numeric::xyzVector< numeric::Real > > &  YY,
utility::vector1< numeric::Real > const &  WW,
int  Npoints,
numeric::xyzMatrix< numeric::Real > &  UU,
numeric::Real sigma3 
)

This is a helper function for using the above implementation of findUU. There is some cost to the conversion but everything else is probably slower and also you don't have to use FArrays everywhere.

References numeric::FArray_to_vector_of_xyzvectors(), numeric::FArray_to_xyzmatrix(), findUU(), and ObjexxFCL::index().

void numeric::model_quality::fixEigenvector ( FArray2A< numeric::Real m_v)

m_v is a 3x3 matrix of 3 eigen vectors replaces the third eigenvector by taking cross product of of the first two eigenvectors

Parameters
m_v- [in/out]? -
Global Read:
Global Write:
Remarks
References:
Author

References ObjexxFCL::FArray2A< typename >::dimension(), and measure_params::norm().

Referenced by findUU().

void numeric::model_quality::MatrixMult ( FArray2A< numeric::Real A,
int  n,
int  np,
int  transposeA,
FArray2A< numeric::Real B,
int  m,
int  transposeB,
FArray2A< numeric::Real AxB_out 
)

multiplys matrices A (npXn) and B (npXn). results in AxB.out IF THE MATRICES are SQUARE. you can also multiply the transposes of these matrices to do so set the transposeA or transposeB flags to 1, otherwise they should be zero.

Parameters
A- [in/out]? -
n- [in/out]? -
np- [in/out]? -
transposeA- [in/out]? -
B- [in/out]? -
m- [in/out]? -
transposeB- [in/out]? -
AxB_out- [in/out]? -
Global Read:
Global Write:
Remarks
transpose only works correctly for square matricies!

this function does SUMS to the old value of AxB_out... you might want to call BlankMatrixMult instead (see above) 4/30/01 jjg

this function works on numeric::Real values float version below. jjg

References:
Author
charlie strauss 1999

References ObjexxFCL::format::A(), ObjexxFCL::FArray2A< typename >::dimension(), basic::options::OptionKeys::frags::j, and test.T110_Numeric::m.

Referenced by BlankMatrixMult().

void numeric::model_quality::maxsub ( int nsup,
ObjexxFCL::FArray1A_double  xe,
ObjexxFCL::FArray1A_double  xp,
double &  rms,
double &  psi,
int nali,
double &  zscore,
double &  evalue,
double &  score,
double  rmstol,
double  distance_tolerance 
)

identify the largest subset of CA atoms of a model that superimposes "well" (under certain rms cutoff) over the experimental structure

cems 2001. this is the main rosetta entry point for this function. it is a wrapper for max sub, converting the input arrays to double precision and reducing them to just calphas it does max sub comparing the claphas passed into thosw of the native and returns the number of aligned residues, the rms of these and the log eval c of the comparison

Parameters
x- [in/out]? -
nali- [in/out]? -
rms- [in/out]? -
logeval- [in/out]? -
Global Read:
Global Write:
Remarks
References:
Author
this function was adapted and improved by cem strauss from an
original template provided by angel ortiz.

Here applies a modification of Dani Fischer's heuristic algorithm
for finding the largest subset of residues for superimposition within
a threshold. The part that restraints the secondary structure
matching needs to be changed.

At this point, the algorithm works as follows: first, the residue
assignment is done on the basis of the global secondary structure
similarity. Then, with this assignment for residue pairs, the
heuristic procedure of Fisher is used.

A seed segment of 7 CA atoms was first superimposed onto the reference structure,
then the neighbor radius is gradually increased (up to "distance_tolerance"):to
include more CA atoms within the
range "t" to do a new superimposition, if the aligned rms is below the rms cutoff "rmstol"
the new alignment is accepted. This proceduare is repeated for every 7-residue seed segment
along the sequence until the largest subset of atoms which can yield an aligned rms below is
found."nsup" is the total number of CA atoms in the model, xe and xp are coordinates of native
and model respectively. "rms" is the final aligned rms based on the identified subset of atoms,
"nali" is the number of aligned atoms in the subset and "psi" is the ratio of nali/nsup; The rest
scores are metrics for quality of the alignment. Note that if no suitable alignment can be found
given the input rms cutoff, the rms of overall structure alignment is returned and "nali" is set to
zero. -- chu 2009/10
Parameters
nsup- [in/out]? -
xe- [in/out]? -
xp- [in/out]? -
rms- [in/out]? -
psi- [in/out]? -
nali- [in/out]? -
zscore- [in/out]? -
evalue- [in/out]? -
score- [in/out]? -
Global Read:
Global Write:
Remarks
References:
Author

References ObjexxFCL::FArray1A< typename >::dimension(), ObjexxFCL::format::E(), erfcc(), utility::SingletonBase< RmsData >::get_instance(), basic::options::OptionKeys::frags::j, basic::options::OptionKeys::in::file::l, ObjexxFCL::pow(), loops_kic::rms, rmsfitca2(), rmsfitca3(), numeric::square(), and basic::options::OptionKeys::in::file::t.

void numeric::model_quality::rms_fit ( int  npoints,
ObjexxFCL::FArray2D< double xx,
ObjexxFCL::FArray2D< double > &  yy,
ObjexxFCL::FArray1D< double ww,
int  natsel,
double esq 
)
numeric::Real numeric::model_quality::rms_wrapper ( int  natoms,
FArray2D< numeric::Real p1a,
FArray2D< numeric::Real p2a 
)

References calc_rms_fast(), and findUU().

Referenced by calc_rms(), interface_rmsd(), and main().

numeric::Real numeric::model_quality::rms_wrapper_slow_and_correct ( int  natoms,
FArray2D< numeric::Real p1a,
FArray2D< numeric::Real p2a 
)
void numeric::model_quality::rmsfitca2 ( int  npoints,
ObjexxFCL::FArray2A< double xx,
ObjexxFCL::FArray2A< double yy,
ObjexxFCL::FArray1A< double ww,
int  natsel,
double esq,
double const &  offset_val = 1.0e-7,
bool const  realign = false 
)

computes the rms between two weighted point vectors.

xx_0,yy_0 are the input vectors of of points and ww is their weights xx,yy are by product output vectors of the same points offset to remove center of mass det is an out value of the determinant of the cross moment matrix returned value is the rms

most of this is double for good reasons. first there are some large differences of small numbers. and second the rsymm_eignen() function can internally have numbers larger than the largest double number. (you could do some fancy foot work to rescale things if you really had a problem with this.)

Parameters
npoints- [in/out]? -
xx- [in/out]? -
yy- [in/out]? -
ww- [in/out]? -
natsel- [in/out]? -
esq- [in/out]? -
[in]offset_val- A small offset temporarily added or subtracted from z-coordinates to ensure that determinants are nonzero. Defaults to 1e-7.
[in]relalign- If true, the small offset is subtracted off again before final output. False by default (legacy behaviour).
Global Read:
Global Write:
Remarks
det is a double precision real (xx,yy) can be same arrays as (xx_0,yy_0) if desired
References:
Author
charlie strauss 2001

References ObjexxFCL::abs(), COMAS(), det3(), ObjexxFCL::FArray1A< typename >::dimension(), ObjexxFCL::FArray2A< typename >::dimension(), ObjexxFCL::format::E(), basic::options::OptionKeys::frags::j, rsym_eigenval(), rsym_rotation(), numeric::sign_transfered(), and basic::options::OptionKeys::in::file::t.

Referenced by maxsub(), and rms_wrapper_slow_and_correct().

void numeric::model_quality::rmsfitca3 ( int  npoints,
ObjexxFCL::FArray2A< double xx0,
ObjexxFCL::FArray2A< double xx,
ObjexxFCL::FArray2A< double yy0,
ObjexxFCL::FArray2A< double yy,
double esq 
)

This function gets its alignment info via a namespace! Alignment (rotation matrix) and rms(esq) are computed on the basis of residues previously designated by calls to add_rms(). However, the rotation is applied to all Npoints of XX0,yy0 with the results returned in xx,yy.

most of this is double for good reasons. first there are some large differences of small numbers. second the rsymm_eignen() function can internally have numbers larger than the largest double number. (you could do some fancy foot work to rescale m_moment if you really had a problem with this.)

Parameters
npoints- [in/out]? -
xx0- [in/out]? -
xx- [in/out]? -
yy0- [in/out]? -
yy- [in/out]? -
esq- [in/out]? -
Global Read:
Global Write:
Remarks
NOTE: det is a double precision real NOTE: (xx,yy) can be same arrays as (xx_0,yy_0) if desired
References:
Author

References ObjexxFCL::abs(), numeric::model_quality::RmsData::count(), det3(), ObjexxFCL::FArray2A< typename >::dimension(), ObjexxFCL::format::E(), utility::SingletonBase< RmsData >::get_instance(), basic::options::OptionKeys::frags::j, rsym_eigenval(), rsym_rotation(), numeric::sign_transfered(), basic::options::OptionKeys::in::file::t, numeric::model_quality::RmsData::xm(), numeric::model_quality::RmsData::xre(), numeric::model_quality::RmsData::xrp(), numeric::model_quality::RmsData::xse(), and numeric::model_quality::RmsData::xsp().

Referenced by maxsub().

void numeric::model_quality::rsym_eigenval ( ObjexxFCL::FArray2A< double m,
ObjexxFCL::FArray1A< double ev 
)

computes the eigen values of a real symmetric 3x3 matrix

the method used is a deterministic analytic result that I hand factored.(whew!) Amusingly, while I suspect this factorization is not yet optimal in the number of calcs required I cannot find a signifcantly better one. (if it were optimal I suspect I would not have to compute imaginary numbers that I know must eventually cancel out to give a net real result.) this method relys on the fact that an analytic factoring of an order 3 polynomial exists. m(3,3) is a 3x3 real symmetric matrix: only the upper triangle is actually used ev(3) is a real vector of eigen values, not neccesarily in sorted order.

Parameters
m- [in/out]? -
ev- [in/out]? -
Global Read:
Global Write:
Remarks
References:
Author
charlie strauss 2001

References basic::options::OptionKeys::score::fiber_diffraction::a, test.Workshop3test::a2, ObjexxFCL::abs(), basic::options::OptionKeys::score::fiber_diffraction::b, ObjexxFCL::FArray1A< typename >::dimension(), ObjexxFCL::FArray2A< typename >::dimension(), test.T110_Numeric::m, max(), measure_params::norm(), ObjexxFCL::pow(), and basic::options::OptionKeys::james::real.

Referenced by rms_fit(), rmsfitca2(), and rmsfitca3().

void numeric::model_quality::rsym_evector ( ObjexxFCL::FArray2A< double m,
ObjexxFCL::FArray1A< double ev,
ObjexxFCL::FArray2A< double mvec 
)

Author: charlie strauss (cems) 2001 given original matrix plus its eigen values compute the eigen vectors. USAGE notice: for computing min rms rotations be sure to call this with the lowest eigen value in Ev(3).

The minimal factorization of the eigenvector problem I have derived below has a puzzling or, rather, interesting assymetry. Namely, it doesn't matter what either ZZ=M(3,3) is or what Ev(3) is! One reason for this is that of course all we need to know is contained in the M matrix in the firstplace, so the eigen values overdetermine the problem We are just exploiting the redundant info in the eigen values to hasten the solution. What I dont know is if infact there exists any symmetic form using the eigen values.

we deliberately introduce another assymetry for numerical stability, and to force proper rotations (since eigen vectors are not unique within a sign change). first, we explicitly numerically norm the vectors to 1 rather than assuming the algebra will do it with enough accuracy. ( and its faster to boot!) second, we explicitly compute the third vector as being the cross product of the previous two rather than using the M matrix and third eigen value. If you arrange the eigen values so that the third eigen value is the lowest then this guarantees a stable result under the case of either very small eigen value or degenerate eigen values. this norm, and ignoring the third eigen value also gaurentee us the even if the eigen vectors are not perfectly accurate that, at least, the matrix that results is a pure orthonormal rotation matrix, which for most applications is the most important form of accuracy.

Parameters
m- [in/out]? -
ev- [in/out]? -
mvec- [in/out]? -
Global Read:
Global Write:
Remarks
References:
Author

References utility::io::oc::cout, ObjexxFCL::FArray1A< typename >::dimension(), ObjexxFCL::FArray2A< typename >::dimension(), and test.T110_Numeric::m.

Referenced by rsym_rotation().

void numeric::model_quality::rsym_rotation ( ObjexxFCL::FArray2A< double mm,
ObjexxFCL::FArray2A< double m,
ObjexxFCL::FArray1A< double ev,
ObjexxFCL::FArray2A< double rot 
)

finds a (proper) rotation matrix that minimizes the rms.

this computes the rotation matrix based on the eigenvectors of m that gives the the mimimum rms. this is determined using mm the cross moments matrix.

for best results the third eigen value should be the smallest eigen value!

Parameters
mm- [in/out]? -
m- [in/out]? -
ev- [in/out]? -
rot- [in/out]? -
Global Read:
Global Write:
Remarks
References:
Author
charlie strauss (cems) 2001

References ObjexxFCL::abs(), ObjexxFCL::FArray1A< typename >::dimension(), ObjexxFCL::FArray2A< typename >::dimension(), basic::options::OptionKeys::frags::j, loops_kic::mm, measure_params::norm(), rot, rsym_evector(), and erraser_analysis::temp.

Referenced by rms_fit(), rmsfitca2(), and rmsfitca3().