• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files

ring.h

Go to the documentation of this file.
00001 /**********************************************************************
00002 ring.h - Deal with rings, find smallest set of smallest rings (SSSR).
00003  
00004 Copyright (C) 1998-2001 by OpenEye Scientific Software, Inc.
00005 Some portions Copyright (C) 2001-2005 by Geoffrey R. Hutchison
00006  
00007 This file is part of the Open Babel project.
00008 For more information, see <http://openbabel.sourceforge.net/>
00009  
00010 This program is free software; you can redistribute it and/or modify
00011 it under the terms of the GNU General Public License as published by
00012 the Free Software Foundation version 2 of the License.
00013  
00014 This program is distributed in the hope that it will be useful,
00015 but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 GNU General Public License for more details.
00018 ***********************************************************************/
00019 
00020 #ifndef OB_RING_H
00021 #define OB_RING_H
00022 
00023 #include <deque>
00024 #include <algorithm>
00025 
00026 // TODO: Make this work as a free-standing header
00027 // Currently only used in ring.cpp which imports mol.h beforehand
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   // class introduction in ring.cpp
00039   class OBAPI OBRing
00040   {
00041     OBMol *_parent; 
00042   public:
00043     //public data members
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     //member functions
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 } // end namespace OpenBabel
00174 
00175 #endif // OB_RING_H
00176 

This file is part of the documentation for Open Babel, version 2.2.0.

Documentation copyright © 1998-2007, the Open Babel Developers.
Open Babel is hosted by: SourceForge Logo
Generated on Thu Jul 3 14:30:34 2008 by doxygen 1.5.6.