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 namespace OpenBabel
00027 {
00028
00029 class OBMol;
00030 class OBAtom;
00031 class OBBond;
00032
00034 class OBAPI OBRTree
00035 {
00036 OBAtom *_atom;
00037 OBRTree *_prv;
00038 public:
00039 OBRTree(OBAtom*,OBRTree*);
00040 ~OBRTree() {}
00041
00043 int GetAtomIdx();
00045 void PathToRoot(std::vector<OBNodeBase*>&);
00046 };
00047
00048
00049 class OBAPI OBRing
00050 {
00051 OBMol *_parent;
00052 public:
00053
00054 std::vector<int> _path;
00055 OBBitVec _pathset;
00056 bool findCenterAndNormal(vector3 & center, vector3 &norm1, vector3 &norm2);
00057
00058
00059 OBRing() {}
00060 OBRing(std::vector<int>&,int);
00061 OBRing(const OBRing &src);
00062 OBRing& operator=(const OBRing &src);
00063
00064
00065 int Size() const
00066 {
00067 return(_path.size());
00068 }
00069 int PathSize() const
00070 {
00071 return(_path.size());
00072 }
00073 bool IsMember(OBAtom *a);
00074 bool IsMember(OBBond *b);
00075 bool IsAromatic();
00076 bool IsInRing(int i)
00077 {
00078 return(_pathset.BitIsOn(i));
00079 }
00080 void SetParent(OBMol *m)
00081 {
00082 _parent = m;
00083 }
00084 OBMol *GetParent()
00085 {
00086 return(_parent);
00087 }
00088 };
00089
00090 bool CompareRingSize(const OBRing *,const OBRing *);
00091
00092
00094 class OBAPI OBRingSearch
00095 {
00096 std::vector<OBBond*> _bonds;
00097 std::vector<OBRing*> _rlist;
00098 public:
00099 OBRingSearch() {}
00100 ~OBRingSearch();
00101
00103 void SortRings()
00104 {
00105 std::sort(_rlist.begin(),_rlist.end(),CompareRingSize);
00106 }
00108 void RemoveRedundant(int);
00109 void AddRingFromClosure(OBMol &,OBBond *);
00111 void WriteRings();
00112
00113 bool SaveUniqueRing(std::deque<int>&,std::deque<int>&);
00114
00115 std::vector<OBRing*>::iterator BeginRings()
00116 {
00117 return(_rlist.begin());
00118 }
00119 std::vector<OBRing*>::iterator EndRings()
00120 {
00121 return(_rlist.end());
00122 }
00123 };
00124
00125 }
00126
00127 #endif // OB_RING_H
00128