PBond.h

Go to the documentation of this file.
00001 /*
00002     LoopTK: Protein Loop Kinematic Toolkit
00003     Copyright (C) 2007 Stanford University
00004 
00005     This program is free software; you can redistribute it and/or modify
00006     it under the terms of the GNU General Public License as published by
00007     the Free Software Foundation; either version 2 of the License, or
00008     (at your option) any later version.
00009 
00010     This program is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013     GNU General Public License for more details.
00014 
00015     You should have received a copy of the GNU General Public License along
00016     with this program; if not, write to the Free Software Foundation, Inc.,
00017     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00018 */
00019 
00020 #ifndef __P_BOND_H
00021 #define __P_BOND_H
00022 
00023 #include "PEnums.h"
00024 
00031 class PBond {
00032  public:
00033   friend struct DOFCacher;
00034 
00038   PBond(PAtom *a1, PAtom *a2, bool isDOF) { 
00039     m_atom1 = a1; 
00040     m_atom2 = a2;
00041     m_isDOF = isDOF;
00042     m_forwardDirection = NULL;
00043     a1->m_bonds.push_back(this);
00044     a2->m_bonds.push_back(this);
00045  }
00046 
00047 
00051   Real getLength();
00052 
00058   void traverseChain(BondDirection dir, AtomFunctor *atomFn, BondFunctor *bondFn, PChain *rootChain);
00059 
00065   void traverseAtoms(BondDirection dir, AtomFunctor *atomFn, PChain *rootChain) {
00066     traverseChain(dir, atomFn, NULL, rootChain);
00067   }
00068 
00074   void traverseBonds(BondDirection dir, BondFunctor *bondFn, PChain *rootChain) {
00075     traverseChain(dir, NULL, bondFn, rootChain);
00076   }
00077 
00083   void Rotate(BondDirection dir, float degrees, PChain *chain);
00084 
00088   void Rotate(BondDirection dir, float degrees);
00089 
00093   PAtom *getAtom1() const { return m_atom1; }
00094 
00098   PAtom *getAtom2() const { return m_atom2; }
00099 
00104   PAtom *getAtom(BondDirection dir) const;
00105 
00110   bool isDOF() const { return m_isDOF; }
00111 
00112  private:
00113 
00114   /*
00115    * Sets the specified atom to be the
00116    * "forward" atom of this bond. (for DOFCacher)
00117    */
00118   void setDirection(PAtom *front) { m_forwardDirection = front; }
00119 
00120   PAtom *m_atom1;
00121   PAtom *m_atom2;
00122   PAtom *m_forwardDirection;
00123   bool m_isDOF;
00124 };
00125 
00126 #endif  // __P_BOND_H

Generated on Wed May 16 20:22:07 2007 for LoopTK: Protein Loop Kinematic Toolkit by  doxygen 1.5.1