Ignore:
Timestamp:
Apr 22, 2010, 2:00:03 PM (15 years ago)
Author:
Frederik Heber <heber@…>
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:
299554
Parents:
6613ec
Message:

Huge change: Log() << Verbose(.) --> DoLog(.) && (Log() << Verbose(.) << ...);

Most of the files are affected, but this is necessary as if DoLog() says verbosity is not enough, all the stream operators won"t get executed which saves substantial amount of computation time.

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/molecule_graph.cpp

    r6613ec ra67d19  
    5959
    6060  if (!input) {
    61     Log() << Verbose(1) << "Opening silica failed \n";
     61    DoLog(1) && (Log() << Verbose(1) << "Opening silica failed \n");
    6262  };
    6363
    6464  *input >> ws >> atom1;
    6565  *input >> ws >> atom2;
    66   Log() << Verbose(1) << "Scanning file\n";
     66  DoLog(1) && (Log() << Verbose(1) << "Scanning file\n");
    6767  while (!input->eof()) // Check whether we read everything already
    6868  {
     
    115115
    116116  BondDistance = bonddistance; // * ((IsAngstroem) ? 1. : 1./AtomicLengthToAngstroem);
    117   Log() << Verbose(0) << "Begin of CreateAdjacencyList." << endl;
     117  DoLog(0) && (Log() << Verbose(0) << "Begin of CreateAdjacencyList." << endl);
    118118  // remove every bond from the list
    119119  bond *Binder = NULL;
     
    128128  // count atoms in molecule = dimension of matrix (also give each unique name and continuous numbering)
    129129  CountAtoms();
    130   Log() << Verbose(1) << "AtomCount " << AtomCount << " and bonddistance is " << bonddistance << "." << endl;
     130  DoLog(1) && (Log() << Verbose(1) << "AtomCount " << AtomCount << " and bonddistance is " << bonddistance << "." << endl);
    131131
    132132  if ((AtomCount > 1) && (bonddistance > 1.)) {
    133     Log() << Verbose(2) << "Creating Linked Cell structure ... " << endl;
     133    DoLog(2) && (Log() << Verbose(2) << "Creating Linked Cell structure ... " << endl);
    134134    LC = new LinkedCell(this, bonddistance);
    135135
    136136    // create a list to map Tesselpoint::nr to atom *
    137     Log() << Verbose(2) << "Creating TesselPoint to atom map ... " << endl;
     137    DoLog(2) && (Log() << Verbose(2) << "Creating TesselPoint to atom map ... " << endl);
    138138    AtomMap = Calloc<atom *> (AtomCount, "molecule::CreateAdjacencyList - **AtomCount");
    139139    Walker = start;
     
    144144
    145145    // 3a. go through every cell
    146     Log() << Verbose(2) << "Celling ... " << endl;
     146    DoLog(2) && (Log() << Verbose(2) << "Celling ... " << endl);
    147147    for (LC->n[0] = 0; LC->n[0] < LC->N[0]; LC->n[0]++)
    148148      for (LC->n[1] = 0; LC->n[1] < LC->N[1]; LC->n[1]++)
     
    183183    Free(&AtomMap);
    184184    delete (LC);
    185     Log() << Verbose(1) << "I detected " << BondCount << " bonds in the molecule with distance " << BondDistance << "." << endl;
     185    DoLog(1) && (Log() << Verbose(1) << "I detected " << BondCount << " bonds in the molecule with distance " << BondDistance << "." << endl);
    186186
    187187    // correct bond degree by comparing valence and bond degree
    188     Log() << Verbose(2) << "Correcting bond degree ... " << endl;
     188    DoLog(2) && (Log() << Verbose(2) << "Correcting bond degree ... " << endl);
    189189    CorrectBondDegree();
    190190
     
    192192    ActOnAllAtoms( &atom::OutputBondOfAtom );
    193193  } else
    194     Log() << Verbose(1) << "AtomCount is " << AtomCount << ", thus no bonds, no connections!." << endl;
    195   Log() << Verbose(0) << "End of CreateAdjacencyList." << endl;
     194    DoLog(1) && (Log() << Verbose(1) << "AtomCount is " << AtomCount << ", thus no bonds, no connections!." << endl);
     195  DoLog(0) && (Log() << Verbose(0) << "End of CreateAdjacencyList." << endl);
    196196  if (free_BG)
    197197    delete(BG);
     
    204204void molecule::OutputBondsList() const
    205205{
    206   Log() << Verbose(1) << endl << "From contents of bond chain list:";
     206  DoLog(1) && (Log() << Verbose(1) << endl << "From contents of bond chain list:");
    207207  bond *Binder = first;
    208208  while (Binder->next != last) {
    209209    Binder = Binder->next;
    210     Log() << Verbose(0) << *Binder << "\t" << endl;
    211   }
    212   Log() << Verbose(0) << endl;
     210    DoLog(0) && (Log() << Verbose(0) << *Binder << "\t" << endl);
     211  }
     212  DoLog(0) && (Log() << Verbose(0) << endl);
    213213}
    214214;
     
    227227
    228228  if (BondCount != 0) {
    229     Log() << Verbose(1) << "Correcting Bond degree of each bond ... " << endl;
     229    DoLog(1) && (Log() << Verbose(1) << "Correcting Bond degree of each bond ... " << endl);
    230230    do {
    231231      OldNo = No;
    232232      No = SumPerAtom( &atom::CorrectBondDegree );
    233233    } while (OldNo != No);
    234     Log() << Verbose(0) << " done." << endl;
     234    DoLog(0) && (Log() << Verbose(0) << " done." << endl);
    235235  } else {
    236     Log() << Verbose(1) << "BondCount is " << BondCount << ", no bonds between any of the " << AtomCount << " atoms." << endl;
    237   }
    238   Log() << Verbose(0) << No << " bonds could not be corrected." << endl;
     236    DoLog(1) && (Log() << Verbose(1) << "BondCount is " << BondCount << ", no bonds between any of the " << AtomCount << " atoms." << endl);
     237  }
     238  DoLog(0) && (Log() << Verbose(0) << No << " bonds could not be corrected." << endl);
    239239
    240240  return (No);
     
    255255  bond *Binder = first;
    256256  if ((Binder->next != last) && (Binder->next->Type == Undetermined)) {
    257     Log() << Verbose(0) << "No Depth-First-Search analysis performed so far, calling ..." << endl;
     257    DoLog(0) && (Log() << Verbose(0) << "No Depth-First-Search analysis performed so far, calling ..." << endl);
    258258    Subgraphs = DepthFirstSearchAnalysis(BackEdgeStack);
    259259    while (Subgraphs->next != NULL) {
     
    310310    Walker->GraphNr = DFS.CurrentGraphNr;
    311311    Walker->LowpointNr = DFS.CurrentGraphNr;
    312     Log() << Verbose(1) << "Setting Walker[" << Walker->Name << "]'s number to " << Walker->GraphNr << " with Lowpoint " << Walker->LowpointNr << "." << endl;
     312    DoLog(1) && (Log() << Verbose(1) << "Setting Walker[" << Walker->Name << "]'s number to " << Walker->GraphNr << " with Lowpoint " << Walker->LowpointNr << "." << endl);
    313313    DFS.AtomStack->Push(Walker);
    314314    DFS.CurrentGraphNr++;
     
    337337    if (Binder == NULL)
    338338      break;
    339     Log() << Verbose(2) << "Current Unused Bond is " << *Binder << "." << endl;
     339    DoLog(2) && (Log() << Verbose(2) << "Current Unused Bond is " << *Binder << "." << endl);
    340340    // (4) Mark Binder used, ...
    341341    Binder->MarkUsed(black);
    342342    OtherAtom = Binder->GetOtherAtom(Walker);
    343     Log() << Verbose(2) << "(4) OtherAtom is " << OtherAtom->Name << "." << endl;
     343    DoLog(2) && (Log() << Verbose(2) << "(4) OtherAtom is " << OtherAtom->Name << "." << endl);
    344344    if (OtherAtom->GraphNr != -1) {
    345345      // (4a) ... if "other" atom has been visited (GraphNr != 0), set lowpoint to minimum of both, go to (3)
     
    347347      DFS.BackEdgeStack->Push(Binder);
    348348      Walker->LowpointNr = (Walker->LowpointNr < OtherAtom->GraphNr) ? Walker->LowpointNr : OtherAtom->GraphNr;
    349       Log() << Verbose(3) << "(4a) Visited: Setting Lowpoint of Walker[" << Walker->Name << "] to " << Walker->LowpointNr << "." << endl;
     349      DoLog(3) && (Log() << Verbose(3) << "(4a) Visited: Setting Lowpoint of Walker[" << Walker->Name << "] to " << Walker->LowpointNr << "." << endl);
    350350    } else {
    351351      // (4b) ... otherwise set OtherAtom as Ancestor of Walker and Walker as OtherAtom, go to (2)
     
    353353      OtherAtom->Ancestor = Walker;
    354354      Walker = OtherAtom;
    355       Log() << Verbose(3) << "(4b) Not Visited: OtherAtom[" << OtherAtom->Name << "]'s Ancestor is now " << OtherAtom->Ancestor->Name << ", Walker is OtherAtom " << OtherAtom->Name << "." << endl;
     355      DoLog(3) && (Log() << Verbose(3) << "(4b) Not Visited: OtherAtom[" << OtherAtom->Name << "]'s Ancestor is now " << OtherAtom->Ancestor->Name << ", Walker is OtherAtom " << OtherAtom->Name << "." << endl);
    356356      break;
    357357    }
     
    375375
    376376  // (5) if Ancestor of Walker is ...
    377   Log() << Verbose(1) << "(5) Number of Walker[" << Walker->Name << "]'s Ancestor[" << Walker->Ancestor->Name << "] is " << Walker->Ancestor->GraphNr << "." << endl;
     377  DoLog(1) && (Log() << Verbose(1) << "(5) Number of Walker[" << Walker->Name << "]'s Ancestor[" << Walker->Ancestor->Name << "] is " << Walker->Ancestor->GraphNr << "." << endl);
    378378
    379379  if (Walker->Ancestor->GraphNr != DFS.Root->GraphNr) {
     
    382382      // (6a) set Ancestor's Lowpoint number to minimum of of its Ancestor and itself, go to Step(8)
    383383      Walker->Ancestor->LowpointNr = (Walker->Ancestor->LowpointNr < Walker->LowpointNr) ? Walker->Ancestor->LowpointNr : Walker->LowpointNr;
    384       Log() << Verbose(2) << "(6) Setting Walker[" << Walker->Name << "]'s Ancestor[" << Walker->Ancestor->Name << "]'s Lowpoint to " << Walker->Ancestor->LowpointNr << "." << endl;
     384      DoLog(2) && (Log() << Verbose(2) << "(6) Setting Walker[" << Walker->Name << "]'s Ancestor[" << Walker->Ancestor->Name << "]'s Lowpoint to " << Walker->Ancestor->LowpointNr << "." << endl);
    385385    } else {
    386386      // (7) (Ancestor of Walker is a separating vertex, remove all from stack till Walker (including), these and Ancestor form a component
    387387      Walker->Ancestor->SeparationVertex = true;
    388       Log() << Verbose(2) << "(7) Walker[" << Walker->Name << "]'s Ancestor[" << Walker->Ancestor->Name << "]'s is a separating vertex, creating component." << endl;
     388      DoLog(2) && (Log() << Verbose(2) << "(7) Walker[" << Walker->Name << "]'s Ancestor[" << Walker->Ancestor->Name << "]'s is a separating vertex, creating component." << endl);
    389389      mol->SetNextComponentNumber(Walker->Ancestor, DFS.ComponentNumber);
    390       Log() << Verbose(3) << "(7) Walker[" << Walker->Name << "]'s Ancestor's Compont is " << DFS.ComponentNumber << "." << endl;
     390      DoLog(3) && (Log() << Verbose(3) << "(7) Walker[" << Walker->Name << "]'s Ancestor's Compont is " << DFS.ComponentNumber << "." << endl);
    391391      mol->SetNextComponentNumber(Walker, DFS.ComponentNumber);
    392       Log() << Verbose(3) << "(7) Walker[" << Walker->Name << "]'s Compont is " << DFS.ComponentNumber << "." << endl;
     392      DoLog(3) && (Log() << Verbose(3) << "(7) Walker[" << Walker->Name << "]'s Compont is " << DFS.ComponentNumber << "." << endl);
    393393      do {
    394394        OtherAtom = DFS.AtomStack->PopLast();
    395395        LeafWalker->Leaf->AddCopyAtom(OtherAtom);
    396396        mol->SetNextComponentNumber(OtherAtom, DFS.ComponentNumber);
    397         Log() << Verbose(3) << "(7) Other[" << OtherAtom->Name << "]'s Compont is " << DFS.ComponentNumber << "." << endl;
     397        DoLog(3) && (Log() << Verbose(3) << "(7) Other[" << OtherAtom->Name << "]'s Compont is " << DFS.ComponentNumber << "." << endl);
    398398      } while (OtherAtom != Walker);
    399399      DFS.ComponentNumber++;
    400400    }
    401401    // (8) Walker becomes its Ancestor, go to (3)
    402     Log() << Verbose(2) << "(8) Walker[" << Walker->Name << "] is now its Ancestor " << Walker->Ancestor->Name << ", backstepping. " << endl;
     402    DoLog(2) && (Log() << Verbose(2) << "(8) Walker[" << Walker->Name << "] is now its Ancestor " << Walker->Ancestor->Name << ", backstepping. " << endl);
    403403    Walker = Walker->Ancestor;
    404404    DFS.BackStepping = true;
     
    424424    //DFS.AtomStack->Output(out);
    425425    mol->SetNextComponentNumber(DFS.Root, DFS.ComponentNumber);
    426     Log() << Verbose(3) << "(9) Root[" << DFS.Root->Name << "]'s Component is " << DFS.ComponentNumber << "." << endl;
     426    DoLog(3) && (Log() << Verbose(3) << "(9) Root[" << DFS.Root->Name << "]'s Component is " << DFS.ComponentNumber << "." << endl);
    427427    mol->SetNextComponentNumber(Walker, DFS.ComponentNumber);
    428     Log() << Verbose(3) << "(9) Walker[" << Walker->Name << "]'s Component is " << DFS.ComponentNumber << "." << endl;
     428    DoLog(3) && (Log() << Verbose(3) << "(9) Walker[" << Walker->Name << "]'s Component is " << DFS.ComponentNumber << "." << endl);
    429429    do {
    430430      OtherAtom = DFS.AtomStack->PopLast();
    431431      LeafWalker->Leaf->AddCopyAtom(OtherAtom);
    432432      mol->SetNextComponentNumber(OtherAtom, DFS.ComponentNumber);
    433       Log() << Verbose(3) << "(7) Other[" << OtherAtom->Name << "]'s Compont is " << DFS.ComponentNumber << "." << endl;
     433      DoLog(3) && (Log() << Verbose(3) << "(7) Other[" << OtherAtom->Name << "]'s Compont is " << DFS.ComponentNumber << "." << endl);
    434434    } while (OtherAtom != Walker);
    435435    DFS.ComponentNumber++;
     
    438438    Walker = DFS.Root;
    439439    Binder = mol->FindNextUnused(Walker);
    440     Log() << Verbose(1) << "(10) Walker is Root[" << DFS.Root->Name << "], next Unused Bond is " << Binder << "." << endl;
     440    DoLog(1) && (Log() << Verbose(1) << "(10) Walker is Root[" << DFS.Root->Name << "], next Unused Bond is " << Binder << "." << endl);
    441441    if (Binder != NULL) { // Root is separation vertex
    442       Log() << Verbose(1) << "(11) Root is a separation vertex." << endl;
     442      DoLog(1) && (Log() << Verbose(1) << "(11) Root is a separation vertex." << endl);
    443443      Walker->SeparationVertex = true;
    444444    }
     
    497497  if (AtomCount == 0)
    498498    return SubGraphs;
    499   Log() << Verbose(0) << "Begin of DepthFirstSearchAnalysis" << endl;
     499  DoLog(0) && (Log() << Verbose(0) << "Begin of DepthFirstSearchAnalysis" << endl);
    500500  DepthFirstSearchAnalysis_Init(DFS, this);
    501501
     
    519519
    520520        if (Binder == NULL) {
    521           Log() << Verbose(2) << "No more Unused Bonds." << endl;
     521          DoLog(2) && (Log() << Verbose(2) << "No more Unused Bonds." << endl);
    522522          break;
    523523        } else
     
    536536
    537537    // From OldGraphNr to CurrentGraphNr ranges an disconnected subgraph
    538     Log() << Verbose(0) << "Disconnected subgraph ranges from " << OldGraphNr << " to " << DFS.CurrentGraphNr << "." << endl;
     538    DoLog(0) && (Log() << Verbose(0) << "Disconnected subgraph ranges from " << OldGraphNr << " to " << DFS.CurrentGraphNr << "." << endl);
    539539    LeafWalker->Leaf->Output((ofstream *)&cout);
    540     Log() << Verbose(0) << endl;
     540    DoLog(0) && (Log() << Verbose(0) << endl);
    541541
    542542    // step on to next root
     
    556556  // free all and exit
    557557  DepthFirstSearchAnalysis_Finalize(DFS);
    558   Log() << Verbose(0) << "End of DepthFirstSearchAnalysis" << endl;
     558  DoLog(0) && (Log() << Verbose(0) << "End of DepthFirstSearchAnalysis" << endl);
    559559  return SubGraphs;
    560560}
     
    582582void molecule::OutputGraphInfoPerAtom() const
    583583{
    584   Log() << Verbose(1) << "Final graph info for each atom is:" << endl;
     584  DoLog(1) && (Log() << Verbose(1) << "Final graph info for each atom is:" << endl);
    585585  ActOnAllAtoms( &atom::OutputGraphInfo );
    586586}
     
    592592void molecule::OutputGraphInfoPerBond() const
    593593{
    594   Log() << Verbose(1) << "Final graph info for each bond is:" << endl;
     594  DoLog(1) && (Log() << Verbose(1) << "Final graph info for each bond is:" << endl);
    595595  bond *Binder = first;
    596596  while (Binder->next != last) {
    597597    Binder = Binder->next;
    598     Log() << Verbose(2) << ((Binder->Type == TreeEdge) ? "TreeEdge " : "BackEdge ") << *Binder << ": <";
    599     Log() << Verbose(0) << ((Binder->leftatom->SeparationVertex) ? "SP," : "") << "L" << Binder->leftatom->LowpointNr << " G" << Binder->leftatom->GraphNr << " Comp.";
     598    DoLog(2) && (Log() << Verbose(2) << ((Binder->Type == TreeEdge) ? "TreeEdge " : "BackEdge ") << *Binder << ": <");
     599    DoLog(0) && (Log() << Verbose(0) << ((Binder->leftatom->SeparationVertex) ? "SP," : "") << "L" << Binder->leftatom->LowpointNr << " G" << Binder->leftatom->GraphNr << " Comp.");
    600600    Binder->leftatom->OutputComponentNumber();
    601     Log() << Verbose(0) << " ===  ";
    602     Log() << Verbose(0) << ((Binder->rightatom->SeparationVertex) ? "SP," : "") << "L" << Binder->rightatom->LowpointNr << " G" << Binder->rightatom->GraphNr << " Comp.";
     601    DoLog(0) && (Log() << Verbose(0) << " ===  ");
     602    DoLog(0) && (Log() << Verbose(0) << ((Binder->rightatom->SeparationVertex) ? "SP," : "") << "L" << Binder->rightatom->LowpointNr << " G" << Binder->rightatom->GraphNr << " Comp.");
    603603    Binder->rightatom->OutputComponentNumber();
    604     Log() << Verbose(0) << ">." << endl;
     604    DoLog(0) && (Log() << Verbose(0) << ">." << endl);
    605605    if (Binder->Cyclic) // cyclic ??
    606       Log() << Verbose(3) << "Lowpoint at each side are equal: CYCLIC!" << endl;
     606      DoLog(3) && (Log() << Verbose(3) << "Lowpoint at each side are equal: CYCLIC!" << endl);
    607607  }
    608608}
     
    678678  do { // look for Root
    679679    Walker = BFS.BFSStack->PopFirst();
    680     Log() << Verbose(2) << "Current Walker is " << *Walker << ", we look for SP to Root " << *BFS.Root << "." << endl;
     680    DoLog(2) && (Log() << Verbose(2) << "Current Walker is " << *Walker << ", we look for SP to Root " << *BFS.Root << "." << endl);
    681681    for (BondList::const_iterator Runner = Walker->ListOfBonds.begin(); Runner != Walker->ListOfBonds.end(); (++Runner)) {
    682682      if ((*Runner) != BackEdge) { // only walk along DFS spanning tree (otherwise we always find SP of one being backedge Binder)
     
    685685        if (OtherAtom->type->Z != 1) {
    686686#endif
    687         Log() << Verbose(2) << "Current OtherAtom is: " << OtherAtom->Name << " for bond " << *(*Runner) << "." << endl;
     687        DoLog(2) && (Log() << Verbose(2) << "Current OtherAtom is: " << OtherAtom->Name << " for bond " << *(*Runner) << "." << endl);
    688688        if (BFS.ColorList[OtherAtom->nr] == white) {
    689689          BFS.TouchedStack->Push(OtherAtom);
     
    691691          BFS.PredecessorList[OtherAtom->nr] = Walker; // Walker is the predecessor
    692692          BFS.ShortestPathList[OtherAtom->nr] = BFS.ShortestPathList[Walker->nr] + 1;
    693           Log() << Verbose(2) << "Coloring OtherAtom " << OtherAtom->Name << " lightgray, its predecessor is " << Walker->Name << " and its Shortest Path is " << BFS.ShortestPathList[OtherAtom->nr] << " egde(s) long." << endl;
     693          DoLog(2) && (Log() << Verbose(2) << "Coloring OtherAtom " << OtherAtom->Name << " lightgray, its predecessor is " << Walker->Name << " and its Shortest Path is " << BFS.ShortestPathList[OtherAtom->nr] << " egde(s) long." << endl);
    694694          //if (BFS.ShortestPathList[OtherAtom->nr] < MinimumRingSize[Walker->GetTrueFather()->nr]) { // Check for maximum distance
    695           Log() << Verbose(3) << "Putting OtherAtom into queue." << endl;
     695          DoLog(3) && (Log() << Verbose(3) << "Putting OtherAtom into queue." << endl);
    696696          BFS.BFSStack->Push(OtherAtom);
    697697          //}
    698698        } else {
    699           Log() << Verbose(3) << "Not Adding, has already been visited." << endl;
     699          DoLog(3) && (Log() << Verbose(3) << "Not Adding, has already been visited." << endl);
    700700        }
    701701        if (OtherAtom == BFS.Root)
     
    703703#ifdef ADDHYDROGEN
    704704      } else {
    705         Log() << Verbose(2) << "Skipping hydrogen atom " << *OtherAtom << "." << endl;
     705        DoLog(2) && (Log() << Verbose(2) << "Skipping hydrogen atom " << *OtherAtom << "." << endl);
    706706        BFS.ColorList[OtherAtom->nr] = black;
    707707      }
    708708#endif
    709709      } else {
    710         Log() << Verbose(2) << "Bond " << *(*Runner) << " not Visiting, is the back edge." << endl;
     710        DoLog(2) && (Log() << Verbose(2) << "Bond " << *(*Runner) << " not Visiting, is the back edge." << endl);
    711711      }
    712712    }
    713713    BFS.ColorList[Walker->nr] = black;
    714     Log() << Verbose(1) << "Coloring Walker " << Walker->Name << " black." << endl;
     714    DoLog(1) && (Log() << Verbose(1) << "Coloring Walker " << Walker->Name << " black." << endl);
    715715    if (OtherAtom == BFS.Root) { // if we have found the root, check whether this cycle wasn't already found beforehand
    716716      // step through predecessor list
     
    722722      }
    723723      if (OtherAtom == BackEdge->rightatom) { // if each atom in found cycle is cyclic, loop's been found before already
    724         Log() << Verbose(3) << "This cycle was already found before, skipping and removing seeker from search." << endl;
     724        DoLog(3) && (Log() << Verbose(3) << "This cycle was already found before, skipping and removing seeker from search." << endl);
    725725        do {
    726726          OtherAtom = BFS.TouchedStack->PopLast();
    727727          if (BFS.PredecessorList[OtherAtom->nr] == Walker) {
    728             Log() << Verbose(4) << "Removing " << *OtherAtom << " from lists and stacks." << endl;
     728            DoLog(4) && (Log() << Verbose(4) << "Removing " << *OtherAtom << " from lists and stacks." << endl);
    729729            BFS.PredecessorList[OtherAtom->nr] = NULL;
    730730            BFS.ShortestPathList[OtherAtom->nr] = -1;
     
    760760    RingSize = 1;
    761761    BFS.Root->GetTrueFather()->IsCyclic = true;
    762     Log() << Verbose(1) << "Found ring contains: ";
     762    DoLog(1) && (Log() << Verbose(1) << "Found ring contains: ");
    763763    Walker = BFS.Root;
    764764    while (Walker != BackEdge->rightatom) {
    765       Log() << Verbose(0) << Walker->Name << " <-> ";
     765      DoLog(0) && (Log() << Verbose(0) << Walker->Name << " <-> ");
    766766      Walker = BFS.PredecessorList[Walker->nr];
    767767      Walker->GetTrueFather()->IsCyclic = true;
    768768      RingSize++;
    769769    }
    770     Log() << Verbose(0) << Walker->Name << "  with a length of " << RingSize << "." << endl << endl;
     770    DoLog(0) && (Log() << Verbose(0) << Walker->Name << "  with a length of " << RingSize << "." << endl << endl);
    771771    // walk through all and set MinimumRingSize
    772772    Walker = BFS.Root;
     
    780780      MinRingSize = RingSize;
    781781  } else {
    782     Log() << Verbose(1) << "No ring containing " << *BFS.Root << " with length equal to or smaller than " << MinimumRingSize[Walker->GetTrueFather()->nr] << " found." << endl;
     782    DoLog(1) && (Log() << Verbose(1) << "No ring containing " << *BFS.Root << " with length equal to or smaller than " << MinimumRingSize[Walker->GetTrueFather()->nr] << " found." << endl);
    783783  }
    784784};
     
    858858
    859859      }
    860       Log() << Verbose(1) << "Minimum ring size of " << *Root << " is " << MinimumRingSize[Root->GetTrueFather()->nr] << "." << endl;
    861     }
    862     Log() << Verbose(1) << "Minimum ring size is " << MinRingSize << ", over " << NumCycles << " cycles total." << endl;
     860      DoLog(1) && (Log() << Verbose(1) << "Minimum ring size of " << *Root << " is " << MinimumRingSize[Root->GetTrueFather()->nr] << "." << endl);
     861    }
     862    DoLog(1) && (Log() << Verbose(1) << "Minimum ring size is " << MinRingSize << ", over " << NumCycles << " cycles total." << endl);
    863863  } else
    864     Log() << Verbose(1) << "No rings were detected in the molecular structure." << endl;
     864    DoLog(1) && (Log() << Verbose(1) << "No rings were detected in the molecular structure." << endl);
    865865}
    866866;
     
    890890  //BackEdgeStack->Output(out);
    891891
    892   Log() << Verbose(1) << "Analysing cycles ... " << endl;
     892  DoLog(1) && (Log() << Verbose(1) << "Analysing cycles ... " << endl);
    893893  NumCycles = 0;
    894894  while (!BackEdgeStack->IsEmpty()) {
     
    901901    ResetBFSAccounting(Walker, BFS);
    902902
    903     Log() << Verbose(1) << "---------------------------------------------------------------------------------------------------------" << endl;
     903    DoLog(1) && (Log() << Verbose(1) << "---------------------------------------------------------------------------------------------------------" << endl);
    904904    OtherAtom = NULL;
    905905    CyclicStructureAnalysis_CyclicBFSFromRootToRoot(BackEdge, BFS);
     
    973973void OutputAlreadyVisited(int *list)
    974974{
    975   Log() << Verbose(4) << "Already Visited Bonds:\t";
     975  DoLog(4) && (Log() << Verbose(4) << "Already Visited Bonds:\t");
    976976  for (int i = 1; i <= list[0]; i++)
    977     Log() << Verbose(0) << list[i] << "  ";
    978   Log() << Verbose(0) << endl;
     977    DoLog(0) && (Log() << Verbose(0) << list[i] << "  ");
     978  DoLog(0) && (Log() << Verbose(0) << endl);
    979979}
    980980;
     
    997997    line << filename;
    998998  AdjacencyFile.open(line.str().c_str(), ios::out);
    999   Log() << Verbose(1) << "Saving adjacency list ... ";
     999  DoLog(1) && (Log() << Verbose(1) << "Saving adjacency list ... ");
    10001000  if (AdjacencyFile != NULL) {
    10011001    AdjacencyFile << "m\tn" << endl;
    10021002    ActOnAllAtoms(&atom::OutputAdjacency, &AdjacencyFile);
    10031003    AdjacencyFile.close();
    1004     Log() << Verbose(1) << "done." << endl;
     1004    DoLog(1) && (Log() << Verbose(1) << "done." << endl);
    10051005  } else {
    1006     Log() << Verbose(1) << "failed to open file " << line.str() << "." << endl;
     1006    DoLog(1) && (Log() << Verbose(1) << "failed to open file " << line.str() << "." << endl);
    10071007    status = false;
    10081008  }
     
    10291029    line << filename;
    10301030  BondFile.open(line.str().c_str(), ios::out);
    1031   Log() << Verbose(1) << "Saving adjacency list ... ";
     1031  DoLog(1) && (Log() << Verbose(1) << "Saving adjacency list ... ");
    10321032  if (BondFile != NULL) {
    10331033    BondFile << "m\tn" << endl;
    10341034    ActOnAllAtoms(&atom::OutputBonds, &BondFile);
    10351035    BondFile.close();
    1036     Log() << Verbose(1) << "done." << endl;
     1036    DoLog(1) && (Log() << Verbose(1) << "done." << endl);
    10371037  } else {
    1038     Log() << Verbose(1) << "failed to open file " << line.str() << "." << endl;
     1038    DoLog(1) && (Log() << Verbose(1) << "failed to open file " << line.str() << "." << endl);
    10391039    status = false;
    10401040  }
     
    10491049  filename << path << "/" << FRAGMENTPREFIX << ADJACENCYFILE;
    10501050  File.open(filename.str().c_str(), ios::out);
    1051   Log() << Verbose(1) << "Looking at bond structure stored in adjacency file and comparing to present one ... ";
     1051  DoLog(1) && (Log() << Verbose(1) << "Looking at bond structure stored in adjacency file and comparing to present one ... ");
    10521052  if (File == NULL)
    10531053    return false;
     
    10901090    //Log() << Verbose(0) << endl;
    10911091  } else {
    1092     Log() << Verbose(0) << "Number of bonds for Atom " << *Walker << " does not match, parsed " << CurrentBondsOfAtom << " against " << Walker->ListOfBonds.size() << "." << endl;
     1092    DoLog(0) && (Log() << Verbose(0) << "Number of bonds for Atom " << *Walker << " does not match, parsed " << CurrentBondsOfAtom << " against " << Walker->ListOfBonds.size() << "." << endl);
    10931093    status = false;
    10941094  }
     
    11131113
    11141114  if (!CheckAdjacencyFileAgainstMolecule_Init(path, File, CurrentBonds)) {
    1115     Log() << Verbose(1) << "Adjacency file not found." << endl;
     1115    DoLog(1) && (Log() << Verbose(1) << "Adjacency file not found." << endl);
    11161116    return true;
    11171117  }
     
    11391139
    11401140  if (status) { // if equal we parse the KeySetFile
    1141     Log() << Verbose(1) << "done: Equal." << endl;
     1141    DoLog(1) && (Log() << Verbose(1) << "done: Equal." << endl);
    11421142  } else
    1143     Log() << Verbose(1) << "done: Not equal by " << NonMatchNumber << " atoms." << endl;
     1143    DoLog(1) && (Log() << Verbose(1) << "done: Not equal by " << NonMatchNumber << " atoms." << endl);
    11441144  return status;
    11451145}
     
    11571157  bool status = true;
    11581158  if (ReferenceStack->IsEmpty()) {
    1159     Log() << Verbose(1) << "ReferenceStack is empty!" << endl;
     1159    DoLog(1) && (Log() << Verbose(1) << "ReferenceStack is empty!" << endl);
    11601160    return false;
    11611161  }
     
    11721172        if (OtherAtom == ListOfLocalAtoms[(*Runner)->rightatom->nr]) { // found the bond
    11731173          LocalStack->Push((*Runner));
    1174           Log() << Verbose(3) << "Found local edge " << *(*Runner) << "." << endl;
     1174          DoLog(3) && (Log() << Verbose(3) << "Found local edge " << *(*Runner) << "." << endl);
    11751175          break;
    11761176        }
    11771177      }
    11781178    Binder = ReferenceStack->PopFirst(); // loop the stack for next item
    1179     Log() << Verbose(3) << "Current candidate edge " << Binder << "." << endl;
     1179    DoLog(3) && (Log() << Verbose(3) << "Current candidate edge " << Binder << "." << endl);
    11801180    ReferenceStack->Push(Binder);
    11811181  } while (FirstBond != Binder);
     
    12261226  BFS.PredecessorList[OtherAtom->nr] = Walker; // Walker is the predecessor
    12271227  BFS.ShortestPathList[OtherAtom->nr] = BFS.ShortestPathList[Walker->nr] + 1;
    1228   Log() << Verbose(2) << "Coloring OtherAtom " << OtherAtom->Name << " " << ((BFS.ColorList[OtherAtom->nr] == white) ? "white" : "lightgray") << ", its predecessor is " << Walker->Name << " and its Shortest Path is " << BFS.ShortestPathList[OtherAtom->nr] << " egde(s) long." << endl;
     1228  DoLog(2) && (Log() << Verbose(2) << "Coloring OtherAtom " << OtherAtom->Name << " " << ((BFS.ColorList[OtherAtom->nr] == white) ? "white" : "lightgray") << ", its predecessor is " << Walker->Name << " and its Shortest Path is " << BFS.ShortestPathList[OtherAtom->nr] << " egde(s) long." << endl);
    12291229  if ((((BFS.ShortestPathList[OtherAtom->nr] < BFS.BondOrder) && (Binder != Bond)))) { // Check for maximum distance
    1230     Log() << Verbose(3);
     1230    DoLog(3) && (Log() << Verbose(3));
    12311231    if (AddedAtomList[OtherAtom->nr] == NULL) { // add if it's not been so far
    12321232      AddedAtomList[OtherAtom->nr] = Mol->AddCopyAtom(OtherAtom);
    1233       Log() << Verbose(0) << "Added OtherAtom " << OtherAtom->Name;
     1233      DoLog(0) && (Log() << Verbose(0) << "Added OtherAtom " << OtherAtom->Name);
    12341234      AddedBondList[Binder->nr] = Mol->CopyBond(AddedAtomList[Walker->nr], AddedAtomList[OtherAtom->nr], Binder);
    1235       Log() << Verbose(0) << " and bond " << *(AddedBondList[Binder->nr]) << ", ";
     1235      DoLog(0) && (Log() << Verbose(0) << " and bond " << *(AddedBondList[Binder->nr]) << ", ");
    12361236    } else { // this code should actually never come into play (all white atoms are not yet present in BondMolecule, that's why they are white in the first place)
    1237       Log() << Verbose(0) << "Not adding OtherAtom " << OtherAtom->Name;
     1237      DoLog(0) && (Log() << Verbose(0) << "Not adding OtherAtom " << OtherAtom->Name);
    12381238      if (AddedBondList[Binder->nr] == NULL) {
    12391239        AddedBondList[Binder->nr] = Mol->CopyBond(AddedAtomList[Walker->nr], AddedAtomList[OtherAtom->nr], Binder);
    1240         Log() << Verbose(0) << ", added Bond " << *(AddedBondList[Binder->nr]);
     1240        DoLog(0) && (Log() << Verbose(0) << ", added Bond " << *(AddedBondList[Binder->nr]));
    12411241      } else
    1242         Log() << Verbose(0) << ", not added Bond ";
    1243     }
    1244     Log() << Verbose(0) << ", putting OtherAtom into queue." << endl;
     1242        DoLog(0) && (Log() << Verbose(0) << ", not added Bond ");
     1243    }
     1244    DoLog(0) && (Log() << Verbose(0) << ", putting OtherAtom into queue." << endl);
    12451245    BFS.BFSStack->Push(OtherAtom);
    12461246  } else { // out of bond order, then replace
     
    12481248      BFS.ColorList[OtherAtom->nr] = white; // unmark if it has not been queued/added, to make it available via its other bonds (cyclic)
    12491249    if (Binder == Bond)
    1250       Log() << Verbose(3) << "Not Queueing, is the Root bond";
     1250      DoLog(3) && (Log() << Verbose(3) << "Not Queueing, is the Root bond");
    12511251    else if (BFS.ShortestPathList[OtherAtom->nr] >= BFS.BondOrder)
    1252       Log() << Verbose(3) << "Not Queueing, is out of Bond Count of " << BFS.BondOrder;
     1252      DoLog(3) && (Log() << Verbose(3) << "Not Queueing, is out of Bond Count of " << BFS.BondOrder);
    12531253    if (!Binder->Cyclic)
    1254       Log() << Verbose(0) << ", is not part of a cyclic bond, saturating bond with Hydrogen." << endl;
     1254      DoLog(0) && (Log() << Verbose(0) << ", is not part of a cyclic bond, saturating bond with Hydrogen." << endl);
    12551255    if (AddedBondList[Binder->nr] == NULL) {
    12561256      if ((AddedAtomList[OtherAtom->nr] != NULL)) { // .. whether we add or saturate
     
    12691269void BreadthFirstSearchAdd_VisitedNode(molecule *Mol, struct BFSAccounting &BFS, atom *&Walker, atom *&OtherAtom, bond *&Binder, bond *&Bond, atom **&AddedAtomList, bond **&AddedBondList, bool IsAngstroem)
    12701270{
    1271   Log() << Verbose(3) << "Not Adding, has already been visited." << endl;
     1271  DoLog(3) && (Log() << Verbose(3) << "Not Adding, has already been visited." << endl);
    12721272  // This has to be a cyclic bond, check whether it's present ...
    12731273  if (AddedBondList[Binder->nr] == NULL) {
     
    13151315    // followed by n+1 till top of stack.
    13161316    Walker = BFS.BFSStack->PopFirst(); // pop oldest added
    1317     Log() << Verbose(1) << "Current Walker is: " << Walker->Name << ", and has " << Walker->ListOfBonds.size() << " bonds." << endl;
     1317    DoLog(1) && (Log() << Verbose(1) << "Current Walker is: " << Walker->Name << ", and has " << Walker->ListOfBonds.size() << " bonds." << endl);
    13181318    for (BondList::const_iterator Runner = Walker->ListOfBonds.begin(); Runner != Walker->ListOfBonds.end(); (++Runner)) {
    13191319      if ((*Runner) != NULL) { // don't look at bond equal NULL
    13201320        Binder = (*Runner);
    13211321        OtherAtom = (*Runner)->GetOtherAtom(Walker);
    1322         Log() << Verbose(2) << "Current OtherAtom is: " << OtherAtom->Name << " for bond " << *(*Runner) << "." << endl;
     1322        DoLog(2) && (Log() << Verbose(2) << "Current OtherAtom is: " << OtherAtom->Name << " for bond " << *(*Runner) << "." << endl);
    13231323        if (BFS.ColorList[OtherAtom->nr] == white) {
    13241324          BreadthFirstSearchAdd_UnvisitedNode(Mol, BFS, Walker, OtherAtom, Binder, Bond, AddedAtomList, AddedBondList, IsAngstroem);
     
    13291329    }
    13301330    BFS.ColorList[Walker->nr] = black;
    1331     Log() << Verbose(1) << "Coloring Walker " << Walker->Name << " black." << endl;
     1331    DoLog(1) && (Log() << Verbose(1) << "Coloring Walker " << Walker->Name << " black." << endl);
    13321332  }
    13331333  BreadthFirstSearchAdd_Free(BFS);
     
    13541354  // reset parent list
    13551355  ParentList = Calloc<atom*> (AtomCount, "molecule::BuildInducedSubgraph_Init: **ParentList");
    1356   Log() << Verbose(3) << "Resetting ParentList." << endl;
     1356  DoLog(3) && (Log() << Verbose(3) << "Resetting ParentList." << endl);
    13571357}
    13581358;
     
    13611361{
    13621362  // fill parent list with sons
    1363   Log() << Verbose(3) << "Filling Parent List." << endl;
     1363  DoLog(3) && (Log() << Verbose(3) << "Filling Parent List." << endl);
    13641364  atom *Walker = mol->start;
    13651365  while (Walker->next != mol->end) {
     
    13671367    ParentList[Walker->father->nr] = Walker;
    13681368    // Outputting List for debugging
    1369     Log() << Verbose(4) << "Son[" << Walker->father->nr << "] of " << Walker->father << " is " << ParentList[Walker->father->nr] << "." << endl;
     1369    DoLog(4) && (Log() << Verbose(4) << "Son[" << Walker->father->nr << "] of " << Walker->father << " is " << ParentList[Walker->father->nr] << "." << endl);
    13701370  }
    13711371
     
    13851385  atom *OtherAtom = NULL;
    13861386  // check each entry of parent list and if ok (one-to-and-onto matching) create bonds
    1387   Log() << Verbose(3) << "Creating bonds." << endl;
     1387  DoLog(3) && (Log() << Verbose(3) << "Creating bonds." << endl);
    13881388  Walker = Father->start;
    13891389  while (Walker->next != Father->end) {
     
    13961396          OtherAtom = (*Runner)->GetOtherAtom(Walker);
    13971397          if (ParentList[OtherAtom->nr] != NULL) { // if otheratom is also a father of an atom on this molecule, create the bond
    1398             Log() << Verbose(4) << "Endpoints of Bond " << (*Runner) << " are both present: " << ParentList[Walker->nr]->Name << " and " << ParentList[OtherAtom->nr]->Name << "." << endl;
     1398            DoLog(4) && (Log() << Verbose(4) << "Endpoints of Bond " << (*Runner) << " are both present: " << ParentList[Walker->nr]->Name << " and " << ParentList[OtherAtom->nr]->Name << "." << endl);
    13991399            mol->AddBond(ParentList[Walker->nr], ParentList[OtherAtom->nr], (*Runner)->BondDegree);
    14001400          }
     
    14211421  atom **ParentList = NULL;
    14221422
    1423   Log() << Verbose(2) << "Begin of BuildInducedSubgraph." << endl;
     1423  DoLog(2) && (Log() << Verbose(2) << "Begin of BuildInducedSubgraph." << endl);
    14241424  BuildInducedSubgraph_Init(ParentList, Father->AtomCount);
    14251425  BuildInducedSubgraph_FillParentList(this, Father, ParentList);
    14261426  status = BuildInducedSubgraph_CreateBondsFromParent(this, Father, ParentList);
    14271427  BuildInducedSubgraph_Finalize(ParentList);
    1428   Log() << Verbose(2) << "End of BuildInducedSubgraph." << endl;
     1428  DoLog(2) && (Log() << Verbose(2) << "End of BuildInducedSubgraph." << endl);
    14291429  return status;
    14301430}
     
    14431443  int size;
    14441444
    1445   Log() << Verbose(1) << "Begin of CheckForConnectedSubgraph" << endl;
    1446   Log() << Verbose(2) << "Disconnected atom: ";
     1445  DoLog(1) && (Log() << Verbose(1) << "Begin of CheckForConnectedSubgraph" << endl);
     1446  DoLog(2) && (Log() << Verbose(2) << "Disconnected atom: ");
    14471447
    14481448  // count number of atoms in graph
     
    14661466      }
    14671467      if (!BondStatus) {
    1468         Log() << Verbose(0) << (*Walker) << endl;
     1468        DoLog(0) && (Log() << Verbose(0) << (*Walker) << endl);
    14691469        return false;
    14701470      }
    14711471    }
    14721472  else {
    1473     Log() << Verbose(0) << "none." << endl;
     1473    DoLog(0) && (Log() << Verbose(0) << "none." << endl);
    14741474    return true;
    14751475  }
    1476   Log() << Verbose(0) << "none." << endl;
    1477 
    1478   Log() << Verbose(1) << "End of CheckForConnectedSubgraph" << endl;
     1476  DoLog(0) && (Log() << Verbose(0) << "none." << endl);
     1477
     1478  DoLog(1) && (Log() << Verbose(1) << "End of CheckForConnectedSubgraph" << endl);
    14791479
    14801480  return true;
Note: See TracChangeset for help on using the changeset viewer.