Molmodel
|
Abstract base class for custom torsion functions, that is, functional forms that apply a dihedral-angle based torque about the middle bond of a 1-2-3-4 quadruple of bonded atoms. More...
#include <DuMMForceFieldSubsystem.h>
Public Member Functions | |
virtual | ~CustomBondTorsion () |
virtual Real | calcEnergy (Real dihedralAngle) const =0 |
virtual Real | calcTorque (Real dihedralAngle) const =0 |
Abstract base class for custom torsion functions, that is, functional forms that apply a dihedral-angle based torque about the middle bond of a 1-2-3-4 quadruple of bonded atoms.
AmberTorsion example
This demonstrates how the built-in Amber force might be applied as a custom torsion. This is a toy example because this particular form is already built into DuMMForceFieldSubsystem.
class AmberTorsion : public DuMM::CustomBondTorsion { public: AmberTorsion(Real amplitudeInKJ, Real phaseInRad, int periodicity) : amplitude(amplitudeInKJ), phase(phaseInRad), periodicity(periodicity) {} Real calcEnergy(Real dihedralAngleInRad) { return amplitude * ( 1 + std::cos(periodicity * dihedralAngleInRad - phase) ); } // Note: this is MINUS the gradient of the energy function! Real calcTorque(Real dihedralAngleInRad) { return periodicity * amplitude * std::sin(periodicity * dihedralAngleInRad - phase); } private: Real amplitude; // in KJ/mol Real phase; // in radians int periodicity; }; #include "SimTKmolmodel.h" int main() { DuMMForceFieldSubsystem dumm; dumm.loadAmber99Parameters(); // torsion for aliphatic H-C-C-H torsions like those in ethane dumm.defineCustomTorsion( dumm.getAtomClassIndex("HC"), dumm.getAtomClassIndex("CT"), dumm.getAtomClassIndex("CT"), dumm.getAtomClassIndex("HC"), new AmberTorsion(0.150*DuMM::Kcal2KJ, 0*DuMM::Deg2Rad, 3)); ... }
virtual SimTK::DuMM::CustomBondTorsion::~CustomBondTorsion | ( | ) | [inline, virtual] |