RDKit
Open-source cheminformatics and machine learning.
MMFF/TorsionConstraint.h
Go to the documentation of this file.
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 #ifndef __RD_MMFFTORSIONCONSTRAINT_H__
13 #define __RD_MMFFTORSIONCONSTRAINT_H__
14 #include <iostream>
15 #include <ForceField/Contrib.h>
16 
17 namespace ForceFields {
18 namespace MMFF {
19 
20 //! A dihedral angle range constraint modelled after a TorsionContrib
22  public:
24  : d_at1Idx(-1), d_at2Idx(-1), d_at3Idx(-1), d_at4Idx(-1){};
25  //! Constructor
26  /*!
27  \param owner pointer to the owning ForceField
28  \param idx1 index of atom1 in the ForceField's positions
29  \param idx2 index of atom2 in the ForceField's positions
30  \param idx3 index of atom3 in the ForceField's positions
31  \param idx4 index of atom4 in the ForceField's positions
32  \param minDihedralDeg minimum dihedral angle
33  \param maxDihedralDeg maximum dihedral angle
34  \param forceConst force Constant
35 
36  */
37  TorsionConstraintContrib(ForceField *owner, unsigned int idx1,
38  unsigned int idx2, unsigned int idx3,
39  unsigned int idx4, double minDihedralDeg,
40  double maxDihedralDeg, double forceConst);
41  TorsionConstraintContrib(ForceField *owner, unsigned int idx1,
42  unsigned int idx2, unsigned int idx3,
43  unsigned int idx4, bool relative,
44  double minDihedralDeg, double maxDihedralDeg,
45  double forceConst);
46 
48  double getEnergy(double *pos) const;
49 
50  void getGrad(double *pos, double *grad) const;
51  virtual TorsionConstraintContrib *copy() const {
52  return new TorsionConstraintContrib(*this);
53  };
54 
55  private:
56  int d_at1Idx, d_at2Idx, d_at3Idx,
57  d_at4Idx; //!< indices of atoms forming the dihedral angle
58  double d_minDihedralDeg,
59  d_maxDihedralDeg; //!< rest amplitudes of the dihedral angle
60  double d_forceConstant; //!< force constant of the angle constraint
61 };
62 }
63 }
64 #endif
virtual TorsionConstraintContrib * copy() const
return a copy
A dihedral angle range constraint modelled after a TorsionContrib.
abstract base class for contributions to ForceFields
Definition: Contrib.h:17
void getGrad(double *pos, double *grad) const
calculates our contribution to the gradients of a position
A class to store forcefields and handle minimization.
Definition: ForceField.h:57
double getEnergy(double *pos) const
returns our contribution to the energy of a position