chemkit::Float OplsAngleBendCalculation::energy() const { const chemkit::ForceFieldAtom *a = atom(0); const chemkit::ForceFieldAtom *b = atom(1); const chemkit::ForceFieldAtom *c = atom(2); chemkit::Float ka = parameter(0); chemkit::Float theta0 = parameter(1); chemkit::Float theta = bondAngleRadians(a, b, c); return ka * pow(theta - theta0, 2); }
chemkit::Real UffAngleBendCalculation::energy() const { const chemkit::ForceFieldAtom *a = atom(0); const chemkit::ForceFieldAtom *b = atom(1); const chemkit::ForceFieldAtom *c = atom(2); chemkit::Real ka = parameter(0); chemkit::Real c0 = parameter(1); chemkit::Real c1 = parameter(2); chemkit::Real c2 = parameter(3); chemkit::Real theta = bondAngleRadians(a, b, c); return ka * (c0 + (c1 * cos(theta)) + (c2 * cos(2*theta))); }
std::vector<chemkit::Vector3> OplsAngleBendCalculation::gradient() const { const chemkit::ForceFieldAtom *a = atom(0); const chemkit::ForceFieldAtom *b = atom(1); const chemkit::ForceFieldAtom *c = atom(2); chemkit::Float ka = parameter(0); chemkit::Float theta0 = parameter(1); chemkit::Float theta = bondAngleRadians(a, b, c); std::vector<chemkit::Vector3> gradient = bondAngleGradientRadians(a, b, c); // dE/dtheta chemkit::Float de_dtheta = (2.0 * ka * (theta - theta0)); gradient[0] *= de_dtheta; gradient[1] *= de_dtheta; gradient[2] *= de_dtheta; return gradient; }
std::vector<chemkit::Vector3> UffAngleBendCalculation::gradient() const { const chemkit::ForceFieldAtom *a = atom(0); const chemkit::ForceFieldAtom *b = atom(1); const chemkit::ForceFieldAtom *c = atom(2); chemkit::Real ka = parameter(0); chemkit::Real c1 = parameter(2); chemkit::Real c2 = parameter(3); chemkit::Real theta = bondAngleRadians(a, b, c); // dE/dtheta chemkit::Real de_dtheta = -ka * (c1 * sin(theta) + 2 * c2 * sin(2 * theta)); std::vector<chemkit::Vector3> gradient = bondAngleGradientRadians(a, b, c); gradient[0] *= de_dtheta; gradient[1] *= de_dtheta; gradient[2] *= de_dtheta; return gradient; }