58 if (!targetMolForHighlights || !
trimHs || targetMolWasTrimmed) {
59 return targetMolForHighlights;
66 int numMolAtoms = targetMolForHighlights->getNumAtoms();
69 targetMolForHighlights->getNumBonds(), std::make_pair(-1, -1));
70 auto atoms = targetMolForHighlights->atoms();
76 auto res = atom->getAtomMapNum();
77 atom->setAtomMapNum(0);
81 auto &combinedMol =
pair.second->combinedMol;
88 targetMolForHighlights->getBondWithIdx(bondIdx);
89 const auto beginAtom = bond->getBeginAtom();
90 const auto endAtom = bond->getEndAtom();
91 oldBondEnds[bondIdx].first = beginAtom->getIdx();
92 oldBondEnds[bondIdx].second = endAtom->getIdx();
93 beginAtom->setAtomMapNum(beginAtom->getIdx() + 1);
94 endAtom->setAtomMapNum(endAtom->getIdx() + 1);
103 for (
auto atom : targetMolForHighlights->atoms()) {
113 auto &combinedMol =
pair.second->combinedMol;
120 auto newAtomIdx = oldToNewAtomIndices.at(atomIdx);
121 CHECK_INVARIANT(newAtomIdx != -1,
"newAtomIdx must be >=0");
132 const auto &oldPair = oldBondEnds.at(bondIdx);
133 CHECK_INVARIANT(oldPair.first != -1 && oldPair.second != -1,
134 "oldPair members must be >=0");
135 const auto newBeginAtomIdx =
136 oldToNewAtomIndices.at(oldPair.first);
137 const auto newEndAtomIdx = oldToNewAtomIndices.at(oldPair.second);
138 CHECK_INVARIANT(newBeginAtomIdx != -1 && newEndAtomIdx != -1,
139 "newBeginAtomIdx and newEndAtomIdx must be >=0");
140 const auto bond = targetMolForHighlights->getBondBetweenAtoms(
141 newBeginAtomIdx, newEndAtomIdx);
142 CHECK_INVARIANT(bond,
"bond must not be null");
143 return bond->getIdx();
148 targetMolWasTrimmed =
true;
149 return targetMolForHighlights;