Skip to content

Commit

Permalink
fix leak
Browse files Browse the repository at this point in the history
  • Loading branch information
ricrogz committed Jan 27, 2023
1 parent facff4f commit 30410d9
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions CoordgenMacrocycleBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ bool CoordgenMacrocycleBuilder::openCycleAndGenerateCoords(
sketcherMinimizer min(getPrecision());
min.setSkipMinimization(true);
min.setForceOpenMacrocycles(true);
auto* minMol = new sketcherMinimizerMolecule;
sketcherMinimizerMolecule minMol ;
sketcherMinimizerBond* bondToBreak = findBondToOpen(ring);
if (!bondToBreak) {
return false;
Expand All @@ -783,9 +783,9 @@ bool CoordgenMacrocycleBuilder::openCycleAndGenerateCoords(
new_at->coordinates = at->coordinates;
new_at->atomicNumber = at->atomicNumber;
new_at->_generalUseN = at->_generalUseN;
new_at->molecule = minMol;
new_at->molecule = &minMol;
new_at->_implicitHs = at->_implicitHs;
minMol->_atoms.push_back(new_at);
minMol._atoms.push_back(new_at);
}

// vector<sketcherMinimizerBond*> bonds = a->getFragment()->getBonds();
Expand All @@ -801,22 +801,22 @@ bool CoordgenMacrocycleBuilder::openCycleAndGenerateCoords(
new_bo->endAtom = atomMap[bo->endAtom];
new_bo->isZ = bo->isZ;
new_bo->m_ignoreZE = bo->m_ignoreZE;
minMol->_bonds.push_back(new_bo);
minMol._bonds.push_back(new_bo);
}
min.initialize(minMol);
min.initialize(&minMol);
min.findFragments();
min.buildFromFragments(true);
auto* brokenBond = new sketcherMinimizerBond;
brokenBond->bondOrder = bondToBreak->bondOrder;
brokenBond->startAtom = atomMap[bondToBreak->startAtom];
brokenBond->endAtom = atomMap[bondToBreak->endAtom];
brokenBond->isZ = bondToBreak->isZ;
minMol->_bonds.push_back(brokenBond);
minMol->forceUpdateStruct(minMol->_atoms, minMol->_bonds, minMol->_rings);
minMol._bonds.push_back(brokenBond);
minMol.forceUpdateStruct(minMol._atoms, minMol._bonds, minMol._rings);
std::vector<sketcherMinimizerInteraction*> extraInteractions;
extraInteractions.push_back(new sketcherMinimizerStretchInteraction(
brokenBond->startAtom, brokenBond->endAtom));
min.avoidClashesOfMolecule(minMol, extraInteractions);
min.avoidClashesOfMolecule(&minMol, extraInteractions);

for (sketcherMinimizerAtom* atom : atoms) {
sketcherMinimizerAtom* otherAtom = atomMap[atom];
Expand Down

0 comments on commit 30410d9

Please sign in to comment.