File: Params.h

package info (click to toggle)
rdkit 201809.1%2Bdfsg-6
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 123,688 kB
  • sloc: cpp: 230,509; python: 70,501; java: 6,329; ansic: 5,427; sql: 1,899; yacc: 1,739; lex: 1,243; makefile: 445; xml: 229; fortran: 183; sh: 123; cs: 93
file content (153 lines) | stat: -rw-r--r-- 4,467 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
//
//  Copyright (C) 2004-2006 Rational Discovery LLC
//
//   @@ All Rights Reserved @@
//  This file is part of the RDKit.
//  The contents are covered by the terms of the BSD license
//  which is included in the file license.txt, found at the root
//  of the RDKit source tree.
//
#include <RDGeneral/export.h>
#ifndef __RD_UFFPARAMS_H__
#define __RD_UFFPARAMS_H__

#include <string>
#include <cmath>
#include <map>

#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif

namespace ForceFields {
namespace UFF {

const double DEG2RAD = M_PI / 180.0;
const double RAD2DEG = 180.0 / M_PI;
inline bool isDoubleZero(const double x) {
  return ((x < 1.0e-10) && (x > -1.0e-10));
}
inline void clipToOne(double &x) {
  if (x > 1.0) {
    x = 1.0;
  } else if (x < -1.0) {
    x = -1.0;
  }
}

//! class to store UFF parameters for bond stretching
class RDKIT_FORCEFIELD_EXPORT UFFBond {
 public:
  double kb;
  double r0;
};

//! class to store UFF parameters for angle bending
class RDKIT_FORCEFIELD_EXPORT UFFAngle {
 public:
  double ka;
  double theta0;
};

//! class to store UFF parameters for torsions
class RDKIT_FORCEFIELD_EXPORT UFFTor {
 public:
  double V;
};

//! class to store UFF parameters for inversions
class RDKIT_FORCEFIELD_EXPORT UFFInv {
 public:
  double K;
};

//! class to store UFF parameters for van der Waals interactions
class RDKIT_FORCEFIELD_EXPORT UFFVdW {
 public:
  double x_ij;
  double D_ij;
};

//! class to store atomic parameters for the Universal Force Field
class RDKIT_FORCEFIELD_EXPORT AtomicParams {
 public:
  double r1;            //!<  valence bond radius
  double theta0;        //!< valence angle
  double x1;            //!< vdW characteristic length
  double D1;            //!< vdW atomic energy
  double zeta;          //!< vdW scaling term
  double Z1;            //!< effective charge
  double V1;            //!< sp3 torsional barrier parameter
  double U1;            //!< torsional contribution for sp2-sp3 bonds
  double GMP_Xi;        //!< GMP Electronegativity;
  double GMP_Hardness;  //!< GMP Hardness
  double GMP_Radius;    //!< GMP Radius value
};

namespace Params {
const double lambda = 0.1332;  //!< scaling factor for rBO correction
const double G = 332.06;       //!< bond force constant prefactor
const double amideBondOrder =
    1.41;  //!< special case bond order for amide C-N bonds.
};

//! singleton class for retrieving UFF AtomParams
/*!
  Use the singleton like this:

  \verbatim
  ParamCollection *params=ParamCollection::getParams();
  const AtomParams *ap=params("C_3");
  \endverbatim

  If you have your own parameter data, it can be supplied as a string:
  \verbatim
  ParamCollection *params=ParamCollection::getParams(myParamData);
  const AtomParams *ap=params("C_3");
  \endverbatim
  You are responsible for making sure that the data is in the correct
  format (see Params.cpp for an example).

*/
class RDKIT_FORCEFIELD_EXPORT ParamCollection {
 public:
  //! gets a pointer to the singleton ParamCollection
  /*!
    \param paramData (optional) a string with parameter data. See
     below for more information about this argument

    \return a pointer to the singleton ParamCollection

    <b>Notes:</b>
      - do <b>not</b> delete the pointer returned here
      - if the singleton ParamCollection has already been instantiated and
        \c paramData is empty, the singleton will be returned.
      - if \c paramData is empty and the singleton ParamCollection has
        not yet been instantiated, the default UFF parameters (from Params.cpp)
        will be used.
      - if \c paramData is supplied, a new singleton will be instantiated.
        The current instantiation (if there is one) will be deleted.
  */
  static ParamCollection *getParams(const std::string &paramData = "");
  //! Looks up the parameters for a particular UFF key and returns them.
  /*!
    \return a pointer to the AtomicParams object, NULL on failure.
  */
  const AtomicParams *operator()(const std::string &symbol) const {
    std::map<std::string, AtomicParams>::const_iterator res;
    res = d_params.find(symbol);
    if (res != d_params.end()) {
      return &((*res).second);
    }
    return 0;
  }

 private:
  //! to force this to be a singleton, the constructor must be private
  ParamCollection(std::string paramData);
  static class ParamCollection *ds_instance;     //!< the singleton
  std::map<std::string, AtomicParams> d_params;  //!< the parameter map
};
}
}
#endif