RDKit: AtomTyper.h Source File

| RDKit Open-source cheminformatics and machine learning.

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

MMFF/AtomTyper.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2013-2016 Paolo Tosco
3 //
4 // Copyright (C) 2004-2006 Rational Discovery LLC
5 //
6 // @@ All Rights Reserved @@
7 // This file is part of the RDKit.
8 // The contents are covered by the terms of the BSD license
9 // which is included in the file license.txt, found at the root
10 // of the RDKit source tree.
11 //
12 #ifndef _RD_MMFFATOMTYPER_H__
13 #define _RD_MMFFATOMTYPER_H__
14
15 #include <vector>
16 #include <string>
17 #include <iostream>
18 #include <ForceField/MMFF/Params.h>
19 #include <boost/cstdint.hpp>
20
21 namespace RDKit {
22 class ROMol;
23 class RWMol;
24 class Atom;
25 class Bond;
26
27 namespace MMFF {
28 class RingMembershipSize;
29 using namespace ForceFields::MMFF;
30 class MMFFAtomProperties {
31 public:
32 MMFFAtomProperties()
33 : mmffAtomType(0), mmffFormalCharge(0.0), mmffPartialCharge(0.0){};
34 ~MMFFAtomProperties(){};
35 boost::uint8_t mmffAtomType;
36 double mmffFormalCharge;
37 double mmffPartialCharge;
38 };
39
40 typedef boost::shared_ptr<MMFFAtomProperties> MMFFAtomPropertiesPtr;
41 enum { CONSTANT = 1, DISTANCE = 2 };
42 enum {
43 MMFF_VERBOSITY_NONE = 0,
44 MMFF_VERBOSITY_LOW = 1,
45 MMFF_VERBOSITY_HIGH = 2
46 };
47 class MMFFMolProperties {
48 public:
49 MMFFMolProperties(ROMol &mol, const std::string &mmffVariant = "MMFF94",
50 boost::uint8_t verbosity = MMFF_VERBOSITY_NONE,
51 std::ostream &oStream = std::cout);
52 ~MMFFMolProperties(){};
53 unsigned int getMMFFBondType(const Bond *bond);
54 unsigned int getMMFFAngleType(const ROMol &mol, const unsigned int idx1,
55 const unsigned int idx2,
56 const unsigned int idx3);
57 const std::pair<unsigned int, unsigned int> getMMFFTorsionType(
58 const ROMol &mol, const unsigned int idx1, const unsigned int idx2,
59 const unsigned int idx3, const unsigned int idx4);
60 void computeMMFFCharges(const ROMol &mol);
61 const ForceFields::MMFF::MMFFTor *getMMFFTorsionEmpiricalRuleParams(
62 const ROMol &mol, unsigned int idx2, unsigned int idx3);
63 const ForceFields::MMFF::MMFFBond *getMMFFBondStretchEmpiricalRuleParams(
64 const ROMol &mol, const Bond *bond);
65 boost::uint8_t getMMFFAtomType(const unsigned int idx) {
66 URANGE_CHECK(idx, this->d_MMFFAtomPropertiesPtrVect.size());
67
68 return this->d_MMFFAtomPropertiesPtrVect[idx]->mmffAtomType;
69 };
70 double getMMFFFormalCharge(const unsigned int idx) {
71 URANGE_CHECK(idx, this->d_MMFFAtomPropertiesPtrVect.size());
72
73 return this->d_MMFFAtomPropertiesPtrVect[idx]->mmffFormalCharge;
74 };
75 double getMMFFPartialCharge(const unsigned int idx) {
76 URANGE_CHECK(idx, this->d_MMFFAtomPropertiesPtrVect.size());
77
78 return this->d_MMFFAtomPropertiesPtrVect[idx]->mmffPartialCharge;
79 };
80 void setMMFFBondTerm(const bool state) { this->d_bondTerm = state; };
81 bool getMMFFBondTerm() { return this->d_bondTerm; };
82 void setMMFFAngleTerm(const bool state) { this->d_angleTerm = state; };
83 bool getMMFFAngleTerm() { return this->d_angleTerm; };
84 void setMMFFStretchBendTerm(const bool state) {
85 this->d_stretchBendTerm = state;
86 };
87 bool getMMFFStretchBendTerm() { return this->d_stretchBendTerm; };
88 void setMMFFOopTerm(const bool state) { this->d_oopTerm = state; };
89 bool getMMFFOopTerm() { return this->d_oopTerm; };
90 void setMMFFTorsionTerm(const bool state) { this->d_torsionTerm = state; };
91 bool getMMFFTorsionTerm() { return this->d_torsionTerm; };
92 void setMMFFVdWTerm(const bool state) { this->d_vdWTerm = state; };
93 bool getMMFFVdWTerm() { return this->d_vdWTerm; };
94 void setMMFFEleTerm(const bool state) { this->d_eleTerm = state; };
95 bool getMMFFEleTerm() { return this->d_eleTerm; };
96 void setMMFFVariant(const std::string &mmffVariant) {
97 PRECONDITION((mmffVariant == "MMFF94") || (mmffVariant == "MMFF94s"),
98 "bad MMFF variant");
99
100 this->d_mmffs = ((mmffVariant == "MMFF94s") ? true : false);
101 };
102 const std::string getMMFFVariant() {
103 return (this->d_mmffs ? "MMFF94s" : "MMFF94");
104 };
105 void setMMFFDielectricConstant(const double dielConst) {
106 PRECONDITION(dielConst > 0.0, "bad dielectric constant");
107
108 this->d_dielConst = dielConst;
109 };
110 double getMMFFDielectricConstant() { return this->d_dielConst; };
111 void setMMFFDielectricModel(boost::uint8_t dielModel) {
112 this->d_dielModel = dielModel;
113 };
114 boost::uint8_t getMMFFDielectricModel() { return this->d_dielModel; };
115 void setMMFFVerbosity(boost::uint8_t verbosity) {
116 this->d_verbosity = verbosity;
117 };
118 boost::uint8_t getMMFFVerbosity() { return this->d_verbosity; };
119 void setMMFFOStream(std::ostream *oStream) { this->d_oStream = oStream; };
120 std::ostream &getMMFFOStream() { return *(this->d_oStream); };
121 bool isValid() { return d_valid; };
122 bool getMMFFBondStretchParams(const ROMol &mol, const unsigned int idx1,
123 const unsigned int idx2, unsigned int &bondType,
124 MMFFBond &mmffBondStretchParams);
125 bool getMMFFAngleBendParams(const ROMol &mol, const unsigned int idx1,
126 const unsigned int idx2, const unsigned int idx3,
127 unsigned int &angleType,
128 MMFFAngle &mmffAngleBendParams);
129 bool getMMFFStretchBendParams(const ROMol &mol, const unsigned int idx1,
130 const unsigned int idx2,
131 const unsigned int idx3,
132 unsigned int &stretchBendType,
133 MMFFStbn &mmffStretchBendParams,
134 MMFFBond mmffBondStretchParams[2],
135 MMFFAngle &mmffAngleBendParams);
136 bool getMMFFTorsionParams(const ROMol &mol, const unsigned int idx1,
137 const unsigned int idx2, const unsigned int idx3,
138 const unsigned int idx4, unsigned int &torsionType,
139 MMFFTor &mmffTorsionParams);
140 bool getMMFFOopBendParams(const ROMol &mol, const unsigned int idx1,
141 const unsigned int idx2, const unsigned int idx3,
142 const unsigned int idx4,
143 MMFFOop &mmffOopBendParams);
144 bool getMMFFVdWParams(const unsigned int idx1, const unsigned int idx2,
145 MMFFVdWRijstarEps &mmffVdWParams);
146
147 private:
148 void setMMFFHeavyAtomType(const RingMembershipSize &rmSize, const Atom *atom);
149 void setMMFFHydrogenType(const Atom *atom);
150 void setMMFFFormalCharge(const unsigned int idx, const double fChg) {
151 URANGE_CHECK(idx, this->d_MMFFAtomPropertiesPtrVect.size());
152
153 this->d_MMFFAtomPropertiesPtrVect[idx]->mmffFormalCharge = fChg;
154 };
155 void setMMFFPartialCharge(const unsigned int idx, const double pChg) {
156 URANGE_CHECK(idx, this->d_MMFFAtomPropertiesPtrVect.size());
157
158 this->d_MMFFAtomPropertiesPtrVect[idx]->mmffPartialCharge = pChg;
159 };
160 bool d_valid;
161 bool d_mmffs;
162 bool d_bondTerm;
163 bool d_angleTerm;
164 bool d_stretchBendTerm;
165 bool d_oopTerm;
166 bool d_torsionTerm;
167 bool d_vdWTerm;
168 bool d_eleTerm;
169 double d_dielConst; //!< the dielectric constant
170 boost::uint8_t d_dielModel; //!< the dielectric model (1 = constant, 2 =
171 // distance-dependent)
172 boost::uint8_t d_verbosity;
173 std::ostream *d_oStream;
174 std::vector<MMFFAtomPropertiesPtr> d_MMFFAtomPropertiesPtrVect;
175 };
176 unsigned int isAngleInRingOfSize3or4(const ROMol &mol, const unsigned int idx1,
177 const unsigned int idx2,
178 const unsigned int idx3);
179 unsigned int isTorsionInRingOfSize4or5(const ROMol &mol,
180 const unsigned int idx1,
181 const unsigned int idx2,
182 const unsigned int idx3,
183 const unsigned int idx4);
184 bool isRingAromatic(const ROMol &mol, const INT_VECT &ringIndxVect);
185 bool isAtomInAromaticRingOfSize(const Atom *atom, const unsigned int ringSize);
186 bool isAtomNOxide(const Atom *atom);
187 bool areAtomsInSameAromaticRing(const ROMol &mol, const unsigned int idx1,
188 const unsigned int idx2);
189 bool areAtomsInSameRingOfSize(const ROMol &mol, const unsigned int ringSize,
190 const unsigned int numAtoms, ...);
191 unsigned int sanitizeMMFFMol(RWMol &mol);
192 void setMMFFAromaticity(RWMol &mol);
193 unsigned int getMMFFStretchBendType(const unsigned int angleType,
194 const unsigned int bondType1,
195 const unsigned int bondType2);
196 unsigned int getPeriodicTableRow(const int atomicNum);
197 const ForceFields::MMFF::MMFFAngle *getMMFFAngleBendEmpiricalRuleParams(
198 const ROMol &mol, const ForceFields::MMFF::MMFFAngle *oldMMFFAngleParams,
199 const ForceFields::MMFF::MMFFProp *mmffPropParamsCentralAtom,
200 const ForceFields::MMFF::MMFFBond *mmffBondParams1,
201 const ForceFields::MMFF::MMFFBond *mmffBondParams2, unsigned int idx1,
202 unsigned int idx2, unsigned int idx3);
203 }
204 }
205
206 #endif
RDKit::MMFF::MMFFMolProperties::getMMFFVerbosity
boost::uint8_t getMMFFVerbosity()
Definition: MMFF/AtomTyper.h:118
RDKit::MMFF::MMFF_VERBOSITY_HIGH
Definition: MMFF/AtomTyper.h:45
RDKit::MMFF::MMFFMolProperties::getMMFFStretchBendTerm
bool getMMFFStretchBendTerm()
Definition: MMFF/AtomTyper.h:87
RDKit::MMFF::MMFFMolProperties::setMMFFAngleTerm
void setMMFFAngleTerm(const bool state)
Definition: MMFF/AtomTyper.h:82
RDKit::MMFF::MMFFAtomProperties
Definition: MMFF/AtomTyper.h:30
RDKit::MMFF::MMFFMolProperties::getMMFFVariant
const std::string getMMFFVariant()
Definition: MMFF/AtomTyper.h:102
RDKit::MMFF::setMMFFAromaticity
void setMMFFAromaticity(RWMol &mol)
Params.h
RDKit::MMFF::MMFFMolProperties::setMMFFVdWTerm
void setMMFFVdWTerm(const bool state)
Definition: MMFF/AtomTyper.h:92
ForceFields::MMFF::MMFFAngle
class to store MMFF parameters for angle bending
Definition: MMFF/Params.h:110
RDKit::MMFF::MMFFAtomPropertiesPtr
boost::shared_ptr< MMFFAtomProperties > MMFFAtomPropertiesPtr
Definition: MMFF/AtomTyper.h:40
RDKit::MMFF::MMFFMolProperties::setMMFFDielectricConstant
void setMMFFDielectricConstant(const double dielConst)
Definition: MMFF/AtomTyper.h:105
RDKit::MMFF::MMFFMolProperties::getMMFFTorsionTerm
bool getMMFFTorsionTerm()
Definition: MMFF/AtomTyper.h:91
RDKit::RWMol
RWMol is a molecule class that is intended to be edited.
Definition: RWMol.h:30
RDKit::MMFF::DISTANCE
Definition: MMFF/AtomTyper.h:41
RDKit::MMFF::getMMFFStretchBendType
unsigned int getMMFFStretchBendType(const unsigned int angleType, const unsigned int bondType1, const unsigned int bondType2)
RDKit::MMFF::MMFF_VERBOSITY_LOW
Definition: MMFF/AtomTyper.h:44
RDKit::MMFF::MMFFMolProperties::getMMFFOStream
std::ostream & getMMFFOStream()
Definition: MMFF/AtomTyper.h:120
RDKit::MMFF::MMFFMolProperties::~MMFFMolProperties
~MMFFMolProperties()
Definition: MMFF/AtomTyper.h:52
RDKit::MMFF::MMFFMolProperties::setMMFFBondTerm
void setMMFFBondTerm(const bool state)
Definition: MMFF/AtomTyper.h:80
RDKit::MMFF::MMFFAtomProperties::~MMFFAtomProperties
~MMFFAtomProperties()
Definition: MMFF/AtomTyper.h:34
RDKit::ROMol
ROMol is a molecule class that is intended to have a fixed topology.
Definition: ROMol.h:103
RDKit::MMFF::MMFF_VERBOSITY_NONE
Definition: MMFF/AtomTyper.h:43
RDKit::MMFF::MMFFMolProperties::setMMFFTorsionTerm
void setMMFFTorsionTerm(const bool state)
Definition: MMFF/AtomTyper.h:90
RDKit::MMFF::areAtomsInSameAromaticRing
bool areAtomsInSameAromaticRing(const ROMol &mol, const unsigned int idx1, const unsigned int idx2)
RDKit::MMFF::MMFFMolProperties::getMMFFEleTerm
bool getMMFFEleTerm()
Definition: MMFF/AtomTyper.h:95
RDKit::MMFF::areAtomsInSameRingOfSize
bool areAtomsInSameRingOfSize(const ROMol &mol, const unsigned int ringSize, const unsigned int numAtoms,...)
RDKit::MMFF::MMFFMolProperties::getMMFFBondTerm
bool getMMFFBondTerm()
Definition: MMFF/AtomTyper.h:81
RDKit::MMFF::isTorsionInRingOfSize4or5
unsigned int isTorsionInRingOfSize4or5(const ROMol &mol, const unsigned int idx1, const unsigned int idx2, const unsigned int idx3, const unsigned int idx4)
RDKit::MMFF::MMFFAtomProperties::mmffPartialCharge
double mmffPartialCharge
Definition: MMFF/AtomTyper.h:37
RDKit::MMFF::MMFFMolProperties::getMMFFOopTerm
bool getMMFFOopTerm()
Definition: MMFF/AtomTyper.h:89
RDKit::MMFF::sanitizeMMFFMol
unsigned int sanitizeMMFFMol(RWMol &mol)
RDKit::MMFF::MMFFMolProperties::getMMFFVdWTerm
bool getMMFFVdWTerm()
Definition: MMFF/AtomTyper.h:93
RDKit::INT_VECT
std::vector< int > INT_VECT
Definition: types.h:191
ForceFields::MMFF::MMFFStbn
class to store MMFF parameters for stretch-bending
Definition: MMFF/Params.h:117
RDKit::MMFF::getPeriodicTableRow
unsigned int getPeriodicTableRow(const int atomicNum)
ForceFields::MMFF::MMFFBond
class to store MMFF parameters for bond stretching
Definition: MMFF/Params.h:86
RDKit::MMFF::MMFFMolProperties::setMMFFStretchBendTerm
void setMMFFStretchBendTerm(const bool state)
Definition: MMFF/AtomTyper.h:84
ForceFields::MMFF
Definition: MMFF/AngleBend.h:19
RDKit::MMFF::MMFFMolProperties::getMMFFFormalCharge
double getMMFFFormalCharge(const unsigned int idx)
Definition: MMFF/AtomTyper.h:70
ForceFields::MMFF::MMFFOop
class to store MMFF parameters for out-of-plane bending
Definition: MMFF/Params.h:124
RDKit
Std stuff.
Definition: Atom.h:29
RDKit::MMFF::MMFFMolProperties::setMMFFVerbosity
void setMMFFVerbosity(boost::uint8_t verbosity)
Definition: MMFF/AtomTyper.h:115
RDKit::MMFF::MMFFMolProperties::setMMFFOopTerm
void setMMFFOopTerm(const bool state)
Definition: MMFF/AtomTyper.h:88
RDKit::MMFF::MMFFMolProperties::getMMFFPartialCharge
double getMMFFPartialCharge(const unsigned int idx)
Definition: MMFF/AtomTyper.h:75
RDKit::MMFF::isAngleInRingOfSize3or4
unsigned int isAngleInRingOfSize3or4(const ROMol &mol, const unsigned int idx1, const unsigned int idx2, const unsigned int idx3)
URANGE_CHECK
#define URANGE_CHECK(x, hi)
Definition: Invariant.h:140
RDKit::Bond
class for representing a bond
Definition: Bond.h:47
RDKit::MMFF::CONSTANT
Definition: MMFF/AtomTyper.h:41
RDKit::MMFF::MMFFMolProperties::setMMFFEleTerm
void setMMFFEleTerm(const bool state)
Definition: MMFF/AtomTyper.h:94
RDKit::MMFF::isAtomInAromaticRingOfSize
bool isAtomInAromaticRingOfSize(const Atom *atom, const unsigned int ringSize)
RDKit::MMFF::MMFFMolProperties::getMMFFAtomType
boost::uint8_t getMMFFAtomType(const unsigned int idx)
Definition: MMFF/AtomTyper.h:65
RDKit::MMFF::MMFFMolProperties::setMMFFOStream
void setMMFFOStream(std::ostream *oStream)
Definition: MMFF/AtomTyper.h:119
RDKit::MMFF::MMFFMolProperties::setMMFFVariant
void setMMFFVariant(const std::string &mmffVariant)
Definition: MMFF/AtomTyper.h:96
PRECONDITION
#define PRECONDITION(expr, mess)
Definition: Invariant.h:107
RDKit::MMFF::MMFFMolProperties
Definition: MMFF/AtomTyper.h:47
RDKit::MMFF::getMMFFAngleBendEmpiricalRuleParams
const ForceFields::MMFF::MMFFAngle * getMMFFAngleBendEmpiricalRuleParams(const ROMol &mol, const ForceFields::MMFF::MMFFAngle *oldMMFFAngleParams, const ForceFields::MMFF::MMFFProp *mmffPropParamsCentralAtom, const ForceFields::MMFF::MMFFBond *mmffBondParams1, const ForceFields::MMFF::MMFFBond *mmffBondParams2, unsigned int idx1, unsigned int idx2, unsigned int idx3)
ForceFields::MMFF::MMFFVdWRijstarEps
Definition: MMFF/Params.h:148
ForceFields::MMFF::MMFFTor
class to store MMFF parameters for torsions
Definition: MMFF/Params.h:130
RDKit::MMFF::isRingAromatic
bool isRingAromatic(const ROMol &mol, const INT_VECT &ringIndxVect)
RDKit::MMFF::MMFFMolProperties::getMMFFDielectricConstant
double getMMFFDielectricConstant()
Definition: MMFF/AtomTyper.h:110
RDKit::MMFF::MMFFMolProperties::setMMFFDielectricModel
void setMMFFDielectricModel(boost::uint8_t dielModel)
Definition: MMFF/AtomTyper.h:111
RDKit::MMFF::MMFFMolProperties::getMMFFAngleTerm
bool getMMFFAngleTerm()
Definition: MMFF/AtomTyper.h:83
RDKit::MMFF::isAtomNOxide
bool isAtomNOxide(const Atom *atom)
RDKit::Atom
The class for representing atoms.
Definition: Atom.h:68
RDKit::MMFF::MMFFMolProperties::isValid
bool isValid()
Definition: MMFF/AtomTyper.h:121
RDKit::MMFF::MMFFAtomProperties::MMFFAtomProperties
MMFFAtomProperties()
Definition: MMFF/AtomTyper.h:32
RDKit::MMFF::MMFFAtomProperties::mmffFormalCharge
double mmffFormalCharge
Definition: MMFF/AtomTyper.h:36
RDKit::MMFF::MMFFMolProperties::getMMFFDielectricModel
boost::uint8_t getMMFFDielectricModel()
Definition: MMFF/AtomTyper.h:114
ForceFields::MMFF::MMFFProp
class to store MMFF Properties
Definition: MMFF/Params.h:59