RDKit
Open-source cheminformatics and machine learning.
DistGeom Namespace Reference

Classes

class  BoundsMatrix
 Class to store the distance bound. More...
 
class  ChiralSet
 Class used to store a quartet of points and chiral volume bounds on them. More...
 
class  ChiralViolationContrib
 
class  DistViolationContrib
 
class  FourthDimContrib
 

Typedefs

typedef boost::shared_ptr< BoundsMatrixBoundsMatPtr
 
typedef boost::shared_ptr< ChiralSetChiralSetPtr
 
typedef std::vector< ChiralSetPtrVECT_CHIRALSET
 

Functions

double pickRandomDistMat (const BoundsMatrix &mmat, RDNumeric::SymmMatrix< double > &distmat, int seed=-1)
 
double pickRandomDistMat (const BoundsMatrix &mmat, RDNumeric::SymmMatrix< double > &distmat, RDKit::double_source_type &rng)
 
bool computeInitialCoords (const RDNumeric::SymmMatrix< double > &distmat, RDGeom::PointPtrVect &positions, bool randNegEig=false, unsigned int numZeroFail=2, int seed=-1)
 Compute an initial embedded in 3D based on a distance matrix. More...
 
bool computeInitialCoords (const RDNumeric::SymmMatrix< double > &distmat, RDGeom::PointPtrVect &positions, RDKit::double_source_type &rng, bool randNegEig=false, unsigned int numZeroFail=2)
 
bool computeRandomCoords (RDGeom::PointPtrVect &positions, double boxSize, int seed=-1)
 places atoms randomly in a box More...
 
bool computeRandomCoords (RDGeom::PointPtrVect &positions, double boxSize, RDKit::double_source_type &rng)
 
ForceFields::ForceFieldconstructForceField (const BoundsMatrix &mmat, RDGeom::PointPtrVect &positions, const VECT_CHIRALSET &csets, double weightChiral=1.0, double weightFourthDim=0.1, std::map< std::pair< int, int >, double > *extraWeights=0, double basinSizeTol=5.0)
 Setup the error function for violation of distance bounds as a forcefield. More...
 
ForceFields::ForceFieldconstruct3DForceField (const BoundsMatrix &mmat, RDGeom::Point3DPtrVect &positions, const std::vector< std::pair< int, int > > &bonds, const std::vector< std::vector< int > > &angles, const std::vector< std::vector< int > > &expTorsionAtoms, const std::vector< std::pair< std::vector< int >, std::vector< double > > > &expTorsionAngles, const std::vector< std::vector< int > > &improperAtoms, const std::vector< int > &atomNums)
 Force field with experimental torsion angle preferences and 1-2/1-3 distance. More...
 
ForceFields::ForceFieldconstructPlain3DForceField (const BoundsMatrix &mmat, RDGeom::Point3DPtrVect &positions, const std::vector< std::pair< int, int > > &bonds, const std::vector< std::vector< int > > &angles, const std::vector< std::vector< int > > &expTorsionAtoms, const std::vector< std::pair< std::vector< int >, std::vector< double > > > &expTorsionAngles, const std::vector< int > &atomNums)
 Force field with experimental torsion angle preferences and 1-2/1-3 distance. More...
 
ForceFields::ForceFieldconstruct3DImproperForceField (const BoundsMatrix &mmat, RDGeom::Point3DPtrVect &positions, const std::vector< std::vector< int > > &improperAtoms, const std::vector< int > &atomNums)
 Force field with only improper terms. More...
 
bool triangleSmoothBounds (BoundsMatrix *boundsMat, double tol=0.)
 
bool triangleSmoothBounds (BoundsMatPtr boundsMat, double tol=0.)
 

Typedef Documentation

typedef boost::shared_ptr<BoundsMatrix> DistGeom::BoundsMatPtr

Definition at line 116 of file BoundsMatrix.h.

typedef boost::shared_ptr<ChiralSet> DistGeom::ChiralSetPtr

Definition at line 53 of file ChiralSet.h.

typedef std::vector<ChiralSetPtr> DistGeom::VECT_CHIRALSET

Definition at line 54 of file ChiralSet.h.

Function Documentation

bool DistGeom::computeInitialCoords ( const RDNumeric::SymmMatrix< double > &  distmat,
RDGeom::PointPtrVect positions,
bool  randNegEig = false,
unsigned int  numZeroFail = 2,
int  seed = -1 
)

Compute an initial embedded in 3D based on a distance matrix.

This function follows the embed algorithm mentioned in "Distance Geometry and Molecular Conformation" by G.M.Crippen and T.F.Havel (pages 312-313)

Parameters
distmatDistance matrix
positionsA vector of pointers to Points to write out the resulting coordinates
randNegEigIf set to true and if any of the eigen values are negative, we will pick the corresponding components of the coordinates at random
numZeroFailFail embedding is more this many (or more) eigen values are zero
seedthe random number seed to use
Returns
true if the embedding was successful
bool DistGeom::computeInitialCoords ( const RDNumeric::SymmMatrix< double > &  distmat,
RDGeom::PointPtrVect positions,
RDKit::double_source_type rng,
bool  randNegEig = false,
unsigned int  numZeroFail = 2 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

bool DistGeom::computeRandomCoords ( RDGeom::PointPtrVect positions,
double  boxSize,
int  seed = -1 
)

places atoms randomly in a box

Parameters
positionsA vector of pointers to Points to write out the resulting coordinates
boxSizethe side-length of the cubic box
seedthe random number seed to use
Returns
true if the coordinate generation was successful
bool DistGeom::computeRandomCoords ( RDGeom::PointPtrVect positions,
double  boxSize,
RDKit::double_source_type rng 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

ForceFields::ForceField* DistGeom::construct3DForceField ( const BoundsMatrix mmat,
RDGeom::Point3DPtrVect positions,
const std::vector< std::pair< int, int > > &  bonds,
const std::vector< std::vector< int > > &  angles,
const std::vector< std::vector< int > > &  expTorsionAtoms,
const std::vector< std::pair< std::vector< int >, std::vector< double > > > &  expTorsionAngles,
const std::vector< std::vector< int > > &  improperAtoms,
const std::vector< int > &  atomNums 
)

Force field with experimental torsion angle preferences and 1-2/1-3 distance.

Parameters
mmatDistance bounds matrix
positionsA vector of pointers to 3D Points to write out the resulting coordinates
bondsA list of 1-2 partners (bonds)
anglesA list of 1-3 partners (angles)
expTorsionAtomsA list of groups of 4 atom indices for experimental torsions
expTorsionAnglesA list of corresponding torsion angle-potential parameters
improperAtomsA list of groups of 4 atom indices for inversion terms
atomNumsA list of atomic numbers for all atoms in the molecule
Returns
a pointer to a ForceField suitable for imposing experimental torsion angle preferences NOTE: the caller is responsible for deleting this force field.
ForceFields::ForceField* DistGeom::construct3DImproperForceField ( const BoundsMatrix mmat,
RDGeom::Point3DPtrVect positions,
const std::vector< std::vector< int > > &  improperAtoms,
const std::vector< int > &  atomNums 
)

Force field with only improper terms.

Parameters
mmatDistance bounds matrix
positionsA vector of pointers to 3D Points to write out the resulting coordinates
improperAtomsA list of groups of 4 atom indices for inversion terms
atomNumsA list of atomic numbers for all atoms in the molecule
Returns
a pointer to a ForceField with improper terms NOTE: the caller is responsible for deleting this force field.
ForceFields::ForceField* DistGeom::constructForceField ( const BoundsMatrix mmat,
RDGeom::PointPtrVect positions,
const VECT_CHIRALSET csets,
double  weightChiral = 1.0,
double  weightFourthDim = 0.1,
std::map< std::pair< int, int >, double > *  extraWeights = 0,
double  basinSizeTol = 5.0 
)

Setup the error function for violation of distance bounds as a forcefield.

This is based on function E3 on page 311 of "Distance Geometry in Molecular Modeling" Jeffrey M.Blaney and J.Scott Dixon, Review in Computational Chemistry, Volume V

Parameters
mmatDistance bounds matrix
positionsA vector of pointers to Points to write out the resulting coordinates
csetsThe vector of chiral points (type: ChiralSet)
weightChiralweight to be used to enforce chirality
weightFourthDimanother chiral weight
extraWeightsan optional set of weights for distance bounds violations
basinSizeTolOptional: any distance bound with a basin (distance between max and min bounds) larger than this value will not be included in the force field used to cleanup the structure.
Returns
a pointer to a ForceField suitable for cleaning up the violations. NOTE: the caller is responsible for deleting this force field.
ForceFields::ForceField* DistGeom::constructPlain3DForceField ( const BoundsMatrix mmat,
RDGeom::Point3DPtrVect positions,
const std::vector< std::pair< int, int > > &  bonds,
const std::vector< std::vector< int > > &  angles,
const std::vector< std::vector< int > > &  expTorsionAtoms,
const std::vector< std::pair< std::vector< int >, std::vector< double > > > &  expTorsionAngles,
const std::vector< int > &  atomNums 
)

Force field with experimental torsion angle preferences and 1-2/1-3 distance.

Parameters
mmatDistance bounds matrix
positionsA vector of pointers to 3D Points to write out the resulting coordinates
bondsA list of 1-2 partners (bonds)
anglesA list of 1-3 partners (angles)
expTorsionAtomsA list of groups of 4 atom indices for experimental torsions
expTorsionAnglesA list of corresponding torsion angle-potential parameters
atomNumsA list of atomic numbers for all atoms in the molecule
Returns
a pointer to a ForceField suitable for imposing experimental torsion angle preferences NOTE: the caller is responsible for deleting this force field.
double DistGeom::pickRandomDistMat ( const BoundsMatrix mmat,
RDNumeric::SymmMatrix< double > &  distmat,
int  seed = -1 
)

Pick a distance matrix at random such that the distance satisfy the bounds in the BoundsMatrix

Parameters
mmatBounds matrix
distmatStorage for randomly chosen distances
seedthe random number seed to use
Returns
the largest element of the distance matrix
double DistGeom::pickRandomDistMat ( const BoundsMatrix mmat,
RDNumeric::SymmMatrix< double > &  distmat,
RDKit::double_source_type rng 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

bool DistGeom::triangleSmoothBounds ( BoundsMatrix boundsMat,
double  tol = 0. 
)

Smooth the upper and lower bound in a metric matrix so that triangle inequality is not violated

This an implementation of the O(N^3) algorithm given on pages 252-253 of "Distance Geometry and Molecular Conformation" by G.M.Crippen and T.F.Havel Research Studies Press, 1988. There are other (slightly) more implementations (see pages 301-302 in the above book), but that is for later

Parameters
boundsMatA pointer to the distance bounds matrix
tola tolerance (percent) for errors in the smoothing process
bool DistGeom::triangleSmoothBounds ( BoundsMatPtr  boundsMat,
double  tol = 0. 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.