Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decrease volumeTolerance threshold to calculate chirality on molecules #7376

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Code/GraphMol/Chirality.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ namespace Chirality {

std::optional<Atom::ChiralType> atomChiralTypeFromBondDirPseudo3D(
const ROMol &mol, const Bond *bond, const Conformer *conf,
double pseudo3DOffset = 0.1, double volumeTolerance = 0.01) {
double pseudo3DOffset = 0.1, double volumeTolerance = 1e-3) {
PRECONDITION(bond, "no bond");
PRECONDITION(conf, "no conformer");
auto bondDir = bond->getBondDir();
Expand Down
48 changes: 48 additions & 0 deletions Code/GraphMol/catch_chirality.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5380,3 +5380,51 @@ M END)CTAB"_ctab;
CHECK(cAt0->getProp<std::string>(common_properties::_CIPCode) ==
cAt1->getProp<std::string>(common_properties::_CIPCode));
}

TEST_CASE(
"GitHub Issue #7070: zero final chiral volume on scaled molecules") {
const auto mlarge = R"CTAB(
MM V3K 01017000002D

0 0 0 0 0 999 V3000
M V30 BEGIN CTAB
M V30 COUNTS 5 4 0 0 1
M V30 BEGIN ATOM
M V30 1 C 264.49 -311.16 0 0
M V30 2 C 278.9 -311.16 0 0
M V30 3 O 286.1 -298.69 0 0
M V30 4 C 286.1 -323.63 0 0
M V30 5 C 278.9 -336.1 0 0
M V30 END ATOM
M V30 BEGIN BOND
M V30 1 1 1 2
M V30 2 1 2 3 CFG=3
M V30 3 1 2 4
M V30 4 1 4 5
M V30 END BOND
M V30 END CTAB
M END)CTAB"_ctab;
const auto mscaled = R"CTAB(
MM V3K 01017000002D

0 0 0 0 0 999 V3000
M V30 BEGIN CTAB
M V30 COUNTS 5 4 0 0 1
M V30 BEGIN ATOM
M V30 1 C 26.449 -31.116 0 0
M V30 2 C 27.89 -31.116 0 0
M V30 3 O 28.61 -29.869 0 0
M V30 4 C 28.61 -32.363 0 0
M V30 5 C 27.89 -33.61 0 0
M V30 END ATOM
M V30 BEGIN BOND
M V30 1 1 1 2
M V30 2 1 2 3 CFG=3
M V30 3 1 2 4
M V30 4 1 4 5
M V30 END BOND
M V30 END CTAB
M END)CTAB"_ctab;
CHECK(MolToSmiles(*mlarge) == "CC[C@H](C)O");
CHECK(MolToSmiles(*mscaled) == "CC[C@H](C)O");
}
4 changes: 2 additions & 2 deletions rdkit/Chem/UnitTestInchi.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,9 @@ def test0InchiWritePubChem(self):

fmt = "\n{0}InChI write Summary: {1} identical, {2} suffix variance, {3} reasonable{4}"
print(fmt.format(COLOR_GREEN, same, diff, reasonable, COLOR_RESET))
self.assertEqual(same, 1160)
self.assertEqual(same, 1162)
self.assertEqual(diff, 0)
self.assertEqual(reasonable, 21)
self.assertEqual(reasonable, 19)

def test1InchiReadPubChem(self):
for f in self.dataset.values():
Expand Down