diff --git a/Code/GraphMol/CIPLabeler/CIPMol.cpp b/Code/GraphMol/CIPLabeler/CIPMol.cpp index ed7c1798d..043b65cb1 100644 --- a/Code/GraphMol/CIPLabeler/CIPMol.cpp +++ b/Code/GraphMol/CIPLabeler/CIPMol.cpp @@ -16,7 +16,10 @@ namespace RDKit { namespace CIPLabeler { -CIPMol::CIPMol(ROMol &mol) : d_mol{mol} {} +CIPMol::CIPMol(ROMol &mol) : d_mol{mol} { + d_bonds.reserve(mol.getNumBonds()); + std::ranges::copy(mol.bonds(), std::back_inserter(d_bonds)); +} boost::rational CIPMol::getFractionalAtomicNum(Atom *atom) const { PRECONDITION(atom, "bad atom") @@ -36,7 +39,7 @@ CXXAtomIterator CIPMol::atoms() const { return d_mol.atoms(); } -Bond *CIPMol::getBond(int idx) const { return d_mol.getBondWithIdx(idx); }; +Bond *CIPMol::getBond(int idx) const { return d_bonds[idx]; }; CIPMolSpan CIPMol::getBonds(Atom *atom) const { PRECONDITION(atom, "bad atom") @@ -108,4 +111,4 @@ int CIPMol::getBondOrder(Bond *bond) const { }; } // namespace CIPLabeler -} // namespace RDKit \ No newline at end of file +} // namespace RDKit diff --git a/Code/GraphMol/CIPLabeler/CIPMol.h b/Code/GraphMol/CIPLabeler/CIPMol.h index eda543846..bedd335a2 100644 --- a/Code/GraphMol/CIPLabeler/CIPMol.h +++ b/Code/GraphMol/CIPLabeler/CIPMol.h @@ -97,6 +97,7 @@ class CIPMol { ROMol &d_mol; std::vector d_kekulized_bonds; std::vector> d_atomnums; + std::vector d_bonds; }; } // namespace CIPLabeler