Changeset 00b59d5


Ignore:
Timestamp:
Feb 4, 2011, 6:56:38 PM (14 years ago)
Author:
Frederik Heber <heber@…>
Branches:
Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
Children:
038713
Parents:
1d5afa5
git-author:
Frederik Heber <heber@…> (01/17/11 14:05:30)
git-committer:
Frederik Heber <heber@…> (02/04/11 18:56:38)
Message:

FIX: molecule::FragmentMolecule() did not remove copied atoms and molecules.

  • Subgraph copies molecules, are now removed in MoleculeLeafClass dstor.
  • BondFragments's molecules, i.e. the created fragments, are not removed, hence the output file got a lot bigger ...
Location:
src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/molecule_fragmentation.cpp

    r1d5afa5 r00b59d5  
    752752  // free subgraph memory again
    753753  FragmentCounter = 0;
    754   if (Subgraphs != NULL) {
    755     while (Subgraphs->next != NULL) {
    756       Subgraphs = Subgraphs->next;
    757       delete(FragmentList[FragmentCounter++]);
    758       delete(Subgraphs->previous);
    759     }
     754  while (Subgraphs != NULL) {
     755    // remove entry in fragment list
     756    // remove subgraph fragment
     757    MolecularWalker = Subgraphs->next;
    760758    delete(Subgraphs);
    761   }
     759    Subgraphs = MolecularWalker;
     760  }
     761  // free fragment list
     762  for (int i=0; i< FragmentCounter; ++i )
     763    delete(FragmentList[i]);
    762764  delete[](FragmentList);
     765
     766  DoLog(0) && (Log() << Verbose(0) << FragmentCounter-1 << " subgraph fragments have been removed." << std::endl);
    763767
    764768  // ===== 8b. gather keyset lists (graphs) from all subgraphs and transform into MoleculeListClass =====
     
    813817  } else {
    814818    DoLog(1) && (Log() << Verbose(1) << "FragmentList is zero on return, splitting failed." << endl);
     819  }
     820  // remove all create molecules again from the World including their atoms
     821  for (MoleculeList::iterator iter = BondFragments->ListOfMolecules.begin();
     822      !BondFragments->ListOfMolecules.empty();
     823      iter = BondFragments->ListOfMolecules.begin()) {
     824    // remove copied atoms and molecule again
     825    molecule *mol = *iter;
     826    mol->removeAtomsinMolecule();
     827    World::getInstance().destroyMolecule(mol);
     828    BondFragments->ListOfMolecules.erase(iter);
    815829  }
    816830  delete(BondFragments);
  • src/moleculelist.cpp

    r1d5afa5 r00b59d5  
    741741  // remove the leaf itself
    742742  if (Leaf != NULL) {
     743    Leaf->removeAtomsinMolecule();
    743744    World::getInstance().destroyMolecule(Leaf);
    744745    Leaf = NULL;
Note: See TracChangeset for help on using the changeset viewer.