00001 // 00002 // Copyright (C) 2001-2006 Rational Discovery LLC 00003 // 00004 // @@ All Rights Reserved @@ 00005 // This file is part of the RDKit. 00006 // The contents are covered by the terms of the BSD license 00007 // which is included in the file license.txt, found at the root 00008 // of the RDKit source tree. 00009 // 00010 #ifndef _RD_ALIGNMOLECULES_H_ 00011 #define _RD_ALIGNMOLECULES_H_ 00012 00013 #include <Geometry/Transform3D.h> 00014 #include <Numerics/Vector.h> 00015 #include <vector> 00016 00017 namespace RDKit { 00018 typedef std::vector< std::pair<int,int> > MatchVectType; 00019 00020 class Conformer; 00021 class ROMol; 00022 namespace MolAlign { 00023 class MolAlignException : public std::exception { 00024 public: 00025 //! construct with an error message 00026 MolAlignException(const char *msg) : _msg(msg) {}; 00027 //! construct with an error message 00028 MolAlignException(const std::string msg) : _msg(msg) {}; 00029 //! get the error message 00030 const char *message () const { return _msg.c_str(); }; 00031 ~MolAlignException () throw () {}; 00032 private: 00033 std::string _msg; 00034 }; 00035 00036 //! Alignment functions 00037 00038 //! Compute the transformation required to align a molecule 00039 /*! 00040 The 3D transformation required to align the specied conformation in the probe molecule 00041 to a specified conformation in the reference molecule is computed so that the root mean 00042 squared distance between a specified set of atoms is minimized 00043 00044 \param prbMol molecule that is to be aligned 00045 \param refMol molecule used as the reference for the alignment 00046 \param trans storage for the computed transform 00047 \param prbCid ID of the conformation in the probe to be used 00048 for the alignment (defaults to first conformation) 00049 \param refCid ID of the conformation in the ref molecule to which 00050 the alignment is computed (defaults to first conformation) 00051 \param atomMap a vector of pairs of atom IDs (probe AtomId, ref AtomId) 00052 used to compute the alignments. If this mapping is 00053 not specified an attempt is made to generate on by 00054 substructure matching 00055 \param weights Optionally specify weights for each of the atom pairs 00056 \param reflect if true reflect the conformation of the probe molecule 00057 \param maxIters maximum number of iteration used in mimizing the RMSD 00058 00059 <b>Returns</b> 00060 RMSD value 00061 */ 00062 double getAlignmentTransform(const ROMol &prbMol, const ROMol &refMol, 00063 RDGeom::Transform3D &trans, 00064 int prbCid=-1, int refCid=-1, 00065 const MatchVectType *atomMap=0, 00066 const RDNumeric::DoubleVector *weights=0, 00067 bool reflect=false, 00068 unsigned int maxIters=50); 00069 00070 00071 //! Optimally (minimum RMSD) align a molecule to another molecule 00072 /*! 00073 The 3D transformation required to align the specied conformation in the probe molecule 00074 to a specified conformation in the reference molecule is computed so that the root mean 00075 squared distance between a specified set of atoms is minimized. This transforms is them 00076 applied to the specified conformation in the probe molecule 00077 00078 \param prbMol molecule that is to be aligned 00079 \param refMol molecule used as the reference for the alignment 00080 \param prbCid ID of the conformation in the probe to be used 00081 for the alignment (defaults to first conformation) 00082 \param refCid ID of the conformation in the ref molecule to which 00083 the alignment is computed (defaults to first conformation) 00084 \param atomMap a vector of pairs of atom IDs (probe AtomId, ref AtomId) 00085 used to compute the alignments. If this mapping is 00086 not specified an attempt is made to generate on by 00087 substructure matching 00088 \param weights Optionally specify weights for each of the atom pairs 00089 \param reflect if true reflect the conformation of the probe molecule 00090 \param maxIters maximum number of iteration used in mimizing the RMSD 00091 00092 <b>Returns</b> 00093 RMSD value 00094 */ 00095 double alignMol(ROMol &prbMol, const ROMol &refMol, 00096 int prbCid=-1, int refCid=-1, 00097 const MatchVectType *atomMap=0, 00098 const RDNumeric::DoubleVector *weights=0, 00099 bool reflect=false, unsigned int maxIters=50); 00100 00101 //! Align the conformations of a molecule using a common set of atoms 00102 /*! 00103 \param mol The molecule of interest 00104 \param atomIds vector of atoms to be used to generate the alignment. 00105 All atoms will be used is not specified 00106 \param confIds vector of conformations to align - defaults to all 00107 \param weights vector of weights to applied to particular atom pairs 00108 defaults to all weights = 1 00109 \param reflect toggles reflecting (about the origin) the alignment 00110 \param maxIters the maximum number of iterations to attempt 00111 */ 00112 void alignMolConformers(ROMol &mol, const std::vector<unsigned int> *atomIds=0, 00113 const std::vector<unsigned int> *confIds=0, 00114 const RDNumeric::DoubleVector *weights=0, 00115 bool reflect=false, unsigned int maxIters=50); 00116 } 00117 } 00118 #endif
1.7.1