Changeset 8dbcaf
- Timestamp:
- Oct 14, 2013, 11:42:03 PM (11 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:
- fe0cb8
- Parents:
- fb9f6d
- git-author:
- Frederik Heber <heber@…> (09/24/13 12:32:02)
- git-committer:
- Frederik Heber <heber@…> (10/14/13 23:42:03)
- Location:
- src/Graph
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Graph/CyclicStructureAnalysis.cpp
rfb9f6d r8dbcaf 99 99 100 100 /** Performs a BFS from \a *Root, trying to find the same node and hence a cycle. 101 * \param OtherAtom pointing to Root on return indicating found cycle 101 102 * \param *&BackEdge the edge from root that we don't want to move along 102 * \param &BFS accounting structure 103 */ 104 void CyclicStructureAnalysis::CyclicBFSFromRootToRoot(bond::ptr &BackEdge) 103 */ 104 void CyclicStructureAnalysis::CyclicBFSFromRootToRoot(atom *&OtherAtom, bond::ptr &BackEdge) 105 105 { 106 106 atom *Walker = NULL; 107 atom *OtherAtom = NULL;108 107 do { // look for Root 109 108 ASSERT(!BFSStack.empty(), "CyclicStructureAnalysis_CyclicBFSFromRootToRoot() - BFSStack is empty!"); 110 109 Walker = BFSStack.front(); 111 110 BFSStack.pop_front(); 112 LOG(2, "INFO: Current Walker is " << *Walker << ", we look for SP to Root " << *Root << "." << endl);111 LOG(2, "INFO: Current Walker is " << *Walker << ", we look for SP to Root " << *Root << "."); 113 112 const BondList& ListOfBonds = Walker->getListOfBonds(); 114 113 for (BondList::const_iterator Runner = ListOfBonds.begin(); … … 118 117 OtherAtom = (*Runner)->GetOtherAtom(Walker); 119 118 if ((treatment == IncludeHydrogen) || (OtherAtom->getType()->getAtomicNumber() != 1)) { 120 LOG(2, "INFO: Current OtherAtom is: " << OtherAtom->getName() << " for bond " << *(*Runner) << "." << endl);119 LOG(2, "INFO: Current OtherAtom is: " << OtherAtom->getName() << " for bond " << *(*Runner) << "."); 121 120 if (ColorList[OtherAtom->getNr()] == GraphEdge::white) { 122 121 TouchedStack.push_front(OtherAtom); … … 124 123 PredecessorList[OtherAtom->getNr()] = Walker; // Walker is the predecessor 125 124 ShortestPathList[OtherAtom->getNr()] = ShortestPathList[Walker->getNr()] + 1; 126 LOG(2, "INFO: Coloring OtherAtom " << OtherAtom->getName() << " lightgray, its predecessor is " << Walker->getName() << " and its Shortest Path is " << ShortestPathList[OtherAtom->getNr()] << " egde(s) long." << endl);125 LOG(2, "INFO: Coloring OtherAtom " << OtherAtom->getName() << " lightgray, its predecessor is " << Walker->getName() << " and its Shortest Path is " << ShortestPathList[OtherAtom->getNr()] << " egde(s) long."); 127 126 //if (ShortestPathList[OtherAtom->getNr()] < MinimumRingSize[Walker->GetTrueFather()->getNr()]) { // Check for maximum distance 128 LOG(3, "ACCEPT: Putting OtherAtom into queue." << endl);127 LOG(3, "ACCEPT: Putting OtherAtom " << OtherAtom->getName() << " into queue."); 129 128 BFSStack.push_front(OtherAtom); 130 129 //} 131 130 } else { 132 LOG(3, "REJECT: Not Adding, has already been visited." << endl);131 LOG(3, "REJECT: Not Adding, has already been visited."); 133 132 } 134 133 if (OtherAtom == Root) 135 134 break; 136 135 } else { 137 LOG(2, "INFO: Skipping hydrogen atom " << *OtherAtom << "." << endl);136 LOG(2, "INFO: Skipping hydrogen atom " << *OtherAtom << "."); 138 137 ColorList[OtherAtom->getNr()] = GraphEdge::black; 139 138 } 140 139 } else { 141 LOG(2, "REJECT: Bond " << *(*Runner) << " not Visiting, is the back edge." << endl);140 LOG(2, "REJECT: Bond " << *(*Runner) << " not Visiting, is the back edge."); 142 141 } 143 142 } 144 143 ColorList[Walker->getNr()] = GraphEdge::black; 145 LOG(1, "INFO: Coloring Walker " << Walker->getName() << " " << GraphEdge::getColorName(ColorList[Walker->getNr()]) << "." << endl);144 LOG(1, "INFO: Coloring Walker " << Walker->getName() << " " << GraphEdge::getColorName(ColorList[Walker->getNr()]) << "."); 146 145 if (OtherAtom == Root) { // if we have found the root, check whether this cycle wasn't already found beforehand 147 146 // step through predecessor list 148 while (OtherAtom != BackEdge->rightatom) { 149 if (!OtherAtom->GetTrueFather()->IsCyclic) // if one bond in the loop is not marked as cyclic, we haven't found this cycle yet 147 LOG(4, "DEBUG: Checking whether all predecessors are already marked cyclic ..."); 148 while (OtherAtom != BackEdge->rightatom) { // Note that leftatom is Root itself 149 if (!OtherAtom->GetTrueFather()->IsCyclic) { // if one bond in the loop is not marked as cyclic, we haven't found this cycle yet 150 LOG(4, "\tDEBUG: OtherAtom " << *OtherAtom << " is not cyclic, breaking."); 150 151 break; 151 else152 } else 152 153 OtherAtom = PredecessorList[OtherAtom->getNr()]; 153 154 } 154 if (OtherAtom == BackEdge->rightatom) { // if each atom in found cycle is cyclic, loop's been found before already 155 LOG(3, "INFO This cycle was already found before, skipping and removing seeker from search." << endl); 155 LOG(4, "DEBUG: Checking done."); 156 // if each atom in found cycle is cyclic, loop's been found before already 157 if (OtherAtom == BackEdge->rightatom) { // loop got round completely 158 LOG(3, "INFO: This cycle was already found before, skipping and removing seeker from search."); 156 159 do { 157 160 ASSERT(!TouchedStack.empty(), "CyclicStructureAnalysis_CyclicBFSFromRootToRoot() - TouchedStack is empty!"); … … 159 162 TouchedStack.pop_front(); 160 163 if (PredecessorList[OtherAtom->getNr()] == Walker) { 161 LOG(4, "INFO: Removing " << *OtherAtom << " from lists and stacks." << endl);164 LOG(4, "INFO: Removing " << *OtherAtom << " from lists and stacks."); 162 165 PredecessorList[OtherAtom->getNr()] = NULL; 163 166 ShortestPathList[OtherAtom->getNr()] = -1; … … 175 178 TouchedStack.push_front(OtherAtom); // last was wrongly popped 176 179 OtherAtom = BackEdge->rightatom; // set to not Root 177 } else 180 } else { 178 181 OtherAtom = Root; 182 LOG(2, "INFO: We have reached Root " << *OtherAtom << " and may extract the cycle."); 183 } 179 184 } 180 185 } while ((!BFSStack.empty()) && (OtherAtom != Root) && (OtherAtom != NULL)); // || (ShortestPathList[OtherAtom->getNr()] < MinimumRingSize[Walker->GetTrueFather()->getNr()]))); … … 186 191 * \param &BFS accounting structure 187 192 * \param &MinRingSize global minimum distance from one node without encountering oneself, set on return 188 */ 189 void CyclicStructureAnalysis::RetrieveCycleMembers(atom *&OtherAtom, bond::ptr &BackEdge, int &MinRingSize) 193 * \param &NumCyles number of cycles in graph 194 */ 195 void CyclicStructureAnalysis::RetrieveCycleMembers( 196 atom *&OtherAtom, 197 bond::ptr &BackEdge, 198 int &MinRingSize, 199 int &NumCycles) 190 200 { 191 201 atom *Walker = NULL; 192 int NumCycles = 0;193 202 int RingSize = -1; 194 203 … … 213 222 // walk through all and set MinimumRingSize 214 223 Walker = Root; 215 ASSERT(!MinimumRingSize.count(Walker->GetTrueFather()->getNr()), 216 "CyclicStructureAnalysis::RetrieveCycleMembers() - setting MinimumRingSize of " 217 +toString(*(Walker->GetTrueFather()))+" to " 218 +toString(RingSize)+" which is already set to " 219 +toString(MinimumRingSize[Walker->GetTrueFather()->getNr()])+"."); 220 MinimumRingSize[Walker->GetTrueFather()->getNr()] = RingSize; 221 while (Walker != BackEdge->rightatom) { 224 if ((MinimumRingSize.count(Walker->GetTrueFather()->getNr()) == 0) 225 || (RingSize < MinimumRingSize[Walker->GetTrueFather()->getNr()])) { 226 MinimumRingSize[Walker->GetTrueFather()->getNr()] = RingSize; 227 } else { 228 LOG(3, "INFO: Not setting MinimumRingSize of "<< *(Walker->GetTrueFather()) 229 << " to " << RingSize << " which is already set to " 230 << MinimumRingSize[Walker->GetTrueFather()->getNr()] << "."); 231 } 232 while (Walker != BackEdge->rightatom) { // note that Root is leftatom 222 233 Walker = PredecessorList[Walker->getNr()]; 223 if (RingSize < MinimumRingSize[Walker->GetTrueFather()->getNr()]) 234 if ((MinimumRingSize.count(Walker->GetTrueFather()->getNr()) == 0) 235 || (RingSize < MinimumRingSize[Walker->GetTrueFather()->getNr()])) 224 236 MinimumRingSize[Walker->GetTrueFather()->getNr()] = RingSize; 225 237 } … … 227 239 MinRingSize = RingSize; 228 240 } else { 229 LOG(1, "INFO: No ring containing " << *Root << " with length equal to or smaller than " << MinimumRingSize[Root->GetTrueFather()->getNr()] << " found." << endl);241 LOG(1, "INFO: No ring containing " << *Root << " with length equal to or smaller than " << MinimumRingSize[Root->GetTrueFather()->getNr()] << " found."); 230 242 } 231 243 } 232 244 233 245 /** From a given node performs a BFS to touch the next cycle, for whose nodes \a MinimumRingSize is set and set it accordingly. 234 * \param *& Rootnode to look for closest cycle from, i.e. \a MinimumRingSize is set for this node246 * \param *&Walker node to look for closest cycle from, i.e. \a MinimumRingSize is set for this node 235 247 * \param AtomCount number of nodes in graph 236 248 */ 237 void CyclicStructureAnalysis::BFSToNextCycle(atom *&Root, atom *&Walker) 238 { 249 void CyclicStructureAnalysis::BFSToNextCycle(atom *Walker) 250 { 251 atom *Root = Walker; 239 252 atom *OtherAtom = Walker; 240 253 … … 246 259 Walker = BFSStack.front(); 247 260 BFSStack.pop_front(); 248 LOG(2, "INFO: Current Walker is " << *Walker << ", we look for SP toRoot " << *Root << ".");261 LOG(2, "INFO: Current Walker is " << *Walker << ", BFS-stepping away from Root " << *Root << "."); 249 262 const BondList& ListOfBonds = Walker->getListOfBonds(); 250 263 for (BondList::const_iterator Runner = ListOfBonds.begin(); … … 252 265 ++Runner) { 253 266 // "removed (*Runner) != BackEdge) || " from next if, is u 254 if ((ListOfBonds.size() == 1)) { // only walk along DFS spanning tree (otherwise we always find SP of 1 being backedge Binder), but terminal hydrogens may be connected via backedge, hence extra check 267 268 // only walk along DFS spanning tree (otherwise we always find SP of 1 269 // being backedge Binder), but terminal hydrogens may be connected via 270 // backedge, hence extra check 271 // if ((ListOfBonds.size() != 1)) { 255 272 OtherAtom = (*Runner)->GetOtherAtom(Walker); 256 LOG(2, "INFO: Current OtherAtom is: " << OtherAtom->getName() << " for bond " << *(*Runner) << "."); 257 if (ColorList[OtherAtom->getNr()] == GraphEdge::white) { 258 TouchedStack.push_front(OtherAtom); 259 ColorList[OtherAtom->getNr()] = GraphEdge::lightgray; 260 PredecessorList[OtherAtom->getNr()] = Walker; // Walker is the predecessor 261 ShortestPathList[OtherAtom->getNr()] = ShortestPathList[Walker->getNr()] + 1; 262 LOG(2, "ACCEPT: Coloring OtherAtom " << OtherAtom->getName() << " lightgray, its predecessor is " << Walker->getName() << " and its Shortest Path is " << ShortestPathList[OtherAtom->getNr()] << " egde(s) long."); 263 if (OtherAtom->GetTrueFather()->IsCyclic) { // if the other atom is connected to a ring 264 ASSERT(!MinimumRingSize.count(Root->GetTrueFather()->getNr()), 265 "CyclicStructureAnalysis::BFSToNextCycle() - setting MinimumRingSize of " 266 +toString(*(Root->GetTrueFather()))+" to "+ 267 toString(ShortestPathList[OtherAtom->getNr()] + MinimumRingSize[OtherAtom->GetTrueFather()->getNr()]) 268 +" which is already set to " 269 +toString(MinimumRingSize[Root->GetTrueFather()->getNr()])+"."); 270 MinimumRingSize[Root->GetTrueFather()->getNr()] = ShortestPathList[OtherAtom->getNr()] + MinimumRingSize[OtherAtom->GetTrueFather()->getNr()]; 271 OtherAtom = NULL; //break; 272 break; 273 } else 274 BFSStack.push_front(OtherAtom); 273 if ((treatment == IncludeHydrogen) || (OtherAtom->getType()->getAtomicNumber() != 1)) { 274 LOG(2, "INFO: Current OtherAtom is: " << OtherAtom->getName() << " for bond " << *(*Runner) << "."); 275 if (ColorList[OtherAtom->getNr()] == GraphEdge::white) { 276 TouchedStack.push_front(OtherAtom); 277 ColorList[OtherAtom->getNr()] = GraphEdge::lightgray; 278 PredecessorList[OtherAtom->getNr()] = Walker; // Walker is the predecessor 279 ShortestPathList[OtherAtom->getNr()] = ShortestPathList[Walker->getNr()] + 1; 280 LOG(2, "ACCEPT: Coloring OtherAtom " 281 << OtherAtom->getName() << " lightgray, its predecessor is " 282 << Walker->getName() << " and its Shortest Path is " 283 << ShortestPathList[OtherAtom->getNr()] << " egde(s) long."); 284 // distance is a locally optimal criterion (we have eliminated all 285 // cycles already). Hence, we may assume that all set MinimumRingSize 286 // correspond to shortest distances to cycles. I.e., as soon as we reach 287 // as set MinimumRingSize we may use it and the current shortest path 288 // distance to it 289 if (MinimumRingSize.count(OtherAtom->GetTrueFather()->getNr())) { 290 LOG(2, "SUCCESS: Found set MinimumRingSize at " << *OtherAtom 291 << ", walking back to Root " << *Root << "."); 292 // set all predecessors 293 const unsigned int shorttestpath = ShortestPathList[OtherAtom->getNr()]; 294 atom *Backwalker = OtherAtom; 295 while (Backwalker != Root) { 296 Backwalker = PredecessorList[Backwalker->getNr()]; 297 MinimumRingSize[Backwalker->GetTrueFather()->getNr()] = 298 (shorttestpath - ShortestPathList[Backwalker->getNr()]) 299 + MinimumRingSize[OtherAtom->GetTrueFather()->getNr()]; 300 LOG(2, "Setting MinimumRingSize of " << *Backwalker << " to " 301 << MinimumRingSize[Backwalker->GetTrueFather()->getNr()] << "."); 302 } 303 OtherAtom = NULL; //break; 304 break; 305 } else 306 BFSStack.push_front(OtherAtom); 307 } else { 308 LOG(3, "REJECT: Not Adding, has already been visited."); 309 } 275 310 } else { 276 LOG(3, "REJECT: Not Adding, has already been visited.");311 LOG(3, "REJECT: Not Visiting, is a back edge to hydrogen."); 277 312 } 278 } else { 279 LOG(3, "REJECT: Not Visiting, is a back edge."); 280 } 313 // } 281 314 } 282 315 ColorList[Walker->getNr()] = GraphEdge::black; … … 285 318 } 286 319 287 /** All nodes that are not in cycles get assigned a \a *&MinimumRingSizeby BFS to next cycle. 288 * \param *&MinimumRingSize array with minimum distance without encountering onself for each atom 289 * \param &MinRingSize global minium distance 290 * \param &NumCyles number of cycles in graph 291 */ 292 void CyclicStructureAnalysis::AssignRingSizetoNonCycleMembers(int &MinRingSize, int &NumCycles) 293 { 294 atom *Root = NULL; 320 /** All nodes that are not in cycles get assigned a \a *&MinimumRingSize by BFS to next cycle. 321 * \param *&MinimumRingSize array with minimum distance without encountering oneself for each atom 322 * \param MinRingSize global minium distance 323 * \param NumCyles number of cycles in graph 324 */ 325 void CyclicStructureAnalysis::AssignRingSizetoNonCycleMembers(const int MinRingSize, const int NumCycles) 326 { 295 327 atom *Walker = NULL; 296 328 if (MinRingSize != -1) { // if rings are present … … 300 332 iter != allatoms.end(); 301 333 ++iter) { 302 Root = *iter; 303 304 if (MinimumRingSize.find(Root->GetTrueFather()->getNr()) != MinimumRingSize.end()) { // check whether MinimumRingSize is set, if not BFS to next where it is 305 Walker = Root; 306 334 Walker = *iter; 335 336 if (MinimumRingSize.find(Walker->GetTrueFather()->getNr()) == MinimumRingSize.end()) { // check whether MinimumRingSize is set, if not BFS to next where it is 307 337 LOG(1, "---------------------------------------------------------------------------------------------------------"); 308 BFSToNextCycle(Root, Walker); 309 338 BFSToNextCycle(Walker); 310 339 } 311 ASSERT(MinimumRingSize.find( Root->GetTrueFather()->getNr()) != MinimumRingSize.end(),340 ASSERT(MinimumRingSize.find(Walker->GetTrueFather()->getNr()) != MinimumRingSize.end(), 312 341 "CyclicStructureAnalysis::AssignRingSizetoNonCycleMembers() - BFSToNextCycle did not set MinimumRingSize of " 313 +toString(*( Root->GetTrueFather()))+".");314 LOG(1, "INFO: Minimum ring size of " << * Root << " is " << MinimumRingSize[Root->GetTrueFather()->getNr()] << "." << endl);315 } 316 LOG(1, "INFO: Minimum ring size is " << MinRingSize << ", over " << NumCycles << " cycle s total." << endl);342 +toString(*(Walker->GetTrueFather()))+"."); 343 LOG(1, "INFO: Minimum ring size of " << *Walker << " is " << MinimumRingSize[Walker->GetTrueFather()->getNr()] << "."); 344 } 345 LOG(1, "INFO: Minimum ring size is " << MinRingSize << ", over " << NumCycles << " cycle(s) total."); 317 346 } else 318 LOG(1, "INFO: No rings were detected in the molecular structure." << endl);347 LOG(1, "INFO: No rings were detected in the molecular structure."); 319 348 } 320 349 … … 336 365 int MinRingSize = -1; 337 366 338 //std::stringstream output; 339 //output << "Back edge list - "; 340 //BackEdgeStack->Output(output); 341 //LOG(0, output.str()); 342 343 LOG(1, "STATUS: Analysing cycles ... " << endl); 367 { 368 std::stringstream output; 369 output << "Back edge list - "; 370 for (std::deque<bond::ptr >::const_iterator iter = BackEdgeStack->begin(); 371 iter != BackEdgeStack->end(); ++iter) 372 output << **iter << " "; 373 LOG(0, output.str()); 374 } 375 376 LOG(1, "STATUS: Analysing cycles ... "); 344 377 NumCycles = 0; 345 378 while (!BackEdgeStack->empty()) { … … 353 386 InitializeToRoot(Walker); 354 387 355 LOG(1, "---------------------------------------------------------------------------------------------------------" << endl);388 LOG(1, "---------------------------------------------------------------------------------------------------------"); 356 389 OtherAtom = NULL; 357 390 // go to next cycle via BFS 358 CyclicBFSFromRootToRoot( BackEdge);391 CyclicBFSFromRootToRoot(OtherAtom, BackEdge); 359 392 // get all member nodes of this cycle 360 RetrieveCycleMembers(OtherAtom, BackEdge, MinRingSize );393 RetrieveCycleMembers(OtherAtom, BackEdge, MinRingSize, NumCycles); 361 394 362 395 CleanAllTouched(); -
src/Graph/CyclicStructureAnalysis.hpp
rfb9f6d r8dbcaf 43 43 void InitializeToRoot(atom *&Walker); 44 44 // performing tasks 45 void CyclicBFSFromRootToRoot( bond::ptr &BackEdge);46 void RetrieveCycleMembers(atom *&OtherAtom, bond::ptr &BackEdge, int &MinRingSize );47 void BFSToNextCycle(atom * &Root, atom *&Walker);48 void AssignRingSizetoNonCycleMembers( int &MinRingSize, int &NumCycles);45 void CyclicBFSFromRootToRoot(atom *&OtherAtom, bond::ptr &BackEdge); 46 void RetrieveCycleMembers(atom *&OtherAtom, bond::ptr &BackEdge, int &MinRingSize, int &NumCycles); 47 void BFSToNextCycle(atom *Walker); 48 void AssignRingSizetoNonCycleMembers(const int MinRingSize, const int NumCycles); 49 49 // output 50 50 void OutputAlreadyVisited(int *list); -
src/Graph/DepthFirstSearchAnalysis.cpp
rfb9f6d r8dbcaf 130 130 return false; 131 131 } 132 bond::ptr Binder = BackEdgeStack.front(); 133 bond::ptr FirstBond = Binder; // mark the first bond, so that we don't loop through the stack indefinitely 134 atom *Walker = NULL, *OtherAtom = NULL; 132 std::deque<bond::ptr > MyBackEdgeStack = BackEdgeStack; 135 133 136 134 do { // go through all bonds and push local ones 135 const bond::ptr &Binder = MyBackEdgeStack.front(); // loop the stack for next item 136 MyBackEdgeStack.pop_front(); 137 LOG(3, "INFO: Current candidate edge " << *Binder << "."); 137 138 const ListOfLocalAtoms_t::const_iterator leftiter = ListOfLocalAtoms.find(Binder->leftatom->getNr()); 138 139 ASSERT( leftiter != ListOfLocalAtoms.end(), 139 140 "DepthFirstSearchAnalysis::PickLocalBackEdges() - could not find atom id " 140 141 +toString(Binder->leftatom->getNr())+" in ListOfLocalAtoms."); 141 Walker = leftiter->second; // get one atom in the reference molecule142 atom * const Walker = leftiter->second; // get one atom in the reference molecule 142 143 if (Walker != NULL) { // if this Walker exists in the subgraph ... 143 144 const BondList& ListOfBonds = Walker->getListOfBonds(); … … 145 146 Runner != ListOfBonds.end(); 146 147 ++Runner) { 147 OtherAtom = (*Runner)->GetOtherAtom(Walker);148 atom * const OtherAtom = (*Runner)->GetOtherAtom(Walker); 148 149 const ListOfLocalAtoms_t::const_iterator rightiter = ListOfLocalAtoms.find((*Runner)->rightatom->getNr()); 149 150 if (OtherAtom == rightiter->second) { // found the bond … … 154 155 } 155 156 } 156 ASSERT(!BackEdgeStack.empty(), "DepthFirstSearchAnalysis::PickLocalBackEdges() - ReferenceStack is empty!"); 157 Binder = BackEdgeStack.front(); // loop the stack for next item 158 LOG(3, "Current candidate edge " << Binder << "."); 159 } while (FirstBond != Binder); 157 } while (!MyBackEdgeStack.empty()); 160 158 161 159 return status;
Note:
See TracChangeset
for help on using the changeset viewer.