Changeset 701ad6
- Timestamp:
- Aug 28, 2010, 1:36:03 AM (15 years ago)
- 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:
- 653542
- Parents:
- 2b7d1b
- git-author:
- Frederik Heber <heber@…> (08/28/10 01:31:44)
- git-committer:
- Frederik Heber <heber@…> (08/28/10 01:36:03)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/Actions/FragmentationAction/SubgraphDissectionAction.cpp ¶
r2b7d1b r701ad6 22 22 #include "config.hpp" 23 23 #include "Helpers/Log.hpp" 24 #include "Helpers/Verbose.hpp" 24 25 #include "molecule.hpp" 25 26 #include "stackclass.hpp" 26 #include "verbose.hpp"27 27 #include "World.hpp" 28 28 … … 104 104 return Action::failure; 105 105 } 106 <<<<<<< HEAD 107 108 // 3. dissect (the following construct is needed to have the atoms not in the order of the DFS, but in 109 // the original one as parsed in) 110 // TODO: Optimize this, when molecules just contain pointer list of global atoms! 111 112 // 4a. create array of molecules to fill 113 const int MolCount = Subgraphs->next->Count(); 114 char number[MAXSTRINGSIZE]; 115 molecule **moleculelist = new molecule *[MolCount]; 116 MoleculeLeafClass *MolecularWalker = Subgraphs; 117 for (int i=0;i<MolCount;i++) { 118 MolecularWalker = MolecularWalker->next; 119 moleculelist[i] = World::getInstance().createMolecule(); 120 moleculelist[i]->ActiveFlag = true; 121 strncpy(moleculelist[i]->name, mol->name, MAXSTRINGSIZE); 122 if (MolCount > 1) { 123 sprintf(number, "-%d", i+1); 124 strncat(moleculelist[i]->name, number, MAXSTRINGSIZE - strlen(mol->name) - 1); 125 } 126 DoLog(1) && (Log() << Verbose(1) << "MolName is " << moleculelist[i]->name << ", id is " << moleculelist[i]->getId() << endl); 127 for (molecule::iterator iter = MolecularWalker->Leaf->begin(); iter != MolecularWalker->Leaf->end(); ++iter) { 128 DoLog(1) && (Log() << Verbose(1) << **iter << endl); 129 } 130 molecules->insert(moleculelist[i]); 131 } 132 133 // 4b. create and fill map of which atom is associated to which connected molecule (note, counting starts at 1) 134 int FragmentCounter = 0; 135 map<int, atom *> AtomToFragmentMap; 136 MolecularWalker = Subgraphs; 137 while (MolecularWalker->next != NULL) { 138 MolecularWalker = MolecularWalker->next; 139 for (molecule::iterator iter = MolecularWalker->Leaf->begin(); !MolecularWalker->Leaf->empty(); iter = MolecularWalker->Leaf->begin()) { 140 atom * Walker = *iter; 141 DoLog(1) && (Log() << Verbose(1) << "Re-linking " << Walker << "..." << endl); 142 MolecularWalker->Leaf->erase(iter); 143 moleculelist[FragmentCounter]->AddAtom(Walker); // counting starts at 1 144 } 145 FragmentCounter++; 146 } 147 // TODO: When DepthFirstSearchAnalysis does not use AddCopyAtom() anymore, we don't need to delete all original atoms. 148 // 4d. destroy the original molecule 149 ======= 150 int FragmentCounter = Subgraphs->Count(); 106 int FragmentCounter = Subgraphs->next->Count(); 151 107 152 108 // TODO: When DepthFirstSearchAnalysis does not use AddCopyAtom() anymore, we don't need to delete all original atoms 153 109 // 3. destroy the original molecule 154 >>>>>>> Merged MoleculeListClass::DissectMoleculeIntoConnectedSubgraphs() into FragmenationSubgraphDissectionAction.155 110 for (molecule::iterator AtomRunner = mol->begin(); !mol->empty(); AtomRunner = mol->begin()) 156 111 World::getInstance().destroyAtom(*AtomRunner); 157 112 World::getInstance().destroyMolecule(mol); 158 113 159 <<<<<<< HEAD160 // 4d. we don't need to redo bonds, as they are connected subgraphs and still maintain their ListOfBonds, but we have to remove them from first..last list161 // TODO: check whether this is really not needed anymore162 // 4e. free Leafs163 MolecularWalker = Subgraphs;164 =======165 114 // 4. free Leafs 166 115 MoleculeLeafClass *MolecularWalker = Subgraphs; 167 >>>>>>> Merged MoleculeListClass::DissectMoleculeIntoConnectedSubgraphs() into FragmenationSubgraphDissectionAction.168 116 while (MolecularWalker->next != NULL) { 117 MolecularWalker->Leaf = NULL; 169 118 MolecularWalker = MolecularWalker->next; 170 119 delete(MolecularWalker->previous); 171 120 } 172 121 delete(MolecularWalker); 173 <<<<<<< HEAD174 delete[](moleculelist);175 =======176 >>>>>>> Merged MoleculeListClass::DissectMoleculeIntoConnectedSubgraphs() into FragmenationSubgraphDissectionAction.177 122 DoLog(1) && (Log() << Verbose(1) << "I scanned " << FragmentCounter << " molecules." << endl); 178 123
Note:
See TracChangeset
for help on using the changeset viewer.