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 std::vector<int> _path;
00045 OBBitVec _pathset;
00046
00048
00049 OBRing() {}
00051 OBRing(std::vector<int>& path, int size);
00052 OBRing(std::vector<int>& path, OBBitVec set) : _path(path), _pathset(set) {}
00053 OBRing(const OBRing &src);
00054 OBRing& operator=(const OBRing &src);
00056
00057
00058
00060 int Size() const { return(_path.size()); }
00063 int PathSize() const { return(_path.size()); }
00064
00068 bool IsAromatic();
00069
00071 void SetType(char *type);
00073 void SetType(std::string &type);
00075 char *GetType();
00079 unsigned int GetRootAtom();
00080
00082 bool IsMember(OBAtom *a);
00085 bool IsMember(OBBond *b);
00087 bool IsInRing(int i)
00088 {
00089 return(_pathset.BitIsOn(i));
00090 }
00091
00093 void SetParent(OBMol *m) { _parent = m; }
00095 OBMol *GetParent() { return(_parent);}
00096
00103 bool findCenterAndNormal(vector3 & center, vector3 &norm1, vector3 &norm2);
00104 private:
00105 char _type[30];
00106 };
00107
00110 OBAPI bool CompareRingSize(const OBRing *,const OBRing *);
00111
00112
00116 class OBAPI OBRingSearch
00117 {
00118 std::vector<OBBond*> _bonds;
00119 std::vector<OBRing*> _rlist;
00120 public:
00121 OBRingSearch() {}
00122 ~OBRingSearch();
00123
00125 void SortRings()
00126 {
00127 std::sort(_rlist.begin(),_rlist.end(),CompareRingSize);
00128 }
00130 void RemoveRedundant(int);
00132 void AddRingFromClosure(OBMol &,OBBond *);
00133
00134 bool SaveUniqueRing(std::deque<int>&,std::deque<int>&);
00135
00137 void WriteRings();
00138
00140
00141
00142 std::vector<OBRing*>::iterator BeginRings()
00143 {
00144 return(_rlist.begin());
00145 }
00147 std::vector<OBRing*>::iterator EndRings()
00148 {
00149 return(_rlist.end());
00150 }
00152 };
00153
00158 class OBAPI OBRTree
00159 {
00160 OBAtom *_atom;
00161 OBRTree *_prv;
00162 public:
00164 OBRTree(OBAtom*,OBRTree*);
00165 ~OBRTree() {}
00166
00168 int GetAtomIdx();
00170 void PathToRoot(std::vector<OBAtom*>&);
00171 };
00172
00173 }
00174
00175 #endif // OB_RING_H
00176