RDKit
Open-source cheminformatics and machine learning.
MMFF/PositionConstraint.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_MMFFPOSITIONCONSTRAINT_H__
13 #define __RD_MMFFPOSITIONCONSTRAINT_H__
14 #include <iostream>
15 #include <ForceField/Contrib.h>
16 #include <Geometry/point.h>
17 
18 namespace ForceFields {
19 namespace MMFF {
20 
21 //! A position constraint of the type 0.5k * deltaX^2
23  public:
24  PositionConstraintContrib() : d_atIdx(-1){};
25  //! Constructor
26  /*!
27  \param owner pointer to the owning ForceField
28  \param idx index of the atom in the ForceField's positions
29  \param minDispl minimum displacement
30  \param maxDispl maximum displacement
31  \param forceConst force constant
32 
33  */
34  PositionConstraintContrib(ForceField *owner, unsigned int idx,
35  double maxDispl, double forceConst);
36 
38  double getEnergy(double *pos) const;
39 
40  void getGrad(double *pos, double *grad) const;
41  virtual PositionConstraintContrib *copy() const {
42  return new PositionConstraintContrib(*this);
43  };
44 
45  private:
46  int d_atIdx; //!< index of the restrained atom
47  double d_maxDispl; //!< maximum allowed displacement
48  RDGeom::Point3D d_pos0; //!< reference position
49  double d_forceConstant; //!< force constant of the bond
50 };
51 }
52 }
53 #endif
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
virtual PositionConstraintContrib * copy() const
return a copy
double getEnergy(double *pos) const
returns our contribution to the energy of a position
A position constraint of the type 0.5k * deltaX^2.
A class to store forcefields and handle minimization.
Definition: ForceField.h:57