RDKit
Open-source cheminformatics and machine learning.
UFF/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 #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
23  public:
25  : d_at1Idx(-1), d_at2Idx(-1), d_at3Idx(-1), d_at4Idx(-1){};
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 
49  double getEnergy(double *pos) const;
50 
51  void getGrad(double *pos, double *grad) const;
52  virtual TorsionConstraintContrib *copy() const {
53  return new TorsionConstraintContrib(*this);
54  };
55 
56  private:
57  int d_at1Idx, d_at2Idx, d_at3Idx,
58  d_at4Idx; //!< indices of atoms forming the dihedral angle
59  double d_minDihedralDeg,
60  d_maxDihedralDeg; //!< rest amplitudes of the dihedral angle
61  double d_forceConstant; //!< force constant of the angle constraint
62 };
63 }
64 }
65 #endif
abstract base class for contributions to ForceFields
Definition: Contrib.h:18
virtual TorsionConstraintContrib * copy() const
return a copy
A dihedral angle range constraint modelled after a TorsionContrib.
#define RDKIT_FORCEFIELD_EXPORT
Definition: export.h:242
A class to store forcefields and handle minimization.
Definition: ForceField.h:58