mirror of
https://github.com/rdkit/rdkit.git
synced 2026-06-03 21:44:30 +08:00
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (C) David Cosgrove 2025.
|
||||
// Copyright (C) 2025 David Cosgrove and other RDKit contributors.
|
||||
//
|
||||
// @@ All Rights Reserved @@
|
||||
// This file is part of the RDKit.
|
||||
@@ -34,7 +34,8 @@ StereoisomerEnumerator::StereoisomerEnumerator(
|
||||
atom->clearProp("_CIPCode");
|
||||
}
|
||||
for (auto bond : d_mol.bonds()) {
|
||||
if (bond->getBondDir() == Bond::BondDir::EITHERDOUBLE) {
|
||||
if (bond->getBondDir() == Bond::BondDir::EITHERDOUBLE ||
|
||||
bond->getBondDir() == Bond::BondDir::UNKNOWN) {
|
||||
bond->setBondDir(Bond::BondDir::NONE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (C) David Cosgrove 2025.
|
||||
// Copyright (C) 2025 David Cosgrove and other RDKit contributors.
|
||||
//
|
||||
// @@ All Rights Reserved @@
|
||||
// This file is part of the RDKit.
|
||||
@@ -522,3 +522,34 @@ M END)CTAB"_ctab;
|
||||
CHECK(got.size() == 2);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("wiggly bonds and EnumerateStereoisomers") {
|
||||
SECTION("as reported (bonds)") {
|
||||
auto m1 = "CC=CC |w:1.0|"_smiles;
|
||||
REQUIRE(m1);
|
||||
StereoEnumerationOptions opts;
|
||||
opts.onlyUnassigned = false;
|
||||
StereoisomerEnumerator enu1(*m1, opts);
|
||||
std::vector<std::string> got;
|
||||
while (auto isomer = enu1.next()) {
|
||||
got.push_back(MolToSmiles(*isomer));
|
||||
}
|
||||
CHECK(got.size() == 2);
|
||||
CHECK(std::find(got.begin(), got.end(), "C/C=C/C") != got.end());
|
||||
CHECK(std::find(got.begin(), got.end(), "C/C=C\\C") != got.end());
|
||||
}
|
||||
SECTION("chiral centers") {
|
||||
auto m1 = "CC(F)(Cl)(Br) |w:1.0|"_smiles;
|
||||
REQUIRE(m1);
|
||||
StereoEnumerationOptions opts;
|
||||
opts.onlyUnassigned = false;
|
||||
StereoisomerEnumerator enu1(*m1, opts);
|
||||
std::vector<std::string> got;
|
||||
while (auto isomer = enu1.next()) {
|
||||
got.push_back(MolToSmiles(*isomer));
|
||||
}
|
||||
CHECK(got.size() == 2);
|
||||
CHECK(std::find(got.begin(), got.end(), "C[C@](F)(Cl)Br") != got.end());
|
||||
CHECK(std::find(got.begin(), got.end(), "C[C@@](F)(Cl)Br") != got.end());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user