void addMissingProductAtom(const Atom& reactAtom, unsigned reactNeighborIdx, unsigned prodNeighborIdx, RWMOL_SPTR product, const ROMol& reactant, ReactantProductAtomMapping* mapping) { Atom *newAtom = new Atom(reactAtom); unsigned reactAtomIdx = reactAtom.getIdx(); unsigned productIdx = product->addAtom(newAtom,false,true); mapping->reactProdAtomMap[reactAtomIdx].push_back(productIdx); mapping->prodReactAtomMap[productIdx] = reactAtomIdx; // add the bonds const Bond *origB = reactant.getBondBetweenAtoms(reactNeighborIdx,reactAtomIdx); unsigned int begIdx=origB->getBeginAtomIdx(); unsigned int endIdx=origB->getEndAtomIdx(); if(begIdx == reactNeighborIdx) { setNewProductBond(*origB, product, prodNeighborIdx, productIdx); } else { setNewProductBond(*origB, product, productIdx, prodNeighborIdx); } }
void addMissingProductBonds(const Bond &origB, RWMOL_SPTR product, ReactantProductAtomMapping *mapping) { unsigned int begIdx = origB.getBeginAtomIdx(); unsigned int endIdx = origB.getEndAtomIdx(); std::vector<unsigned> prodBeginIdxs = mapping->reactProdAtomMap[begIdx]; std::vector<unsigned> prodEndIdxs = mapping->reactProdAtomMap[endIdx]; CHECK_INVARIANT(prodBeginIdxs.size() == prodEndIdxs.size(), "Different number of start-end points for product bonds."); for (unsigned i = 0; i < prodBeginIdxs.size(); i++) { setNewProductBond(origB, product, prodBeginIdxs.at(i), prodEndIdxs.at(i)); } }