BALL  1.4.1
charmmTorsion.h
Go to the documentation of this file.
00001 // -*- Mode: C++; tab-width: 2; -*-
00002 // vi: set ts=2:
00003 //
00004 
00005 // Molecular Mechanics: CHARMM force field, proper torsion component
00006 
00007 #ifndef BALL_MOLMEC_CHARMM_CHARMMTORSION_H
00008 #define BALL_MOLMEC_CHARMM_CHARMMTORSION_H
00009 
00010 #ifndef BALL_COMMON_H
00011 # include <BALL/common.h>
00012 #endif
00013 
00014 #ifndef BALL_MOLMEC_PARAMETER_COSINETORSION_H
00015 # include <BALL/MOLMEC/PARAMETER/cosineTorsion.h>
00016 #endif
00017 
00018 #ifndef BALL_MOLMEC_PARAMETER_RESIDUETORSIONS_H
00019 # include <BALL/MOLMEC/PARAMETER/residueTorsions.h>
00020 #endif
00021 
00022 #ifndef BALL_MOLMEC_COMMON_FORCEFIELDCOMPONENT_H
00023 # include <BALL/MOLMEC/COMMON/forceFieldComponent.h>
00024 #endif
00025 
00026 #ifndef BALL_MOLMEC_COMMON_FORCEFIELD_H
00027 # include <BALL/MOLMEC/COMMON/forceField.h>
00028 #endif
00029 
00030 namespace BALL 
00031 {
00036   class BALL_EXPORT CharmmTorsion 
00037     : public ForceFieldComponent
00038   {
00039     public:
00040 
00042     #define CHARMM_TORSIONS_ENABLED "enable Torsions"
00043 
00047 
00048     struct SingleCharmmTorsion 
00049     {
00050       Atom* atom1;
00051       Atom* atom2;
00052       Atom* atom3;
00053       Atom* atom4;
00054 
00055       float   V;
00056       unsigned char f;
00057       float   phase;
00058 
00059       SingleCharmmTorsion()
00060         : atom1(0),
00061           atom2(0),
00062           atom3(0),
00063           atom4(0),
00064           V(0),
00065           f(0),
00066           phase(0)
00067       {
00068       }
00069 
00070       SingleCharmmTorsion(CosineTorsion::SingleData& t)
00071       {
00072         atom1 = t.atom1;
00073         atom2 = t.atom2;
00074         atom3 = t.atom3;
00075         atom4 = t.atom4;
00076 
00077         V = t.values.V / t.values.n;
00078         f = (unsigned char)t.values.f;
00079 
00080         // convert phase from degrees to radiant
00081         phase = (float)(BALL::Constants::PI / 180.0) * t.values.phase;
00082       }
00083     };
00084 
00086 
00089 
00090     BALL_CREATE(CharmmTorsion)
00091 
00092     
00094     CharmmTorsion();
00095 
00098     CharmmTorsion(ForceField& force_field);
00099 
00102     CharmmTorsion(const CharmmTorsion& charmm_stretch);
00103 
00106     virtual ~CharmmTorsion();
00107 
00109 
00112 
00115     virtual bool setup()
00116       throw(Exception::TooManyErrors);
00117 
00119 
00122 
00125     virtual double updateEnergy();
00126 
00129     virtual void updateForces();
00130 
00132 
00133     private:
00134 
00135     /*_ @name Private Attributes  
00136     */
00137     //_@{
00138 
00139     /*_ Vector containing the parameters for each torsion.
00140     */
00141     vector<SingleCharmmTorsion>   torsion_;
00142 
00143     /*_ Contents of the [Torsions] section of the parameter file.
00144     */
00145     CosineTorsion                 torsion_parameters_;    
00146 
00147     /*_ Contents of the [ResidueTorsions] section of the parameter file.
00148     */
00149     ResidueTorsions               residue_torsions_;
00150 
00151     /*_ true, if the torsions are read from the ResidueTorsions section.
00152     */
00153     bool use_residue_torsion_list_;
00154 
00155     //_@}
00156    
00157   };
00158 } // namespace BALL 
00159 
00160 #endif // BALL_MOLMEC_CHARMM_CHARMMTORSION_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines