AngleBend.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_ANGLEBEND_H__
00011 #define __RD_ANGLEBEND_H__
00012 
00013 #include <ForceField/Contrib.h>
00014 
00015 namespace ForceFields {
00016   namespace UFF {
00017     class AtomicParams;
00018 
00019 
00020     //! The angle-bend term for the Universal Force Field
00021     class AngleBendContrib : public ForceFieldContrib {
00022     public:
00023       AngleBendContrib() : d_at1Idx(-1), d_at2Idx(-1), d_at3Idx(-1),d_order(0) {};
00024       //! Constructor
00025       /*!
00026         The angle is between atom1 - atom2 - atom3
00027         
00028         \param owner       pointer to the owning ForceField
00029         \param idx1        index of atom1 in the ForceField's positions
00030         \param idx2        index of atom2 in the ForceField's positions
00031         \param idx3        index of atom3 in the ForceField's positions
00032         \param bondOrder12 order of the bond between atoms 1 and 2 (as a double)
00033         \param bondOrder23 order of the bond between atoms 2 and 3 (as a double)
00034         \param at1Params   pointer to the parameters for atom 1
00035         \param at2Params   pointer to the parameters for atom 2
00036         \param at3Params   pointer to the parameters for atom 3
00037         \param order (optional) the order of the angle term, this is for
00038            special cases and should adopt values:
00039              - 0: not a special case, use the \c theta0 value from \c at2Params
00040              - 2: linear coordination
00041              - 3: trigonal planar coordination
00042              - 4: square planar or tetrahedral coordination
00043         
00044       */
00045       AngleBendContrib(ForceField *owner,
00046                        unsigned int idx1,unsigned int idx2,unsigned int idx3,
00047                        double bondOrder12,double bondOrder23,
00048                        const AtomicParams *at1Params,
00049                        const AtomicParams *at2Params,
00050                        const AtomicParams *at3Params,
00051                        unsigned int order=0);
00052       double getEnergy(double *pos) const;
00053       void getGrad(double *pos,double *grad) const;
00054     
00055     private:
00056       int d_at1Idx,d_at2Idx,d_at3Idx;
00057       unsigned int d_order;
00058       double d_forceConstant,d_theta0,d_C0,d_C1,d_C2;
00059 
00060       double getEnergyTerm(double cosTheta,double sinThetaSq) const;
00061       double getThetaDeriv(double cosTheta,double sinTheta) const;
00062     };
00063   
00064     namespace Utils {
00065       //! Calculate the force constant for an angle bend
00066       /*!
00067         The angle is between atom1 - atom2 - atom3
00068         
00069         \param theta0      the preferred value of the angle (in radians)
00070         \param bondOrder12 order of the bond between atoms 1 and 2 (as a double)
00071         \param bondOrder23 order of the bond between atoms 2 and 3 (as a double)
00072         \param at1Params   pointer to the parameters for atom 1
00073         \param at2Params   pointer to the parameters for atom 2
00074         \param at3Params   pointer to the parameters for atom 3
00075         
00076       */
00077       double calcAngleForceConstant(double theta0,
00078                                     double bondOrder12,double bondOrder23,
00079                                     const AtomicParams *at1Params,
00080                                     const AtomicParams *at2Params,
00081                                     const AtomicParams *at3Params);
00082     }  
00083   }
00084 }
00085 #endif