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

Prefer wedging ring bonds around atropisomers #7373

Merged
merged 10 commits into from
May 8, 2024
30 changes: 18 additions & 12 deletions Code/GraphMol/Atropisomers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,12 @@ bool WedgeBondFromAtropisomerOneBond2d(
}

// did not find a good bond dir - pick one to use
// we would like to have one that is not in a ring, and will be a wedge
// we would like to have one that is in a ring, and will favor it being a
// wedge

// We favor rings here because wedging non-ring bonds makes it too likely that
// we'll end up accidentally creating new atropisomeric bonds. This was github
// issue 7371

const RingInfo *ri = bond->getOwningMol().getRingInfo();

Expand Down Expand Up @@ -628,11 +633,12 @@ bool WedgeBondFromAtropisomerOneBond2d(
}
}
auto ringCount = ri->numBondRings(bondToTry->getIdx());
if (!ringCount) {
ringCount = 10;
bp-kelley marked this conversation as resolved.
Show resolved Hide resolved
}
if (ringCount > bestRingCount) {
continue;
}

else if (ringCount < bestRingCount) {
} else if (ringCount < bestRingCount) {
bestBondEnd = whichEnd;
bestBondNumber = whichBond;
bestRingCount = ringCount;
Expand Down Expand Up @@ -669,8 +675,8 @@ bool WedgeBondFromAtropisomerOneBond2d(
}
}

if (bestBondEnd >= 0) // we found a good one
{
if (bestBondEnd >= 0) {
bp-kelley marked this conversation as resolved.
Show resolved Hide resolved
// we found a good one
// make sure the atoms on the bond are in the right order for the
// wedge/hash the atom on the end of the main bond must be listed
// first for the wedge/has bond
Expand All @@ -680,7 +686,6 @@ bool WedgeBondFromAtropisomerOneBond2d(
bestBond->setEndAtom(bestBond->getBeginAtom());
bestBond->setBeginAtom(atomAndBondVecs[bestBondEnd].first);
}
// bonds[bestBondEnd][bestBondNumber]->setBondDir(bestBondDir);
auto newWedgeInfo = std::unique_ptr<RDKit::Chirality::WedgeInfoBase>(
new RDKit::Chirality::WedgeInfoAtropisomer(bond->getIdx(),
bestBondDir));
Expand Down Expand Up @@ -796,11 +801,12 @@ bool WedgeBondFromAtropisomerOneBond3d(
}
}
auto ringCount = ri->numBondRings(bondToTry->getIdx());
if (!ringCount) {
ringCount = 10;
}
if (ringCount > bestRingCount) {
continue;
}

else if (ringCount < bestRingCount) {
} else if (ringCount < bestRingCount) {
bestBond = bondToTry;
bestBondEnd = whichEnd;
bestRingCount = ringCount;
Expand Down Expand Up @@ -833,7 +839,8 @@ bool WedgeBondFromAtropisomerOneBond3d(
}
}

if (bestBond != nullptr) { // we found a good one
if (bestBond != nullptr) {
// we found a good one

// make sure the atoms on the bond are in the right order for the
// wedge/hash the atom on the end of the main bond must be listed
Expand All @@ -843,7 +850,6 @@ bool WedgeBondFromAtropisomerOneBond3d(
bestBond->setEndAtom(bestBond->getBeginAtom());
bestBond->setBeginAtom(atomAndBondVecs[bestBondEnd].first);
}
// bestBond->setBondDir(bestBondDir);
auto newWedgeInfo = std::unique_ptr<RDKit::Chirality::WedgeInfoBase>(
new RDKit::Chirality::WedgeInfoAtropisomer(bond->getIdx(),
bestBondDir));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ M V30 44 C 4.644100 1.443800 0.000000 0
M V30 45 C 3.929600 1.031300 0.000000 0
M V30 END ATOM
M V30 BEGIN BOND
M V30 1 1 1 2 CFG=3
M V30 1 1 1 2
M V30 2 1 2 3
M V30 3 1 4 3 CFG=1
M V30 4 1 4 5
Expand Down Expand Up @@ -93,7 +93,7 @@ M V30 38 1 35 36
M V30 39 1 36 37
M V30 40 3 37 38
M V30 41 2 36 39
M V30 42 1 32 39
M V30 42 1 32 39 CFG=1
M V30 43 1 39 40
M V30 44 1 40 41
M V30 45 1 34 42
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ M V30 44 C 4.644100 1.443800 0.000000 0
M V30 45 C 3.929600 1.031300 0.000000 0
M V30 END ATOM
M V30 BEGIN BOND
M V30 1 1 1 2 CFG=3
M V30 1 1 1 2
M V30 2 1 2 3
M V30 3 1 4 3 CFG=1
M V30 4 1 4 5
Expand Down Expand Up @@ -93,7 +93,7 @@ M V30 38 1 35 36
M V30 39 1 36 37
M V30 40 3 37 38
M V30 41 2 36 39
M V30 42 1 32 39
M V30 42 1 32 39 CFG=1
M V30 43 1 39 40
M V30 44 1 40 41
M V30 45 1 34 42
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ M V30 44 C 4.644100 1.443800 0.000000 0
M V30 45 C 3.929600 1.031300 0.000000 0
M V30 END ATOM
M V30 BEGIN BOND
M V30 1 1 1 2 CFG=3
M V30 1 1 1 2
M V30 2 1 2 3
M V30 3 1 4 3 CFG=1
M V30 4 1 4 5
Expand Down Expand Up @@ -93,7 +93,7 @@ M V30 38 1 35 36
M V30 39 1 36 37
M V30 40 3 37 38
M V30 41 2 36 39
M V30 42 1 32 39
M V30 42 1 32 39 CFG=1
M V30 43 1 39 40
M V30 44 1 40 41
M V30 45 1 34 42
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<cml xmlns="http://www.chemaxon.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.chemaxon.com http://www.chemaxon.com/marvin/schema/mrvSchema_20_20_0.xsd"><MDocument><MChemicalStruct><molecule molID="m1"><atomArray><atom id="a1" elementType="C" x2="4.66849" y2="0.384778"/><atom id="a2" elementType="N" x2="3.33456" y2="-0.384778"/><atom id="a3" elementType="C" x2="2.00062" y2="0.384778"/><atom id="a4" elementType="C" x2="0.666874" y2="-0.384778"/><atom id="a5" elementType="C" x2="-0.666874" y2="0.384778"/><atom id="a6" elementType="C" x2="-2.00062" y2="-0.384778"/><atom id="a7" elementType="N" x2="-3.33456" y2="0.384778"/><atom id="a8" elementType="C" x2="-3.33456" y2="1.92538"/><atom id="a9" elementType="C" x2="-4.66849" y2="2.6955"/><atom id="a10" elementType="C" x2="-6.00224" y2="1.92538"/><atom id="a11" elementType="C" x2="-6.00224" y2="0.384778"/><atom id="a12" elementType="C" x2="-4.66849" y2="-0.384778"/><atom id="a13" elementType="C" x2="-7.33636" y2="2.6955"/><atom id="a14" elementType="C" x2="-7.33636" y2="4.23536"/><atom id="a15" elementType="S" x2="-6.00224" y2="5.00548"/><atom id="a16" elementType="C" x2="-4.66849" y2="4.23536"/><atom id="a17" elementType="O" x2="-6.00224" y2="6.54608"/><atom id="a18" elementType="C" x2="-8.6703" y2="5.00548"/><atom id="a19" elementType="C" x2="-10.0039" y2="4.23536"/><atom id="a20" elementType="C" x2="-10.0039" y2="2.6955"/><atom id="a21" elementType="C" x2="-8.6703" y2="1.92538"/><atom id="a22" elementType="C" x2="0.666874" y2="-1.92538"/><atom id="a23" elementType="C" x2="-0.666874" y2="-2.6955"/><atom id="a24" elementType="C" x2="-0.666874" y2="-4.23536"/><atom id="a25" elementType="Cl" x2="-2.00062" y2="-5.00548"/><atom id="a26" elementType="C" x2="0.666874" y2="-5.00548"/><atom id="a27" elementType="Cl" x2="0.666874" y2="-6.54608"/><atom id="a28" elementType="C" x2="2.00062" y2="-4.23536"/><atom id="a29" elementType="C" x2="2.00062" y2="-2.6955"/><atom id="a30" elementType="C" x2="3.33456" y2="-1.92538"/><atom id="a31" elementType="O" x2="4.66849" y2="1.92538"/><atom id="a32" elementType="C" x2="6.00224" y2="-0.384778"/><atom id="a33" elementType="C" x2="7.33636" y2="0.384778"/><atom id="a34" elementType="C" x2="8.6703" y2="-0.384778"/><atom id="a35" elementType="C" x2="8.6703" y2="-1.92538"/><atom id="a36" elementType="C" x2="7.33636" y2="-2.6955"/><atom id="a37" elementType="C" x2="7.33636" y2="-4.23536"/><atom id="a38" elementType="N" x2="7.33636" y2="-5.77597"/><atom id="a39" elementType="C" x2="6.00224" y2="-1.92538"/><atom id="a40" elementType="C" x2="4.66849" y2="-2.6955"/><atom id="a41" elementType="C" x2="4.66849" y2="-4.23536"/><atom id="a42" elementType="C" x2="10.0039" y2="0.384778"/><atom id="a43" elementType="C" x2="10.0039" y2="1.92538"/><atom id="a44" elementType="C" x2="8.6703" y2="2.6955"/><atom id="a45" elementType="C" x2="7.33636" y2="1.92538"/></atomArray><bondArray><bond id="b1" atomRefs2="a1 a2" order="1"><bondStereo>H</bondStereo></bond><bond id="b2" atomRefs2="a2 a3" order="1"/><bond id="b3" atomRefs2="a4 a3" order="1"><bondStereo>W</bondStereo></bond><bond id="b4" atomRefs2="a4 a5" order="1"/><bond id="b5" atomRefs2="a5 a6" order="1"/><bond id="b6" atomRefs2="a6 a7" order="1"/><bond id="b7" atomRefs2="a7 a8" order="1"/><bond id="b8" atomRefs2="a8 a9" order="1"/><bond id="b9" atomRefs2="a9 a10" order="1"/><bond id="b10" atomRefs2="a10 a11" order="1"/><bond id="b11" atomRefs2="a11 a12" order="1"/><bond id="b12" atomRefs2="a7 a12" order="1"/><bond id="b13" atomRefs2="a10 a13" order="1"/><bond id="b14" atomRefs2="a13 a14" order="2"/><bond id="b15" atomRefs2="a14 a15" order="1"/><bond id="b16" atomRefs2="a15 a16" order="1"/><bond id="b17" atomRefs2="a15 a17" order="2"/><bond id="b18" atomRefs2="a14 a18" order="1"/><bond id="b19" atomRefs2="a18 a19" order="2"/><bond id="b20" atomRefs2="a19 a20" order="1"/><bond id="b21" atomRefs2="a20 a21" order="2"/><bond id="b22" atomRefs2="a13 a21" order="1"/><bond id="b23" atomRefs2="a4 a22" order="1"/><bond id="b24" atomRefs2="a22 a23" order="2"/><bond id="b25" atomRefs2="a23 a24" order="1"/><bond id="b26" atomRefs2="a24 a25" order="1"/><bond id="b27" atomRefs2="a24 a26" order="2"/><bond id="b28" atomRefs2="a26 a27" order="1"/><bond id="b29" atomRefs2="a26 a28" order="1"/><bond id="b30" atomRefs2="a28 a29" order="2"/><bond id="b31" atomRefs2="a22 a29" order="1"/><bond id="b32" atomRefs2="a2 a30" order="1"/><bond id="b33" atomRefs2="a1 a31" order="2"/><bond id="b34" atomRefs2="a1 a32" order="1"/><bond id="b35" atomRefs2="a32 a33" order="2"/><bond id="b36" atomRefs2="a33 a34" order="1"/><bond id="b37" atomRefs2="a34 a35" order="2"/><bond id="b38" atomRefs2="a35 a36" order="1"/><bond id="b39" atomRefs2="a36 a37" order="1"/><bond id="b40" atomRefs2="a37 a38" order="3"/><bond id="b41" atomRefs2="a36 a39" order="2"/><bond id="b42" atomRefs2="a32 a39" order="1"/><bond id="b43" atomRefs2="a39 a40" order="1"/><bond id="b44" atomRefs2="a40 a41" order="1"/><bond id="b45" atomRefs2="a34 a42" order="1"/><bond id="b46" atomRefs2="a42 a43" order="2"/><bond id="b47" atomRefs2="a43 a44" order="1"/><bond id="b48" atomRefs2="a44 a45" order="2"/><bond id="b49" atomRefs2="a33 a45" order="1"/></bondArray></molecule></MChemicalStruct></MDocument></cml>
<cml xmlns="http://www.chemaxon.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.chemaxon.com http://www.chemaxon.com/marvin/schema/mrvSchema_20_20_0.xsd"><MDocument><MChemicalStruct><molecule molID="m1"><atomArray><atom id="a1" elementType="C" x2="4.66849" y2="0.384778"/><atom id="a2" elementType="N" x2="3.33456" y2="-0.384778"/><atom id="a3" elementType="C" x2="2.00062" y2="0.384778"/><atom id="a4" elementType="C" x2="0.666874" y2="-0.384778"/><atom id="a5" elementType="C" x2="-0.666874" y2="0.384778"/><atom id="a6" elementType="C" x2="-2.00062" y2="-0.384778"/><atom id="a7" elementType="N" x2="-3.33456" y2="0.384778"/><atom id="a8" elementType="C" x2="-3.33456" y2="1.92538"/><atom id="a9" elementType="C" x2="-4.66849" y2="2.6955"/><atom id="a10" elementType="C" x2="-6.00224" y2="1.92538"/><atom id="a11" elementType="C" x2="-6.00224" y2="0.384778"/><atom id="a12" elementType="C" x2="-4.66849" y2="-0.384778"/><atom id="a13" elementType="C" x2="-7.33636" y2="2.6955"/><atom id="a14" elementType="C" x2="-7.33636" y2="4.23536"/><atom id="a15" elementType="S" x2="-6.00224" y2="5.00548"/><atom id="a16" elementType="C" x2="-4.66849" y2="4.23536"/><atom id="a17" elementType="O" x2="-6.00224" y2="6.54608"/><atom id="a18" elementType="C" x2="-8.6703" y2="5.00548"/><atom id="a19" elementType="C" x2="-10.0039" y2="4.23536"/><atom id="a20" elementType="C" x2="-10.0039" y2="2.6955"/><atom id="a21" elementType="C" x2="-8.6703" y2="1.92538"/><atom id="a22" elementType="C" x2="0.666874" y2="-1.92538"/><atom id="a23" elementType="C" x2="-0.666874" y2="-2.6955"/><atom id="a24" elementType="C" x2="-0.666874" y2="-4.23536"/><atom id="a25" elementType="Cl" x2="-2.00062" y2="-5.00548"/><atom id="a26" elementType="C" x2="0.666874" y2="-5.00548"/><atom id="a27" elementType="Cl" x2="0.666874" y2="-6.54608"/><atom id="a28" elementType="C" x2="2.00062" y2="-4.23536"/><atom id="a29" elementType="C" x2="2.00062" y2="-2.6955"/><atom id="a30" elementType="C" x2="3.33456" y2="-1.92538"/><atom id="a31" elementType="O" x2="4.66849" y2="1.92538"/><atom id="a32" elementType="C" x2="6.00224" y2="-0.384778"/><atom id="a33" elementType="C" x2="7.33636" y2="0.384778"/><atom id="a34" elementType="C" x2="8.6703" y2="-0.384778"/><atom id="a35" elementType="C" x2="8.6703" y2="-1.92538"/><atom id="a36" elementType="C" x2="7.33636" y2="-2.6955"/><atom id="a37" elementType="C" x2="7.33636" y2="-4.23536"/><atom id="a38" elementType="N" x2="7.33636" y2="-5.77597"/><atom id="a39" elementType="C" x2="6.00224" y2="-1.92538"/><atom id="a40" elementType="C" x2="4.66849" y2="-2.6955"/><atom id="a41" elementType="C" x2="4.66849" y2="-4.23536"/><atom id="a42" elementType="C" x2="10.0039" y2="0.384778"/><atom id="a43" elementType="C" x2="10.0039" y2="1.92538"/><atom id="a44" elementType="C" x2="8.6703" y2="2.6955"/><atom id="a45" elementType="C" x2="7.33636" y2="1.92538"/></atomArray><bondArray><bond id="b1" atomRefs2="a1 a2" order="1"/><bond id="b2" atomRefs2="a2 a3" order="1"/><bond id="b3" atomRefs2="a4 a3" order="1"><bondStereo>W</bondStereo></bond><bond id="b4" atomRefs2="a4 a5" order="1"/><bond id="b5" atomRefs2="a5 a6" order="1"/><bond id="b6" atomRefs2="a6 a7" order="1"/><bond id="b7" atomRefs2="a7 a8" order="1"/><bond id="b8" atomRefs2="a8 a9" order="1"/><bond id="b9" atomRefs2="a9 a10" order="1"/><bond id="b10" atomRefs2="a10 a11" order="1"/><bond id="b11" atomRefs2="a11 a12" order="1"/><bond id="b12" atomRefs2="a7 a12" order="1"/><bond id="b13" atomRefs2="a10 a13" order="1"/><bond id="b14" atomRefs2="a13 a14" order="2"/><bond id="b15" atomRefs2="a14 a15" order="1"/><bond id="b16" atomRefs2="a15 a16" order="1"/><bond id="b17" atomRefs2="a15 a17" order="2"/><bond id="b18" atomRefs2="a14 a18" order="1"/><bond id="b19" atomRefs2="a18 a19" order="2"/><bond id="b20" atomRefs2="a19 a20" order="1"/><bond id="b21" atomRefs2="a20 a21" order="2"/><bond id="b22" atomRefs2="a13 a21" order="1"/><bond id="b23" atomRefs2="a4 a22" order="1"/><bond id="b24" atomRefs2="a22 a23" order="2"/><bond id="b25" atomRefs2="a23 a24" order="1"/><bond id="b26" atomRefs2="a24 a25" order="1"/><bond id="b27" atomRefs2="a24 a26" order="2"/><bond id="b28" atomRefs2="a26 a27" order="1"/><bond id="b29" atomRefs2="a26 a28" order="1"/><bond id="b30" atomRefs2="a28 a29" order="2"/><bond id="b31" atomRefs2="a22 a29" order="1"/><bond id="b32" atomRefs2="a2 a30" order="1"/><bond id="b33" atomRefs2="a1 a31" order="2"/><bond id="b34" atomRefs2="a1 a32" order="1"/><bond id="b35" atomRefs2="a32 a33" order="2"/><bond id="b36" atomRefs2="a33 a34" order="1"/><bond id="b37" atomRefs2="a34 a35" order="2"/><bond id="b38" atomRefs2="a35 a36" order="1"/><bond id="b39" atomRefs2="a36 a37" order="1"/><bond id="b40" atomRefs2="a37 a38" order="3"/><bond id="b41" atomRefs2="a36 a39" order="2"/><bond id="b42" atomRefs2="a32 a39" order="1"><bondStereo>W</bondStereo></bond><bond id="b43" atomRefs2="a39 a40" order="1"/><bond id="b44" atomRefs2="a40 a41" order="1"/><bond id="b45" atomRefs2="a34 a42" order="1"/><bond id="b46" atomRefs2="a42 a43" order="2"/><bond id="b47" atomRefs2="a43 a44" order="1"/><bond id="b48" atomRefs2="a44 a45" order="2"/><bond id="b49" atomRefs2="a33 a45" order="1"/></bondArray></molecule></MChemicalStruct></MDocument></cml>
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ M V30 44 C 8.670298 2.695501 0.000000 0
M V30 45 C 7.336363 1.925385 0.000000 0
M V30 END ATOM
M V30 BEGIN BOND
M V30 1 1 1 2 CFG=3
M V30 1 1 1 2
M V30 2 1 2 3
M V30 3 1 4 3 CFG=1
M V30 4 1 4 5
Expand Down Expand Up @@ -93,7 +93,7 @@ M V30 38 1 35 36
M V30 39 1 36 37
M V30 40 3 37 38
M V30 41 2 36 39
M V30 42 1 32 39
M V30 42 1 32 39 CFG=1
M V30 43 1 39 40
M V30 44 1 40 41
M V30 45 1 34 42
Expand Down