MTK++ Latest version: 0.2.0

superimpose.h
Go to the documentation of this file.
00001 
00033 #ifndef SUPERIMPOSE_H
00034 #define SUPERIMPOSE_H
00035 
00036 #include <iostream>
00037 #include <string>
00038 #include <vector>
00039 #include <math.h>
00040 #include "Utils/constants.h"
00041 
00042 // - BOOST - //
00043 /*
00044 #include <boost/numeric/ublas/symmetric.hpp>
00045 #include <boost/numeric/ublas/matrix.hpp>
00046 #include <boost/numeric/ublas/io.hpp>
00047 #include <boost/numeric/ublas/banded.hpp> // for diagonal matrix
00048 #include <boost/numeric/bindings/blas/blas3.hpp>
00049 #include "boost/numeric/bindings/traits/ublas_matrix.hpp"
00050 #include "boost/numeric/bindings/traits/ublas_vector.hpp"
00051 
00052 namespace ublas  = boost::numeric::ublas;
00053 namespace blas   = boost::numeric::bindings::blas;
00054 */
00055 #include <Eigen/Dense>
00056 using namespace Eigen;
00057 
00058 namespace MTKpp
00059 {
00060 
00061 class molecule;
00062 class vector3d;
00063 
00064 // ============================================================
00065 // Class : superimpose()
00066 // ------------------------------------------------------------
00073 // ============================================================
00074 class superimpose
00075 {
00076 public:
00077 
00079     superimpose();
00080 
00085     superimpose(int i);
00086 
00088     virtual ~superimpose();
00089 
00096     double    fit(molecule* pMoleculeA, molecule* pMoleculeB);
00097 
00105     double    fit(double coordsA[][3], double coordsB[][3], int n);
00106 
00119     int       fit(molecule* pMoleculeA, molecule* pMoleculeB,
00120                   std::vector<int> cor, int type);
00121 
00129     double    rmsd(molecule* pMoleculeA, molecule* pMoleculeB);
00130 
00140     double    rmsd(molecule* pMoleculeA, molecule* pMoleculeB,
00141               std::vector<std::vector<int> > &correspondenceMatrices);
00142 
00153     double    rmsd(molecule* pMoleculeA, std::vector< vector3d > &molBCoords,
00154               std::vector<std::vector<int> > &correspondenceMatrices, int &cor);
00155 
00164     double    rmsdNoFit(molecule* pMoleculeA,
00165               std::vector< vector3d > &molBCoords,
00166               std::vector<std::vector<int> > &correspondenceMatrices);
00167 
00174     void       getRotationMatrix(double centerA[3], double centerB[3],
00175                                  double rotMat[][3]);
00176 
00185     int       getRotationMatrix(double coordsA[][3], double coordsB[][3],
00186                                      int n, double rotMat[][3]);
00187 
00198     int       getRotationMatrix(double coordsA[][3], double coordsB[][3],
00199                                 double centerA[3], double centerB[3],
00200                                 int n, double rotMat[][3]);
00201 
00208     double    calculateRMSD(double coordsA[][3], double coordsB[][3]);
00209 
00220     double    minRMSD(molecule* pMoleculeA, molecule* pMoleculeB, int type,
00221                       int &nFittedAtoms);
00222 
00234     int initializeCorrespondences(molecule* pMol,
00235                  int type,
00236                  std::vector<std::vector<int> > &correspondenceMatrices);
00237 
00238     int initializeCorrespondences(molecule* pMolB,
00239                  molecule* pMolA,
00240                  int type,
00241                  std::vector<std::vector<int> > &correspondenceMatrices);
00242 
00248     void      center(double coords[][3], double center[3]);
00249 
00258     void      updateCoords(double coords[][3], int n, double c1[3],
00259                            double c2[3], double rotMat[][3]);
00260 
00261 protected: // functions
00262 
00270     void      coordinateDiff(double coordsA[][3], double coordsB[][3],
00271                              double itsDXM[][3], double itsDXP[][3]);
00272 
00279 /*
00280     void      buildQuaternion(ublas::matrix<double, ublas::column_major>& quaternion,
00281                               double itsDXM[][3], double itsDXP[][3]);
00282 */
00283     void      buildQuaternion(Eigen::MatrixXd& quaternion,
00284                               double itsDXM[][3], double itsDXP[][3]);
00285 
00291 /*
00292     void      buildRotation(double t[][3],
00293               ublas::matrix<double, ublas::column_major> eigenvectors);
00294 */
00295     void      buildRotation(double t[][3],
00296               Eigen::MatrixXd eigenvectors);
00297 
00298 protected: // data
00299 
00301     molecule* pMoleculeA;
00302 
00304     molecule* pMoleculeB;
00305 
00307     int       nAtoms;
00308 
00310     double    centerA[3];
00311 
00313     double    centerB[3];
00314 
00316     double    rotMat[3][3];
00317 
00319     double    dRMSD;
00320 
00322     int* genMatchMatrix;
00323 
00331     int correspondenceType;
00332 
00334     int                           nHeavyAtomsA;
00335 
00337     int*                          heavyAtomIndicesA;
00338 
00340     int                           nHeavyAtomsB;
00341 
00343     int*                          heavyAtomIndicesB;
00344 
00345 };
00346 
00347 } // MTKpp namespace
00348 
00349 #endif // SUPERIMPOSE_H

Generated on Fri Dec 23 2011 09:28:52 for MTK++ by Doxygen 1.7.5.1