RDKit
Open-source cheminformatics and machine learning.
DistViolationContrib.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2004-2006 Rational Discovery LLC
3 //
4 // @@ All Rights Reserved @@
5 // This file is part of the RDKit.
6 // The contents are covered by the terms of the BSD license
7 // which is included in the file license.txt, found at the root
8 // of the RDKit source tree.
9 //
10 #ifndef __RD_DISTVIOLATIONCONTRIB_H__
11 #define __RD_DISTVIOLATIONCONTRIB_H__
12 
13 #include <ForceField/Contrib.h>
14 
15 namespace DistGeom {
16 //! A term to capture the violation of the upper and lower bounds by
17 //! distance between two points
19  public:
21  : d_end1Idx(0), d_end2Idx(0), d_ub(1000.0), d_lb(0.0), d_weight(1.0){};
22 
23  //! Constructor
24  /*!
25  \param owner pointer to the owning ForceField
26  \param idx1 index of end1 in the ForceField's positions
27  \param idx2 index of end2 in the ForceField's positions
28  \param ub Upper bound on the distance
29  \param lb Lower bound on the distance
30  \param weight optional weight for this contribution
31  */
32  DistViolationContrib(ForceFields::ForceField *owner, unsigned int idx1,
33  unsigned int idx2, double ub, double lb,
34  double weight = 1.0);
35 
36  double getEnergy(double *pos) const;
37 
38  void getGrad(double *pos, double *grad) const;
39  virtual DistViolationContrib *copy() const {
40  return new DistViolationContrib(*this);
41  };
42 
43  private:
44  unsigned int d_end1Idx, d_end2Idx; //!< indices of end points
45  double d_ub; //!< upper bound on the distance between d_end1Idx,d_end2Idx
46  double d_lb; //!< lower bound on the distance between d_end1Idx,d_end2Idx
47  double d_weight; //!< used to adjust relative contribution weights
48 };
49 }
50 
51 #endif
virtual DistViolationContrib * copy() const
return a copy
abstract base class for contributions to ForceFields
Definition: Contrib.h:17
double getEnergy(double *pos) const
returns our contribution to the energy of a position
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