Changeset 543ce4 for molecuilder/src/moleculelist.cpp
- Timestamp:
- Nov 4, 2009, 7:56:04 PM (16 years ago)
- Children:
- 4ef101, aa8542
- Parents:
- ec70ec
- File:
-
- 1 edited
-
molecuilder/src/moleculelist.cpp (modified) (53 diffs)
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/moleculelist.cpp
rec70ec r543ce4 13 13 #include "linkedcell.hpp" 14 14 #include "lists.hpp" 15 #include "log.hpp" 15 16 #include "molecule.hpp" 16 17 #include "memoryallocator.hpp" … … 32 33 MoleculeListClass::~MoleculeListClass() 33 34 { 34 cout<< Verbose(3) << this << ": Freeing ListOfMolcules." << endl;35 Log() << Verbose(3) << this << ": Freeing ListOfMolcules." << endl; 35 36 for (MoleculeList::iterator ListRunner = ListOfMolecules.begin(); ListRunner != ListOfMolecules.end(); ListRunner++) { 36 cout<< Verbose(4) << "ListOfMolecules: Freeing " << *ListRunner << "." << endl;37 Log() << Verbose(4) << "ListOfMolecules: Freeing " << *ListRunner << "." << endl; 37 38 delete (*ListRunner); 38 39 } 39 cout<< Verbose(4) << "Freeing ListOfMolecules." << endl;40 Log() << Verbose(4) << "Freeing ListOfMolecules." << endl; 40 41 ListOfMolecules.clear(); // empty list 41 42 }; … … 65 66 66 67 // sort each atom list and put the numbers into a list, then go through 67 // cout<< "Comparing fragment no. " << *(molecule **)a << " to " << *(molecule **)b << "." << endl;68 //Log() << Verbose(0) << "Comparing fragment no. " << *(molecule **)a << " to " << *(molecule **)b << "." << endl; 68 69 if ((**(molecule **) a).AtomCount < (**(molecule **) b).AtomCount) { 69 70 return -1; … … 141 142 142 143 // header 143 *out<< "Index\tName\t\tAtoms\tFormula\tCenter\tSize" << endl;144 cout<< Verbose(0) << "-----------------------------------------------" << endl;144 Log() << Verbose(0) << "Index\tName\t\tAtoms\tFormula\tCenter\tSize" << endl; 145 Log() << Verbose(0) << "-----------------------------------------------" << endl; 145 146 if (ListOfMolecules.size() == 0) 146 *out<< "\tNone" << endl;147 Log() << Verbose(0) << "\tNone" << endl; 147 148 else { 148 149 Origin.Zero(); … … 161 162 } 162 163 // output Index, Name, number of atoms, chemical formula 163 *out<< ((*ListRunner)->ActiveFlag ? "*" : " ") << (*ListRunner)->IndexNr << "\t" << (*ListRunner)->name << "\t\t" << (*ListRunner)->AtomCount << "\t";164 Log() << Verbose(0) << ((*ListRunner)->ActiveFlag ? "*" : " ") << (*ListRunner)->IndexNr << "\t" << (*ListRunner)->name << "\t\t" << (*ListRunner)->AtomCount << "\t"; 164 165 Elemental = (*ListRunner)->elemente->end; 165 166 while(Elemental->previous != (*ListRunner)->elemente->start) { 166 167 Elemental = Elemental->previous; 167 168 if (Counts[Elemental->Z] != 0) 168 *out<< Elemental->symbol << Counts[Elemental->Z];169 Log() << Verbose(0) << Elemental->symbol << Counts[Elemental->Z]; 169 170 } 170 171 // Center and size 171 *out<< "\t" << (*ListRunner)->Center << "\t" << sqrt(size) << endl;172 Log() << Verbose(0) << "\t" << (*ListRunner)->Center << "\t" << sqrt(size) << endl; 172 173 } 173 174 } … … 310 311 Tesselation *TesselStruct = NULL; 311 312 if ((srcmol == NULL) || (mol == NULL)) { 312 cout<< Verbose(1) << "ERROR: Either fixed or variable molecule is given as NULL." << endl;313 Log() << Verbose(1) << "ERROR: Either fixed or variable molecule is given as NULL." << endl; 313 314 return false; 314 315 } … … 316 317 // calculate envelope for *mol 317 318 LCList = new LinkedCell(mol, 8.); 318 FindNonConvexBorder( (ofstream *)&cout,mol, TesselStruct, (const LinkedCell *&)LCList, 4., NULL);319 FindNonConvexBorder(mol, TesselStruct, (const LinkedCell *&)LCList, 4., NULL); 319 320 if (TesselStruct == NULL) { 320 cout<< Verbose(1) << "ERROR: Could not tesselate the fixed molecule." << endl;321 Log() << Verbose(1) << "ERROR: Could not tesselate the fixed molecule." << endl; 321 322 return false; 322 323 } … … 325 326 326 327 // prepare index list for bonds 327 srcmol->CountAtoms( (ofstream *)&cout);328 srcmol->CountAtoms(); 328 329 atom ** CopyAtoms = new atom*[srcmol->AtomCount]; 329 330 for(int i=0;i<srcmol->AtomCount;i++) … … 335 336 while (Walker->next != srcmol->end) { 336 337 Walker = Walker->next; 337 cout<< Verbose(2) << "INFO: Current Walker is " << *Walker << "." << endl;338 if (!TesselStruct->IsInnerPoint( (ofstream *)&cout,Walker->x, LCList)) {338 Log() << Verbose(2) << "INFO: Current Walker is " << *Walker << "." << endl; 339 if (!TesselStruct->IsInnerPoint(Walker->x, LCList)) { 339 340 CopyAtoms[Walker->nr] = new atom(Walker); 340 341 mol->AddAtom(CopyAtoms[Walker->nr]); … … 344 345 } 345 346 } 346 cout<< Verbose(1) << nr << " of " << srcmol->AtomCount << " atoms have been merged.";347 Log() << Verbose(1) << nr << " of " << srcmol->AtomCount << " atoms have been merged."; 347 348 348 349 // go through all bonds and add as well … … 350 351 while(Binder->next != srcmol->last) { 351 352 Binder = Binder->next; 352 cout<< Verbose(3) << "Adding Bond between " << *CopyAtoms[Binder->leftatom->nr] << " and " << *CopyAtoms[Binder->rightatom->nr]<< "." << endl;353 Log() << Verbose(3) << "Adding Bond between " << *CopyAtoms[Binder->leftatom->nr] << " and " << *CopyAtoms[Binder->rightatom->nr]<< "." << endl; 353 354 mol->AddBond(CopyAtoms[Binder->leftatom->nr], CopyAtoms[Binder->rightatom->nr], Binder->BondDegree); 354 355 } … … 362 363 void MoleculeListClass::Output(ofstream *out) 363 364 { 364 *out<< Verbose(1) << "MoleculeList: ";365 Log() << Verbose(1) << "MoleculeList: "; 365 366 for (MoleculeList::iterator ListRunner = ListOfMolecules.begin(); ListRunner != ListOfMolecules.end(); ListRunner++) 366 *out<< *ListRunner << "\t";367 *out<< endl;367 Log() << Verbose(0) << *ListRunner << "\t"; 368 Log() << Verbose(0) << endl; 368 369 }; 369 370 … … 375 376 * \param *path path to file 376 377 */ 377 bool MoleculeListClass::AddHydrogenCorrection( ofstream *out,char *path)378 bool MoleculeListClass::AddHydrogenCorrection(char *path) 378 379 { 379 380 atom *Walker = NULL; … … 391 392 char *FragmentNumber = NULL; 392 393 393 cout<< Verbose(1) << "Saving hydrogen saturation correction ... ";394 Log() << Verbose(1) << "Saving hydrogen saturation correction ... "; 394 395 // 0. parse in fit constant files that should have the same dimension as the final energy files 395 396 // 0a. find dimension of matrices with constants … … 401 402 input.open(line.c_str()); 402 403 if (input == NULL) { 403 cerr<< endl << "Unable to open " << line << ", is the directory correct?"404 eLog() << Verbose(0) << endl << "Unable to open " << line << ", is the directory correct?" 404 405 << endl; 405 406 return false; … … 419 420 b++; 420 421 } 421 cout<< "I recognized " << a << " columns and " << b << " rows, ";422 Log() << Verbose(0) << "I recognized " << a << " columns and " << b << " rows, "; 422 423 input.close(); 423 424 … … 440 441 input.open(line.c_str()); 441 442 if (input == NULL) { 442 cerr<< endl << "Unable to open " << line << ", is the directory correct?" << endl;443 eLog() << Verbose(0) << endl << "Unable to open " << line << ", is the directory correct?" << endl; 443 444 return false; 444 445 } … … 446 447 while ((!input.eof()) && (k < b)) { 447 448 input.getline(ParsedLine, 1023); 448 // cout<< "Current Line: " << ParsedLine << endl;449 //Log() << Verbose(0) << "Current Line: " << ParsedLine << endl; 449 450 zeile.str(ParsedLine); 450 451 zeile.clear(); … … 452 453 while ((!zeile.eof()) && (l < a)) { 453 454 zeile >> FitConstant[i][l][k]; 454 // cout<< FitConstant[i][l][k] << "\t";455 //Log() << Verbose(0) << FitConstant[i][l][k] << "\t"; 455 456 l++; 456 457 } 457 // cout<< endl;458 //Log() << Verbose(0) << endl; 458 459 k++; 459 460 } … … 461 462 } 462 463 for (int k = 0; k < 3; k++) { 463 cout<< "Constants " << k << ":" << endl;464 Log() << Verbose(0) << "Constants " << k << ":" << endl; 464 465 for (int j = 0; j < b; j++) { 465 466 for (int i = 0; i < a; i++) { 466 cout<< FitConstant[k][i][j] << "\t";467 Log() << Verbose(0) << FitConstant[k][i][j] << "\t"; 467 468 } 468 cout<< endl;469 } 470 cout<< endl;469 Log() << Verbose(0) << endl; 470 } 471 Log() << Verbose(0) << endl; 471 472 } 472 473 … … 486 487 while (Walker->next != (*ListRunner)->end) { 487 488 Walker = Walker->next; 488 // cout<< Verbose(1) << "Walker: " << *Walker << " with first bond " << *(Walker->ListOfBonds.begin()) << "." << endl;489 //Log() << Verbose(1) << "Walker: " << *Walker << " with first bond " << *(Walker->ListOfBonds.begin()) << "." << endl; 489 490 if ((Walker->type->Z == 1) && ((Walker->father == NULL) 490 491 || (Walker->father->type->Z != 1))) { // if it's a hydrogen … … 492 493 while (Runner->next != (*ListRunner)->end) { 493 494 Runner = Runner->next; 494 // cout<< Verbose(2) << "Runner: " << *Runner << " with first bond " << *(Walker->ListOfBonds.begin()) << "." << endl;495 //Log() << Verbose(2) << "Runner: " << *Runner << " with first bond " << *(Walker->ListOfBonds.begin()) << "." << endl; 495 496 // 3. take every other hydrogen that is the not the first and not bound to same bonding partner 496 497 Binder = *(Runner->ListOfBonds.begin()); … … 498 499 // 4. evaluate the morse potential for each matrix component and add up 499 500 distance = Runner->x.Distance(&Walker->x); 500 // cout<< "Fragment " << (*ListRunner)->name << ": " << *Runner << "<= " << distance << "=>" << *Walker << ":" << endl;501 //Log() << Verbose(0) << "Fragment " << (*ListRunner)->name << ": " << *Runner << "<= " << distance << "=>" << *Walker << ":" << endl; 501 502 for (int k = 0; k < a; k++) { 502 503 for (int j = 0; j < b; j++) { … … 511 512 }; 512 513 correction[k][j] -= tmp; // ground state is actually lower (disturbed by additional interaction) 513 // cout<< tmp << "\t";514 //Log() << Verbose(0) << tmp << "\t"; 514 515 } 515 // cout<< endl;516 //Log() << Verbose(0) << endl; 516 517 } 517 // cout<< endl;518 //Log() << Verbose(0) << endl; 518 519 } 519 520 } … … 556 557 } 557 558 Free(&FitConstant); 558 cout<< "done." << endl;559 Log() << Verbose(0) << "done." << endl; 559 560 return true; 560 561 }; … … 566 567 * \return true - file written successfully, false - writing failed 567 568 */ 568 bool MoleculeListClass::StoreForcesFile( ofstream *out,char *path,569 bool MoleculeListClass::StoreForcesFile(char *path, 569 570 int *SortIndex) 570 571 { … … 576 577 577 578 // open file for the force factors 578 *out<< Verbose(1) << "Saving force factors ... ";579 Log() << Verbose(1) << "Saving force factors ... "; 579 580 line << path << "/" << FRAGMENTPREFIX << FORCESFILE; 580 581 ForcesFile.open(line.str().c_str(), ios::out); 581 582 if (ForcesFile != NULL) { 582 // cout<< Verbose(1) << "Final AtomicForcesList: ";583 //Log() << Verbose(1) << "Final AtomicForcesList: "; 583 584 //output << prefix << "Forces" << endl; 584 585 for (MoleculeList::iterator ListRunner = ListOfMolecules.begin(); ListRunner != ListOfMolecules.end(); ListRunner++) { … … 592 593 if (Walker->type->Z == runner->Z) { 593 594 if ((Walker->GetTrueFather() != NULL) && (Walker->GetTrueFather() != Walker)) {// if there is a rea 594 // cout<< "Walker is " << *Walker << " with true father " << *( Walker->GetTrueFather()) << ", it595 //Log() << Verbose(0) << "Walker is " << *Walker << " with true father " << *( Walker->GetTrueFather()) << ", it 595 596 ForcesFile << SortIndex[Walker->GetTrueFather()->nr] << "\t"; 596 597 } else … … 604 605 } 605 606 ForcesFile.close(); 606 *out<< Verbose(1) << "done." << endl;607 Log() << Verbose(1) << "done." << endl; 607 608 } else { 608 609 status = false; 609 *out<< Verbose(1) << "failed to open file " << line.str() << "." << endl;610 Log() << Verbose(1) << "failed to open file " << line.str() << "." << endl; 610 611 } 611 612 ForcesFile.close(); … … 622 623 * \return true - success (each file was written), false - something went wrong. 623 624 */ 624 bool MoleculeListClass::OutputConfigForListOfFragments( ofstream *out,config *configuration, int *SortIndex)625 bool MoleculeListClass::OutputConfigForListOfFragments(config *configuration, int *SortIndex) 625 626 { 626 627 ofstream outputFragment; … … 643 644 strcpy(PathBackup, path); 644 645 else 645 cerr<< "OutputConfigForListOfFragments: NULL default path obtained from config!" << endl;646 eLog() << Verbose(0) << "OutputConfigForListOfFragments: NULL default path obtained from config!" << endl; 646 647 647 648 // correct periodic 648 (*ListRunner)->ScanForPeriodicCorrection( out);649 (*ListRunner)->ScanForPeriodicCorrection(); 649 650 650 651 // output xyz file … … 652 653 sprintf(FragmentName, "%s/%s%s.conf.xyz", configuration->configpath, FRAGMENTPREFIX, FragmentNumber); 653 654 outputFragment.open(FragmentName, ios::out); 654 *out<< Verbose(2) << "Saving bond fragment No. " << FragmentNumber << "/" << FragmentCounter - 1 << " as XYZ ...";655 Log() << Verbose(2) << "Saving bond fragment No. " << FragmentNumber << "/" << FragmentCounter - 1 << " as XYZ ..."; 655 656 if ((intermediateResult = (*ListRunner)->OutputXYZ(&outputFragment))) 656 *out<< " done." << endl;657 Log() << Verbose(0) << " done." << endl; 657 658 else 658 *out<< " failed." << endl;659 Log() << Verbose(0) << " failed." << endl; 659 660 result = result && intermediateResult; 660 661 outputFragment.close(); … … 662 663 663 664 // list atoms in fragment for debugging 664 *out<< Verbose(2) << "Contained atoms: ";665 Log() << Verbose(2) << "Contained atoms: "; 665 666 Walker = (*ListRunner)->start; 666 667 while (Walker->next != (*ListRunner)->end) { 667 668 Walker = Walker->next; 668 *out<< Walker->Name << " ";669 } 670 *out<< endl;669 Log() << Verbose(0) << Walker->Name << " "; 670 } 671 Log() << Verbose(0) << endl; 671 672 672 673 // center on edge 673 (*ListRunner)->CenterEdge( out,&BoxDimension);674 (*ListRunner)->CenterEdge(&BoxDimension); 674 675 (*ListRunner)->SetBoxDimension(&BoxDimension); // update Box of atoms by boundary 675 676 int j = -1; … … 692 693 // and save as config 693 694 sprintf(FragmentName, "%s/%s%s.conf", configuration->configpath, FRAGMENTPREFIX, FragmentNumber); 694 *out<< Verbose(2) << "Saving bond fragment No. " << FragmentNumber << "/" << FragmentCounter - 1 << " as config ...";695 Log() << Verbose(2) << "Saving bond fragment No. " << FragmentNumber << "/" << FragmentCounter - 1 << " as config ..."; 695 696 if ((intermediateResult = configuration->Save(FragmentName, (*ListRunner)->elemente, (*ListRunner)))) 696 *out<< " done." << endl;697 Log() << Verbose(0) << " done." << endl; 697 698 else 698 *out<< " failed." << endl;699 Log() << Verbose(0) << " failed." << endl; 699 700 result = result && intermediateResult; 700 701 … … 704 705 // and save as mpqc input file 705 706 sprintf(FragmentName, "%s/%s%s.conf", configuration->configpath, FRAGMENTPREFIX, FragmentNumber); 706 *out<< Verbose(2) << "Saving bond fragment No. " << FragmentNumber << "/" << FragmentCounter - 1 << " as mpqc input ...";707 Log() << Verbose(2) << "Saving bond fragment No. " << FragmentNumber << "/" << FragmentCounter - 1 << " as mpqc input ..."; 707 708 if ((intermediateResult = configuration->SaveMPQC(FragmentName, (*ListRunner)))) 708 *out<< " done." << endl;709 Log() << Verbose(2) << " done." << endl; 709 710 else 710 *out<< " failed." << endl;711 Log() << Verbose(0) << " failed." << endl; 711 712 712 713 result = result && intermediateResult; … … 715 716 Free(&FragmentNumber); 716 717 } 717 cout<< " done." << endl;718 Log() << Verbose(0) << " done." << endl; 718 719 719 720 // printing final number 720 *out<< "Final number of fragments: " << FragmentCounter << "." << endl;721 Log() << Verbose(2) << "Final number of fragments: " << FragmentCounter << "." << endl; 721 722 722 723 return result; … … 739 740 * \param *configuration config with BondGraph 740 741 */ 741 void MoleculeListClass::DissectMoleculeIntoConnectedSubgraphs( ofstream * const out,molecule * const mol, config * const configuration)742 void MoleculeListClass::DissectMoleculeIntoConnectedSubgraphs(molecule * const mol, config * const configuration) 742 743 { 743 744 // 1. dissect the molecule into connected subgraphs 744 configuration ->BG->ConstructBondGraph( out,mol);745 configuration ->BG->ConstructBondGraph(mol); 745 746 746 747 // 2. scan for connected subgraphs 747 748 MoleculeLeafClass *Subgraphs = NULL; // list of subgraphs from DFS analysis 748 749 class StackClass<bond *> *BackEdgeStack = NULL; 749 Subgraphs = mol->DepthFirstSearchAnalysis( out,BackEdgeStack);750 Subgraphs = mol->DepthFirstSearchAnalysis(BackEdgeStack); 750 751 delete(BackEdgeStack); 751 752 … … 783 784 Walker = mol->start->next; 784 785 if ((Walker->nr <0) || (Walker->nr >= mol->AtomCount)) { 785 cerr<< "Index of atom " << *Walker << " is invalid!" << endl;786 eLog() << Verbose(0) << "Index of atom " << *Walker << " is invalid!" << endl; 786 787 performCriticalExit(); 787 788 } 788 789 FragmentCounter = MolMap[Walker->nr]; 789 790 if (FragmentCounter != 0) { 790 cout<< Verbose(3) << "Re-linking " << *Walker << "..." << endl;791 Log() << Verbose(3) << "Re-linking " << *Walker << "..." << endl; 791 792 unlink(Walker); 792 793 molecules[FragmentCounter-1]->AddAtom(Walker); // counting starts at 1 793 794 } else { 794 cerr<< "Atom " << *Walker << " not associated to molecule!" << endl;795 eLog() << Verbose(0) << "Atom " << *Walker << " not associated to molecule!" << endl; 795 796 performCriticalExit(); 796 797 } … … 806 807 Free(&MolMap); 807 808 Free(&molecules); 808 cout<< Verbose(1) << "I scanned " << FragmentCounter << " molecules." << endl;809 Log() << Verbose(1) << "I scanned " << FragmentCounter << " molecules." << endl; 809 810 }; 810 811 … … 888 889 * \return true - success, false - faoilure 889 890 */ 890 bool MoleculeLeafClass::FillBondStructureFromReference( ofstream *out,const molecule * const reference, int &FragmentCounter, atom ***&ListOfLocalAtoms, bool FreeList)891 bool MoleculeLeafClass::FillBondStructureFromReference(const molecule * const reference, int &FragmentCounter, atom ***&ListOfLocalAtoms, bool FreeList) 891 892 { 892 893 atom *Walker = NULL; … … 896 897 int AtomNo; 897 898 898 *out<< Verbose(1) << "Begin of FillBondStructureFromReference." << endl;899 Log() << Verbose(1) << "Begin of FillBondStructureFromReference." << endl; 899 900 // fill ListOfLocalAtoms if NULL was given 900 if (!FillListOfLocalAtoms( out,ListOfLocalAtoms, FragmentCounter, reference->AtomCount, FreeList)) {901 *out<< Verbose(1) << "Filling of ListOfLocalAtoms failed." << endl;901 if (!FillListOfLocalAtoms(ListOfLocalAtoms, FragmentCounter, reference->AtomCount, FreeList)) { 902 Log() << Verbose(1) << "Filling of ListOfLocalAtoms failed." << endl; 902 903 return false; 903 904 } 904 905 905 906 if (status) { 906 *out<< Verbose(1) << "Creating adjacency list for subgraph " << Leaf << "." << endl;907 Log() << Verbose(1) << "Creating adjacency list for subgraph " << Leaf << "." << endl; 907 908 // remove every bond from the list 908 909 bond *Binder = NULL; … … 925 926 Leaf->AddBond(Walker, OtherWalker, (*Runner)->BondDegree); 926 927 } else { 927 *out<< Verbose(1) << "OtherWalker = ListOfLocalAtoms[" << FragmentCounter << "][" << (*Runner)->GetOtherAtom(Walker->GetTrueFather())->nr << "] is NULL!" << endl;928 Log() << Verbose(1) << "OtherWalker = ListOfLocalAtoms[" << FragmentCounter << "][" << (*Runner)->GetOtherAtom(Walker->GetTrueFather())->nr << "] is NULL!" << endl; 928 929 status = false; 929 930 } … … 938 939 Free(&ListOfLocalAtoms); 939 940 } 940 *out<< Verbose(1) << "End of FillBondStructureFromReference." << endl;941 Log() << Verbose(1) << "End of FillBondStructureFromReference." << endl; 941 942 return status; 942 943 }; … … 950 951 * \return true - stack is non-empty, fragmentation necessary, false - stack is empty, no more sites to update 951 952 */ 952 bool MoleculeLeafClass::FillRootStackForSubgraphs(ofstream *out, 953 KeyStack *&RootStack, bool *AtomMask, int &FragmentCounter) 953 bool MoleculeLeafClass::FillRootStackForSubgraphs(KeyStack *&RootStack, bool *AtomMask, int &FragmentCounter) 954 954 { 955 955 atom *Walker = NULL, *Father = NULL; … … 970 970 } 971 971 if (next != NULL) 972 next->FillRootStackForSubgraphs( out,RootStack, AtomMask, ++FragmentCounter);972 next->FillRootStackForSubgraphs(RootStack, AtomMask, ++FragmentCounter); 973 973 } else { 974 *out<< Verbose(1) << "Rootstack[" << FragmentCounter << "] is NULL." << endl;974 Log() << Verbose(1) << "Rootstack[" << FragmentCounter << "] is NULL." << endl; 975 975 return false; 976 976 } … … 978 978 return true; 979 979 } else { 980 *out<< Verbose(1) << "Rootstack is NULL." << endl;980 Log() << Verbose(1) << "Rootstack is NULL." << endl; 981 981 return false; 982 982 } … … 991 991 * \return true - success, false - failure 992 992 */ 993 bool MoleculeLeafClass::FillListOfLocalAtoms( ofstream *out,atom ***&ListOfLocalAtoms, const int FragmentCounter, const int GlobalAtomCount, bool &FreeList)993 bool MoleculeLeafClass::FillListOfLocalAtoms(atom ***&ListOfLocalAtoms, const int FragmentCounter, const int GlobalAtomCount, bool &FreeList) 994 994 { 995 995 bool status = true; … … 1006 1006 1007 1007 if ((ListOfLocalAtoms != NULL) && (ListOfLocalAtoms[FragmentCounter] == NULL)) { // allocate and fill list of this fragment/subgraph 1008 status = status && CreateFatherLookupTable( out,Leaf->start, Leaf->end, ListOfLocalAtoms[FragmentCounter], GlobalAtomCount);1008 status = status && CreateFatherLookupTable(Leaf->start, Leaf->end, ListOfLocalAtoms[FragmentCounter], GlobalAtomCount); 1009 1009 FreeList = FreeList && true; 1010 1010 } … … 1023 1023 * \retuen true - success, false - failure 1024 1024 */ 1025 bool MoleculeLeafClass::AssignKeySetsToFragment(ofstream *out, 1026 molecule *reference, Graph *KeySetList, atom ***&ListOfLocalAtoms, 1027 Graph **&FragmentList, int &FragmentCounter, bool FreeList) 1025 bool MoleculeLeafClass::AssignKeySetsToFragment(molecule *reference, Graph *KeySetList, atom ***&ListOfLocalAtoms, Graph **&FragmentList, int &FragmentCounter, bool FreeList) 1028 1026 { 1029 1027 bool status = true; 1030 1028 int KeySetCounter = 0; 1031 1029 1032 *out<< Verbose(1) << "Begin of AssignKeySetsToFragment." << endl;1030 Log() << Verbose(1) << "Begin of AssignKeySetsToFragment." << endl; 1033 1031 // fill ListOfLocalAtoms if NULL was given 1034 if (!FillListOfLocalAtoms( out,ListOfLocalAtoms, FragmentCounter, reference->AtomCount, FreeList)) {1035 *out<< Verbose(1) << "Filling of ListOfLocalAtoms failed." << endl;1032 if (!FillListOfLocalAtoms(ListOfLocalAtoms, FragmentCounter, reference->AtomCount, FreeList)) { 1033 Log() << Verbose(1) << "Filling of ListOfLocalAtoms failed." << endl; 1036 1034 return false; 1037 1035 } … … 1061 1059 delete (TempSet); 1062 1060 if (KeySetCounter == 0) {// if there are no keysets, delete the list 1063 *out<< Verbose(1) << "KeySetCounter is zero, deleting FragmentList." << endl;1061 Log() << Verbose(1) << "KeySetCounter is zero, deleting FragmentList." << endl; 1064 1062 delete (FragmentList[FragmentCounter]); 1065 1063 } else 1066 *out<< Verbose(1) << KeySetCounter << " keysets were assigned to subgraph " << FragmentCounter << "." << endl;1064 Log() << Verbose(1) << KeySetCounter << " keysets were assigned to subgraph " << FragmentCounter << "." << endl; 1067 1065 FragmentCounter++; 1068 1066 if (next != NULL) 1069 next->AssignKeySetsToFragment( out,reference, KeySetList, ListOfLocalAtoms, FragmentList, FragmentCounter, FreeList);1067 next->AssignKeySetsToFragment(reference, KeySetList, ListOfLocalAtoms, FragmentList, FragmentCounter, FreeList); 1070 1068 FragmentCounter--; 1071 1069 } else 1072 *out<< Verbose(1) << "KeySetList is NULL or empty." << endl;1070 Log() << Verbose(1) << "KeySetList is NULL or empty." << endl; 1073 1071 1074 1072 if ((FreeList) && (ListOfLocalAtoms != NULL)) { … … 1078 1076 Free(&ListOfLocalAtoms); 1079 1077 } 1080 *out<< Verbose(1) << "End of AssignKeySetsToFragment." << endl;1078 Log() << Verbose(1) << "End of AssignKeySetsToFragment." << endl; 1081 1079 return status; 1082 1080 }; … … 1089 1087 * \param &TotalGraph Graph to be filled with global numbers 1090 1088 */ 1091 void MoleculeLeafClass::TranslateIndicesToGlobalIDs(ofstream *out, 1092 Graph **FragmentList, int &FragmentCounter, int &TotalNumberOfKeySets, 1093 Graph &TotalGraph) 1094 { 1095 *out << Verbose(1) << "Begin of TranslateIndicesToGlobalIDs." << endl; 1089 void MoleculeLeafClass::TranslateIndicesToGlobalIDs(Graph **FragmentList, int &FragmentCounter, int &TotalNumberOfKeySets, Graph &TotalGraph) 1090 { 1091 Log() << Verbose(1) << "Begin of TranslateIndicesToGlobalIDs." << endl; 1096 1092 KeySet *TempSet = new KeySet; 1097 1093 if (FragmentList[FragmentCounter] != NULL) { … … 1104 1100 delete (TempSet); 1105 1101 } else { 1106 *out<< Verbose(1) << "FragmentList is NULL." << endl;1102 Log() << Verbose(1) << "FragmentList is NULL." << endl; 1107 1103 } 1108 1104 if (next != NULL) 1109 next->TranslateIndicesToGlobalIDs( out,FragmentList, ++FragmentCounter, TotalNumberOfKeySets, TotalGraph);1105 next->TranslateIndicesToGlobalIDs(FragmentList, ++FragmentCounter, TotalNumberOfKeySets, TotalGraph); 1110 1106 FragmentCounter--; 1111 *out<< Verbose(1) << "End of TranslateIndicesToGlobalIDs." << endl;1107 Log() << Verbose(1) << "End of TranslateIndicesToGlobalIDs." << endl; 1112 1108 }; 1113 1109
Note:
See TracChangeset
for help on using the changeset viewer.
