This file is indexed.

/usr/include/rdkit/GraphMol/PeriodicTable.h is in librdkit-dev 201603.5+dfsg-1ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
//
//  Copyright (C) 2001-2011 Rational Discovery LLC
//
//   @@ All Rights Reserved @@
//  This file is part of the RDKit.
//  The contents are covered by the terms of the BSD license
//  which is included in the file license.txt, found at the root
//  of the RDKit source tree.
//
#ifndef _RD_PERIODIC_TABLE_H
#define _RD_PERIODIC_TABLE_H

#include <map>
#include <vector>
#include <RDGeneral/types.h>
#include "atomic_data.h"

namespace RDKit {

//! singleton class for retrieving information about atoms
/*!
  Use the singleton like this:

  \verbatim
  const PeriodicTable *tbl = PeriodicTable::getTable();
  tbl->getAtomicWeight(6); // get atomic weight for Carbon
  tbl->getAtomicWeight("C"); // get atomic weight for Carbon
  \endverbatim

*/
class PeriodicTable {
 public:
  //! returns a pointer to the singleton PeriodicTable
  /*
      \return a pointer to the singleton ParamCollection

      <b>Notes:</b>
        - do <b>not</b> delete the pointer returned here
        - if the singleton PeriodicTable has already been instantiated and
          the singleton will be returned, otherwise the singleton will
          be constructed.

   */
  static PeriodicTable *getTable();

  ~PeriodicTable() {
    byanum.clear();
    byname.clear();
  };

  //! returns the atomic weight
  double getAtomicWeight(UINT atomicNumber) const {
    PRECONDITION(atomicNumber < byanum.size(), "Atomic number not found");
    double mass = byanum[atomicNumber].Mass();
    return mass;
  }
  //! \overload
  double getAtomicWeight(const std::string &elementSymbol) const {
    PRECONDITION(byname.count(elementSymbol), "Element not found");
    int anum = byname.find(elementSymbol)->second;
    double mass = byanum[anum].Mass();
    return mass;
  }
  //! \overload
  double getAtomicWeight(const char *elementSymbol) const {
    return getAtomicWeight(std::string(elementSymbol));
  }

  //! returns the atomic number
  int getAtomicNumber(const char *elementSymbol) const {
    std::string symb(elementSymbol);

    return getAtomicNumber(symb);
  }
  //! overload
  int getAtomicNumber(const std::string &elementSymbol) const {
    // this little optimization actually makes a measurable difference
    // in molecule-construction time
    int anum = -1;
    if (elementSymbol == "C")
      anum = 6;
    else if (elementSymbol == "N")
      anum = 7;
    else if (elementSymbol == "O")
      anum = 8;
    else {
      STR_UINT_MAP::const_iterator iter = byname.find(elementSymbol);
      if (iter != byname.end()) anum = iter->second;
    }
    POSTCONDITION(anum > -1, "Element '" + elementSymbol + "' not found");
    return anum;
  }

  //! returns the atomic symbol
  std::string getElementSymbol(UINT atomicNumber) const {
    PRECONDITION(atomicNumber < byanum.size(), "Atomic number not found");
    return byanum[atomicNumber].Symbol();
  }

  //! returns the atom's van der Waals radius
  double getRvdw(UINT atomicNumber) const {
    PRECONDITION(atomicNumber < byanum.size(), "Atomic number not found");
    return byanum[atomicNumber].Rvdw();
  }
  //! \overload
  double getRvdw(const std::string &elementSymbol) const {
    PRECONDITION(byname.count(elementSymbol),
                 "Element '" + elementSymbol + "' not found");
    return getRvdw(byname.find(elementSymbol)->second);
  }
  //! \overload
  double getRvdw(const char *elementSymbol) const {
    return getRvdw(std::string(elementSymbol));
  }

  //! returns the atom's covalent radius
  double getRcovalent(UINT atomicNumber) const {
    PRECONDITION(atomicNumber < byanum.size(), "Atomic number not found");
    return byanum[atomicNumber].Rcov();
  }
  //! \overload
  double getRcovalent(const std::string &elementSymbol) const {
    PRECONDITION(byname.count(elementSymbol),
                 "Element '" + elementSymbol + "' not found");
    return getRcovalent(byname.find(elementSymbol)->second);
  }
  //! \overload
  double getRcovalent(const char *elementSymbol) const {
    return getRcovalent(std::string(elementSymbol));
  }

  //! returns the atom's bond radius
  double getRb0(UINT atomicNumber) const {
    PRECONDITION(atomicNumber < byanum.size(), "Atomic number not found");
    return byanum[atomicNumber].Rb0();
  }
  //! \overload
  double getRb0(const std::string &elementSymbol) const {
    PRECONDITION(byname.count(elementSymbol),
                 "Element '" + elementSymbol + "' not found");
    return getRb0(byname.find(elementSymbol)->second);
  }
  //! \overload
  double getRb0(const char *elementSymbol) const {
    return getRb0(std::string(elementSymbol));
  }

  //! returns the atom's default valence
  int getDefaultValence(UINT atomicNumber) const {
    PRECONDITION(atomicNumber < byanum.size(), "Atomic number not found");
    return byanum[atomicNumber].DefaultValence();
  }
  //! \overload
  int getDefaultValence(const std::string &elementSymbol) const {
    PRECONDITION(byname.count(elementSymbol),
                 "Element '" + elementSymbol + "' not found");
    return getDefaultValence(byname.find(elementSymbol)->second);
  }
  //! \overload
  int getDefaultValence(const char *elementSymbol) const {
    return getDefaultValence(std::string(elementSymbol));
  }

  //! returns a vector of all stable valences. For atoms where
  //! we really don't have any idea what a reasonable maximum
  //! valence is (like transition metals), the vector ends with -1
  const INT_VECT &getValenceList(UINT atomicNumber) const {
    PRECONDITION(atomicNumber < byanum.size(), "Atomic number not found");
    return byanum[atomicNumber].ValenceList();
  }
  //! \overload
  const INT_VECT &getValenceList(const std::string &elementSymbol) const {
    PRECONDITION(byname.count(elementSymbol),
                 "Element '" + elementSymbol + "' not found");
    return getValenceList(byname.find(elementSymbol)->second);
  }
  //! \overload
  const INT_VECT &getValenceList(const char *elementSymbol) const {
    return getValenceList(std::string(elementSymbol));
  }

  //! returns the number of outer shell electrons
  int getNouterElecs(UINT atomicNumber) const {
    PRECONDITION(atomicNumber < byanum.size(), "Atomic number not found");
    return byanum[atomicNumber].NumOuterShellElec();
  }
  //! \overload
  int getNouterElecs(const std::string &elementSymbol) const {
    PRECONDITION(byname.count(elementSymbol),
                 "Element '" + elementSymbol + "' not found");
    return getNouterElecs(byname.find(elementSymbol)->second);
  }
  //! \overload
  int getNouterElecs(const char *elementSymbol) const {
    return getNouterElecs(std::string(elementSymbol));
  }

  //! returns the number of the most common isotope
  int getMostCommonIsotope(UINT atomicNumber) const {
    PRECONDITION(atomicNumber < byanum.size(), "Atomic number not found");
    return byanum[atomicNumber].MostCommonIsotope();
  }
  //! \overload
  int getMostCommonIsotope(const std::string &elementSymbol) const {
    PRECONDITION(byname.count(elementSymbol),
                 "Element '" + elementSymbol + "' not found");
    return getMostCommonIsotope(byname.find(elementSymbol)->second);
  }
  //! \overload
  int getMostCommonIsotope(const char *elementSymbol) const {
    return getMostCommonIsotope(std::string(elementSymbol));
  }

  //! returns the mass of the most common isotope
  double getMostCommonIsotopeMass(UINT atomicNumber) const {
    PRECONDITION(atomicNumber < byanum.size(), "Atomic number not found");
    return byanum[atomicNumber].MostCommonIsotopeMass();
  }
  //! \overload
  double getMostCommonIsotopeMass(const std::string &elementSymbol) const {
    PRECONDITION(byname.count(elementSymbol),
                 "Element '" + elementSymbol + "' not found");
    return getMostCommonIsotopeMass(byname.find(elementSymbol)->second);
  }
  //! \overload
  double getMostCommonIsotopeMass(const char *elementSymbol) const {
    return getMostCommonIsotopeMass(std::string(elementSymbol));
  }

  //! returns the mass of a particular isotope; zero if that
  //! isotope is unknown.
  double getMassForIsotope(UINT atomicNumber, UINT isotope) const {
    PRECONDITION(atomicNumber < byanum.size(), "Atomic number not found");
    const std::map<unsigned int, std::pair<double, double> > &m =
        byanum[atomicNumber].d_isotopeInfoMap;
    std::map<unsigned int, std::pair<double, double> >::const_iterator item =
        m.find(isotope);
    if (item == m.end()) {
      return 0.0;
    } else {
      return item->second.first;
    }
  }
  //! \overload
  double getMassForIsotope(const std::string &elementSymbol,
                           UINT isotope) const {
    PRECONDITION(byname.count(elementSymbol),
                 "Element '" + elementSymbol + "' not found");
    return getMassForIsotope(byname.find(elementSymbol)->second, isotope);
  }
  //! \overload
  double getMassForIsotope(const char *elementSymbol, UINT isotope) const {
    return getMassForIsotope(std::string(elementSymbol), isotope);
  }
  //! returns the abundance of a particular isotope; zero if that
  //! isotope is unknown.
  double getAbundanceForIsotope(UINT atomicNumber, UINT isotope) const {
    PRECONDITION(atomicNumber < byanum.size(), "Atomic number not found");
    const std::map<unsigned int, std::pair<double, double> > &m =
        byanum[atomicNumber].d_isotopeInfoMap;
    std::map<unsigned int, std::pair<double, double> >::const_iterator item =
        m.find(isotope);
    if (item == m.end()) {
      return 0.0;
    } else {
      return item->second.second;
    }
  }
  //! \overload
  double getAbundanceForIsotope(const std::string &elementSymbol,
                                UINT isotope) const {
    PRECONDITION(byname.count(elementSymbol),
                 "Element '" + elementSymbol + "' not found");
    return getAbundanceForIsotope(byname.find(elementSymbol)->second, isotope);
  }
  //! \overload
  double getAbundanceForIsotope(const char *elementSymbol, UINT isotope) const {
    return getAbundanceForIsotope(std::string(elementSymbol), isotope);
  }

  //! convenience function to determine which atom is more electronegative
  /*!

     check if atom with atomic number \c anum1 is more
     electronegative than the one with \c anum2
     this is rather lame but here is how we do it
       - the atom with the higher number of outer shell electrons
         is considered more electronegative
       - if the # of outer shell elecs are the same
         the atom with the lower atomic weight is more electronegative

  */
  bool moreElectroNegative(UINT anum1, UINT anum2) const {
    PRECONDITION(anum1 < byanum.size(), "Atomic number not found");
    PRECONDITION(anum2 < byanum.size(), "Atomic number not found");
    // FIX: the atomic_data needs to have real electronegativity values
    UINT ne1 = getNouterElecs(anum1);
    UINT ne2 = getNouterElecs(anum2);
    if (ne1 > ne2) {
      return true;
    }
    if (ne1 == ne2) {
      if (anum1 < anum2) {
        return true;
      }
    }
    return false;
  }

 private:
  PeriodicTable();
  PeriodicTable &operator=(const PeriodicTable &);

  static class PeriodicTable *ds_instance;

  std::vector<atomicData> byanum;
  STR_UINT_MAP byname;
};
};

#endif