ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-2.0/src/openbabel/typer.hpp
Revision: 2440
Committed: Wed Nov 16 19:42:11 2005 UTC (18 years, 7 months ago) by tim
File size: 3591 byte(s)
Log Message:
adding openbabel

File Contents

# User Rev Content
1 tim 2440 /**********************************************************************
2     typer.h - Open Babel atom and aromaticity typer.
3    
4     Copyright (C) 1998-2001 by OpenEye Scientific Software, Inc.
5     Some portions Copyright (C) 2001-2005 by Geoffrey R. Hutchison
6    
7     This file is part of the Open Babel project.
8     For more information, see <http://openbabel.sourceforge.net/>
9    
10     This program is free software; you can redistribute it and/or modify
11     it under the terms of the GNU General Public License as published by
12     the Free Software Foundation version 2 of the License.
13    
14     This program is distributed in the hope that it will be useful,
15     but WITHOUT ANY WARRANTY; without even the implied warranty of
16     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17     GNU General Public License for more details.
18     ***********************************************************************/
19    
20     #ifndef OB_TYPER_H
21     #define OB_TYPER_H
22    
23     #include "parsmart.hpp"
24     #include "data.hpp"
25    
26     namespace OpenBabel
27     {
28    
29     // class introduction in typer.cpp
30     class OBAPI OBAtomTyper : public OBGlobalDataBase
31     {
32     // int _rc;
33     std::vector<std::vector<int> > _mlist; //!< match list for atom typing
34     std::vector<std::pair<OBSmartsPattern*,int> > _vinthyb; //!< internal hybridization rules
35     std::vector<std::pair<OBSmartsPattern*,int> > _vimpval; //!< internal implicit valence rules
36     std::vector<std::pair<OBSmartsPattern*,std::string> > _vexttyp; //!< external atom type rules
37    
38     public:
39     OBAtomTyper();
40     ~OBAtomTyper();
41    
42     void ParseLine(const char*);
43     //! \return the number of implicit valence rules
44     unsigned int GetSize() { return _vimpval.size();}
45    
46     //! Assign atomic hybridization (1 = sp, 2 = sp2, 3 = sp3...)
47     void AssignHyb(OBMol&);
48     //! Assign external atomic types (i.e., EXTTYP lines in atomtyp.txt)
49     void AssignTypes(OBMol&);
50     //! Assign implicit valence (i.e., given an atomic type, what is the
51     //! expected number of bonds to this atom
52     void AssignImplicitValence(OBMol&);
53     //! Correct typing, valence, and hybridization for aromatic nitrogen atoms
54     void CorrectAromaticNitrogens(OBMol&);
55     };
56    
57     // class introduction in typer.cpp
58     class OBAPI OBAromaticTyper : public OBGlobalDataBase
59     {
60     std::vector<bool> _vpa; //!< potentially aromatic atoms
61     std::vector<bool> _visit;
62     std::vector<bool> _root;
63     std::vector<std::vector<int> > _mlist;
64     std::vector<OBSmartsPattern*> _vsp; //!< SMARTS of potentially aromatic atoms
65     std::vector<std::pair<int,int> > _verange; //!< min and max number of electrons
66     std::vector<std::pair<int,int> > _velec; //!< # electrons an atom contributes
67     public:
68     OBAromaticTyper();
69     ~OBAromaticTyper();
70    
71     //! \return the number of SMARTS patterns
72     unsigned int GetSize() { return _vsp.size();}
73    
74     void ParseLine(const char*);
75     //! Assign aromaticity flag to atoms and bonds
76     void AssignAromaticFlags(OBMol &);
77     void PropagatePotentialAromatic(OBAtom*);
78     void SelectRootAtoms(OBMol &, bool avoidInnerRingAtoms = true);
79     //! Remove 3-member rings from consideration
80     void ExcludeSmallRing(OBMol &);
81     //! Check aromaticity starting from the root atom, up to a specified depth
82     void CheckAromaticity(OBAtom *root,int searchDepth);
83     bool TraverseCycle(OBAtom*,OBAtom*,OBBond*,std::pair<int,int>&,int);
84     };
85    
86     } //namespace OpenBabel
87    
88     #endif // OB_TYPER_H
89    
90     //! \file typer.h
91     //! \brief Open Babel atom and aromaticity typer.