Index: src/moleculelist.cpp
===================================================================
--- src/moleculelist.cpp	(revision bc84ffc76ba4d3b32c0699d8504d57183a64c18f)
+++ src/moleculelist.cpp	(revision a67d19a01c3b0bbb8bd6d255ed9a4ffbe37f3138)
@@ -36,10 +36,10 @@
 MoleculeListClass::~MoleculeListClass()
 {
-  Log() << Verbose(3) << this << ": Freeing ListOfMolcules." << endl;
+  DoLog(3) && (Log() << Verbose(3) << this << ": Freeing ListOfMolcules." << endl);
   for (MoleculeList::iterator ListRunner = ListOfMolecules.begin(); ListRunner != ListOfMolecules.end(); ListRunner++) {
-    Log() << Verbose(4) << "ListOfMolecules: Freeing " << *ListRunner << "." << endl;
+    DoLog(4) && (Log() << Verbose(4) << "ListOfMolecules: Freeing " << *ListRunner << "." << endl);
     delete (*ListRunner);
   }
-  Log() << Verbose(4) << "Freeing ListOfMolecules." << endl;
+  DoLog(4) && (Log() << Verbose(4) << "Freeing ListOfMolecules." << endl);
   ListOfMolecules.clear(); // empty list
 };
@@ -145,8 +145,8 @@
 
   // header
-  Log() << Verbose(0) << "Index\tName\t\tAtoms\tFormula\tCenter\tSize" << endl;
-  Log() << Verbose(0) << "-----------------------------------------------" << endl;
+  DoLog(0) && (Log() << Verbose(0) << "Index\tName\t\tAtoms\tFormula\tCenter\tSize" << endl);
+  DoLog(0) && (Log() << Verbose(0) << "-----------------------------------------------" << endl);
   if (ListOfMolecules.size() == 0)
-    Log() << Verbose(0) << "\tNone" << endl;
+    DoLog(0) && (Log() << Verbose(0) << "\tNone" << endl);
   else {
     Origin.Zero();
@@ -165,13 +165,13 @@
       }
       // output Index, Name, number of atoms, chemical formula
-      Log() << Verbose(0) << ((*ListRunner)->ActiveFlag ? "*" : " ") << (*ListRunner)->IndexNr << "\t" << (*ListRunner)->name << "\t\t" << (*ListRunner)->AtomCount << "\t";
+      DoLog(0) && (Log() << Verbose(0) << ((*ListRunner)->ActiveFlag ? "*" : " ") << (*ListRunner)->IndexNr << "\t" << (*ListRunner)->name << "\t\t" << (*ListRunner)->AtomCount << "\t");
       Elemental = (*ListRunner)->elemente->end;
       while(Elemental->previous != (*ListRunner)->elemente->start) {
         Elemental = Elemental->previous;
         if (Counts[Elemental->Z] != 0)
-          Log() << Verbose(0) << Elemental->symbol << Counts[Elemental->Z];
+          DoLog(0) && (Log() << Verbose(0) << Elemental->symbol << Counts[Elemental->Z]);
       }
       // Center and size
-      Log() << Verbose(0) << "\t" << (*ListRunner)->Center << "\t" << sqrt(size) << endl;
+      DoLog(0) && (Log() << Verbose(0) << "\t" << (*ListRunner)->Center << "\t" << sqrt(size) << endl);
     }
   }
@@ -339,5 +339,5 @@
   while (Walker->next != srcmol->end) {
     Walker = Walker->next;
-    Log() << Verbose(2) << "INFO: Current Walker is " << *Walker << "." << endl;
+    DoLog(2) && (Log() << Verbose(2) << "INFO: Current Walker is " << *Walker << "." << endl);
     if (!TesselStruct->IsInnerPoint(Walker->x, LCList)) {
       CopyAtoms[Walker->nr] = new atom(Walker);
@@ -348,5 +348,5 @@
     }
   }
-  Log() << Verbose(1) << nr << " of " << srcmol->AtomCount << " atoms have been merged.";
+  DoLog(1) && (Log() << Verbose(1) << nr << " of " << srcmol->AtomCount << " atoms have been merged.");
 
   // go through all bonds and add as well
@@ -354,5 +354,5 @@
   while(Binder->next != srcmol->last) {
     Binder = Binder->next;
-    Log() << Verbose(3) << "Adding Bond between " << *CopyAtoms[Binder->leftatom->nr] << " and " << *CopyAtoms[Binder->rightatom->nr]<< "." << endl;
+    DoLog(3) && (Log() << Verbose(3) << "Adding Bond between " << *CopyAtoms[Binder->leftatom->nr] << " and " << *CopyAtoms[Binder->rightatom->nr]<< "." << endl);
     mol->AddBond(CopyAtoms[Binder->leftatom->nr], CopyAtoms[Binder->rightatom->nr], Binder->BondDegree);
   }
@@ -366,8 +366,8 @@
 void MoleculeListClass::Output(ofstream *out)
 {
-  Log() << Verbose(1) << "MoleculeList: ";
+  DoLog(1) && (Log() << Verbose(1) << "MoleculeList: ");
   for (MoleculeList::iterator ListRunner = ListOfMolecules.begin(); ListRunner != ListOfMolecules.end(); ListRunner++)
-    Log() << Verbose(0) << *ListRunner << "\t";
-  Log() << Verbose(0) << endl;
+    DoLog(0) && (Log() << Verbose(0) << *ListRunner << "\t");
+  DoLog(0) && (Log() << Verbose(0) << endl);
 };
 
@@ -395,5 +395,5 @@
   char *FragmentNumber = NULL;
 
-  Log() << Verbose(1) << "Saving hydrogen saturation correction ... ";
+  DoLog(1) && (Log() << Verbose(1) << "Saving hydrogen saturation correction ... ");
   // 0. parse in fit constant files that should have the same dimension as the final energy files
   // 0a. find dimension of matrices with constants
@@ -405,5 +405,5 @@
   input.open(line.c_str());
   if (input == NULL) {
-    Log() << Verbose(1) << endl << "Unable to open " << line << ", is the directory correct?" << endl;
+    DoLog(1) && (Log() << Verbose(1) << endl << "Unable to open " << line << ", is the directory correct?" << endl);
     return false;
   }
@@ -422,5 +422,5 @@
     b++;
   }
-  Log() << Verbose(0) << "I recognized " << a << " columns and " << b << " rows, ";
+  DoLog(0) && (Log() << Verbose(0) << "I recognized " << a << " columns and " << b << " rows, ");
   input.close();
 
@@ -465,12 +465,12 @@
   }
   for (int k = 0; k < 3; k++) {
-    Log() << Verbose(0) << "Constants " << k << ":" << endl;
+    DoLog(0) && (Log() << Verbose(0) << "Constants " << k << ":" << endl);
     for (int j = 0; j < b; j++) {
       for (int i = 0; i < a; i++) {
-        Log() << Verbose(0) << FitConstant[k][i][j] << "\t";
+        DoLog(0) && (Log() << Verbose(0) << FitConstant[k][i][j] << "\t");
       }
-      Log() << Verbose(0) << endl;
-    }
-    Log() << Verbose(0) << endl;
+      DoLog(0) && (Log() << Verbose(0) << endl);
+    }
+    DoLog(0) && (Log() << Verbose(0) << endl);
   }
 
@@ -560,5 +560,5 @@
   }
   Free(&FitConstant);
-  Log() << Verbose(0) << "done." << endl;
+  DoLog(0) && (Log() << Verbose(0) << "done." << endl);
   return true;
 };
@@ -580,5 +580,5 @@
 
   // open file for the force factors
-  Log() << Verbose(1) << "Saving  force factors ... ";
+  DoLog(1) && (Log() << Verbose(1) << "Saving  force factors ... ");
   line << path << "/" << FRAGMENTPREFIX << FORCESFILE;
   ForcesFile.open(line.str().c_str(), ios::out);
@@ -608,8 +608,8 @@
     }
     ForcesFile.close();
-    Log() << Verbose(1) << "done." << endl;
+    DoLog(1) && (Log() << Verbose(1) << "done." << endl);
   } else {
     status = false;
-    Log() << Verbose(1) << "failed to open file " << line.str() << "." << endl;
+    DoLog(1) && (Log() << Verbose(1) << "failed to open file " << line.str() << "." << endl);
   }
   ForcesFile.close();
@@ -663,9 +663,9 @@
     sprintf(FragmentName, "%s/%s%s.conf.xyz", configuration->configpath, FRAGMENTPREFIX, FragmentNumber);
     outputFragment.open(FragmentName, ios::out);
-    Log() << Verbose(2) << "Saving bond fragment No. " << FragmentNumber << "/" << FragmentCounter - 1 << " as XYZ ...";
+    DoLog(2) && (Log() << Verbose(2) << "Saving bond fragment No. " << FragmentNumber << "/" << FragmentCounter - 1 << " as XYZ ...");
     if ((intermediateResult = (*ListRunner)->OutputXYZ(&outputFragment)))
-      Log() << Verbose(0) << " done." << endl;
+      DoLog(0) && (Log() << Verbose(0) << " done." << endl);
     else
-      Log() << Verbose(0) << " failed." << endl;
+      DoLog(0) && (Log() << Verbose(0) << " failed." << endl);
     result = result && intermediateResult;
     outputFragment.close();
@@ -673,11 +673,11 @@
 
     // list atoms in fragment for debugging
-    Log() << Verbose(2) << "Contained atoms: ";
+    DoLog(2) && (Log() << Verbose(2) << "Contained atoms: ");
     Walker = (*ListRunner)->start;
     while (Walker->next != (*ListRunner)->end) {
       Walker = Walker->next;
-      Log() << Verbose(0) << Walker->Name << " ";
-    }
-    Log() << Verbose(0) << endl;
+      DoLog(0) && (Log() << Verbose(0) << Walker->Name << " ");
+    }
+    DoLog(0) && (Log() << Verbose(0) << endl);
 
     // center on edge
@@ -703,9 +703,9 @@
     // and save as config
     sprintf(FragmentName, "%s/%s%s.conf", configuration->configpath, FRAGMENTPREFIX, FragmentNumber);
-    Log() << Verbose(2) << "Saving bond fragment No. " << FragmentNumber << "/" << FragmentCounter - 1 << " as config ...";
+    DoLog(2) && (Log() << Verbose(2) << "Saving bond fragment No. " << FragmentNumber << "/" << FragmentCounter - 1 << " as config ...");
     if ((intermediateResult = configuration->Save(FragmentName, (*ListRunner)->elemente, (*ListRunner))))
-      Log() << Verbose(0) << " done." << endl;
+      DoLog(0) && (Log() << Verbose(0) << " done." << endl);
     else
-      Log() << Verbose(0) << " failed." << endl;
+      DoLog(0) && (Log() << Verbose(0) << " failed." << endl);
     result = result && intermediateResult;
 
@@ -715,9 +715,9 @@
     // and save as mpqc input file
     sprintf(FragmentName, "%s/%s%s.conf", configuration->configpath, FRAGMENTPREFIX, FragmentNumber);
-    Log() << Verbose(2) << "Saving bond fragment No. " << FragmentNumber << "/" << FragmentCounter - 1 << " as mpqc input ...";
+    DoLog(2) && (Log() << Verbose(2) << "Saving bond fragment No. " << FragmentNumber << "/" << FragmentCounter - 1 << " as mpqc input ...");
     if ((intermediateResult = configuration->SaveMPQC(FragmentName, (*ListRunner))))
-      Log() << Verbose(2) << " done." << endl;
+      DoLog(2) && (Log() << Verbose(2) << " done." << endl);
     else
-      Log() << Verbose(0) << " failed." << endl;
+      DoLog(0) && (Log() << Verbose(0) << " failed." << endl);
 
     result = result && intermediateResult;
@@ -726,8 +726,8 @@
     Free(&FragmentNumber);
   }
-  Log() << Verbose(0) << " done." << endl;
+  DoLog(0) && (Log() << Verbose(0) << " done." << endl);
 
   // printing final number
-  Log() << Verbose(2) << "Final number of fragments: " << FragmentCounter << "." << endl;
+  DoLog(2) && (Log() << Verbose(2) << "Final number of fragments: " << FragmentCounter << "." << endl);
 
   // restore cell_size
@@ -768,5 +768,5 @@
       Walker = Advancer;
       Advancer = Advancer->next;
-      Log() << Verbose(3) << "Re-linking " << *Walker << "..." << endl;
+      DoLog(3) && (Log() << Verbose(3) << "Re-linking " << *Walker << "..." << endl);
       unlink(Walker);
       Walker->father = Walker;
@@ -819,5 +819,5 @@
       strncat(molecules[i]->name, number, MAXSTRINGSIZE - strlen(mol->name) - 1);
     }
-    Log() << Verbose(1) << "MolName is " << molecules[i]->name << endl;
+    DoLog(1) && (Log() << Verbose(1) << "MolName is " << molecules[i]->name << endl);
     insert(molecules[i]);
   }
@@ -848,5 +848,5 @@
     FragmentCounter = MolMap[Walker->nr];
     if (FragmentCounter != 0) {
-      Log() << Verbose(3) << "Re-linking " << *Walker << "..." << endl;
+      DoLog(3) && (Log() << Verbose(3) << "Re-linking " << *Walker << "..." << endl);
       unlink(Walker);
       molecules[FragmentCounter-1]->AddAtom(Walker);    // counting starts at 1
@@ -873,5 +873,5 @@
   Free(&MolMap);
   Free(&molecules);
-  Log() << Verbose(1) << "I scanned " << FragmentCounter << " molecules." << endl;
+  DoLog(1) && (Log() << Verbose(1) << "I scanned " << FragmentCounter << " molecules." << endl);
 };
 
@@ -982,13 +982,13 @@
   int AtomNo;
 
-  Log() << Verbose(1) << "Begin of FillBondStructureFromReference." << endl;
+  DoLog(1) && (Log() << Verbose(1) << "Begin of FillBondStructureFromReference." << endl);
   // fill ListOfLocalAtoms if NULL was given
   if (!FillListOfLocalAtoms(ListOfLocalAtoms, FragmentCounter, reference->AtomCount, FreeList)) {
-    Log() << Verbose(1) << "Filling of ListOfLocalAtoms failed." << endl;
+    DoLog(1) && (Log() << Verbose(1) << "Filling of ListOfLocalAtoms failed." << endl);
     return false;
   }
 
   if (status) {
-    Log() << Verbose(1) << "Creating adjacency list for subgraph " << Leaf << "." << endl;
+    DoLog(1) && (Log() << Verbose(1) << "Creating adjacency list for subgraph " << Leaf << "." << endl);
     // remove every bond from the list
     bond *Binder = NULL;
@@ -1011,5 +1011,5 @@
             Leaf->AddBond(Walker, OtherWalker, (*Runner)->BondDegree);
         } else {
-          Log() << Verbose(1) << "OtherWalker = ListOfLocalAtoms[" << FragmentCounter << "][" << (*Runner)->GetOtherAtom(Walker->GetTrueFather())->nr << "] is NULL!" << endl;
+          DoLog(1) && (Log() << Verbose(1) << "OtherWalker = ListOfLocalAtoms[" << FragmentCounter << "][" << (*Runner)->GetOtherAtom(Walker->GetTrueFather())->nr << "] is NULL!" << endl);
           status = false;
         }
@@ -1024,5 +1024,5 @@
       Free(&ListOfLocalAtoms);
   }
-  Log() << Verbose(1) << "End of FillBondStructureFromReference." << endl;
+  DoLog(1) && (Log() << Verbose(1) << "End of FillBondStructureFromReference." << endl);
   return status;
 };
@@ -1057,5 +1057,5 @@
         next->FillRootStackForSubgraphs(RootStack, AtomMask, ++FragmentCounter);
     } else {
-      Log() << Verbose(1) << "Rootstack[" << FragmentCounter << "] is NULL." << endl;
+      DoLog(1) && (Log() << Verbose(1) << "Rootstack[" << FragmentCounter << "] is NULL." << endl);
       return false;
     }
@@ -1063,5 +1063,5 @@
     return true;
   } else {
-    Log() << Verbose(1) << "Rootstack is NULL." << endl;
+    DoLog(1) && (Log() << Verbose(1) << "Rootstack is NULL." << endl);
     return false;
   }
@@ -1113,8 +1113,8 @@
   int KeySetCounter = 0;
 
-  Log() << Verbose(1) << "Begin of AssignKeySetsToFragment." << endl;
+  DoLog(1) && (Log() << Verbose(1) << "Begin of AssignKeySetsToFragment." << endl);
   // fill ListOfLocalAtoms if NULL was given
   if (!FillListOfLocalAtoms(ListOfLocalAtoms, FragmentCounter, reference->AtomCount, FreeList)) {
-    Log() << Verbose(1) << "Filling of ListOfLocalAtoms failed." << endl;
+    DoLog(1) && (Log() << Verbose(1) << "Filling of ListOfLocalAtoms failed." << endl);
     return false;
   }
@@ -1144,8 +1144,8 @@
     delete (TempSet);
     if (KeySetCounter == 0) {// if there are no keysets, delete the list
-      Log() << Verbose(1) << "KeySetCounter is zero, deleting FragmentList." << endl;
+      DoLog(1) && (Log() << Verbose(1) << "KeySetCounter is zero, deleting FragmentList." << endl);
       delete (FragmentList[FragmentCounter]);
     } else
-      Log() << Verbose(1) << KeySetCounter << " keysets were assigned to subgraph " << FragmentCounter << "." << endl;
+      DoLog(1) && (Log() << Verbose(1) << KeySetCounter << " keysets were assigned to subgraph " << FragmentCounter << "." << endl);
     FragmentCounter++;
     if (next != NULL)
@@ -1153,5 +1153,5 @@
     FragmentCounter--;
   } else
-    Log() << Verbose(1) << "KeySetList is NULL or empty." << endl;
+    DoLog(1) && (Log() << Verbose(1) << "KeySetList is NULL or empty." << endl);
 
   if ((FreeList) && (ListOfLocalAtoms != NULL)) {
@@ -1161,5 +1161,5 @@
       Free(&ListOfLocalAtoms);
   }
-  Log() << Verbose(1) << "End of AssignKeySetsToFragment." << endl;
+  DoLog(1) && (Log() << Verbose(1) << "End of AssignKeySetsToFragment." << endl);
   return status;
 };
@@ -1174,5 +1174,5 @@
 void MoleculeLeafClass::TranslateIndicesToGlobalIDs(Graph **FragmentList, int &FragmentCounter, int &TotalNumberOfKeySets, Graph &TotalGraph)
 {
-  Log() << Verbose(1) << "Begin of TranslateIndicesToGlobalIDs." << endl;
+  DoLog(1) && (Log() << Verbose(1) << "Begin of TranslateIndicesToGlobalIDs." << endl);
   KeySet *TempSet = new KeySet;
   if (FragmentList[FragmentCounter] != NULL) {
@@ -1185,10 +1185,10 @@
     delete (TempSet);
   } else {
-    Log() << Verbose(1) << "FragmentList is NULL." << endl;
+    DoLog(1) && (Log() << Verbose(1) << "FragmentList is NULL." << endl);
   }
   if (next != NULL)
     next->TranslateIndicesToGlobalIDs(FragmentList, ++FragmentCounter, TotalNumberOfKeySets, TotalGraph);
   FragmentCounter--;
-  Log() << Verbose(1) << "End of TranslateIndicesToGlobalIDs." << endl;
+  DoLog(1) && (Log() << Verbose(1) << "End of TranslateIndicesToGlobalIDs." << endl);
 };
 
