Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/builder.cpp

    r481601 ra67d19  
    5252#include <cstring>
    5353
     54#include "analysis_bonds.hpp"
    5455#include "analysis_correlation.hpp"
    5556#include "atom.hpp"
     
    6869#include "periodentafel.hpp"
    6970#include "version.h"
     71#include "World.hpp"
    7072
    7173/********************************************* Subsubmenu routine ************************************/
     
    8486  bool valid;
    8587
    86   Log() << Verbose(0) << "===========ADD ATOM============================" << endl;
    87   Log() << Verbose(0) << " a - state absolute coordinates of atom" << endl;
    88   Log() << Verbose(0) << " b - state relative coordinates of atom wrt to reference point" << endl;
    89   Log() << Verbose(0) << " c - state relative coordinates of atom wrt to already placed atom" << endl;
    90   Log() << Verbose(0) << " d - state two atoms, two angles and a distance" << endl;
    91   Log() << Verbose(0) << " e - least square distance position to a set of atoms" << endl;
    92   Log() << Verbose(0) << "all else - go back" << endl;
    93   Log() << Verbose(0) << "===============================================" << endl;
    94   Log() << Verbose(0) << "Note: Specifiy angles in degrees not multiples of Pi!" << endl;
    95   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: ";
    9698  cin >> choice;
    9799
    98100  switch (choice) {
    99101    default:
    100       eLog() << Verbose(2) << "Not a valid choice." << endl;
     102      DoeLog(2) && (eLog()<< Verbose(2) << "Not a valid choice." << endl);
    101103      break;
    102104      case 'a': // absolute coordinates of atom
    103         Log() << Verbose(0) << "Enter absolute coordinates." << endl;
     105        cout << Verbose(0) << "Enter absolute coordinates." << endl;
    104106        first = new atom;
    105         first->x.AskPosition(mol->cell_size, false);
     107        first->x.AskPosition(World::get()->cell_size, false);
    106108        first->type = periode->AskElement();  // give type
    107109        mol->AddAtom(first);  // add to molecule
     
    112114        valid = true;
    113115        do {
    114           if (!valid) eLog() << Verbose(2) << "Resulting position out of cell." << endl;
    115           Log() << Verbose(0) << "Enter reference coordinates." << endl;
    116           x.AskPosition(mol->cell_size, true);
    117           Log() << Verbose(0) << "Enter relative coordinates." << endl;
    118           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);
    119121          first->x.AddVector((const Vector *)&x);
    120           Log() << Verbose(0) << "\n";
     122          cout << Verbose(0) << "\n";
    121123        } while (!(valid = mol->CheckBounds((const Vector *)&first->x)));
    122124        first->type = periode->AskElement();  // give type
     
    128130        valid = true;
    129131        do {
    130           if (!valid) eLog() << Verbose(2) << "Resulting position out of cell." << endl;
     132          if (!valid) DoeLog(2) && (eLog()<< Verbose(2) << "Resulting position out of cell." << endl);
    131133          second = mol->AskAtom("Enter atom number: ");
    132           Log() << Verbose(0) << "Enter relative coordinates." << endl;
    133           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);
    134136          for (int i=NDIM;i--;) {
    135137            first->x.x[i] += second->x.x[i];
     
    145147        do {
    146148          if (!valid) {
    147             eLog() << Verbose(2) << "Resulting coordinates out of cell - " << first->x << endl;
     149            DoeLog(2) && (eLog()<< Verbose(2) << "Resulting coordinates out of cell - " << first->x << endl);
    148150          }
    149           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;
    150152          second = mol->AskAtom("Enter central atom: ");
    151153          third = mol->AskAtom("Enter second atom (specifying the axis for first angle): ");
     
    158160          c *= M_PI/180.;
    159161          bound(&c, -M_PI, M_PI);
    160           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;
    161163/*
    162164          second->Output(1,1,(ofstream *)&cout);
     
    170172
    171173          if (!z.SolveSystem(&x,&y,&n, b, c, a)) {
    172             Log() << Verbose(0) << "Failure solving self-dependent linear system!" << endl;
     174         coutg() << Verbose(0) << "Failure solving self-dependent linear system!" << endl;
    173175            continue;
    174176          }
    175           Log() << Verbose(0) << "resulting relative coordinates: ";
     177          DoLog(0) && (Log() << Verbose(0) << "resulting relative coordinates: ");
    176178          z.Output();
    177           Log() << Verbose(0) << endl;
     179          DoLog(0) && (Log() << Verbose(0) << endl);
    178180          */
    179181          // calc axis vector
     
    183185          Log() << Verbose(0) << "x: ",
    184186          x.Output();
    185           Log() << Verbose(0) << endl;
     187          DoLog(0) && (Log() << Verbose(0) << endl);
    186188          z.MakeNormalVector(&second->x,&third->x,&fourth->x);
    187189          Log() << Verbose(0) << "z: ",
    188190          z.Output();
    189           Log() << Verbose(0) << endl;
     191          DoLog(0) && (Log() << Verbose(0) << endl);
    190192          y.MakeNormalVector(&x,&z);
    191193          Log() << Verbose(0) << "y: ",
    192194          y.Output();
    193           Log() << Verbose(0) << endl;
     195          DoLog(0) && (Log() << Verbose(0) << endl);
    194196
    195197          // rotate vector around first angle
     
    198200          Log() << Verbose(0) << "Rotated vector: ",
    199201          first->x.Output();
    200           Log() << Verbose(0) << endl;
     202          DoLog(0) && (Log() << Verbose(0) << endl);
    201203          // remove the projection onto the rotation plane of the second angle
    202204          n.CopyVector(&y);
     
    204206          Log() << Verbose(0) << "N1: ",
    205207          n.Output();
    206           Log() << Verbose(0) << endl;
     208          DoLog(0) && (Log() << Verbose(0) << endl);
    207209          first->x.SubtractVector(&n);
    208210          Log() << Verbose(0) << "Subtracted vector: ",
    209211          first->x.Output();
    210           Log() << Verbose(0) << endl;
     212          DoLog(0) && (Log() << Verbose(0) << endl);
    211213          n.CopyVector(&z);
    212214          n.Scale(first->x.ScalarProduct(&z));
    213215          Log() << Verbose(0) << "N2: ",
    214216          n.Output();
    215           Log() << Verbose(0) << endl;
     217          DoLog(0) && (Log() << Verbose(0) << endl);
    216218          first->x.SubtractVector(&n);
    217219          Log() << Verbose(0) << "2nd subtracted vector: ",
    218220          first->x.Output();
    219           Log() << Verbose(0) << endl;
     221          DoLog(0) && (Log() << Verbose(0) << endl);
    220222
    221223          // rotate another vector around second angle
     
    224226          Log() << Verbose(0) << "2nd Rotated vector: ",
    225227          n.Output();
    226           Log() << Verbose(0) << endl;
     228          DoLog(0) && (Log() << Verbose(0) << endl);
    227229
    228230          // add the two linear independent vectors
     
    232234          first->x.AddVector(&second->x);
    233235
    234           Log() << Verbose(0) << "resulting coordinates: ";
     236          DoLog(0) && (Log() << Verbose(0) << "resulting coordinates: ");
    235237          first->x.Output();
    236           Log() << Verbose(0) << endl;
     238          DoLog(0) && (Log() << Verbose(0) << endl);
    237239        } while (!(valid = mol->CheckBounds((const Vector *)&first->x)));
    238240        first->type = periode->AskElement();  // give type
     
    247249          atoms[i] = NULL;
    248250        int i=0, j=0;
    249         Log() << Verbose(0) << "Now we need at least three molecules.\n";
     251        cout << Verbose(0) << "Now we need at least three molecules.\n";
    250252        do {
    251           Log() << Verbose(0) << "Enter " << i+1 << "th atom: ";
     253          cout << Verbose(0) << "Enter " << i+1 << "th atom: ";
    252254          cin >> j;
    253255          if (j != -1) {
     
    264266        } else {
    265267          delete first;
    266           Log() << Verbose(0) << "Please enter at least two vectors!\n";
     268          cout << Verbose(0) << "Please enter at least two vectors!\n";
    267269        }
    268270        break;
     
    278280  char choice;  // menu choice char
    279281
    280   Log() << Verbose(0) << "===========CENTER ATOMS=========================" << endl;
    281   Log() << Verbose(0) << " a - on origin" << endl;
    282   Log() << Verbose(0) << " b - on center of gravity" << endl;
    283   Log() << Verbose(0) << " c - within box with additional boundary" << endl;
    284   Log() << Verbose(0) << " d - within given simulation box" << endl;
    285   Log() << Verbose(0) << "all else - go back" << endl;
    286   Log() << Verbose(0) << "===============================================" << endl;
    287   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: ";
    288290  cin >> choice;
    289291
    290292  switch (choice) {
    291293    default:
    292       Log() << Verbose(0) << "Not a valid choice." << endl;
     294      cout << Verbose(0) << "Not a valid choice." << endl;
    293295      break;
    294296    case 'a':
    295       Log() << Verbose(0) << "Centering atoms in config file on origin." << endl;
     297      cout << Verbose(0) << "Centering atoms in config file on origin." << endl;
    296298      mol->CenterOrigin();
    297299      break;
    298300    case 'b':
    299       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;
    300302      mol->CenterPeriodic();
    301303      break;
    302304    case 'c':
    303       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;
    304306      for (int i=0;i<NDIM;i++) {
    305         Log() << Verbose(0) << "Enter axis " << i << " boundary: ";
     307        cout << Verbose(0) << "Enter axis " << i << " boundary: ";
    306308        cin >> y.x[i];
    307309      }
     
    314316      break;
    315317    case 'd':
    316       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;
    317319      for (int i=0;i<NDIM;i++) {
    318         Log() << Verbose(0) << "Enter axis " << i << " boundary: ";
     320        cout << Verbose(0) << "Enter axis " << i << " boundary: ";
    319321        cin >> x.x[i];
    320322      }
     
    337339  char choice;  // menu choice char
    338340
    339   Log() << Verbose(0) << "===========ALIGN ATOMS=========================" << endl;
    340   Log() << Verbose(0) << " a - state three atoms defining align plane" << endl;
    341   Log() << Verbose(0) << " b - state alignment vector" << endl;
    342   Log() << Verbose(0) << " c - state two atoms in alignment direction" << endl;
    343   Log() << Verbose(0) << " d - align automatically by least square fit" << endl;
    344   Log() << Verbose(0) << "all else - go back" << endl;
    345   Log() << Verbose(0) << "===============================================" << endl;
    346   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: ";
    347349  cin >> choice;
    348350
     
    357359      break;
    358360    case 'b': // normal vector of mirror plane
    359       Log() << Verbose(0) << "Enter normal vector of mirror plane." << endl;
    360       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);
    361363      n.Normalize();
    362364      break;
     
    377379        fscanf(stdin, "%3s", shorthand);
    378380      } while ((param.type = periode->FindElement(shorthand)) == NULL);
    379       Log() << Verbose(0) << "Element is " << param.type->name << endl;
     381      cout << Verbose(0) << "Element is " << param.type->name << endl;
    380382      mol->GetAlignvector(&param);
    381383      for (int i=NDIM;i--;) {
     
    384386      }
    385387      gsl_vector_free(param.x);
    386       Log() << Verbose(0) << "Offset vector: ";
     388      cout << Verbose(0) << "Offset vector: ";
    387389      x.Output();
    388       Log() << Verbose(0) << endl;
     390      DoLog(0) && (Log() << Verbose(0) << endl);
    389391      n.Normalize();
    390392      break;
    391393  };
    392   Log() << Verbose(0) << "Alignment vector: ";
     394  DoLog(0) && (Log() << Verbose(0) << "Alignment vector: ");
    393395  n.Output();
    394   Log() << Verbose(0) << endl;
     396  DoLog(0) && (Log() << Verbose(0) << endl);
    395397  mol->Align(&n);
    396398};
     
    405407  char choice;  // menu choice char
    406408
    407   Log() << Verbose(0) << "===========MIRROR ATOMS=========================" << endl;
    408   Log() << Verbose(0) << " a - state three atoms defining mirror plane" << endl;
    409   Log() << Verbose(0) << " b - state normal vector of mirror plane" << endl;
    410   Log() << Verbose(0) << " c - state two atoms in normal direction" << endl;
    411   Log() << Verbose(0) << "all else - go back" << endl;
    412   Log() << Verbose(0) << "===============================================" << endl;
    413   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: ");
    414416  cin >> choice;
    415417
     
    424426      break;
    425427    case 'b': // normal vector of mirror plane
    426       Log() << Verbose(0) << "Enter normal vector of mirror plane." << endl;
    427       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);
    428430      n.Normalize();
    429431      break;
     
    437439      break;
    438440  };
    439   Log() << Verbose(0) << "Normal vector: ";
     441  DoLog(0) && (Log() << Verbose(0) << "Normal vector: ");
    440442  n.Output();
    441   Log() << Verbose(0) << endl;
     443  DoLog(0) && (Log() << Verbose(0) << endl);
    442444  mol->Mirror((const Vector *)&n);
    443445};
     
    453455  char choice;  // menu choice char
    454456
    455   Log() << Verbose(0) << "===========REMOVE ATOMS=========================" << endl;
    456   Log() << Verbose(0) << " a - state atom for removal by number" << endl;
    457   Log() << Verbose(0) << " b - keep only in radius around atom" << endl;
    458   Log() << Verbose(0) << " c - remove this with one axis greater value" << endl;
    459   Log() << Verbose(0) << "all else - go back" << endl;
    460   Log() << Verbose(0) << "===============================================" << endl;
    461   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: ");
    462464  cin >> choice;
    463465
     
    466468    case 'a':
    467469      if (mol->RemoveAtom(mol->AskAtom("Enter number of atom within molecule: ")))
    468         Log() << Verbose(1) << "Atom removed." << endl;
     470        DoLog(1) && (Log() << Verbose(1) << "Atom removed." << endl);
    469471      else
    470         Log() << Verbose(1) << "Atom not found." << endl;
     472        DoLog(1) && (Log() << Verbose(1) << "Atom not found." << endl);
    471473      break;
    472474    case 'b':
    473475      second = mol->AskAtom("Enter number of atom as reference point: ");
    474       Log() << Verbose(0) << "Enter radius: ";
     476      DoLog(0) && (Log() << Verbose(0) << "Enter radius: ");
    475477      cin >> tmp1;
    476478      first = mol->start;
     
    484486      break;
    485487    case 'c':
    486       Log() << Verbose(0) << "Which axis is it: ";
     488      DoLog(0) && (Log() << Verbose(0) << "Which axis is it: ");
    487489      cin >> axis;
    488       Log() << Verbose(0) << "Lower boundary: ";
     490      DoLog(0) && (Log() << Verbose(0) << "Lower boundary: ");
    489491      cin >> tmp1;
    490       Log() << Verbose(0) << "Upper boundary: ";
     492      DoLog(0) && (Log() << Verbose(0) << "Upper boundary: ");
    491493      cin >> tmp2;
    492494      first = mol->start;
     
    518520  char choice;  // menu choice char
    519521
    520   Log() << Verbose(0) << "===========MEASURE ATOMS=========================" << endl;
    521   Log() << Verbose(0) << " a - calculate bond length between one atom and all others" << endl;
    522   Log() << Verbose(0) << " b - calculate bond length between two atoms" << endl;
    523   Log() << Verbose(0) << " c - calculate bond angle" << endl;
    524   Log() << Verbose(0) << " d - calculate principal axis of the system" << endl;
    525   Log() << Verbose(0) << " e - calculate volume of the convex envelope" << endl;
    526   Log() << Verbose(0) << " f - calculate temperature from current velocity" << endl;
    527   Log() << Verbose(0) << " g - output all temperatures per step from velocities" << endl;
    528   Log() << Verbose(0) << "all else - go back" << endl;
    529   Log() << Verbose(0) << "===============================================" << endl;
    530   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: ");
    531533  cin >> choice;
    532534
    533535  switch(choice) {
    534536    default:
    535       Log() << Verbose(1) << "Not a valid choice." << endl;
     537      DoLog(1) && (Log() << Verbose(1) << "Not a valid choice." << endl);
    536538      break;
    537539    case 'a':
     
    565567      x.SubtractVector((const Vector *)&second->x);
    566568      tmp1 = x.Norm();
    567       Log() << Verbose(1) << "Distance vector is ";
     569      DoLog(1) && (Log() << Verbose(1) << "Distance vector is ");
    568570      x.Output();
    569       Log() << Verbose(0) << "." << endl << "Norm of distance is " << tmp1 << "." << endl;
     571      DoLog(0) && (Log() << Verbose(0) << "." << endl << "Norm of distance is " << tmp1 << "." << endl);
    570572      break;
    571573
    572574    case 'c':
    573       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);
    574576      first = mol->AskAtom("Enter first atom: ");
    575577      second = mol->AskAtom("Enter central atom: ");
     
    580582      y.CopyVector((const Vector *)&third->x);
    581583      y.SubtractVector((const Vector *)&second->x);
    582       Log() << Verbose(0) << "Bond angle between first atom Nr." << first->nr << ", central atom Nr." << second->nr << " and last atom Nr." << third->nr << ": ";
    583       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);
    584586      break;
    585587    case 'd':
    586       Log() << Verbose(0) << "Evaluating prinicipal axis." << endl;
    587       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]: ");
    588590      cin >> Z;
    589591      if ((Z >=0) && (Z <=1))
     
    594596    case 'e':
    595597      {
    596         Log() << Verbose(0) << "Evaluating volume of the convex envelope.";
     598        DoLog(0) && (Log() << Verbose(0) << "Evaluating volume of the convex envelope.");
    597599        class Tesselation *TesselStruct = NULL;
    598600        const LinkedCell *LCList = NULL;
     
    600602        FindConvexBorder(mol, TesselStruct, LCList, NULL);
    601603        double clustervolume = VolumeOfConvexEnvelope(TesselStruct, configuration);
    602         Log() << Verbose(0) << "The tesselated surface area is " << clustervolume << "." << endl;\
     604        DoLog(0) && (Log() << Verbose(0) << "The tesselated surface area is " << clustervolume << "." << endl);\
    603605        delete(LCList);
    604606        delete(TesselStruct);
     
    611613      {
    612614        char filename[255];
    613         Log() << Verbose(0) << "Please enter filename: " << endl;
     615        DoLog(0) && (Log() << Verbose(0) << "Please enter filename: " << endl);
    614616        cin >> filename;
    615         Log() << Verbose(1) << "Storing temperatures in " << filename << "." << endl;
     617        DoLog(1) && (Log() << Verbose(1) << "Storing temperatures in " << filename << "." << endl);
    616618        ofstream *output = new ofstream(filename, ios::trunc);
    617619        if (!mol->OutputTemperatureFromTrajectories(output, 0, mol->MDSteps))
    618           Log() << Verbose(2) << "File could not be written." << endl;
     620          DoLog(2) && (Log() << Verbose(2) << "File could not be written." << endl);
    619621        else
    620           Log() << Verbose(2) << "File stored." << endl;
     622          DoLog(2) && (Log() << Verbose(2) << "File stored." << endl);
    621623        output->close();
    622624        delete(output);
     
    635637  clock_t start, end;
    636638
    637   Log() << Verbose(0) << "Fragmenting molecule with current connection matrix ..." << endl;
    638   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: ");
    639641  cin >> Order1;
    640642  if (mol->first->next != mol->last) {  // there are bonds
     
    642644    mol->FragmentMolecule(Order1, configuration);
    643645    end = clock();
    644     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);
    645647  } else
    646     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);
    647649};
    648650
     
    655657static void ManipulateAtoms(periodentafel *periode, MoleculeListClass *molecules, config *configuration)
    656658{
    657   atom *first, *second;
     659  atom *first, *second, *third;
    658660  molecule *mol = NULL;
    659661  Vector x,y,z,n; // coordinates for absolute point in cell volume
     
    663665  bool valid;
    664666
    665   Log() << Verbose(0) << "=========MANIPULATE ATOMS======================" << endl;
    666   Log() << Verbose(0) << "a - add an atom" << endl;
    667   Log() << Verbose(0) << "r - remove an atom" << endl;
    668   Log() << Verbose(0) << "b - scale a bond between atoms" << endl;
    669   Log() << Verbose(0) << "u - change an atoms element" << endl;
    670   Log() << Verbose(0) << "l - measure lengths, angles, ... for an atom" << endl;
    671   Log() << Verbose(0) << "all else - go back" << endl;
    672   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);
    673676  if (molecules->NumberOfActiveMolecules() > 1)
    674     eLog() << Verbose(2) << "There is more than one molecule active! Atoms will be added to each." << endl;
    675   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: ");
    676679  cin >> choice;
    677680
    678681  switch (choice) {
    679682    default:
    680       Log() << Verbose(0) << "Not a valid choice." << endl;
     683      DoLog(0) && (Log() << Verbose(0) << "Not a valid choice." << endl);
    681684      break;
    682685
     
    685688        if ((*ListRunner)->ActiveFlag) {
    686689        mol = *ListRunner;
    687         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);
    688691        AddAtoms(periode, mol);
    689692      }
     
    694697        if ((*ListRunner)->ActiveFlag) {
    695698        mol = *ListRunner;
    696         Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
    697         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);
    698701        first = mol->AskAtom("Enter first (fixed) atom: ");
    699702        second = mol->AskAtom("Enter second (shifting) atom: ");
     
    702705          minBond += (first->x.x[i]-second->x.x[i])*(first->x.x[i] - second->x.x[i]);
    703706        minBond = sqrt(minBond);
    704         Log() << Verbose(0) << "Current Bond length between " << first->type->name << " Atom " << first->nr << " and " << second->type->name << " Atom " << second->nr << ": " << minBond << " a.u." << endl;
    705         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.]: ");
    706709        cin >> bond;
    707710        for (int i=NDIM;i--;) {
     
    717720        if ((*ListRunner)->ActiveFlag) {
    718721        mol = *ListRunner;
    719         Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
    720        Log() << Verbose(0) << "Angstroem -> Bohrradius: 1.8897261\t\tBohrradius -> Angstroem: 0.52917721" << endl;
    721        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: ");
    722725       factor = new double[NDIM];
    723726       cin >> factor[0];
     
    734737        if ((*ListRunner)->ActiveFlag) {
    735738        mol = *ListRunner;
    736         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);
    737740        MeasureAtoms(periode, mol, configuration);
    738741      }
     
    743746        if ((*ListRunner)->ActiveFlag) {
    744747        mol = *ListRunner;
    745         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);
    746749        RemoveAtoms(mol);
    747750      }
     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        }
    748784      break;
    749785
     
    753789        int Z;
    754790        mol = *ListRunner;
    755         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);
    756792        first = NULL;
    757793        do {
    758           Log() << Verbose(0) << "Change the element of which atom: ";
     794          DoLog(0) && (Log() << Verbose(0) << "Change the element of which atom: ");
    759795          cin >> Z;
    760796        } while ((first = mol->FindAtom(Z)) == NULL);
    761         Log() << Verbose(0) << "New element by atomic number Z: ";
     797        DoLog(0) && (Log() << Verbose(0) << "New element by atomic number Z: ");
    762798        cin >> Z;
    763799        first->type = periode->FindElement(Z);
    764         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);
    765801      }
    766802      break;
     
    783819  MoleculeLeafClass *Subgraphs = NULL;
    784820
    785   Log() << Verbose(0) << "=========MANIPULATE GLOBALLY===================" << endl;
    786   Log() << Verbose(0) << "c - scale by unit transformation" << endl;
    787   Log() << Verbose(0) << "d - duplicate molecule/periodic cell" << endl;
    788   Log() << Verbose(0) << "f - fragment molecule many-body bond order style" << endl;
    789   Log() << Verbose(0) << "g - center atoms in box" << endl;
    790   Log() << Verbose(0) << "i - realign molecule" << endl;
    791   Log() << Verbose(0) << "m - mirror all molecules" << endl;
    792   Log() << Verbose(0) << "o - create connection matrix" << endl;
    793   Log() << Verbose(0) << "t - translate molecule by vector" << endl;
    794   Log() << Verbose(0) << "all else - go back" << endl;
    795   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);
    796832  if (molecules->NumberOfActiveMolecules() > 1)
    797     eLog() << Verbose(2) << "There is more than one molecule active! Atoms will be added to each." << endl;
    798   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: ");
    799835  cin >> choice;
    800836
    801837  switch (choice) {
    802838    default:
    803       Log() << Verbose(0) << "Not a valid choice." << endl;
     839      DoLog(0) && (Log() << Verbose(0) << "Not a valid choice." << endl);
    804840      break;
    805841
     
    808844        if ((*ListRunner)->ActiveFlag) {
    809845        mol = *ListRunner;
    810         Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
    811         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]: ");
    812848        cin >> axis;
    813         Log() << Verbose(0) << "State the factor: ";
     849        DoLog(0) && (Log() << Verbose(0) << "State the factor: ");
    814850        cin >> faktor;
    815851
     
    828864          }
    829865          if (count != j)
    830             eLog() << Verbose(1) << "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);
    831867          x.Zero();
    832868          y.Zero();
    833           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
    834870          for (int i=1;i<faktor;i++) {  // then add this list with respective translation factor times
    835871            x.AddVector(&y); // per factor one cell width further
     
    854890            mol->Translate(&x);
    855891          }
    856           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;
    857893        }
    858894      }
     
    867903        if ((*ListRunner)->ActiveFlag) {
    868904        mol = *ListRunner;
    869         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);
    870906        CenterAtoms(mol);
    871907      }
     
    876912        if ((*ListRunner)->ActiveFlag) {
    877913        mol = *ListRunner;
    878         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);
    879915        AlignAtoms(periode, mol);
    880916      }
     
    885921        if ((*ListRunner)->ActiveFlag) {
    886922        mol = *ListRunner;
    887         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);
    888924        MirrorAtoms(mol);
    889925      }
     
    896932          double bonddistance;
    897933          clock_t start,end;
    898           Log() << Verbose(0) << "What's the maximum bond distance: ";
     934          DoLog(0) && (Log() << Verbose(0) << "What's the maximum bond distance: ");
    899935          cin >> bonddistance;
    900936          start = clock();
    901937          mol->CreateAdjacencyList(bonddistance, configuration->GetIsAngstroem(), &BondGraph::CovalentMinMaxDistance, NULL);
    902938          end = clock();
    903           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);
    904940        }
    905941      break;
     
    909945        if ((*ListRunner)->ActiveFlag) {
    910946        mol = *ListRunner;
    911         Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
    912         Log() << Verbose(0) << "Enter translation vector." << endl;
    913         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);
    914950        mol->Center.AddVector((const Vector *)&x);
    915951     }
     
    938974  molecule *mol = NULL;
    939975
    940   Log() << Verbose(0) << "==========EDIT MOLECULES=====================" << endl;
    941   Log() << Verbose(0) << "c - create new molecule" << endl;
    942   Log() << Verbose(0) << "l - load molecule from xyz file" << endl;
    943   Log() << Verbose(0) << "n - change molecule's name" << endl;
    944   Log() << Verbose(0) << "N - give molecules filename" << endl;
    945   Log() << Verbose(0) << "p - parse atoms in xyz file into molecule" << endl;
    946   Log() << Verbose(0) << "r - remove a molecule" << endl;
    947   Log() << Verbose(0) << "all else - go back" << endl;
    948   Log() << Verbose(0) << "===============================================" << endl;
    949   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: ");
    950986  cin >> choice;
    951987
    952988  switch (choice) {
    953989    default:
    954       Log() << Verbose(0) << "Not a valid choice." << endl;
     990      DoLog(0) && (Log() << Verbose(0) << "Not a valid choice." << endl);
    955991      break;
    956992    case 'c':
     
    962998      {
    963999        char filename[MAXSTRINGSIZE];
    964         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);
    9651001        mol = new molecule(periode);
    9661002        do {
    967           Log() << Verbose(0) << "Enter file name: ";
     1003          DoLog(0) && (Log() << Verbose(0) << "Enter file name: ");
    9681004          cin >> filename;
    9691005        } while (!mol->AddXYZFile(filename));
     
    9711007        // center at set box dimensions
    9721008        mol->CenterEdge(&center);
    973         mol->cell_size[0] = center.x[0];
    974         mol->cell_size[1] = 0;
    975         mol->cell_size[2] = center.x[1];
    976         mol->cell_size[3] = 0;
    977         mol->cell_size[4] = 0;
    978         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];
    9791016        molecules->insert(mol);
    9801017      }
     
    9851022        char filename[MAXSTRINGSIZE];
    9861023        do {
    987           Log() << Verbose(0) << "Enter index of molecule: ";
     1024          DoLog(0) && (Log() << Verbose(0) << "Enter index of molecule: ");
    9881025          cin >> nr;
    9891026          mol = molecules->ReturnIndex(nr);
    9901027        } while (mol == NULL);
    991         Log() << Verbose(0) << "Enter name: ";
     1028        DoLog(0) && (Log() << Verbose(0) << "Enter name: ");
    9921029        cin >> filename;
    9931030        strcpy(mol->name, filename);
     
    9991036        char filename[MAXSTRINGSIZE];
    10001037        do {
    1001           Log() << Verbose(0) << "Enter index of molecule: ";
     1038          DoLog(0) && (Log() << Verbose(0) << "Enter index of molecule: ");
    10021039          cin >> nr;
    10031040          mol = molecules->ReturnIndex(nr);
    10041041        } while (mol == NULL);
    1005         Log() << Verbose(0) << "Enter name: ";
     1042        DoLog(0) && (Log() << Verbose(0) << "Enter name: ");
    10061043        cin >> filename;
    10071044        mol->SetNameFromFilename(filename);
     
    10141051        mol = NULL;
    10151052        do {
    1016           Log() << Verbose(0) << "Enter index of molecule: ";
     1053          DoLog(0) && (Log() << Verbose(0) << "Enter index of molecule: ");
    10171054          cin >> nr;
    10181055          mol = molecules->ReturnIndex(nr);
    10191056        } while (mol == NULL);
    1020         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);
    10211058        do {
    1022           Log() << Verbose(0) << "Enter file name: ";
     1059          DoLog(0) && (Log() << Verbose(0) << "Enter file name: ");
    10231060          cin >> filename;
    10241061        } while (!mol->AddXYZFile(filename));
     
    10281065
    10291066    case 'r':
    1030       Log() << Verbose(0) << "Enter index of molecule: ";
     1067      DoLog(0) && (Log() << Verbose(0) << "Enter index of molecule: ");
    10311068      cin >> nr;
    10321069      count = 1;
     
    10511088  char choice;  // menu choice char
    10521089
    1053   Log() << Verbose(0) << "===========MERGE MOLECULES=====================" << endl;
    1054   Log() << Verbose(0) << "a - simple add of one molecule to another" << endl;
    1055   Log() << Verbose(0) << "e - embedding merge of two molecules" << endl;
    1056   Log() << Verbose(0) << "m - multi-merge of all molecules" << endl;
    1057   Log() << Verbose(0) << "s - scatter merge of two molecules" << endl;
    1058   Log() << Verbose(0) << "t - simple merge of two molecules" << endl;
    1059   Log() << Verbose(0) << "all else - go back" << endl;
    1060   Log() << Verbose(0) << "===============================================" << endl;
    1061   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: ");
    10621103  cin >> choice;
    10631104
    10641105  switch (choice) {
    10651106    default:
    1066       Log() << Verbose(0) << "Not a valid choice." << endl;
     1107      DoLog(0) && (Log() << Verbose(0) << "Not a valid choice." << endl);
    10671108      break;
    10681109
     
    10731114        {
    10741115          do {
    1075             Log() << Verbose(0) << "Enter index of destination molecule: ";
     1116            DoLog(0) && (Log() << Verbose(0) << "Enter index of destination molecule: ");
    10761117            cin >> dest;
    10771118            destmol = molecules->ReturnIndex(dest);
    10781119          } while ((destmol == NULL) && (dest != -1));
    10791120          do {
    1080             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: ");
    10811122            cin >> src;
    10821123            srcmol = molecules->ReturnIndex(src);
     
    10881129      break;
    10891130
     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
    10901183    case 'e':
    10911184      {
     
    10931186        molecule *srcmol = NULL, *destmol = NULL;
    10941187        do {
    1095           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): ");
    10961189          cin >> src;
    10971190          srcmol = molecules->ReturnIndex(src);
    10981191        } while ((srcmol == NULL) && (src != -1));
    10991192        do {
    1100           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): ");
    11011194          cin >> dest;
    11021195          destmol = molecules->ReturnIndex(dest);
     
    11071200      break;
    11081201
     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
    11091212    case 'm':
    11101213      {
     
    11121215        molecule *mol = NULL;
    11131216        do {
    1114           Log() << Verbose(0) << "Enter index of molecule to merge into: ";
     1217          DoLog(0) && (Log() << Verbose(0) << "Enter index of molecule to merge into: ");
    11151218          cin >> nr;
    11161219          mol = molecules->ReturnIndex(nr);
     
    11291232
    11301233    case 's':
    1131       Log() << Verbose(0) << "Not implemented yet." << endl;
     1234      DoLog(0) && (Log() << Verbose(0) << "Not implemented yet." << endl);
    11321235      break;
    11331236
     
    11381241        {
    11391242          do {
    1140             Log() << Verbose(0) << "Enter index of destination molecule: ";
     1243            DoLog(0) && (Log() << Verbose(0) << "Enter index of destination molecule: ");
    11411244            cin >> dest;
    11421245            destmol = molecules->ReturnIndex(dest);
    11431246          } while ((destmol == NULL) && (dest != -1));
    11441247          do {
    1145             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: ");
    11461249            cin >> src;
    11471250            srcmol = molecules->ReturnIndex(src);
     
    11721275    mol = (molecules->ListOfMolecules.front())->CopyMolecule();
    11731276  else {
    1174     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 ... ");
    11751278    performCriticalExit();
    11761279    return;
     
    11791282
    11801283  // generate some KeySets
    1181   Log() << Verbose(0) << "Generating KeySets." << endl;
     1284  DoLog(0) && (Log() << Verbose(0) << "Generating KeySets." << endl);
    11821285  KeySet TestSets[mol->AtomCount+1];
    11831286  i=1;
     
    11891292    i++;
    11901293  }
    1191   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);
    11921295  KeySetTestPair test;
    11931296  test = TestSets[mol->AtomCount-1].insert(Walker->nr);
    11941297  if (test.second) {
    1195     Log() << Verbose(1) << "Insertion worked?!" << endl;
     1298    DoLog(1) && (Log() << Verbose(1) << "Insertion worked?!" << endl);
    11961299  } else {
    1197     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);
    11981301  }
    11991302  TestSets[mol->AtomCount].insert(mol->end->previous->nr);
     
    12011304
    12021305  // constructing Graph structure
    1203   Log() << Verbose(0) << "Generating Subgraph class." << endl;
     1306  DoLog(0) && (Log() << Verbose(0) << "Generating Subgraph class." << endl);
    12041307  Graph Subgraphs;
    12051308
    12061309  // insert KeySets into Subgraphs
    1207   Log() << Verbose(0) << "Inserting KeySets into Subgraph class." << endl;
     1310  DoLog(0) && (Log() << Verbose(0) << "Inserting KeySets into Subgraph class." << endl);
    12081311  for (int j=0;j<mol->AtomCount;j++) {
    12091312    Subgraphs.insert(GraphPair (TestSets[j],pair<int, double>(counter++, 1.)));
    12101313  }
    1211   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);
    12121315  GraphTestPair test2;
    12131316  test2 = Subgraphs.insert(GraphPair (TestSets[mol->AtomCount],pair<int, double>(counter++, 1.)));
    12141317  if (test2.second) {
    1215     Log() << Verbose(1) << "Insertion worked?!" << endl;
     1318    DoLog(1) && (Log() << Verbose(1) << "Insertion worked?!" << endl);
    12161319  } else {
    1217     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);
    12181321  }
    12191322
    12201323  // show graphs
    1221   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);
    12221325  Graph::iterator A = Subgraphs.begin();
    12231326  while (A !=  Subgraphs.end()) {
    1224     Log() << Verbose(0) << (*A).second.first << ": ";
     1327    DoLog(0) && (Log() << Verbose(0) << (*A).second.first << ": ");
    12251328    KeySet::iterator key = (*A).first.begin();
    12261329    comp = -1;
    12271330    while (key != (*A).first.end()) {
    12281331      if ((*key) > comp)
    1229         Log() << Verbose(0) << (*key) << " ";
     1332        DoLog(0) && (Log() << Verbose(0) << (*key) << " ");
    12301333      else
    1231         Log() << Verbose(0) << (*key) << "! ";
     1334        DoLog(0) && (Log() << Verbose(0) << (*key) << "! ");
    12321335      comp = (*key);
    12331336      key++;
    12341337    }
    1235     Log() << Verbose(0) << endl;
     1338    DoLog(0) && (Log() << Verbose(0) << endl);
    12361339    A++;
    12371340  }
     
    12531356
    12541357  if (!strcmp(configuration->configpath, configuration->GetDefaultPath())) {
    1255     eLog() << Verbose(2) << "config is found under different path then stated in config file::defaultpath!" << endl;
     1358    DoeLog(2) && (eLog()<< Verbose(2) << "config is found under different path then stated in config file::defaultpath!" << endl);
    12561359  }
    12571360
     
    12621365  if (output == NULL)
    12631366    strcpy(filename,"main_pcp_linux");
    1264   Log() << Verbose(0) << "Saving as pdb input ";
     1367  DoLog(0) && (Log() << Verbose(0) << "Saving as pdb input ");
    12651368  if (configuration->SavePDB(filename, molecules))
    1266     Log() << Verbose(0) << "done." << endl;
     1369    DoLog(0) && (Log() << Verbose(0) << "done." << endl);
    12671370  else
    1268     Log() << Verbose(0) << "failed." << endl;
     1371    DoLog(0) && (Log() << Verbose(0) << "failed." << endl);
    12691372
    12701373  // then save as tremolo data file
     
    12731376  if (output == NULL)
    12741377    strcpy(filename,"main_pcp_linux");
    1275   Log() << Verbose(0) << "Saving as tremolo data input ";
     1378  DoLog(0) && (Log() << Verbose(0) << "Saving as tremolo data input ");
    12761379  if (configuration->SaveTREMOLO(filename, molecules))
    1277     Log() << Verbose(0) << "done." << endl;
     1380    DoLog(0) && (Log() << Verbose(0) << "done." << endl);
    12781381  else
    1279     Log() << Verbose(0) << "failed." << endl;
     1382    DoLog(0) && (Log() << Verbose(0) << "failed." << endl);
    12801383
    12811384  // translate each to its center and merge all molecules in MoleculeListClass into this molecule
     
    12971400  }
    12981401
    1299   Log() << Verbose(0) << "Storing configuration ... " << endl;
     1402  DoLog(0) && (Log() << Verbose(0) << "Storing configuration ... " << endl);
    13001403  // get correct valence orbitals
    13011404  mol->CalculateOrbitals(*configuration);
     
    13131416  output.close();
    13141417  output.clear();
    1315   Log() << Verbose(0) << "Saving of config file ";
     1418  DoLog(0) && (Log() << Verbose(0) << "Saving of config file ");
    13161419  if (configuration->Save(filename, periode, mol))
    1317     Log() << Verbose(0) << "successful." << endl;
     1420    DoLog(0) && (Log() << Verbose(0) << "successful." << endl);
    13181421  else
    1319     Log() << Verbose(0) << "failed." << endl;
     1422    DoLog(0) && (Log() << Verbose(0) << "failed." << endl);
    13201423
    13211424  // and save to xyz file
     
    13301433    output.open(filename, ios::trunc);
    13311434  }
    1332   Log() << Verbose(0) << "Saving of XYZ file ";
     1435  DoLog(0) && (Log() << Verbose(0) << "Saving of XYZ file ");
    13331436  if (mol->MDSteps <= 1) {
    13341437    if (mol->OutputXYZ(&output))
    1335       Log() << Verbose(0) << "successful." << endl;
     1438      DoLog(0) && (Log() << Verbose(0) << "successful." << endl);
    13361439    else
    1337       Log() << Verbose(0) << "failed." << endl;
     1440      DoLog(0) && (Log() << Verbose(0) << "failed." << endl);
    13381441  } else {
    13391442    if (mol->OutputTrajectoriesXYZ(&output))
    1340       Log() << Verbose(0) << "successful." << endl;
     1443      DoLog(0) && (Log() << Verbose(0) << "successful." << endl);
    13411444    else
    1342       Log() << Verbose(0) << "failed." << endl;
     1445      DoLog(0) && (Log() << Verbose(0) << "failed." << endl);
    13431446  }
    13441447  output.close();
     
    13501453  if (output == NULL)
    13511454    strcpy(filename,"main_pcp_linux");
    1352   Log() << Verbose(0) << "Saving as mpqc input ";
     1455  DoLog(0) && (Log() << Verbose(0) << "Saving as mpqc input ");
    13531456  if (configuration->SaveMPQC(filename, mol))
    1354     Log() << Verbose(0) << "done." << endl;
     1457    DoLog(0) && (Log() << Verbose(0) << "done." << endl);
    13551458  else
    1356     Log() << Verbose(0) << "failed." << endl;
     1459    DoLog(0) && (Log() << Verbose(0) << "failed." << endl);
    13571460
    13581461  if (!strcmp(configuration->configpath, configuration->GetDefaultPath())) {
    1359     eLog() << Verbose(2) << "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);
    13601463  }
    13611464
     
    13871490  enum ConfigStatus configPresent = absent;
    13881491  clock_t start,end;
     1492  double MaxDistance = -1;
    13891493  int argptr;
    13901494  molecule *mol = NULL;
     
    13981502    do {
    13991503      if (argv[argptr][0] == '-') {
    1400         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");
    14011505        argptr++;
    14021506        switch(argv[argptr-1][1]) {
     
    14041508          case 'H':
    14051509          case '?':
    1406             Log() << Verbose(0) << "MoleCuilder suite" << endl << "==================" << endl << endl;
    1407             Log() << Verbose(0) << "Usage: " << argv[0] << "[config file] [-{acefpsthH?vfrp}] [further arguments]" << endl;
    1408             Log() << Verbose(0) << "or simply " << argv[0] << " without arguments for interactive session." << endl;
    1409             Log() << Verbose(0) << "\t-a Z x1 x2 x3\tAdd new atom of element Z at coordinates (x1,x2,x3)." << endl;
    1410             Log() << Verbose(0) << "\t-A <source>\tCreate adjacency list from bonds parsed from 'dbond'-style file." <<endl;
    1411             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;
    1412             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;
    1413             Log() << Verbose(0) << "\t-c x1 x2 x3\tCenter atoms in domain with a minimum distance to boundary of (x1,x2,x3)." << endl;
    1414             Log() << Verbose(0) << "\t-C <Z> <output> <bin output>\tPair Correlation analysis." << endl;
    1415             Log() << Verbose(0) << "\t-d x1 x2 x3\tDuplicate cell along each axis by given factor." << endl;
    1416             Log() << Verbose(0) << "\t-D <bond distance>\tDepth-First-Search Analysis of the molecule, giving cycles and tree/back edges." << endl;
    1417             Log() << Verbose(0) << "\t-e <file>\tSets the databases path to be parsed (default: ./)." << endl;
    1418             Log() << Verbose(0) << "\t-E <id> <Z>\tChange atom <id>'s element to <Z>, <id> begins at 0." << endl;
    1419             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;
    1420             Log() << Verbose(0) << "\t-F <dist_x> <dist_y> <dist_z> <epsilon> <randatom> <randmol> <DoRotate>\tFilling Box with water molecules." << endl;
    1421             Log() << Verbose(0) << "\t-g <file>\tParses a bond length table from the given file." << endl;
    1422             Log() << Verbose(0) << "\t-h/-H/-?\tGive this help screen." << endl;
    1423             Log() << Verbose(0) << "\t-I\t Dissect current system of molecules into a set of disconnected (subgraphs of) molecules." << endl;
    1424             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;
    1425             Log() << Verbose(0) << "\t-m <0/1>\tCalculate (0)/ Align in(1) PAS with greatest EV along z axis." << endl;
    1426             Log() << Verbose(0) << "\t-M <basis>\tSetting basis to store to MPQC config files." << endl;
    1427             Log() << Verbose(0) << "\t-n\tFast parsing (i.e. no trajectories are looked for)." << endl;
    1428             Log() << Verbose(0) << "\t-N <radius> <file>\tGet non-convex-envelope." << endl;
    1429             Log() << Verbose(0) << "\t-o <out>\tGet volume of the convex envelope (and store to tecplot file)." << endl;
    1430             Log() << Verbose(0) << "\t-O\tCenter atoms in origin." << endl;
    1431             Log() << Verbose(0) << "\t-p <file>\tParse given xyz file and create raw config file from it." << endl;
    1432             Log() << Verbose(0) << "\t-P <file>\tParse given forces file and append as an MD step to config file via Verlet." << endl;
    1433             Log() << Verbose(0) << "\t-r <id>\t\tRemove an atom with given id." << endl;
    1434             Log() << Verbose(0) << "\t-R <id> <radius>\t\tRemove all atoms out of sphere around a given one." << endl;
    1435             Log() << Verbose(0) << "\t-s x1 x2 x3\tScale all atom coordinates by this vector (x1,x2,x3)." << endl;
    1436             Log() << Verbose(0) << "\t-S <file> Store temperatures from the config file in <file>." << endl;
    1437             Log() << Verbose(0) << "\t-t x1 x2 x3\tTranslate all atoms by this vector (x1,x2,x3)." << endl;
    1438             Log() << Verbose(0) << "\t-T x1 x2 x3\tTranslate periodically all atoms by this vector (x1,x2,x3)." << endl;
    1439             Log() << Verbose(0) << "\t-u rho\tsuspend in water solution and output necessary cell lengths, average density rho and repetition." << endl;
    1440             Log() << Verbose(0) << "\t-v\t\tsets verbosity (more is more)." << endl;
    1441             Log() << Verbose(0) << "\t-V\t\tGives version information." << endl;
    1442             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);
    14431551            return (1);
    14441552            break;
     
    14481556            }
    14491557            setVerbosity(verbosity);
    1450             Log() << Verbose(0) << "Setting verbosity to " << verbosity << "." << endl;
     1558            DoLog(0) && (Log() << Verbose(0) << "Setting verbosity to " << verbosity << "." << endl);
    14511559            break;
    14521560          case 'V':
    1453             Log() << Verbose(0) << argv[0] << " " << VERSIONSTRING << endl;
    1454             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);
    14551563            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            }
    14561581            break;
    14571582          case 'e':
    14581583            if ((argptr >= argc) || (argv[argptr][0] == '-')) {
    1459               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);
    14601585              performCriticalExit();
    14611586            } else {
    1462               Log() << Verbose(0) << "Using " << argv[argptr] << " as elements database." << endl;
     1587              DoLog(0) && (Log() << Verbose(0) << "Using " << argv[argptr] << " as elements database." << endl);
    14631588              strncpy (configuration.databasepath, argv[argptr], MAXSTRINGSIZE-1);
    14641589              argptr+=1;
     
    14671592          case 'g':
    14681593            if ((argptr >= argc) || (argv[argptr][0] == '-')) {
    1469               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);
    14701595              performCriticalExit();
    14711596            } else {
    14721597              BondGraphFileName = argv[argptr];
    1473               Log() << Verbose(0) << "Using " << BondGraphFileName << " as bond length table." << endl;
     1598              DoLog(0) && (Log() << Verbose(0) << "Using " << BondGraphFileName << " as bond length table." << endl);
    14741599              argptr+=1;
    14751600            }
    14761601            break;
    14771602          case 'n':
    1478             Log() << Verbose(0) << "I won't parse trajectories." << endl;
     1603            DoLog(0) && (Log() << Verbose(0) << "I won't parse trajectories." << endl);
    14791604            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            }
    14801615            break;
    14811616          default:   // no match? Step on
     
    14891624    // 3a. Parse the element database
    14901625    if (periode->LoadPeriodentafel(configuration.databasepath)) {
    1491       Log() << Verbose(0) << "Element list loaded successfully." << endl;
     1626      DoLog(0) && (Log() << Verbose(0) << "Element list loaded successfully." << endl);
    14921627      //periode->Output();
    14931628    } else {
    1494       Log() << Verbose(0) << "Element list loading failed." << endl;
     1629      DoLog(0) && (Log() << Verbose(0) << "Element list loading failed." << endl);
    14951630      return 1;
    14961631    }
     
    14981633    if (argv[1][0] != '-') {
    14991634      // simply create a new molecule, wherein the config file is loaded and the manipulation takes place
    1500       Log() << Verbose(0) << "Config file given." << endl;
     1635      DoLog(0) && (Log() << Verbose(0) << "Config file given." << endl);
    15011636      test.open(argv[1], ios::in);
    15021637      if (test == NULL) {
     
    15041639        output.open(argv[1], ios::out);
    15051640        if (output == NULL) {
    1506           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);
    15071642          configPresent = absent;
    15081643        } else {
    1509           Log() << Verbose(0) << "Empty configuration file." << endl;
     1644          DoLog(0) && (Log() << Verbose(0) << "Empty configuration file." << endl);
    15101645          ConfigFileName = argv[1];
    15111646          configPresent = empty;
     
    15151650        test.close();
    15161651        ConfigFileName = argv[1];
    1517         Log() << Verbose(1) << "Specified config file found, parsing ... ";
     1652        DoLog(1) && (Log() << Verbose(1) << "Specified config file found, parsing ... ");
    15181653        switch (configuration.TestSyntax(ConfigFileName, periode)) {
    15191654          case 1:
    1520             Log() << Verbose(0) << "new syntax." << endl;
     1655            DoLog(0) && (Log() << Verbose(0) << "new syntax." << endl);
    15211656            configuration.Load(ConfigFileName, BondGraphFileName, periode, molecules);
    15221657            configPresent = present;
    15231658            break;
    15241659          case 0:
    1525             Log() << Verbose(0) << "old syntax." << endl;
     1660            DoLog(0) && (Log() << Verbose(0) << "old syntax." << endl);
    15261661            configuration.LoadOld(ConfigFileName, BondGraphFileName, periode, molecules);
    15271662            configPresent = present;
    15281663            break;
    15291664          default:
    1530             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);
    15311666            configPresent = empty;
    15321667       }
     
    15521687       configuration.BG = new BondGraph(configuration.GetIsAngstroem());
    15531688       if ((!BondGraphFileName.empty()) && (configuration.BG->LoadBondLengthTable(BondGraphFileName))) {
    1554          Log() << Verbose(0) << "Bond length table loaded successfully." << endl;
     1689         DoLog(0) && (Log() << Verbose(0) << "Bond length table loaded successfully." << endl);
    15551690       } else {
    1556          eLog() << Verbose(1) << "Bond length table loading failed." << endl;
     1691         DoeLog(1) && (eLog()<< Verbose(1) << "Bond length table loading failed." << endl);
    15571692       }
    15581693     }
     
    15611696    argptr = 1;
    15621697    do {
    1563       Log() << Verbose(0) << "Current Command line argument: " << argv[argptr] << "." << endl;
     1698      DoLog(0) && (Log() << Verbose(0) << "Current Command line argument: " << argv[argptr] << "." << endl);
    15641699      if (argv[argptr][0] == '-') {
    15651700        argptr++;
     
    15701705              if ((argptr >= argc) || (argv[argptr][0] == '-')) {
    15711706                ExitFlag = 255;
    1572                 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);
    15731708                performCriticalExit();
    15741709              } else {
    15751710                SaveFlag = true;
    1576                 Log() << Verbose(1) << "Parsing xyz file for new atoms." << endl;
     1711                DoLog(1) && (Log() << Verbose(1) << "Parsing xyz file for new atoms." << endl);
    15771712                if (!mol->AddXYZFile(argv[argptr]))
    1578                   Log() << Verbose(2) << "File not found." << endl;
     1713                  DoLog(2) && (Log() << Verbose(2) << "File not found." << endl);
    15791714                else {
    1580                   Log() << Verbose(2) << "File found and parsed." << endl;
     1715                  DoLog(2) && (Log() << Verbose(2) << "File found and parsed." << endl);
    15811716                  configPresent = present;
    15821717                }
     
    15871722              if ((argptr >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) || (!IsValidNumber(argv[argptr+3]))) {
    15881723                ExitFlag = 255;
    1589                 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);
    15901725                performCriticalExit();
    15911726              } else {
    15921727                SaveFlag = true;
    1593                 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] << "), ");
    15941729                first = new atom;
    15951730                first->type = periode->FindElement(atoi(argv[argptr]));
    15961731                if (first->type != NULL)
    1597                   Log() << Verbose(2) << "found element " << first->type->name << endl;
     1732                  DoLog(2) && (Log() << Verbose(2) << "found element " << first->type->name << endl);
    15981733                for (int i=NDIM;i--;)
    15991734                  first->x.x[i] = atof(argv[argptr+1+i]);
     
    16031738                    configPresent = present;
    16041739                } else
    1605                   eLog() << Verbose(1) << "Could not find the specified element." << endl;
     1740                  DoeLog(1) && (eLog()<< Verbose(1) << "Could not find the specified element." << endl);
    16061741                argptr+=4;
    16071742              }
     
    16161751              if ((argptr >= argc) || (argv[argptr][0] == '-')) {
    16171752                ExitFlag = 255;
    1618                 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);
    16191754                performCriticalExit();
    16201755              } else {
    16211756                configuration.basis = argv[argptr];
    1622                 Log() << Verbose(1) << "Setting MPQC basis to " << configuration.basis << "." << endl;
     1757                DoLog(1) && (Log() << Verbose(1) << "Setting MPQC basis to " << configuration.basis << "." << endl);
    16231758                argptr+=1;
    16241759              }
     
    16271762              if (ExitFlag == 0) ExitFlag = 1;
    16281763              {
    1629                 Log() << Verbose(1) << "Depth-First-Search Analysis." << endl;
     1764                DoLog(1) && (Log() << Verbose(1) << "Depth-First-Search Analysis." << endl);
    16301765                MoleculeLeafClass *Subgraphs = NULL;      // list of subgraphs from DFS analysis
    16311766                int *MinimumRingSize = new int[mol->AtomCount];
     
    16581793              break;
    16591794            case 'I':
    1660               Log() << Verbose(1) << "Dissecting molecular system into a set of disconnected subgraphs ... " << endl;
     1795              DoLog(1) && (Log() << Verbose(1) << "Dissecting molecular system into a set of disconnected subgraphs ... " << endl);
    16611796              // @TODO rather do the dissection afterwards
    16621797              molecules->DissectMoleculeIntoConnectedSubgraphs(periode, &configuration);
     
    16691804                  }
    16701805              }
    1671               if (mol == NULL) {
     1806              if ((mol == NULL) && (!molecules->ListOfMolecules.empty())) {
    16721807                mol = *(molecules->ListOfMolecules.begin());
    1673                 mol->ActiveFlag = true;
     1808                if (mol != NULL)
     1809                  mol->ActiveFlag = true;
    16741810              }
    16751811              break;
    16761812            case 'C':
    1677               if (ExitFlag == 0) ExitFlag = 1;
    1678               if ((argptr+2 >= argc) || (!IsValidNumber(argv[argptr])) || (argv[argptr][0] == '-') || (argv[argptr+1][0] == '-') || (argv[argptr+2][0] == '-')) {
    1679                 ExitFlag = 255;
    1680                 eLog() << Verbose(0) << "Not enough or invalid arguments given for pair correlation analysis: -C <Z> <output> <bin output>" << endl;
    1681                 performCriticalExit();
    1682               } else {
    1683                 ofstream output(argv[argptr+1]);
    1684                 ofstream binoutput(argv[argptr+2]);
    1685                 const double radius = 5.;
    1686 
    1687                 // get the boundary
    1688                 class molecule *Boundary = NULL;
    1689                 class Tesselation *TesselStruct = NULL;
    1690                 const LinkedCell *LCList = NULL;
    1691                 // find biggest molecule
    1692                 int counter  = 0;
    1693                 for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) {
    1694                   if ((Boundary == NULL) || (Boundary->AtomCount < (*BigFinder)->AtomCount)) {
    1695                     Boundary = *BigFinder;
     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;
    16961962                  }
    1697                   counter++;
    16981963                }
    1699                 bool *Actives = Malloc<bool>(counter, "ParseCommandLineOptions() - case C -- *Actives");
    1700                 counter = 0;
    1701                 for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) {
    1702                   Actives[counter++] = (*BigFinder)->ActiveFlag;
    1703                   (*BigFinder)->ActiveFlag = (*BigFinder == Boundary) ? false : true;
    1704                 }
    1705                 LCList = new LinkedCell(Boundary, 2.*radius);
    1706                 element *elemental = periode->FindElement((const int) atoi(argv[argptr]));
    1707                 FindNonConvexBorder(Boundary, TesselStruct, LCList, radius, NULL);
    1708                 int ranges[NDIM] = {1,1,1};
    1709                 CorrelationToSurfaceMap *surfacemap = PeriodicCorrelationToSurface( molecules, elemental, TesselStruct, LCList, ranges );
    1710                 OutputCorrelationToSurface(&output, surfacemap);
    1711                 BinPairMap *binmap = BinData( surfacemap, 0.5, 0., 0. );
    1712                 OutputCorrelation ( &binoutput, binmap );
    1713                 output.close();
    1714                 binoutput.close();
    1715                 for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++)
    1716                   (*BigFinder)->ActiveFlag = Actives[counter++];
    1717                 Free(&Actives);
    1718                 delete(LCList);
    1719                 delete(TesselStruct);
    1720                 argptr+=3;
    1721               }
    1722               break;
     1964                break;
     1965              }
    17231966            case 'E':
    17241967              if (ExitFlag == 0) ExitFlag = 1;
    17251968              if ((argptr+1 >= argc) || (!IsValidNumber(argv[argptr])) || (argv[argptr+1][0] == '-')) {
    17261969                ExitFlag = 255;
    1727                 eLog() << Verbose(0) << "Not enough or invalid arguments given for changing element: -E <atom nr.> <element>" << endl;
     1970                DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for changing element: -E <atom nr.> <element>" << endl);
    17281971                performCriticalExit();
    17291972              } else {
    17301973                SaveFlag = true;
    1731                 Log() << Verbose(1) << "Changing atom " << argv[argptr] << " to element " << argv[argptr+1] << "." << endl;
     1974                DoLog(1) && (Log() << Verbose(1) << "Changing atom " << argv[argptr] << " to element " << argv[argptr+1] << "." << endl);
    17321975                first = mol->FindAtom(atoi(argv[argptr]));
    17331976                first->type = periode->FindElement(atoi(argv[argptr+1]));
     
    17371980            case 'F':
    17381981              if (ExitFlag == 0) ExitFlag = 1;
    1739               if (argptr+6 >=argc) {
     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]))) {
    17401989                ExitFlag = 255;
    1741                 eLog() << Verbose(0) << "Not enough or invalid arguments given for filling box with water: -F <dist_x> <dist_y> <dist_z> <boundary> <randatom> <randmol> <DoRotate>" << endl;
     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);
    17421991                performCriticalExit();
    17431992              } else {
    17441993                SaveFlag = true;
    1745                 Log() << Verbose(1) << "Filling Box with water molecules." << endl;
     1994                DoLog(1) && (Log() << Verbose(1) << "Filling Box with water molecules." << endl);
    17461995                // construct water molecule
    17471996                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);
    17482002                molecule *Filling = NULL;
    1749                 atom *second = NULL, *third = NULL;
    1750 //                first = new atom();
    1751 //                first->type = periode->FindElement(5);
    1752 //                first->x.Zero();
    1753 //                filler->AddAtom(first);
    1754                 first = new atom();
    1755                 first->type = periode->FindElement(1);
    1756                 first->x.Init(0.441, -0.143, 0.);
    1757                 filler->AddAtom(first);
    1758                 second = new atom();
    1759                 second->type = periode->FindElement(1);
    1760                 second->x.Init(-0.464, 1.137, 0.0);
    1761                 filler->AddAtom(second);
    1762                 third = new atom();
    1763                 third->type = periode->FindElement(8);
    1764                 third->x.Init(-0.464, 0.177, 0.);
    1765                 filler->AddAtom(third);
    1766                 filler->AddBond(first, third, 1);
    1767                 filler->AddBond(second, third, 1);
    17682003                // call routine
    17692004                double distance[NDIM];
    17702005                for (int i=0;i<NDIM;i++)
    1771                   distance[i] = atof(argv[argptr+i]);
    1772                 Filling = FillBoxWithMolecule(molecules, filler, configuration, distance, atof(argv[argptr+3]), atof(argv[argptr+4]), atof(argv[argptr+5]), atoi(argv[argptr+6]));
     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]));
    17732008                if (Filling != NULL) {
    17742009                  Filling->ActiveFlag = false;
     
    17832018              if ((argptr >= argc) || (argv[argptr][0] == '-')) {
    17842019                ExitFlag =255;
    1785                 eLog() << Verbose(0) << "Missing source file for bonds in molecule: -A <bond sourcefile>" << endl;
     2020                DoeLog(0) && (eLog()<< Verbose(0) << "Missing source file for bonds in molecule: -A <bond sourcefile>" << endl);
    17862021                performCriticalExit();
    17872022              } else {
    1788                 Log() << Verbose(0) << "Parsing bonds from " << argv[argptr] << "." << endl;
     2023                DoLog(0) && (Log() << Verbose(0) << "Parsing bonds from " << argv[argptr] << "." << endl);
    17892024                ifstream *input = new ifstream(argv[argptr]);
    17902025                mol->CreateAdjacencyListFromDbondFile(input);
     
    17932028              }
    17942029              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
    17952059            case 'N':
    17962060              if (ExitFlag == 0) ExitFlag = 1;
    17972061              if ((argptr+1 >= argc) || (argv[argptr+1][0] == '-')){
    17982062                ExitFlag = 255;
    1799                 eLog() << Verbose(0) << "Not enough or invalid arguments given for non-convex envelope: -o <radius> <tecplot output file>" << endl;
     2063                DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for non-convex envelope: -o <radius> <tecplot output file>" << endl);
    18002064                performCriticalExit();
    18012065              } else {
     
    18052069                //string filename(argv[argptr+1]);
    18062070                //filename.append(".csv");
    1807                 Log() << Verbose(0) << "Evaluating non-convex envelope of biggest molecule.";
    1808                 Log() << Verbose(1) << "Using rolling ball of radius " << atof(argv[argptr]) << " and storing tecplot data in " << argv[argptr+1] << "." << endl;
     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);
    18092073                // find biggest molecule
    18102074                int counter  = 0;
     
    18162080                  counter++;
    18172081                }
    1818                 Log() << Verbose(1) << "Biggest molecule has " << Boundary->AtomCount << " atoms." << endl;
     2082                DoLog(1) && (Log() << Verbose(1) << "Biggest molecule has " << Boundary->AtomCount << " atoms." << endl);
    18192083                start = clock();
    18202084                LCList = new LinkedCell(Boundary, atof(argv[argptr])*2.);
     
    18232087                //FindDistributionOfEllipsoids(T, &LCList, N, number, filename.c_str());
    18242088                end = clock();
    1825                 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);
    18262090                delete(LCList);
    18272091                delete(T);
     
    18332097              if ((argptr >= argc) || (argv[argptr][0] == '-')) {
    18342098                ExitFlag = 255;
    1835                 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);
    18362100                performCriticalExit();
    18372101              } else {
    1838                 Log() << Verbose(1) << "Storing temperatures in " << argv[argptr] << "." << endl;
     2102                DoLog(1) && (Log() << Verbose(1) << "Storing temperatures in " << argv[argptr] << "." << endl);
    18392103                ofstream *output = new ofstream(argv[argptr], ios::trunc);
    18402104                if (!mol->OutputTemperatureFromTrajectories(output, 0, mol->MDSteps))
    1841                   Log() << Verbose(2) << "File could not be written." << endl;
     2105                  DoLog(2) && (Log() << Verbose(2) << "File could not be written." << endl);
    18422106                else
    1843                   Log() << Verbose(2) << "File stored." << endl;
     2107                  DoLog(2) && (Log() << Verbose(2) << "File stored." << endl);
    18442108                output->close();
    18452109                delete(output);
     
    18512115              if ((argptr >= argc) || (argv[argptr][0] == '-')) {
    18522116                ExitFlag = 255;
    1853                 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);
    18542118                performCriticalExit();
    18552119              } else {
    18562120                SaveFlag = true;
    1857                 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);
    18582122                if (atoi(argv[argptr+3]) == 1)
    1859                   Log() << Verbose(1) << "Using Identity for the permutation map." << endl;
     2123                  DoLog(1) && (Log() << Verbose(1) << "Using Identity for the permutation map." << endl);
    18602124                if (!mol->LinearInterpolationBetweenConfiguration(atoi(argv[argptr]), atoi(argv[argptr+1]), argv[argptr+2], configuration, atoi(argv[argptr+3])) == 1 ? true : false)
    1861                   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);
    18622126                else
    1863                   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);
    18642128                argptr+=4;
    18652129              }
     
    18692133              if ((argptr >= argc) || (argv[argptr][0] == '-')) {
    18702134                ExitFlag = 255;
    1871                 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);
    18722136                performCriticalExit();
    18732137              } else {
    18742138                SaveFlag = true;
    1875                 Log() << Verbose(1) << "Parsing forces file and Verlet integrating." << endl;
     2139                DoLog(1) && (Log() << Verbose(1) << "Parsing forces file and Verlet integrating." << endl);
    18762140                if (!mol->VerletForceIntegration(argv[argptr], configuration))
    1877                   Log() << Verbose(2) << "File not found." << endl;
     2141                  DoLog(2) && (Log() << Verbose(2) << "File not found." << endl);
    18782142                else
    1879                   Log() << Verbose(2) << "File found and parsed." << endl;
     2143                  DoLog(2) && (Log() << Verbose(2) << "File found and parsed." << endl);
    18802144                argptr+=1;
    18812145              }
     
    18852149              if ((argptr+1 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])))  {
    18862150                ExitFlag = 255;
    1887                 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);
    18882152                performCriticalExit();
    18892153              } else {
    18902154                SaveFlag = true;
    1891                 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);
    18922156                double tmp1 = atof(argv[argptr+1]);
    18932157                atom *third = mol->FindAtom(atoi(argv[argptr]));
     
    19022166                  }
    19032167                } else {
    1904                   eLog() << Verbose(1) << "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);
    19052169                }
    19062170                argptr+=2;
     
    19112175              if ((argptr+2 >= argc) || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) ) {
    19122176                ExitFlag = 255;
    1913                 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);
    19142178                performCriticalExit();
    19152179              } else {
    19162180                if (ExitFlag == 0) ExitFlag = 1;
    19172181                SaveFlag = true;
    1918                 Log() << Verbose(1) << "Translating all ions by given vector." << endl;
     2182                DoLog(1) && (Log() << Verbose(1) << "Translating all ions by given vector." << endl);
    19192183                for (int i=NDIM;i--;)
    19202184                  x.x[i] = atof(argv[argptr+i]);
     
    19272191              if ((argptr+2 >= argc) || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) ) {
    19282192                ExitFlag = 255;
    1929                 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);
    19302194                performCriticalExit();
    19312195              } else {
    19322196                if (ExitFlag == 0) ExitFlag = 1;
    19332197                SaveFlag = true;
    1934                 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);
    19352199                for (int i=NDIM;i--;)
    19362200                  x.x[i] = atof(argv[argptr+i]);
     
    19432207              if ((argptr >= argc) || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) ) {
    19442208                ExitFlag = 255;
    1945                 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);
    19462210                performCriticalExit();
    19472211              } else {
    19482212                SaveFlag = true;
    19492213                j = -1;
    1950                 Log() << Verbose(1) << "Scaling all ion positions by factor." << endl;
     2214                DoLog(1) && (Log() << Verbose(1) << "Scaling all ion positions by factor." << endl);
    19512215                factor = new double[NDIM];
    19522216                factor[0] = atof(argv[argptr]);
     
    19542218                factor[2] = atof(argv[argptr+2]);
    19552219                mol->Scale((const double ** const)&factor);
     2220                double * const cell_size = World::get()->cell_size;
    19562221                for (int i=0;i<NDIM;i++) {
    19572222                  j += i+1;
    19582223                  x.x[i] = atof(argv[NDIM+i]);
    1959                   mol->cell_size[j]*=factor[i];
     2224                  cell_size[j]*=factor[i];
    19602225                }
    19612226                delete[](factor);
     
    19672232              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])) ) {
    19682233                ExitFlag = 255;
    1969                 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);
    19702235                performCriticalExit();
    19712236              } else {
    19722237                SaveFlag = true;
    19732238                j = -1;
    1974                 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;
    19752241                for (int i=0;i<6;i++) {
    1976                   mol->cell_size[i] = atof(argv[argptr+i]);
     2242                  cell_size[i] = atof(argv[argptr+i]);
    19772243                }
    19782244                // center
     
    19852251              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])) ) {
    19862252                ExitFlag = 255;
    1987                 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);
    19882254                performCriticalExit();
    19892255              } else {
    19902256                SaveFlag = true;
    19912257                j = -1;
    1992                 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;
    19932260                for (int i=0;i<6;i++) {
    1994                   mol->cell_size[i] = atof(argv[argptr+i]);
     2261                  cell_size[i] = atof(argv[argptr+i]);
    19952262                }
    19962263                // center
     
    20032270              if ((argptr+2 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) ) {
    20042271                ExitFlag = 255;
    2005                 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);
    20062273                performCriticalExit();
    20072274              } else {
    20082275                SaveFlag = true;
    20092276                j = -1;
    2010                 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);
    20112278                // make every coordinate positive
    20122279                mol->CenterEdge(&x);
     
    20142281                mol->SetBoxDimension(&x);
    20152282                // translate each coordinate by boundary
     2283                double * const cell_size = World::get()->cell_size;
    20162284                j=-1;
    20172285                for (int i=0;i<NDIM;i++) {
    20182286                  j += i+1;
    20192287                  x.x[i] = atof(argv[argptr+i]);
    2020                   mol->cell_size[j] += x.x[i]*2.;
     2288                  cell_size[j] += x.x[i]*2.;
    20212289                }
    20222290                mol->Translate((const Vector *)&x);
     
    20272295              if (ExitFlag == 0) ExitFlag = 1;
    20282296              SaveFlag = true;
    2029               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);
    20302298              x.Zero();
    20312299              mol->CenterEdge(&x);
     
    20372305              if ((argptr >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])))  {
    20382306                ExitFlag = 255;
    2039                 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);
    20402308                performCriticalExit();
    20412309              } else {
    20422310                SaveFlag = true;
    2043                 Log() << Verbose(1) << "Removing atom " << argv[argptr] << "." << endl;
     2311                DoLog(1) && (Log() << Verbose(1) << "Removing atom " << argv[argptr] << "." << endl);
    20442312                atom *first = mol->FindAtom(atoi(argv[argptr]));
    20452313                mol->RemoveAtom(first);
     
    20512319              if ((argptr+1 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1]))) {
    20522320                ExitFlag = 255;
    2053                 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);
    20542322                performCriticalExit();
    20552323              } else {
    2056                 Log() << Verbose(0) << "Fragmenting molecule with bond distance " << argv[argptr] << " angstroem, order of " << argv[argptr+1] << "." << endl;
    2057                 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);
    20582326                start = clock();
    20592327                mol->CreateAdjacencyList(atof(argv[argptr++]), configuration.GetIsAngstroem(), &BondGraph::CovalentMinMaxDistance, NULL);
    2060                 Log() << Verbose(0) << "Fragmenting molecule with current connection matrix ..." << endl;
     2328                DoLog(0) && (Log() << Verbose(0) << "Fragmenting molecule with current connection matrix ..." << endl);
    20612329                if (mol->first->next != mol->last) {
    20622330                  ExitFlag = mol->FragmentMolecule(atoi(argv[argptr]), &configuration);
    20632331                }
    20642332                end = clock();
    2065                 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);
    20662334                argptr+=2;
    20672335              }
     
    20712339              j = atoi(argv[argptr++]);
    20722340              if ((j<0) || (j>1)) {
    2073                 eLog() << Verbose(1) << "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);
    20742342                j = 0;
    20752343              }
    20762344              if (j) {
    20772345                SaveFlag = true;
    2078                 Log() << Verbose(0) << "Converting to prinicipal axis system." << endl;
     2346                DoLog(0) && (Log() << Verbose(0) << "Converting to prinicipal axis system." << endl);
    20792347              } else
    2080                 Log() << Verbose(0) << "Evaluating prinicipal axis." << endl;
     2348                DoLog(0) && (Log() << Verbose(0) << "Evaluating prinicipal axis." << endl);
    20812349              mol->PrincipalAxisSystem((bool)j);
    20822350              break;
     
    20852353              if ((argptr+1 >= argc) || (argv[argptr][0] == '-')){
    20862354                ExitFlag = 255;
    2087                 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);
    20882356                performCriticalExit();
    20892357              } else {
    20902358                class Tesselation *TesselStruct = NULL;
    20912359                const LinkedCell *LCList = NULL;
    2092                 Log() << Verbose(0) << "Evaluating volume of the convex envelope.";
    2093                 Log() << Verbose(1) << "Storing tecplot convex data in " << argv[argptr] << "." << endl;
    2094                 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);
    20952363                LCList = new LinkedCell(mol, 10.);
    20962364                //FindConvexBorder(mol, LCList, argv[argptr]);
     
    20992367                double volumedifference = ConvexizeNonconvexEnvelope(TesselStruct, mol, argv[argptr]);
    21002368                double clustervolume = VolumeOfConvexEnvelope(TesselStruct, &configuration);
    2101                 Log() << Verbose(0) << "The tesselated volume area is " << clustervolume << " " << (configuration.GetIsAngstroem() ? "angstrom" : "atomiclength") << "^3." << endl;
    2102                 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);
    21032371                delete(TesselStruct);
    21042372                delete(LCList);
     
    21102378              if ((argptr+1 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) ) {
    21112379                ExitFlag = 255;
    2112                 eLog() << Verbose(0) << "Not enough or invalid arguments given for suspension with specified volume: -U <volume> <density>" << endl;
     2380                DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for suspension with specified volume: -U <volume> <density>" << endl);
    21132381                performCriticalExit();
    21142382              } else {
    21152383                volume = atof(argv[argptr++]);
    2116                 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);
    21172385              }
    21182386            case 'u':
     
    21212389                if (volume != -1)
    21222390                  ExitFlag = 255;
    2123                   eLog() << Verbose(0) << "Not enough or invalid arguments given for suspension: -u <density>" << endl;
     2391                  DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for suspension: -u <density>" << endl);
    21242392                  performCriticalExit();
    21252393              } else {
    21262394                double density;
    21272395                SaveFlag = true;
    2128                 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.");
    21292397                density = atof(argv[argptr++]);
    21302398                if (density < 1.0) {
    2131                   eLog() << Verbose(1) << "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);
    21322400                  density = 1.3;
    21332401                }
     
    21352403//                  repetition[i] = atoi(argv[argptr++]);
    21362404//                  if (repetition[i] < 1)
    2137 //                    eLog() << Verbose(1) << "repetition value must be greater 1!" << endl;
     2405//                    DoeLog(1) && (eLog()<< Verbose(1) << "repetition value must be greater 1!" << endl);
    21382406//                  repetition[i] = 1;
    21392407//                }
     
    21452413              if ((argptr+2 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) ) {
    21462414                ExitFlag = 255;
    2147                 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);
    21482416                performCriticalExit();
    21492417              } else {
    21502418                SaveFlag = true;
     2419                double * const cell_size = World::get()->cell_size;
    21512420                for (int axis = 1; axis <= NDIM; axis++) {
    21522421                  int faktor = atoi(argv[argptr++]);
     
    21552424                  Vector ** vectors;
    21562425                  if (faktor < 1) {
    2157                     eLog() << Verbose(1) << "Repetition factor mus be greater than 1!" << endl;
     2426                    DoeLog(1) && (eLog()<< Verbose(1) << "Repetition factor mus be greater than 1!" << endl);
    21582427                    faktor = 1;
    21592428                  }
     
    21722441                    }
    21732442                    if (count != j)
    2174                       eLog() << Verbose(1) << "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);
    21752444                    x.Zero();
    21762445                    y.Zero();
    2177                     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
    21782447                    for (int i=1;i<faktor;i++) {  // then add this list with respective translation factor times
    21792448                      x.AddVector(&y); // per factor one cell width further
     
    21962465                      mol->Translate(&x);
    21972466                    }
    2198                     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;
    21992468                  }
    22002469                }
     
    22132482  } else {  // no arguments, hence scan the elements db
    22142483    if (periode->LoadPeriodentafel(configuration.databasepath))
    2215       Log() << Verbose(0) << "Element list loaded successfully." << endl;
     2484      DoLog(0) && (Log() << Verbose(0) << "Element list loaded successfully." << endl);
    22162485    else
    2217       Log() << Verbose(0) << "Element list loading failed." << endl;
     2486      DoLog(0) && (Log() << Verbose(0) << "Element list loading failed." << endl);
    22182487    configuration.RetrieveConfigPathAndName("main_pcp_linux");
    22192488  }
     
    22382507
    22392508  cout << ESPACKVersion << endl;
     2509
     2510  DoLog(1) && (Log() << Verbose(1) << "test" << endl);
     2511  DoLog(3) && (Log() << Verbose(1) << "test");
    22402512
    22412513  setVerbosity(0);
     
    22652537  if (molecules->ListOfMolecules.size() == 0) {
    22662538    mol = new molecule(periode);
    2267     if (mol->cell_size[0] == 0.) {
    2268       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);
    22692542      for (int i=0;i<6;i++) {
    2270         Log() << Verbose(1) << "Cell size" << i << ": ";
    2271         cin >> mol->cell_size[i];
     2543        DoLog(1) && (Log() << Verbose(1) << "Cell size" << i << ": ");
     2544        cin >> cell_size[i];
    22722545      }
    22732546    }
     
    22792552
    22802553  // now the main construction loop
    2281   Log() << Verbose(0) << endl << "Now comes the real construction..." << endl;
     2554  DoLog(0) && (Log() << Verbose(0) << endl << "Now comes the real construction..." << endl);
    22822555  do {
    2283     Log() << Verbose(0) << endl << endl;
    2284     Log() << Verbose(0) << "============Molecule list=======================" << endl;
     2556    DoLog(0) && (Log() << Verbose(0) << endl << endl);
     2557    DoLog(0) && (Log() << Verbose(0) << "============Molecule list=======================" << endl);
    22852558    molecules->Enumerate((ofstream *)&cout);
    2286     Log() << Verbose(0) << "============Menu===============================" << endl;
    2287     Log() << Verbose(0) << "a - set molecule (in)active" << endl;
    2288     Log() << Verbose(0) << "e - edit molecules (load, parse, save)" << endl;
    2289     Log() << Verbose(0) << "g - globally manipulate atoms in molecule" << endl;
    2290     Log() << Verbose(0) << "M - Merge molecules" << endl;
    2291     Log() << Verbose(0) << "m - manipulate atoms" << endl;
    2292     Log() << Verbose(0) << "-----------------------------------------------" << endl;
    2293     Log() << Verbose(0) << "c - edit the current configuration" << endl;
    2294     Log() << Verbose(0) << "-----------------------------------------------" << endl;
    2295     Log() << Verbose(0) << "s - save current setup to config file" << endl;
    2296     Log() << Verbose(0) << "T - call the current test routine" << endl;
    2297     Log() << Verbose(0) << "q - quit" << endl;
    2298     Log() << Verbose(0) << "===============================================" << endl;
    2299     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: ");
    23002573    cin >> choice;
    23012574
     
    23032576      case 'a':  // (in)activate molecule
    23042577        {
    2305           Log() << Verbose(0) << "Enter index of molecule: ";
     2578          DoLog(0) && (Log() << Verbose(0) << "Enter index of molecule: ");
    23062579          cin >> j;
    23072580          for(MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     
    23492622  // save element data base
    23502623  if (periode->StorePeriodentafel(configuration->databasepath)) //ElementsFileName
    2351     Log() << Verbose(0) << "Saving of elements.db successful." << endl;
     2624    DoLog(0) && (Log() << Verbose(0) << "Saving of elements.db successful." << endl);
    23522625  else
    2353     Log() << Verbose(0) << "Saving of elements.db failed." << endl;
     2626    DoLog(0) && (Log() << Verbose(0) << "Saving of elements.db failed." << endl);
    23542627
    23552628  delete(molecules); // also free's all molecules contained
Note: See TracChangeset for help on using the changeset viewer.