46#include "forceFields/UFF.hpp"
51 RealType fastPower(RealType x,
int y) {
55 temp = fastPower(x, y/2);
66 RealType calcBondRestLength(RealType bondOrder,
const AtomType *at1,
67 const AtomType *at2) {
68 assert(bondOrder > 0);
72 UFFAdapter uff1 = UFFAdapter(at1);
73 UFFAdapter uff2 = UFFAdapter(at2);
75 RealType ri = uff1->getR1();
76 RealType rj = uff2->getR1();
80 RealType rBO = -Params::lambda * (ri + rj) * log(bondOrder);
83 RealType Xi = uff1->getXi();
84 RealType Xj = uff2->getXi();
85 RealType rEN = ri * rj * (sqrt(Xi) - sqrt(Xj)) * (sqrt(Xi) - sqrt(Xj)) /
89 RealType r0 = ri + rj + rBO - rEN;
93 RealType calcBondForceConstant(RealType restLength,
const AtomType *at1,
94 const AtomType *at2) {
95 UFFAdapter uff1 = UFFAdapter(at1);
96 UFFAdapter uff2 = UFFAdapter(at2);
98 RealType kb = 2.0 * Params::G * uff1->getZ1() * uff2->getZ1() /
99 (restLength * restLength * restLength);
103 RealType calcAngleForceConstant(RealType theta0, RealType bondOrder12,
104 RealType bondOrder23,
const AtomType *at1,
106 const AtomType *at3) {
107 UFFAdapter uff1 = UFFAdapter(at1);
108 UFFAdapter uff2 = UFFAdapter(at2);
109 UFFAdapter uff3 = UFFAdapter(at3);
111 RealType cosTheta0 = cos(theta0);
112 RealType r12 = calcBondRestLength(bondOrder12, at1, at2);
113 RealType r23 = calcBondRestLength(bondOrder23, at2, at3);
114 RealType r13 = sqrt(r12 * r12 + r23 * r23 - 2. * r12 * r23 * cosTheta0);
115 RealType beta = 2. * Params::G / (r12 * r23);
117 RealType preFactor = beta * uff1->getZ1() * uff3->getZ1() /
119 RealType rTerm = r12 * r23;
121 3. * rTerm * (1. - cosTheta0 * cosTheta0) - r13 * r13 * cosTheta0;
122 RealType res = preFactor * rTerm * innerBit;
126 void calcTorsionParams(RealType bondOrder23,
int atNum2,
128 RDKit::Atom::HybridizationType hyb2,
129 RDKit::Atom::HybridizationType hyb3,
133 assert((hyb2 == RDKit::Atom::SP2 || hyb2 == RDKit::Atom::SP3) &&
134 (hyb3 == RDKit::Atom::SP2 || hyb3 == RDKit::Atom::SP3));
136 UFFAdapter uff2 = UFFAdapter(at2);
137 UFFAdapter uff3 = UFFAdapter(at3);
140 if (hyb2 == RDKit::Atom::SP3 && hyb3 == RDKit::Atom::SP3) {
142 d_forceConstant = sqrt(uff2->getV1() * uff3->getV1());
147 if (bondOrder23 == 1.0 && isInGroup6(atNum2) &&
148 isInGroup6(atNum3)) {
149 RealType V2 = 6.8, V3 = 6.8;
156 d_forceConstant = sqrt(V2 * V3);
160 }
else if (hyb2 == RDKit::Atom::SP2 && hyb3 == RDKit::Atom::SP2) {
161 d_forceConstant = equation17(bondOrder23, at2, at3);
167 d_forceConstant = 1.0;
170 if (bondOrder23 == 1.0) {
172 if ((hyb2 == RDKit::Atom::SP3 && isInGroup6(atNum2) &&
173 !isInGroup6(atNum3)) ||
174 (hyb3 == RDKit::Atom::SP3 && isInGroup6(atNum3) &&
175 !isInGroup6(atNum2))) {
176 d_forceConstant = equation17(bondOrder23, at2, at3);
183 else if (endAtomIsSP2) {
184 d_forceConstant = 2.0;
192 bool isInGroup6(
int num) {
193 return (num == 8 || num == 16 || num == 34 || num == 52 || num == 84);
197 RealType equation17(RealType bondOrder23,
const AtomType *at2,
198 const AtomType *at3) {
199 UFFAdapter uff2 = UFFAdapter(at2);
200 UFFAdapter uff3 = UFFAdapter(at3);
202 return 5. * sqrt(uff2->getU1() * uff3->getU1()) *
203 (1. + 4.18 * log(bondOrder23));
206 RealType calculateCosY(
const Vector3d &iPoint,
207 const Vector3d &jPoint,
208 const Vector3d &kPoint,
209 const Vector3d &lPoint) {
210 Vector3d rJI = iPoint - jPoint;
211 Vector3d rJK = kPoint - jPoint;
212 Vector3d rJL = lPoint - jPoint;
217 Vector3d n = rJI.crossProduct(rJK);
220 return n.dotProduct(rJL);
223 calcInversionCoefficientsAndForceConstant(
int at2AtomicNum,
230 if ((at2AtomicNum == 6) || (at2AtomicNum == 7) || (at2AtomicNum == 8)) {
234 res = (isCBoundToO ? 50.0 : 6.0);
238 RealType w0 = M_PI / 180.0;
239 switch (at2AtomicNum) {
262 C0 = -(C1 * cos(w0) + C2 * cos(2.0 * w0));
263 res = 22.0 / (C0 + C1 + C2);
267 return boost::make_tuple(res, C0, C1, C2);
270 RealType calcNonbondedMinimum(
const AtomType *at1,
271 const AtomType *at2) {
272 UFFAdapter uff1 = UFFAdapter(at1);
273 UFFAdapter uff2 = UFFAdapter(at2);
275 return sqrt(uff1->getX1() * uff2->getX1());
278 RealType calcNonbondedDepth(
const AtomType *at1,
279 const AtomType *at2) {
280 UFFAdapter uff1 = UFFAdapter(at1);
281 UFFAdapter uff2 = UFFAdapter(at2);
283 return sqrt(uff1->getD1() * uff2->getD1());
Real length()
Returns the length of this vector.
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.