Skip to content

Commit

Permalink
revert ringinfo level checks
Browse files Browse the repository at this point in the history
  • Loading branch information
ricrogz committed May 9, 2024
1 parent 61d4fc5 commit 56eed01
Show file tree
Hide file tree
Showing 27 changed files with 84 additions and 101 deletions.
2 changes: 1 addition & 1 deletion Code/GraphMol/Aromaticity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -912,7 +912,7 @@ int setAromaticity(RWMol &mol, AromaticityModel model, int (*func)(RWMol &)) {

// first find the all the simple rings in the molecule
VECT_INT_VECT srings;
if (mol.getRingInfo()->isSymmSssr()) {
if (mol.getRingInfo()->isInitialized()) {
srings = mol.getRingInfo()->atomRings();
} else {
MolOps::symmetrizeSSSR(mol, srings);
Expand Down
2 changes: 1 addition & 1 deletion Code/GraphMol/Canon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1028,7 +1028,7 @@ void canonicalizeFragment(ROMol &mol, int atomIdx,

// we need ring information; make sure findSSSR has been called before
// if not call now
if (!mol.getRingInfo()->isSssrOrBetter()) {
if (!mol.getRingInfo()->isInitialized()) {
MolOps::findSSSR(mol);
}
mol.getAtomWithIdx(atomIdx)->setProp(common_properties::_TraversalStartPoint,
Expand Down
8 changes: 4 additions & 4 deletions Code/GraphMol/ChemReactions/ReactionFingerprints.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ RDKit::SparseIntVect<std::uint32_t> *generateFingerprint(
delete tmp2;
} break;
case RDKit::MorganFP: {
if (!mol.getRingInfo()->isSssrOrBetter()) {
mol.updatePropertyCache(false);
if (!mol.getRingInfo()->isInitialized()) {
mol.updatePropertyCache();
RDKit::MolOps::findSSSR(mol);
}
res = RDKit::MorganFingerprints::getHashedFingerprint(mol, 2, fpSize);
Expand Down Expand Up @@ -101,8 +101,8 @@ ExplicitBitVect *generateFingerprintAsBitVect(RDKit::ROMol &mol,
mol, fpSize);
break;
case RDKit::MorganFP: {
if (!mol.getRingInfo()->isSssrOrBetter()) {
mol.updatePropertyCache(false);
if (!mol.getRingInfo()->isInitialized()) {
mol.updatePropertyCache();
RDKit::MolOps::findSSSR(mol);
}
res = RDKit::MorganFingerprints::getFingerprintAsBitVect(mol, 2, fpSize);
Expand Down
8 changes: 2 additions & 6 deletions Code/GraphMol/ChemReactions/Wrap/testReactionWrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -1153,9 +1153,7 @@ def testCDXML(self):
self.assertEqual(len(rxns), 1)
self.assertEqual(
AllChem.ReactionToSmarts(rxns[0]),
"[#6&D2:2]1:[#6&D2:3]:[#6&D2:4]:[#6&D3:1](-[#17&D1]):[#6&D2:5]:[#6&D2:6]:1."
"[#6&D3](-[#5&D2]-[#6&D3:7]1:[#6&D2:8]:[#6&D2:9]:[#6&D2:10]:[#6&D2:11]:[#6&D2:12]:1)(-[#8&D1])-[#8&D1]>>"
"[#6&D2:1]1:[#6&D2:5]:[#6&D3:6](-[#6&D3:7]2:[#6&D2:8]:[#6&D2:9]:[#6&D2:10]:[#6&D2:11]:[#6&D2:12]:2):[#6&D2:2]:[#6&D2:3]:[#6&D2:4]:1"
"[#6&D2:2]1:[#6&D2:3]:[#6&D2:4]:[#6&D3:1](:[#6&D2:5]:[#6&D2:6]:1)-[#17&D1].[#6&D3](-[#5&D2]-[#6&D3:7]1:[#6&D2:8]:[#6&D2:9]:[#6&D2:10]:[#6&D2:11]:[#6&D2:12]:1)(-[#8&D1])-[#8&D1]>>[#6&D2:1]1:[#6&D2:5]:[#6&D3:6](:[#6&D2:2]:[#6&D2:3]:[#6&D2:4]:1)-[#6&D3:7]1:[#6&D2:8]:[#6&D2:9]:[#6&D2:10]:[#6&D2:11]:[#6&D2:12]:1"
)

rxns = AllChem.ReactionsFromCDXMLFile('does-not-exist.cdxml')
Expand All @@ -1167,9 +1165,7 @@ def testCDXML(self):
self.assertEqual(len(rxns), 1)
self.assertEqual(
AllChem.ReactionToSmarts(rxns[0]),
"[#6&D2:2]1:[#6&D2:3]:[#6&D2:4]:[#6&D3:1](-[#17&D1]):[#6&D2:5]:[#6&D2:6]:1."
"[#6&D3](-[#5&D2]-[#6&D3:7]1:[#6&D2:8]:[#6&D2:9]:[#6&D2:10]:[#6&D2:11]:[#6&D2:12]:1)(-[#8&D1])-[#8&D1]>>"
"[#6&D2:1]1:[#6&D2:5]:[#6&D3:6](-[#6&D3:7]2:[#6&D2:8]:[#6&D2:9]:[#6&D2:10]:[#6&D2:11]:[#6&D2:12]:2):[#6&D2:2]:[#6&D2:3]:[#6&D2:4]:1"
"[#6&D2:2]1:[#6&D2:3]:[#6&D2:4]:[#6&D3:1](:[#6&D2:5]:[#6&D2:6]:1)-[#17&D1].[#6&D3](-[#5&D2]-[#6&D3:7]1:[#6&D2:8]:[#6&D2:9]:[#6&D2:10]:[#6&D2:11]:[#6&D2:12]:1)(-[#8&D1])-[#8&D1]>>[#6&D2:1]1:[#6&D2:5]:[#6&D3:6](:[#6&D2:2]:[#6&D2:3]:[#6&D2:4]:1)-[#6&D3:7]1:[#6&D2:8]:[#6&D2:9]:[#6&D2:10]:[#6&D2:11]:[#6&D2:12]:1"
)

rxns = AllChem.ReactionsFromCDXMLBlock('')
Expand Down
4 changes: 1 addition & 3 deletions Code/GraphMol/ChemReactions/catch_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1304,9 +1304,7 @@ TEST_CASE("CDXML Parser") {
auto smarts = ChemicalReactionToRxnSmarts(*rxns[0]);
CHECK(
smarts ==
("[#6&D2:2]1:[#6&D2:3]:[#6&D2:4]:[#6&D3:1](-[#17&D1]):[#6&D2:5]:[#6&D2:6]:1."
"[#6&D3](-[#5&D2]-[#6&D3:7]1:[#6&D2:8]:[#6&D2:9]:[#6&D2:10]:[#6&D2:11]:[#6&D2:12]:1)(-[#8&D1])-[#8&D1]>>"
"[#6&D2:1]1:[#6&D2:5]:[#6&D3:6](-[#6&D3:7]2:[#6&D2:8]:[#6&D2:9]:[#6&D2:10]:[#6&D2:11]:[#6&D2:12]:2):[#6&D2:2]:[#6&D2:3]:[#6&D2:4]:1"));
"[#6&D2:2]1:[#6&D2:3]:[#6&D2:4]:[#6&D3:1](:[#6&D2:5]:[#6&D2:6]:1)-[#17&D1].[#6&D3](-[#5&D2]-[#6&D3:7]1:[#6&D2:8]:[#6&D2:9]:[#6&D2:10]:[#6&D2:11]:[#6&D2:12]:1)(-[#8&D1])-[#8&D1]>>[#6&D2:1]1:[#6&D2:5]:[#6&D3:6](:[#6&D2:2]:[#6&D2:3]:[#6&D2:4]:1)-[#6&D3:7]1:[#6&D2:8]:[#6&D2:9]:[#6&D2:10]:[#6&D2:11]:[#6&D2:12]:1");
}
}

Expand Down
6 changes: 3 additions & 3 deletions Code/GraphMol/ChemTransforms/ChemTransforms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -407,8 +407,8 @@ int findNbrBond(RWMol &mol, Bond *bond, Atom *bondAtom, const INT_VECT &bring,

void setSubMolBrokenRingStereo(RWMol &mol,
const boost::dynamic_bitset<> &removedAtoms) {
PRECONDITION(mol.getRingInfo() && mol.getRingInfo()->isSssrOrBetter(),
"insufficient ringinfo");
PRECONDITION(mol.getRingInfo() && mol.getRingInfo()->isInitialized(),
"bad ringinfo");

for (const auto &bring : mol.getRingInfo()->bondRings()) {
// check whether or not this bond ring is affected by the removal
Expand Down Expand Up @@ -718,7 +718,7 @@ ROMol *replaceCore(const ROMol &mol, const ROMol &core,
newMol->removeAtom(at);
removedAtoms.set(at->getIdx());
if (!removedRingAtom && mol.getRingInfo() &&
mol.getRingInfo()->isSssrOrBetter() &&
mol.getRingInfo()->isInitialized() &&
mol.getRingInfo()->numAtomRings(at->getIdx())) {
removedRingAtom = true;
}
Expand Down
6 changes: 3 additions & 3 deletions Code/GraphMol/Chirality.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1375,7 +1375,7 @@ bool atomIsCandidateForRingStereochem(const ROMol &mol, const Atom *atom) {
std::set<unsigned int> nbrRanks;
if (!atom->getPropIfPresent(common_properties::_ringStereochemCand, res)) {
const RingInfo *ringInfo = mol.getRingInfo();
if (ringInfo->isSssrOrBetter() && ringInfo->numAtomRings(atom->getIdx())) {
if (ringInfo->isInitialized() && ringInfo->numAtomRings(atom->getIdx())) {
// three-coordinate N additional requirements:
// in a ring of size 3 (from InChI)
// OR
Expand Down Expand Up @@ -1438,7 +1438,7 @@ void findChiralAtomSpecialCases(ROMol &mol,
PRECONDITION(possibleSpecialCases.size() >= mol.getNumAtoms(),
"bit vector too small");
possibleSpecialCases.reset();
if (!mol.getRingInfo()->isSymmSssr()) {
if (!mol.getRingInfo()->isInitialized()) {
VECT_INT_VECT sssrs;
MolOps::symmetrizeSSSR(mol, sssrs);
}
Expand Down Expand Up @@ -2181,7 +2181,7 @@ void legacyStereoPerception(ROMol &mol, bool cleanIt,

// later we're going to need ring information, get it now if we don't
// have it already:
if (!mol.getRingInfo()->isFindFastOrBetter()) {
if (!mol.getRingInfo()->isInitialized()) {
MolOps::fastFindRings(mol);
}

Expand Down
2 changes: 1 addition & 1 deletion Code/GraphMol/DistGeomHelpers/BoundsMatrixBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ void set12Bounds(const ROMol &mol, DistGeom::BoundsMatPtr mmat,
if (bond->getIsConjugated() &&
(bond->getBeginAtom()->getAtomicNum() > 10 ||
bond->getEndAtom()->getAtomicNum() > 10) &&
mol.getRingInfo() && mol.getRingInfo()->isSssrOrBetter() &&
mol.getRingInfo() && mol.getRingInfo()->isInitialized() &&
mol.getRingInfo()->isBondInRingOfSize(bond->getIdx(), 5)) {
squishAtoms.set(bond->getBeginAtomIdx());
squishAtoms.set(bond->getEndAtomIdx());
Expand Down
2 changes: 1 addition & 1 deletion Code/GraphMol/DistGeomHelpers/Embedder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1052,7 +1052,7 @@ void findChiralSets(const ROMol &mol, DistGeom::VECT_CHIRALSET &chiralCenters,
chiralCenters.push_back(cptr);
} else {
if ((coordMap && coordMap->find(atom->getIdx()) != coordMap->end()) ||
(mol.getRingInfo()->isSssrOrBetter() &&
(mol.getRingInfo()->isInitialized() &&
(mol.getRingInfo()->numAtomRings(atom->getIdx()) < 2 ||
mol.getRingInfo()->isAtomInRingOfSize(atom->getIdx(), 3)))) {
// we only want to these tests for ring atoms that are not part of
Expand Down
2 changes: 1 addition & 1 deletion Code/GraphMol/FMCS/Wrap/testFMCS.py
Original file line number Diff line number Diff line change
Expand Up @@ -1234,7 +1234,7 @@ def test21ShouldAcceptMCS(self):
mcs = rdFMCS.FindMCS(mols1, params)
self.assertEqual(mcs.numAtoms, 11)
self.assertEqual(mcs.numBonds, 12)
self.assertEqual(mcs.smartsString, "[#6]1:&@[#6]:&@[#6]2:&@[#6]:&@[#6]:&@[#6]:&@[#6]:&@[#6]:&@2:&@[#6](-&!@[#0,#6]):&@[#6]:&@1")
self.assertEqual(mcs.smartsString, "[#6]1:&@[#6]:&@[#6]2:&@[#6]:&@[#6]:&@[#6]:&@[#6]:&@[#6]:&@2:&@[#6](:&@[#6]:&@1)-&!@[#0,#6]")
self.assertGreater(params.ProgressCallback.callCount, 0)
self.assertGreater(params.FinalMatchChecker.callCount, 0)
params.AtomCompareParameters.RingMatchesRingOnly = True
Expand Down
24 changes: 11 additions & 13 deletions Code/GraphMol/FMCS/testFMCS_Unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2035,7 +2035,7 @@ void testGitHub2731_comment546175466() {
TEST_ASSERT(res.NumBonds == 14);
TEST_ASSERT(
res.SmartsString ==
"[#6;r6,!R1]1:&@[#6;r6,!R1]:&@[#6]2:&@[#6;r6,!R1]:&@[#6](:&@[#6]:&@[#6]):&@[#6](:&@[#6]):&@[#7;r6,!R1]:&@[#6]:&@2:&@[#6;r6,!R1]:&@[#6;r6,!R1]:&@1");
"[#6;r6,!R1]1:&@[#6;r6,!R1]:&@[#6]2:&@[#6;r6,!R1]:&@[#6](:&@[#6]:&@[#6]):&@[#6](:&@[#7;r6,!R1]:&@[#6]:&@2:&@[#6;r6,!R1]:&@[#6;r6,!R1]:&@1):&@[#6]");
}
{
MCSParameters p;
Expand Down Expand Up @@ -2329,7 +2329,7 @@ void testGitHub3458() {
TEST_ASSERT(res.NumBonds == 18);
TEST_ASSERT(
res.SmartsString ==
"[#6&R]:&@[#6&R]:&@[#6]1:&@[#6](-&!@[#7&!R]-&!@[#6]2:&@[#6]:&@[#6]:&@[#6]:&@[#6](-&!@[#35&!R]):&@[#6]:&@2):&@[#7]:&@[#6]:&@[#7]:&@[#6]:&@1:&@[#6&R]");
"[#6&R]:&@[#6&R]:&@[#6]1:&@[#6](-&!@[#7&!R]-&!@[#6]2:&@[#6]:&@[#6]:&@[#6]:&@[#6](:&@[#6]:&@2)-&!@[#35&!R]):&@[#7]:&@[#6]:&@[#7]:&@[#6]:&@1:&@[#6&R]");
}
{
MCSParameters p;
Expand Down Expand Up @@ -2682,7 +2682,7 @@ void testCustomShouldAcceptMCS() {
TEST_ASSERT(mcs.NumBonds == 12);
TEST_ASSERT(
mcs.SmartsString ==
"[#6]1:&@[#6]:&@[#6]2:&@[#6]:&@[#6]:&@[#6]:&@[#6]:&@[#6]:&@2:&@[#6](-&!@[#0,#6]):&@[#6]:&@1");
"[#6]1:&@[#6]:&@[#6]2:&@[#6]:&@[#6]:&@[#6]:&@[#6]:&@[#6]:&@2:&@[#6](:&@[#6]:&@1)-&!@[#0,#6]");
}

void testGitHub5510() {
Expand Down Expand Up @@ -2958,7 +2958,7 @@ void testGitHub6578() {
TEST_ASSERT(mcs.NumBonds == 33);
TEST_ASSERT(
mcs.SmartsString ==
"[#6]-[#6]1:[#6]:[#6]:[#6]2:[#7](:[#7]:1):[#7]:[#6](-[#6]1:[#6]:[#6]:[#6]:[#6]:[#6]:1):[#6]:2-[#6]1:[#6]:[#6]:[#7]:[#6](-[#7]-[#6]2:[#6]:[#6]:[#6]:[#6]:[#6]:2):[#7]:1");
"[#6]-[#6]1:[#6]:[#6]:[#6]2:[#7](:[#7]:1):[#7]:[#6](:[#6]:2-[#6]1:[#6]:[#6]:[#7]:[#6](:[#7]:1)-[#7]-[#6]1:[#6]:[#6]:[#6]:[#6]:[#6]:1)-[#6]1:[#6]:[#6]:[#6]:[#6]:[#6]:1");
}
{
std::vector<ROMOL_SPTR> mols{
Expand All @@ -2972,7 +2972,7 @@ void testGitHub6578() {
TEST_ASSERT(mcs.NumBonds == 33);
TEST_ASSERT(
mcs.SmartsString ==
"[#6]-[#6]1:[#6]:[#6]:[#6]2:[#7](:[#7]:1):[#7]:[#6](-[#6]1:[#6]:[#6]:[#6]:[#6]:[#6]:1):[#6]:2-[#6]1:[#6]:[#6]:[#7]:[#6](-[#7]-[#6]2:[#6]:[#6]:[#6]:[#6]:[#6]:2):[#7]:1");
"[#6]-[#6]1:[#6]:[#6]:[#6]2:[#7](:[#7]:1):[#7]:[#6](:[#6]:2-[#6]1:[#6]:[#6]:[#7]:[#6](:[#7]:1)-[#7]-[#6]1:[#6]:[#6]:[#6]:[#6]:[#6]:1)-[#6]1:[#6]:[#6]:[#6]:[#6]:[#6]:1");
}
{
std::vector<ROMOL_SPTR> mols{""_smiles, ""_smiles, ""_smiles, ""_smiles};
Expand Down Expand Up @@ -3002,7 +3002,7 @@ void testGitHub6773() {
TEST_ASSERT(mcs.NumBonds == 11);
TEST_ASSERT(
mcs.SmartsString ==
"[#8&!R]-&!@[#6;r6,!R1]1-&@[#6;r6,!R1]-&@[#6;r6,!R1]-&@[#6]-&@[#6](-&@[#6&R]-&@[#6&R]-&@[#6&R]-&@[#6&R])-&@[#6;r6,!R1]-&@1");
"[#8&!R]-&!@[#6;r6,!R1]1-&@[#6;r6,!R1]-&@[#6;r6,!R1]-&@[#6]-&@[#6](-&@[#6;r6,!R1]-&@1)-&@[#6&R]-&@[#6&R]-&@[#6&R]-&@[#6&R]");
}
{
MCSParameters p;
Expand Down Expand Up @@ -3044,8 +3044,7 @@ void testGitHub6773() {
TEST_ASSERT(mcs.NumBonds == 1);
TEST_ASSERT(mcs.SmartsString == "[#8&!R]-&!@[#6&R]");
}
mols = std::vector<ROMOL_SPTR>{"C1CC2CCC3CC2C(C1)CCCCCC3"_smiles,
"C1CC2CCC3CCCC4CCC(C1)C2C34"_smiles};
mols = std::vector<ROMOL_SPTR>{"C1CC2CCC3CC2C(C1)CCCCCC3"_smiles, "C1CC2CCC3CCCC4CCC(C1)C2C34"_smiles};
{
MCSParameters p;
p.BondCompareParameters.MatchFusedRingsStrict = true;
Expand All @@ -3054,7 +3053,7 @@ void testGitHub6773() {
TEST_ASSERT(mcs.NumBonds == 16);
TEST_ASSERT(
mcs.SmartsString ==
"[#6;r6,!R1]1-&@[#6;r6,!R1]-&@[#6]2-&@[#6;r6,!R1]-&@[#6;r6,!R1]-&@[#6](-&@[#6]-&@[#6]-&@[#6])-&@[#6]-&@[#6]-&@2-&@[#6](-&@[#6]-&@[#6])-&@[#6;r6,!R1]-&@1");
"[#6;r6,!R1]1-&@[#6;r6,!R1]-&@[#6]2-&@[#6;r6,!R1]-&@[#6;r6,!R1]-&@[#6](-&@[#6]-&@[#6]-&@2-&@[#6](-&@[#6;r6,!R1]-&@1)-&@[#6]-&@[#6])-&@[#6]-&@[#6]-&@[#6]");
}
{
MCSParameters p;
Expand All @@ -3079,10 +3078,9 @@ void testGitHub6773() {

void testBondCompareCompleteRingsOnly() {
BOOST_LOG(rdInfoLog) << "-------------------------------------" << std::endl;
BOOST_LOG(rdInfoLog)
<< "test CompleteRingsOnly should work also on unsubstituted fused systems"
<< std::endl;
std::vector<ROMOL_SPTR> mols{"C1CCCC2CCCCC12"_smiles, "C1CCC2CCCC12"_smiles};
BOOST_LOG(rdInfoLog) << "test CompleteRingsOnly should work also on unsubstituted fused systems" << std::endl;
std::vector<ROMOL_SPTR> mols{"C1CCCC2CCCCC12"_smiles,
"C1CCC2CCCC12"_smiles};
MCSParameters p;
p.BondCompareParameters.CompleteRingsOnly = true;
auto mcs = findMCS(mols, &p);
Expand Down
4 changes: 2 additions & 2 deletions Code/GraphMol/FileParsers/cdxml_parser_catch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -510,8 +510,8 @@ TEST_CASE("CDXML") {
std::vector<std::string> expected = {"*C1=C([H])C([H])=C([H])C([H])=C1[H]",
"*C1=C([H])N([H])=C([H])C([H])=C1[H]"};
std::vector<std::string> expected_smarts = {
"[#6]1(-[H])=[#6](-[H])-[#6](-[H])=[#6](-[H])-[#6](-[H])=[#6]-1-*",
"[#6]1(-[H])=[#6](-[H])-[#6](-[H])=[#7](-[H])-[#6](-[H])=[#6]-1-[!#1]",
"[#6]1(=[#6](-[#6](=[#6](-[#6](=[#6]-1-*)-[H])-[H])-[H])-[H])-[H]",
"[#6]1(=[#6](-[#6](=[#7](-[#6](=[#6]-1-[!#1])-[H])-[H])-[H])-[H])-[H]",
};
CDXMLParserParams params;
params.sanitize = false;
Expand Down
2 changes: 1 addition & 1 deletion Code/GraphMol/FileParsers/file_parsers_catch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3076,7 +3076,7 @@ M END
"DoubleOrAromaticBond");

auto smarts = MolToSmarts(*m);
CHECK(smarts == "[#7]1-[#6][#6]-[#6]=,:[#8]-[#6]-,=1");
CHECK(smarts == "[#7]1-,=[#6]-[#8]=,:[#6]-[#6][#6]-1");
}
SECTION("basics V2K") {
auto m = R"CTAB(
Expand Down
2 changes: 1 addition & 1 deletion Code/GraphMol/Fingerprints/Fingerprints.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ ExplicitBitVect *LayeredFingerprintMol(
PRECONDITION(!setOnlyBits || setOnlyBits->getNumBits() == fpSize,
"bad setOnlyBits size");

if (!mol.getRingInfo()->isSssrOrBetter()) {
if (!mol.getRingInfo()->isInitialized()) {
MolOps::findSSSR(mol);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ void getExperimentalTorsions(
// torsions for flat rings
const RingInfo *rinfo = mol.getRingInfo();
CHECK_INVARIANT(rinfo, "no ring info");
CHECK_INVARIANT(rinfo->isSssrOrBetter(), "sssr ring info not initialized");
CHECK_INVARIANT(rinfo->isInitialized(), "ring info not initialized");
for (const auto &atomRing : rinfo->atomRings()) {
unsigned int rSize = atomRing.size();
// we don't need to deal with 3 membered rings
Expand Down
2 changes: 1 addition & 1 deletion Code/GraphMol/GenericGroups/GenericGroups.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ bool FusedRingMatch(const ROMol &mol, const Atom &atom,
return false;
}

if (!mol.getRingInfo() || !mol.getRingInfo()->isSssrOrBetter()) {
if (!mol.getRingInfo() || !mol.getRingInfo()->isInitialized()) {
MolOps::findSSSR(mol);
}
if (!mol.getRingInfo()->numAtomRings(atom.getIdx())) {
Expand Down
4 changes: 2 additions & 2 deletions Code/GraphMol/Kekulize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ void KekulizeFragment(RWMol &mol, const boost::dynamic_bitset<> &atomsToUse,
// first find all the simple rings in the molecule that are not
// completely composed of dummy atoms
VECT_INT_VECT allringsSSSR;
if (!mol.getRingInfo()->isSssrOrBetter()) {
if (!mol.getRingInfo()->isInitialized()) {
MolOps::findSSSR(mol, allringsSSSR);
}
const VECT_INT_VECT &allrings =
Expand Down Expand Up @@ -640,7 +640,7 @@ void KekulizeFragment(RWMol &mol, const boost::dynamic_bitset<> &atomsToUse,
if (markAtomsBonds) {
// if we want the atoms and bonds to be marked non-aromatic do
// that here.
if (!mol.getRingInfo()->isSssrOrBetter()) {
if (!mol.getRingInfo()->isInitialized()) {
MolOps::findSSSR(mol);
}
for (auto bond : mol.bonds()) {
Expand Down
2 changes: 1 addition & 1 deletion Code/GraphMol/MolDraw2D/MolDraw2DUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ bool isAtomCandForChiralH(const RWMol &mol, const Atom *atom) {
// conditions for needing a chiral H:
// - stereochem specified
// - in at least two rings
return mol.getRingInfo()->isSssrOrBetter() &&
return mol.getRingInfo()->isInitialized() &&
mol.getRingInfo()->numAtomRings(atom->getIdx()) > 1u &&
(atom->getChiralTag() == Atom::CHI_TETRAHEDRAL_CCW ||
atom->getChiralTag() == Atom::CHI_TETRAHEDRAL_CW);
Expand Down
8 changes: 4 additions & 4 deletions Code/GraphMol/MolEnumerator/enumerator_catch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ M END
auto bundle = MolEnumerator::enumerate(*mol1);
CHECK(bundle.size() == 2);
std::vector<std::string> tsmas = {"[#6]1-[#6]-[#7]=[#6]-[#7]-1-[!#1]",
"[#6]1-[#6]-[#7](-[!#1])=[#6]-[#7]-1"};
"[#6]1-[#6]-[#7](=[#6]-[#7]-1)-[!#1]"};
for (const auto &molp : bundle.getMols()) {
auto smarts = MolToSmarts(*molp);
CHECK(std::find(tsmas.begin(), tsmas.end(), smarts) != tsmas.end());
Expand Down Expand Up @@ -663,7 +663,7 @@ M END
auto bundle = MolEnumerator::enumerate(*mol1);
CHECK(bundle.size() == 2);
std::vector<std::string> tsmas = {"[#6]1-[#6]-[#7]=[#6]-[#7]-1-[!#1]",
"[#6]1-[#6]-[#7](-[!#1])=[#6]-[#7]-1"};
"[#6]1-[#6]-[#7](=[#6]-[#7]-1)-[!#1]"};
for (const auto &molp : bundle.getMols()) {
auto smarts = MolToSmarts(*molp);
CHECK(std::find(tsmas.begin(), tsmas.end(), smarts) != tsmas.end());
Expand Down Expand Up @@ -701,7 +701,7 @@ M END
auto bundle = MolEnumerator::enumerate(*mol1);
CHECK(bundle.size() == 2);
std::vector<std::string> tsmas = {"[#6]1-[#6]-[#7]=[#6]-[#7]-1-*",
"[#6]1-[#6]-[#7](-*)=[#6]-[#7]-1"};
"[#6]1-[#6]-[#7](=[#6]-[#7]-1)-*"};
for (const auto &molp : bundle.getMols()) {
auto smarts = MolToSmarts(*molp);
CHECK(std::find(tsmas.begin(), tsmas.end(), smarts) != tsmas.end());
Expand Down Expand Up @@ -742,7 +742,7 @@ M END
auto bundle = MolEnumerator::enumerate(*mol1);
CHECK(bundle.size() == 2);
std::vector<std::string> tsmas = {"[#6]1:[#6]:[#7]:[#6]:[#7]:1-[#6]",
"[#6]1:[#6]:[#7](-[#6]):[#6]:[#7]:1"};
"[#6]1:[#6]:[#7](:[#6]:[#7]:1)-[#6]"};
for (const auto &molp : bundle.getMols()) {
auto smarts = MolToSmarts(*molp);
CHECK(std::find(tsmas.begin(), tsmas.end(), smarts) != tsmas.end());
Expand Down

0 comments on commit 56eed01

Please sign in to comment.