MMFF94StretchBend.h

Go to the documentation of this file.
00001 // -*- Mode: C++; tab-width: 2; -*-
00002 // vi: set ts=2:
00003 //
00004 // $Id: MMFF94StretchBend.h,v 1.1.8.1 2007/03/25 21:25:18 oliver Exp $
00005 //
00006 
00007 #ifndef BALL_MOLMEC_MMFF94_MMFF94STRETCHBEND_H
00008 #define BALL_MOLMEC_MMFF94_MMFF94STRETCHBEND_H
00009 
00010 #ifndef BALL_MOLMEC_COMMON_FORCEFIELDCOMPONENT_H
00011 # include <BALL/MOLMEC/COMMON/forceFieldComponent.h>
00012 #endif
00013 
00014 #ifndef BALL_MOLMEC_MMFF94_MMFF94PARAMETERS_H
00015 # include <BALL/MOLMEC/MMFF94/MMFF94Parameters.h>
00016 #endif
00017 
00018 namespace BALL 
00019 {
00020   class MMFF94;
00021 
00025   class BALL_EXPORT MMFF94StretchBend 
00026     : public ForceFieldComponent
00027   {
00028     public:
00029 
00030     struct BALL_EXPORT StretchBend
00031     {
00032       double kba_ijk;
00033       double kba_kji;
00034       double energy; // debug
00035       Index sbtijk; 
00036       Index stretch_i_j, stretch_j_k;
00037       Index bend_index;
00038     };
00039 
00041     struct BALL_EXPORT Bend
00042     {
00043       Bend();
00044 
00045       double theta0;
00046       double delta_theta;
00047       double theta;
00048       double ka;
00049       Atom* atom1;
00050       Atom* atom2;
00051       Atom* atom3;
00052       bool is_linear;
00053       Position ATIJK;
00054       double energy;  // debug
00055       bool emperical; // debug
00056       TVector3<double> n1, n2;
00057     };
00058     
00060     struct BALL_EXPORT Stretch
00061     {
00062       Atom* atom1;
00063       Atom* atom2;
00064       double kb;
00065       double r0;
00066       double delta_r;
00067       bool  sbmb; 
00068       bool  emperical;
00069       Vector3 n;
00070     };
00071 
00073     #define MMFF94_BENDS_ENABLED "enable Bends"
00074     
00076     #define MMFF94_STRETCHES_ENABLED "enable Stretches"
00077 
00079     #define MMFF94_STRETCHBENDS_ENABLED "enable StrechBends"
00080 
00081     BALL_CREATE(MMFF94StretchBend)
00082 
00083     
00085     MMFF94StretchBend();
00086 
00089     MMFF94StretchBend(ForceField& force_field);
00090 
00093     MMFF94StretchBend(const MMFF94StretchBend& to_copy);
00094 
00097     virtual ~MMFF94StretchBend();
00098 
00101     virtual bool setup()
00102       throw(Exception::TooManyErrors);
00103 
00105     virtual double updateEnergy();
00106 
00108     virtual double updateBendEnergy();
00109     
00111     virtual double updateStretchEnergy();
00112 
00114     virtual double updateStretchBendEnergy();
00115 
00117     double getStretchEnergy() const;
00118 
00120     double getBendEnergy() const;
00121 
00123     double getStretchBendEnergy() const;
00124 
00126     virtual void updateForces();
00127 
00129     virtual void updateBendForces();
00130 
00132     virtual void updateStretchForces();
00133 
00135     virtual void updateStretchBendForces();
00136 
00138     const vector<Bend>& getBends() const { return bends_;}
00139     
00141     const vector<Stretch>& getStretches() const { return stretches_;}
00142 
00144     const vector<StretchBend>& getStretchBends() const { return stretch_bends_;}
00145     
00147     Index calculateSBTIJK(Position angle_type, 
00148                           bool bond_type1,
00149                           bool bond_type2);
00150     
00152     Position getBendType(const Bond& bond1, const Bond& bond2,
00153                          Atom& atom1, Atom& atom2, Atom& atom3) const;
00154     
00156     double calculateBendEmpiricalReferenceAngle(Atom& atom1, Atom& atom2, Atom& atom3) const;
00157     
00159     double calculateBendEmpiricalForceConstant(Atom& atom1, Atom& atom2, Atom& atom3, double angle_0) const;
00160 
00162     double calculateStretchR0(const Bond& bond);
00163 
00165     double calculateStretchConstant(const Bond& bond, double r0);
00166 
00167     private:
00168 
00169     inline void AddDV3_(Vector3& f3, const TVector3<double> d3);
00170     void calculateDeltas_();
00171     bool setupBends_();
00172     bool setupStretches_();
00173     bool setupStretchBends_();
00174     
00175     void errorOccured_(const String& string, 
00176                        const Atom& a1, const Atom& a2, const Atom& a3);
00177 
00178     vector<Bend> bends_;
00179     vector<Stretch> stretches_;
00180     vector<StretchBend> stretch_bends_;
00181 
00182     const MMFF94StretchParameters* stretch_parameters_;
00183     MMFF94BendParameters bend_parameters_;
00184     MMFF94StretchBendParameters sb_parameters_;
00185 
00186     static double bend_z_[];
00187     static double bend_c_[];
00188     static String bend_elements_[];
00189 
00190     double stretch_energy_;
00191     double bend_energy_;
00192     double stretch_bend_energy_;
00193 
00194     MMFF94* mmff94_;
00195     bool stretch_enabled_, bend_enabled_, stretchbend_enabled_;
00196   };
00197 } // namespace BALL
00198 
00199 #endif // BALL_MOLMEC_MMFF94_MMFF94STRETCHBEND_H