Ignore:
Timestamp:
Apr 27, 2010, 2:25:42 PM (16 years ago)
Author:
Frederik Heber <heber@…>
Children:
90c4460
Parents:
1561e2 (diff), 2bc713 (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.
Message:

Merge branch 'Analysis_PairCorrelation' into StructureRefactoring

Conflicts:

molecuilder/src/Makefile.am
molecuilder/src/World.cpp
molecuilder/src/World.hpp
molecuilder/src/boundary.cpp
molecuilder/src/builder.cpp
molecuilder/src/log.cpp
molecuilder/src/moleculelist.cpp
molecuilder/src/periodentafel.cpp
molecuilder/src/tesselation.cpp
molecuilder/src/unittests/AnalysisCorrelationToSurfaceUnitTest.cpp
molecuilder/src/unittests/Makefile.am
molecuilder/src/unittests/bondgraphunittest.cpp
molecuilder/src/unittests/gslvectorunittest.cpp
molecuilder/src/unittests/logunittest.cpp
molecuilder/src/unittests/tesselation_boundarytriangleunittest.hpp
molecuilder/src/vector.cpp
molecuilder/tests/Tesselations/defs.in

Conflicts have been many and too numerous to listen here, just the few general cases

  • new molecule() replaced by World::getInstance().createMolecule()
  • new atom() replaced by World::getInstance().createAtom() where appropriate.
  • Some DoLog()s added interfered with changes to the message produced by Log() << Verbose(.) << ...
  • DoLog() has been erroneously added to TestRunner.cpp as well, there cout is appropriate
  • ...

Additionally, there was a bug in atom::clone(), sort was set to atom::nr of the atom to clone not of the clone itself. This caused a failure of the fragmentation.

This merge has been fully checked from a clean build directory with subsequent configure,make all install and make check.
It configures, compiles and runs all test cases and the test suite without errors.

Signed-off-by: Frederik Heber <heber@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/molecule_fragmentation.cpp

    r1561e2 r075729  
    1919#include "molecule.hpp"
    2020#include "periodentafel.hpp"
     21#include "World.hpp"
    2122
    2223/************************************* Functions for class molecule *********************************/
     
    4445  }
    4546  FragmentCount = NoNonHydrogen*(1 << (c*order));
    46   Log() << Verbose(1) << "Upper limit for this subgraph is " << FragmentCount << " for " << NoNonHydrogen << " non-H atoms with maximum bond degree of " << c << "." << endl;
     47  DoLog(1) && (Log() << Verbose(1) << "Upper limit for this subgraph is " << FragmentCount << " for " << NoNonHydrogen << " non-H atoms with maximum bond degree of " << c << "." << endl);
    4748  return FragmentCount;
    4849};
     
    6869    } // else it's "-1" or else and thus must not be added
    6970  }
    70   Log() << Verbose(1) << "The scanned KeySet is ";
     71  DoLog(1) && (Log() << Verbose(1) << "The scanned KeySet is ");
    7172  for(KeySet::iterator runner = CurrentSet.begin(); runner != CurrentSet.end(); runner++) {
    72     Log() << Verbose(0) << (*runner) << "\t";
    73   }
    74   Log() << Verbose(0) << endl;
     73    DoLog(0) && (Log() << Verbose(0) << (*runner) << "\t");
     74  }
     75  DoLog(0) && (Log() << Verbose(0) << endl);
    7576  return (status != 0);
    7677};
     
    100101
    101102  // 1st pass: open file and read
    102   Log() << Verbose(1) << "Parsing the KeySet file ... " << endl;
     103  DoLog(1) && (Log() << Verbose(1) << "Parsing the KeySet file ... " << endl);
    103104  sprintf(filename, "%s/%s%s", path, FRAGMENTPREFIX, KEYSETFILE);
    104105  InputFile.open(filename);
     
    113114        testGraphInsert = FragmentList->insert(GraphPair (CurrentSet,pair<int,double>(NumberOfFragments++,1)));  // store fragment number and current factor
    114115        if (!testGraphInsert.second) {
    115           eLog() << Verbose(0) << "KeySet file must be corrupt as there are two equal key sets therein!" << endl;
     116          DoeLog(0) && (eLog()<< Verbose(0) << "KeySet file must be corrupt as there are two equal key sets therein!" << endl);
    116117          performCriticalExit();
    117118        }
     
    122123    InputFile.clear();
    123124    Free(&buffer);
    124     Log() << Verbose(1) << "done." << endl;
     125    DoLog(1) && (Log() << Verbose(1) << "done." << endl);
    125126  } else {
    126     Log() << Verbose(1) << "File " << filename << " not found." << endl;
     127    DoLog(1) && (Log() << Verbose(1) << "File " << filename << " not found." << endl);
    127128    status = false;
    128129  }
     
    154155
    155156  // 2nd pass: open TEFactors file and read
    156   Log() << Verbose(1) << "Parsing the TEFactors file ... " << endl;
     157  DoLog(1) && (Log() << Verbose(1) << "Parsing the TEFactors file ... " << endl);
    157158  sprintf(filename, "%s/%s%s", path, FRAGMENTPREFIX, TEFACTORSFILE);
    158159  InputFile.open(filename);
     
    164165        InputFile >> TEFactor;
    165166        (*runner).second.second = TEFactor;
    166         Log() << Verbose(2) << "Setting " << ++NumberOfFragments << " fragment's TEFactor to " << (*runner).second.second << "." << endl;
     167        DoLog(2) && (Log() << Verbose(2) << "Setting " << ++NumberOfFragments << " fragment's TEFactor to " << (*runner).second.second << "." << endl);
    167168      } else {
    168169        status = false;
     
    172173    // 4. Free and done
    173174    InputFile.close();
    174     Log() << Verbose(1) << "done." << endl;
     175    DoLog(1) && (Log() << Verbose(1) << "done." << endl);
    175176  } else {
    176     Log() << Verbose(1) << "File " << filename << " not found." << endl;
     177    DoLog(1) && (Log() << Verbose(1) << "File " << filename << " not found." << endl);
    177178    status = false;
    178179  }
     
    202203  line += KEYSETFILE;
    203204  output.open(line.c_str(), ios::out);
    204   Log() << Verbose(1) << "Saving key sets of the total graph ... ";
     205  DoLog(1) && (Log() << Verbose(1) << "Saving key sets of the total graph ... ");
    205206  if(output != NULL) {
    206207    for(Graph::iterator runner = KeySetList.begin(); runner != KeySetList.end(); runner++) {
     
    212213      output << endl;
    213214    }
    214     Log() << Verbose(0) << "done." << endl;
     215    DoLog(0) && (Log() << Verbose(0) << "done." << endl);
    215216  } else {
    216     eLog() << Verbose(0) << "Unable to open " << line << " for writing keysets!" << endl;
     217    DoeLog(0) && (eLog()<< Verbose(0) << "Unable to open " << line << " for writing keysets!" << endl);
    217218    performCriticalExit();
    218219    status = false;
     
    243244  line += TEFACTORSFILE;
    244245  output.open(line.c_str(), ios::out);
    245   Log() << Verbose(1) << "Saving TEFactors of the total graph ... ";
     246  DoLog(1) && (Log() << Verbose(1) << "Saving TEFactors of the total graph ... ");
    246247  if(output != NULL) {
    247248    for(Graph::iterator runner = KeySetList.begin(); runner != KeySetList.end(); runner++)
    248249      output << (*runner).second.second << endl;
    249     Log() << Verbose(1) << "done." << endl;
     250    DoLog(1) && (Log() << Verbose(1) << "done." << endl);
    250251  } else {
    251     Log() << Verbose(1) << "failed to open " << line << "." << endl;
     252    DoLog(1) && (Log() << Verbose(1) << "failed to open " << line << "." << endl);
    252253    status = false;
    253254  }
     
    293294        (*PresentItem).second.first = fabs(Value);
    294295        (*PresentItem).second.second = FragOrder;
    295         Log() << Verbose(2) << "Updated element (" <<  (*PresentItem).first << ",[" << (*PresentItem).second.first << "," << (*PresentItem).second.second << "])." << endl;
     296        DoLog(2) && (Log() << Verbose(2) << "Updated element (" <<  (*PresentItem).first << ",[" << (*PresentItem).second.first << "," << (*PresentItem).second.second << "])." << endl);
    296297      } else {
    297         Log() << Verbose(2) << "Did not update element " <<  (*PresentItem).first << " as " << FragOrder << " is less than or equal to " << (*PresentItem).second.second << "." << endl;
     298        DoLog(2) && (Log() << Verbose(2) << "Did not update element " <<  (*PresentItem).first << " as " << FragOrder << " is less than or equal to " << (*PresentItem).second.second << "." << endl);
    298299      }
    299300    } else {
    300       Log() << Verbose(2) << "Inserted element (" <<  (*PresentItem).first << ",[" << (*PresentItem).second.first << "," << (*PresentItem).second.second << "])." << endl;
     301      DoLog(2) && (Log() << Verbose(2) << "Inserted element (" <<  (*PresentItem).first << ",[" << (*PresentItem).second.first << "," << (*PresentItem).second.second << "])." << endl);
    301302    }
    302303  } else {
    303     Log() << Verbose(1) << "No Fragment under No. " << No << "found." << endl;
     304    DoLog(1) && (Log() << Verbose(1) << "No Fragment under No. " << No << "found." << endl);
    304305  }
    305306};
     
    360361  atom *Walker = mol->start;
    361362  map<double, pair<int,int> > *FinalRootCandidates = new map<double, pair<int,int> > ;
    362   Log() << Verbose(1) << "Root candidate list is: " << endl;
     363  DoLog(1) && (Log() << Verbose(1) << "Root candidate list is: " << endl);
    363364  for(map<int, pair<double,int> >::iterator runner = AdaptiveCriteriaList->begin(); runner != AdaptiveCriteriaList->end(); runner++) {
    364365    Walker = mol->FindAtom((*runner).first);
     
    366367      //if ((*runner).second.second >= Walker->AdaptiveOrder) { // only insert if this is an "active" root site for the current order
    367368      if (!Walker->MaxOrder) {
    368         Log() << Verbose(2) << "(" << (*runner).first << ",[" << (*runner).second.first << "," << (*runner).second.second << "])" << endl;
     369        DoLog(2) && (Log() << Verbose(2) << "(" << (*runner).first << ",[" << (*runner).second.first << "," << (*runner).second.second << "])" << endl);
    369370        FinalRootCandidates->insert( make_pair( (*runner).second.first, pair<int,int>((*runner).first, (*runner).second.second) ) );
    370371      } else {
    371         Log() << Verbose(2) << "Excluding (" << *Walker << ", " << (*runner).first << ",[" << (*runner).second.first << "," << (*runner).second.second << "]), as it has reached its maximum order." << endl;
     372        DoLog(2) && (Log() << Verbose(2) << "Excluding (" << *Walker << ", " << (*runner).first << ",[" << (*runner).second.first << "," << (*runner).second.second << "]), as it has reached its maximum order." << endl);
    372373      }
    373374    } else {
    374       eLog() << Verbose(0) << "Atom No. " << (*runner).second.first << " was not found in this molecule." << endl;
     375      DoeLog(0) && (eLog()<< Verbose(0) << "Atom No. " << (*runner).second.first << " was not found in this molecule." << endl);
    375376      performCriticalExit();
    376377    }
     
    397398    Walker = mol->FindAtom(No);
    398399    //if (Walker->AdaptiveOrder < MinimumRingSize[Walker->nr]) {
    399       Log() << Verbose(2) << "Root " << No << " is still above threshold (10^{" << Order <<"}: " << runner->first << ", setting entry " << No << " of Atom mask to true." << endl;
     400      DoLog(2) && (Log() << Verbose(2) << "Root " << No << " is still above threshold (10^{" << Order <<"}: " << runner->first << ", setting entry " << No << " of Atom mask to true." << endl);
    400401      AtomMask[No] = true;
    401402      status = true;
     
    413414void PrintAtomMask(bool *AtomMask, int AtomCount)
    414415{
    415   Log() << Verbose(2) << "              ";
     416  DoLog(2) && (Log() << Verbose(2) << "              ");
    416417  for(int i=0;i<AtomCount;i++)
    417     Log() << Verbose(0) << (i % 10);
    418   Log() << Verbose(0) << endl;
    419   Log() << Verbose(2) << "Atom mask is: ";
     418    DoLog(0) && (Log() << Verbose(0) << (i % 10));
     419  DoLog(0) && (Log() << Verbose(0) << endl);
     420  DoLog(2) && (Log() << Verbose(2) << "Atom mask is: ");
    420421  for(int i=0;i<AtomCount;i++)
    421     Log() << Verbose(0) << (AtomMask[i] ? "t" : "f");
    422   Log() << Verbose(0) << endl;
     422    DoLog(0) && (Log() << Verbose(0) << (AtomMask[i] ? "t" : "f"));
     423  DoLog(0) && (Log() << Verbose(0) << endl);
    423424};
    424425
     
    447448    // transmorph graph keyset list into indexed KeySetList
    448449    if (GlobalKeySetList == NULL) {
    449       eLog() << Verbose(1) << "Given global key set list (graph) is NULL!" << endl;
     450      DoeLog(1) && (eLog()<< Verbose(1) << "Given global key set list (graph) is NULL!" << endl);
    450451      return false;
    451452    }
     
    455456    map<int, pair<double,int> > *AdaptiveCriteriaList = ScanAdaptiveFileIntoMap(path, *IndexKeySetList); // (Root No., (Value, Order)) !
    456457    if (AdaptiveCriteriaList->empty()) {
    457       eLog() << Verbose(2) << "Unable to parse file, incrementing all." << endl;
     458      DoeLog(2) && (eLog()<< Verbose(2) << "Unable to parse file, incrementing all." << endl);
    458459      while (Walker->next != end) {
    459460        Walker = Walker->next;
     
    493494    if (!status) {
    494495      if (Order == 0)
    495         Log() << Verbose(1) << "Single stepping done." << endl;
     496        DoLog(1) && (Log() << Verbose(1) << "Single stepping done." << endl);
    496497      else
    497         Log() << Verbose(1) << "Order at every site is already equal or above desired order " << Order << "." << endl;
     498        DoLog(1) && (Log() << Verbose(1) << "Order at every site is already equal or above desired order " << Order << "." << endl);
    498499    }
    499500  }
     
    512513{
    513514  if (SortIndex != NULL) {
    514     Log() << Verbose(1) << "SortIndex is " << SortIndex << " and not NULL as expected." << endl;
     515    DoLog(1) && (Log() << Verbose(1) << "SortIndex is " << SortIndex << " and not NULL as expected." << endl);
    515516    return false;
    516517  }
     
    563564  bool *AtomMask = NULL;
    564565
    565   Log() << Verbose(0) << endl;
     566  DoLog(0) && (Log() << Verbose(0) << endl);
    566567#ifdef ADDHYDROGEN
    567   Log() << Verbose(0) << "I will treat hydrogen special and saturate dangling bonds with it." << endl;
     568  DoLog(0) && (Log() << Verbose(0) << "I will treat hydrogen special and saturate dangling bonds with it." << endl);
    568569#else
    569   Log() << Verbose(0) << "Hydrogen is treated just like the rest of the lot." << endl;
     570  DoLog(0) && (Log() << Verbose(0) << "Hydrogen is treated just like the rest of the lot." << endl);
    570571#endif
    571572
     
    593594    // fill the bond structure of the individually stored subgraphs
    594595  MolecularWalker->FillBondStructureFromReference(this, FragmentCounter, ListOfLocalAtoms, false);  // we want to keep the created ListOfLocalAtoms
    595     Log() << Verbose(0) << "Analysing the cycles of subgraph " << MolecularWalker->Leaf << " with nr. " << FragmentCounter << "." << endl;
     596    DoLog(0) && (Log() << Verbose(0) << "Analysing the cycles of subgraph " << MolecularWalker->Leaf << " with nr. " << FragmentCounter << "." << endl);
    596597    LocalBackEdgeStack = new StackClass<bond *> (MolecularWalker->Leaf->BondCount);
    597598//    // check the list of local atoms for debugging
     
    602603//      else
    603604//        Log() << Verbose(0) << "\t" << ListOfLocalAtoms[FragmentCounter][i]->Name;
    604     Log() << Verbose(0) << "Gathering local back edges for subgraph " << MolecularWalker->Leaf << " with nr. " << FragmentCounter << "." << endl;
     605    DoLog(0) && (Log() << Verbose(0) << "Gathering local back edges for subgraph " << MolecularWalker->Leaf << " with nr. " << FragmentCounter << "." << endl);
    605606    MolecularWalker->Leaf->PickLocalBackEdges(ListOfLocalAtoms[FragmentCounter++], BackEdgeStack, LocalBackEdgeStack);
    606     Log() << Verbose(0) << "Analysing the cycles of subgraph " << MolecularWalker->Leaf << " with nr. " << FragmentCounter << "." << endl;
     607    DoLog(0) && (Log() << Verbose(0) << "Analysing the cycles of subgraph " << MolecularWalker->Leaf << " with nr. " << FragmentCounter << "." << endl);
    607608    MolecularWalker->Leaf->CyclicStructureAnalysis(LocalBackEdgeStack, MinimumRingSize);
    608     Log() << Verbose(0) << "Done with Analysing the cycles of subgraph " << MolecularWalker->Leaf << " with nr. " << FragmentCounter << "." << endl;
     609    DoLog(0) && (Log() << Verbose(0) << "Done with Analysing the cycles of subgraph " << MolecularWalker->Leaf << " with nr. " << FragmentCounter << "." << endl);
    609610    delete(LocalBackEdgeStack);
    610611  }
     
    637638    while (MolecularWalker->next != NULL) {
    638639      MolecularWalker = MolecularWalker->next;
    639       Log() << Verbose(1) << "Fragmenting subgraph " << MolecularWalker << "." << endl;
     640      DoLog(1) && (Log() << Verbose(1) << "Fragmenting subgraph " << MolecularWalker << "." << endl);
    640641      //MolecularWalker->Leaf->OutputListOfBonds(out);  // output atom::ListOfBonds for debugging
    641642      if (MolecularWalker->Leaf->first->next != MolecularWalker->Leaf->last) {
    642643        // call BOSSANOVA method
    643         Log() << Verbose(0) << endl << " ========== BOND ENERGY of subgraph " << FragmentCounter << " ========================= " << endl;
     644        DoLog(0) && (Log() << Verbose(0) << endl << " ========== BOND ENERGY of subgraph " << FragmentCounter << " ========================= " << endl);
    644645        MolecularWalker->Leaf->FragmentBOSSANOVA(FragmentList[FragmentCounter], RootStack[FragmentCounter], MinimumRingSize);
    645646      } else {
    646         eLog() << Verbose(1) << "Subgraph " << MolecularWalker << " has no atoms!" << endl;
     647        DoeLog(1) && (eLog()<< Verbose(1) << "Subgraph " << MolecularWalker << " has no atoms!" << endl);
    647648      }
    648649      FragmentCounter++;  // next fragment list
    649650    }
    650651  }
    651   Log() << Verbose(2) << "CheckOrder is " << CheckOrder << "." << endl;
     652  DoLog(2) && (Log() << Verbose(2) << "CheckOrder is " << CheckOrder << "." << endl);
    652653  delete[](RootStack);
    653654  delete[](AtomMask);
     
    680681  for(Graph::iterator runner = TotalGraph.begin(); runner != TotalGraph.end(); runner++) {
    681682    KeySet test = (*runner).first;
    682     Log() << Verbose(0) << "Fragment No." << (*runner).second.first << " with TEFactor " << (*runner).second.second << "." << endl;
     683    DoLog(0) && (Log() << Verbose(0) << "Fragment No." << (*runner).second.first << " with TEFactor " << (*runner).second.second << "." << endl);
    683684    BondFragments->insert(StoreFragmentFromKeySet(test, configuration));
    684685    k++;
    685686  }
    686   Log() << Verbose(0) << k << "/" << BondFragments->ListOfMolecules.size() << " fragments generated from the keysets." << endl;
     687  DoLog(0) && (Log() << Verbose(0) << k << "/" << BondFragments->ListOfMolecules.size() << " fragments generated from the keysets." << endl);
    687688
    688689  // ===== 9. Save fragments' configuration and keyset files et al to disk ===
     
    691692    CreateMappingLabelsToConfigSequence(SortIndex);
    692693
    693     Log() << Verbose(1) << "Writing " << BondFragments->ListOfMolecules.size() << " possible bond fragmentation configs" << endl;
     694    DoLog(1) && (Log() << Verbose(1) << "Writing " << BondFragments->ListOfMolecules.size() << " possible bond fragmentation configs" << endl);
    694695    if (BondFragments->OutputConfigForListOfFragments(configuration, SortIndex))
    695       Log() << Verbose(1) << "All configs written." << endl;
     696      DoLog(1) && (Log() << Verbose(1) << "All configs written." << endl);
    696697    else
    697       Log() << Verbose(1) << "Some config writing failed." << endl;
     698      DoLog(1) && (Log() << Verbose(1) << "Some config writing failed." << endl);
    698699
    699700    // store force index reference file
     
    704705
    705706    // store Adjacency file
    706     StoreAdjacencyToFile(configuration->configpath);
     707    char *filename = Malloc<char> (MAXSTRINGSIZE, "molecule::FragmentMolecule - *filename");
     708    strcpy(filename, FRAGMENTPREFIX);
     709    strcat(filename, ADJACENCYFILE);
     710    StoreAdjacencyToFile(configuration->configpath, filename);
     711    Free(&filename);
    707712
    708713    // store Hydrogen saturation correction file
     
    716721
    717722    // free memory for bond part
    718     Log() << Verbose(1) << "Freeing bond memory" << endl;
     723    DoLog(1) && (Log() << Verbose(1) << "Freeing bond memory" << endl);
    719724    delete(FragmentList); // remove bond molecule from memory
    720725    Free(&SortIndex);
    721726  } else {
    722     Log() << Verbose(1) << "FragmentList is zero on return, splitting failed." << endl;
     727    DoLog(1) && (Log() << Verbose(1) << "FragmentList is zero on return, splitting failed." << endl);
    723728  }
    724729  delete(BondFragments);
    725   Log() << Verbose(0) << "End of bond fragmentation." << endl;
     730  DoLog(0) && (Log() << Verbose(0) << "End of bond fragmentation." << endl);
    726731
    727732  return ((int)(!FragmentationToDo)+1);    // 1 - continue, 2 - stop (no fragmentation occured)
     
    742747  line << path << "/" << FRAGMENTPREFIX << ORDERATSITEFILE;
    743748  file.open(line.str().c_str());
    744   Log() << Verbose(1) << "Writing OrderAtSite " << ORDERATSITEFILE << " ... " << endl;
     749  DoLog(1) && (Log() << Verbose(1) << "Writing OrderAtSite " << ORDERATSITEFILE << " ... " << endl);
    745750  if (file != NULL) {
    746751    ActOnAllAtoms( &atom::OutputOrder, &file );
    747752    file.close();
    748     Log() << Verbose(1) << "done." << endl;
     753    DoLog(1) && (Log() << Verbose(1) << "done." << endl);
    749754    return true;
    750755  } else {
    751     Log() << Verbose(1) << "failed to open file " << line.str() << "." << endl;
     756    DoLog(1) && (Log() << Verbose(1) << "failed to open file " << line.str() << "." << endl);
    752757    return false;
    753758  }
     
    770775  ifstream file;
    771776
    772   Log() << Verbose(1) << "Begin of ParseOrderAtSiteFromFile" << endl;
     777  DoLog(1) && (Log() << Verbose(1) << "Begin of ParseOrderAtSiteFromFile" << endl);
    773778  line << path << "/" << FRAGMENTPREFIX << ORDERATSITEFILE;
    774779  file.open(line.str().c_str());
     
    791796    SetAtomValueToIndexedArray( MaxArray, &atom::nr, &atom::MaxOrder );
    792797
    793     Log() << Verbose(1) << "done." << endl;
     798    DoLog(1) && (Log() << Verbose(1) << "done." << endl);
    794799    status = true;
    795800  } else {
    796     Log() << Verbose(1) << "failed to open file " << line.str() << "." << endl;
     801    DoLog(1) && (Log() << Verbose(1) << "failed to open file " << line.str() << "." << endl);
    797802    status = false;
    798803  }
     
    800805  Free(&MaxArray);
    801806
    802   Log() << Verbose(1) << "End of ParseOrderAtSiteFromFile" << endl;
     807  DoLog(1) && (Log() << Verbose(1) << "End of ParseOrderAtSiteFromFile" << endl);
    803808  return status;
    804809};
     
    817822  int SP, Removal;
    818823
    819   Log() << Verbose(2) << "Looking for removal candidate." << endl;
     824  DoLog(2) && (Log() << Verbose(2) << "Looking for removal candidate." << endl);
    820825  SP = -1; //0;  // not -1, so that Root is never removed
    821826  Removal = -1;
     
    844849
    845850  Leaf->BondDistance = mol->BondDistance;
    846   for(int i=NDIM*2;i--;)
    847     Leaf->cell_size[i] = mol->cell_size[i];
    848851
    849852  // first create the minimal set of atoms from the KeySet
     
    904907      }
    905908    } else {
    906       eLog() << Verbose(1) << "Son " << Runner->Name << " has father " << FatherOfRunner->Name << " but its entry in SonList is " << SonList[FatherOfRunner->nr] << "!" << endl;
     909      DoeLog(1) && (eLog()<< Verbose(1) << "Son " << Runner->Name << " has father " << FatherOfRunner->Name << " but its entry in SonList is " << SonList[FatherOfRunner->nr] << "!" << endl);
    907910    }
    908911    if ((LonelyFlag) && (Leaf->AtomCount > 1)) {
    909       Log() << Verbose(0) << *Runner << "has got bonds only to hydrogens!" << endl;
     912      DoLog(0) && (Log() << Verbose(0) << *Runner << "has got bonds only to hydrogens!" << endl);
    910913    }
    911914#ifdef ADDHYDROGEN
     
    10541057    TouchedList[j] = -1;
    10551058  }
    1056   Log() << Verbose(2) << "Remaining local nr.s on snake stack are: ";
     1059  DoLog(2) && (Log() << Verbose(2) << "Remaining local nr.s on snake stack are: ");
    10571060  for(KeySet::iterator runner = FragmentSet->begin(); runner != FragmentSet->end(); runner++)
    1058     Log() << Verbose(0) << (*runner) << " ";
    1059   Log() << Verbose(0) << endl;
     1061    DoLog(0) && (Log() << Verbose(0) << (*runner) << " ");
     1062  DoLog(0) && (Log() << Verbose(0) << endl);
    10601063  TouchedIndex = 0; // set Index to 0 for list of atoms added on this level
    10611064};
     
    11341137        Log() << Verbose(1+verbosity) << "Enough items on stack for a fragment!" << endl;
    11351138        // store fragment as a KeySet
    1136         Log() << Verbose(2) << "Found a new fragment[" << FragmentSearch->FragmentCounter << "], local nr.s are: ";
     1139        DoLog(2) && (Log() << Verbose(2) << "Found a new fragment[" << FragmentSearch->FragmentCounter << "], local nr.s are: ");
    11371140        for(KeySet::iterator runner = FragmentSearch->FragmentSet->begin(); runner != FragmentSearch->FragmentSet->end(); runner++)
    1138           Log() << Verbose(0) << (*runner) << " ";
    1139         Log() << Verbose(0) << endl;
     1141          DoLog(0) && (Log() << Verbose(0) << (*runner) << " ");
     1142        DoLog(0) && (Log() << Verbose(0) << endl);
    11401143        //if (!CheckForConnectedSubgraph(FragmentSearch->FragmentSet))
    1141           //eLog() << Verbose(1) << "The found fragment is not a connected subgraph!" << endl;
     1144          //DoeLog(1) && (eLog()<< Verbose(1) << "The found fragment is not a connected subgraph!" << endl);
    11421145        InsertFragmentIntoGraph(FragmentSearch);
    11431146      }
     
    12191222{
    12201223  bond *Binder = NULL;
    1221   Log() << Verbose(0) << "Free'ing all found lists. and resetting index lists" << endl;
     1224  DoLog(0) && (Log() << Verbose(0) << "Free'ing all found lists. and resetting index lists" << endl);
    12221225  for(int i=Order;i--;) {
    1223     Log() << Verbose(1) << "Current SP level is " << i << ": ";
     1226    DoLog(1) && (Log() << Verbose(1) << "Current SP level is " << i << ": ");
    12241227    Binder = FragmentSearch.BondsPerSPList[2*i];
    12251228    while (Binder->next != FragmentSearch.BondsPerSPList[2*i+1]) {
     
    12321235    cleanup(FragmentSearch.BondsPerSPList[2*i], FragmentSearch.BondsPerSPList[2*i+1]);
    12331236    // also start and end node
    1234     Log() << Verbose(0) << "cleaned." << endl;
     1237    DoLog(0) && (Log() << Verbose(0) << "cleaned." << endl);
    12351238  }
    12361239};
     
    12621265  int SP = -1;
    12631266
    1264   Log() << Verbose(0) << "Starting BFS analysis ..." << endl;
     1267  DoLog(0) && (Log() << Verbose(0) << "Starting BFS analysis ..." << endl);
    12651268  for (SP = 0; SP < (Order-1); SP++) {
    1266     Log() << Verbose(1) << "New SP level reached: " << SP << ", creating new SP list with " << FragmentSearch.BondsPerSPCount[SP] << " item(s)";
     1269    DoLog(1) && (Log() << Verbose(1) << "New SP level reached: " << SP << ", creating new SP list with " << FragmentSearch.BondsPerSPCount[SP] << " item(s)");
    12671270    if (SP > 0) {
    1268       Log() << Verbose(0) << ", old level closed with " << FragmentSearch.BondsPerSPCount[SP-1] << " item(s)." << endl;
     1271      DoLog(0) && (Log() << Verbose(0) << ", old level closed with " << FragmentSearch.BondsPerSPCount[SP-1] << " item(s)." << endl);
    12691272      FragmentSearch.BondsPerSPCount[SP] = 0;
    12701273    } else
    1271       Log() << Verbose(0) << "." << endl;
     1274      DoLog(0) && (Log() << Verbose(0) << "." << endl);
    12721275
    12731276    RemainingWalkers = FragmentSearch.BondsPerSPCount[SP];
     
    12791282      Predecessor = CurrentEdge->leftatom;    // ... and leftatom is predecessor
    12801283      AtomKeyNr = Walker->nr;
    1281       Log() << Verbose(0) << "Current Walker is: " << *Walker << " with nr " << Walker->nr << " and SP of " << SP << ", with " << RemainingWalkers << " remaining walkers on this level." << endl;
     1284      DoLog(0) && (Log() << Verbose(0) << "Current Walker is: " << *Walker << " with nr " << Walker->nr << " and SP of " << SP << ", with " << RemainingWalkers << " remaining walkers on this level." << endl);
    12821285      // check for new sp level
    12831286      // go through all its bonds
    1284       Log() << Verbose(1) << "Going through all bonds of Walker." << endl;
     1287      DoLog(1) && (Log() << Verbose(1) << "Going through all bonds of Walker." << endl);
    12851288      for (BondList::const_iterator Runner = Walker->ListOfBonds.begin(); Runner != Walker->ListOfBonds.end(); (++Runner)) {
    12861289        OtherWalker = (*Runner)->GetOtherAtom(Walker);
     
    12901293  #endif
    12911294                                                              ) {  // skip hydrogens and restrict to fragment
    1292           Log() << Verbose(2) << "Current partner is " << *OtherWalker << " with nr " << OtherWalker->nr << " in bond " << *(*Runner) << "." << endl;
     1295          DoLog(2) && (Log() << Verbose(2) << "Current partner is " << *OtherWalker << " with nr " << OtherWalker->nr << " in bond " << *(*Runner) << "." << endl);
    12931296          // set the label if not set (and push on root stack as well)
    12941297          if ((OtherWalker != Predecessor) && (OtherWalker->GetTrueFather()->nr > RootKeyNr)) { // only pass through those with label bigger than Root's
    12951298            FragmentSearch.ShortestPathList[OtherWalker->nr] = SP+1;
    1296             Log() << Verbose(3) << "Set Shortest Path to " << FragmentSearch.ShortestPathList[OtherWalker->nr] << "." << endl;
     1299            DoLog(3) && (Log() << Verbose(3) << "Set Shortest Path to " << FragmentSearch.ShortestPathList[OtherWalker->nr] << "." << endl);
    12971300            // add the bond in between to the SP list
    12981301            Binder = new bond(Walker, OtherWalker); // create a new bond in such a manner, that bond::rightatom is always the one more distant
    12991302            add(Binder, FragmentSearch.BondsPerSPList[2*(SP+1)+1]);
    13001303            FragmentSearch.BondsPerSPCount[SP+1]++;
    1301             Log() << Verbose(3) << "Added its bond to SP list, having now " << FragmentSearch.BondsPerSPCount[SP+1] << " item(s)." << endl;
     1304            DoLog(3) && (Log() << Verbose(3) << "Added its bond to SP list, having now " << FragmentSearch.BondsPerSPCount[SP+1] << " item(s)." << endl);
    13021305          } else {
    13031306            if (OtherWalker != Predecessor)
    1304               Log() << Verbose(3) << "Not passing on, as index of " << *OtherWalker << " " << OtherWalker->GetTrueFather()->nr << " is smaller than that of Root " << RootKeyNr << "." << endl;
     1307              DoLog(3) && (Log() << Verbose(3) << "Not passing on, as index of " << *OtherWalker << " " << OtherWalker->GetTrueFather()->nr << " is smaller than that of Root " << RootKeyNr << "." << endl);
    13051308            else
    1306               Log() << Verbose(3) << "This is my predecessor " << *Predecessor << "." << endl;
     1309              DoLog(3) && (Log() << Verbose(3) << "This is my predecessor " << *Predecessor << "." << endl);
    13071310          }
    13081311        } else Log() << Verbose(2) << "Is not in the restricted keyset or skipping hydrogen " << *OtherWalker << "." << endl;
     
    13201323{
    13211324  bond *Binder = NULL;
    1322   Log() << Verbose(0) << "Printing all found lists." << endl;
     1325  DoLog(0) && (Log() << Verbose(0) << "Printing all found lists." << endl);
    13231326  for(int i=1;i<Order;i++) {    // skip the root edge in the printing
    13241327    Binder = FragmentSearch.BondsPerSPList[2*i];
    1325     Log() << Verbose(1) << "Current SP level is " << i << "." << endl;
     1328    DoLog(1) && (Log() << Verbose(1) << "Current SP level is " << i << "." << endl);
    13261329    while (Binder->next != FragmentSearch.BondsPerSPList[2*i+1]) {
    13271330      Binder = Binder->next;
    1328       Log() << Verbose(2) << *Binder << endl;
     1331      DoLog(2) && (Log() << Verbose(2) << *Binder << endl);
    13291332    }
    13301333  }
     
    13701373  int Counter = FragmentSearch.FragmentCounter; // mark current value of counter
    13711374
    1372   Log() << Verbose(0) << endl;
    1373   Log() << Verbose(0) << "Begin of PowerSetGenerator with order " << Order << " at Root " << *FragmentSearch.Root << "." << endl;
     1375  DoLog(0) && (Log() << Verbose(0) << endl);
     1376  DoLog(0) && (Log() << Verbose(0) << "Begin of PowerSetGenerator with order " << Order << " at Root " << *FragmentSearch.Root << "." << endl);
    13741377
    13751378  SetSPList(Order, FragmentSearch);
     
    13831386  // creating fragments with the found edge sets  (may be done in reverse order, faster)
    13841387  int SP = CountNumbersInBondsList(Order, FragmentSearch);
    1385   Log() << Verbose(0) << "Total number of edges is " << SP << "." << endl;
     1388  DoLog(0) && (Log() << Verbose(0) << "Total number of edges is " << SP << "." << endl);
    13861389  if (SP >= (Order-1)) {
    13871390    // start with root (push on fragment stack)
    1388     Log() << Verbose(0) << "Starting fragment generation with " << *FragmentSearch.Root << ", local nr is " << FragmentSearch.Root->nr << "." << endl;
     1391    DoLog(0) && (Log() << Verbose(0) << "Starting fragment generation with " << *FragmentSearch.Root << ", local nr is " << FragmentSearch.Root->nr << "." << endl);
    13891392    FragmentSearch.FragmentSet->clear();
    1390     Log() << Verbose(0) << "Preparing subset for this root and calling generator." << endl;
     1393    DoLog(0) && (Log() << Verbose(0) << "Preparing subset for this root and calling generator." << endl);
    13911394
    13921395    // prepare the subset and call the generator
     
    13981401    Free(&BondsList);
    13991402  } else {
    1400     Log() << Verbose(0) << "Not enough total number of edges to build " << Order << "-body fragments." << endl;
     1403    DoLog(0) && (Log() << Verbose(0) << "Not enough total number of edges to build " << Order << "-body fragments." << endl);
    14011404  }
    14021405
    14031406  // as FragmentSearch structure is used only once, we don't have to clean it anymore
    14041407  // remove root from stack
    1405   Log() << Verbose(0) << "Removing root again from stack." << endl;
     1408  DoLog(0) && (Log() << Verbose(0) << "Removing root again from stack." << endl);
    14061409  FragmentSearch.FragmentSet->erase(FragmentSearch.Root->nr);
    14071410
     
    14101413
    14111414  // return list
    1412   Log() << Verbose(0) << "End of PowerSetGenerator." << endl;
     1415  DoLog(0) && (Log() << Verbose(0) << "End of PowerSetGenerator." << endl);
    14131416  return (FragmentSearch.FragmentCounter - Counter);
    14141417};
     
    14561459  atom *Walker = NULL;
    14571460
    1458   Log() << Verbose(0) << "Combining the lists of all orders per order and finally into a single one." << endl;
     1461  DoLog(0) && (Log() << Verbose(0) << "Combining the lists of all orders per order and finally into a single one." << endl);
    14591462  if (FragmentList == NULL) {
    14601463    FragmentList = new Graph;
     
    14891492void FreeAllOrdersList(Graph ***FragmentLowerOrdersList, KeyStack &RootStack, molecule *mol)
    14901493{
    1491   Log() << Verbose(1) << "Free'ing the lists of all orders per order." << endl;
     1494  DoLog(1) && (Log() << Verbose(1) << "Free'ing the lists of all orders per order." << endl);
    14921495  int RootNr = 0;
    14931496  int RootKeyNr = 0;
     
    15421545  struct UniqueFragments FragmentSearch;
    15431546
    1544   Log() << Verbose(0) << "Begin of FragmentBOSSANOVA." << endl;
     1547  DoLog(0) && (Log() << Verbose(0) << "Begin of FragmentBOSSANOVA." << endl);
    15451548
    15461549  // FragmentLowerOrdersList is a 2D-array of pointer to MoleculeListClass objects, one dimension represents the ANOVA expansion of a single order (i.e. 5)
     
    15921595
    15931596      // create top order where nothing is reduced
    1594       Log() << Verbose(0) << "==============================================================================================================" << endl;
    1595       Log() << Verbose(0) << "Creating KeySets of Bond Order " << Order << " for " << *Walker << ", " << (RootStack.size()-RootNr) << " Roots remaining." << endl; // , NumLevels is " << NumLevels << "
     1597      DoLog(0) && (Log() << Verbose(0) << "==============================================================================================================" << endl);
     1598      DoLog(0) && (Log() << Verbose(0) << "Creating KeySets of Bond Order " << Order << " for " << *Walker << ", " << (RootStack.size()-RootNr) << " Roots remaining." << endl); // , NumLevels is " << NumLevels << "
    15961599
    15971600      // Create list of Graphs of current Bond Order (i.e. F_{ij})
     
    16031606
    16041607      // output resulting number
    1605       Log() << Verbose(1) << "Number of resulting KeySets is: " << NumMoleculesOfOrder[RootNr] << "." << endl;
     1608      DoLog(1) && (Log() << Verbose(1) << "Number of resulting KeySets is: " << NumMoleculesOfOrder[RootNr] << "." << endl);
    16061609      if (NumMoleculesOfOrder[RootNr] != 0) {
    16071610        NumMolecules = 0;
     
    16201623    }
    16211624  }
    1622   Log() << Verbose(0) << "==============================================================================================================" << endl;
    1623   Log() << Verbose(1) << "Total number of resulting molecules is: " << TotalNumMolecules << "." << endl;
    1624   Log() << Verbose(0) << "==============================================================================================================" << endl;
     1625  DoLog(0) && (Log() << Verbose(0) << "==============================================================================================================" << endl);
     1626  DoLog(1) && (Log() << Verbose(1) << "Total number of resulting molecules is: " << TotalNumMolecules << "." << endl);
     1627  DoLog(0) && (Log() << Verbose(0) << "==============================================================================================================" << endl);
    16251628
    16261629  // cleanup FragmentSearch structure
     
    16401643  Free(&NumMoleculesOfOrder);
    16411644
    1642   Log() << Verbose(0) << "End of FragmentBOSSANOVA." << endl;
     1645  DoLog(0) && (Log() << Verbose(0) << "End of FragmentBOSSANOVA." << endl);
    16431646};
    16441647
     
    16551658  atom *Walker = NULL;
    16561659  atom *OtherWalker = NULL;
     1660  double * const cell_size = World::getInstance().getDomain();
    16571661  double *matrix = ReturnFullMatrixforSymmetric(cell_size);
    16581662  enum Shading *ColorList = NULL;
     
    16631667  bool flag = true;
    16641668
    1665   Log() << Verbose(2) << "Begin of ScanForPeriodicCorrection." << endl;
     1669  DoLog(2) && (Log() << Verbose(2) << "Begin of ScanForPeriodicCorrection." << endl);
    16661670
    16671671  ColorList = Calloc<enum Shading>(AtomCount, "molecule::ScanForPeriodicCorrection: *ColorList");
     
    16811685          OtherBinder = Binder->next; // note down binding partner for later re-insertion
    16821686          unlink(Binder);   // unlink bond
    1683           Log() << Verbose(2) << "Correcting at bond " << *Binder << "." << endl;
     1687          DoLog(2) && (Log() << Verbose(2) << "Correcting at bond " << *Binder << "." << endl);
    16841688          flag = true;
    16851689          break;
     
    16971701      //Log() << Verbose(3) << "Translation vector is ";
    16981702      Translationvector.Output();
    1699       Log() << Verbose(0) << endl;
     1703      DoLog(0) && (Log() << Verbose(0) << endl);
    17001704      // apply to all atoms of first component via BFS
    17011705      for (int i=AtomCount;i--;)
     
    17191723      link(Binder, OtherBinder);
    17201724    } else {
    1721       Log() << Verbose(3) << "No corrections for this fragment." << endl;
     1725      DoLog(3) && (Log() << Verbose(3) << "No corrections for this fragment." << endl);
    17221726    }
    17231727    //delete(CompStack);
     
    17281732  Free(&ColorList);
    17291733  Free(&matrix);
    1730   Log() << Verbose(2) << "End of ScanForPeriodicCorrection." << endl;
    1731 };
     1734  DoLog(2) && (Log() << Verbose(2) << "End of ScanForPeriodicCorrection." << endl);
     1735};
Note: See TracChangeset for help on using the changeset viewer.