Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/builder.cpp

    re138de ra67d19  
    5050using namespace std;
    5151
     52#include <cstring>
     53
     54#include "analysis_bonds.hpp"
    5255#include "analysis_correlation.hpp"
    5356#include "atom.hpp"
     
    6568#include "molecule.hpp"
    6669#include "periodentafel.hpp"
     70#include "version.h"
     71#include "World.hpp"
    6772
    6873/********************************************* Subsubmenu routine ************************************/
     
    8186  bool valid;
    8287
    83   Log() << Verbose(0) << "===========ADD ATOM============================" << endl;
    84   Log() << Verbose(0) << " a - state absolute coordinates of atom" << endl;
    85   Log() << Verbose(0) << " b - state relative coordinates of atom wrt to reference point" << endl;
    86   Log() << Verbose(0) << " c - state relative coordinates of atom wrt to already placed atom" << endl;
    87   Log() << Verbose(0) << " d - state two atoms, two angles and a distance" << endl;
    88   Log() << Verbose(0) << " e - least square distance position to a set of atoms" << endl;
    89   Log() << Verbose(0) << "all else - go back" << endl;
    90   Log() << Verbose(0) << "===============================================" << endl;
    91   Log() << Verbose(0) << "Note: Specifiy angles in degrees not multiples of Pi!" << endl;
    92   Log() << Verbose(0) << "INPUT: ";
     88  cout << Verbose(0) << "===========ADD ATOM============================" << endl;
     89  cout << Verbose(0) << " a - state absolute coordinates of atom" << endl;
     90  cout << Verbose(0) << " b - state relative coordinates of atom wrt to reference point" << endl;
     91  cout << Verbose(0) << " c - state relative coordinates of atom wrt to already placed atom" << endl;
     92  cout << Verbose(0) << " d - state two atoms, two angles and a distance" << endl;
     93  cout << Verbose(0) << " e - least square distance position to a set of atoms" << endl;
     94  cout << Verbose(0) << "all else - go back" << endl;
     95  cout << Verbose(0) << "===============================================" << endl;
     96  cout << Verbose(0) << "Note: Specifiy angles in degrees not multiples of Pi!" << endl;
     97  cout << Verbose(0) << "INPUT: ";
    9398  cin >> choice;
    9499
    95100  switch (choice) {
    96101    default:
    97       Log() << Verbose(0) << "Not a valid choice." << endl;
     102      DoeLog(2) && (eLog()<< Verbose(2) << "Not a valid choice." << endl);
    98103      break;
    99104      case 'a': // absolute coordinates of atom
    100         Log() << Verbose(0) << "Enter absolute coordinates." << endl;
     105        cout << Verbose(0) << "Enter absolute coordinates." << endl;
    101106        first = new atom;
    102         first->x.AskPosition(mol->cell_size, false);
     107        first->x.AskPosition(World::get()->cell_size, false);
    103108        first->type = periode->AskElement();  // give type
    104109        mol->AddAtom(first);  // add to molecule
     
    109114        valid = true;
    110115        do {
    111           if (!valid) Log() << Verbose(0) << "Resulting position out of cell." << endl;
    112           Log() << Verbose(0) << "Enter reference coordinates." << endl;
    113           x.AskPosition(mol->cell_size, true);
    114           Log() << Verbose(0) << "Enter relative coordinates." << endl;
    115           first->x.AskPosition(mol->cell_size, false);
     116          if (!valid) DoeLog(2) && (eLog()<< Verbose(2) << "Resulting position out of cell." << endl);
     117          cout << Verbose(0) << "Enter reference coordinates." << endl;
     118          x.AskPosition(World::get()->cell_size, true);
     119          cout << Verbose(0) << "Enter relative coordinates." << endl;
     120          first->x.AskPosition(World::get()->cell_size, false);
    116121          first->x.AddVector((const Vector *)&x);
    117           Log() << Verbose(0) << "\n";
     122          cout << Verbose(0) << "\n";
    118123        } while (!(valid = mol->CheckBounds((const Vector *)&first->x)));
    119124        first->type = periode->AskElement();  // give type
     
    125130        valid = true;
    126131        do {
    127           if (!valid) Log() << Verbose(0) << "Resulting position out of cell." << endl;
     132          if (!valid) DoeLog(2) && (eLog()<< Verbose(2) << "Resulting position out of cell." << endl);
    128133          second = mol->AskAtom("Enter atom number: ");
    129           Log() << Verbose(0) << "Enter relative coordinates." << endl;
    130           first->x.AskPosition(mol->cell_size, false);
     134          DoLog(0) && (Log() << Verbose(0) << "Enter relative coordinates." << endl);
     135          first->x.AskPosition(World::get()->cell_size, false);
    131136          for (int i=NDIM;i--;) {
    132137            first->x.x[i] += second->x.x[i];
     
    142147        do {
    143148          if (!valid) {
    144             Log() << Verbose(0) << "Resulting coordinates out of cell - ";
    145             first->x.Output();
    146             Log() << Verbose(0) << endl;
     149            DoeLog(2) && (eLog()<< Verbose(2) << "Resulting coordinates out of cell - " << first->x << endl);
    147150          }
    148           Log() << Verbose(0) << "First, we need two atoms, the first atom is the central, while the second is the outer one." << endl;
     151          cout << Verbose(0) << "First, we need two atoms, the first atom is the central, while the second is the outer one." << endl;
    149152          second = mol->AskAtom("Enter central atom: ");
    150153          third = mol->AskAtom("Enter second atom (specifying the axis for first angle): ");
     
    157160          c *= M_PI/180.;
    158161          bound(&c, -M_PI, M_PI);
    159           Log() << Verbose(0) << "radius: " << a << "\t phi: " << b*180./M_PI << "\t theta: " << c*180./M_PI << endl;
     162          cout << Verbose(0) << "radius: " << a << "\t phi: " << b*180./M_PI << "\t theta: " << c*180./M_PI << endl;
    160163/*
    161164          second->Output(1,1,(ofstream *)&cout);
     
    169172
    170173          if (!z.SolveSystem(&x,&y,&n, b, c, a)) {
    171             Log() << Verbose(0) << "Failure solving self-dependent linear system!" << endl;
     174         coutg() << Verbose(0) << "Failure solving self-dependent linear system!" << endl;
    172175            continue;
    173176          }
    174           Log() << Verbose(0) << "resulting relative coordinates: ";
     177          DoLog(0) && (Log() << Verbose(0) << "resulting relative coordinates: ");
    175178          z.Output();
    176           Log() << Verbose(0) << endl;
     179          DoLog(0) && (Log() << Verbose(0) << endl);
    177180          */
    178181          // calc axis vector
     
    182185          Log() << Verbose(0) << "x: ",
    183186          x.Output();
    184           Log() << Verbose(0) << endl;
     187          DoLog(0) && (Log() << Verbose(0) << endl);
    185188          z.MakeNormalVector(&second->x,&third->x,&fourth->x);
    186189          Log() << Verbose(0) << "z: ",
    187190          z.Output();
    188           Log() << Verbose(0) << endl;
     191          DoLog(0) && (Log() << Verbose(0) << endl);
    189192          y.MakeNormalVector(&x,&z);
    190193          Log() << Verbose(0) << "y: ",
    191194          y.Output();
    192           Log() << Verbose(0) << endl;
     195          DoLog(0) && (Log() << Verbose(0) << endl);
    193196
    194197          // rotate vector around first angle
     
    197200          Log() << Verbose(0) << "Rotated vector: ",
    198201          first->x.Output();
    199           Log() << Verbose(0) << endl;
     202          DoLog(0) && (Log() << Verbose(0) << endl);
    200203          // remove the projection onto the rotation plane of the second angle
    201204          n.CopyVector(&y);
     
    203206          Log() << Verbose(0) << "N1: ",
    204207          n.Output();
    205           Log() << Verbose(0) << endl;
     208          DoLog(0) && (Log() << Verbose(0) << endl);
    206209          first->x.SubtractVector(&n);
    207210          Log() << Verbose(0) << "Subtracted vector: ",
    208211          first->x.Output();
    209           Log() << Verbose(0) << endl;
     212          DoLog(0) && (Log() << Verbose(0) << endl);
    210213          n.CopyVector(&z);
    211214          n.Scale(first->x.ScalarProduct(&z));
    212215          Log() << Verbose(0) << "N2: ",
    213216          n.Output();
    214           Log() << Verbose(0) << endl;
     217          DoLog(0) && (Log() << Verbose(0) << endl);
    215218          first->x.SubtractVector(&n);
    216219          Log() << Verbose(0) << "2nd subtracted vector: ",
    217220          first->x.Output();
    218           Log() << Verbose(0) << endl;
     221          DoLog(0) && (Log() << Verbose(0) << endl);
    219222
    220223          // rotate another vector around second angle
     
    223226          Log() << Verbose(0) << "2nd Rotated vector: ",
    224227          n.Output();
    225           Log() << Verbose(0) << endl;
     228          DoLog(0) && (Log() << Verbose(0) << endl);
    226229
    227230          // add the two linear independent vectors
     
    231234          first->x.AddVector(&second->x);
    232235
    233           Log() << Verbose(0) << "resulting coordinates: ";
     236          DoLog(0) && (Log() << Verbose(0) << "resulting coordinates: ");
    234237          first->x.Output();
    235           Log() << Verbose(0) << endl;
     238          DoLog(0) && (Log() << Verbose(0) << endl);
    236239        } while (!(valid = mol->CheckBounds((const Vector *)&first->x)));
    237240        first->type = periode->AskElement();  // give type
     
    246249          atoms[i] = NULL;
    247250        int i=0, j=0;
    248         Log() << Verbose(0) << "Now we need at least three molecules.\n";
     251        cout << Verbose(0) << "Now we need at least three molecules.\n";
    249252        do {
    250           Log() << Verbose(0) << "Enter " << i+1 << "th atom: ";
     253          cout << Verbose(0) << "Enter " << i+1 << "th atom: ";
    251254          cin >> j;
    252255          if (j != -1) {
     
    263266        } else {
    264267          delete first;
    265           Log() << Verbose(0) << "Please enter at least two vectors!\n";
     268          cout << Verbose(0) << "Please enter at least two vectors!\n";
    266269        }
    267270        break;
     
    277280  char choice;  // menu choice char
    278281
    279   Log() << Verbose(0) << "===========CENTER ATOMS=========================" << endl;
    280   Log() << Verbose(0) << " a - on origin" << endl;
    281   Log() << Verbose(0) << " b - on center of gravity" << endl;
    282   Log() << Verbose(0) << " c - within box with additional boundary" << endl;
    283   Log() << Verbose(0) << " d - within given simulation box" << endl;
    284   Log() << Verbose(0) << "all else - go back" << endl;
    285   Log() << Verbose(0) << "===============================================" << endl;
    286   Log() << Verbose(0) << "INPUT: ";
     282  cout << Verbose(0) << "===========CENTER ATOMS=========================" << endl;
     283  cout << Verbose(0) << " a - on origin" << endl;
     284  cout << Verbose(0) << " b - on center of gravity" << endl;
     285  cout << Verbose(0) << " c - within box with additional boundary" << endl;
     286  cout << Verbose(0) << " d - within given simulation box" << endl;
     287  cout << Verbose(0) << "all else - go back" << endl;
     288  cout << Verbose(0) << "===============================================" << endl;
     289  cout << Verbose(0) << "INPUT: ";
    287290  cin >> choice;
    288291
    289292  switch (choice) {
    290293    default:
    291       Log() << Verbose(0) << "Not a valid choice." << endl;
     294      cout << Verbose(0) << "Not a valid choice." << endl;
    292295      break;
    293296    case 'a':
    294       Log() << Verbose(0) << "Centering atoms in config file on origin." << endl;
     297      cout << Verbose(0) << "Centering atoms in config file on origin." << endl;
    295298      mol->CenterOrigin();
    296299      break;
    297300    case 'b':
    298       Log() << Verbose(0) << "Centering atoms in config file on center of gravity." << endl;
     301      cout << Verbose(0) << "Centering atoms in config file on center of gravity." << endl;
    299302      mol->CenterPeriodic();
    300303      break;
    301304    case 'c':
    302       Log() << Verbose(0) << "Centering atoms in config file within given additional boundary." << endl;
     305      cout << Verbose(0) << "Centering atoms in config file within given additional boundary." << endl;
    303306      for (int i=0;i<NDIM;i++) {
    304         Log() << Verbose(0) << "Enter axis " << i << " boundary: ";
     307        cout << Verbose(0) << "Enter axis " << i << " boundary: ";
    305308        cin >> y.x[i];
    306309      }
     
    313316      break;
    314317    case 'd':
    315       Log() << Verbose(1) << "Centering atoms in config file within given simulation box." << endl;
     318      cout << Verbose(1) << "Centering atoms in config file within given simulation box." << endl;
    316319      for (int i=0;i<NDIM;i++) {
    317         Log() << Verbose(0) << "Enter axis " << i << " boundary: ";
     320        cout << Verbose(0) << "Enter axis " << i << " boundary: ";
    318321        cin >> x.x[i];
    319322      }
     
    336339  char choice;  // menu choice char
    337340
    338   Log() << Verbose(0) << "===========ALIGN ATOMS=========================" << endl;
    339   Log() << Verbose(0) << " a - state three atoms defining align plane" << endl;
    340   Log() << Verbose(0) << " b - state alignment vector" << endl;
    341   Log() << Verbose(0) << " c - state two atoms in alignment direction" << endl;
    342   Log() << Verbose(0) << " d - align automatically by least square fit" << endl;
    343   Log() << Verbose(0) << "all else - go back" << endl;
    344   Log() << Verbose(0) << "===============================================" << endl;
    345   Log() << Verbose(0) << "INPUT: ";
     341  cout << Verbose(0) << "===========ALIGN ATOMS=========================" << endl;
     342  cout << Verbose(0) << " a - state three atoms defining align plane" << endl;
     343  cout << Verbose(0) << " b - state alignment vector" << endl;
     344  cout << Verbose(0) << " c - state two atoms in alignment direction" << endl;
     345  cout << Verbose(0) << " d - align automatically by least square fit" << endl;
     346  cout << Verbose(0) << "all else - go back" << endl;
     347  cout << Verbose(0) << "===============================================" << endl;
     348  cout << Verbose(0) << "INPUT: ";
    346349  cin >> choice;
    347350
     
    356359      break;
    357360    case 'b': // normal vector of mirror plane
    358       Log() << Verbose(0) << "Enter normal vector of mirror plane." << endl;
    359       n.AskPosition(mol->cell_size,0);
     361      cout << Verbose(0) << "Enter normal vector of mirror plane." << endl;
     362      n.AskPosition(World::get()->cell_size,0);
    360363      n.Normalize();
    361364      break;
     
    376379        fscanf(stdin, "%3s", shorthand);
    377380      } while ((param.type = periode->FindElement(shorthand)) == NULL);
    378       Log() << Verbose(0) << "Element is " << param.type->name << endl;
     381      cout << Verbose(0) << "Element is " << param.type->name << endl;
    379382      mol->GetAlignvector(&param);
    380383      for (int i=NDIM;i--;) {
     
    383386      }
    384387      gsl_vector_free(param.x);
    385       Log() << Verbose(0) << "Offset vector: ";
     388      cout << Verbose(0) << "Offset vector: ";
    386389      x.Output();
    387       Log() << Verbose(0) << endl;
     390      DoLog(0) && (Log() << Verbose(0) << endl);
    388391      n.Normalize();
    389392      break;
    390393  };
    391   Log() << Verbose(0) << "Alignment vector: ";
     394  DoLog(0) && (Log() << Verbose(0) << "Alignment vector: ");
    392395  n.Output();
    393   Log() << Verbose(0) << endl;
     396  DoLog(0) && (Log() << Verbose(0) << endl);
    394397  mol->Align(&n);
    395398};
     
    404407  char choice;  // menu choice char
    405408
    406   Log() << Verbose(0) << "===========MIRROR ATOMS=========================" << endl;
    407   Log() << Verbose(0) << " a - state three atoms defining mirror plane" << endl;
    408   Log() << Verbose(0) << " b - state normal vector of mirror plane" << endl;
    409   Log() << Verbose(0) << " c - state two atoms in normal direction" << endl;
    410   Log() << Verbose(0) << "all else - go back" << endl;
    411   Log() << Verbose(0) << "===============================================" << endl;
    412   Log() << Verbose(0) << "INPUT: ";
     409  DoLog(0) && (Log() << Verbose(0) << "===========MIRROR ATOMS=========================" << endl);
     410  DoLog(0) && (Log() << Verbose(0) << " a - state three atoms defining mirror plane" << endl);
     411  DoLog(0) && (Log() << Verbose(0) << " b - state normal vector of mirror plane" << endl);
     412  DoLog(0) && (Log() << Verbose(0) << " c - state two atoms in normal direction" << endl);
     413  DoLog(0) && (Log() << Verbose(0) << "all else - go back" << endl);
     414  DoLog(0) && (Log() << Verbose(0) << "===============================================" << endl);
     415  DoLog(0) && (Log() << Verbose(0) << "INPUT: ");
    413416  cin >> choice;
    414417
     
    423426      break;
    424427    case 'b': // normal vector of mirror plane
    425       Log() << Verbose(0) << "Enter normal vector of mirror plane." << endl;
    426       n.AskPosition(mol->cell_size,0);
     428      DoLog(0) && (Log() << Verbose(0) << "Enter normal vector of mirror plane." << endl);
     429      n.AskPosition(World::get()->cell_size,0);
    427430      n.Normalize();
    428431      break;
     
    436439      break;
    437440  };
    438   Log() << Verbose(0) << "Normal vector: ";
     441  DoLog(0) && (Log() << Verbose(0) << "Normal vector: ");
    439442  n.Output();
    440   Log() << Verbose(0) << endl;
     443  DoLog(0) && (Log() << Verbose(0) << endl);
    441444  mol->Mirror((const Vector *)&n);
    442445};
     
    452455  char choice;  // menu choice char
    453456
    454   Log() << Verbose(0) << "===========REMOVE ATOMS=========================" << endl;
    455   Log() << Verbose(0) << " a - state atom for removal by number" << endl;
    456   Log() << Verbose(0) << " b - keep only in radius around atom" << endl;
    457   Log() << Verbose(0) << " c - remove this with one axis greater value" << endl;
    458   Log() << Verbose(0) << "all else - go back" << endl;
    459   Log() << Verbose(0) << "===============================================" << endl;
    460   Log() << Verbose(0) << "INPUT: ";
     457  DoLog(0) && (Log() << Verbose(0) << "===========REMOVE ATOMS=========================" << endl);
     458  DoLog(0) && (Log() << Verbose(0) << " a - state atom for removal by number" << endl);
     459  DoLog(0) && (Log() << Verbose(0) << " b - keep only in radius around atom" << endl);
     460  DoLog(0) && (Log() << Verbose(0) << " c - remove this with one axis greater value" << endl);
     461  DoLog(0) && (Log() << Verbose(0) << "all else - go back" << endl);
     462  DoLog(0) && (Log() << Verbose(0) << "===============================================" << endl);
     463  DoLog(0) && (Log() << Verbose(0) << "INPUT: ");
    461464  cin >> choice;
    462465
     
    465468    case 'a':
    466469      if (mol->RemoveAtom(mol->AskAtom("Enter number of atom within molecule: ")))
    467         Log() << Verbose(1) << "Atom removed." << endl;
     470        DoLog(1) && (Log() << Verbose(1) << "Atom removed." << endl);
    468471      else
    469         Log() << Verbose(1) << "Atom not found." << endl;
     472        DoLog(1) && (Log() << Verbose(1) << "Atom not found." << endl);
    470473      break;
    471474    case 'b':
    472475      second = mol->AskAtom("Enter number of atom as reference point: ");
    473       Log() << Verbose(0) << "Enter radius: ";
     476      DoLog(0) && (Log() << Verbose(0) << "Enter radius: ");
    474477      cin >> tmp1;
    475478      first = mol->start;
     
    483486      break;
    484487    case 'c':
    485       Log() << Verbose(0) << "Which axis is it: ";
     488      DoLog(0) && (Log() << Verbose(0) << "Which axis is it: ");
    486489      cin >> axis;
    487       Log() << Verbose(0) << "Lower boundary: ";
     490      DoLog(0) && (Log() << Verbose(0) << "Lower boundary: ");
    488491      cin >> tmp1;
    489       Log() << Verbose(0) << "Upper boundary: ";
     492      DoLog(0) && (Log() << Verbose(0) << "Upper boundary: ");
    490493      cin >> tmp2;
    491494      first = mol->start;
     
    517520  char choice;  // menu choice char
    518521
    519   Log() << Verbose(0) << "===========MEASURE ATOMS=========================" << endl;
    520   Log() << Verbose(0) << " a - calculate bond length between one atom and all others" << endl;
    521   Log() << Verbose(0) << " b - calculate bond length between two atoms" << endl;
    522   Log() << Verbose(0) << " c - calculate bond angle" << endl;
    523   Log() << Verbose(0) << " d - calculate principal axis of the system" << endl;
    524   Log() << Verbose(0) << " e - calculate volume of the convex envelope" << endl;
    525   Log() << Verbose(0) << " f - calculate temperature from current velocity" << endl;
    526   Log() << Verbose(0) << " g - output all temperatures per step from velocities" << endl;
    527   Log() << Verbose(0) << "all else - go back" << endl;
    528   Log() << Verbose(0) << "===============================================" << endl;
    529   Log() << Verbose(0) << "INPUT: ";
     522  DoLog(0) && (Log() << Verbose(0) << "===========MEASURE ATOMS=========================" << endl);
     523  DoLog(0) && (Log() << Verbose(0) << " a - calculate bond length between one atom and all others" << endl);
     524  DoLog(0) && (Log() << Verbose(0) << " b - calculate bond length between two atoms" << endl);
     525  DoLog(0) && (Log() << Verbose(0) << " c - calculate bond angle" << endl);
     526  DoLog(0) && (Log() << Verbose(0) << " d - calculate principal axis of the system" << endl);
     527  DoLog(0) && (Log() << Verbose(0) << " e - calculate volume of the convex envelope" << endl);
     528  DoLog(0) && (Log() << Verbose(0) << " f - calculate temperature from current velocity" << endl);
     529  DoLog(0) && (Log() << Verbose(0) << " g - output all temperatures per step from velocities" << endl);
     530  DoLog(0) && (Log() << Verbose(0) << "all else - go back" << endl);
     531  DoLog(0) && (Log() << Verbose(0) << "===============================================" << endl);
     532  DoLog(0) && (Log() << Verbose(0) << "INPUT: ");
    530533  cin >> choice;
    531534
    532535  switch(choice) {
    533536    default:
    534       Log() << Verbose(1) << "Not a valid choice." << endl;
     537      DoLog(1) && (Log() << Verbose(1) << "Not a valid choice." << endl);
    535538      break;
    536539    case 'a':
     
    564567      x.SubtractVector((const Vector *)&second->x);
    565568      tmp1 = x.Norm();
    566       Log() << Verbose(1) << "Distance vector is ";
     569      DoLog(1) && (Log() << Verbose(1) << "Distance vector is ");
    567570      x.Output();
    568       Log() << Verbose(0) << "." << endl << "Norm of distance is " << tmp1 << "." << endl;
     571      DoLog(0) && (Log() << Verbose(0) << "." << endl << "Norm of distance is " << tmp1 << "." << endl);
    569572      break;
    570573
    571574    case 'c':
    572       Log() << Verbose(0) << "Evaluating bond angle between three - first, central, last - atoms." << endl;
     575      DoLog(0) && (Log() << Verbose(0) << "Evaluating bond angle between three - first, central, last - atoms." << endl);
    573576      first = mol->AskAtom("Enter first atom: ");
    574577      second = mol->AskAtom("Enter central atom: ");
     
    579582      y.CopyVector((const Vector *)&third->x);
    580583      y.SubtractVector((const Vector *)&second->x);
    581       Log() << Verbose(0) << "Bond angle between first atom Nr." << first->nr << ", central atom Nr." << second->nr << " and last atom Nr." << third->nr << ": ";
    582       Log() << Verbose(0) << (acos(x.ScalarProduct((const Vector *)&y)/(y.Norm()*x.Norm()))/M_PI*180.) << " degrees" << endl;
     584      DoLog(0) && (Log() << Verbose(0) << "Bond angle between first atom Nr." << first->nr << ", central atom Nr." << second->nr << " and last atom Nr." << third->nr << ": ");
     585      DoLog(0) && (Log() << Verbose(0) << (acos(x.ScalarProduct((const Vector *)&y)/(y.Norm()*x.Norm()))/M_PI*180.) << " degrees" << endl);
    583586      break;
    584587    case 'd':
    585       Log() << Verbose(0) << "Evaluating prinicipal axis." << endl;
    586       Log() << Verbose(0) << "Shall we rotate? [0/1]: ";
     588      DoLog(0) && (Log() << Verbose(0) << "Evaluating prinicipal axis." << endl);
     589      DoLog(0) && (Log() << Verbose(0) << "Shall we rotate? [0/1]: ");
    587590      cin >> Z;
    588591      if ((Z >=0) && (Z <=1))
     
    593596    case 'e':
    594597      {
    595         Log() << Verbose(0) << "Evaluating volume of the convex envelope.";
     598        DoLog(0) && (Log() << Verbose(0) << "Evaluating volume of the convex envelope.");
    596599        class Tesselation *TesselStruct = NULL;
    597600        const LinkedCell *LCList = NULL;
     
    599602        FindConvexBorder(mol, TesselStruct, LCList, NULL);
    600603        double clustervolume = VolumeOfConvexEnvelope(TesselStruct, configuration);
    601         Log() << Verbose(0) << "The tesselated surface area is " << clustervolume << "." << endl;\
     604        DoLog(0) && (Log() << Verbose(0) << "The tesselated surface area is " << clustervolume << "." << endl);\
    602605        delete(LCList);
    603606        delete(TesselStruct);
     
    610613      {
    611614        char filename[255];
    612         Log() << Verbose(0) << "Please enter filename: " << endl;
     615        DoLog(0) && (Log() << Verbose(0) << "Please enter filename: " << endl);
    613616        cin >> filename;
    614         Log() << Verbose(1) << "Storing temperatures in " << filename << "." << endl;
     617        DoLog(1) && (Log() << Verbose(1) << "Storing temperatures in " << filename << "." << endl);
    615618        ofstream *output = new ofstream(filename, ios::trunc);
    616619        if (!mol->OutputTemperatureFromTrajectories(output, 0, mol->MDSteps))
    617           Log() << Verbose(2) << "File could not be written." << endl;
     620          DoLog(2) && (Log() << Verbose(2) << "File could not be written." << endl);
    618621        else
    619           Log() << Verbose(2) << "File stored." << endl;
     622          DoLog(2) && (Log() << Verbose(2) << "File stored." << endl);
    620623        output->close();
    621624        delete(output);
     
    634637  clock_t start, end;
    635638
    636   Log() << Verbose(0) << "Fragmenting molecule with current connection matrix ..." << endl;
    637   Log() << Verbose(0) << "What's the desired bond order: ";
     639  DoLog(0) && (Log() << Verbose(0) << "Fragmenting molecule with current connection matrix ..." << endl);
     640  DoLog(0) && (Log() << Verbose(0) << "What's the desired bond order: ");
    638641  cin >> Order1;
    639642  if (mol->first->next != mol->last) {  // there are bonds
     
    641644    mol->FragmentMolecule(Order1, configuration);
    642645    end = clock();
    643     Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl;
     646    DoLog(0) && (Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl);
    644647  } else
    645     Log() << Verbose(0) << "Connection matrix has not yet been generated!" << endl;
     648    DoLog(0) && (Log() << Verbose(0) << "Connection matrix has not yet been generated!" << endl);
    646649};
    647650
     
    654657static void ManipulateAtoms(periodentafel *periode, MoleculeListClass *molecules, config *configuration)
    655658{
    656   atom *first, *second;
     659  atom *first, *second, *third;
    657660  molecule *mol = NULL;
    658661  Vector x,y,z,n; // coordinates for absolute point in cell volume
     
    662665  bool valid;
    663666
    664   Log() << Verbose(0) << "=========MANIPULATE ATOMS======================" << endl;
    665   Log() << Verbose(0) << "a - add an atom" << endl;
    666   Log() << Verbose(0) << "r - remove an atom" << endl;
    667   Log() << Verbose(0) << "b - scale a bond between atoms" << endl;
    668   Log() << Verbose(0) << "u - change an atoms element" << endl;
    669   Log() << Verbose(0) << "l - measure lengths, angles, ... for an atom" << endl;
    670   Log() << Verbose(0) << "all else - go back" << endl;
    671   Log() << Verbose(0) << "===============================================" << endl;
     667  DoLog(0) && (Log() << Verbose(0) << "=========MANIPULATE ATOMS======================" << endl);
     668  DoLog(0) && (Log() << Verbose(0) << "a - add an atom" << endl);
     669  DoLog(0) && (Log() << Verbose(0) << "r - remove an atom" << endl);
     670  DoLog(0) && (Log() << Verbose(0) << "b - scale a bond between atoms" << endl);
     671  DoLog(0) && (Log() << Verbose(0) << "t - turn an atom round another bond" << endl);
     672  DoLog(0) && (Log() << Verbose(0) << "u - change an atoms element" << endl);
     673  DoLog(0) && (Log() << Verbose(0) << "l - measure lengths, angles, ... for an atom" << endl);
     674  DoLog(0) && (Log() << Verbose(0) << "all else - go back" << endl);
     675  DoLog(0) && (Log() << Verbose(0) << "===============================================" << endl);
    672676  if (molecules->NumberOfActiveMolecules() > 1)
    673     Log() << Verbose(0) << "WARNING: There is more than one molecule active! Atoms will be added to each." << endl;
    674   Log() << Verbose(0) << "INPUT: ";
     677    DoeLog(2) && (eLog()<< Verbose(2) << "There is more than one molecule active! Atoms will be added to each." << endl);
     678  DoLog(0) && (Log() << Verbose(0) << "INPUT: ");
    675679  cin >> choice;
    676680
    677681  switch (choice) {
    678682    default:
    679       Log() << Verbose(0) << "Not a valid choice." << endl;
     683      DoLog(0) && (Log() << Verbose(0) << "Not a valid choice." << endl);
    680684      break;
    681685
     
    684688        if ((*ListRunner)->ActiveFlag) {
    685689        mol = *ListRunner;
    686         Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
     690        DoLog(0) && (Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl);
    687691        AddAtoms(periode, mol);
    688692      }
     
    693697        if ((*ListRunner)->ActiveFlag) {
    694698        mol = *ListRunner;
    695         Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
    696         Log() << Verbose(0) << "Scaling bond length between two atoms." << endl;
     699        DoLog(0) && (Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl);
     700        DoLog(0) && (Log() << Verbose(0) << "Scaling bond length between two atoms." << endl);
    697701        first = mol->AskAtom("Enter first (fixed) atom: ");
    698702        second = mol->AskAtom("Enter second (shifting) atom: ");
     
    701705          minBond += (first->x.x[i]-second->x.x[i])*(first->x.x[i] - second->x.x[i]);
    702706        minBond = sqrt(minBond);
    703         Log() << Verbose(0) << "Current Bond length between " << first->type->name << " Atom " << first->nr << " and " << second->type->name << " Atom " << second->nr << ": " << minBond << " a.u." << endl;
    704         Log() << Verbose(0) << "Enter new bond length [a.u.]: ";
     707        DoLog(0) && (Log() << Verbose(0) << "Current Bond length between " << first->type->name << " Atom " << first->nr << " and " << second->type->name << " Atom " << second->nr << ": " << minBond << " a.u." << endl);
     708        DoLog(0) && (Log() << Verbose(0) << "Enter new bond length [a.u.]: ");
    705709        cin >> bond;
    706710        for (int i=NDIM;i--;) {
     
    716720        if ((*ListRunner)->ActiveFlag) {
    717721        mol = *ListRunner;
    718         Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
    719        Log() << Verbose(0) << "Angstroem -> Bohrradius: 1.8897261\t\tBohrradius -> Angstroem: 0.52917721" << endl;
    720        Log() << Verbose(0) << "Enter three factors: ";
     722        DoLog(0) && (Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl);
     723       DoLog(0) && (Log() << Verbose(0) << "Angstroem -> Bohrradius: 1.8897261\t\tBohrradius -> Angstroem: 0.52917721" << endl);
     724       DoLog(0) && (Log() << Verbose(0) << "Enter three factors: ");
    721725       factor = new double[NDIM];
    722726       cin >> factor[0];
     
    733737        if ((*ListRunner)->ActiveFlag) {
    734738        mol = *ListRunner;
    735         Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
     739        DoLog(0) && (Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl);
    736740        MeasureAtoms(periode, mol, configuration);
    737741      }
     
    742746        if ((*ListRunner)->ActiveFlag) {
    743747        mol = *ListRunner;
    744         Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
     748        DoLog(0) && (Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl);
    745749        RemoveAtoms(mol);
    746750      }
     751      break;
     752
     753    case 't': // turn/rotate atom
     754      for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     755        if ((*ListRunner)->ActiveFlag) {
     756          mol = *ListRunner;
     757          DoLog(0) && (Log() << Verbose(0) << "Turning atom around another bond - first is atom to turn, second (central) and third specify bond" << endl);
     758          first = mol->AskAtom("Enter turning atom: ");
     759          second = mol->AskAtom("Enter central atom: ");
     760          third  = mol->AskAtom("Enter bond atom: ");
     761          cout << Verbose(0) << "Enter new angle in degrees: ";
     762          double tmp = 0.;
     763          cin >> tmp;
     764          // calculate old angle
     765          x.CopyVector((const Vector *)&first->x);
     766          x.SubtractVector((const Vector *)&second->x);
     767          y.CopyVector((const Vector *)&third->x);
     768          y.SubtractVector((const Vector *)&second->x);
     769          double alpha = (acos(x.ScalarProduct((const Vector *)&y)/(y.Norm()*x.Norm()))/M_PI*180.);
     770          cout << Verbose(0) << "Bond angle between first atom Nr." << first->nr << ", central atom Nr." << second->nr << " and last atom Nr." << third->nr << ": ";
     771          cout << Verbose(0) << alpha << " degrees" << endl;
     772          // rotate
     773          z.MakeNormalVector(&x,&y);
     774          x.RotateVector(&z,(alpha-tmp)*M_PI/180.);
     775          x.AddVector(&second->x);
     776          first->x.CopyVector(&x);
     777          // check new angle
     778          x.CopyVector((const Vector *)&first->x);
     779          x.SubtractVector((const Vector *)&second->x);
     780          alpha = (acos(x.ScalarProduct((const Vector *)&y)/(y.Norm()*x.Norm()))/M_PI*180.);
     781          cout << Verbose(0) << "new Bond angle between first atom Nr." << first->nr << ", central atom Nr." << second->nr << " and last atom Nr." << third->nr << ": ";
     782          cout << Verbose(0) << alpha << " degrees" << endl;
     783        }
    747784      break;
    748785
     
    752789        int Z;
    753790        mol = *ListRunner;
    754         Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
     791        DoLog(0) && (Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl);
    755792        first = NULL;
    756793        do {
    757           Log() << Verbose(0) << "Change the element of which atom: ";
     794          DoLog(0) && (Log() << Verbose(0) << "Change the element of which atom: ");
    758795          cin >> Z;
    759796        } while ((first = mol->FindAtom(Z)) == NULL);
    760         Log() << Verbose(0) << "New element by atomic number Z: ";
     797        DoLog(0) && (Log() << Verbose(0) << "New element by atomic number Z: ");
    761798        cin >> Z;
    762799        first->type = periode->FindElement(Z);
    763         Log() << Verbose(0) << "Atom " << first->nr << "'s element is " << first->type->name << "." << endl;
     800        DoLog(0) && (Log() << Verbose(0) << "Atom " << first->nr << "'s element is " << first->type->name << "." << endl);
    764801      }
    765802      break;
     
    782819  MoleculeLeafClass *Subgraphs = NULL;
    783820
    784   Log() << Verbose(0) << "=========MANIPULATE GLOBALLY===================" << endl;
    785   Log() << Verbose(0) << "c - scale by unit transformation" << endl;
    786   Log() << Verbose(0) << "d - duplicate molecule/periodic cell" << endl;
    787   Log() << Verbose(0) << "f - fragment molecule many-body bond order style" << endl;
    788   Log() << Verbose(0) << "g - center atoms in box" << endl;
    789   Log() << Verbose(0) << "i - realign molecule" << endl;
    790   Log() << Verbose(0) << "m - mirror all molecules" << endl;
    791   Log() << Verbose(0) << "o - create connection matrix" << endl;
    792   Log() << Verbose(0) << "t - translate molecule by vector" << endl;
    793   Log() << Verbose(0) << "all else - go back" << endl;
    794   Log() << Verbose(0) << "===============================================" << endl;
     821  DoLog(0) && (Log() << Verbose(0) << "=========MANIPULATE GLOBALLY===================" << endl);
     822  DoLog(0) && (Log() << Verbose(0) << "c - scale by unit transformation" << endl);
     823  DoLog(0) && (Log() << Verbose(0) << "d - duplicate molecule/periodic cell" << endl);
     824  DoLog(0) && (Log() << Verbose(0) << "f - fragment molecule many-body bond order style" << endl);
     825  DoLog(0) && (Log() << Verbose(0) << "g - center atoms in box" << endl);
     826  DoLog(0) && (Log() << Verbose(0) << "i - realign molecule" << endl);
     827  DoLog(0) && (Log() << Verbose(0) << "m - mirror all molecules" << endl);
     828  DoLog(0) && (Log() << Verbose(0) << "o - create connection matrix" << endl);
     829  DoLog(0) && (Log() << Verbose(0) << "t - translate molecule by vector" << endl);
     830  DoLog(0) && (Log() << Verbose(0) << "all else - go back" << endl);
     831  DoLog(0) && (Log() << Verbose(0) << "===============================================" << endl);
    795832  if (molecules->NumberOfActiveMolecules() > 1)
    796     Log() << Verbose(0) << "WARNING: There is more than one molecule active! Atoms will be added to each." << endl;
    797   Log() << Verbose(0) << "INPUT: ";
     833    DoeLog(2) && (eLog()<< Verbose(2) << "There is more than one molecule active! Atoms will be added to each." << endl);
     834  DoLog(0) && (Log() << Verbose(0) << "INPUT: ");
    798835  cin >> choice;
    799836
    800837  switch (choice) {
    801838    default:
    802       Log() << Verbose(0) << "Not a valid choice." << endl;
     839      DoLog(0) && (Log() << Verbose(0) << "Not a valid choice." << endl);
    803840      break;
    804841
     
    807844        if ((*ListRunner)->ActiveFlag) {
    808845        mol = *ListRunner;
    809         Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
    810         Log() << Verbose(0) << "State the axis [(+-)123]: ";
     846        DoLog(0) && (Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl);
     847        DoLog(0) && (Log() << Verbose(0) << "State the axis [(+-)123]: ");
    811848        cin >> axis;
    812         Log() << Verbose(0) << "State the factor: ";
     849        DoLog(0) && (Log() << Verbose(0) << "State the factor: ");
    813850        cin >> faktor;
    814851
     
    827864          }
    828865          if (count != j)
    829             Log() << Verbose(0) << "ERROR: AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!" << endl;
     866            DoeLog(1) && (eLog()<< Verbose(1) << "AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!" << endl);
    830867          x.Zero();
    831868          y.Zero();
    832           y.x[abs(axis)-1] = mol->cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] * abs(axis)/axis; // last term is for sign, first is for magnitude
     869          y.x[abs(axis)-1] = World::get()->cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] * abs(axis)/axis; // last term is for sign, first is for magnitude
    833870          for (int i=1;i<faktor;i++) {  // then add this list with respective translation factor times
    834871            x.AddVector(&y); // per factor one cell width further
     
    853890            mol->Translate(&x);
    854891          }
    855           mol->cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] *= faktor;
     892          World::get()->cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] *= faktor;
    856893        }
    857894      }
     
    866903        if ((*ListRunner)->ActiveFlag) {
    867904        mol = *ListRunner;
    868         Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
     905        DoLog(0) && (Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl);
    869906        CenterAtoms(mol);
    870907      }
     
    875912        if ((*ListRunner)->ActiveFlag) {
    876913        mol = *ListRunner;
    877         Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
     914        DoLog(0) && (Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl);
    878915        AlignAtoms(periode, mol);
    879916      }
     
    884921        if ((*ListRunner)->ActiveFlag) {
    885922        mol = *ListRunner;
    886         Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
     923        DoLog(0) && (Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl);
    887924        MirrorAtoms(mol);
    888925      }
     
    895932          double bonddistance;
    896933          clock_t start,end;
    897           Log() << Verbose(0) << "What's the maximum bond distance: ";
     934          DoLog(0) && (Log() << Verbose(0) << "What's the maximum bond distance: ");
    898935          cin >> bonddistance;
    899936          start = clock();
    900937          mol->CreateAdjacencyList(bonddistance, configuration->GetIsAngstroem(), &BondGraph::CovalentMinMaxDistance, NULL);
    901938          end = clock();
    902           Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl;
     939          DoLog(0) && (Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl);
    903940        }
    904941      break;
     
    908945        if ((*ListRunner)->ActiveFlag) {
    909946        mol = *ListRunner;
    910         Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
    911         Log() << Verbose(0) << "Enter translation vector." << endl;
    912         x.AskPosition(mol->cell_size,0);
     947        DoLog(0) && (Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl);
     948        DoLog(0) && (Log() << Verbose(0) << "Enter translation vector." << endl);
     949        x.AskPosition(World::get()->cell_size,0);
    913950        mol->Center.AddVector((const Vector *)&x);
    914951     }
     
    937974  molecule *mol = NULL;
    938975
    939   Log() << Verbose(0) << "==========EDIT MOLECULES=====================" << endl;
    940   Log() << Verbose(0) << "c - create new molecule" << endl;
    941   Log() << Verbose(0) << "l - load molecule from xyz file" << endl;
    942   Log() << Verbose(0) << "n - change molecule's name" << endl;
    943   Log() << Verbose(0) << "N - give molecules filename" << endl;
    944   Log() << Verbose(0) << "p - parse atoms in xyz file into molecule" << endl;
    945   Log() << Verbose(0) << "r - remove a molecule" << endl;
    946   Log() << Verbose(0) << "all else - go back" << endl;
    947   Log() << Verbose(0) << "===============================================" << endl;
    948   Log() << Verbose(0) << "INPUT: ";
     976  DoLog(0) && (Log() << Verbose(0) << "==========EDIT MOLECULES=====================" << endl);
     977  DoLog(0) && (Log() << Verbose(0) << "c - create new molecule" << endl);
     978  DoLog(0) && (Log() << Verbose(0) << "l - load molecule from xyz file" << endl);
     979  DoLog(0) && (Log() << Verbose(0) << "n - change molecule's name" << endl);
     980  DoLog(0) && (Log() << Verbose(0) << "N - give molecules filename" << endl);
     981  DoLog(0) && (Log() << Verbose(0) << "p - parse atoms in xyz file into molecule" << endl);
     982  DoLog(0) && (Log() << Verbose(0) << "r - remove a molecule" << endl);
     983  DoLog(0) && (Log() << Verbose(0) << "all else - go back" << endl);
     984  DoLog(0) && (Log() << Verbose(0) << "===============================================" << endl);
     985  DoLog(0) && (Log() << Verbose(0) << "INPUT: ");
    949986  cin >> choice;
    950987
    951988  switch (choice) {
    952989    default:
    953       Log() << Verbose(0) << "Not a valid choice." << endl;
     990      DoLog(0) && (Log() << Verbose(0) << "Not a valid choice." << endl);
    954991      break;
    955992    case 'c':
     
    961998      {
    962999        char filename[MAXSTRINGSIZE];
    963         Log() << Verbose(0) << "Format should be XYZ with: ShorthandOfElement\tX\tY\tZ" << endl;
     1000        DoLog(0) && (Log() << Verbose(0) << "Format should be XYZ with: ShorthandOfElement\tX\tY\tZ" << endl);
    9641001        mol = new molecule(periode);
    9651002        do {
    966           Log() << Verbose(0) << "Enter file name: ";
     1003          DoLog(0) && (Log() << Verbose(0) << "Enter file name: ");
    9671004          cin >> filename;
    9681005        } while (!mol->AddXYZFile(filename));
     
    9701007        // center at set box dimensions
    9711008        mol->CenterEdge(&center);
    972         mol->cell_size[0] = center.x[0];
    973         mol->cell_size[1] = 0;
    974         mol->cell_size[2] = center.x[1];
    975         mol->cell_size[3] = 0;
    976         mol->cell_size[4] = 0;
    977         mol->cell_size[5] = center.x[2];
     1009        double * const cell_size = World::get()->cell_size;
     1010        cell_size[0] = center.x[0];
     1011        cell_size[1] = 0;
     1012        cell_size[2] = center.x[1];
     1013        cell_size[3] = 0;
     1014        cell_size[4] = 0;
     1015        cell_size[5] = center.x[2];
    9781016        molecules->insert(mol);
    9791017      }
     
    9841022        char filename[MAXSTRINGSIZE];
    9851023        do {
    986           Log() << Verbose(0) << "Enter index of molecule: ";
     1024          DoLog(0) && (Log() << Verbose(0) << "Enter index of molecule: ");
    9871025          cin >> nr;
    9881026          mol = molecules->ReturnIndex(nr);
    9891027        } while (mol == NULL);
    990         Log() << Verbose(0) << "Enter name: ";
     1028        DoLog(0) && (Log() << Verbose(0) << "Enter name: ");
    9911029        cin >> filename;
    9921030        strcpy(mol->name, filename);
     
    9981036        char filename[MAXSTRINGSIZE];
    9991037        do {
    1000           Log() << Verbose(0) << "Enter index of molecule: ";
     1038          DoLog(0) && (Log() << Verbose(0) << "Enter index of molecule: ");
    10011039          cin >> nr;
    10021040          mol = molecules->ReturnIndex(nr);
    10031041        } while (mol == NULL);
    1004         Log() << Verbose(0) << "Enter name: ";
     1042        DoLog(0) && (Log() << Verbose(0) << "Enter name: ");
    10051043        cin >> filename;
    10061044        mol->SetNameFromFilename(filename);
     
    10131051        mol = NULL;
    10141052        do {
    1015           Log() << Verbose(0) << "Enter index of molecule: ";
     1053          DoLog(0) && (Log() << Verbose(0) << "Enter index of molecule: ");
    10161054          cin >> nr;
    10171055          mol = molecules->ReturnIndex(nr);
    10181056        } while (mol == NULL);
    1019         Log() << Verbose(0) << "Format should be XYZ with: ShorthandOfElement\tX\tY\tZ" << endl;
     1057        DoLog(0) && (Log() << Verbose(0) << "Format should be XYZ with: ShorthandOfElement\tX\tY\tZ" << endl);
    10201058        do {
    1021           Log() << Verbose(0) << "Enter file name: ";
     1059          DoLog(0) && (Log() << Verbose(0) << "Enter file name: ");
    10221060          cin >> filename;
    10231061        } while (!mol->AddXYZFile(filename));
     
    10271065
    10281066    case 'r':
    1029       Log() << Verbose(0) << "Enter index of molecule: ";
     1067      DoLog(0) && (Log() << Verbose(0) << "Enter index of molecule: ");
    10301068      cin >> nr;
    10311069      count = 1;
     
    10501088  char choice;  // menu choice char
    10511089
    1052   Log() << Verbose(0) << "===========MERGE MOLECULES=====================" << endl;
    1053   Log() << Verbose(0) << "a - simple add of one molecule to another" << endl;
    1054   Log() << Verbose(0) << "e - embedding merge of two molecules" << endl;
    1055   Log() << Verbose(0) << "m - multi-merge of all molecules" << endl;
    1056   Log() << Verbose(0) << "s - scatter merge of two molecules" << endl;
    1057   Log() << Verbose(0) << "t - simple merge of two molecules" << endl;
    1058   Log() << Verbose(0) << "all else - go back" << endl;
    1059   Log() << Verbose(0) << "===============================================" << endl;
    1060   Log() << Verbose(0) << "INPUT: ";
     1090  DoLog(0) && (Log() << Verbose(0) << "===========MERGE MOLECULES=====================" << endl);
     1091  DoLog(0) && (Log() << Verbose(0) << "a - simple add of one molecule to another" << endl);
     1092  DoLog(0) && (Log() << Verbose(0) << "b - count the number of bonds of two elements" << endl);
     1093  DoLog(0) && (Log() << Verbose(0) << "B - count the number of bonds of three elements " << endl);
     1094  DoLog(0) && (Log() << Verbose(0) << "e - embedding merge of two molecules" << endl);
     1095  DoLog(0) && (Log() << Verbose(0) << "h - count the number of hydrogen bonds" << endl);
     1096  DoLog(0) && (Log() << Verbose(0) << "b - count the number of hydrogen bonds" << endl);
     1097  DoLog(0) && (Log() << Verbose(0) << "m - multi-merge of all molecules" << endl);
     1098  DoLog(0) && (Log() << Verbose(0) << "s - scatter merge of two molecules" << endl);
     1099  DoLog(0) && (Log() << Verbose(0) << "t - simple merge of two molecules" << endl);
     1100  DoLog(0) && (Log() << Verbose(0) << "all else - go back" << endl);
     1101  DoLog(0) && (Log() << Verbose(0) << "===============================================" << endl);
     1102  DoLog(0) && (Log() << Verbose(0) << "INPUT: ");
    10611103  cin >> choice;
    10621104
    10631105  switch (choice) {
    10641106    default:
    1065       Log() << Verbose(0) << "Not a valid choice." << endl;
     1107      DoLog(0) && (Log() << Verbose(0) << "Not a valid choice." << endl);
    10661108      break;
    10671109
     
    10721114        {
    10731115          do {
    1074             Log() << Verbose(0) << "Enter index of destination molecule: ";
     1116            DoLog(0) && (Log() << Verbose(0) << "Enter index of destination molecule: ");
    10751117            cin >> dest;
    10761118            destmol = molecules->ReturnIndex(dest);
    10771119          } while ((destmol == NULL) && (dest != -1));
    10781120          do {
    1079             Log() << Verbose(0) << "Enter index of source molecule to add from: ";
     1121            DoLog(0) && (Log() << Verbose(0) << "Enter index of source molecule to add from: ");
    10801122            cin >> src;
    10811123            srcmol = molecules->ReturnIndex(src);
     
    10871129      break;
    10881130
     1131    case 'b':
     1132      {
     1133        const int nr = 2;
     1134        char *names[nr] = {"first", "second"};
     1135        int Z[nr];
     1136        element *elements[nr];
     1137        for (int i=0;i<nr;i++) {
     1138          Z[i] = 0;
     1139          do {
     1140            cout << "Enter " << names[i] << " element: ";
     1141            cin >> Z[i];
     1142          } while ((Z[i] <= 0) && (Z[i] > MAX_ELEMENTS));
     1143          elements[i] = periode->FindElement(Z[i]);
     1144        }
     1145        const int count = CountBondsOfTwo(molecules, elements[0], elements[1]);
     1146        cout << endl << "There are " << count << " ";
     1147        for (int i=0;i<nr;i++) {
     1148          if (i==0)
     1149            cout << elements[i]->symbol;
     1150          else
     1151            cout << "-" << elements[i]->symbol;
     1152        }
     1153        cout << " bonds." << endl;
     1154      }
     1155    break;
     1156
     1157    case 'B':
     1158      {
     1159        const int nr = 3;
     1160        char *names[nr] = {"first", "second", "third"};
     1161        int Z[nr];
     1162        element *elements[nr];
     1163        for (int i=0;i<nr;i++) {
     1164          Z[i] = 0;
     1165          do {
     1166            cout << "Enter " << names[i] << " element: ";
     1167            cin >> Z[i];
     1168          } while ((Z[i] <= 0) && (Z[i] > MAX_ELEMENTS));
     1169          elements[i] = periode->FindElement(Z[i]);
     1170        }
     1171        const int count = CountBondsOfThree(molecules, elements[0], elements[1], elements[2]);
     1172        cout << endl << "There are " << count << " ";
     1173        for (int i=0;i<nr;i++) {
     1174          if (i==0)
     1175            cout << elements[i]->symbol;
     1176          else
     1177            cout << "-" << elements[i]->symbol;
     1178        }
     1179        cout << " bonds." << endl;
     1180      }
     1181    break;
     1182
    10891183    case 'e':
    10901184      {
     
    10921186        molecule *srcmol = NULL, *destmol = NULL;
    10931187        do {
    1094           Log() << Verbose(0) << "Enter index of matrix molecule (the variable one): ";
     1188          DoLog(0) && (Log() << Verbose(0) << "Enter index of matrix molecule (the variable one): ");
    10951189          cin >> src;
    10961190          srcmol = molecules->ReturnIndex(src);
    10971191        } while ((srcmol == NULL) && (src != -1));
    10981192        do {
    1099           Log() << Verbose(0) << "Enter index of molecule to merge into (the fixed one): ";
     1193          DoLog(0) && (Log() << Verbose(0) << "Enter index of molecule to merge into (the fixed one): ");
    11001194          cin >> dest;
    11011195          destmol = molecules->ReturnIndex(dest);
     
    11061200      break;
    11071201
     1202    case 'h':
     1203      {
     1204        int Z;
     1205        cout << "Please enter interface element: ";
     1206        cin >> Z;
     1207        element * const InterfaceElement = periode->FindElement(Z);
     1208        cout << endl << "There are " << CountHydrogenBridgeBonds(molecules, InterfaceElement) << " hydrogen bridges with connections to " << (InterfaceElement != 0 ? InterfaceElement->name : "None") << "." << endl;
     1209      }
     1210      break;
     1211
    11081212    case 'm':
    11091213      {
     
    11111215        molecule *mol = NULL;
    11121216        do {
    1113           Log() << Verbose(0) << "Enter index of molecule to merge into: ";
     1217          DoLog(0) && (Log() << Verbose(0) << "Enter index of molecule to merge into: ");
    11141218          cin >> nr;
    11151219          mol = molecules->ReturnIndex(nr);
     
    11281232
    11291233    case 's':
    1130       Log() << Verbose(0) << "Not implemented yet." << endl;
     1234      DoLog(0) && (Log() << Verbose(0) << "Not implemented yet." << endl);
    11311235      break;
    11321236
     
    11371241        {
    11381242          do {
    1139             Log() << Verbose(0) << "Enter index of destination molecule: ";
     1243            DoLog(0) && (Log() << Verbose(0) << "Enter index of destination molecule: ");
    11401244            cin >> dest;
    11411245            destmol = molecules->ReturnIndex(dest);
    11421246          } while ((destmol == NULL) && (dest != -1));
    11431247          do {
    1144             Log() << Verbose(0) << "Enter index of source molecule to merge into: ";
     1248            DoLog(0) && (Log() << Verbose(0) << "Enter index of source molecule to merge into: ");
    11451249            cin >> src;
    11461250            srcmol = molecules->ReturnIndex(src);
     
    11711275    mol = (molecules->ListOfMolecules.front())->CopyMolecule();
    11721276  else {
    1173     eLog() << Verbose(0) << "I don't have anything to test on ... ";
     1277    DoeLog(0) && (eLog()<< Verbose(0) << "I don't have anything to test on ... ");
     1278    performCriticalExit();
    11741279    return;
    11751280  }
     
    11771282
    11781283  // generate some KeySets
    1179   Log() << Verbose(0) << "Generating KeySets." << endl;
     1284  DoLog(0) && (Log() << Verbose(0) << "Generating KeySets." << endl);
    11801285  KeySet TestSets[mol->AtomCount+1];
    11811286  i=1;
     
    11871292    i++;
    11881293  }
    1189   Log() << Verbose(0) << "Testing insertion of already present item in KeySets." << endl;
     1294  DoLog(0) && (Log() << Verbose(0) << "Testing insertion of already present item in KeySets." << endl);
    11901295  KeySetTestPair test;
    11911296  test = TestSets[mol->AtomCount-1].insert(Walker->nr);
    11921297  if (test.second) {
    1193     Log() << Verbose(1) << "Insertion worked?!" << endl;
     1298    DoLog(1) && (Log() << Verbose(1) << "Insertion worked?!" << endl);
    11941299  } else {
    1195     Log() << Verbose(1) << "Insertion rejected: Present object is " << (*test.first) << "." << endl;
     1300    DoLog(1) && (Log() << Verbose(1) << "Insertion rejected: Present object is " << (*test.first) << "." << endl);
    11961301  }
    11971302  TestSets[mol->AtomCount].insert(mol->end->previous->nr);
     
    11991304
    12001305  // constructing Graph structure
    1201   Log() << Verbose(0) << "Generating Subgraph class." << endl;
     1306  DoLog(0) && (Log() << Verbose(0) << "Generating Subgraph class." << endl);
    12021307  Graph Subgraphs;
    12031308
    12041309  // insert KeySets into Subgraphs
    1205   Log() << Verbose(0) << "Inserting KeySets into Subgraph class." << endl;
     1310  DoLog(0) && (Log() << Verbose(0) << "Inserting KeySets into Subgraph class." << endl);
    12061311  for (int j=0;j<mol->AtomCount;j++) {
    12071312    Subgraphs.insert(GraphPair (TestSets[j],pair<int, double>(counter++, 1.)));
    12081313  }
    1209   Log() << Verbose(0) << "Testing insertion of already present item in Subgraph." << endl;
     1314  DoLog(0) && (Log() << Verbose(0) << "Testing insertion of already present item in Subgraph." << endl);
    12101315  GraphTestPair test2;
    12111316  test2 = Subgraphs.insert(GraphPair (TestSets[mol->AtomCount],pair<int, double>(counter++, 1.)));
    12121317  if (test2.second) {
    1213     Log() << Verbose(1) << "Insertion worked?!" << endl;
     1318    DoLog(1) && (Log() << Verbose(1) << "Insertion worked?!" << endl);
    12141319  } else {
    1215     Log() << Verbose(1) << "Insertion rejected: Present object is " << (*(test2.first)).second.first << "." << endl;
     1320    DoLog(1) && (Log() << Verbose(1) << "Insertion rejected: Present object is " << (*(test2.first)).second.first << "." << endl);
    12161321  }
    12171322
    12181323  // show graphs
    1219   Log() << Verbose(0) << "Showing Subgraph's contents, checking that it's sorted." << endl;
     1324  DoLog(0) && (Log() << Verbose(0) << "Showing Subgraph's contents, checking that it's sorted." << endl);
    12201325  Graph::iterator A = Subgraphs.begin();
    12211326  while (A !=  Subgraphs.end()) {
    1222     Log() << Verbose(0) << (*A).second.first << ": ";
     1327    DoLog(0) && (Log() << Verbose(0) << (*A).second.first << ": ");
    12231328    KeySet::iterator key = (*A).first.begin();
    12241329    comp = -1;
    12251330    while (key != (*A).first.end()) {
    12261331      if ((*key) > comp)
    1227         Log() << Verbose(0) << (*key) << " ";
     1332        DoLog(0) && (Log() << Verbose(0) << (*key) << " ");
    12281333      else
    1229         Log() << Verbose(0) << (*key) << "! ";
     1334        DoLog(0) && (Log() << Verbose(0) << (*key) << "! ");
    12301335      comp = (*key);
    12311336      key++;
    12321337    }
    1233     Log() << Verbose(0) << endl;
     1338    DoLog(0) && (Log() << Verbose(0) << endl);
    12341339    A++;
    12351340  }
     
    12481353  ofstream output;
    12491354  molecule *mol = new molecule(periode);
     1355  mol->SetNameFromFilename(ConfigFileName);
     1356
     1357  if (!strcmp(configuration->configpath, configuration->GetDefaultPath())) {
     1358    DoeLog(2) && (eLog()<< Verbose(2) << "config is found under different path then stated in config file::defaultpath!" << endl);
     1359  }
     1360
     1361
     1362  // first save as PDB data
     1363  if (ConfigFileName != NULL)
     1364    strcpy(filename, ConfigFileName);
     1365  if (output == NULL)
     1366    strcpy(filename,"main_pcp_linux");
     1367  DoLog(0) && (Log() << Verbose(0) << "Saving as pdb input ");
     1368  if (configuration->SavePDB(filename, molecules))
     1369    DoLog(0) && (Log() << Verbose(0) << "done." << endl);
     1370  else
     1371    DoLog(0) && (Log() << Verbose(0) << "failed." << endl);
     1372
     1373  // then save as tremolo data file
     1374  if (ConfigFileName != NULL)
     1375    strcpy(filename, ConfigFileName);
     1376  if (output == NULL)
     1377    strcpy(filename,"main_pcp_linux");
     1378  DoLog(0) && (Log() << Verbose(0) << "Saving as tremolo data input ");
     1379  if (configuration->SaveTREMOLO(filename, molecules))
     1380    DoLog(0) && (Log() << Verbose(0) << "done." << endl);
     1381  else
     1382    DoLog(0) && (Log() << Verbose(0) << "failed." << endl);
    12501383
    12511384  // translate each to its center and merge all molecules in MoleculeListClass into this molecule
     
    12671400  }
    12681401
    1269   Log() << Verbose(0) << "Storing configuration ... " << endl;
     1402  DoLog(0) && (Log() << Verbose(0) << "Storing configuration ... " << endl);
    12701403  // get correct valence orbitals
    12711404  mol->CalculateOrbitals(*configuration);
     
    12831416  output.close();
    12841417  output.clear();
    1285   Log() << Verbose(0) << "Saving of config file ";
     1418  DoLog(0) && (Log() << Verbose(0) << "Saving of config file ");
    12861419  if (configuration->Save(filename, periode, mol))
    1287     Log() << Verbose(0) << "successful." << endl;
     1420    DoLog(0) && (Log() << Verbose(0) << "successful." << endl);
    12881421  else
    1289     Log() << Verbose(0) << "failed." << endl;
     1422    DoLog(0) && (Log() << Verbose(0) << "failed." << endl);
    12901423
    12911424  // and save to xyz file
     
    13001433    output.open(filename, ios::trunc);
    13011434  }
    1302   Log() << Verbose(0) << "Saving of XYZ file ";
     1435  DoLog(0) && (Log() << Verbose(0) << "Saving of XYZ file ");
    13031436  if (mol->MDSteps <= 1) {
    13041437    if (mol->OutputXYZ(&output))
    1305       Log() << Verbose(0) << "successful." << endl;
     1438      DoLog(0) && (Log() << Verbose(0) << "successful." << endl);
    13061439    else
    1307       Log() << Verbose(0) << "failed." << endl;
     1440      DoLog(0) && (Log() << Verbose(0) << "failed." << endl);
    13081441  } else {
    13091442    if (mol->OutputTrajectoriesXYZ(&output))
    1310       Log() << Verbose(0) << "successful." << endl;
     1443      DoLog(0) && (Log() << Verbose(0) << "successful." << endl);
    13111444    else
    1312       Log() << Verbose(0) << "failed." << endl;
     1445      DoLog(0) && (Log() << Verbose(0) << "failed." << endl);
    13131446  }
    13141447  output.close();
     
    13201453  if (output == NULL)
    13211454    strcpy(filename,"main_pcp_linux");
    1322   Log() << Verbose(0) << "Saving as mpqc input ";
     1455  DoLog(0) && (Log() << Verbose(0) << "Saving as mpqc input ");
    13231456  if (configuration->SaveMPQC(filename, mol))
    1324     Log() << Verbose(0) << "done." << endl;
     1457    DoLog(0) && (Log() << Verbose(0) << "done." << endl);
    13251458  else
    1326     Log() << Verbose(0) << "failed." << endl;
     1459    DoLog(0) && (Log() << Verbose(0) << "failed." << endl);
    13271460
    13281461  if (!strcmp(configuration->configpath, configuration->GetDefaultPath())) {
    1329     eLog() << Verbose(0) << "WARNING: config is found under different path then stated in config file::defaultpath!" << endl;
     1462    DoeLog(2) && (eLog()<< Verbose(2) << "config is found under different path then stated in config file::defaultpath!" << endl);
    13301463  }
     1464
    13311465  delete(mol);
    13321466};
     
    13561490  enum ConfigStatus configPresent = absent;
    13571491  clock_t start,end;
     1492  double MaxDistance = -1;
    13581493  int argptr;
    13591494  molecule *mol = NULL;
    1360   string BondGraphFileName("");
     1495  string BondGraphFileName("\n");
     1496  int verbosity = 0;
    13611497  strncpy(configuration.databasepath, LocalPath, MAXSTRINGSIZE-1);
    13621498
     
    13661502    do {
    13671503      if (argv[argptr][0] == '-') {
    1368         Log() << Verbose(0) << "Recognized command line argument: " << argv[argptr][1] << ".\n";
     1504        DoLog(0) && (Log() << Verbose(0) << "Recognized command line argument: " << argv[argptr][1] << ".\n");
    13691505        argptr++;
    13701506        switch(argv[argptr-1][1]) {
     
    13721508          case 'H':
    13731509          case '?':
    1374             Log() << Verbose(0) << "MoleCuilder suite" << endl << "==================" << endl << endl;
    1375             Log() << Verbose(0) << "Usage: " << argv[0] << "[config file] [-{acefpsthH?vfrp}] [further arguments]" << endl;
    1376             Log() << Verbose(0) << "or simply " << argv[0] << " without arguments for interactive session." << endl;
    1377             Log() << Verbose(0) << "\t-a Z x1 x2 x3\tAdd new atom of element Z at coordinates (x1,x2,x3)." << endl;
    1378             Log() << Verbose(0) << "\t-A <source>\tCreate adjacency list from bonds parsed from 'dbond'-style file." <<endl;
    1379             Log() << Verbose(0) << "\t-b xx xy xz yy yz zz\tCenter atoms in domain with given symmetric matrix of (xx,xy,xz,yy,yz,zz)." << endl;
    1380             Log() << Verbose(0) << "\t-B xx xy xz yy yz zz\tBound atoms by domain with given symmetric matrix of (xx,xy,xz,yy,yz,zz)." << endl;
    1381             Log() << Verbose(0) << "\t-c x1 x2 x3\tCenter atoms in domain with a minimum distance to boundary of (x1,x2,x3)." << endl;
    1382             Log() << Verbose(0) << "\t-C\tPair Correlation analysis." << endl;
    1383             Log() << Verbose(0) << "\t-d x1 x2 x3\tDuplicate cell along each axis by given factor." << endl;
    1384             Log() << Verbose(0) << "\t-D <bond distance>\tDepth-First-Search Analysis of the molecule, giving cycles and tree/back edges." << endl;
    1385             Log() << Verbose(0) << "\t-e <file>\tSets the databases path to be parsed (default: ./)." << endl;
    1386             Log() << Verbose(0) << "\t-E <id> <Z>\tChange atom <id>'s element to <Z>, <id> begins at 0." << endl;
    1387             Log() << Verbose(0) << "\t-f/F <dist> <order>\tFragments the molecule in BOSSANOVA manner (with/out rings compressed) and stores config files in same dir as config (return code 0 - fragmented, 2 - no fragmentation necessary)." << endl;
    1388             Log() << Verbose(0) << "\t-g <file>\tParses a bond length table from the given file." << endl;
    1389             Log() << Verbose(0) << "\t-h/-H/-?\tGive this help screen." << endl;
    1390             Log() << Verbose(0) << "\t-L <step0> <step1> <prefix>\tStore a linear interpolation between two configurations <step0> and <step1> into single config files with prefix <prefix> and as Trajectories into the current config file." << endl;
    1391             Log() << Verbose(0) << "\t-m <0/1>\tCalculate (0)/ Align in(1) PAS with greatest EV along z axis." << endl;
    1392             Log() << Verbose(0) << "\t-M <basis>\tSetting basis to store to MPQC config files." << endl;
    1393             Log() << Verbose(0) << "\t-n\tFast parsing (i.e. no trajectories are looked for)." << endl;
    1394             Log() << Verbose(0) << "\t-N <radius> <file>\tGet non-convex-envelope." << endl;
    1395             Log() << Verbose(0) << "\t-o <out>\tGet volume of the convex envelope (and store to tecplot file)." << endl;
    1396             Log() << Verbose(0) << "\t-O\tCenter atoms in origin." << endl;
    1397             Log() << Verbose(0) << "\t-p <file>\tParse given xyz file and create raw config file from it." << endl;
    1398             Log() << Verbose(0) << "\t-P <file>\tParse given forces file and append as an MD step to config file via Verlet." << endl;
    1399             Log() << Verbose(0) << "\t-r <id>\t\tRemove an atom with given id." << endl;
    1400             Log() << Verbose(0) << "\t-R <id> <radius>\t\tRemove all atoms out of sphere around a given one." << endl;
    1401             Log() << Verbose(0) << "\t-s x1 x2 x3\tScale all atom coordinates by this vector (x1,x2,x3)." << endl;
    1402             Log() << Verbose(0) << "\t-S <file> Store temperatures from the config file in <file>." << endl;
    1403             Log() << Verbose(0) << "\t-t x1 x2 x3\tTranslate all atoms by this vector (x1,x2,x3)." << endl;
    1404             Log() << Verbose(0) << "\t-T x1 x2 x3\tTranslate periodically all atoms by this vector (x1,x2,x3)." << endl;
    1405             Log() << Verbose(0) << "\t-u rho\tsuspend in water solution and output necessary cell lengths, average density rho and repetition." << endl;
    1406             Log() << Verbose(0) << "\t-v/-V\t\tGives version information." << endl;
    1407             Log() << Verbose(0) << "Note: config files must not begin with '-' !" << endl;
     1510            DoLog(0) && (Log() << Verbose(0) << "MoleCuilder suite" << endl << "==================" << endl << endl);
     1511            DoLog(0) && (Log() << Verbose(0) << "Usage: " << argv[0] << "[config file] [-{acefpsthH?vfrp}] [further arguments]" << endl);
     1512            DoLog(0) && (Log() << Verbose(0) << "or simply " << argv[0] << " without arguments for interactive session." << endl);
     1513            DoLog(0) && (Log() << Verbose(0) << "\t-a Z x1 x2 x3\tAdd new atom of element Z at coordinates (x1,x2,x3)." << endl);
     1514            DoLog(0) && (Log() << Verbose(0) << "\t-A <source>\tCreate adjacency list from bonds parsed from 'dbond'-style file." <<endl);
     1515            DoLog(0) && (Log() << Verbose(0) << "\t-b xx xy xz yy yz zz\tCenter atoms in domain with given symmetric matrix of (xx,xy,xz,yy,yz,zz)." << endl);
     1516            DoLog(0) && (Log() << Verbose(0) << "\t-B xx xy xz yy yz zz\tBound atoms by domain with given symmetric matrix of (xx,xy,xz,yy,yz,zz)." << endl);
     1517            DoLog(0) && (Log() << Verbose(0) << "\t-c x1 x2 x3\tCenter atoms in domain with a minimum distance to boundary of (x1,x2,x3)." << endl);
     1518            DoLog(0) && (Log() << Verbose(0) << "\t-C <type> [params] <output> <bin output> <BinWidth> <BinStart> <BinEnd>\tPair Correlation analysis." << endl);
     1519            DoLog(0) && (Log() << Verbose(0) << "\t-d x1 x2 x3\tDuplicate cell along each axis by given factor." << endl);
     1520            DoLog(0) && (Log() << Verbose(0) << "\t-D <bond distance>\tDepth-First-Search Analysis of the molecule, giving cycles and tree/back edges." << endl);
     1521            DoLog(0) && (Log() << Verbose(0) << "\t-e <file>\tSets the databases path to be parsed (default: ./)." << endl);
     1522            DoLog(0) && (Log() << Verbose(0) << "\t-E <id> <Z>\tChange atom <id>'s element to <Z>, <id> begins at 0." << endl);
     1523            DoLog(0) && (Log() << Verbose(0) << "\t-f <dist> <order>\tFragments the molecule in BOSSANOVA manner (with/out rings compressed) and stores config files in same dir as config (return code 0 - fragmented, 2 - no fragmentation necessary)." << endl);
     1524            DoLog(0) && (Log() << Verbose(0) << "\t-F <xyz of filler> <dist_x> <dist_y> <dist_z> <epsilon> <randatom> <randmol> <DoRotate>\tFilling Box with water molecules." << endl);
     1525            DoLog(0) && (Log() << Verbose(0) << "\t-FF <MaxDistance> <xyz of filler> <dist_x> <dist_y> <dist_z> <epsilon> <randatom> <randmol> <DoRotate>\tFilling Box with water molecules." << endl);
     1526            DoLog(0) && (Log() << Verbose(0) << "\t-g <file>\tParses a bond length table from the given file." << endl);
     1527            DoLog(0) && (Log() << Verbose(0) << "\t-h/-H/-?\tGive this help screen." << endl);
     1528            DoLog(0) && (Log() << Verbose(0) << "\t-I\t Dissect current system of molecules into a set of disconnected (subgraphs of) molecules." << endl);
     1529            DoLog(0) && (Log() << Verbose(0) << "\t-j\t<path> Store all bonds to file." << endl);
     1530            DoLog(0) && (Log() << Verbose(0) << "\t-J\t<path> Store adjacency per atom to file." << endl);
     1531            DoLog(0) && (Log() << Verbose(0) << "\t-L <step0> <step1> <prefix>\tStore a linear interpolation between two configurations <step0> and <step1> into single config files with prefix <prefix> and as Trajectories into the current config file." << endl);
     1532            DoLog(0) && (Log() << Verbose(0) << "\t-m <0/1>\tCalculate (0)/ Align in(1) PAS with greatest EV along z axis." << endl);
     1533            DoLog(0) && (Log() << Verbose(0) << "\t-M <basis>\tSetting basis to store to MPQC config files." << endl);
     1534            DoLog(0) && (Log() << Verbose(0) << "\t-n\tFast parsing (i.e. no trajectories are looked for)." << endl);
     1535            DoLog(0) && (Log() << Verbose(0) << "\t-N <radius> <file>\tGet non-convex-envelope." << endl);
     1536            DoLog(0) && (Log() << Verbose(0) << "\t-o <out>\tGet volume of the convex envelope (and store to tecplot file)." << endl);
     1537            DoLog(0) && (Log() << Verbose(0) << "\t-O\tCenter atoms in origin." << endl);
     1538            DoLog(0) && (Log() << Verbose(0) << "\t-p <file>\tParse given xyz file and create raw config file from it." << endl);
     1539            DoLog(0) && (Log() << Verbose(0) << "\t-P <file>\tParse given forces file and append as an MD step to config file via Verlet." << endl);
     1540            DoLog(0) && (Log() << Verbose(0) << "\t-r <id>\t\tRemove an atom with given id." << endl);
     1541            DoLog(0) && (Log() << Verbose(0) << "\t-R <id> <radius>\t\tRemove all atoms out of sphere around a given one." << endl);
     1542            DoLog(0) && (Log() << Verbose(0) << "\t-s x1 x2 x3\tScale all atom coordinates by this vector (x1,x2,x3)." << endl);
     1543            DoLog(0) && (Log() << Verbose(0) << "\t-S <file> Store temperatures from the config file in <file>." << endl);
     1544            DoLog(0) && (Log() << Verbose(0) << "\t-t x1 x2 x3\tTranslate all atoms by this vector (x1,x2,x3)." << endl);
     1545            DoLog(0) && (Log() << Verbose(0) << "\t-T x1 x2 x3\tTranslate periodically all atoms by this vector (x1,x2,x3)." << endl);
     1546            DoLog(0) && (Log() << Verbose(0) << "\t-u rho\tsuspend in water solution and output necessary cell lengths, average density rho and repetition." << endl);
     1547            DoLog(0) && (Log() << Verbose(0) << "\t-v\t\tsets verbosity (more is more)." << endl);
     1548            DoLog(0) && (Log() << Verbose(0) << "\t-V\t\tGives version information." << endl);
     1549            DoLog(0) && (Log() << Verbose(0) << "\t-X\t\tset default name of a molecule." << endl);
     1550            DoLog(0) && (Log() << Verbose(0) << "Note: config files must not begin with '-' !" << endl);
    14081551            return (1);
    14091552            break;
    14101553          case 'v':
     1554            while (argv[argptr-1][verbosity+1] == 'v') {
     1555              verbosity++;
     1556            }
     1557            setVerbosity(verbosity);
     1558            DoLog(0) && (Log() << Verbose(0) << "Setting verbosity to " << verbosity << "." << endl);
     1559            break;
    14111560          case 'V':
    1412             Log() << Verbose(0) << argv[0] << " " << VERSIONSTRING << endl;
    1413             Log() << Verbose(0) << "Build your own molecule position set." << endl;
     1561            DoLog(0) && (Log() << Verbose(0) << argv[0] << " " << VERSIONSTRING << endl);
     1562            DoLog(0) && (Log() << Verbose(0) << "Build your own molecule position set." << endl);
    14141563            return (1);
     1564            break;
     1565          case 'B':
     1566            if (ExitFlag == 0) ExitFlag = 1;
     1567            if ((argptr+5 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) || (!IsValidNumber(argv[argptr+3])) || (!IsValidNumber(argv[argptr+4])) || (!IsValidNumber(argv[argptr+5])) ) {
     1568              ExitFlag = 255;
     1569              DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for bounding in box: -B <xx> <xy> <xz> <yy> <yz> <zz>" << endl);
     1570              performCriticalExit();
     1571            } else {
     1572              SaveFlag = true;
     1573              j = -1;
     1574              DoLog(1) && (Log() << Verbose(1) << "Centering atoms in config file within given simulation box." << endl);
     1575              double * const cell_size = World::get()->cell_size;
     1576              for (int i=0;i<6;i++) {
     1577                cell_size[i] = atof(argv[argptr+i]);
     1578              }
     1579              argptr+=6;
     1580            }
    14151581            break;
    14161582          case 'e':
    14171583            if ((argptr >= argc) || (argv[argptr][0] == '-')) {
    1418               eLog() << Verbose(0) << "Not enough or invalid arguments for specifying element db: -e <db file>" << endl;
     1584              DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments for specifying element db: -e <db file>" << endl);
     1585              performCriticalExit();
    14191586            } else {
    1420               Log() << Verbose(0) << "Using " << argv[argptr] << " as elements database." << endl;
     1587              DoLog(0) && (Log() << Verbose(0) << "Using " << argv[argptr] << " as elements database." << endl);
    14211588              strncpy (configuration.databasepath, argv[argptr], MAXSTRINGSIZE-1);
    14221589              argptr+=1;
     
    14251592          case 'g':
    14261593            if ((argptr >= argc) || (argv[argptr][0] == '-')) {
    1427               eLog() << Verbose(0) << "Not enough or invalid arguments for specifying bond length table: -g <table file>" << endl;
     1594              DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments for specifying bond length table: -g <table file>" << endl);
     1595              performCriticalExit();
    14281596            } else {
    14291597              BondGraphFileName = argv[argptr];
    1430               Log() << Verbose(0) << "Using " << BondGraphFileName << " as bond length table." << endl;
     1598              DoLog(0) && (Log() << Verbose(0) << "Using " << BondGraphFileName << " as bond length table." << endl);
    14311599              argptr+=1;
    14321600            }
    14331601            break;
    14341602          case 'n':
    1435             Log() << Verbose(0) << "I won't parse trajectories." << endl;
     1603            DoLog(0) && (Log() << Verbose(0) << "I won't parse trajectories." << endl);
    14361604            configuration.FastParsing = true;
     1605            break;
     1606          case 'X':
     1607            {
     1608              char **name = &(World::get()->DefaultName);
     1609              delete[](*name);
     1610              const int length = strlen(argv[argptr]);
     1611              *name = new char[length+2];
     1612              strncpy(*name, argv[argptr], length);
     1613              DoLog(0) && (Log() << Verbose(0) << "Default name of new molecules set to " << *name << "." << endl);
     1614            }
    14371615            break;
    14381616          default:   // no match? Step on
     
    14461624    // 3a. Parse the element database
    14471625    if (periode->LoadPeriodentafel(configuration.databasepath)) {
    1448       Log() << Verbose(0) << "Element list loaded successfully." << endl;
     1626      DoLog(0) && (Log() << Verbose(0) << "Element list loaded successfully." << endl);
    14491627      //periode->Output();
    14501628    } else {
    1451       Log() << Verbose(0) << "Element list loading failed." << endl;
     1629      DoLog(0) && (Log() << Verbose(0) << "Element list loading failed." << endl);
    14521630      return 1;
    14531631    }
     
    14551633    if (argv[1][0] != '-') {
    14561634      // simply create a new molecule, wherein the config file is loaded and the manipulation takes place
    1457       Log() << Verbose(0) << "Config file given." << endl;
     1635      DoLog(0) && (Log() << Verbose(0) << "Config file given." << endl);
    14581636      test.open(argv[1], ios::in);
    14591637      if (test == NULL) {
     
    14611639        output.open(argv[1], ios::out);
    14621640        if (output == NULL) {
    1463           Log() << Verbose(1) << "Specified config file " << argv[1] << " not found." << endl;
     1641          DoLog(1) && (Log() << Verbose(1) << "Specified config file " << argv[1] << " not found." << endl);
    14641642          configPresent = absent;
    14651643        } else {
    1466           Log() << Verbose(0) << "Empty configuration file." << endl;
     1644          DoLog(0) && (Log() << Verbose(0) << "Empty configuration file." << endl);
    14671645          ConfigFileName = argv[1];
    14681646          configPresent = empty;
     
    14721650        test.close();
    14731651        ConfigFileName = argv[1];
    1474         Log() << Verbose(1) << "Specified config file found, parsing ... ";
     1652        DoLog(1) && (Log() << Verbose(1) << "Specified config file found, parsing ... ");
    14751653        switch (configuration.TestSyntax(ConfigFileName, periode)) {
    14761654          case 1:
    1477             Log() << Verbose(0) << "new syntax." << endl;
     1655            DoLog(0) && (Log() << Verbose(0) << "new syntax." << endl);
    14781656            configuration.Load(ConfigFileName, BondGraphFileName, periode, molecules);
    14791657            configPresent = present;
    14801658            break;
    14811659          case 0:
    1482             Log() << Verbose(0) << "old syntax." << endl;
     1660            DoLog(0) && (Log() << Verbose(0) << "old syntax." << endl);
    14831661            configuration.LoadOld(ConfigFileName, BondGraphFileName, periode, molecules);
    14841662            configPresent = present;
    14851663            break;
    14861664          default:
    1487             Log() << Verbose(0) << "Unknown syntax or empty, yet present file." << endl;
     1665            DoLog(0) && (Log() << Verbose(0) << "Unknown syntax or empty, yet present file." << endl);
    14881666            configPresent = empty;
    14891667       }
     
    15021680       mol = new molecule(periode);
    15031681       mol->ActiveFlag = true;
     1682       if (ConfigFileName != NULL)
     1683         mol->SetNameFromFilename(ConfigFileName);
    15041684       molecules->insert(mol);
     1685     }
     1686     if (configuration.BG == NULL) {
     1687       configuration.BG = new BondGraph(configuration.GetIsAngstroem());
     1688       if ((!BondGraphFileName.empty()) && (configuration.BG->LoadBondLengthTable(BondGraphFileName))) {
     1689         DoLog(0) && (Log() << Verbose(0) << "Bond length table loaded successfully." << endl);
     1690       } else {
     1691         DoeLog(1) && (eLog()<< Verbose(1) << "Bond length table loading failed." << endl);
     1692       }
    15051693     }
    15061694
     
    15081696    argptr = 1;
    15091697    do {
    1510       Log() << Verbose(0) << "Current Command line argument: " << argv[argptr] << "." << endl;
     1698      DoLog(0) && (Log() << Verbose(0) << "Current Command line argument: " << argv[argptr] << "." << endl);
    15111699      if (argv[argptr][0] == '-') {
    15121700        argptr++;
     
    15171705              if ((argptr >= argc) || (argv[argptr][0] == '-')) {
    15181706                ExitFlag = 255;
    1519                 eLog() << Verbose(0) << "Not enough arguments for parsing: -p <xyz file>" << endl;
     1707                DoeLog(0) && (eLog()<< Verbose(0) << "Not enough arguments for parsing: -p <xyz file>" << endl);
     1708                performCriticalExit();
    15201709              } else {
    15211710                SaveFlag = true;
    1522                 Log() << Verbose(1) << "Parsing xyz file for new atoms." << endl;
     1711                DoLog(1) && (Log() << Verbose(1) << "Parsing xyz file for new atoms." << endl);
    15231712                if (!mol->AddXYZFile(argv[argptr]))
    1524                   Log() << Verbose(2) << "File not found." << endl;
     1713                  DoLog(2) && (Log() << Verbose(2) << "File not found." << endl);
    15251714                else {
    1526                   Log() << Verbose(2) << "File found and parsed." << endl;
     1715                  DoLog(2) && (Log() << Verbose(2) << "File found and parsed." << endl);
    15271716                  configPresent = present;
    15281717                }
     
    15331722              if ((argptr >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) || (!IsValidNumber(argv[argptr+3]))) {
    15341723                ExitFlag = 255;
    1535                 eLog() << Verbose(0) << "Not enough or invalid arguments for adding atom: -a <element> <x> <y> <z>" << endl;
     1724                DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments for adding atom: -a <element> <x> <y> <z>" << endl);
     1725                performCriticalExit();
    15361726              } else {
    15371727                SaveFlag = true;
    1538                 Log() << Verbose(1) << "Adding new atom with element " << argv[argptr] << " at (" << argv[argptr+1] << "," << argv[argptr+2] << "," << argv[argptr+3] << "), ";
     1728                DoLog(1) && (Log() << Verbose(1) << "Adding new atom with element " << argv[argptr] << " at (" << argv[argptr+1] << "," << argv[argptr+2] << "," << argv[argptr+3] << "), ");
    15391729                first = new atom;
    15401730                first->type = periode->FindElement(atoi(argv[argptr]));
    15411731                if (first->type != NULL)
    1542                   Log() << Verbose(2) << "found element " << first->type->name << endl;
     1732                  DoLog(2) && (Log() << Verbose(2) << "found element " << first->type->name << endl);
    15431733                for (int i=NDIM;i--;)
    15441734                  first->x.x[i] = atof(argv[argptr+1+i]);
     
    15481738                    configPresent = present;
    15491739                } else
    1550                   eLog() << Verbose(1) << "Could not find the specified element." << endl;
     1740                  DoeLog(1) && (eLog()<< Verbose(1) << "Could not find the specified element." << endl);
    15511741                argptr+=4;
    15521742              }
     
    15611751              if ((argptr >= argc) || (argv[argptr][0] == '-')) {
    15621752                ExitFlag = 255;
    1563                 eLog() << Verbose(0) << "Not enough or invalid arguments given for setting MPQC basis: -B <basis name>" << endl;
     1753                DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for setting MPQC basis: -B <basis name>" << endl);
     1754                performCriticalExit();
    15641755              } else {
    15651756                configuration.basis = argv[argptr];
    1566                 Log() << Verbose(1) << "Setting MPQC basis to " << configuration.basis << "." << endl;
     1757                DoLog(1) && (Log() << Verbose(1) << "Setting MPQC basis to " << configuration.basis << "." << endl);
    15671758                argptr+=1;
    15681759              }
     
    15711762              if (ExitFlag == 0) ExitFlag = 1;
    15721763              {
    1573                 Log() << Verbose(1) << "Depth-First-Search Analysis." << endl;
     1764                DoLog(1) && (Log() << Verbose(1) << "Depth-First-Search Analysis." << endl);
    15741765                MoleculeLeafClass *Subgraphs = NULL;      // list of subgraphs from DFS analysis
    15751766                int *MinimumRingSize = new int[mol->AtomCount];
     
    16011792              //argptr+=1;
    16021793              break;
     1794            case 'I':
     1795              DoLog(1) && (Log() << Verbose(1) << "Dissecting molecular system into a set of disconnected subgraphs ... " << endl);
     1796              // @TODO rather do the dissection afterwards
     1797              molecules->DissectMoleculeIntoConnectedSubgraphs(periode, &configuration);
     1798              mol = NULL;
     1799              if (molecules->ListOfMolecules.size() != 0) {
     1800                for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     1801                  if ((*ListRunner)->ActiveFlag) {
     1802                    mol = *ListRunner;
     1803                    break;
     1804                  }
     1805              }
     1806              if ((mol == NULL) && (!molecules->ListOfMolecules.empty())) {
     1807                mol = *(molecules->ListOfMolecules.begin());
     1808                if (mol != NULL)
     1809                  mol->ActiveFlag = true;
     1810              }
     1811              break;
    16031812            case 'C':
     1813              {
     1814                int ranges[3] = {1, 1, 1};
     1815                bool periodic = (argv[argptr-1][2] =='p');
     1816                if (ExitFlag == 0) ExitFlag = 1;
     1817                if ((argptr >= argc)) {
     1818                  ExitFlag = 255;
     1819                  DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for pair correlation analysis: -C[p] <type: E/P/S> [more params] <output> <bin output> <BinStart> <BinEnd>" << endl);
     1820                  performCriticalExit();
     1821                } else {
     1822                  switch(argv[argptr][0]) {
     1823                    case 'E':
     1824                      {
     1825                        if ((argptr+6 >= argc) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+5])) || (!IsValidNumber(argv[argptr+6])) || (!IsValidNumber(argv[argptr+2])) || (argv[argptr+1][0] == '-') || (argv[argptr+2][0] == '-') || (argv[argptr+3][0] == '-') || (argv[argptr+4][0] == '-')) {
     1826                          ExitFlag = 255;
     1827                          DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for pair correlation analysis: -C E <Z1> <Z2> <output> <bin output>" << endl);
     1828                          performCriticalExit();
     1829                        } else {
     1830                          ofstream output(argv[argptr+3]);
     1831                          ofstream binoutput(argv[argptr+4]);
     1832                          const double BinStart = atof(argv[argptr+5]);
     1833                          const double BinEnd = atof(argv[argptr+6]);
     1834
     1835                          element *elemental = periode->FindElement((const int) atoi(argv[argptr+1]));
     1836                          element *elemental2 = periode->FindElement((const int) atoi(argv[argptr+2]));
     1837                          PairCorrelationMap *correlationmap = NULL;
     1838                          if (periodic)
     1839                            correlationmap = PeriodicPairCorrelation(molecules, elemental, elemental2, ranges);
     1840                          else
     1841                            correlationmap = PairCorrelation(molecules, elemental, elemental2);
     1842                          //OutputCorrelationToSurface(&output, correlationmap);
     1843                          BinPairMap *binmap = BinData( correlationmap, 0.5, BinStart, BinEnd );
     1844                          OutputCorrelation ( &binoutput, binmap );
     1845                          output.close();
     1846                          binoutput.close();
     1847                          delete(binmap);
     1848                          delete(correlationmap);
     1849                          argptr+=7;
     1850                        }
     1851                      }
     1852                      break;
     1853
     1854                    case 'P':
     1855                      {
     1856                        if ((argptr+8 >= argc) || (!IsValidNumber(argv[argptr+1])) ||  (!IsValidNumber(argv[argptr+2])) || (!IsValidNumber(argv[argptr+3])) || (!IsValidNumber(argv[argptr+4])) || (!IsValidNumber(argv[argptr+7])) || (!IsValidNumber(argv[argptr+8])) || (argv[argptr+1][0] == '-') || (argv[argptr+2][0] == '-') || (argv[argptr+3][0] == '-') || (argv[argptr+4][0] == '-') || (argv[argptr+5][0] == '-') || (argv[argptr+6][0] == '-')) {
     1857                          ExitFlag = 255;
     1858                          DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for pair correlation analysis: -C P <Z1> <x> <y> <z> <output> <bin output>" << endl);
     1859                          performCriticalExit();
     1860                        } else {
     1861                          ofstream output(argv[argptr+5]);
     1862                          ofstream binoutput(argv[argptr+6]);
     1863                          const double BinStart = atof(argv[argptr+7]);
     1864                          const double BinEnd = atof(argv[argptr+8]);
     1865
     1866                          element *elemental = periode->FindElement((const int) atoi(argv[argptr+1]));
     1867                          Vector *Point = new Vector((const double) atof(argv[argptr+1]),(const double) atof(argv[argptr+2]),(const double) atof(argv[argptr+3]));
     1868                          CorrelationToPointMap *correlationmap = NULL;
     1869                          if (periodic)
     1870                            correlationmap  = PeriodicCorrelationToPoint(molecules, elemental, Point, ranges);
     1871                          else
     1872                            correlationmap = CorrelationToPoint(molecules, elemental, Point);
     1873                          //OutputCorrelationToSurface(&output, correlationmap);
     1874                          BinPairMap *binmap = BinData( correlationmap, 0.5, BinStart, BinEnd );
     1875                          OutputCorrelation ( &binoutput, binmap );
     1876                          output.close();
     1877                          binoutput.close();
     1878                          delete(Point);
     1879                          delete(binmap);
     1880                          delete(correlationmap);
     1881                          argptr+=9;
     1882                        }
     1883                      }
     1884                      break;
     1885
     1886                    case 'S':
     1887                      {
     1888                        if ((argptr+6 >= argc) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+4])) || (!IsValidNumber(argv[argptr+5])) || (!IsValidNumber(argv[argptr+6])) || (argv[argptr+1][0] == '-') || (argv[argptr+2][0] == '-') || (argv[argptr+3][0] == '-')) {
     1889                          ExitFlag = 255;
     1890                          DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for pair correlation analysis: -C S <Z> <output> <bin output> <BinWidth> <BinStart> <BinEnd>" << endl);
     1891                          performCriticalExit();
     1892                        } else {
     1893                          ofstream output(argv[argptr+2]);
     1894                          ofstream binoutput(argv[argptr+3]);
     1895                          const double radius = 4.;
     1896                          const double BinWidth = atof(argv[argptr+4]);
     1897                          const double BinStart = atof(argv[argptr+5]);
     1898                          const double BinEnd = atof(argv[argptr+6]);
     1899                          double LCWidth = 20.;
     1900                          if (BinEnd > 0) {
     1901                            if (BinEnd > 2.*radius)
     1902                                LCWidth = BinEnd;
     1903                            else
     1904                              LCWidth = 2.*radius;
     1905                          }
     1906
     1907                          // get the boundary
     1908                          class molecule *Boundary = NULL;
     1909                          class Tesselation *TesselStruct = NULL;
     1910                          const LinkedCell *LCList = NULL;
     1911                          // find biggest molecule
     1912                          int counter  = 0;
     1913                          for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) {
     1914                            if ((Boundary == NULL) || (Boundary->AtomCount < (*BigFinder)->AtomCount)) {
     1915                              Boundary = *BigFinder;
     1916                            }
     1917                            counter++;
     1918                          }
     1919                          bool *Actives = Malloc<bool>(counter, "ParseCommandLineOptions() - case C -- *Actives");
     1920                          counter = 0;
     1921                          for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) {
     1922                            Actives[counter++] = (*BigFinder)->ActiveFlag;
     1923                            (*BigFinder)->ActiveFlag = (*BigFinder == Boundary) ? false : true;
     1924                          }
     1925                          LCList = new LinkedCell(Boundary, LCWidth);
     1926                          element *elemental = periode->FindElement((const int) atoi(argv[argptr+1]));
     1927                          FindNonConvexBorder(Boundary, TesselStruct, LCList, radius, NULL);
     1928                          CorrelationToSurfaceMap *surfacemap = NULL;
     1929                          if (periodic)
     1930                            surfacemap = PeriodicCorrelationToSurface( molecules, elemental, TesselStruct, LCList, ranges);
     1931                          else
     1932                            surfacemap = CorrelationToSurface( molecules, elemental, TesselStruct, LCList);
     1933                          OutputCorrelationToSurface(&output, surfacemap);
     1934                          // check whether radius was appropriate
     1935                          {
     1936                            double start; double end;
     1937                            GetMinMax( surfacemap, start, end);
     1938                            if (LCWidth < end)
     1939                              DoeLog(1) && (eLog()<< Verbose(1) << "Linked Cell width is smaller than the found range of values! Bins can only be correct up to: " << radius << "." << endl);
     1940                          }
     1941                          BinPairMap *binmap = BinData( surfacemap, BinWidth, BinStart, BinEnd );
     1942                          OutputCorrelation ( &binoutput, binmap );
     1943                          output.close();
     1944                          binoutput.close();
     1945                          for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++)
     1946                            (*BigFinder)->ActiveFlag = Actives[counter++];
     1947                          Free(&Actives);
     1948                          delete(LCList);
     1949                          delete(TesselStruct);
     1950                          delete(binmap);
     1951                          delete(surfacemap);
     1952                          argptr+=7;
     1953                        }
     1954                      }
     1955                      break;
     1956
     1957                    default:
     1958                      ExitFlag = 255;
     1959                      DoeLog(0) && (eLog()<< Verbose(0) << "Invalid type given for pair correlation analysis: -C <type: E/P/S> [more params] <output> <bin output>" << endl);
     1960                      performCriticalExit();
     1961                      break;
     1962                  }
     1963                }
     1964                break;
     1965              }
     1966            case 'E':
    16041967              if (ExitFlag == 0) ExitFlag = 1;
    1605               if ((argptr+2 >= argc) || (!IsValidNumber(argv[argptr])) || (argv[argptr][0] == '-') || (argv[argptr+1][0] == '-') || (argv[argptr+2][0] == '-')) {
     1968              if ((argptr+1 >= argc) || (!IsValidNumber(argv[argptr])) || (argv[argptr+1][0] == '-')) {
    16061969                ExitFlag = 255;
    1607                 eLog() << Verbose(0) << "Not enough or invalid arguments given for pair correlation analysis: -C <Z> <output> <bin output>" << endl;
     1970                DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for changing element: -E <atom nr.> <element>" << endl);
     1971                performCriticalExit();
    16081972              } else {
    1609                 SaveFlag = false;
    1610                 ofstream output(argv[argptr+1]);
    1611                 ofstream binoutput(argv[argptr+2]);
    1612                 const double radius = 5.;
    1613 
    1614                 // get the boundary
    1615                 class molecule *Boundary = NULL;
    1616                 class Tesselation *TesselStruct = NULL;
     1973                SaveFlag = true;
     1974                DoLog(1) && (Log() << Verbose(1) << "Changing atom " << argv[argptr] << " to element " << argv[argptr+1] << "." << endl);
     1975                first = mol->FindAtom(atoi(argv[argptr]));
     1976                first->type = periode->FindElement(atoi(argv[argptr+1]));
     1977                argptr+=2;
     1978              }
     1979              break;
     1980            case 'F':
     1981              if (ExitFlag == 0) ExitFlag = 1;
     1982              MaxDistance = -1;
     1983              if (argv[argptr-1][2] == 'F') { // option is -FF?
     1984                // fetch first argument as max distance to surface
     1985                MaxDistance = atof(argv[argptr++]);
     1986                DoLog(0) && (Log() << Verbose(0) << "Filling with maximum layer distance of " << MaxDistance << "." << endl);
     1987              }
     1988              if ((argptr+7 >=argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) || (!IsValidNumber(argv[argptr+3])) || (!IsValidNumber(argv[argptr+4])) || (!IsValidNumber(argv[argptr+5])) || (!IsValidNumber(argv[argptr+6])) || (!IsValidNumber(argv[argptr+7]))) {
     1989                ExitFlag = 255;
     1990                DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for filling box with water: -F <xyz of filler> <dist_x> <dist_y> <dist_z> <boundary> <randatom> <randmol> <DoRotate>" << endl);
     1991                performCriticalExit();
     1992              } else {
     1993                SaveFlag = true;
     1994                DoLog(1) && (Log() << Verbose(1) << "Filling Box with water molecules." << endl);
     1995                // construct water molecule
     1996                molecule *filler = new molecule(periode);
     1997                if (!filler->AddXYZFile(argv[argptr])) {
     1998                  DoeLog(0) && (eLog()<< Verbose(0) << "Could not parse filler molecule from " << argv[argptr] << "." << endl);
     1999                }
     2000                filler->SetNameFromFilename(argv[argptr]);
     2001                configuration.BG->ConstructBondGraph(filler);
     2002                molecule *Filling = NULL;
     2003                // call routine
     2004                double distance[NDIM];
     2005                for (int i=0;i<NDIM;i++)
     2006                  distance[i] = atof(argv[argptr+i+1]);
     2007                Filling = FillBoxWithMolecule(molecules, filler, configuration, MaxDistance, distance, atof(argv[argptr+4]), atof(argv[argptr+5]), atof(argv[argptr+6]), atoi(argv[argptr+7]));
     2008                if (Filling != NULL) {
     2009                  Filling->ActiveFlag = false;
     2010                  molecules->insert(Filling);
     2011                }
     2012                delete(filler);
     2013                argptr+=6;
     2014              }
     2015              break;
     2016            case 'A':
     2017              if (ExitFlag == 0) ExitFlag = 1;
     2018              if ((argptr >= argc) || (argv[argptr][0] == '-')) {
     2019                ExitFlag =255;
     2020                DoeLog(0) && (eLog()<< Verbose(0) << "Missing source file for bonds in molecule: -A <bond sourcefile>" << endl);
     2021                performCriticalExit();
     2022              } else {
     2023                DoLog(0) && (Log() << Verbose(0) << "Parsing bonds from " << argv[argptr] << "." << endl);
     2024                ifstream *input = new ifstream(argv[argptr]);
     2025                mol->CreateAdjacencyListFromDbondFile(input);
     2026                input->close();
     2027                argptr+=1;
     2028              }
     2029              break;
     2030
     2031            case 'J':
     2032              if (ExitFlag == 0) ExitFlag = 1;
     2033              if ((argptr >= argc) || (argv[argptr][0] == '-')) {
     2034                ExitFlag =255;
     2035                DoeLog(0) && (eLog()<< Verbose(0) << "Missing path of adjacency file: -j <path>" << endl);
     2036                performCriticalExit();
     2037              } else {
     2038                DoLog(0) && (Log() << Verbose(0) << "Storing adjacency to path " << argv[argptr] << "." << endl);
     2039                configuration.BG->ConstructBondGraph(mol);
     2040                mol->StoreAdjacencyToFile(NULL, argv[argptr]);
     2041                argptr+=1;
     2042              }
     2043              break;
     2044
     2045            case 'j':
     2046              if (ExitFlag == 0) ExitFlag = 1;
     2047              if ((argptr >= argc) || (argv[argptr][0] == '-')) {
     2048                ExitFlag =255;
     2049                DoeLog(0) && (eLog()<< Verbose(0) << "Missing path of bonds file: -j <path>" << endl);
     2050                performCriticalExit();
     2051              } else {
     2052                DoLog(0) && (Log() << Verbose(0) << "Storing bonds to path " << argv[argptr] << "." << endl);
     2053                configuration.BG->ConstructBondGraph(mol);
     2054                mol->StoreBondsToFile(NULL, argv[argptr]);
     2055                argptr+=1;
     2056              }
     2057              break;
     2058
     2059            case 'N':
     2060              if (ExitFlag == 0) ExitFlag = 1;
     2061              if ((argptr+1 >= argc) || (argv[argptr+1][0] == '-')){
     2062                ExitFlag = 255;
     2063                DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for non-convex envelope: -o <radius> <tecplot output file>" << endl);
     2064                performCriticalExit();
     2065              } else {
     2066                class Tesselation *T = NULL;
    16172067                const LinkedCell *LCList = NULL;
     2068                molecule * Boundary = NULL;
     2069                //string filename(argv[argptr+1]);
     2070                //filename.append(".csv");
     2071                DoLog(0) && (Log() << Verbose(0) << "Evaluating non-convex envelope of biggest molecule.");
     2072                DoLog(1) && (Log() << Verbose(1) << "Using rolling ball of radius " << atof(argv[argptr]) << " and storing tecplot data in " << argv[argptr+1] << "." << endl);
    16182073                // find biggest molecule
    16192074                int counter  = 0;
    16202075                for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) {
     2076                  (*BigFinder)->CountAtoms();
    16212077                  if ((Boundary == NULL) || (Boundary->AtomCount < (*BigFinder)->AtomCount)) {
    16222078                    Boundary = *BigFinder;
     
    16242080                  counter++;
    16252081                }
    1626                 bool *Actives = Malloc<bool>(counter, "ParseCommandLineOptions() - case C -- *Actives");
    1627                 counter = 0;
    1628                 for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) {
    1629                   Actives[counter] = (*BigFinder)->ActiveFlag;
    1630                   (*BigFinder)->ActiveFlag = (*BigFinder == Boundary) ? false : true;
    1631                 }
    1632                 LCList = new LinkedCell(Boundary, 2.*radius);
    1633                 element *elemental = periode->FindElement((const int) atoi(argv[argptr]));
    1634                 FindNonConvexBorder(Boundary, TesselStruct, LCList, radius, NULL);
    1635                 int ranges[NDIM] = {1,1,1};
    1636                 CorrelationToSurfaceMap *surfacemap = PeriodicCorrelationToSurface( molecules, elemental, TesselStruct, LCList, ranges );
    1637                 BinPairMap *binmap = BinData( surfacemap, 0.5, 0., 0. );
    1638                 OutputCorrelation ( &binoutput, binmap );
    1639                 output.close();
    1640                 binoutput.close();
    1641                 for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++)
    1642                   (*BigFinder)->ActiveFlag = Actives[counter];
    1643                 Free(&Actives);
    1644                 delete(LCList);
    1645                 delete(TesselStruct);
    1646                 argptr+=3;
    1647               }
    1648               break;
    1649             case 'E':
    1650               if (ExitFlag == 0) ExitFlag = 1;
    1651               if ((argptr+1 >= argc) || (!IsValidNumber(argv[argptr])) || (argv[argptr+1][0] == '-')) {
    1652                 ExitFlag = 255;
    1653                 eLog() << Verbose(0) << "Not enough or invalid arguments given for changing element: -E <atom nr.> <element>" << endl;
    1654               } else {
    1655                 SaveFlag = true;
    1656                 Log() << Verbose(1) << "Changing atom " << argv[argptr] << " to element " << argv[argptr+1] << "." << endl;
    1657                 first = mol->FindAtom(atoi(argv[argptr]));
    1658                 first->type = periode->FindElement(atoi(argv[argptr+1]));
    1659                 argptr+=2;
    1660               }
    1661               break;
    1662             case 'F':
    1663               if (ExitFlag == 0) ExitFlag = 1;
    1664               if (argptr+5 >=argc) {
    1665                 ExitFlag = 255;
    1666                 eLog() << Verbose(0) << "Not enough or invalid arguments given for filling box with water: -F <dist_x> <dist_y> <dist_z> <randatom> <randmol> <DoRotate>" << endl;
    1667               } else {
    1668                 SaveFlag = true;
    1669                 Log() << Verbose(1) << "Filling Box with water molecules." << endl;
    1670                 // construct water molecule
    1671                 molecule *filler = new molecule(periode);;
    1672                 molecule *Filling = NULL;
    1673                 atom *second = NULL, *third = NULL;
    1674                 first = new atom();
    1675                 first->type = periode->FindElement(1);
    1676                 first->x.Init(0.441, -0.143, 0.);
    1677                 filler->AddAtom(first);
    1678                 second = new atom();
    1679                 second->type = periode->FindElement(1);
    1680                 second->x.Init(-0.464, 1.137, 0.0);
    1681                 filler->AddAtom(second);
    1682                 third = new atom();
    1683                 third->type = periode->FindElement(8);
    1684                 third->x.Init(-0.464, 0.177, 0.);
    1685                 filler->AddAtom(third);
    1686                 filler->AddBond(first, third, 1);
    1687                 filler->AddBond(second, third, 1);
    1688                 // call routine
    1689                 double distance[NDIM];
    1690                 for (int i=0;i<NDIM;i++)
    1691                   distance[i] = atof(argv[argptr+i]);
    1692                 Filling = FillBoxWithMolecule(molecules, filler, configuration, distance, atof(argv[argptr+3]), atof(argv[argptr+4]), atoi(argv[argptr+5]));
    1693                 if (Filling != NULL) {
    1694                   molecules->insert(Filling);
    1695                 }
    1696                 delete(filler);
    1697                 argptr+=6;
    1698               }
    1699               break;
    1700             case 'A':
    1701               if (ExitFlag == 0) ExitFlag = 1;
    1702               if ((argptr >= argc) || (argv[argptr][0] == '-')) {
    1703                 ExitFlag =255;
    1704                 eLog() << Verbose(0) << "Missing source file for bonds in molecule: -A <bond sourcefile>" << endl;
    1705               } else {
    1706                 Log() << Verbose(0) << "Parsing bonds from " << argv[argptr] << "." << endl;
    1707                 ifstream *input = new ifstream(argv[argptr]);
    1708                 mol->CreateAdjacencyListFromDbondFile(input);
    1709                 input->close();
    1710                 argptr+=1;
    1711               }
    1712               break;
    1713             case 'N':
    1714               if (ExitFlag == 0) ExitFlag = 1;
    1715               if ((argptr+1 >= argc) || (argv[argptr+1][0] == '-')){
    1716                 ExitFlag = 255;
    1717                 eLog() << Verbose(0) << "Not enough or invalid arguments given for non-convex envelope: -o <radius> <tecplot output file>" << endl;
    1718               } else {
    1719                 class Tesselation *T = NULL;
    1720                 const LinkedCell *LCList = NULL;
    1721                 string filename(argv[argptr+1]);
    1722                 filename.append(".csv");
    1723                 Log() << Verbose(0) << "Evaluating non-convex envelope.";
    1724                 Log() << Verbose(1) << "Using rolling ball of radius " << atof(argv[argptr]) << " and storing tecplot data in " << argv[argptr+1] << "." << endl;
     2082                DoLog(1) && (Log() << Verbose(1) << "Biggest molecule has " << Boundary->AtomCount << " atoms." << endl);
    17252083                start = clock();
    1726                 LCList = new LinkedCell(mol, atof(argv[argptr])*2.);
    1727                 FindNonConvexBorder(mol, T, LCList, atof(argv[argptr]), argv[argptr+1]);
     2084                LCList = new LinkedCell(Boundary, atof(argv[argptr])*2.);
     2085                if (!FindNonConvexBorder(Boundary, T, LCList, atof(argv[argptr]), argv[argptr+1]))
     2086                  ExitFlag = 255;
    17282087                //FindDistributionOfEllipsoids(T, &LCList, N, number, filename.c_str());
    17292088                end = clock();
    1730                 Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl;
     2089                DoLog(0) && (Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl);
    17312090                delete(LCList);
     2091                delete(T);
    17322092                argptr+=2;
    17332093              }
     
    17372097              if ((argptr >= argc) || (argv[argptr][0] == '-')) {
    17382098                ExitFlag = 255;
    1739                 eLog() << Verbose(0) << "Not enough or invalid arguments given for storing tempature: -S <temperature file>" << endl;
     2099                DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for storing tempature: -S <temperature file>" << endl);
     2100                performCriticalExit();
    17402101              } else {
    1741                 Log() << Verbose(1) << "Storing temperatures in " << argv[argptr] << "." << endl;
     2102                DoLog(1) && (Log() << Verbose(1) << "Storing temperatures in " << argv[argptr] << "." << endl);
    17422103                ofstream *output = new ofstream(argv[argptr], ios::trunc);
    17432104                if (!mol->OutputTemperatureFromTrajectories(output, 0, mol->MDSteps))
    1744                   Log() << Verbose(2) << "File could not be written." << endl;
     2105                  DoLog(2) && (Log() << Verbose(2) << "File could not be written." << endl);
    17452106                else
    1746                   Log() << Verbose(2) << "File stored." << endl;
     2107                  DoLog(2) && (Log() << Verbose(2) << "File stored." << endl);
    17472108                output->close();
    17482109                delete(output);
     
    17542115              if ((argptr >= argc) || (argv[argptr][0] == '-')) {
    17552116                ExitFlag = 255;
    1756                 eLog() << Verbose(0) << "Not enough or invalid arguments given for storing tempature: -L <step0> <step1> <prefix> <identity mapping?>" << endl;
     2117                DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for storing tempature: -L <step0> <step1> <prefix> <identity mapping?>" << endl);
     2118                performCriticalExit();
    17572119              } else {
    17582120                SaveFlag = true;
    1759                 Log() << Verbose(1) << "Linear interpolation between configuration " << argv[argptr] << " and " << argv[argptr+1] << "." << endl;
     2121                DoLog(1) && (Log() << Verbose(1) << "Linear interpolation between configuration " << argv[argptr] << " and " << argv[argptr+1] << "." << endl);
    17602122                if (atoi(argv[argptr+3]) == 1)
    1761                   Log() << Verbose(1) << "Using Identity for the permutation map." << endl;
     2123                  DoLog(1) && (Log() << Verbose(1) << "Using Identity for the permutation map." << endl);
    17622124                if (!mol->LinearInterpolationBetweenConfiguration(atoi(argv[argptr]), atoi(argv[argptr+1]), argv[argptr+2], configuration, atoi(argv[argptr+3])) == 1 ? true : false)
    1763                   Log() << Verbose(2) << "Could not store " << argv[argptr+2] << " files." << endl;
     2125                  DoLog(2) && (Log() << Verbose(2) << "Could not store " << argv[argptr+2] << " files." << endl);
    17642126                else
    1765                   Log() << Verbose(2) << "Steps created and " << argv[argptr+2] << " files stored." << endl;
     2127                  DoLog(2) && (Log() << Verbose(2) << "Steps created and " << argv[argptr+2] << " files stored." << endl);
    17662128                argptr+=4;
    17672129              }
     
    17712133              if ((argptr >= argc) || (argv[argptr][0] == '-')) {
    17722134                ExitFlag = 255;
    1773                 eLog() << Verbose(0) << "Not enough or invalid arguments given for parsing and integrating forces: -P <forces file>" << endl;
     2135                DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for parsing and integrating forces: -P <forces file>" << endl);
     2136                performCriticalExit();
    17742137              } else {
    17752138                SaveFlag = true;
    1776                 Log() << Verbose(1) << "Parsing forces file and Verlet integrating." << endl;
     2139                DoLog(1) && (Log() << Verbose(1) << "Parsing forces file and Verlet integrating." << endl);
    17772140                if (!mol->VerletForceIntegration(argv[argptr], configuration))
    1778                   Log() << Verbose(2) << "File not found." << endl;
     2141                  DoLog(2) && (Log() << Verbose(2) << "File not found." << endl);
    17792142                else
    1780                   Log() << Verbose(2) << "File found and parsed." << endl;
     2143                  DoLog(2) && (Log() << Verbose(2) << "File found and parsed." << endl);
    17812144                argptr+=1;
    17822145              }
     
    17862149              if ((argptr+1 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])))  {
    17872150                ExitFlag = 255;
    1788                 eLog() << Verbose(0) << "Not enough or invalid arguments given for removing atoms: -R <id> <distance>" << endl;
     2151                DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for removing atoms: -R <id> <distance>" << endl);
     2152                performCriticalExit();
    17892153              } else {
    17902154                SaveFlag = true;
    1791                 Log() << Verbose(1) << "Removing atoms around " << argv[argptr] << " with radius " << argv[argptr+1] << "." << endl;
     2155                DoLog(1) && (Log() << Verbose(1) << "Removing atoms around " << argv[argptr] << " with radius " << argv[argptr+1] << "." << endl);
    17922156                double tmp1 = atof(argv[argptr+1]);
    17932157                atom *third = mol->FindAtom(atoi(argv[argptr]));
     
    18022166                  }
    18032167                } else {
    1804                   eLog() << Verbose(0) << "Removal failed due to missing atoms on molecule or wrong id." << endl;
     2168                  DoeLog(1) && (eLog()<< Verbose(1) << "Removal failed due to missing atoms on molecule or wrong id." << endl);
    18052169                }
    18062170                argptr+=2;
     
    18112175              if ((argptr+2 >= argc) || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) ) {
    18122176                ExitFlag = 255;
    1813                 eLog() << Verbose(0) << "Not enough or invalid arguments given for translation: -t <x> <y> <z>" << endl;
     2177                DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for translation: -t <x> <y> <z>" << endl);
     2178                performCriticalExit();
    18142179              } else {
    18152180                if (ExitFlag == 0) ExitFlag = 1;
    18162181                SaveFlag = true;
    1817                 Log() << Verbose(1) << "Translating all ions by given vector." << endl;
     2182                DoLog(1) && (Log() << Verbose(1) << "Translating all ions by given vector." << endl);
    18182183                for (int i=NDIM;i--;)
    18192184                  x.x[i] = atof(argv[argptr+i]);
     
    18262191              if ((argptr+2 >= argc) || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) ) {
    18272192                ExitFlag = 255;
    1828                 eLog() << Verbose(0) << "Not enough or invalid arguments given for periodic translation: -T <x> <y> <z>" << endl;
     2193                DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for periodic translation: -T <x> <y> <z>" << endl);
     2194                performCriticalExit();
    18292195              } else {
    18302196                if (ExitFlag == 0) ExitFlag = 1;
    18312197                SaveFlag = true;
    1832                 Log() << Verbose(1) << "Translating all ions periodically by given vector." << endl;
     2198                DoLog(1) && (Log() << Verbose(1) << "Translating all ions periodically by given vector." << endl);
    18332199                for (int i=NDIM;i--;)
    18342200                  x.x[i] = atof(argv[argptr+i]);
     
    18412207              if ((argptr >= argc) || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) ) {
    18422208                ExitFlag = 255;
    1843                 eLog() << Verbose(0) << "Not enough or invalid arguments given for scaling: -s <factor_x> [factor_y] [factor_z]" << endl;
     2209                DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for scaling: -s <factor_x> [factor_y] [factor_z]" << endl);
     2210                performCriticalExit();
    18442211              } else {
    18452212                SaveFlag = true;
    18462213                j = -1;
    1847                 Log() << Verbose(1) << "Scaling all ion positions by factor." << endl;
     2214                DoLog(1) && (Log() << Verbose(1) << "Scaling all ion positions by factor." << endl);
    18482215                factor = new double[NDIM];
    18492216                factor[0] = atof(argv[argptr]);
     
    18512218                factor[2] = atof(argv[argptr+2]);
    18522219                mol->Scale((const double ** const)&factor);
     2220                double * const cell_size = World::get()->cell_size;
    18532221                for (int i=0;i<NDIM;i++) {
    18542222                  j += i+1;
    18552223                  x.x[i] = atof(argv[NDIM+i]);
    1856                   mol->cell_size[j]*=factor[i];
     2224                  cell_size[j]*=factor[i];
    18572225                }
    18582226                delete[](factor);
     
    18642232              if ((argptr+5 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) || (!IsValidNumber(argv[argptr+3])) || (!IsValidNumber(argv[argptr+4])) || (!IsValidNumber(argv[argptr+5])) ) {
    18652233                ExitFlag = 255;
    1866                 eLog() << Verbose(0) << "Not enough or invalid arguments given for centering in box: -b <xx> <xy> <xz> <yy> <yz> <zz>" << endl;
     2234                DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for centering in box: -b <xx> <xy> <xz> <yy> <yz> <zz>" << endl);
     2235                performCriticalExit();
    18672236              } else {
    18682237                SaveFlag = true;
    18692238                j = -1;
    1870                 Log() << Verbose(1) << "Centering atoms in config file within given simulation box." << endl;
     2239                DoLog(1) && (Log() << Verbose(1) << "Centering atoms in config file within given simulation box." << endl);
     2240                double * const cell_size = World::get()->cell_size;
    18712241                for (int i=0;i<6;i++) {
    1872                   mol->cell_size[i] = atof(argv[argptr+i]);
     2242                  cell_size[i] = atof(argv[argptr+i]);
    18732243                }
    18742244                // center
     
    18812251              if ((argptr+5 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) || (!IsValidNumber(argv[argptr+3])) || (!IsValidNumber(argv[argptr+4])) || (!IsValidNumber(argv[argptr+5])) ) {
    18822252                ExitFlag = 255;
    1883                 eLog() << Verbose(0) << "Not enough or invalid arguments given for bounding in box: -B <xx> <xy> <xz> <yy> <yz> <zz>" << endl;
     2253                DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for bounding in box: -B <xx> <xy> <xz> <yy> <yz> <zz>" << endl);
     2254                performCriticalExit();
    18842255              } else {
    18852256                SaveFlag = true;
    18862257                j = -1;
    1887                 Log() << Verbose(1) << "Centering atoms in config file within given simulation box." << endl;
     2258                DoLog(1) && (Log() << Verbose(1) << "Centering atoms in config file within given simulation box." << endl);
     2259                double * const cell_size = World::get()->cell_size;
    18882260                for (int i=0;i<6;i++) {
    1889                   mol->cell_size[i] = atof(argv[argptr+i]);
     2261                  cell_size[i] = atof(argv[argptr+i]);
    18902262                }
    18912263                // center
     
    18982270              if ((argptr+2 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) ) {
    18992271                ExitFlag = 255;
    1900                 eLog() << Verbose(0) << "Not enough or invalid arguments given for centering with boundary: -c <boundary_x> <boundary_y> <boundary_z>" << endl;
     2272                DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for centering with boundary: -c <boundary_x> <boundary_y> <boundary_z>" << endl);
     2273                performCriticalExit();
    19012274              } else {
    19022275                SaveFlag = true;
    19032276                j = -1;
    1904                 Log() << Verbose(1) << "Centering atoms in config file within given additional boundary." << endl;
     2277                DoLog(1) && (Log() << Verbose(1) << "Centering atoms in config file within given additional boundary." << endl);
    19052278                // make every coordinate positive
    19062279                mol->CenterEdge(&x);
     
    19082281                mol->SetBoxDimension(&x);
    19092282                // translate each coordinate by boundary
     2283                double * const cell_size = World::get()->cell_size;
    19102284                j=-1;
    19112285                for (int i=0;i<NDIM;i++) {
    19122286                  j += i+1;
    19132287                  x.x[i] = atof(argv[argptr+i]);
    1914                   mol->cell_size[j] += x.x[i]*2.;
     2288                  cell_size[j] += x.x[i]*2.;
    19152289                }
    19162290                mol->Translate((const Vector *)&x);
     
    19212295              if (ExitFlag == 0) ExitFlag = 1;
    19222296              SaveFlag = true;
    1923               Log() << Verbose(1) << "Centering atoms on edge and setting box dimensions." << endl;
     2297              DoLog(1) && (Log() << Verbose(1) << "Centering atoms on edge and setting box dimensions." << endl);
    19242298              x.Zero();
    19252299              mol->CenterEdge(&x);
     
    19312305              if ((argptr >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])))  {
    19322306                ExitFlag = 255;
    1933                 eLog() << Verbose(0) << "Not enough or invalid arguments given for removing atoms: -r <id>" << endl;
     2307                DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for removing atoms: -r <id>" << endl);
     2308                performCriticalExit();
    19342309              } else {
    19352310                SaveFlag = true;
    1936                 Log() << Verbose(1) << "Removing atom " << argv[argptr] << "." << endl;
     2311                DoLog(1) && (Log() << Verbose(1) << "Removing atom " << argv[argptr] << "." << endl);
    19372312                atom *first = mol->FindAtom(atoi(argv[argptr]));
    19382313                mol->RemoveAtom(first);
     
    19442319              if ((argptr+1 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1]))) {
    19452320                ExitFlag = 255;
    1946                 eLog() << Verbose(0) << "Not enough or invalid arguments for fragmentation: -f <max. bond distance> <bond order>" << endl;
     2321                DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments for fragmentation: -f <max. bond distance> <bond order>" << endl);
     2322                performCriticalExit();
    19472323              } else {
    1948                 Log() << Verbose(0) << "Fragmenting molecule with bond distance " << argv[argptr] << " angstroem, order of " << argv[argptr+1] << "." << endl;
    1949                 Log() << Verbose(0) << "Creating connection matrix..." << endl;
     2324                DoLog(0) && (Log() << Verbose(0) << "Fragmenting molecule with bond distance " << argv[argptr] << " angstroem, order of " << argv[argptr+1] << "." << endl);
     2325                DoLog(0) && (Log() << Verbose(0) << "Creating connection matrix..." << endl);
    19502326                start = clock();
    19512327                mol->CreateAdjacencyList(atof(argv[argptr++]), configuration.GetIsAngstroem(), &BondGraph::CovalentMinMaxDistance, NULL);
    1952                 Log() << Verbose(0) << "Fragmenting molecule with current connection matrix ..." << endl;
     2328                DoLog(0) && (Log() << Verbose(0) << "Fragmenting molecule with current connection matrix ..." << endl);
    19532329                if (mol->first->next != mol->last) {
    19542330                  ExitFlag = mol->FragmentMolecule(atoi(argv[argptr]), &configuration);
    19552331                }
    19562332                end = clock();
    1957                 Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl;
     2333                DoLog(0) && (Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl);
    19582334                argptr+=2;
    19592335              }
     
    19632339              j = atoi(argv[argptr++]);
    19642340              if ((j<0) || (j>1)) {
    1965                 eLog() << Verbose(1) << "ERROR: Argument of '-m' should be either 0 for no-rotate or 1 for rotate." << endl;
     2341                DoeLog(1) && (eLog()<< Verbose(1) << "Argument of '-m' should be either 0 for no-rotate or 1 for rotate." << endl);
    19662342                j = 0;
    19672343              }
    19682344              if (j) {
    19692345                SaveFlag = true;
    1970                 Log() << Verbose(0) << "Converting to prinicipal axis system." << endl;
     2346                DoLog(0) && (Log() << Verbose(0) << "Converting to prinicipal axis system." << endl);
    19712347              } else
    1972                 Log() << Verbose(0) << "Evaluating prinicipal axis." << endl;
     2348                DoLog(0) && (Log() << Verbose(0) << "Evaluating prinicipal axis." << endl);
    19732349              mol->PrincipalAxisSystem((bool)j);
    19742350              break;
     
    19772353              if ((argptr+1 >= argc) || (argv[argptr][0] == '-')){
    19782354                ExitFlag = 255;
    1979                 eLog() << Verbose(0) << "Not enough or invalid arguments given for convex envelope: -o <convex output file> <non-convex output file>" << endl;
     2355                DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for convex envelope: -o <convex output file> <non-convex output file>" << endl);
     2356                performCriticalExit();
    19802357              } else {
    19812358                class Tesselation *TesselStruct = NULL;
    19822359                const LinkedCell *LCList = NULL;
    1983                 Log() << Verbose(0) << "Evaluating volume of the convex envelope.";
    1984                 Log() << Verbose(1) << "Storing tecplot convex data in " << argv[argptr] << "." << endl;
    1985                 Log() << Verbose(1) << "Storing tecplot non-convex data in " << argv[argptr+1] << "." << endl;
     2360                DoLog(0) && (Log() << Verbose(0) << "Evaluating volume of the convex envelope.");
     2361                DoLog(1) && (Log() << Verbose(1) << "Storing tecplot convex data in " << argv[argptr] << "." << endl);
     2362                DoLog(1) && (Log() << Verbose(1) << "Storing tecplot non-convex data in " << argv[argptr+1] << "." << endl);
    19862363                LCList = new LinkedCell(mol, 10.);
    19872364                //FindConvexBorder(mol, LCList, argv[argptr]);
     
    19902367                double volumedifference = ConvexizeNonconvexEnvelope(TesselStruct, mol, argv[argptr]);
    19912368                double clustervolume = VolumeOfConvexEnvelope(TesselStruct, &configuration);
    1992                 Log() << Verbose(0) << "The tesselated volume area is " << clustervolume << " " << (configuration.GetIsAngstroem() ? "angstrom" : "atomiclength") << "^3." << endl;
    1993                 Log() << Verbose(0) << "The non-convex tesselated volume area is " << clustervolume-volumedifference << " " << (configuration.GetIsAngstroem() ? "angstrom" : "atomiclength") << "^3." << endl;
     2369                DoLog(0) && (Log() << Verbose(0) << "The tesselated volume area is " << clustervolume << " " << (configuration.GetIsAngstroem() ? "angstrom" : "atomiclength") << "^3." << endl);
     2370                DoLog(0) && (Log() << Verbose(0) << "The non-convex tesselated volume area is " << clustervolume-volumedifference << " " << (configuration.GetIsAngstroem() ? "angstrom" : "atomiclength") << "^3." << endl);
    19942371                delete(TesselStruct);
    19952372                delete(LCList);
     
    20012378              if ((argptr+1 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) ) {
    20022379                ExitFlag = 255;
    2003                 eLog() << Verbose(0) << "Not enough or invalid arguments given for suspension with specified volume: -U <volume> <density>" << endl;
    2004                 volume = -1; // for case 'u': don't print error again
     2380                DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for suspension with specified volume: -U <volume> <density>" << endl);
     2381                performCriticalExit();
    20052382              } else {
    20062383                volume = atof(argv[argptr++]);
    2007                 Log() << Verbose(0) << "Using " << volume << " angstrom^3 as the volume instead of convex envelope one's." << endl;
     2384                DoLog(0) && (Log() << Verbose(0) << "Using " << volume << " angstrom^3 as the volume instead of convex envelope one's." << endl);
    20082385              }
    20092386            case 'u':
     
    20122389                if (volume != -1)
    20132390                  ExitFlag = 255;
    2014                   eLog() << Verbose(0) << "Not enough arguments given for suspension: -u <density>" << endl;
     2391                  DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for suspension: -u <density>" << endl);
     2392                  performCriticalExit();
    20152393              } else {
    20162394                double density;
    20172395                SaveFlag = true;
    2018                 Log() << Verbose(0) << "Evaluating necessary cell volume for a cluster suspended in water.";
     2396                DoLog(0) && (Log() << Verbose(0) << "Evaluating necessary cell volume for a cluster suspended in water.");
    20192397                density = atof(argv[argptr++]);
    20202398                if (density < 1.0) {
    2021                   eLog() << Verbose(0) << "Density must be greater than 1.0g/cm^3 !" << endl;
     2399                  DoeLog(1) && (eLog()<< Verbose(1) << "Density must be greater than 1.0g/cm^3 !" << endl);
    20222400                  density = 1.3;
    20232401                }
     
    20252403//                  repetition[i] = atoi(argv[argptr++]);
    20262404//                  if (repetition[i] < 1)
    2027 //                    eLog() << Verbose(0) << "ERROR: repetition value must be greater 1!" << endl;
     2405//                    DoeLog(1) && (eLog()<< Verbose(1) << "repetition value must be greater 1!" << endl);
    20282406//                  repetition[i] = 1;
    20292407//                }
     
    20352413              if ((argptr+2 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) ) {
    20362414                ExitFlag = 255;
    2037                 eLog() << Verbose(0) << "Not enough or invalid arguments given for repeating cells: -d <repeat_x> <repeat_y> <repeat_z>" << endl;
     2415                DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for repeating cells: -d <repeat_x> <repeat_y> <repeat_z>" << endl);
     2416                performCriticalExit();
    20382417              } else {
    20392418                SaveFlag = true;
     2419                double * const cell_size = World::get()->cell_size;
    20402420                for (int axis = 1; axis <= NDIM; axis++) {
    20412421                  int faktor = atoi(argv[argptr++]);
     
    20442424                  Vector ** vectors;
    20452425                  if (faktor < 1) {
    2046                     eLog() << Verbose(0) << "ERROR: Repetition faktor mus be greater than 1!" << endl;
     2426                    DoeLog(1) && (eLog()<< Verbose(1) << "Repetition factor mus be greater than 1!" << endl);
    20472427                    faktor = 1;
    20482428                  }
     
    20612441                    }
    20622442                    if (count != j)
    2063                       Log() << Verbose(0) << "ERROR: AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!" << endl;
     2443                      DoeLog(1) && (eLog()<< Verbose(1) << "AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!" << endl);
    20642444                    x.Zero();
    20652445                    y.Zero();
    2066                     y.x[abs(axis)-1] = mol->cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] * abs(axis)/axis; // last term is for sign, first is for magnitude
     2446                    y.x[abs(axis)-1] = cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] * abs(axis)/axis; // last term is for sign, first is for magnitude
    20672447                    for (int i=1;i<faktor;i++) {  // then add this list with respective translation factor times
    20682448                      x.AddVector(&y); // per factor one cell width further
     
    20852465                      mol->Translate(&x);
    20862466                    }
    2087                     mol->cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] *= faktor;
     2467                    cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] *= faktor;
    20882468                  }
    20892469                }
     
    21022482  } else {  // no arguments, hence scan the elements db
    21032483    if (periode->LoadPeriodentafel(configuration.databasepath))
    2104       Log() << Verbose(0) << "Element list loaded successfully." << endl;
     2484      DoLog(0) && (Log() << Verbose(0) << "Element list loaded successfully." << endl);
    21052485    else
    2106       Log() << Verbose(0) << "Element list loading failed." << endl;
     2486      DoLog(0) && (Log() << Verbose(0) << "Element list loading failed." << endl);
    21072487    configuration.RetrieveConfigPathAndName("main_pcp_linux");
    21082488  }
     
    21262506  int j;
    21272507
    2128   setVerbosity(2);
     2508  cout << ESPACKVersion << endl;
     2509
     2510  DoLog(1) && (Log() << Verbose(1) << "test" << endl);
     2511  DoLog(3) && (Log() << Verbose(1) << "test");
     2512
     2513  setVerbosity(0);
    21292514
    21302515  // =========================== PARSE COMMAND LINE OPTIONS ====================================
     
    21422527        << MemoryUsageObserver::getInstance()->getUsedMemorySize() << endl;
    21432528      MemoryUsageObserver::getInstance()->purgeInstance();
     2529      logger::purgeInstance();
     2530      errorLogger::purgeInstance();
    21442531     return (j == 1 ? 0 : j);
    21452532    default:
     
    21502537  if (molecules->ListOfMolecules.size() == 0) {
    21512538    mol = new molecule(periode);
    2152     if (mol->cell_size[0] == 0.) {
    2153       Log() << Verbose(0) << "enter lower tridiagonal form of basis matrix" << endl << endl;
     2539    double * const cell_size = World::get()->cell_size;
     2540    if (cell_size[0] == 0.) {
     2541      DoLog(0) && (Log() << Verbose(0) << "enter lower tridiagonal form of basis matrix" << endl << endl);
    21542542      for (int i=0;i<6;i++) {
    2155         Log() << Verbose(1) << "Cell size" << i << ": ";
    2156         cin >> mol->cell_size[i];
     2543        DoLog(1) && (Log() << Verbose(1) << "Cell size" << i << ": ");
     2544        cin >> cell_size[i];
    21572545      }
    21582546    }
     
    21642552
    21652553  // now the main construction loop
    2166   Log() << Verbose(0) << endl << "Now comes the real construction..." << endl;
     2554  DoLog(0) && (Log() << Verbose(0) << endl << "Now comes the real construction..." << endl);
    21672555  do {
    2168     Log() << Verbose(0) << endl << endl;
    2169     Log() << Verbose(0) << "============Molecule list=======================" << endl;
     2556    DoLog(0) && (Log() << Verbose(0) << endl << endl);
     2557    DoLog(0) && (Log() << Verbose(0) << "============Molecule list=======================" << endl);
    21702558    molecules->Enumerate((ofstream *)&cout);
    2171     Log() << Verbose(0) << "============Menu===============================" << endl;
    2172     Log() << Verbose(0) << "a - set molecule (in)active" << endl;
    2173     Log() << Verbose(0) << "e - edit molecules (load, parse, save)" << endl;
    2174     Log() << Verbose(0) << "g - globally manipulate atoms in molecule" << endl;
    2175     Log() << Verbose(0) << "M - Merge molecules" << endl;
    2176     Log() << Verbose(0) << "m - manipulate atoms" << endl;
    2177     Log() << Verbose(0) << "-----------------------------------------------" << endl;
    2178     Log() << Verbose(0) << "c - edit the current configuration" << endl;
    2179     Log() << Verbose(0) << "-----------------------------------------------" << endl;
    2180     Log() << Verbose(0) << "s - save current setup to config file" << endl;
    2181     Log() << Verbose(0) << "T - call the current test routine" << endl;
    2182     Log() << Verbose(0) << "q - quit" << endl;
    2183     Log() << Verbose(0) << "===============================================" << endl;
    2184     Log() << Verbose(0) << "Input: ";
     2559    DoLog(0) && (Log() << Verbose(0) << "============Menu===============================" << endl);
     2560    DoLog(0) && (Log() << Verbose(0) << "a - set molecule (in)active" << endl);
     2561    DoLog(0) && (Log() << Verbose(0) << "e - edit molecules (load, parse, save)" << endl);
     2562    DoLog(0) && (Log() << Verbose(0) << "g - globally manipulate atoms in molecule" << endl);
     2563    DoLog(0) && (Log() << Verbose(0) << "M - Merge molecules" << endl);
     2564    DoLog(0) && (Log() << Verbose(0) << "m - manipulate atoms" << endl);
     2565    DoLog(0) && (Log() << Verbose(0) << "-----------------------------------------------" << endl);
     2566    DoLog(0) && (Log() << Verbose(0) << "c - edit the current configuration" << endl);
     2567    DoLog(0) && (Log() << Verbose(0) << "-----------------------------------------------" << endl);
     2568    DoLog(0) && (Log() << Verbose(0) << "s - save current setup to config file" << endl);
     2569    DoLog(0) && (Log() << Verbose(0) << "T - call the current test routine" << endl);
     2570    DoLog(0) && (Log() << Verbose(0) << "q - quit" << endl);
     2571    DoLog(0) && (Log() << Verbose(0) << "===============================================" << endl);
     2572    DoLog(0) && (Log() << Verbose(0) << "Input: ");
    21852573    cin >> choice;
    21862574
     
    21882576      case 'a':  // (in)activate molecule
    21892577        {
    2190           Log() << Verbose(0) << "Enter index of molecule: ";
     2578          DoLog(0) && (Log() << Verbose(0) << "Enter index of molecule: ");
    21912579          cin >> j;
    21922580          for(MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     
    22342622  // save element data base
    22352623  if (periode->StorePeriodentafel(configuration->databasepath)) //ElementsFileName
    2236     Log() << Verbose(0) << "Saving of elements.db successful." << endl;
     2624    DoLog(0) && (Log() << Verbose(0) << "Saving of elements.db successful." << endl);
    22372625  else
    2238     Log() << Verbose(0) << "Saving of elements.db failed." << endl;
     2626    DoLog(0) && (Log() << Verbose(0) << "Saving of elements.db failed." << endl);
    22392627
    22402628  delete(molecules); // also free's all molecules contained
     
    22472635    << MemoryUsageObserver::getInstance()->getUsedMemorySize() << endl;
    22482636  MemoryUsageObserver::purgeInstance();
     2637  logger::purgeInstance();
     2638  errorLogger::purgeInstance();
    22492639
    22502640  return (0);
Note: See TracChangeset for help on using the changeset viewer.