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