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
23 class RDKIT_FORCEFIELD_EXPORT PositionConstraintContrib
24     : public ForceFieldContrib {
25  public:
PositionConstraintContrib()26   PositionConstraintContrib()  {};
27   //! Constructor
28   /*!
29     \param owner       pointer to the owning ForceField
30     \param idx         index of the atom in the ForceField's positions
31     \param minDispl    minimum displacement
32     \param maxDispl    maximum displacement
33     \param forceConst  force constant
34 
35   */
36   PositionConstraintContrib(ForceField *owner, unsigned int idx,
37                             double maxDispl, double forceConst);
38 
~PositionConstraintContrib()39   ~PositionConstraintContrib() {}
40   double getEnergy(double *pos) const;
41 
42   void getGrad(double *pos, double *grad) const;
copy()43   virtual PositionConstraintContrib *copy() const {
44     return new PositionConstraintContrib(*this);
45   };
46 
47  private:
48   int d_atIdx{-1};             //!< index of the restrained atom
49   double d_maxDispl;       //!< maximum allowed displacement
50   RDGeom::Point3D d_pos0;  //!< reference position
51   double d_forceConstant;  //!< force constant of the bond
52 };
53 }  // namespace MMFF
54 }  // namespace ForceFields
55 #endif
56