Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef OB_RING_H
00021 #define OB_RING_H
00022
00023 #include <deque>
00024 #include <algorithm>
00025
00026
00027
00028 #include <openbabel/bitvec.h>
00029 #include <openbabel/typer.h>
00030
00031 namespace OpenBabel
00032 {
00033
00034 class OBMol;
00035 class OBAtom;
00036 class OBBond;
00037
00038
00039 class OBAPI OBRing
00040 {
00041 OBMol *_parent;
00042 public:
00043
00044 int ring_id;
00045 std::vector<int> _path;
00046 OBBitVec _pathset;
00047
00049
00050 OBRing() {}
00052 OBRing(std::vector<int>& path, int size);
00053 OBRing(std::vector<int>& path, OBBitVec set) : _path(path), _pathset(set) {}
00054 OBRing(const OBRing &src);
00055 OBRing& operator=(const OBRing &src);
00057
00058
00059
00061 size_t Size() const { return(_path.size()); }
00064 size_t PathSize() const { return(_path.size()); }
00065
00069 bool IsAromatic();
00070
00072 void SetType(char *type);
00074 void SetType(std::string &type);
00076 char *GetType();
00080 unsigned int GetRootAtom();
00081
00083 bool IsMember(OBAtom *a);
00086 bool IsMember(OBBond *b);
00088 bool IsInRing(int i)
00089 {
00090 return(_pathset.BitIsOn(i));
00091 }
00092
00094 void SetParent(OBMol *m) { _parent = m; }
00096 OBMol *GetParent() { return(_parent);}
00097
00104 bool findCenterAndNormal(vector3 & center, vector3 &norm1, vector3 &norm2);
00105 private:
00106 char _type[30];
00107 };
00108
00111 OBAPI bool CompareRingSize(const OBRing *,const OBRing *);
00112
00113
00117 class OBAPI OBRingSearch
00118 {
00119 std::vector<OBBond*> _bonds;
00120 std::vector<OBRing*> _rlist;
00121 public:
00122 OBRingSearch() {}
00123 ~OBRingSearch();
00124
00126 void SortRings()
00127 {
00128 std::vector<OBRing*>::iterator j;
00129 int ring_id;
00130
00131 for (j = _rlist.begin(), ring_id = 0; j != _rlist.end(); ++j, ++ring_id)
00132 (*j)->ring_id = ring_id;
00133 std::sort(_rlist.begin(),_rlist.end(),CompareRingSize);
00134 }
00136 void RemoveRedundant(int);
00138 void AddRingFromClosure(OBMol &,OBBond *);
00139
00140 bool SaveUniqueRing(std::deque<int>&,std::deque<int>&);
00141
00143 void WriteRings();
00144
00146
00147
00148 std::vector<OBRing*>::iterator BeginRings()
00149 {
00150 return(_rlist.begin());
00151 }
00153 std::vector<OBRing*>::iterator EndRings()
00154 {
00155 return(_rlist.end());
00156 }
00158 };
00159
00164 class OBAPI OBRTree
00165 {
00166 OBAtom *_atom;
00167 OBRTree *_prv;
00168 public:
00170 OBRTree(OBAtom*,OBRTree*);
00171 ~OBRTree() {}
00172
00174 int GetAtomIdx();
00176 void PathToRoot(std::vector<OBAtom*>&);
00177 };
00178
00179 }
00180
00181 #endif // OB_RING_H
00182