Changeset d50d2a for molecuilder/src/molecules.cpp
- Timestamp:
- May 7, 2008, 1:38:13 PM (17 years ago)
- Children:
- a01955
- Parents:
- 417bb5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified molecuilder/src/molecules.cpp ¶
r417bb5 rd50d2a 1419 1419 MoleculeLeafClass * molecule::DepthFirstSearchAnalysis(ofstream *out, bool ReturnStack, int &MinimumRingSize) 1420 1420 { 1421 AtomStackClass *AtomStack = new AtomStackClass(AtomCount); 1421 class StackClass<atom *> *AtomStack; 1422 AtomStack = new StackClass<atom *>(AtomCount); 1423 class StackClass<bond *> *BackEdgeStack = new StackClass<bond *> (BondCount); 1422 1424 MoleculeLeafClass *SubGraphs = new MoleculeLeafClass(NULL); 1423 1425 MoleculeLeafClass *LeafWalker = SubGraphs; 1424 1426 int CurrentGraphNr = 0, OldGraphNr; 1425 int CyclicBonds;1426 1427 int ComponentNumber = 0; 1427 1428 atom *Walker = NULL, *OtherAtom = NULL, *Root = start->next; … … 1434 1435 ResetAllAtomNumbers(); 1435 1436 InitComponentNumbers(); 1437 BackEdgeStack->ClearStack(); 1436 1438 while (Root != end) { // if there any atoms at all 1437 1439 // (1) mark all edges unused, empty stack, set atom->GraphNr = 0 for all … … 1468 1470 // (4a) ... if "other" atom has been visited (GraphNr != 0), set lowpoint to minimum of both, go to (3) 1469 1471 Binder->Type = BackEdge; 1472 BackEdgeStack->Push(Binder); 1470 1473 Walker->LowpointNr = ( Walker->LowpointNr < OtherAtom->GraphNr ) ? Walker->LowpointNr : OtherAtom->GraphNr; 1471 1474 *out << Verbose(3) << "(4a) Visited: Setting Lowpoint of Walker[" << Walker->Name << "] to " << Walker->LowpointNr << "." << endl; … … 1568 1571 } 1569 1572 1570 // correct cyclic bonds that are not included in "same LP" argument 1571 Binder = first; 1572 while (Binder->next != last) { 1573 Binder = Binder->next; 1574 Walker = Binder->leftatom; 1575 OtherAtom = Binder->rightatom; 1576 // now check whether both have a cyclic bond in their list 1577 CyclicBonds = 0; // counts cyclic bonds; 1578 for(int i=0;i<NumberOfBondsPerAtom[Walker->nr];i++) 1579 if ((CyclicBonds == 0) && (ListOfBondsPerAtom[Walker->nr][i]->Cyclic)) 1580 CyclicBonds = 1; 1581 for(int i=0;i<NumberOfBondsPerAtom[OtherAtom->nr];i++) 1582 if ((CyclicBonds == 1) && (ListOfBondsPerAtom[OtherAtom->nr][i]->Cyclic)) 1583 CyclicBonds = 2; 1584 Binder->Cyclic = (Binder->Cyclic) || (CyclicBonds == 2); // set the Cyclic criterium either or ... 1585 } 1586 1587 // further analysis of the found cycles (print rings, get minimum cycle length) 1573 // analysis of the cycles (print rings, get minimum cycle length) 1588 1574 CyclicStructureAnalysis(out, MinimumRingSize); 1575 1589 1576 *out << Verbose(1) << "Final graph info for each atom is:" << endl; 1590 1577 Walker = start; … … 1624 1611 void molecule::CyclicStructureAnalysis(ofstream *out, int &MinimumRingSize) 1625 1612 { 1626 AtomStackClass *AtomStack = new AtomStackClass(AtomCount);1613 class StackClass<atom *> *AtomStack = new StackClass<atom *>(AtomCount); 1627 1614 int LP; 1628 1615 atom *Walker = NULL, *OtherAtom = NULL, *Root = NULL, *Runner = NULL; … … 1630 1617 int RingSize, NumCycles; 1631 1618 1632 // go through every atom1619 // count number of cyclic bonds per atom and push all with 3 cyclic bonds onto stack 1633 1620 AtomStack->ClearStack(); 1634 1621 int *NoCyclicBondsPerAtom = (int *) Malloc(sizeof(int)*AtomCount, "molecule::CyclicStructureAnalysis: *NoCyclicBondsPerAtom"); … … 2065 2052 line << path << "/" << FRAGMENTPREFIX << ADJACENCYFILE; 2066 2053 File.open(line.str().c_str(), ios::out); 2067 *out << Verbose(1) << "Looking at bond structure stored in adjacency file and comparing to present one ... " << endl;2054 *out << Verbose(1) << "Looking at bond structure stored in adjacency file and comparing to present one ... "; 2068 2055 if (File != NULL) { 2069 2056 // allocate storage structure … … 2119 2106 status = false; 2120 2107 } 2108 *out << endl; 2121 2109 Free((void **)&buffer, "molecule::CheckAdjacencyFileAgainstMolecule: *buffer"); 2122 2110 … … 2620 2608 2621 2609 /** Adds atoms up to \a BondCount distance from \a *Root and notes them down in \a **AddedAtomList. 2622 * Gray vertices are always enqueued in an AtomStackClassFIFO queue, the rest is usual BFS with adding vertices found was2610 * Gray vertices are always enqueued in an StackClass<atom *> FIFO queue, the rest is usual BFS with adding vertices found was 2623 2611 * white and putting into queue. 2624 2612 * \param *out output stream for debugging … … 2636 2624 int *ShortestPathList = (int *) Malloc(sizeof(int)*AtomCount, "molecule::BreadthFirstSearchAdd: *ShortestPathList"); 2637 2625 enum Shading *ColorList = (enum Shading *) Malloc(sizeof(enum Shading)*AtomCount, "molecule::BreadthFirstSearchAdd: *ColorList"); 2638 AtomStackClass *AtomStack = new AtomStackClass(AtomCount);2626 class StackClass<atom *> *AtomStack = new StackClass<atom *>(AtomCount); 2639 2627 atom *Walker = NULL, *OtherAtom = NULL; 2640 2628 bond *Binder = NULL; … … 2802 2790 2803 2791 2804 /** Looks through a AtomStackClassand returns the likeliest removal candiate.2792 /** Looks through a StackClass<atom *> and returns the likeliest removal candiate. 2805 2793 * \param *out output stream for debugging messages 2806 2794 * \param *&Leaf KeySet to look through … … 2922 2910 enum Shading *ColorVertexList = (enum Shading *) Malloc(sizeof(enum Shading)*AtomCount, "molecule::CreateListOfUniqueFragmentsOfOrder: *ColorList"); 2923 2911 enum Shading *ColorEdgeList = (enum Shading *) Malloc(sizeof(enum Shading)*BondCount, "molecule::CreateListOfUniqueFragmentsOfOrder: *ColorBondList"); 2924 AtomStackClass *RootStack = new AtomStackClass(AtomCount);2925 AtomStackClass *TouchedStack = new AtomStackClass((int)pow(4,Order)+2); // number of atoms reached from one with maximal 4 bonds plus Root itself2926 AtomStackClass *SnakeStack = new AtomStackClass(Order+1); // equal to Order is not possible, as then the AtomStackClasscannot discern between full and empty stack!2912 StackClass<atom *> *RootStack = new StackClass<atom *>(AtomCount); 2913 StackClass<atom *> *TouchedStack = new StackClass<atom *>((int)pow(4,Order)+2); // number of atoms reached from one with maximal 4 bonds plus Root itself 2914 StackClass<atom *> *SnakeStack = new StackClass<atom *>(Order+1); // equal to Order is not possible, as then the StackClass<atom *> cannot discern between full and empty stack! 2927 2915 MoleculeLeafClass *Leaflet = NULL, *TempLeaf = NULL; 2928 2916 MoleculeListClass *FragmentList = NULL; … … 3489 3477 double tmp; 3490 3478 vector TranslationVector; 3491 // AtomStackClass*CompStack = NULL;3492 AtomStackClass *AtomStack = new AtomStackClass(AtomCount);3479 //class StackClass<atom *> *CompStack = NULL; 3480 class StackClass<atom *> *AtomStack = new StackClass<atom *>(AtomCount); 3493 3481 bool flag = true; 3494 3482
Note:
See TracChangeset
for help on using the changeset viewer.