RDKit
Open-source cheminformatics and machine learning.
GasteigerParams.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2003-2015 Rational Discovery LLC
3 //
4 // @@ All Rights Reserved @@
5 // This file is part of the RDKit.
6 // The contents are covered by the terms of the BSD license
7 // which is included in the file license.txt, found at the root
8 // of the RDKit source tree.
9 //
10 #ifndef _RD_GASTEIGERPARAMS_H
11 #define _RD_GASTEIGERPARAMS_H
12 
13 #include <RDGeneral/types.h>
14 #include <RDGeneral/Exceptions.h>
15 #include <string>
16 #include <map>
17 
18 namespace RDKit {
19  extern std::string paramData;
20  extern std::string additionalParamData;
21 
22  // this is a constant used during the iteration procedure for the hydrogen atoms
23  // for the remaining atoms it is computed on the fly
24  const double IONXH = 20.02;
25 
26  const double DAMP_SCALE = 0.5;
27  const double DAMP = 0.5;
28 
30  /* \brief Container for all the partial charge paramters
31  *
32  * It is filled by the paramData string defined in GasteigerParams.cpp
33  * The main data member is a STL map that take a pair<std::string, std::string>
34  * of element name and mode (hybridization or bonding mode) and return a vector
35  * of three parameters, used int eh ierative partial charges euqlization procedure
36  */
37 
38  public:
39 
40  static const GasteigerParams *getParams(const std::string &paramData="");
41 
43  d_paramMap.clear();
44  }
45 
46  DOUBLE_VECT getParams(std::string elem, std::string mode,bool throwOnFailure=false) const {
47  std::pair<std::string, std::string> query(elem, mode);
48  std::map<std::pair<std::string, std::string>, DOUBLE_VECT>::const_iterator iter;
49  iter=d_paramMap.find(query);
50  if (iter != d_paramMap.end()) {
51  return iter->second;
52  }
53  else {
54  if(throwOnFailure){
55  std::string message = "ERROR: No Gasteiger Partial Charge parameters for Element: ";
56  message += elem;
57  message += " Mode: ";
58  message += mode;
59  throw ValueErrorException(message);
60  } else {
61  iter=d_paramMap.find(std::make_pair(std::string("X"),std::string("*")));
62  if (iter != d_paramMap.end()) {
63  return iter->second;
64  } else {
65  std::string message = "ERROR: Default Gasteiger Partial Charge parameters are missing";
66  throw ValueErrorException(message);
67  }
68  }
69  }
70  }
71 
72  GasteigerParams(std::string paramData="");
73  private:
74  std::map<std::pair<std::string, std::string>, DOUBLE_VECT> d_paramMap;
75 
76  static class GasteigerParams *ds_instance;
77  };
78 };
79 
80 #endif
static const GasteigerParams * getParams(const std::string &paramData="")
std::vector< double > DOUBLE_VECT
Definition: types.h:172
std::string additionalParamData
const double DAMP
std::string paramData
Includes a bunch of functionality for handling Atom and Bond queries.
Definition: Atom.h:28
const double IONXH
GasteigerParams(std::string paramData="")
const double DAMP_SCALE
Class to allow us to throw a ValueError from C++ and have it make it back to Python.
Definition: Exceptions.h:31
DOUBLE_VECT getParams(std::string elem, std::string mode, bool throwOnFailure=false) const