RDCode: GasteigerParams.h Source File

- Main Page
- Namespaces
- Classes
- Files
- Directories

# GasteigerParams.h

Go to the documentation of this file.

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