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