00001 // 00002 // Copyright (C) 2004-2007 Greg Landrum and Rational Discovery LLC 00003 // 00004 // @@ All Rights Reserved @@ 00005 // 00006 #ifndef _RD_DISTGEOMUTILS_H_ 00007 #define _RD_DISTGEOMUTILS_H_ 00008 00009 #include "BoundsMatrix.h" 00010 #include <Numerics/SymmMatrix.h> 00011 #include <map> 00012 #include <Geometry/point.h> 00013 #include "ChiralSet.h" 00014 00015 namespace ForceFields { 00016 class ForceField; 00017 } 00018 00019 namespace DistGeom { 00020 00021 //! Pick a distance matrix at random such that the 00022 //! distance satisfy the bounds in the BoundsMatrix 00023 /*! 00024 \param mmat Bounds matrix 00025 \param distmat Storage for randomly chosen distances 00026 \param seed Optional value to seed the random number generator 00027 00028 \return the largest element of the distance matrix 00029 */ 00030 double pickRandomDistMat(const BoundsMatrix &mmat, 00031 RDNumeric::SymmMatrix<double> &distmat, int seed=-1); 00032 00033 //! Compute an initial embedded in 3D based on a distance matrix 00034 /*! 00035 This function follows the embed algorithm mentioned in 00036 "Distance Geometry and Molecular Conformation" by G.M.Crippen and T.F.Havel 00037 (pages 312-313) 00038 00039 \param distmat Distance matrix 00040 \param positions A vector of pointers to Points to write out the resulting coordinates 00041 \param randNegEig If set to true and if any of the eigen values are negative, we will 00042 pick the corresponding components of the coordinates at random 00043 \param numZeroFail Fail embedding is more this many (or more) eigen values are zero 00044 00045 \return true if the embedding was successful 00046 */ 00047 bool computeInitialCoords(const RDNumeric::SymmMatrix<double> &distmat, 00048 RDGeom::PointPtrVect &positions, bool randNegEig=false, 00049 unsigned int numZeroFail=2); 00050 00051 //! places atoms randomly in a box 00052 /*! 00053 \param positions A vector of pointers to Points to write out the resulting coordinates 00054 \param boxSize If set to true and if any of the eigen values are negative, we will 00055 pick the corresponding components of the coordinates at random 00056 00057 \return true if the embedding was successful 00058 */ 00059 bool computeRandomCoords(RDGeom::PointPtrVect &positions, double boxSize); 00060 00061 //! Setup the error function for violation of distance bounds as a forcefield 00062 /*! 00063 This is based on function E3 on page 311 of "Distance Geometry in Molecular 00064 Modeling" Jeffrey M.Blaney and J.Scott Dixon, Review in Computational Chemistry, 00065 Volume V 00066 00067 \param mmat Distance bounds matrix 00068 \param positions A vector of pointers to Points to write out the resulting coordinates 00069 \param csets The vector of chiral points (type: ChiralSet) 00070 \param weightChiral weight to be used to enforce chirality 00071 \param weightFourthDim another chiral weight 00072 \param extraWeights an optional set of weights for distance bounds violations 00073 \param basinSizeTol Optional: any distance bound with a basin (distance between max and 00074 min bounds) larger than this value will not be included in the force 00075 field used to cleanup the structure. 00076 00077 \return a pointer to a ForceField suitable for cleaning up the violations. 00078 <b>NOTE:</b> the caller is responsible for deleting this force field. 00079 00080 */ 00081 ForceFields::ForceField *constructForceField(const BoundsMatrix &mmat, 00082 RDGeom::PointPtrVect &positions, const VECT_CHIRALSET &csets, 00083 double weightChiral=1.0, 00084 double weightFourthDim=0.1, 00085 std::map< std::pair<int,int>,double> *extraWeights=0, 00086 double basinSizeTol=5.0); 00087 00088 } 00089 00090 #endif
1.5.5