DistanceConstraint.h

Go to the documentation of this file.
00001 //
00002 //  Copyright (C) 2004-2006 Rational Discovery LLC
00003 //
00004 //   @@ All Rights Reserved  @@
00005 //
00006 #ifndef __RD_DISTANCECONSTRAINT_H__
00007 #define __RD_DISTANCECONSTRAINT_H__
00008 #include <iostream>
00009 #include <ForceField/Contrib.h>
00010 
00011 namespace ForceFields {
00012   namespace UFF {
00013 
00014     //! A distance range constraint modelled after a BondStretchContrib
00015     class DistanceConstraintContrib : public ForceFieldContrib {
00016     public:
00017       DistanceConstraintContrib() : d_end1Idx(-1), d_end2Idx(-1) {};
00018       //! Constructor
00019       /*!
00020         \param owner       pointer to the owning ForceField
00021         \param idx1        index of end1 in the ForceField's positions
00022         \param idx2        index of end2 in the ForceField's positions
00023         \param minLen      minimum distance
00024         \param maxLen      maximum distance
00025         \param forceConst  force Constant
00026         
00027       */
00028       DistanceConstraintContrib(ForceField *owner,unsigned int idx1,unsigned int idx2,
00029                                 double minLen,double maxLen,double forceConst);
00030 
00031       ~DistanceConstraintContrib() {
00032         //std::cerr << " ==== Destroy constraint " << d_end1Idx << " " << d_end2Idx << std::endl;
00033       }
00034       double getEnergy(double *pos) const;
00035 
00036       void getGrad(double *pos,double *grad) const;
00037     private:
00038       int d_end1Idx,d_end2Idx; //!< indices of end points
00039       double d_minLen,d_maxLen;        //!< rest length of the bond
00040       double d_forceConstant;  //!< force constant of the bond
00041 
00042     };
00043   }
00044 }
00045 #endif

Generated on Sat May 24 08:36:32 2008 for RDCode by  doxygen 1.5.3