Use index-order kekulization in MolToInchi (#9226)

MolToInchi has called MolOps::Kekulize(*m, false) for years, but PR #9125 changed the default traversal to canonical=true. That pulls rankFragmentAtoms() and the canonicalization path into the InChI conversion even though the tested InChI outputs stay the same.

Validation:
- rdkit.Chem.UnitTestInchi passed before and after this change on upstream/master (18 tests, OK in both runs).
- No InChI output drift was observed between stock and patched builds on Regress/Data/mols.1000.sdf.gz, rdkit/Chem/test_data/pubchem-hard-set.sdf.gz, or the atom-order regression molecules added in Code/GraphMol/catch_graphmol.cpp.

Performance:
- Release_2026_03_1 Python MolToInchi on Regress/Data/mols.1000.sdf.gz improved from 0.40712s to 0.38871s median (-4.52%).
- Release_2026_03_1 rdinchi MolToInchi on the same dataset improved from 0.39755s to 0.37814s median (-4.88%).
- Release_2026_03_1 standalone C++ MolToInchi on /tmp/mols.1000.sdf improved from 7.66775s to 7.03474s wall time (-8.26%), from 20.57B to 19.04B cycles (-7.46%), and from 121.78M to 114.05M cache misses (-6.35%).
This commit is contained in:
Yakov Pechersky
2026-04-07 00:17:40 -04:00
committed by greg landrum
parent 0beb4bb900
commit 695c6a5e0c

View File

@@ -1753,7 +1753,7 @@ std::string MolToInchi(const ROMol &mol, ExtraInchiReturnValues &rv,
m->updatePropertyCache(false);
}
// kekulize
MolOps::Kekulize(*m, false);
MolOps::Kekulize(*m, false, false);
// "reverse" cleanup: undo some clean up done by RDKit
rCleanUp(*m);