GasteigerParams.h

Go to the documentation of this file.
00001 //
00002 //  Copyright (C) 2003-2006 Rational Discovery LLC
00003 //
00004 //   @@ All Rights Reserved @@
00005 //  This file is part of the RDKit.
00006 //  The contents are covered by the terms of the BSD license
00007 //  which is included in the file license.txt, found at the root
00008 //  of the RDKit source tree.
00009 //
00010 #ifndef _RD_GASTEIGERPARAMS_H
00011 #define _RD_GASTEIGERPARAMS_H
00012 
00013 #include <RDGeneral/types.h>
00014 #include <string>
00015 #include <map>
00016 
00017 namespace RDKit {
00018   extern std::string paramData;
00019 
00020   // this is a constant used during the iteration procedure for the hydrogen atoms
00021   // for the remaining atoms it is computed on the fly 
00022   const double IONXH = 20.02; 
00023 
00024   const double DAMP_SCALE = 0.5;
00025   const double DAMP = 0.5;
00026     
00027   class GasteigerParams {
00028     /* \brief Container for all the partial charge paramters
00029      * 
00030      * It is filled by the paramData string defined in GasteigerParams.cpp
00031      * The main data member is a STL map that take a pair<std::string, std::string>
00032      * of element name and mode (hybridization or bonding mode) and return a vector
00033      * of three parameters, used int eh ierative partial charges euqlization procedure
00034      */
00035 
00036   public:
00037 
00038     static GasteigerParams *getParams();
00039     
00040     ~GasteigerParams() {
00041       d_paramMap.clear();
00042     }
00043 
00044     DOUBLE_VECT getParams(std::string elem, std::string mode,bool throwOnFailure=false) {
00045       std::pair<std::string, std::string> query(elem, mode);
00046       if (d_paramMap.find(query) != d_paramMap.end()) {
00047         return d_paramMap[query];
00048       }
00049       else {
00050         if(throwOnFailure){
00051           std::string message = "ERROR: No Gasteiger Partial Charge parameters for Element: ";
00052           message += elem;
00053           message += " Mode: ";
00054           message += mode;
00055           throw message.c_str();
00056         } else {
00057           return d_paramMap[std::make_pair<std::string,std::string>("X","*")];
00058         }
00059       }
00060     }
00061 
00062   private:
00063     GasteigerParams();
00064     std::map<std::pair<std::string, std::string>, DOUBLE_VECT> d_paramMap;
00065 
00066     static class GasteigerParams *ds_instance;
00067   };
00068 };
00069 
00070 #endif