AlignMolecules.h

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

Generated on Tue Oct 7 06:10:10 2008 for RDCode by  doxygen 1.5.5