RDKit
Open-source cheminformatics and machine learning.
UFF/Params.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2004-2021 Greg Landrum and other RDKit contributors
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 #include <RDGeneral/export.h>
11 #ifndef RD_UFFPARAMS_H
12 #define RD_UFFPARAMS_H
13 
14 #include <memory>
15 #include <string>
16 #include <cmath>
17 #include <map>
18 
19 #ifndef M_PI
20 #define M_PI 3.14159265358979323846
21 #endif
22 
23 namespace ForceFields {
24 namespace UFF {
25 
26 const double DEG2RAD = M_PI / 180.0;
27 const double RAD2DEG = 180.0 / M_PI;
28 inline bool isDoubleZero(const double x) {
29  return ((x < 1.0e-10) && (x > -1.0e-10));
30 }
31 inline void clipToOne(double &x) {
32  if (x > 1.0) {
33  x = 1.0;
34  } else if (x < -1.0) {
35  x = -1.0;
36  }
37 }
38 
39 //! class to store UFF parameters for bond stretching
41  public:
42  double kb;
43  double r0;
44 };
45 
46 //! class to store UFF parameters for angle bending
48  public:
49  double ka;
50  double theta0;
51 };
52 
53 //! class to store UFF parameters for torsions
55  public:
56  double V;
57 };
58 
59 //! class to store UFF parameters for inversions
61  public:
62  double K;
63 };
64 
65 //! class to store UFF parameters for van der Waals interactions
67  public:
68  double x_ij;
69  double D_ij;
70 };
71 
72 //! class to store atomic parameters for the Universal Force Field
74  public:
75  double r1; //!< valence bond radius
76  double theta0; //!< valence angle
77  double x1; //!< vdW characteristic length
78  double D1; //!< vdW atomic energy
79  double zeta; //!< vdW scaling term
80  double Z1; //!< effective charge
81  double V1; //!< sp3 torsional barrier parameter
82  double U1; //!< torsional contribution for sp2-sp3 bonds
83  double GMP_Xi; //!< GMP Electronegativity;
84  double GMP_Hardness; //!< GMP Hardness
85  double GMP_Radius; //!< GMP Radius value
86 };
87 
88 namespace Params {
89 const double lambda = 0.1332; //!< scaling factor for rBO correction
90 const double G = 332.06; //!< bond force constant prefactor
91 const double amideBondOrder =
92  1.41; //!< special case bond order for amide C-N bonds.
93 }; // namespace Params
94 
95 //! singleton class for retrieving UFF AtomParams
96 /*!
97  Use the singleton like this:
98 
99  \verbatim
100  ParamCollection *params=ParamCollection::getParams();
101  const AtomParams *ap=params("C_3");
102  \endverbatim
103 
104  If you have your own parameter data, it can be supplied as a string:
105  \verbatim
106  ParamCollection *params=ParamCollection::getParams(myParamData);
107  const AtomParams *ap=params("C_3");
108  \endverbatim
109  You are responsible for making sure that the data is in the correct
110  format (see Params.cpp for an example).
111 
112 */
114  public:
115  //! gets a pointer to the singleton ParamCollection
116  /*!
117  \param paramData (optional) a string with parameter data. See
118  below for more information about this argument
119 
120  \return a pointer to the singleton ParamCollection
121 
122  <b>Notes:</b>
123  - do <b>not</b> delete the pointer returned here
124  - if the singleton ParamCollection has already been instantiated and
125  \c paramData is empty, the singleton will be returned.
126  - if \c paramData is empty and the singleton ParamCollection has
127  not yet been instantiated, the default UFF parameters (from Params.cpp)
128  will be used.
129  - if \c paramData is supplied, a new singleton will be instantiated.
130  The current instantiation (if there is one) will be deleted.
131  */
132  static const ParamCollection *getParams(const std::string &paramData = "");
133  //! Looks up the parameters for a particular UFF key and returns them.
134  /*!
135  \return a pointer to the AtomicParams object, NULL on failure.
136  */
137  const AtomicParams *operator()(const std::string &symbol) const {
138  std::map<std::string, AtomicParams>::const_iterator res;
139  res = d_params.find(symbol);
140  if (res != d_params.end()) {
141  return &((*res).second);
142  }
143  return nullptr;
144  }
145 
147 
148  private:
149  std::map<std::string, AtomicParams> d_params; //!< the parameter map
150 };
151 } // namespace UFF
152 } // namespace ForceFields
153 #endif
#define M_PI
Definition: UFF/Params.h:20
class to store atomic parameters for the Universal Force Field
Definition: UFF/Params.h:73
double GMP_Xi
GMP Electronegativity;.
Definition: UFF/Params.h:83
double GMP_Hardness
GMP Hardness.
Definition: UFF/Params.h:84
double GMP_Radius
GMP Radius value.
Definition: UFF/Params.h:85
double r1
valence bond radius
Definition: UFF/Params.h:75
double x1
vdW characteristic length
Definition: UFF/Params.h:77
double U1
torsional contribution for sp2-sp3 bonds
Definition: UFF/Params.h:82
double D1
vdW atomic energy
Definition: UFF/Params.h:78
double zeta
vdW scaling term
Definition: UFF/Params.h:79
double V1
sp3 torsional barrier parameter
Definition: UFF/Params.h:81
double theta0
valence angle
Definition: UFF/Params.h:76
double Z1
effective charge
Definition: UFF/Params.h:80
singleton class for retrieving UFF AtomParams
Definition: UFF/Params.h:113
static const ParamCollection * getParams(const std::string &paramData="")
gets a pointer to the singleton ParamCollection
const AtomicParams * operator()(const std::string &symbol) const
Looks up the parameters for a particular UFF key and returns them.
Definition: UFF/Params.h:137
ParamCollection(std::string paramData)
class to store UFF parameters for angle bending
Definition: UFF/Params.h:47
class to store UFF parameters for bond stretching
Definition: UFF/Params.h:40
class to store UFF parameters for inversions
Definition: UFF/Params.h:60
class to store UFF parameters for torsions
Definition: UFF/Params.h:54
class to store UFF parameters for van der Waals interactions
Definition: UFF/Params.h:66
#define RDKIT_FORCEFIELD_EXPORT
Definition: export.h:177
static const char * symbol[119]
Definition: mf.h:259
const double amideBondOrder
special case bond order for amide C-N bonds.
Definition: UFF/Params.h:91
const double lambda
scaling factor for rBO correction
Definition: UFF/Params.h:89
const double G
bond force constant prefactor
Definition: UFF/Params.h:90
const double RAD2DEG
Definition: UFF/Params.h:27
const double DEG2RAD
Definition: UFF/Params.h:26
bool isDoubleZero(const double x)
Definition: UFF/Params.h:28
void clipToOne(double &x)
Definition: UFF/Params.h:31
std::string paramData