Changeset 47548d for molecuilder/src/molecules.cpp
- Timestamp:
- Jul 23, 2009, 2:04:47 PM (16 years ago)
- Children:
- c3a303
- Parents:
- f39735 (diff), 1f6efb (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/molecules.cpp
rf39735 r47548d 1860 1860 bool molecule::RemoveAtom(atom *pointer) 1861 1861 { 1862 if (ElementsInMolecule[pointer->type->Z] != 0) // this would indicate an error1862 if (ElementsInMolecule[pointer->type->Z] != 0) { // this would indicate an error 1863 1863 ElementsInMolecule[pointer->type->Z]--; // decrease number of atom of this element 1864 else 1864 AtomCount--; 1865 } else 1865 1866 cerr << "ERROR: Atom " << pointer->Name << " is of element " << pointer->type->Z << " but the entry in the table of the molecule is 0!" << endl; 1866 1867 if (ElementsInMolecule[pointer->type->Z] == 0) // was last atom of this element? … … 2845 2846 ColorList[i] = white; 2846 2847 } 2847 2848 2848 2849 *out << Verbose(1) << "Back edge list - "; 2849 2850 BackEdgeStack->Output(out); … … 3852 3853 OtherAtom = ListOfBondsPerAtom[Walker->nr][i]->GetOtherAtom(Walker); 3853 3854 if (OtherAtom == ListOfLocalAtoms[Binder->rightatom->nr]) { // found the bond 3854 3855 3855 LocalStack->Push(ListOfBondsPerAtom[Walker->nr][i]); 3856 *out << Verbose(3) << "Found local edge " << *(ListOfBondsPerAtom[Walker->nr][i]) << "." << endl; 3856 3857 break; 3857 3858 } … … 3861 3862 ReferenceStack->Push(Binder); 3862 3863 } while (FirstBond != Binder); 3863 3864 3864 3865 return status; 3865 3866 }; … … 4006 4007 Walker = start; 4007 4008 while (Walker->next != end) { 4008 Walker = Walker->next; 4009 Walker = Walker->next; 4009 4010 *out << Verbose(4) << "Atom " << Walker->Name << "/" << Walker->nr << " with " << NumberOfBondsPerAtom[Walker->nr] << " bonds: "; 4010 4011 TotalDegree = 0; … … 4365 4366 #ifdef ADDHYDROGEN 4366 4367 && (Walker->type->Z == 1) 4367 #endif4368 ) { // search for first non-hydrogen atom4369 *out << Verbose(4) << "Current Root candidate is " << Walker->Name << "." << endl;4370 Walker = Walker->next;4371 }4372 if (Walker != end)4373 RootStack->Push(Walker);4374 else4375 *out << Verbose(0) << "ERROR: Could not find an appropriate Root atom!" << endl;4376 *out << Verbose(3) << "Root " << Walker->Name << " is on AtomStack, beginning loop through all vertices ..." << endl;4377 4378 ///// OUTER LOOP ////////////4379 while (!RootStack->IsEmpty()) {4380 // get new root vertex from atom stack4381 Root = RootStack->PopFirst();4382 ShortestPathList[Root->nr] = 0;4383 if (Labels[Root->nr] == -1)4384 Labels[Root->nr] = RunningIndex++; // prevent it from getting again on AtomStack4385 PredecessorList[Root->nr] = Root;4386 TouchedStack->Push(Root);4387 *out << Verbose(0) << "Root for this loop is: " << Root->Name << ".\n";4388 4389 // clear snake stack4390 SnakeStack->ClearStack();4391 //SnakeStack->TestImplementation(out, start->next);4392 4393 ///// INNER LOOP ////////////4394 // Problems:4395 // - what about cyclic bonds?4396 Walker = Root;4397 do {4398 *out << Verbose(1) << "Current Walker is: " << Walker->Name;4399 // initial setting of the new Walker: label, color, shortest path and put on stacks4400 if (Labels[Walker->nr] == -1) { // give atom a unique, monotonely increasing number4401 Labels[Walker->nr] = RunningIndex++;4402 RootStack->Push(Walker);4403 }4404 *out << ", has label " << Labels[Walker->nr];4405 if ((ColorVertexList[Walker->nr] == white) || ((Binder != NULL) && (ColorEdgeList[Binder->nr] == white))) { // color it if newly discovered and push on stacks (and if within reach!)4406 if ((Binder != NULL) && (ColorEdgeList[Binder->nr] == white)) {4407 // Binder ought to be set still from last neighbour search4408 *out << ", coloring bond " << *Binder << " black";4409 ColorEdgeList[Binder->nr] = black; // mark this bond as used4410 }4411 if (ShortestPathList[Walker->nr] == -1) {4412 ShortestPathList[Walker->nr] = ShortestPathList[PredecessorList[Walker->nr]->nr]+1;4413 TouchedStack->Push(Walker); // mark every atom for lists cleanup later, whose shortest path has been changed4414 }4415 if ((ShortestPathList[Walker->nr] < Order) && (ColorVertexList[Walker->nr] != darkgray)) { // if not already on snake stack4416 SnakeStack->Push(Walker);4417 ColorVertexList[Walker->nr] = darkgray; // mark as dark gray of on snake stack4418 4368 } 4419 4369 } … … 4452 4402 } else { // otherwise check its colour and element 4453 4403 if ( 4454 #ifdef ADDHYDROGEN4455 4404 (OtherAtom->type->Z != 1) && 4456 4405 #endif
Note:
See TracChangeset
for help on using the changeset viewer.