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