DistViolationContrib.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_DISTVIOLATIONCONTRIB_H__
00007 #define __RD_DISTVIOLATIONCONTRIB_H__
00008 
00009 #include <ForceField/Contrib.h>
00010 
00011 namespace DistGeom {
00012   //! A term to capture the violation of the upper and lower bounds by 
00013   //! distance between two points
00014   class DistViolationContrib : public ForceFields::ForceFieldContrib {
00015   public:
00016     DistViolationContrib() : d_end1Idx(0), d_end2Idx(0), d_ub(1000.0), d_lb(0.0), d_weight(1.0) {};
00017 
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 ub          Upper bound on the distance
00024       \param lb          Lower bound on the distance
00025       \param weight      optional weight for this contribution
00026     */
00027     DistViolationContrib(ForceFields::ForceField *owner,unsigned int idx1,unsigned int idx2,
00028                          double ub, double lb, double weight=1.0);
00029 
00030     double getEnergy(double *pos) const;
00031     
00032     void getGrad(double *pos, double *grad) const;
00033 
00034   private:
00035     unsigned int d_end1Idx,d_end2Idx; //!< indices of end points
00036     double d_ub; //!< upper bound on the distance between d_end1Idx,d_end2Idx
00037     double d_lb; //!< lower bound on the distance between d_end1Idx,d_end2Idx
00038     double d_weight; //!< used to adjust relative contribution weights
00039   };
00040 }
00041 
00042 #endif

Generated on Tue Oct 7 06:10:10 2008 for RDCode by  doxygen 1.5.5