File: Table.cpp

package info (click to toggle)
rdkit 201809.1%2Bdfsg-6
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 123,688 kB
  • sloc: cpp: 230,509; python: 70,501; java: 6,329; ansic: 5,427; sql: 1,899; yacc: 1,739; lex: 1,243; makefile: 445; xml: 229; fortran: 183; sh: 123; cs: 93
file content (137 lines) | stat: -rw-r--r-- 5,532 bytes parent folder | download | duplicates (2)
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
// $Id$
//
//  Copyright (C) 2003-2006 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.
//

#define NO_IMPORT_ARRAY
#include <RDBoost/python.h>
#include <string>

#include <GraphMol/RDKitBase.h>
#include <RDGeneral/types.h>

namespace python = boost::python;
namespace RDKit {

PeriodicTable *GetTable() { return PeriodicTable::getTable(); }

std::string periodicTableClassDoc =
    "A class which stores information from the Periodic Table.\n\
\n\
  It is not possible to create a PeriodicTable object directly from Python,\n\
  use GetPeriodicTable() to get the global table.\n\
\n\
  The PeriodicTable object can be queried for a variety of properties:\n\
\n\
    - GetAtomicWeight\n\
\n\
    - GetAtomicNumber\n\
\n\
    - GetElementSymbol\n\
\n\
    - GetRvdw (van der Waals radius)\n\
\n\
    - GetRCovalent (covalent radius)\n\
\n\
    - GetDefaultValence\n\
\n\
    - GetValenceList\n\
\n\
    - GetNOuterElecs (number of valence electrons)\n\
\n\
    - GetMostCommonIsotope\n\
\n\
    - GetMostCommonIsotopeMass\n\
\n\
    - GetRb0\n\
\n\
    - GetAbundanceForIsotope\n\
\n\
    - GetMassForIsotope\n\
\n\
  When it makes sense, these can be queried using either an atomic number (integer)\n\
  or an atomic symbol (string)\n\
\n";

struct table_wrapper {
  static void wrap() {
    python::class_<PeriodicTable>(
        "PeriodicTable", periodicTableClassDoc.c_str(), python::no_init)
        .def("GetAtomicWeight", (double (PeriodicTable::*)(UINT) const) &
                                    PeriodicTable::getAtomicWeight)
        .def("GetAtomicWeight",
             (double (PeriodicTable::*)(const std::string &) const) &
                 PeriodicTable::getAtomicWeight)
        .def("GetAtomicNumber",
             (int (PeriodicTable::*)(const std::string &) const) &
                 PeriodicTable::getAtomicNumber)
        .def("GetElementSymbol", (std::string (PeriodicTable::*)(UINT) const) &
                                     PeriodicTable::getElementSymbol)
        .def("GetRvdw",
             (double (PeriodicTable::*)(UINT) const) & PeriodicTable::getRvdw)
        .def("GetRvdw", (double (PeriodicTable::*)(const std::string &) const) &
                            PeriodicTable::getRvdw)
        .def("GetRcovalent", (double (PeriodicTable::*)(UINT) const) &
                                 PeriodicTable::getRcovalent)
        .def("GetRcovalent",
             (double (PeriodicTable::*)(const std::string &) const) &
                 PeriodicTable::getRcovalent)
        .def("GetDefaultValence", (int (PeriodicTable::*)(UINT) const) &
                                      PeriodicTable::getDefaultValence)
        .def("GetDefaultValence",
             (int (PeriodicTable::*)(const std::string &) const) &
                 PeriodicTable::getDefaultValence)
        .def("GetValenceList",
             (const INT_VECT &(PeriodicTable::*)(UINT) const) &
                 PeriodicTable::getValenceList,
             python::return_value_policy<python::copy_const_reference>())
        .def("GetValenceList",
             (const INT_VECT &(PeriodicTable::*)(const std::string &) const) &
                 PeriodicTable::getValenceList,
             python::return_value_policy<python::copy_const_reference>())
        .def("GetNOuterElecs", (int (PeriodicTable::*)(UINT) const) &
                                   PeriodicTable::getNouterElecs)
        .def("GetNOuterElecs",
             (int (PeriodicTable::*)(const std::string &) const) &
                 PeriodicTable::getNouterElecs)
        .def("GetMostCommonIsotope", (int (PeriodicTable::*)(UINT) const) &
                                 PeriodicTable::getMostCommonIsotope)
        .def("GetMostCommonIsotope",
             (int (PeriodicTable::*)(const std::string &) const) &
                PeriodicTable::getMostCommonIsotope)
        .def("GetMostCommonIsotopeMass", (double (PeriodicTable::*)(UINT) const) &
                                 PeriodicTable::getMostCommonIsotopeMass)
        .def("GetMostCommonIsotopeMass",
             (double (PeriodicTable::*)(const std::string &) const) &
                PeriodicTable::getMostCommonIsotopeMass)
        .def("GetRb0", (double (PeriodicTable::*)(UINT) const) &
                                 PeriodicTable::getRb0)
        .def("GetRb0",
             (double (PeriodicTable::*)(const std::string &) const) &
                 PeriodicTable::getRb0)
        .def("GetAbundanceForIsotope", (double (PeriodicTable::*)(UINT, UINT) const) &
                                 PeriodicTable::getAbundanceForIsotope)
        .def("GetAbundanceForIsotope",
             (double (PeriodicTable::*)(const std::string &, UINT) const) &
                 PeriodicTable::getAbundanceForIsotope)
        .def("GetMassForIsotope", (double (PeriodicTable::*)(UINT, UINT) const) &
                                 PeriodicTable::getMassForIsotope)
        .def("GetMassForIsotope",
             (double (PeriodicTable::*)(const std::string &, UINT) const) &
                 PeriodicTable::getMassForIsotope);

    python::def(
        "GetPeriodicTable", GetTable,
        "Returns the application's PeriodicTable instance.\n\n",
        python::return_value_policy<python::reference_existing_object>());
  };
};
}  // end of namespace
void wrap_table() { RDKit::table_wrapper::wrap(); }