typer.h

Go to the documentation of this file.
00001 /**********************************************************************
00002 typer.h - Open Babel atom and aromaticity typer.
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_TYPER_H
00021 #define OB_TYPER_H
00022 
00023 #include <openbabel/babelconfig.h>
00024 
00025 #include <vector>
00026 #include <string>
00027 
00028 #include <openbabel/parsmart.h>
00029 #include <openbabel/data.h>
00030 
00031 namespace OpenBabel
00032 {
00033 
00034   // Forward declaration
00035   class OBSmartsPattern;
00036 
00037 // class introduction in typer.cpp
00038 class OBAPI OBAtomTyper : public OBGlobalDataBase
00039 {
00040   //    int                                                      _rc;
00041   std::vector<std::vector<int> >                           _mlist; 
00042   std::vector<std::pair<OBSmartsPattern*,int> >            _vinthyb; 
00043   std::vector<std::pair<OBSmartsPattern*,int> >            _vimpval; 
00044   std::vector<std::pair<OBSmartsPattern*,std::string> >    _vexttyp; 
00045 
00046 public:
00047     OBAtomTyper();
00048     ~OBAtomTyper();
00049 
00050     void ParseLine(const char*);
00052     size_t GetSize()                 { return _vimpval.size();}
00053 
00055     void AssignHyb(OBMol&);
00057     void AssignTypes(OBMol&);
00060     void AssignImplicitValence(OBMol&);
00062     void CorrectAromaticNitrogens(OBMol&);
00063 };
00064 
00065 // class introduction in typer.cpp
00066 class OBAPI OBAromaticTyper : public OBGlobalDataBase
00067 {
00068     std::vector<bool>             _vpa;   
00069     std::vector<bool>             _visit;
00070     std::vector<bool>             _root;
00071     std::vector<std::vector<int> >     _mlist;
00072     std::vector<OBSmartsPattern*> _vsp;   
00073     std::vector<std::pair<int,int> >   _verange; 
00074     std::vector<std::pair<int,int> >   _velec;   
00075 public:
00076     OBAromaticTyper();
00077     ~OBAromaticTyper();
00078 
00080     size_t GetSize()                 { return _vsp.size();}
00081 
00082     void ParseLine(const char*);
00084     void AssignAromaticFlags(OBMol &);
00087     void PropagatePotentialAromatic(OBAtom*);
00088     // Documentation in typer.cpp
00089     void SelectRootAtoms(OBMol &, bool avoidInnerRingAtoms = true);
00091     void ExcludeSmallRing(OBMol &);
00093     void CheckAromaticity(OBAtom *root,int searchDepth);
00094     // Documentation in typer.cpp
00095     bool TraverseCycle(OBAtom *root, OBAtom *atom, OBBond *prev,
00096                        std::pair<int,int> &er,int depth);
00097 };
00098 
00099 // class introduction in typer.cpp
00100 class OBAPI OBRingTyper : public OBGlobalDataBase
00101 {
00102   std::vector<std::vector<int> >                           _mlist; 
00103   std::vector<std::pair<OBSmartsPattern*,std::string> >    _ringtyp; 
00104 
00105 public:
00106     OBRingTyper();
00107     ~OBRingTyper();
00108 
00109     void ParseLine(const char*);
00111     size_t GetSize()                 { return _ringtyp.size();}
00112 
00114     void AssignTypes(OBMol&);
00115 };
00116 
00117 
00118 } //namespace OpenBabel
00119 
00120 #endif // OB_TYPER_H
00121