1 // 2 // Copyright (C) 2013 Paolo Tosco 3 // 4 // Copyright (C) 2004-2006 Rational Discovery LLC 5 // 6 // @@ All Rights Reserved @@ 7 // This file is part of the RDKit. 8 // The contents are covered by the terms of the BSD license 9 // which is included in the file license.txt, found at the root 10 // of the RDKit source tree. 11 // 12 #include <RDGeneral/export.h> 13 #ifndef __RD_UFFTORSIONCONSTRAINT_H__ 14 #define __RD_UFFTORSIONCONSTRAINT_H__ 15 #include <iostream> 16 #include <ForceField/Contrib.h> 17 18 namespace ForceFields { 19 namespace UFF { 20 21 //! A dihedral angle range constraint modelled after a TorsionContrib 22 class RDKIT_FORCEFIELD_EXPORT TorsionConstraintContrib 23 : public ForceFieldContrib { 24 public: TorsionConstraintContrib()25 TorsionConstraintContrib(){}; 26 //! Constructor 27 /*! 28 \param owner pointer to the owning ForceField 29 \param idx1 index of atom1 in the ForceField's positions 30 \param idx2 index of atom2 in the ForceField's positions 31 \param idx3 index of atom3 in the ForceField's positions 32 \param idx4 index of atom4 in the ForceField's positions 33 \param minDihedralDeg minimum dihedral angle 34 \param maxDihedralDeg maximum dihedral angle 35 \param forceConst force Constant 36 37 */ 38 TorsionConstraintContrib(ForceField *owner, unsigned int idx1, 39 unsigned int idx2, unsigned int idx3, 40 unsigned int idx4, double minDihedralDeg, 41 double maxDihedralDeg, double forceConst); 42 TorsionConstraintContrib(ForceField *owner, unsigned int idx1, 43 unsigned int idx2, unsigned int idx3, 44 unsigned int idx4, bool relative, 45 double minDihedralDeg, double maxDihedralDeg, 46 double forceConst); 47 ~TorsionConstraintContrib()48 ~TorsionConstraintContrib() {} 49 double getEnergy(double *pos) const; 50 51 void getGrad(double *pos, double *grad) const; copy()52 virtual TorsionConstraintContrib *copy() const { 53 return new TorsionConstraintContrib(*this); 54 }; 55 56 private: 57 void setParameters(ForceField *owner, unsigned int idx1, unsigned int idx2, 58 unsigned int idx3, unsigned int idx4, 59 double minDihedralDeg, double maxDihedralDeg, 60 double forceConst); 61 double computeDihedralTerm(double dihedral) const; 62 int d_at1Idx{-1}, d_at2Idx{-1}, d_at3Idx{-1}, 63 d_at4Idx{-1}; //!< indices of atoms forming the dihedral angle 64 double d_minDihedralDeg, 65 d_maxDihedralDeg; //!< rest amplitudes of the dihedral angle 66 double d_forceConstant; //!< force constant of the angle constraint 67 }; 68 } // namespace UFF 69 } // namespace ForceFields 70 #endif 71