00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __P_RESIDUE_H
00021 #define __P_RESIDUE_H
00022
00023 #include "PEnums.h"
00024 #include "PResidueShell.h"
00025 #include "PResidueSpec.h"
00026
00034 class PResidue {
00035 public:
00036 friend class PChain;
00037 friend struct DOFCacher;
00038
00048 PResidue(PChain *loop, const string &shellName);
00049
00059 PResidue(PChain *loop, const string &shellName, PResidueSpec &spec);
00060
00070 PResidue(PChain *loop, const string &shellName, PResidue *toConnect);
00071
00081 PResidue(PChain *loop, const string &shellName, PResidueSpec &spec, PResidue *toConnect);
00082
00083 ~PResidue();
00084
00091 PResidue *NextResidue() const { return m_nextRes; }
00092
00099 PResidue *PreviousResidue() const { return m_prevRes; }
00100
00105 PBond *getDOF(const string &blockType, const string &atomId1, const string &atomId2);
00106
00107
00116 const ID_To_DOF_Map *getDOFsForBlock(const string &blockType);
00117
00122 void RandomizeDOFs(const string &blockType, PChain *rootChain);
00123 void RandomizeDOFs(const string &blockType);
00124
00125 void DetachBlocks(const string &blockType, const string &blockToDetachFrom);
00126 void ReattachBlocks(const string &blockType);
00127 void ReattachAllBlocks();
00128
00132 PBond *getBond(const string &id1, const string &id2);
00133
00139 PChain* getChain() const;
00140
00146 string getResourceName() const { return m_shell->getName(); }
00147
00151 string getName() const { return m_customName; }
00152
00156 void setName(string name) { m_customName = name; }
00157
00162 PBlock *getHeadBlock() { return m_blocks[m_shell->getHeadId()]; }
00163
00168 PBlock *getTailBlock() { return m_blocks[m_shell->getTailId()]; }
00169
00175 vector<PAtom *> *getAtoms() { return &m_atomCache; }
00176
00182 HASH_MAP_STR(PAtom *) *getAtomMap() { return &m_atomMap; }
00183
00190 PAtom *getAtom(const string &id) {
00191 if(m_atomMap.find(id)==m_atomMap.end()) return NULL;
00192 else
00193 return m_atomMap[id];
00194 }
00195
00201 Vector3 getAtomPosition(const string &id) { return getAtom(id)->getPos(); }
00202
00208 bool InStaticCollision() const;
00209
00215 bool InSelfCollision() const;
00216
00222 bool InAnyCollision() const;
00223
00230 pair<PAtom *, PAtom *> FindStaticCollision() const;
00231
00238 pair<PAtom *, PAtom *> FindSelfCollision() const;
00239
00246 pair<PAtom *, PAtom *> FindAnyCollision() const;
00247
00253 AtomCollisions* getAllCollidingStatic() const;
00254
00260 AtomCollisions* getAllCollidingSelf() const;
00261
00267 AtomCollisions* getAllCollidingEither() const;
00268
00273 const PSpaceManager* getSpaceManager() const;
00274
00280 PResidueSpec getSpec();
00281
00286 void setPositions(const PAtomPositionsSpec &spec);
00287
00291 int getPdbId() const { return m_pdb_id; }
00292
00293
00297 void inactivate();
00298
00302 void activate();
00303
00304
00305 private:
00306
00307 void EstablishLink(PResidue *prior);
00308
00309 void SetChain(PChain *loop) { assert(loop != NULL); m_loop = loop; }
00310
00311 void finalize();
00312 void ChangeBlockState(const string &blockType, bool status);
00313
00314
00315 void CacheDOF(DOF_Cache &DOFcache);
00316 void CacheAtoms(Atom_Cache &AtomCache);
00317 void DestroyBonds();
00318
00319 void ConstructAroundHead(PChain *loop);
00320 void BuildWithPositions(PChain *loop, const PResidueSpec &spec);
00321 void AddAuxInfo(PResidueSpec &spec);
00322
00323
00324 bool IsFullyDefined(const string &shellName, const PResidueSpec &spec);
00325
00326
00327
00328 bool InCollision(CollisionType type) const;
00329 pair<PAtom *, PAtom *> FindCollision(CollisionType type) const;
00330 AtomCollisions* getAllColliding(CollisionType type) const;
00331
00332
00333 void CacheSingleDOF(const string &blockType,PBond *bond);
00334
00336 PResidueShell *m_shell;
00337 HASH_MAP_STR(PBlock *) m_blocks;
00338 PChain *m_loop;
00339 string m_customName;
00340
00341
00342 int m_pdb_id;
00343
00344
00345 HASH_MAP_STR(PAtom *) m_atomMap;
00346
00347
00348 PResidue *m_nextRes, *m_prevRes;
00349
00350
00351
00352 vector<PAtom *> m_atomCache;
00353 typedef HASH_MAP_STR(vector<PBlock *>) BlockTypeCache;
00354 BlockTypeCache m_blockTypeCache;
00355 HASH_MAP_STR(HASH_MAP_STRPAIR_OR(PBond *)) m_dofs;
00356
00357 };
00358
00359 #endif // __P_RESIDUE_H