RDKit: DistanceConstraint.h Source File

| RDKit Open-source cheminformatics and machine learning.

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

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