diff --git a/CoordgenMacrocycleBuilder.cpp b/CoordgenMacrocycleBuilder.cpp index 981e802..c0cae24 100644 --- a/CoordgenMacrocycleBuilder.cpp +++ b/CoordgenMacrocycleBuilder.cpp @@ -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; @@ -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 bonds = a->getFragment()->getBonds(); @@ -801,9 +801,9 @@ 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; @@ -811,12 +811,12 @@ bool CoordgenMacrocycleBuilder::openCycleAndGenerateCoords( 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 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];