mirror of
https://github.com/rdkit/rdkit.git
synced 2026-06-03 21:44:30 +08:00
swap boost::tuple to std::tuple (#5851)
This commit is contained in:
@@ -8,8 +8,6 @@
|
||||
// of the RDKit source tree.
|
||||
//
|
||||
|
||||
#include <boost/tuple/tuple_comparison.hpp>
|
||||
|
||||
#include <RDGeneral/Invariant.h>
|
||||
#include <RDGeneral/RDThreads.h>
|
||||
#ifdef RDK_BUILD_THREADSAFE_SSS
|
||||
@@ -29,14 +27,14 @@ std::uint8_t *bitsetToBytes(const boost::dynamic_bitset<> &bitset);
|
||||
namespace {
|
||||
auto tplSorter = [](const MultiFPBReader::ResultTuple &v1,
|
||||
const MultiFPBReader::ResultTuple &v2) {
|
||||
if (v1.get<0>() == v2.get<0>()) {
|
||||
if (v1.get<2>() == v2.get<2>()) {
|
||||
return v1.get<1>() < v2.get<1>();
|
||||
if (std::get<0>(v1) == std::get<0>(v2)) {
|
||||
if (std::get<2>(v1) == std::get<2>(v2)) {
|
||||
return std::get<1>(v1) < std::get<1>(v2);
|
||||
} else {
|
||||
return v1.get<2>() < v2.get<2>();
|
||||
return std::get<2>(v1) < std::get<2>(v2);
|
||||
}
|
||||
} else {
|
||||
return v1.get<0>() > v2.get<0>();
|
||||
return std::get<0>(v1) > std::get<0>(v2);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2016 Greg Landrum
|
||||
// Copyright (c) 2016-2022 Greg Landrum
|
||||
//
|
||||
// @@ All Rights Reserved @@
|
||||
// This file is part of the RDKit.
|
||||
@@ -21,7 +21,7 @@
|
||||
#include <RDGeneral/Exceptions.h>
|
||||
#include <DataStructs/ExplicitBitVect.h>
|
||||
#include <DataStructs/FPBReader.h>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <tuple>
|
||||
|
||||
namespace RDKit {
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace RDKit {
|
||||
MultiFPBReader fpbs(readers);
|
||||
fpbs.init();
|
||||
boost::shared_ptr<ExplicitBitVect> ebv = fpbs.getReader(0)->getFP(95);
|
||||
std::vector<boost::tuple<double,unsigned int, unsigned int> > nbrs =
|
||||
std::vector<std::tuple<double,unsigned int, unsigned int> > nbrs =
|
||||
fpbs.getTanimotoNeighbors(*ebv.get(), 0.70);
|
||||
\endcode
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace RDKit {
|
||||
*/
|
||||
class RDKIT_DATASTRUCTS_EXPORT MultiFPBReader {
|
||||
public:
|
||||
typedef boost::tuple<double, unsigned int, unsigned int> ResultTuple;
|
||||
typedef std::tuple<double, unsigned int, unsigned int> ResultTuple;
|
||||
MultiFPBReader() {}
|
||||
|
||||
/*!
|
||||
|
||||
@@ -58,7 +58,8 @@ python::tuple multiTaniNbrHelper(const MultiFPBReader *self,
|
||||
self->getTanimotoNeighbors(bv, threshold, numThreads);
|
||||
python::list result;
|
||||
for (auto &nbr : nbrs) {
|
||||
result.append(python::make_tuple(nbr.get<0>(), nbr.get<1>(), nbr.get<2>()));
|
||||
result.append(python::make_tuple(std::get<0>(nbr), std::get<1>(nbr),
|
||||
std::get<2>(nbr)));
|
||||
}
|
||||
return python::tuple(result);
|
||||
}
|
||||
@@ -71,7 +72,8 @@ python::tuple multiTverskyNbrHelper(const MultiFPBReader *self,
|
||||
self->getTverskyNeighbors(bv, ca, cb, threshold, numThreads);
|
||||
python::list result;
|
||||
for (auto &nbr : nbrs) {
|
||||
result.append(python::make_tuple(nbr.get<0>(), nbr.get<1>(), nbr.get<2>()));
|
||||
result.append(python::make_tuple(std::get<0>(nbr), std::get<1>(nbr),
|
||||
std::get<2>(nbr)));
|
||||
}
|
||||
return python::tuple(result);
|
||||
}
|
||||
|
||||
@@ -75,12 +75,12 @@ void test2MultiFPBReaderTanimoto() {
|
||||
std::vector<MultiFPBReader::ResultTuple> nbrs =
|
||||
mfps.getTanimotoNeighbors(bytes);
|
||||
TEST_ASSERT(nbrs.size() == 2);
|
||||
TEST_ASSERT(feq(nbrs[0].get<0>(), 1.));
|
||||
TEST_ASSERT(nbrs[0].get<1>() == 0);
|
||||
TEST_ASSERT(nbrs[0].get<2>() == 0);
|
||||
TEST_ASSERT(feq(nbrs[1].get<0>(), 1.));
|
||||
TEST_ASSERT(nbrs[1].get<1>() == 0);
|
||||
TEST_ASSERT(nbrs[1].get<2>() == 1);
|
||||
TEST_ASSERT(feq(std::get<0>(nbrs[0]), 1.));
|
||||
TEST_ASSERT(std::get<1>(nbrs[0]) == 0);
|
||||
TEST_ASSERT(std::get<2>(nbrs[0]) == 0);
|
||||
TEST_ASSERT(feq(std::get<0>(nbrs[1]), 1.));
|
||||
TEST_ASSERT(std::get<1>(nbrs[1]) == 0);
|
||||
TEST_ASSERT(std::get<2>(nbrs[1]) == 1);
|
||||
}
|
||||
{ // with a threshold
|
||||
boost::shared_array<std::uint8_t> bytes = mfps.getReader(0)->getBytes(0);
|
||||
@@ -88,15 +88,15 @@ void test2MultiFPBReaderTanimoto() {
|
||||
std::vector<MultiFPBReader::ResultTuple> nbrs =
|
||||
mfps.getTanimotoNeighbors(bytes, 0.30);
|
||||
TEST_ASSERT(nbrs.size() == 10);
|
||||
TEST_ASSERT(feq(nbrs[0].get<0>(), 1.));
|
||||
TEST_ASSERT(nbrs[0].get<1>() == 0);
|
||||
TEST_ASSERT(nbrs[0].get<2>() == 0);
|
||||
TEST_ASSERT(feq(nbrs[1].get<0>(), 1.));
|
||||
TEST_ASSERT(nbrs[1].get<1>() == 0);
|
||||
TEST_ASSERT(nbrs[1].get<2>() == 1);
|
||||
TEST_ASSERT(feq(nbrs[2].get<0>(), 0.3703));
|
||||
TEST_ASSERT(nbrs[2].get<1>() == 1);
|
||||
TEST_ASSERT(nbrs[2].get<2>() == 0);
|
||||
TEST_ASSERT(feq(std::get<0>(nbrs[0]), 1.));
|
||||
TEST_ASSERT(std::get<1>(nbrs[0]) == 0);
|
||||
TEST_ASSERT(std::get<2>(nbrs[0]) == 0);
|
||||
TEST_ASSERT(feq(std::get<0>(nbrs[1]), 1.));
|
||||
TEST_ASSERT(std::get<1>(nbrs[1]) == 0);
|
||||
TEST_ASSERT(std::get<2>(nbrs[1]) == 1);
|
||||
TEST_ASSERT(feq(std::get<0>(nbrs[2]), 0.3703));
|
||||
TEST_ASSERT(std::get<1>(nbrs[2]) == 1);
|
||||
TEST_ASSERT(std::get<2>(nbrs[2]) == 0);
|
||||
}
|
||||
{ // with a threshold
|
||||
boost::shared_array<std::uint8_t> bytes = mfps.getReader(0)->getBytes(95);
|
||||
@@ -104,15 +104,15 @@ void test2MultiFPBReaderTanimoto() {
|
||||
std::vector<MultiFPBReader::ResultTuple> nbrs =
|
||||
mfps.getTanimotoNeighbors(bytes, 0.30);
|
||||
TEST_ASSERT(nbrs.size() == 4);
|
||||
TEST_ASSERT(feq(nbrs[0].get<0>(), 1.));
|
||||
TEST_ASSERT(nbrs[0].get<1>() == 95);
|
||||
TEST_ASSERT(nbrs[0].get<2>() == 0);
|
||||
TEST_ASSERT(feq(nbrs[1].get<0>(), 1.));
|
||||
TEST_ASSERT(nbrs[1].get<1>() == 95);
|
||||
TEST_ASSERT(nbrs[1].get<2>() == 1);
|
||||
TEST_ASSERT(feq(nbrs[2].get<0>(), 0.4125));
|
||||
TEST_ASSERT(nbrs[2].get<1>() == 89);
|
||||
TEST_ASSERT(nbrs[2].get<2>() == 0);
|
||||
TEST_ASSERT(feq(std::get<0>(nbrs[0]), 1.));
|
||||
TEST_ASSERT(std::get<1>(nbrs[0]) == 95);
|
||||
TEST_ASSERT(std::get<2>(nbrs[0]) == 0);
|
||||
TEST_ASSERT(feq(std::get<0>(nbrs[1]), 1.));
|
||||
TEST_ASSERT(std::get<1>(nbrs[1]) == 95);
|
||||
TEST_ASSERT(std::get<2>(nbrs[1]) == 1);
|
||||
TEST_ASSERT(feq(std::get<0>(nbrs[2]), 0.4125));
|
||||
TEST_ASSERT(std::get<1>(nbrs[2]) == 89);
|
||||
TEST_ASSERT(std::get<2>(nbrs[2]) == 0);
|
||||
}
|
||||
}
|
||||
BOOST_LOG(rdInfoLog) << "Finished" << std::endl;
|
||||
@@ -140,12 +140,12 @@ void test3MultiFPBReaderTversky() {
|
||||
std::vector<MultiFPBReader::ResultTuple> nbrs =
|
||||
mfps.getTverskyNeighbors(bytes, 1., 1.);
|
||||
TEST_ASSERT(nbrs.size() == 2);
|
||||
TEST_ASSERT(feq(nbrs[0].get<0>(), 1.));
|
||||
TEST_ASSERT(nbrs[0].get<1>() == 0);
|
||||
TEST_ASSERT(nbrs[0].get<2>() == 0);
|
||||
TEST_ASSERT(feq(nbrs[1].get<0>(), 1.));
|
||||
TEST_ASSERT(nbrs[1].get<1>() == 0);
|
||||
TEST_ASSERT(nbrs[1].get<2>() == 1);
|
||||
TEST_ASSERT(feq(std::get<0>(nbrs[0]), 1.));
|
||||
TEST_ASSERT(std::get<1>(nbrs[0]) == 0);
|
||||
TEST_ASSERT(std::get<2>(nbrs[0]) == 0);
|
||||
TEST_ASSERT(feq(std::get<0>(nbrs[1]), 1.));
|
||||
TEST_ASSERT(std::get<1>(nbrs[1]) == 0);
|
||||
TEST_ASSERT(std::get<2>(nbrs[1]) == 1);
|
||||
}
|
||||
{ // with a threshold
|
||||
boost::shared_array<std::uint8_t> bytes = mfps.getReader(0)->getBytes(0);
|
||||
@@ -153,15 +153,15 @@ void test3MultiFPBReaderTversky() {
|
||||
std::vector<MultiFPBReader::ResultTuple> nbrs =
|
||||
mfps.getTverskyNeighbors(bytes, 1., 1., 0.30);
|
||||
TEST_ASSERT(nbrs.size() == 10);
|
||||
TEST_ASSERT(feq(nbrs[0].get<0>(), 1.));
|
||||
TEST_ASSERT(nbrs[0].get<1>() == 0);
|
||||
TEST_ASSERT(nbrs[0].get<2>() == 0);
|
||||
TEST_ASSERT(feq(nbrs[1].get<0>(), 1.));
|
||||
TEST_ASSERT(nbrs[1].get<1>() == 0);
|
||||
TEST_ASSERT(nbrs[1].get<2>() == 1);
|
||||
TEST_ASSERT(feq(nbrs[2].get<0>(), 0.3703));
|
||||
TEST_ASSERT(nbrs[2].get<1>() == 1);
|
||||
TEST_ASSERT(nbrs[2].get<2>() == 0);
|
||||
TEST_ASSERT(feq(std::get<0>(nbrs[0]), 1.));
|
||||
TEST_ASSERT(std::get<1>(nbrs[0]) == 0);
|
||||
TEST_ASSERT(std::get<2>(nbrs[0]) == 0);
|
||||
TEST_ASSERT(feq(std::get<0>(nbrs[1]), 1.));
|
||||
TEST_ASSERT(std::get<1>(nbrs[1]) == 0);
|
||||
TEST_ASSERT(std::get<2>(nbrs[1]) == 1);
|
||||
TEST_ASSERT(feq(std::get<0>(nbrs[2]), 0.3703));
|
||||
TEST_ASSERT(std::get<1>(nbrs[2]) == 1);
|
||||
TEST_ASSERT(std::get<2>(nbrs[2]) == 0);
|
||||
}
|
||||
{ // with a threshold, asymmetric
|
||||
boost::shared_array<std::uint8_t> bytes = mfps.getReader(0)->getBytes(0);
|
||||
@@ -169,15 +169,15 @@ void test3MultiFPBReaderTversky() {
|
||||
std::vector<MultiFPBReader::ResultTuple> nbrs =
|
||||
mfps.getTverskyNeighbors(bytes, 1., 0.5, 0.30);
|
||||
TEST_ASSERT(nbrs.size() == 10);
|
||||
TEST_ASSERT(feq(nbrs[0].get<0>(), 1.));
|
||||
TEST_ASSERT(nbrs[0].get<1>() == 0);
|
||||
TEST_ASSERT(nbrs[0].get<2>() == 0);
|
||||
TEST_ASSERT(feq(nbrs[1].get<0>(), 1.));
|
||||
TEST_ASSERT(nbrs[1].get<1>() == 0);
|
||||
TEST_ASSERT(nbrs[1].get<2>() == 1);
|
||||
TEST_ASSERT(feq(nbrs[2].get<0>(), 0.4255));
|
||||
TEST_ASSERT(nbrs[2].get<1>() == 1);
|
||||
TEST_ASSERT(nbrs[2].get<2>() == 0);
|
||||
TEST_ASSERT(feq(std::get<0>(nbrs[0]), 1.));
|
||||
TEST_ASSERT(std::get<1>(nbrs[0]) == 0);
|
||||
TEST_ASSERT(std::get<2>(nbrs[0]) == 0);
|
||||
TEST_ASSERT(feq(std::get<0>(nbrs[1]), 1.));
|
||||
TEST_ASSERT(std::get<1>(nbrs[1]) == 0);
|
||||
TEST_ASSERT(std::get<2>(nbrs[1]) == 1);
|
||||
TEST_ASSERT(feq(std::get<0>(nbrs[2]), 0.4255));
|
||||
TEST_ASSERT(std::get<1>(nbrs[2]) == 1);
|
||||
TEST_ASSERT(std::get<2>(nbrs[2]) == 0);
|
||||
}
|
||||
}
|
||||
BOOST_LOG(rdInfoLog) << "Finished" << std::endl;
|
||||
@@ -263,27 +263,28 @@ void test5MultiFPBReaderThreaded() {
|
||||
mfps.getTanimotoNeighbors(qbv, 0.6);
|
||||
TEST_ASSERT(nbrs.size() == 6);
|
||||
// for (unsigned int i = 0; i < nbrs.size(); ++i) {
|
||||
// std::cerr << i << ": " << nbrs[i].get<0>() << " " << nbrs[i].get<1>()
|
||||
// << " " << nbrs[i].get<2>() << " " << std::endl;
|
||||
// std::cerr << i << ": " << std::get<0>(nbrs[i]) << " " <<
|
||||
// std::get<1>(nbrs[i])
|
||||
// << " " << std::get<2>(nbrs[i]) << " " << std::endl;
|
||||
// }
|
||||
TEST_ASSERT(feq(nbrs[0].get<0>(), 0.66412));
|
||||
TEST_ASSERT(nbrs[0].get<1>() == 0);
|
||||
TEST_ASSERT(nbrs[0].get<2>() == 3);
|
||||
TEST_ASSERT(feq(nbrs[1].get<0>(), 0.65289));
|
||||
TEST_ASSERT(nbrs[1].get<1>() == 1);
|
||||
TEST_ASSERT(nbrs[1].get<2>() == 2);
|
||||
TEST_ASSERT(feq(nbrs[2].get<0>(), 0.64341));
|
||||
TEST_ASSERT(nbrs[2].get<1>() == 2);
|
||||
TEST_ASSERT(nbrs[2].get<2>() == 1);
|
||||
TEST_ASSERT(feq(nbrs[3].get<0>(), 0.61940));
|
||||
TEST_ASSERT(nbrs[3].get<1>() == 1);
|
||||
TEST_ASSERT(nbrs[3].get<2>() == 0);
|
||||
TEST_ASSERT(feq(nbrs[4].get<0>(), 0.61905));
|
||||
TEST_ASSERT(nbrs[4].get<1>() == 0);
|
||||
TEST_ASSERT(nbrs[4].get<2>() == 0);
|
||||
TEST_ASSERT(feq(nbrs[5].get<0>(), 0.61344));
|
||||
TEST_ASSERT(nbrs[5].get<1>() == 0);
|
||||
TEST_ASSERT(nbrs[5].get<2>() == 1);
|
||||
TEST_ASSERT(feq(std::get<0>(nbrs[0]), 0.66412));
|
||||
TEST_ASSERT(std::get<1>(nbrs[0]) == 0);
|
||||
TEST_ASSERT(std::get<2>(nbrs[0]) == 3);
|
||||
TEST_ASSERT(feq(std::get<0>(nbrs[1]), 0.65289));
|
||||
TEST_ASSERT(std::get<1>(nbrs[1]) == 1);
|
||||
TEST_ASSERT(std::get<2>(nbrs[1]) == 2);
|
||||
TEST_ASSERT(feq(std::get<0>(nbrs[2]), 0.64341));
|
||||
TEST_ASSERT(std::get<1>(nbrs[2]) == 2);
|
||||
TEST_ASSERT(std::get<2>(nbrs[2]) == 1);
|
||||
TEST_ASSERT(feq(std::get<0>(nbrs[3]), 0.61940));
|
||||
TEST_ASSERT(std::get<1>(nbrs[3]) == 1);
|
||||
TEST_ASSERT(std::get<2>(nbrs[3]) == 0);
|
||||
TEST_ASSERT(feq(std::get<0>(nbrs[4]), 0.61905));
|
||||
TEST_ASSERT(std::get<1>(nbrs[4]) == 0);
|
||||
TEST_ASSERT(std::get<2>(nbrs[4]) == 0);
|
||||
TEST_ASSERT(feq(std::get<0>(nbrs[5]), 0.61344));
|
||||
TEST_ASSERT(std::get<1>(nbrs[5]) == 0);
|
||||
TEST_ASSERT(std::get<2>(nbrs[5]) == 1);
|
||||
}
|
||||
|
||||
#ifdef RDK_TEST_MULTITHREADED
|
||||
@@ -291,47 +292,47 @@ void test5MultiFPBReaderThreaded() {
|
||||
std::vector<MultiFPBReader::ResultTuple> nbrs =
|
||||
mfps.getTanimotoNeighbors(qbv, 0.6, 4);
|
||||
TEST_ASSERT(nbrs.size() == 6);
|
||||
TEST_ASSERT(feq(nbrs[0].get<0>(), 0.66412));
|
||||
TEST_ASSERT(nbrs[0].get<1>() == 0);
|
||||
TEST_ASSERT(nbrs[0].get<2>() == 3);
|
||||
TEST_ASSERT(feq(nbrs[1].get<0>(), 0.65289));
|
||||
TEST_ASSERT(nbrs[1].get<1>() == 1);
|
||||
TEST_ASSERT(nbrs[1].get<2>() == 2);
|
||||
TEST_ASSERT(feq(nbrs[2].get<0>(), 0.64341));
|
||||
TEST_ASSERT(nbrs[2].get<1>() == 2);
|
||||
TEST_ASSERT(nbrs[2].get<2>() == 1);
|
||||
TEST_ASSERT(feq(nbrs[3].get<0>(), 0.61940));
|
||||
TEST_ASSERT(nbrs[3].get<1>() == 1);
|
||||
TEST_ASSERT(nbrs[3].get<2>() == 0);
|
||||
TEST_ASSERT(feq(nbrs[4].get<0>(), 0.61905));
|
||||
TEST_ASSERT(nbrs[4].get<1>() == 0);
|
||||
TEST_ASSERT(nbrs[4].get<2>() == 0);
|
||||
TEST_ASSERT(feq(nbrs[5].get<0>(), 0.61344));
|
||||
TEST_ASSERT(nbrs[5].get<1>() == 0);
|
||||
TEST_ASSERT(nbrs[5].get<2>() == 1);
|
||||
TEST_ASSERT(feq(std::get<0>(nbrs[0]), 0.66412));
|
||||
TEST_ASSERT(std::get<1>(nbrs[0]) == 0);
|
||||
TEST_ASSERT(std::get<2>(nbrs[0]) == 3);
|
||||
TEST_ASSERT(feq(std::get<0>(nbrs[1]), 0.65289));
|
||||
TEST_ASSERT(std::get<1>(nbrs[1]) == 1);
|
||||
TEST_ASSERT(std::get<2>(nbrs[1]) == 2);
|
||||
TEST_ASSERT(feq(std::get<0>(nbrs[2]), 0.64341));
|
||||
TEST_ASSERT(std::get<1>(nbrs[2]) == 2);
|
||||
TEST_ASSERT(std::get<2>(nbrs[2]) == 1);
|
||||
TEST_ASSERT(feq(std::get<0>(nbrs[3]), 0.61940));
|
||||
TEST_ASSERT(std::get<1>(nbrs[3]) == 1);
|
||||
TEST_ASSERT(std::get<2>(nbrs[3]) == 0);
|
||||
TEST_ASSERT(feq(std::get<0>(nbrs[4]), 0.61905));
|
||||
TEST_ASSERT(std::get<1>(nbrs[4]) == 0);
|
||||
TEST_ASSERT(std::get<2>(nbrs[4]) == 0);
|
||||
TEST_ASSERT(feq(std::get<0>(nbrs[5]), 0.61344));
|
||||
TEST_ASSERT(std::get<1>(nbrs[5]) == 0);
|
||||
TEST_ASSERT(std::get<2>(nbrs[5]) == 1);
|
||||
}
|
||||
{ // request more threads than we have readers, this shouldn't be a problem
|
||||
std::vector<MultiFPBReader::ResultTuple> nbrs =
|
||||
mfps.getTanimotoNeighbors(qbv, 0.6, 8);
|
||||
TEST_ASSERT(nbrs.size() == 6);
|
||||
TEST_ASSERT(feq(nbrs[0].get<0>(), 0.66412));
|
||||
TEST_ASSERT(nbrs[0].get<1>() == 0);
|
||||
TEST_ASSERT(nbrs[0].get<2>() == 3);
|
||||
TEST_ASSERT(feq(nbrs[1].get<0>(), 0.65289));
|
||||
TEST_ASSERT(nbrs[1].get<1>() == 1);
|
||||
TEST_ASSERT(nbrs[1].get<2>() == 2);
|
||||
TEST_ASSERT(feq(nbrs[2].get<0>(), 0.64341));
|
||||
TEST_ASSERT(nbrs[2].get<1>() == 2);
|
||||
TEST_ASSERT(nbrs[2].get<2>() == 1);
|
||||
TEST_ASSERT(feq(nbrs[3].get<0>(), 0.61940));
|
||||
TEST_ASSERT(nbrs[3].get<1>() == 1);
|
||||
TEST_ASSERT(nbrs[3].get<2>() == 0);
|
||||
TEST_ASSERT(feq(nbrs[4].get<0>(), 0.61905));
|
||||
TEST_ASSERT(nbrs[4].get<1>() == 0);
|
||||
TEST_ASSERT(nbrs[4].get<2>() == 0);
|
||||
TEST_ASSERT(feq(nbrs[5].get<0>(), 0.61344));
|
||||
TEST_ASSERT(nbrs[5].get<1>() == 0);
|
||||
TEST_ASSERT(nbrs[5].get<2>() == 1);
|
||||
TEST_ASSERT(feq(std::get<0>(nbrs[0]), 0.66412));
|
||||
TEST_ASSERT(std::get<1>(nbrs[0]) == 0);
|
||||
TEST_ASSERT(std::get<2>(nbrs[0]) == 3);
|
||||
TEST_ASSERT(feq(std::get<0>(nbrs[1]), 0.65289));
|
||||
TEST_ASSERT(std::get<1>(nbrs[1]) == 1);
|
||||
TEST_ASSERT(std::get<2>(nbrs[1]) == 2);
|
||||
TEST_ASSERT(feq(std::get<0>(nbrs[2]), 0.64341));
|
||||
TEST_ASSERT(std::get<1>(nbrs[2]) == 2);
|
||||
TEST_ASSERT(std::get<2>(nbrs[2]) == 1);
|
||||
TEST_ASSERT(feq(std::get<0>(nbrs[3]), 0.61940));
|
||||
TEST_ASSERT(std::get<1>(nbrs[3]) == 1);
|
||||
TEST_ASSERT(std::get<2>(nbrs[3]) == 0);
|
||||
TEST_ASSERT(feq(std::get<0>(nbrs[4]), 0.61905));
|
||||
TEST_ASSERT(std::get<1>(nbrs[4]) == 0);
|
||||
TEST_ASSERT(std::get<2>(nbrs[4]) == 0);
|
||||
TEST_ASSERT(feq(std::get<0>(nbrs[5]), 0.61344));
|
||||
TEST_ASSERT(std::get<1>(nbrs[5]) == 0);
|
||||
TEST_ASSERT(std::get<2>(nbrs[5]) == 1);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
// $Id$
|
||||
//
|
||||
// Copyright (C) 2013 Paolo Tosco
|
||||
//
|
||||
// Copyright (C) 2004-2006 Rational Discovery LLC
|
||||
// Copyright (C) 2013-2022 Paolo Tosco and other RDKit contributors
|
||||
//
|
||||
// @@ All Rights Reserved @@
|
||||
// This file is part of the RDKit.
|
||||
@@ -35,10 +32,10 @@ double calcTorsionCosPhi(const RDGeom::Point3D &iPoint,
|
||||
return cosPhi;
|
||||
}
|
||||
|
||||
boost::tuple<double, double, double> calcTorsionForceConstant(
|
||||
std::tuple<double, double, double> calcTorsionForceConstant(
|
||||
const MMFFTor *mmffTorParams) {
|
||||
return boost::make_tuple(mmffTorParams->V1, mmffTorParams->V2,
|
||||
mmffTorParams->V3);
|
||||
return std::make_tuple(mmffTorParams->V1, mmffTorParams->V2,
|
||||
mmffTorParams->V3);
|
||||
}
|
||||
|
||||
double calcTorsionEnergy(const double V1, const double V2, const double V3,
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
//
|
||||
// Copyright (C) 2013 Paolo Tosco
|
||||
//
|
||||
// Copyright (C) 2004-2006 Rational Discovery LLC
|
||||
// Copyright (C) 2013-2022 Paolo Tosco and other RDKit contributors
|
||||
//
|
||||
// @@ All Rights Reserved @@
|
||||
// This file is part of the RDKit.
|
||||
@@ -10,11 +8,11 @@
|
||||
// of the RDKit source tree.
|
||||
//
|
||||
#include <RDGeneral/export.h>
|
||||
#ifndef __RD_MMFFTORSIONANGLE_H__
|
||||
#define __RD_MMFFTORSIONANGLE_H__
|
||||
#ifndef RD_MMFFTORSIONANGLE_H
|
||||
#define RD_MMFFTORSIONANGLE_H
|
||||
|
||||
#include <ForceField/Contrib.h>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <tuple>
|
||||
|
||||
namespace RDGeom {
|
||||
class Point3D;
|
||||
@@ -62,7 +60,7 @@ RDKIT_FORCEFIELD_EXPORT double calcTorsionCosPhi(const RDGeom::Point3D &iPoint,
|
||||
const RDGeom::Point3D &kPoint,
|
||||
const RDGeom::Point3D &lPoint);
|
||||
//! returns the 3-tuple of a torsion angle force constants
|
||||
RDKIT_FORCEFIELD_EXPORT boost::tuple<double, double, double>
|
||||
RDKIT_FORCEFIELD_EXPORT std::tuple<double, double, double>
|
||||
calcTorsionForceConstant(const MMFFTor *mmffTorParams);
|
||||
//! calculates and returns the torsional MMFF energy
|
||||
RDKIT_FORCEFIELD_EXPORT double calcTorsionEnergy(const double V1,
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
// $Id$
|
||||
//
|
||||
// Copyright (C) 2013 Paolo Tosco
|
||||
//
|
||||
// Copyright (C) 2004-2006 Rational Discovery LLC
|
||||
// Copyright (C) 2013 Paolo Tosco and other RDKit contributors
|
||||
//
|
||||
// @@ All Rights Reserved @@
|
||||
// This file is part of the RDKit.
|
||||
@@ -38,7 +35,7 @@ double calculateCosY(const RDGeom::Point3D &iPoint,
|
||||
return n.dotProduct(rJL);
|
||||
}
|
||||
|
||||
boost::tuple<double, double, double, double>
|
||||
std::tuple<double, double, double, double>
|
||||
calcInversionCoefficientsAndForceConstant(int at2AtomicNum, bool isCBoundToO) {
|
||||
double res = 0.0;
|
||||
double C0 = 0.0;
|
||||
@@ -82,7 +79,7 @@ calcInversionCoefficientsAndForceConstant(int at2AtomicNum, bool isCBoundToO) {
|
||||
}
|
||||
res /= 3.0;
|
||||
|
||||
return boost::make_tuple(res, C0, C1, C2);
|
||||
return std::make_tuple(res, C0, C1, C2);
|
||||
}
|
||||
} // end of namespace Utils
|
||||
|
||||
@@ -103,14 +100,12 @@ InversionContrib::InversionContrib(ForceField *owner, unsigned int idx1,
|
||||
d_at3Idx = idx3;
|
||||
d_at4Idx = idx4;
|
||||
|
||||
boost::tuple<double, double, double, double> invCoeffForceCon =
|
||||
Utils::calcInversionCoefficientsAndForceConstant(at2AtomicNum,
|
||||
isCBoundToO);
|
||||
d_forceConstant =
|
||||
oobForceScalingFactor * boost::tuples::get<0>(invCoeffForceCon);
|
||||
d_C0 = boost::tuples::get<1>(invCoeffForceCon);
|
||||
d_C1 = boost::tuples::get<2>(invCoeffForceCon);
|
||||
d_C2 = boost::tuples::get<3>(invCoeffForceCon);
|
||||
auto invCoeffForceCon = Utils::calcInversionCoefficientsAndForceConstant(
|
||||
at2AtomicNum, isCBoundToO);
|
||||
d_forceConstant = oobForceScalingFactor * std::get<0>(invCoeffForceCon);
|
||||
d_C0 = std::get<1>(invCoeffForceCon);
|
||||
d_C1 = std::get<2>(invCoeffForceCon);
|
||||
d_C2 = std::get<3>(invCoeffForceCon);
|
||||
}
|
||||
|
||||
double InversionContrib::getEnergy(double *pos) const {
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
//
|
||||
// Copyright (C) 2013 Paolo Tosco
|
||||
//
|
||||
// Copyright (C) 2004-2006 Rational Discovery LLC
|
||||
// Copyright (C) 2013 Paolo Tosco and other RDKit contributors
|
||||
//
|
||||
// @@ All Rights Reserved @@
|
||||
// This file is part of the RDKit.
|
||||
@@ -10,10 +8,10 @@
|
||||
// of the RDKit source tree.
|
||||
//
|
||||
#include <RDGeneral/export.h>
|
||||
#ifndef __RD_UFFINVERSION_H__
|
||||
#define __RD_UFFINVERSION_H__
|
||||
#ifndef RD_UFFINVERSION_H
|
||||
#define RD_UFFINVERSION_H
|
||||
#include <ForceField/Contrib.h>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <tuple>
|
||||
#include <Geometry/point.h>
|
||||
|
||||
namespace ForceFields {
|
||||
@@ -73,7 +71,7 @@ RDKIT_FORCEFIELD_EXPORT double calculateCosY(const RDGeom::Point3D &iPoint,
|
||||
\return the force constant
|
||||
|
||||
*/
|
||||
RDKIT_FORCEFIELD_EXPORT boost::tuple<double, double, double, double>
|
||||
RDKIT_FORCEFIELD_EXPORT std::tuple<double, double, double, double>
|
||||
calcInversionCoefficientsAndForceConstant(int at2AtomicNum, bool isCBoundToO);
|
||||
} // namespace Utils
|
||||
} // namespace UFF
|
||||
|
||||
@@ -80,7 +80,7 @@ bool chiralAtomNeedsTagInversion(const RDKit::ROMol &mol,
|
||||
}
|
||||
|
||||
auto _possibleCompare = [](const PossibleType &arg1, const PossibleType &arg2) {
|
||||
return (arg1.get<0>() < arg2.get<0>());
|
||||
return (std::get<0>(arg1) < std::get<0>(arg2));
|
||||
};
|
||||
|
||||
bool checkBondsInSameBranch(MolStack &molStack, Bond *dblBnd, Bond *dirBnd) {
|
||||
@@ -654,16 +654,16 @@ void dfsFindCycles(ROMol &mol, int atomIdx, int inBondIdx,
|
||||
std::sort(possibles.begin(), possibles.end(), _possibleCompare);
|
||||
// if (possibles.size())
|
||||
// std::cerr << " aIdx1: " << atomIdx
|
||||
// << " first: " << possibles.front().get<0>() << " "
|
||||
// << possibles.front().get<1>() << std::endl;
|
||||
// << " first: " << possibles.front()std:std::get<0>() << " "
|
||||
// << possibles.front()std:std::get<1>() << std::endl;
|
||||
// // ---------------------
|
||||
//
|
||||
// Now work the children
|
||||
//
|
||||
// ---------------------
|
||||
for (auto &possible : possibles) {
|
||||
int possibleIdx = possible.get<1>();
|
||||
Bond *bond = possible.get<2>();
|
||||
int possibleIdx = std::get<1>(possible);
|
||||
Bond *bond = std::get<2>(possible);
|
||||
switch (colors[possibleIdx]) {
|
||||
case WHITE_NODE:
|
||||
// -----
|
||||
@@ -825,8 +825,8 @@ void dfsBuildStack(ROMol &mol, int atomIdx, int inBondIdx,
|
||||
std::sort(possibles.begin(), possibles.end(), _possibleCompare);
|
||||
// if (possibles.size())
|
||||
// std::cerr << " aIdx2: " << atomIdx
|
||||
// << " first: " << possibles.front().get<0>() << " "
|
||||
// << possibles.front().get<1>() << std::endl;
|
||||
// << " first: " << possibles.front()std:std::get<0>() << " "
|
||||
// << possibles.front()std:std::get<1>() << std::endl;
|
||||
|
||||
// ---------------------
|
||||
//
|
||||
@@ -835,14 +835,14 @@ void dfsBuildStack(ROMol &mol, int atomIdx, int inBondIdx,
|
||||
// ---------------------
|
||||
for (auto possiblesIt = possibles.begin(); possiblesIt != possibles.end();
|
||||
possiblesIt++) {
|
||||
int possibleIdx = possiblesIt->get<1>();
|
||||
int possibleIdx = std::get<1>(*possiblesIt);
|
||||
if (colors[possibleIdx] != WHITE_NODE) {
|
||||
// we're either done or it's a ring-closure, which we already processed...
|
||||
// this test isn't strictly required, because we only added WHITE notes to
|
||||
// the possibles list, but it seems logical to document it
|
||||
continue;
|
||||
}
|
||||
Bond *bond = possiblesIt->get<2>();
|
||||
Bond *bond = std::get<2>(*possiblesIt);
|
||||
Atom *otherAtom = mol.getAtomWithIdx(possibleIdx);
|
||||
// ww might have some residual data from earlier calls, clean that up:
|
||||
otherAtom->clearProp(common_properties::_TraversalBondIndexOrder);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (C) 2004-2006 Rational Discovery LLC
|
||||
// Copyright (C) 2004-2022 Greg Landrum and other RDKit contributors
|
||||
//
|
||||
// @@ All Rights Reserved @@
|
||||
// This file is part of the RDKit.
|
||||
@@ -8,11 +8,11 @@
|
||||
// of the RDKit source tree.
|
||||
//
|
||||
#include <RDGeneral/export.h>
|
||||
#ifndef _RD_CANON_H_
|
||||
#define _RD_CANON_H_
|
||||
#ifndef RD_CANON_H
|
||||
#define RD_CANON_H
|
||||
|
||||
#include <RDGeneral/BoostStartInclude.h>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <tuple>
|
||||
#include <boost/dynamic_bitset.hpp>
|
||||
#include <RDGeneral/BoostEndInclude.h>
|
||||
|
||||
@@ -95,7 +95,7 @@ class RDKIT_GRAPHMOL_EXPORT MolStackElem {
|
||||
typedef std::vector<MolStackElem> MolStack;
|
||||
|
||||
//! used to represent possible branches from an atom
|
||||
typedef boost::tuple<int, int, Bond *> PossibleType;
|
||||
typedef std::tuple<int, int, Bond *> PossibleType;
|
||||
|
||||
//! constructs the canonical traversal order for a molecular fragment
|
||||
/*!
|
||||
|
||||
@@ -18,8 +18,6 @@
|
||||
#include <GraphMol/SmilesParse/SmilesParse.h>
|
||||
#include <GraphMol/Substruct/SubstructMatch.h>
|
||||
#include <boost/dynamic_bitset.hpp>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/tuple/tuple_comparison.hpp>
|
||||
#include <algorithm>
|
||||
#include <RDGeneral/BoostStartInclude.h>
|
||||
#include <boost/flyweight.hpp>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include <DataStructs/SparseIntVect.h>
|
||||
#include <DataStructs/BitVects.h>
|
||||
#include <cstdint>
|
||||
|
||||
#include <tuple>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <DataStructs/ExplicitBitVect.h>
|
||||
@@ -95,8 +95,7 @@ class RDKIT_FINGERPRINTS_EXPORT ss_matcher {
|
||||
RDKit::ROMOL_SPTR m_matcher;
|
||||
};
|
||||
|
||||
typedef boost::tuple<boost::dynamic_bitset<>, uint32_t, unsigned int>
|
||||
AccumTuple;
|
||||
typedef std::tuple<boost::dynamic_bitset<>, uint32_t, unsigned int> AccumTuple;
|
||||
|
||||
RDKIT_FINGERPRINTS_EXPORT extern std::vector<std::string> defaultFeatureSmarts;
|
||||
|
||||
|
||||
@@ -41,8 +41,6 @@
|
||||
|
||||
#include <RDGeneral/BoostStartInclude.h>
|
||||
#include <boost/dynamic_bitset.hpp>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/tuple/tuple_comparison.hpp>
|
||||
#include <RDGeneral/BoostEndInclude.h>
|
||||
|
||||
#include <algorithm>
|
||||
@@ -245,8 +243,8 @@ void calcFingerprint(const ROMol &mol, unsigned int radius,
|
||||
}
|
||||
roundInvariants[atomIdx] = static_cast<uint32_t>(invar);
|
||||
neighborhoodsThisRound.push_back(
|
||||
boost::make_tuple(roundAtomNeighborhoods[atomIdx],
|
||||
static_cast<uint32_t>(invar), atomIdx));
|
||||
std::make_tuple(roundAtomNeighborhoods[atomIdx],
|
||||
static_cast<uint32_t>(invar), atomIdx));
|
||||
if (!includeRedundantEnvironments &&
|
||||
std::find(neighborhoods.begin(), neighborhoods.end(),
|
||||
roundAtomNeighborhoods[atomIdx]) != neighborhoods.end()) {
|
||||
@@ -265,28 +263,28 @@ void calcFingerprint(const ROMol &mol, unsigned int radius,
|
||||
// fingerprint:
|
||||
if (includeRedundantEnvironments ||
|
||||
std::find(neighborhoods.begin(), neighborhoods.end(),
|
||||
iter->get<0>()) == neighborhoods.end()) {
|
||||
if (!onlyNonzeroInvariants || invariantCpy[iter->get<2>()]) {
|
||||
if (includeAtoms[iter->get<2>()]) {
|
||||
uint32_t bit = updateElement(res, iter->get<1>(), useCounts);
|
||||
std::get<0>(*iter)) == neighborhoods.end()) {
|
||||
if (!onlyNonzeroInvariants || invariantCpy[std::get<2>(*iter)]) {
|
||||
if (includeAtoms[std::get<2>(*iter)]) {
|
||||
uint32_t bit = updateElement(res, std::get<1>(*iter), useCounts);
|
||||
if (atomsSettingBits) {
|
||||
(*atomsSettingBits)[bit].push_back(
|
||||
std::make_pair(iter->get<2>(), layer + 1));
|
||||
std::make_pair(std::get<2>(*iter), layer + 1));
|
||||
}
|
||||
}
|
||||
if (!fromAtoms || std::find(fromAtoms->begin(), fromAtoms->end(),
|
||||
iter->get<2>()) != fromAtoms->end()) {
|
||||
neighborhoods.push_back(iter->get<0>());
|
||||
std::get<2>(*iter)) != fromAtoms->end()) {
|
||||
neighborhoods.push_back(std::get<0>(*iter));
|
||||
}
|
||||
}
|
||||
// std::cerr<<" layer: "<<layer<<" atom: "<<iter->get<2>()<<" "
|
||||
// <<iter->get<0>()<< " " << iter->get<1>() << " " <<
|
||||
// deadAtoms[iter->get<2>()]<<std::endl;
|
||||
// std::cerr<<" layer: "<<layer<<" atom: "<<std::get<2>(*iter)<<" "
|
||||
// <<std::get<0>(*iter)<< " " << std::get<1>(*iter) << " " <<
|
||||
// deadAtoms[std::get<2>(*iter)]<<std::endl;
|
||||
} else {
|
||||
// we have seen this exact environment before, this atom
|
||||
// is now out of consideration:
|
||||
// std::cerr<<" atom: "<< iter->get<2>()<<" is dead."<<std::endl;
|
||||
deadAtoms[iter->get<2>()] = 1;
|
||||
// std::cerr<<" atom: "<< std::get<2>(*iter)<<" is dead."<<std::endl;
|
||||
deadAtoms[std::get<2>(*iter)] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,8 +17,7 @@
|
||||
|
||||
#include <RDGeneral/BoostStartInclude.h>
|
||||
#include <boost/dynamic_bitset.hpp>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/tuple/tuple_comparison.hpp>
|
||||
#include <tuple>
|
||||
#include <RDGeneral/BoostEndInclude.h>
|
||||
|
||||
#include <GraphMol/Fingerprints/FingerprintUtil.h>
|
||||
@@ -320,8 +319,8 @@ MorganEnvGenerator<OutputType>::getEnvironments(
|
||||
// store the environment that generated this bit id along with the bit
|
||||
// id and the atom id
|
||||
allNeighborhoodsThisRound.push_back(
|
||||
boost::make_tuple(roundAtomNeighborhoods[atomIdx],
|
||||
static_cast<OutputType>(invar), atomIdx));
|
||||
std::make_tuple(roundAtomNeighborhoods[atomIdx],
|
||||
static_cast<OutputType>(invar), atomIdx));
|
||||
if (std::find(neighborhoods.begin(), neighborhoods.end(),
|
||||
roundAtomNeighborhoods[atomIdx]) != neighborhoods.end()) {
|
||||
// we have seen this exact environment before, this atom
|
||||
@@ -340,19 +339,19 @@ MorganEnvGenerator<OutputType>::getEnvironments(
|
||||
// result
|
||||
if (morganArguments->df_includeRedundantEnvironments ||
|
||||
std::find(neighborhoods.begin(), neighborhoods.end(),
|
||||
iter->get<0>()) == neighborhoods.end()) {
|
||||
std::get<0>(*iter)) == neighborhoods.end()) {
|
||||
if (!morganArguments->df_onlyNonzeroInvariants ||
|
||||
(*atomInvariants)[iter->get<2>()]) {
|
||||
if (includeAtoms[iter->get<2>()]) {
|
||||
(*atomInvariants)[std::get<2>(*iter)]) {
|
||||
if (includeAtoms[std::get<2>(*iter)]) {
|
||||
result.push_back(new MorganAtomEnv<OutputType>(
|
||||
iter->get<1>(), iter->get<2>(), layer + 1));
|
||||
neighborhoods.push_back(iter->get<0>());
|
||||
std::get<1>(*iter), std::get<2>(*iter), layer + 1));
|
||||
neighborhoods.push_back(std::get<0>(*iter));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// we have seen this exact environment before, this atom
|
||||
// is now out of consideration:
|
||||
deadAtoms[iter->get<2>()] = 1;
|
||||
deadAtoms[std::get<2>(*iter)] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
//
|
||||
// Copyright (C) 2015 Sereina Riniker
|
||||
//
|
||||
// Copyright (C) 2004-2006 Rational Discovery LLC
|
||||
// Copyright (C) 2015 Sereina Riniker and other RDKit contributors
|
||||
//
|
||||
// @@ All Rights Reserved @@
|
||||
// This file is part of the RDKit.
|
||||
@@ -14,7 +12,7 @@
|
||||
#define RD_TORSIONANGLEM6_H
|
||||
|
||||
#include <ForceField/Contrib.h>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <tuple>
|
||||
#include <vector>
|
||||
|
||||
namespace RDGeom {
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
//
|
||||
// Copyright (C) 2013-2018 Paolo Tosco
|
||||
//
|
||||
// Copyright (C) 2004-2006 Rational Discovery LLC
|
||||
// Copyright (C) 2013-2022 Paolo Tosco and other RDKit contributors
|
||||
//
|
||||
// @@ All Rights Reserved @@
|
||||
// This file is part of the RDKit.
|
||||
@@ -21,7 +19,7 @@
|
||||
#include <mutex>
|
||||
#endif
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <tuple>
|
||||
#include <cstdint>
|
||||
|
||||
namespace ForceFields {
|
||||
|
||||
@@ -703,10 +703,10 @@ bool getUFFInversionParams(const ROMol &mol, unsigned int idx1,
|
||||
}
|
||||
if (res) {
|
||||
isBoundToSP2O = (isBoundToSP2O && (at2AtomicNum == 6));
|
||||
boost::tuple<double, double, double, double> invCoeffForceCon =
|
||||
auto invCoeffForceCon =
|
||||
UFF::Utils::calcInversionCoefficientsAndForceConstant(at2AtomicNum,
|
||||
isBoundToSP2O);
|
||||
uffInversionParams.K = boost::tuples::get<0>(invCoeffForceCon);
|
||||
uffInversionParams.K = std::get<0>(invCoeffForceCon);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// $Id$
|
||||
//
|
||||
// Copyright (C) 2003-2009 Greg Landrum and Rational Discovery LLC
|
||||
// Copyright (C) 2003-2022 Greg Landrum and other RDKit contributors
|
||||
//
|
||||
// @@ All Rights Reserved @@
|
||||
// This file is part of the RDKit.
|
||||
@@ -22,6 +21,7 @@
|
||||
#include <fstream>
|
||||
#include <cstdint>
|
||||
#include <RDGeneral/hash/hash.hpp>
|
||||
#include <tuple>
|
||||
|
||||
namespace RDKit {
|
||||
|
||||
@@ -127,23 +127,12 @@ bool FragCatalogEntry::match(const FragCatalogEntry *other, double tol) const {
|
||||
Subgraphs::DiscrimTuple tdiscs, odiscs;
|
||||
odiscs = other->getDiscrims();
|
||||
|
||||
// double x1 = boost::tuples::get<0>(odiscs);
|
||||
// std::cout << x1 << "\n";
|
||||
tdiscs = this->getDiscrims();
|
||||
#if 0
|
||||
std::cout << "DISCRIMS: " << d_descrip << " ";
|
||||
std::cout << tdiscs.get<0>() << " " << tdiscs.get<1>() << " " << tdiscs.get<2>();
|
||||
std::cout << " -- "<<odiscs.get<0>() << " " << odiscs.get<1>() << " " << odiscs.get<2>();
|
||||
std::cout << std::endl;
|
||||
#endif
|
||||
// REVIEW: need an overload of feq that handles tuples in MolOps, or wherever
|
||||
// DiscrimTuple is defined
|
||||
if (!(feq(boost::tuples::get<0>(tdiscs), boost::tuples::get<0>(odiscs),
|
||||
tol)) ||
|
||||
!(feq(boost::tuples::get<1>(tdiscs), boost::tuples::get<1>(odiscs),
|
||||
tol)) ||
|
||||
!(feq(boost::tuples::get<2>(tdiscs), boost::tuples::get<2>(odiscs),
|
||||
tol))) {
|
||||
if (!(feq(std::get<0>(tdiscs), std::get<0>(odiscs), tol)) ||
|
||||
!(feq(std::get<1>(tdiscs), std::get<1>(odiscs), tol)) ||
|
||||
!(feq(std::get<2>(tdiscs), std::get<2>(odiscs), tol))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// $Id$
|
||||
//
|
||||
// Copyright (C) 2003-2006 Rational Discovery LLC
|
||||
// Copyright (C) 2003-2022 Greg Landrum and other RDKit contributors
|
||||
//
|
||||
// @@ All Rights Reserved @@
|
||||
// This file is part of the RDKit.
|
||||
@@ -104,9 +103,9 @@ DOUBLE_VECT GetBitDiscrims(const FragCatalog *self, unsigned int idx) {
|
||||
DOUBLE_VECT res;
|
||||
const FragCatalogEntry *entry = self->getEntryWithBitId(idx);
|
||||
Subgraphs::DiscrimTuple tmp = entry->getDiscrims();
|
||||
res.push_back(tmp.get<0>());
|
||||
res.push_back(tmp.get<1>());
|
||||
res.push_back(tmp.get<2>());
|
||||
res.push_back(std::get<0>(tmp));
|
||||
res.push_back(std::get<1>(tmp));
|
||||
res.push_back(std::get<2>(tmp));
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,6 @@
|
||||
#include <memory>
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/tuple/tuple_comparison.hpp>
|
||||
#include <boost/assign/list_of.hpp>
|
||||
#include <boost/format.hpp>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (C) 2015-2020 Greg Landrum
|
||||
// Copyright (C) 2015-2022 Greg Landrum and other RDKit contributors
|
||||
//
|
||||
// @@ All Rights Reserved @@
|
||||
// This file is part of the RDKit.
|
||||
@@ -18,7 +18,7 @@
|
||||
#include <GraphMol/RDKitBase.h>
|
||||
#include <GraphMol/MolDraw2D/MolDraw2D.h>
|
||||
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <tuple>
|
||||
#include <boost/format.hpp>
|
||||
|
||||
// ****************************************************************************
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#define MOLDRAW2DUTILS_H
|
||||
#include <GraphMol/RWMol.h>
|
||||
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <tuple>
|
||||
|
||||
// ****************************************************************************
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
//
|
||||
// Copyright (C) 2016 Novartis Institutes for BioMedical Research
|
||||
// Copyright (C) 2016-2022 Novartis Institutes for BioMedical Research and
|
||||
// other RDKit contributors
|
||||
//
|
||||
// @@ All Rights Reserved @@
|
||||
// This file is part of the RDKit.
|
||||
@@ -11,6 +12,8 @@
|
||||
#include "../../Geometry/point.h"
|
||||
#include "Utilites.h"
|
||||
#include <algorithm>
|
||||
#include <tuple>
|
||||
|
||||
namespace RDKit {
|
||||
namespace StructureCheck {
|
||||
|
||||
@@ -56,7 +59,7 @@ bool getMolAtomPoints(const ROMol &mol, std::vector<RDGeom::Point3D> &atomPoint,
|
||||
return non_zero_z;
|
||||
}
|
||||
|
||||
typedef boost::tuple<std::string, int, int, int> NbrData;
|
||||
typedef std::tuple<std::string, int, int, int> NbrData;
|
||||
|
||||
bool lessTuple(const NbrData &left, const NbrData &right) {
|
||||
if (left.get<0>() < right.get<0>()) return true;
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
#include <boost/tuple/tuple_comparison.hpp>
|
||||
#include <RDGeneral/hash/hash.hpp>
|
||||
|
||||
namespace RDKit {
|
||||
@@ -218,7 +217,7 @@ DiscrimTuple calcPathDiscriminators(const ROMol &mol, const PATH_TYPE &path,
|
||||
|
||||
// also include the path size (bond count) and number of atoms
|
||||
// in the discriminator
|
||||
return boost::make_tuple(pathInvar, path.size(), nAtoms);
|
||||
return std::make_tuple(pathInvar, path.size(), nAtoms);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (C) 2003-2009 Greg Landrum and Rational Discovery LLC
|
||||
// Copyright (C) 2003-2022 Greg Landrum and other RDKit contributors
|
||||
//
|
||||
// @@ All Rights Reserved @@
|
||||
// This file is part of the RDKit.
|
||||
@@ -8,12 +8,12 @@
|
||||
// of the RDKit source tree.
|
||||
//
|
||||
#include <RDGeneral/export.h>
|
||||
#ifndef _RD_SUBGRAPHUTILS_H_
|
||||
#define _RD_SUBGRAPHUTILS_H_
|
||||
#ifndef RD_SUBGRAPHUTILS_H
|
||||
#define RD_SUBGRAPHUTILS_H
|
||||
|
||||
#include "Subgraphs.h"
|
||||
#include <RDGeneral/BoostStartInclude.h>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <tuple>
|
||||
#include <RDGeneral/BoostEndInclude.h>
|
||||
|
||||
#include <cstdint>
|
||||
@@ -23,8 +23,7 @@ class ROMol;
|
||||
|
||||
namespace Subgraphs {
|
||||
//! used to return path discriminators (three unsigned ints):
|
||||
typedef boost::tuples::tuple<std::uint32_t, std::uint32_t, std::uint32_t>
|
||||
DiscrimTuple;
|
||||
typedef std::tuple<std::uint32_t, std::uint32_t, std::uint32_t> DiscrimTuple;
|
||||
|
||||
RDKIT_SUBGRAPHS_EXPORT DiscrimTuple calcPathDiscriminators(
|
||||
const ROMol &mol, const PATH_TYPE &path, bool useBO = true,
|
||||
|
||||
@@ -29,11 +29,10 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
%include "boost_tuple.i"
|
||||
%include "std_vector.i"
|
||||
%include "std_map.i"
|
||||
%include "std_pair.i"
|
||||
%include "boost_tuple.i"
|
||||
%include "std_tuple.i"
|
||||
%{
|
||||
#include <GraphMol/RDKitBase.h>
|
||||
#include <GraphMol/MolDraw2D/MolDraw2DHelpers.h>
|
||||
|
||||
@@ -41,9 +41,9 @@
|
||||
std::vector<int> calcPathDiscriminators(RDKit::ROMol &mol,RDKit::PATH_TYPE &path){
|
||||
std::vector<int> res(3);
|
||||
RDKit::Subgraphs::DiscrimTuple tpl=RDKit::Subgraphs::calcPathDiscriminators(mol,path);
|
||||
res[0]=boost::get<0>(tpl);
|
||||
res[1]=boost::get<1>(tpl);
|
||||
res[2]=boost::get<2>(tpl);
|
||||
res[0]=std::get<0>(tpl);
|
||||
res[1]=std::get<1>(tpl);
|
||||
res[2]=std::get<2>(tpl);
|
||||
return res;
|
||||
}
|
||||
%}
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
/*
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2015, Greg Landrum
|
||||
* 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.
|
||||
*
|
||||
* taken from this stackexchange answer: http://stackoverflow.com/a/12768318
|
||||
*/
|
||||
%{
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
%}
|
||||
|
||||
namespace boost {
|
||||
template <typename T1=void, typename T2=void, typename T3=void>
|
||||
struct tuple;
|
||||
|
||||
template <>
|
||||
struct tuple<void,void,void> {
|
||||
};
|
||||
|
||||
template <typename T1>
|
||||
struct tuple<T1, void, void> {
|
||||
tuple(T1);
|
||||
%extend {
|
||||
T1 first() const {
|
||||
return boost::get<0>(*$self);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T1, typename T2>
|
||||
struct tuple <T1, T2, void> {
|
||||
tuple(T1,T2);
|
||||
%extend {
|
||||
T1 first() const {
|
||||
return boost::get<0>(*$self);
|
||||
}
|
||||
T2 second() const {
|
||||
return boost::get<1>(*$self);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T1, typename T2, typename T3>
|
||||
struct tuple <T1,T2,T3> {
|
||||
tuple(T1,T2,T3);
|
||||
%extend {
|
||||
T1 first() const {
|
||||
return boost::get<0>(*$self);
|
||||
}
|
||||
T2 second() const {
|
||||
return boost::get<1>(*$self);
|
||||
}
|
||||
T3 third() const {
|
||||
return boost::get<2>(*$self);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
63
Code/JavaWrappers/std_tuple.i
Normal file
63
Code/JavaWrappers/std_tuple.i
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2015-2022, Greg Landrum
|
||||
* 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.
|
||||
*
|
||||
* adapted from this stackexchange answer: https://stackoverflow.com/a/72849351
|
||||
*/
|
||||
// [1]
|
||||
%{
|
||||
#include <tuple>
|
||||
#include <utility>
|
||||
%}
|
||||
|
||||
// [2]
|
||||
#define make_getter(pos, type) const type& get##pos() const { return std::get<pos>(*$self); }
|
||||
#define make_setter(pos, type) void set##pos(const type& val) { std::get<pos>(*$self) = val; }
|
||||
#define make_ctorargN(pos, type) , type v##pos
|
||||
#define make_ctorarg(first, ...) const first& v0 FOR_EACH(make_ctorargN, __VA_ARGS__)
|
||||
|
||||
// [3]
|
||||
#define FE_0(...)
|
||||
#define FE_1(action,a1) action(0,a1)
|
||||
#define FE_2(action,a1,a2) action(0,a1) action(1,a2)
|
||||
#define FE_3(action,a1,a2,a3) action(0,a1) action(1,a2) action(2,a3)
|
||||
#define FE_4(action,a1,a2,a3,a4) action(0,a1) action(1,a2) action(2,a3) action(3,a4)
|
||||
#define FE_5(action,a1,a2,a3,a4,a5) action(0,a1) action(1,a2) action(2,a3) action(3,a4) action(4,a5)
|
||||
|
||||
#define GET_MACRO(_1,_2,_3,_4,_5,NAME,...) NAME
|
||||
%define FOR_EACH(action,...)
|
||||
GET_MACRO(__VA_ARGS__, FE_5, FE_4, FE_3, FE_2, FE_1, FE_0)(action,__VA_ARGS__)
|
||||
%enddef
|
||||
|
||||
// [4]
|
||||
%define %std_tuple(Name, ...)
|
||||
%rename(Name) std::tuple<__VA_ARGS__>;
|
||||
namespace std {
|
||||
struct tuple<__VA_ARGS__> {
|
||||
// [5]
|
||||
tuple(make_ctorarg(__VA_ARGS__));
|
||||
%extend {
|
||||
// [6]
|
||||
FOR_EACH(make_getter, __VA_ARGS__)
|
||||
FOR_EACH(make_setter, __VA_ARGS__)
|
||||
size_t __len__() const { return std::tuple_size<std::decay_t<decltype(*$self)>>{}; }
|
||||
%pythoncode %{
|
||||
# [7]
|
||||
def __getitem__(self, n):
|
||||
if n >= len(self): raise IndexError()
|
||||
return getattr(self, 'get%d' % n)()
|
||||
def __setitem__(self, n, val):
|
||||
if n >= len(self): raise IndexError()
|
||||
getattr(self, 'set%d' % n)(val)
|
||||
%}
|
||||
}
|
||||
};
|
||||
}
|
||||
%enddef
|
||||
16
External/INCHI-API/inchi.cpp
vendored
16
External/INCHI-API/inchi.cpp
vendored
@@ -1,5 +1,6 @@
|
||||
//
|
||||
// Copyright (c) 2011, Novartis Institutes for BioMedical Research Inc.
|
||||
// Copyright (c) 2011-2022 Novartis Institutes for BioMedical Research Inc. and
|
||||
// other RDkit contributors
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
@@ -70,7 +71,7 @@
|
||||
#include <algorithm>
|
||||
|
||||
#include <RDGeneral/BoostStartInclude.h>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <tuple>
|
||||
#include <RDGeneral/BoostEndInclude.h>
|
||||
|
||||
//#define DEBUG 1
|
||||
@@ -1277,7 +1278,7 @@ RWMol* InchiToMol(const std::string& inchi, ExtraInchiReturnValues& rv,
|
||||
}
|
||||
|
||||
// for isotopes of H
|
||||
typedef std::vector<boost::tuple<unsigned int, unsigned int, unsigned int>>
|
||||
typedef std::vector<std::tuple<unsigned int, unsigned int, unsigned int>>
|
||||
ISOTOPES_t;
|
||||
ISOTOPES_t isotopes;
|
||||
if (retcode == inchi_Ret_OKAY || retcode == inchi_Ret_WARNING) {
|
||||
@@ -1314,11 +1315,11 @@ RWMol* InchiToMol(const std::string& inchi, ExtraInchiReturnValues& rv,
|
||||
// number of hydrogens
|
||||
atom->setNumExplicitHs(inchiAtom->num_iso_H[0]);
|
||||
if (inchiAtom->num_iso_H[1]) {
|
||||
isotopes.push_back(boost::make_tuple(1, i, inchiAtom->num_iso_H[1]));
|
||||
isotopes.push_back(std::make_tuple(1, i, inchiAtom->num_iso_H[1]));
|
||||
} else if (inchiAtom->num_iso_H[2]) {
|
||||
isotopes.push_back(boost::make_tuple(2, i, inchiAtom->num_iso_H[2]));
|
||||
isotopes.push_back(std::make_tuple(2, i, inchiAtom->num_iso_H[2]));
|
||||
} else if (inchiAtom->num_iso_H[3]) {
|
||||
isotopes.push_back(boost::make_tuple(3, i, inchiAtom->num_iso_H[3]));
|
||||
isotopes.push_back(std::make_tuple(3, i, inchiAtom->num_iso_H[3]));
|
||||
}
|
||||
// at this point the molecule has all Hs it should have. Set the
|
||||
// noImplicit flag so
|
||||
@@ -1397,8 +1398,7 @@ RWMol* InchiToMol(const std::string& inchi, ExtraInchiReturnValues& rv,
|
||||
|
||||
// adding isotopes at the end
|
||||
for (auto& ii : isotopes) {
|
||||
unsigned int isotope, aid, repeat;
|
||||
boost::tie(isotope, aid, repeat) = ii;
|
||||
auto [isotope, aid, repeat] = ii;
|
||||
aid = indexToAtomIndexMapping[aid];
|
||||
for (unsigned int i = 0; i < repeat; i++) {
|
||||
// create atom
|
||||
|
||||
Reference in New Issue
Block a user