RDKit: MolTransforms.h Source File

| RDKit Open-source cheminformatics and machine learning.

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

MolTransforms.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2003-2006 Rational Discovery LLC
3 //
4 // @@ All Rights Reserved @@
5 // This file is part of the RDKit.
6 // The contents are covered by the terms of the BSD license
7 // which is included in the file license.txt, found at the root
8 // of the RDKit source tree.
9 //
10 #ifndef _RD_MOLTRANSFORMS_H_
11 #define _RD_MOLTRANSFORMS_H_
12
13 #include <Geometry/point.h>
14 #include <Numerics/SymmMatrix.h>
15
16 namespace RDKit {
17 class ROMol;
18 class Atom;
19 class Conformer;
20 }
21
22 namespace RDGeom {
23 class Transform3D;
24 }
25
26 namespace MolTransforms {
27 void transformMolsAtoms(RDKit::ROMol *mol, RDGeom::Transform3D &tform);
28 void transformAtom(RDKit::Atom *atom, RDGeom::Transform3D &tform);
29
30 //! Compute the centroid of a conformer
31 /*!
32 This is simple the average of the heavy atom locations in the conformer,
33 not attention is paid to hydrogens or the differences in atomic radii
34
35 \param conf Conformer of interest
36 \param ignoreHs If true, ignore hydrogen atoms
37 */
38 RDGeom::Point3D computeCentroid(const RDKit::Conformer &conf,
39 bool ignoreHs = true);
40
41 //! Compute the covariance matrix for a conformer
42 /*!
43 \param conf Conformer of interest
44 \param center Center to be used for covariance matrix calculation
45 \param normalize If true, normalize the covariance matrix by the number of
46 atoms
47 \param ignoreHs If true, ignore hydrogen atoms
48 */
49 RDNumeric::DoubleSymmMatrix *computeCovarianceMatrix(
50 const RDKit::Conformer &conf, const RDGeom::Point3D &center,
51 bool normalize = false, bool ignoreHs = true);
52
53 //! Compute the transformation require to orient the conformation
54 //! along the principal axes about the center; i.e. center is made to coincide
55 // with the
56 //! origin, the largest princiapl axis with the x-axis, the next largest with
57 // the y-axis
58 //! and the smallest with the z-axis
59 /*!
60 If center is not specified the the centroid of the conformer will be used
61 \param conf Conformer of interest
62 \param center Center to be used for canonicalization, defaults to
63 the centroid of the
64 conformation
65 \param normalizeCovar Normalize the covariance matrix with the number of
66 atoms
67 \param ignoreHs Optinally ignore hydrogens
68 */
69 RDGeom::Transform3D *computeCanonicalTransform(
70 const RDKit::Conformer &conf, const RDGeom::Point3D *center = 0,
71 bool normalizeCovar = false, bool ignoreHs = true);
72
73 //! Transform the conformation using the specified transformation
74 void transformConformer(RDKit::Conformer &conf,
75 const RDGeom::Transform3D &trans);
76
77 //! Canonicalize the orientation of a conformer so that its principal axes
78 //! around the specified center point coincide with the x, y, z axes
79 /*!
80 \param conf The conformer of interest
81 \param center Optional center point about which the principal axes are
82 computed
83 if not specified the centroid of the conformer will be
84 used
85 \param normalizeCovar Optionally normalize the covariance matrix by the number
86 of atoms
87 \param ignoreHs If true, ignore hydrogen atoms
88
89 */
90 void canonicalizeConformer(RDKit::Conformer &conf,
91 const RDGeom::Point3D *center = 0,
92 bool normalizeCovar = false, bool ignoreHs = true);
93
94 //! Canonicalize all the conformations in a molecule
95 /*!
96 \param mol the molecule of interest
97 \param normalizeCovar Optionally normalize the covariance matrix by the number
98 of atoms
99 \param ignoreHs If true, ignore hydrogens
100 */
101 void canonicalizeMol(RDKit::ROMol &mol, bool normalizeCovar = false,
102 bool ignoreHs = true);
103
104 //! Get the bond length between the specified atoms i, j
105 double getBondLength(const RDKit::Conformer &conf, unsigned int iAtomId,
106 unsigned int jAtomId);
107
108 //! Set the bond length between the specified atoms i, j
109 //! (all atoms bonded to atom j are moved)
110 void setBondLength(RDKit::Conformer &conf, unsigned int iAtomId,
111 unsigned int jAtomId, double value);
112
113 //! Get the angle in radians among the specified atoms i, j, k
114 double getAngleRad(const RDKit::Conformer &conf, unsigned int iAtomId,
115 unsigned int jAtomId, unsigned int kAtomId);
116
117 //! Get the angle in degrees among the specified atoms i, j, k
118 inline double getAngleDeg(const RDKit::Conformer &conf, unsigned int iAtomId,
119 unsigned int jAtomId, unsigned int kAtomId) {
120 return (180. / M_PI * getAngleRad(conf, iAtomId, jAtomId, kAtomId));
121 }
122
123 //! Set the angle in radians among the specified atoms i, j, k
124 //! (all atoms bonded to atom k are moved)
125 void setAngleRad(RDKit::Conformer &conf, unsigned int iAtomId,
126 unsigned int jAtomId, unsigned int kAtomId, double value);
127
128 //! Set the angle in degrees among the specified atoms i, j, k
129 //! (all atoms bonded to atom k are moved)
130 inline void setAngleDeg(RDKit::Conformer &conf, unsigned int iAtomId,
131 unsigned int jAtomId, unsigned int kAtomId,
132 double value) {
133 setAngleRad(conf, iAtomId, jAtomId, kAtomId, value / 180. * M_PI);
134 }
135
136 //! Get the dihedral angle in radians among the specified atoms i, j, k, l
137 double getDihedralRad(const RDKit::Conformer &conf, unsigned int iAtomId,
138 unsigned int jAtomId, unsigned int kAtomId,
139 unsigned int lAtomId);
140
141 //! Get the dihedral angle in degrees among the specified atoms i, j, k, l
142 inline double getDihedralDeg(const RDKit::Conformer &conf, unsigned int iAtomId,
143 unsigned int jAtomId, unsigned int kAtomId,
144 unsigned int lAtomId) {
145 return (180. / M_PI *
146 getDihedralRad(conf, iAtomId, jAtomId, kAtomId, lAtomId));
147 }
148
149 //! Set the dihedral angle in radians among the specified atoms i, j, k, l
150 //! (all atoms bonded to atom l are moved)
151 void setDihedralRad(RDKit::Conformer &conf, unsigned int iAtomId,
152 unsigned int jAtomId, unsigned int kAtomId,
153 unsigned int lAtomId, double value);
154
155 //! Set the dihedral angle in degrees among the specified atoms i, j, k, l
156 //! (all atoms bonded to atom l are moved)
157 inline void setDihedralDeg(RDKit::Conformer &conf, unsigned int iAtomId,
158 unsigned int jAtomId, unsigned int kAtomId,
159 unsigned int lAtomId, double value) {
160 setDihedralRad(conf, iAtomId, jAtomId, kAtomId, lAtomId, value / 180. * M_PI);
161 }
162 }
163 #endif
MolTransforms::getDihedralDeg
double getDihedralDeg(const RDKit::Conformer &conf, unsigned int iAtomId, unsigned int jAtomId, unsigned int kAtomId, unsigned int lAtomId)
Get the dihedral angle in degrees among the specified atoms i, j, k, l.
Definition: MolTransforms.h:142
MolTransforms
Definition: MolTransforms.h:26
MolTransforms::canonicalizeConformer
void canonicalizeConformer(RDKit::Conformer &conf, const RDGeom::Point3D *center=0, bool normalizeCovar=false, bool ignoreHs=true)
MolTransforms::transformAtom
void transformAtom(RDKit::Atom *atom, RDGeom::Transform3D &tform)
point.h
MolTransforms::getAngleRad
double getAngleRad(const RDKit::Conformer &conf, unsigned int iAtomId, unsigned int jAtomId, unsigned int kAtomId)
Get the angle in radians among the specified atoms i, j, k.
RDNumeric::SymmMatrix
A symmetric matrix class.
Definition: SymmMatrix.h:29
MolTransforms::getDihedralRad
double getDihedralRad(const RDKit::Conformer &conf, unsigned int iAtomId, unsigned int jAtomId, unsigned int kAtomId, unsigned int lAtomId)
Get the dihedral angle in radians among the specified atoms i, j, k, l.
MolTransforms::canonicalizeMol
void canonicalizeMol(RDKit::ROMol &mol, bool normalizeCovar=false, bool ignoreHs=true)
Canonicalize all the conformations in a molecule.
MolTransforms::computeCovarianceMatrix
RDNumeric::DoubleSymmMatrix * computeCovarianceMatrix(const RDKit::Conformer &conf, const RDGeom::Point3D &center, bool normalize=false, bool ignoreHs=true)
Compute the covariance matrix for a conformer.
MolTransforms::setDihedralDeg
void setDihedralDeg(RDKit::Conformer &conf, unsigned int iAtomId, unsigned int jAtomId, unsigned int kAtomId, unsigned int lAtomId, double value)
Definition: MolTransforms.h:157
RDKit::ROMol
ROMol is a molecule class that is intended to have a fixed topology.
Definition: ROMol.h:102
MolTransforms::transformConformer
void transformConformer(RDKit::Conformer &conf, const RDGeom::Transform3D &trans)
Transform the conformation using the specified transformation.
MolTransforms::getAngleDeg
double getAngleDeg(const RDKit::Conformer &conf, unsigned int iAtomId, unsigned int jAtomId, unsigned int kAtomId)
Get the angle in degrees among the specified atoms i, j, k.
Definition: MolTransforms.h:118
MolTransforms::setAngleDeg
void setAngleDeg(RDKit::Conformer &conf, unsigned int iAtomId, unsigned int jAtomId, unsigned int kAtomId, double value)
Definition: MolTransforms.h:130
MolTransforms::setAngleRad
void setAngleRad(RDKit::Conformer &conf, unsigned int iAtomId, unsigned int jAtomId, unsigned int kAtomId, double value)
SymmMatrix.h
RDKit
Includes a bunch of functionality for handling Atom and Bond queries.
Definition: Atom.h:28
MolTransforms::computeCentroid
RDGeom::Point3D computeCentroid(const RDKit::Conformer &conf, bool ignoreHs=true)
Compute the centroid of a conformer.
MolTransforms::getBondLength
double getBondLength(const RDKit::Conformer &conf, unsigned int iAtomId, unsigned int jAtomId)
Get the bond length between the specified atoms i, j.
RDGeom::Point3D
Definition: point.h:45
MolTransforms::transformMolsAtoms
void transformMolsAtoms(RDKit::ROMol *mol, RDGeom::Transform3D &tform)
RDKit::Conformer
The class for representing 2D or 3D conformation of a molecule.
Definition: Conformer.h:41
MolTransforms::setBondLength
void setBondLength(RDKit::Conformer &conf, unsigned int iAtomId, unsigned int jAtomId, double value)
RDGeom::Transform3D
Definition: Transform3D.h:21
MolTransforms::setDihedralRad
void setDihedralRad(RDKit::Conformer &conf, unsigned int iAtomId, unsigned int jAtomId, unsigned int kAtomId, unsigned int lAtomId, double value)
MolTransforms::computeCanonicalTransform
RDGeom::Transform3D * computeCanonicalTransform(const RDKit::Conformer &conf, const RDGeom::Point3D *center=0, bool normalizeCovar=false, bool ignoreHs=true)
origin, the largest princiapl axis with the x-axis, the next largest with
RDGeom
Definition: TorsionAngleM6.h:19
RDKit::Atom
The class for representing atoms.
Definition: Atom.h:67
M_PI
#define M_PI
Definition: MMFF/Params.h:25