Skip to content

Commit

Permalink
Fixes #7162
Browse files Browse the repository at this point in the history
  • Loading branch information
greglandrum committed Mar 8, 2024
1 parent 84f8186 commit 6065854
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 3 deletions.
3 changes: 3 additions & 0 deletions Code/GraphMol/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -192,3 +192,6 @@ rdkit_catch_test(molbundleTestsCatch catch_molbundle.cpp

rdkit_catch_test(pickleTestsCatch catch_pickles.cpp
LINK_LIBRARIES FileParsers SmilesParse GraphMol)

rdkit_catch_test(tableTestsCatch catch_periodictable.cpp
LINK_LIBRARIES GraphMol)
11 changes: 8 additions & 3 deletions Code/GraphMol/atomic_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,15 @@ const std::string periodicTableAtomData =
82 Pb 1.46 1.48 2.3 207.2 4 208 207.9766521 2 4
83 Bi 1.48 1.45 2.3 208.98 5 209 208.9803987 3 5 7
84 Po 1.40 1.46 2.0 209 6 209 208.9824304 2 4 6
85 At 1.50 1.45 2.0 210 7 210 209.987148 1 3 5
86 Rn 1.50 2.4 2.0 222 8 211 210.990601 0
85 At 1.50 1.45 2.0 210 7 210 209.987148 1 3 5)DAT"
// the values for Ra and Rn are from:
// https://www.ciaaw.org/atomic-masses.htm
// their most common isotopes are from
// https://www.ciaaw.org/radioactive-elements.htm
R"DAT(
86 Rn 1.50 2.4 2.0 222 8 222 222.0175706 0
87 Fr 2.6 2 2.0 223 1 223 223.0197359 1
88 Ra 2.2 1.9 2.0 226 2 223 223.0185022 2 -1
88 Ra 2.2 1.9 2.0 226 2 226 226.0254026 2 -1
89 Ac 2.15 1.88 2.0 227 3 227 227.0277521 -1
90 Th 2.06 1.79 2.4 232.038 4 232 232.0380553 -1
91 Pa 2.00 1.61 2.0 231.036 3 231 231.035884 -1
Expand Down
29 changes: 29 additions & 0 deletions Code/GraphMol/catch_periodictable.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//
// Copyright (C) 2024 Greg Landrum and other RDKit contributors
//
// @@ 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.
//

#include <catch2/catch_all.hpp>

#include <GraphMol/RDKitBase.h>

using namespace RDKit;

TEST_CASE(
"Github #7162: Unexpected exact mass values are returned for radium and radon") {
SECTION("radium") {
CHECK(PeriodicTable::getTable()->getMostCommonIsotope(88) == 226);
CHECK(PeriodicTable::getTable()->getMassForIsotope(88, 226) ==
Catch::Approx(226.02540).epsilon(1e-4));
}
SECTION("radon") {
CHECK(PeriodicTable::getTable()->getMostCommonIsotope(86) == 222);
CHECK(PeriodicTable::getTable()->getMassForIsotope(86, 222) ==
Catch::Approx(222.01757).epsilon(1e-4));
}
}

0 comments on commit 6065854

Please sign in to comment.