MolTransforms.h

Go to the documentation of this file.
00001 // 
00002 //   Copyright (C) 2003-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_MOLTRANSFORMS_H_
00011 #define _RD_MOLTRANSFORMS_H_
00012 
00013 #include <Geometry/point.h>
00014 #include <Numerics/SymmMatrix.h>
00015 
00016 namespace RDKit{
00017   class ROMol;
00018   class Atom;
00019   class Conformer;
00020 }
00021 
00022 namespace RDGeom {
00023   class Transform3D;
00024 }
00025 
00026 namespace MolTransforms{
00027   void transformMolsAtoms(RDKit::ROMol *mol,RDGeom::Transform3D &tform);
00028   void transformAtom(RDKit::Atom *atom,RDGeom::Transform3D &tform);
00029 
00030   //! Compute the centroid of a conformer
00031   /*! 
00032     This is simple the average of the heavy atom locations in the conformer,
00033     not attention is paid to hydrogens or the differences in atomic radii
00034     
00035     \param conf     Conformer of interest
00036     \param ignoreHs If true, ignore hydrogen atoms
00037   */
00038   RDGeom::Point3D computeCentroid(const RDKit::Conformer &conf, bool ignoreHs=true);
00039 
00040   //! Compute the covariance matrix for a conformer
00041   /*!
00042     \param conf       Conformer of interest
00043     \param center     Center to be used for covariance matrix calculation
00044     \param normalize  If true, normalize the covariance matrix by the number of atoms
00045     \param ignoreHs   If true, ignore hydrogen atoms
00046   */
00047   RDNumeric::DoubleSymmMatrix *computeCovarianceMatrix(const RDKit::Conformer &conf,
00048                                                        const RDGeom::Point3D &center,
00049                                                        bool normalize=false, 
00050                                                        bool ignoreHs=true);
00051    
00052 
00053   //! Compute the transformation require to orient the conformation
00054   //! along the principal axes about the center; i.e. center is made to coincide with the
00055   //! origin, the largest princiapl axis with the x-axis, the next largest with the y-axis
00056   //! and the smallest with the z-axis
00057   /*!
00058     If center is not specified the the centroid of the conformer will be used
00059     \param conf                Conformer of interest
00060     \param center              Center to be used for canonicalization, defaults to the centroid of the 
00061                                conformation
00062     \param normalizeCovar      Normalize the covariance matrix with the number of atoms
00063     \param ignoreHs            Optinally ignore hydrogens
00064   */
00065   RDGeom::Transform3D *computeCanonicalTransform(const RDKit::Conformer &conf,
00066                                                  const RDGeom::Point3D *center=0,
00067                                                  bool normalizeCovar=false,
00068                                                  bool ignoreHs=true);
00069 
00070   //! Transform the conformation using the specified transformation
00071   void transformConformer(RDKit::Conformer &conf, const RDGeom::Transform3D &trans);
00072 
00073   //! Canonicalize the orientation of a conformer so that its principal axes
00074   //! around the specified center point coincide with the x, y, z axes
00075   /*!
00076     \param conf           The conformer of interest
00077     \param center         Optional center point about which the principal axes are computed 
00078                           if not specified the centroid of the conformer will be used
00079     \param normalizeCovar Optionally normalize the covariance matrix by the number of atoms
00080     \param ignoreHs       If true, ignore hydrogen atoms
00081     
00082   */
00083   void canonicalizeConformer(RDKit::Conformer &conf, const RDGeom::Point3D *center=0,
00084                              bool normalizeCovar=false, bool ignoreHs=true);
00085 
00086   //! Canonicalize all the conformations in a molecule
00087   /*!
00088     \param mol            the molecule of interest
00089     \param normalizeCovar Optionally normalize the covariance matrix by the number of atoms
00090     \param ignoreHs       If true, ignore hydrogens
00091   */
00092   void canonicalizeMol(RDKit::ROMol &mol, bool normalizeCovar=false, bool ignoreHs=true);
00093 
00094 }
00095 #endif