RDKit
Open-source cheminformatics and machine learning.
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 #include <RDGeneral/export.h>
13 #ifndef _RD_MMFFATOMTYPER_H__
14 #define _RD_MMFFATOMTYPER_H__
15 
16 #include <vector>
17 #include <string>
18 #include <iostream>
19 #include <ForceField/MMFF/Params.h>
20 #include <cstdint>
21 
22 namespace RDKit {
23 class ROMol;
24 class RWMol;
25 class Atom;
26 class Bond;
27 
28 namespace MMFF {
29 
30 namespace DefaultParameters {
43 }
44 
45 class RingMembershipSize;
46 using namespace ForceFields::MMFF;
48  public:
50  : mmffAtomType(0), mmffFormalCharge(0.0), mmffPartialCharge(0.0){};
52  std::uint8_t mmffAtomType;
55 };
56 
57 typedef boost::shared_ptr<MMFFAtomProperties> MMFFAtomPropertiesPtr;
58 enum { CONSTANT = 1, DISTANCE = 2 };
59 enum {
63 };
65  public:
66  MMFFMolProperties(ROMol &mol, const std::string &mmffVariant = "MMFF94",
67  std::uint8_t verbosity = MMFF_VERBOSITY_NONE,
68  std::ostream &oStream = std::cout);
70  unsigned int getMMFFBondType(const Bond *bond);
71  unsigned int getMMFFAngleType(const ROMol &mol, const unsigned int idx1,
72  const unsigned int idx2,
73  const unsigned int idx3);
74  const std::pair<unsigned int, unsigned int> getMMFFTorsionType(
75  const ROMol &mol, const unsigned int idx1, const unsigned int idx2,
76  const unsigned int idx3, const unsigned int idx4);
77  void computeMMFFCharges(const ROMol &mol);
78  const ForceFields::MMFF::MMFFTor *getMMFFTorsionEmpiricalRuleParams(
79  const ROMol &mol, unsigned int idx2, unsigned int idx3);
80  const ForceFields::MMFF::MMFFBond *getMMFFBondStretchEmpiricalRuleParams(
81  const ROMol &mol, const Bond *bond);
82  std::uint8_t getMMFFAtomType(const unsigned int idx) {
83  URANGE_CHECK(idx, this->d_MMFFAtomPropertiesPtrVect.size());
84 
85  return this->d_MMFFAtomPropertiesPtrVect[idx]->mmffAtomType;
86  };
87  double getMMFFFormalCharge(const unsigned int idx) {
88  URANGE_CHECK(idx, this->d_MMFFAtomPropertiesPtrVect.size());
89 
90  return this->d_MMFFAtomPropertiesPtrVect[idx]->mmffFormalCharge;
91  };
92  double getMMFFPartialCharge(const unsigned int idx) {
93  URANGE_CHECK(idx, this->d_MMFFAtomPropertiesPtrVect.size());
94 
95  return this->d_MMFFAtomPropertiesPtrVect[idx]->mmffPartialCharge;
96  };
97  void setMMFFBondTerm(const bool state) { this->d_bondTerm = state; };
98  bool getMMFFBondTerm() { return this->d_bondTerm; };
99  void setMMFFAngleTerm(const bool state) { this->d_angleTerm = state; };
100  bool getMMFFAngleTerm() { return this->d_angleTerm; };
101  void setMMFFStretchBendTerm(const bool state) {
102  this->d_stretchBendTerm = state;
103  };
104  bool getMMFFStretchBendTerm() { return this->d_stretchBendTerm; };
105  void setMMFFOopTerm(const bool state) { this->d_oopTerm = state; };
106  bool getMMFFOopTerm() { return this->d_oopTerm; };
107  void setMMFFTorsionTerm(const bool state) { this->d_torsionTerm = state; };
108  bool getMMFFTorsionTerm() { return this->d_torsionTerm; };
109  void setMMFFVdWTerm(const bool state) { this->d_vdWTerm = state; };
110  bool getMMFFVdWTerm() { return this->d_vdWTerm; };
111  void setMMFFEleTerm(const bool state) { this->d_eleTerm = state; };
112  bool getMMFFEleTerm() { return this->d_eleTerm; };
113  void setMMFFVariant(const std::string &mmffVariant) {
114  PRECONDITION((mmffVariant == "MMFF94") || (mmffVariant == "MMFF94s"),
115  "bad MMFF variant");
116 
117  this->d_mmffs = ((mmffVariant == "MMFF94s") ? true : false);
118  };
119  const std::string getMMFFVariant() {
120  return (this->d_mmffs ? "MMFF94s" : "MMFF94");
121  };
122  void setMMFFDielectricConstant(const double dielConst) {
123  PRECONDITION(dielConst > 0.0, "bad dielectric constant");
124 
125  this->d_dielConst = dielConst;
126  };
127  double getMMFFDielectricConstant() { return this->d_dielConst; };
128  void setMMFFDielectricModel(std::uint8_t dielModel) {
129  this->d_dielModel = dielModel;
130  };
131  std::uint8_t getMMFFDielectricModel() { return this->d_dielModel; };
132  void setMMFFVerbosity(std::uint8_t verbosity) {
133  this->d_verbosity = verbosity;
134  };
135  std::uint8_t getMMFFVerbosity() { return this->d_verbosity; };
136  void setMMFFOStream(std::ostream *oStream) { this->d_oStream = oStream; };
137  std::ostream &getMMFFOStream() { return *(this->d_oStream); };
138  bool isValid() { return d_valid; };
139  bool getMMFFBondStretchParams(const ROMol &mol, const unsigned int idx1,
140  const unsigned int idx2, unsigned int &bondType,
141  MMFFBond &mmffBondStretchParams);
142  bool getMMFFAngleBendParams(const ROMol &mol,
143  const unsigned int idx1,
144  const unsigned int idx2, const unsigned int idx3,
145  unsigned int &angleType,
146  MMFFAngle &mmffAngleBendParams);
147  bool getMMFFStretchBendParams(const ROMol &mol, const unsigned int idx1,
148  const unsigned int idx2,
149  const unsigned int idx3,
150  unsigned int &stretchBendType,
151  MMFFStbn &mmffStretchBendParams,
152  MMFFBond mmffBondStretchParams[2],
153  MMFFAngle &mmffAngleBendParams);
154  bool getMMFFTorsionParams(const ROMol &mol, const unsigned int idx1,
155  const unsigned int idx2, const unsigned int idx3,
156  const unsigned int idx4, unsigned int &torsionType,
157  MMFFTor &mmffTorsionParams);
158  bool getMMFFOopBendParams(const ROMol &mol, const unsigned int idx1,
159  const unsigned int idx2, const unsigned int idx3,
160  const unsigned int idx4,
161  MMFFOop &mmffOopBendParams);
162  bool getMMFFVdWParams(const unsigned int idx1, const unsigned int idx2,
163  MMFFVdWRijstarEps &mmffVdWParams);
164 
165  private:
166  void setMMFFHeavyAtomType(const RingMembershipSize &rmSize, const Atom *atom);
167  void setMMFFHydrogenType(const Atom *atom);
168  void setMMFFFormalCharge(const unsigned int idx, const double fChg) {
169  URANGE_CHECK(idx, this->d_MMFFAtomPropertiesPtrVect.size());
170 
171  this->d_MMFFAtomPropertiesPtrVect[idx]->mmffFormalCharge = fChg;
172  };
173  void setMMFFPartialCharge(const unsigned int idx, const double pChg) {
174  URANGE_CHECK(idx, this->d_MMFFAtomPropertiesPtrVect.size());
175 
176  this->d_MMFFAtomPropertiesPtrVect[idx]->mmffPartialCharge = pChg;
177  };
178  bool d_valid;
179  bool d_mmffs;
180  bool d_bondTerm;
181  bool d_angleTerm;
182  bool d_stretchBendTerm;
183  bool d_oopTerm;
184  bool d_torsionTerm;
185  bool d_vdWTerm;
186  bool d_eleTerm;
187  double d_dielConst; //!< the dielectric constant
188  std::uint8_t d_dielModel; //!< the dielectric model (1 = constant, 2 =
189  // distance-dependent)
190  std::uint8_t d_verbosity;
191  std::ostream *d_oStream;
192  std::vector<MMFFAtomPropertiesPtr> d_MMFFAtomPropertiesPtrVect;
193 };
195  const ROMol &mol, const unsigned int idx1, const unsigned int idx2,
196  const unsigned int idx3);
198  const ROMol &mol, const unsigned int idx1, const unsigned int idx2,
199  const unsigned int idx3, const unsigned int idx4);
201  const ROMol &mol, const INT_VECT &ringIndxVect);
203  const Atom *atom, const unsigned int ringSize);
206  const ROMol &mol, const unsigned int idx1, const unsigned int idx2);
208  const ROMol &mol, const unsigned int ringSize, const unsigned int numAtoms,
209  ...);
213  const unsigned int angleType, const unsigned int bondType1,
214  const unsigned int bondType2);
216  const int atomicNum);
219  const ROMol &mol, const ForceFields::MMFF::MMFFAngle *oldMMFFAngleParams,
220  const ForceFields::MMFF::MMFFProp *mmffPropParamsCentralAtom,
221  const ForceFields::MMFF::MMFFBond *mmffBondParams1,
222  const ForceFields::MMFF::MMFFBond *mmffBondParams2, unsigned int idx1,
223  unsigned int idx2, unsigned int idx3);
224 } // namespace MMFF
225 } // namespace RDKit
226 
227 #endif
void setMMFFAngleTerm(const bool state)
const std::string getMMFFVariant()
RDKIT_FORCEFIELDHELPERS_EXPORT const ForceFields::MMFF::MMFFOopCollection * getMMFFOop(const bool isMMFFs)
void setMMFFVdWTerm(const bool state)
RDKIT_FORCEFIELDHELPERS_EXPORT bool isAtomNOxide(const Atom *atom)
class to store MMFF parameters for angle bending
Definition: MMFF/Params.h:112
void setMMFFDielectricModel(std::uint8_t dielModel)
RDKIT_FORCEFIELDHELPERS_EXPORT bool areAtomsInSameRingOfSize(const ROMol &mol, const unsigned int ringSize, const unsigned int numAtoms,...)
void setMMFFVerbosity(std::uint8_t verbosity)
boost::shared_ptr< MMFFAtomProperties > MMFFAtomPropertiesPtr
void setMMFFDielectricConstant(const double dielConst)
RDKIT_FORCEFIELDHELPERS_EXPORT const ForceFields::MMFF::MMFFVdWCollection * getMMFFVdW()
RWMol is a molecule class that is intended to be edited.
Definition: RWMol.h:31
RDKIT_FORCEFIELDHELPERS_EXPORT bool isAtomInAromaticRingOfSize(const Atom *atom, const unsigned int ringSize)
RDKIT_FORCEFIELDHELPERS_EXPORT unsigned int isAngleInRingOfSize3or4(const ROMol &mol, const unsigned int idx1, const unsigned int idx2, const unsigned int idx3)
RDKIT_FORCEFIELDHELPERS_EXPORT unsigned int getPeriodicTableRow(const int atomicNum)
RDKIT_FORCEFIELDHELPERS_EXPORT const ForceFields::MMFF::MMFFDfsbCollection * getMMFFDfsb()
RDKIT_FORCEFIELDHELPERS_EXPORT const ForceFields::MMFF::MMFFHerschbachLaurieCollection * getMMFFHerschbachLaurie()
void setMMFFBondTerm(const bool state)
RDKIT_FORCEFIELDHELPERS_EXPORT const ForceFields::MMFF::MMFFTorCollection * getMMFFTor(const bool isMMFFs)
RDKIT_FORCEFIELDHELPERS_EXPORT bool isRingAromatic(const ROMol &mol, const INT_VECT &ringIndxVect)
void setMMFFTorsionTerm(const bool state)
std::uint8_t getMMFFAtomType(const unsigned int idx)
std::vector< int > INT_VECT
Definition: types.h:254
class to store MMFF parameters for stretch-bending
Definition: MMFF/Params.h:119
RDKIT_FORCEFIELDHELPERS_EXPORT 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 bond stretching
Definition: MMFF/Params.h:88
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:126
Std stuff.
Definition: Atom.h:30
void setMMFFOopTerm(const bool state)
double getMMFFPartialCharge(const unsigned int idx)
#define URANGE_CHECK(x, hi)
Definition: Invariant.h:142
class for representing a bond
Definition: Bond.h:47
RDKIT_FORCEFIELDHELPERS_EXPORT const ForceFields::MMFF::MMFFAngleCollection * getMMFFAngle()
void setMMFFEleTerm(const bool state)
void setMMFFOStream(std::ostream *oStream)
RDKIT_FORCEFIELDHELPERS_EXPORT const ForceFields::MMFF::MMFFPropCollection * getMMFFProp()
#define RDKIT_FORCEFIELDHELPERS_EXPORT
Definition: export.h:268
RDKIT_FORCEFIELDHELPERS_EXPORT bool areAtomsInSameAromaticRing(const ROMol &mol, const unsigned int idx1, const unsigned int idx2)
void setMMFFVariant(const std::string &mmffVariant)
#define PRECONDITION(expr, mess)
Definition: Invariant.h:109
RDKIT_FORCEFIELDHELPERS_EXPORT void setMMFFAromaticity(RWMol &mol)
RDKIT_FORCEFIELDHELPERS_EXPORT unsigned int sanitizeMMFFMol(RWMol &mol)
class to store MMFF parameters for torsions
Definition: MMFF/Params.h:132
RDKIT_FORCEFIELDHELPERS_EXPORT unsigned int isTorsionInRingOfSize4or5(const ROMol &mol, const unsigned int idx1, const unsigned int idx2, const unsigned int idx3, const unsigned int idx4)
RDKIT_FORCEFIELDHELPERS_EXPORT const ForceFields::MMFF::MMFFAromCollection * getMMFFArom()
RDKIT_FORCEFIELDHELPERS_EXPORT const ForceFields::MMFF::MMFFStbnCollection * getMMFFStbn()
The class for representing atoms.
Definition: Atom.h:69
RDKIT_FORCEFIELDHELPERS_EXPORT const ForceFields::MMFF::MMFFPBCICollection * getMMFFPBCI()
RDKIT_FORCEFIELDHELPERS_EXPORT unsigned int getMMFFStretchBendType(const unsigned int angleType, const unsigned int bondType1, const unsigned int bondType2)
RDKIT_FORCEFIELDHELPERS_EXPORT const ForceFields::MMFF::MMFFDefCollection * getMMFFDef()
class to store MMFF Properties
Definition: MMFF/Params.h:61