BondStretch.h

Go to the documentation of this file.
00001 //
00002 //  Copyright (C) 2004-2006 Rational Discovery LLC
00003 //
00004 //   @@ All Rights Reserved @@
00005 //  This file is part of the RDKit.
00006 //  The contents are covered by the terms of the BSD license
00007 //  which is included in the file license.txt, found at the root
00008 //  of the RDKit source tree.
00009 //
00010 #ifndef __RD_BONDSTRETCH_H__
00011 #define __RD_BONDSTRETCH_H__
00012 #include <ForceField/Contrib.h>
00013 
00014 namespace ForceFields {
00015   namespace UFF {
00016     class AtomicParams;
00017 
00018     //! The bond-stretch term for the Universal Force Field
00019     class BondStretchContrib : public ForceFieldContrib {
00020     public:
00021       BondStretchContrib() : d_end1Idx(-1), d_end2Idx(-1) {};
00022       //! Constructor
00023       /*!
00024         \param owner       pointer to the owning ForceField
00025         \param idx1        index of end1 in the ForceField's positions
00026         \param idx2        index of end2 in the ForceField's positions
00027         \param bondOrder   order of the bond (as a double)
00028         \param end1Params  pointer to the parameters for end1
00029         \param end2Params  pointer to the parameters for end2
00030         
00031       */
00032       BondStretchContrib(ForceField *owner,unsigned int idx1,unsigned int idx2,
00033                          double bondOrder,
00034                          const AtomicParams *end1Params,
00035                          const AtomicParams *end2Params);
00036 
00037       double getEnergy(double *pos) const;
00038 
00039       void getGrad(double *pos,double *grad) const;
00040     
00041     private:
00042       int d_end1Idx,d_end2Idx; //!< indices of end points
00043       double d_restLen;        //!< rest length of the bond
00044       double d_forceConstant;  //!< force constant of the bond
00045 
00046     };
00047   
00048     namespace Utils {
00049       //! calculates and returns the UFF rest length for a bond 
00050       /*!
00051 
00052         \param bondOrder the order of the bond (as a double)
00053         \param end1Params  pointer to the parameters for end1
00054         \param end2Params  pointer to the parameters for end2
00055 
00056         \return the rest length
00057 
00058       */
00059       double calcBondRestLength(double bondOrder,
00060                                 const AtomicParams *end1Params,
00061                                 const AtomicParams *end2Params);
00062 
00063       //! calculates and returns the UFF force constant for a bond 
00064       /*!
00065 
00066         \param restLength  the rest length of the bond
00067         \param end1Params  pointer to the parameters for end1
00068         \param end2Params  pointer to the parameters for end2
00069 
00070         \return the force constant
00071         
00072       */
00073       double calcBondForceConstant(double restLength,
00074                                    const AtomicParams *end1Params,
00075                                    const AtomicParams *end2Params);
00076 
00077     }  
00078   }
00079 }
00080 #endif