Open Babel  3.0
patty.h
Go to the documentation of this file.
1 /**********************************************************************
2 patty.h - Programmable atom 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.org/>
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_PATTY_H
21 #define OB_PATTY_H
22 
23 #include <openbabel/parsmart.h>
24 
25 namespace OpenBabel
26 {
27 #define PT_CATION 1
28 #define PT_ANION 2
29 #define PT_ACCEPTOR 3
30 #define PT_POLAR 4
31 #define PT_DONOR 5
32 #define PT_HYDROPHOBIC 6
33 #define PT_OTHER 7
34 #define PT_METAL 8
35 
36 // class introduction in patty.cpp
37 class OBAPI patty
38 {
39  std::vector<OBSmartsPattern*> _sp;
40  std::vector<std::string> smarts;
41  std::vector<std::string> typ;
42  bool debug;
43 
44 public :
45 
47  {
48  debug = false;
49  }
50  patty(char *s)
51  {
52  debug = false;
53  read_rules(std::string(s));
54  }
55 
56  patty(const std::string &s)
57  {
58  debug = false;
59  read_rules(s);
60  }
61 
63  {
64  std::vector<OBSmartsPattern*>::iterator i;
65  for (i = _sp.begin();i != _sp.end();++i)
66  delete *i;
67  }
68  void debug_on()
69  {
70  debug = true;
71  }
72  void debug_off()
73  {
74  debug = false;
75  }
76  void read_rules(const std::string &infile);
77  void assign_rules(std::vector<std::string> &rules);
78  void assign_types(OBMol &mol,std::vector<std::string> &atm_typ);
79  void assign_types(OBMol &mol,std::vector<int> &atm_typ);
80  int type_to_int(const std::string &type, bool failOnUndefined= false);
81  int Istype(const std::string &type);
82 };
83 
84 } // end namespace OpenBabel
85 
86 #endif // OB_PATTY_H
87 
Molecule Class.
Definition: mol.h:118
Programmable Atom Typer.
Definition: patty.h:37
patty(char *s)
Definition: patty.h:50
void debug_off()
Definition: patty.h:72
~patty()
Definition: patty.h:62
patty()
Definition: patty.h:46
void debug_on()
Definition: patty.h:68
Daylight SMARTS parser.
patty(const std::string &s)
Definition: patty.h:56
Global namespace for all Open Babel code.
Definition: alias.h:22