patty.h

Go to the documentation of this file.
00001 /**********************************************************************
00002 patty.h - Programmable atom 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_PATTY_H
00021 #define OB_PATTY_H
00022 
00023 namespace OpenBabel
00024 {
00025 #define PT_CATION      1
00026 #define PT_ANION       2
00027 #define PT_ACCEPTOR    3
00028 #define PT_POLAR       4
00029 #define PT_DONOR       5
00030 #define PT_HYDROPHOBIC 6
00031 #define PT_OTHER       7
00032 #define PT_METAL           8
00033 
00034 // class introduction in patty.cpp
00035 class OBAPI patty
00036 {
00037     std::vector<OBSmartsPattern*> _sp;
00038     std::vector<std::string> smarts;
00039     std::vector<std::string> typ;
00040     bool debug;
00041 
00042 public :
00043 
00044     patty()
00045     {
00046         debug = false;
00047     }
00048     patty(char *s)
00049     {
00050         debug = false;
00051         read_rules(std::string(s));
00052     }
00053 
00054     patty(const std::string &s)
00055     {
00056         debug = false;
00057         read_rules(s);
00058     }
00059 
00060     ~patty()
00061     {
00062         std::vector<OBSmartsPattern*>::iterator i;
00063         for (i = _sp.begin();i != _sp.end();++i)
00064             delete *i;
00065     }
00066     void debug_on()
00067     {
00068         debug = true;
00069     }
00070     void debug_off()
00071     {
00072         debug = false;
00073     }
00074     void read_rules(const std::string &infile);
00075     void assign_rules(std::vector<std::string> &rules);
00076     void assign_types(OBMol &mol,std::vector<std::string> &atm_typ);
00077     void assign_types(OBMol &mol,std::vector<int> &atm_typ);
00078     int type_to_int(const std::string &type, bool failOnUndefined= false);
00079     int Istype(const std::string &type);
00080 };
00081 
00082 } // end namespace OpenBabel
00083 
00084 #endif // OB_PATTY_H
00085