| 1 | tim | 741 | /********************************************************************** | 
| 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.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_PATTY_H | 
| 21 |  |  | #define OB_PATTY_H | 
| 22 |  |  |  | 
| 23 |  |  | namespace OpenBabel | 
| 24 |  |  | { | 
| 25 |  |  | #define PT_CATION      1 | 
| 26 |  |  | #define PT_ANION       2 | 
| 27 |  |  | #define PT_ACCEPTOR    3 | 
| 28 |  |  | #define PT_POLAR       4 | 
| 29 |  |  | #define PT_DONOR       5 | 
| 30 |  |  | #define PT_HYDROPHOBIC 6 | 
| 31 |  |  | #define PT_OTHER       7 | 
| 32 |  |  | #define PT_METAL           8 | 
| 33 |  |  |  | 
| 34 |  |  | // class introduction in patty.cpp | 
| 35 |  |  | class OBAPI patty | 
| 36 |  |  | { | 
| 37 |  |  | std::vector<OBSmartsPattern*> _sp; | 
| 38 |  |  | std::vector<std::string> smarts; | 
| 39 |  |  | std::vector<std::string> typ; | 
| 40 |  |  | bool debug; | 
| 41 |  |  |  | 
| 42 |  |  | public : | 
| 43 |  |  |  | 
| 44 |  |  | patty() | 
| 45 |  |  | { | 
| 46 |  |  | debug = false; | 
| 47 |  |  | } | 
| 48 |  |  | patty(char *s) | 
| 49 |  |  | { | 
| 50 |  |  | debug = false; | 
| 51 |  |  | read_rules(std::string(s)); | 
| 52 |  |  | } | 
| 53 |  |  |  | 
| 54 |  |  | patty(const std::string &s) | 
| 55 |  |  | { | 
| 56 |  |  | debug = false; | 
| 57 |  |  | read_rules(s); | 
| 58 |  |  | } | 
| 59 |  |  | ~patty() | 
| 60 |  |  | { | 
| 61 |  |  | std::vector<OBSmartsPattern*>::iterator i; | 
| 62 |  |  | for (i = _sp.begin();i != _sp.end();i++) | 
| 63 |  |  | delete *i; | 
| 64 |  |  | } | 
| 65 |  |  | void debug_on() | 
| 66 |  |  | { | 
| 67 |  |  | debug = true; | 
| 68 |  |  | } | 
| 69 |  |  | void debug_off() | 
| 70 |  |  | { | 
| 71 |  |  | debug = false; | 
| 72 |  |  | } | 
| 73 |  |  | void read_rules(const std::string &infile); | 
| 74 |  |  | void assign_rules(std::vector<std::string> &rules); | 
| 75 |  |  | void assign_types(OBMol &mol,std::vector<std::string> &atm_typ); | 
| 76 |  |  | void assign_types(OBMol &mol,std::vector<int> &atm_typ); | 
| 77 |  |  | int type_to_int(const std::string &type, bool failOnUndefined= false); | 
| 78 |  |  | int Istype(const std::string &type);//!< return atom type index, 0 otherwise | 
| 79 |  |  | }; | 
| 80 |  |  |  | 
| 81 |  |  | } // end namespace OpenBabel | 
| 82 |  |  |  | 
| 83 |  |  | #endif // OB_PATTY_H | 
| 84 |  |  |  | 
| 85 |  |  | //! \file patty.h | 
| 86 |  |  | //! \brief Programmable atom typer. (abbreviated P.At.Ty.) |