RDKit
Open-source cheminformatics and machine learning.
MMFF/DistanceConstraint.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_MMFFDISTANCECONSTRAINT_H__
14 #define __RD_MMFFDISTANCECONSTRAINT_H__
15 #include <iostream>
16 #include <ForceField/Contrib.h>
17 
18 namespace ForceFields {
19 namespace MMFF {
20 
21 //! A distance range constraint modelled after a BondStretchContrib
23  public:
24  DistanceConstraintContrib() : d_end1Idx(-1), d_end2Idx(-1){};
25  //! Constructor
26  /*!
27  \param owner pointer to the owning ForceField
28  \param idx1 index of end1 in the ForceField's positions
29  \param idx2 index of end2 in the ForceField's positions
30  \param minLen minimum distance
31  \param maxLen maximum distance
32  \param forceConst force Constant
33 
34  */
35  DistanceConstraintContrib(ForceField *owner, unsigned int idx1,
36  unsigned int idx2, double minLen, double maxLen,
37  double forceConst);
38  DistanceConstraintContrib(ForceField *owner, unsigned int idx1,
39  unsigned int idx2, bool relative, double minLen,
40  double maxLen, double forceConst);
41 
43  // std::cerr << " ==== Destroy constraint " << d_end1Idx << " " << d_end2Idx
44  // << std::endl;
45  }
46  double getEnergy(double *pos) const;
47 
48  void getGrad(double *pos, double *grad) const;
49  virtual DistanceConstraintContrib *copy() const {
50  return new DistanceConstraintContrib(*this);
51  };
52 
53  private:
54  int d_end1Idx, d_end2Idx; //!< indices of end points
55  double d_minLen, d_maxLen; //!< rest length of the bond
56  double d_forceConstant; //!< force constant of the bond
57 };
58 }
59 }
60 #endif
abstract base class for contributions to ForceFields
Definition: Contrib.h:18
#define RDKIT_FORCEFIELD_EXPORT
Definition: export.h:242
virtual DistanceConstraintContrib * copy() const
return a copy
A class to store forcefields and handle minimization.
Definition: ForceField.h:58
A distance range constraint modelled after a BondStretchContrib.