Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/builder.cpp

    r4fc93f ra67d19  
    5050using namespace std;
    5151
     52#include <cstring>
     53
     54#include "analysis_bonds.hpp"
    5255#include "analysis_correlation.hpp"
    5356#include "atom.hpp"
     
    6568#include "molecule.hpp"
    6669#include "periodentafel.hpp"
     70#include "version.h"
     71#include "World.hpp"
    6772
    6873/********************************************* Subsubmenu routine ************************************/
     
    8186  bool valid;
    8287
    83   Log() << Verbose(0) << "===========ADD ATOM============================" << endl;
    84   Log() << Verbose(0) << " a - state absolute coordinates of atom" << endl;
    85   Log() << Verbose(0) << " b - state relative coordinates of atom wrt to reference point" << endl;
    86   Log() << Verbose(0) << " c - state relative coordinates of atom wrt to already placed atom" << endl;
    87   Log() << Verbose(0) << " d - state two atoms, two angles and a distance" << endl;
    88   Log() << Verbose(0) << " e - least square distance position to a set of atoms" << endl;
    89   Log() << Verbose(0) << "all else - go back" << endl;
    90   Log() << Verbose(0) << "===============================================" << endl;
    91   Log() << Verbose(0) << "Note: Specifiy angles in degrees not multiples of Pi!" << endl;
    92   Log() << Verbose(0) << "INPUT: ";
     88  cout << Verbose(0) << "===========ADD ATOM============================" << endl;
     89  cout << Verbose(0) << " a - state absolute coordinates of atom" << endl;
     90  cout << Verbose(0) << " b - state relative coordinates of atom wrt to reference point" << endl;
     91  cout << Verbose(0) << " c - state relative coordinates of atom wrt to already placed atom" << endl;
     92  cout << Verbose(0) << " d - state two atoms, two angles and a distance" << endl;
     93  cout << Verbose(0) << " e - least square distance position to a set of atoms" << endl;
     94  cout << Verbose(0) << "all else - go back" << endl;
     95  cout << Verbose(0) << "===============================================" << endl;
     96  cout << Verbose(0) << "Note: Specifiy angles in degrees not multiples of Pi!" << endl;
     97  cout << Verbose(0) << "INPUT: ";
    9398  cin >> choice;
    9499
    95100  switch (choice) {
    96101    default:
    97       eLog() << Verbose(2) << "Not a valid choice." << endl;
     102      DoeLog(2) && (eLog()<< Verbose(2) << "Not a valid choice." << endl);
    98103      break;
    99104      case 'a': // absolute coordinates of atom
    100         Log() << Verbose(0) << "Enter absolute coordinates." << endl;
     105        cout << Verbose(0) << "Enter absolute coordinates." << endl;
    101106        first = new atom;
    102         first->x.AskPosition(mol->cell_size, false);
     107        first->x.AskPosition(World::get()->cell_size, false);
    103108        first->type = periode->AskElement();  // give type
    104109        mol->AddAtom(first);  // add to molecule
     
    109114        valid = true;
    110115        do {
    111           if (!valid) eLog() << Verbose(2) << "Resulting position out of cell." << endl;
    112           Log() << Verbose(0) << "Enter reference coordinates." << endl;
    113           x.AskPosition(mol->cell_size, true);
    114           Log() << Verbose(0) << "Enter relative coordinates." << endl;
    115           first->x.AskPosition(mol->cell_size, false);
     116          if (!valid) DoeLog(2) && (eLog()<< Verbose(2) << "Resulting position out of cell." << endl);
     117          cout << Verbose(0) << "Enter reference coordinates." << endl;
     118          x.AskPosition(World::get()->cell_size, true);
     119          cout << Verbose(0) << "Enter relative coordinates." << endl;
     120          first->x.AskPosition(World::get()->cell_size, false);
    116121          first->x.AddVector((const Vector *)&x);
    117           Log() << Verbose(0) << "\n";
     122          cout << Verbose(0) << "\n";
    118123        } while (!(valid = mol->CheckBounds((const Vector *)&first->x)));
    119124        first->type = periode->AskElement();  // give type
     
    125130        valid = true;
    126131        do {
    127           if (!valid) eLog() << Verbose(2) << "Resulting position out of cell." << endl;
     132          if (!valid) DoeLog(2) && (eLog()<< Verbose(2) << "Resulting position out of cell." << endl);
    128133          second = mol->AskAtom("Enter atom number: ");
    129           Log() << Verbose(0) << "Enter relative coordinates." << endl;
    130           first->x.AskPosition(mol->cell_size, false);
     134          DoLog(0) && (Log() << Verbose(0) << "Enter relative coordinates." << endl);
     135          first->x.AskPosition(World::get()->cell_size, false);
    131136          for (int i=NDIM;i--;) {
    132137            first->x.x[i] += second->x.x[i];
     
    142147        do {
    143148          if (!valid) {
    144             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);
    145150          }
    146           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;
    147152          second = mol->AskAtom("Enter central atom: ");
    148153          third = mol->AskAtom("Enter second atom (specifying the axis for first angle): ");
     
    155160          c *= M_PI/180.;
    156161          bound(&c, -M_PI, M_PI);
    157           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;
    158163/*
    159164          second->Output(1,1,(ofstream *)&cout);
     
    167172
    168173          if (!z.SolveSystem(&x,&y,&n, b, c, a)) {
    169             Log() << Verbose(0) << "Failure solving self-dependent linear system!" << endl;
     174         coutg() << Verbose(0) << "Failure solving self-dependent linear system!" << endl;
    170175            continue;
    171176          }
    172           Log() << Verbose(0) << "resulting relative coordinates: ";
     177          DoLog(0) && (Log() << Verbose(0) << "resulting relative coordinates: ");
    173178          z.Output();
    174           Log() << Verbose(0) << endl;
     179          DoLog(0) && (Log() << Verbose(0) << endl);
    175180          */
    176181          // calc axis vector
     
    180185          Log() << Verbose(0) << "x: ",
    181186          x.Output();
    182           Log() << Verbose(0) << endl;
     187          DoLog(0) && (Log() << Verbose(0) << endl);
    183188          z.MakeNormalVector(&second->x,&third->x,&fourth->x);
    184189          Log() << Verbose(0) << "z: ",
    185190          z.Output();
    186           Log() << Verbose(0) << endl;
     191          DoLog(0) && (Log() << Verbose(0) << endl);
    187192          y.MakeNormalVector(&x,&z);
    188193          Log() << Verbose(0) << "y: ",
    189194          y.Output();
    190           Log() << Verbose(0) << endl;
     195          DoLog(0) && (Log() << Verbose(0) << endl);
    191196
    192197          // rotate vector around first angle
     
    195200          Log() << Verbose(0) << "Rotated vector: ",
    196201          first->x.Output();
    197           Log() << Verbose(0) << endl;
     202          DoLog(0) && (Log() << Verbose(0) << endl);
    198203          // remove the projection onto the rotation plane of the second angle
    199204          n.CopyVector(&y);
     
    201206          Log() << Verbose(0) << "N1: ",
    202207          n.Output();
    203           Log() << Verbose(0) << endl;
     208          DoLog(0) && (Log() << Verbose(0) << endl);
    204209          first->x.SubtractVector(&n);
    205210          Log() << Verbose(0) << "Subtracted vector: ",
    206211          first->x.Output();
    207           Log() << Verbose(0) << endl;
     212          DoLog(0) && (Log() << Verbose(0) << endl);
    208213          n.CopyVector(&z);
    209214          n.Scale(first->x.ScalarProduct(&z));
    210215          Log() << Verbose(0) << "N2: ",
    211216          n.Output();
    212           Log() << Verbose(0) << endl;
     217          DoLog(0) && (Log() << Verbose(0) << endl);
    213218          first->x.SubtractVector(&n);
    214219          Log() << Verbose(0) << "2nd subtracted vector: ",
    215220          first->x.Output();
    216           Log() << Verbose(0) << endl;
     221          DoLog(0) && (Log() << Verbose(0) << endl);
    217222
    218223          // rotate another vector around second angle
     
    221226          Log() << Verbose(0) << "2nd Rotated vector: ",
    222227          n.Output();
    223           Log() << Verbose(0) << endl;
     228          DoLog(0) && (Log() << Verbose(0) << endl);
    224229
    225230          // add the two linear independent vectors
     
    229234          first->x.AddVector(&second->x);
    230235
    231           Log() << Verbose(0) << "resulting coordinates: ";
     236          DoLog(0) && (Log() << Verbose(0) << "resulting coordinates: ");
    232237          first->x.Output();
    233           Log() << Verbose(0) << endl;
     238          DoLog(0) && (Log() << Verbose(0) << endl);
    234239        } while (!(valid = mol->CheckBounds((const Vector *)&first->x)));
    235240        first->type = periode->AskElement();  // give type
     
    244249          atoms[i] = NULL;
    245250        int i=0, j=0;
    246         Log() << Verbose(0) << "Now we need at least three molecules.\n";
     251        cout << Verbose(0) << "Now we need at least three molecules.\n";
    247252        do {
    248           Log() << Verbose(0) << "Enter " << i+1 << "th atom: ";
     253          cout << Verbose(0) << "Enter " << i+1 << "th atom: ";
    249254          cin >> j;
    250255          if (j != -1) {
     
    261266        } else {
    262267          delete first;
    263           Log() << Verbose(0) << "Please enter at least two vectors!\n";
     268          cout << Verbose(0) << "Please enter at least two vectors!\n";
    264269        }
    265270        break;
     
    275280  char choice;  // menu choice char
    276281
    277   Log() << Verbose(0) << "===========CENTER ATOMS=========================" << endl;
    278   Log() << Verbose(0) << " a - on origin" << endl;
    279   Log() << Verbose(0) << " b - on center of gravity" << endl;
    280   Log() << Verbose(0) << " c - within box with additional boundary" << endl;
    281   Log() << Verbose(0) << " d - within given simulation box" << endl;
    282   Log() << Verbose(0) << "all else - go back" << endl;
    283   Log() << Verbose(0) << "===============================================" << endl;
    284   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: ";
    285290  cin >> choice;
    286291
    287292  switch (choice) {
    288293    default:
    289       Log() << Verbose(0) << "Not a valid choice." << endl;
     294      cout << Verbose(0) << "Not a valid choice." << endl;
    290295      break;
    291296    case 'a':
    292       Log() << Verbose(0) << "Centering atoms in config file on origin." << endl;
     297      cout << Verbose(0) << "Centering atoms in config file on origin." << endl;
    293298      mol->CenterOrigin();
    294299      break;
    295300    case 'b':
    296       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;
    297302      mol->CenterPeriodic();
    298303      break;
    299304    case 'c':
    300       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;
    301306      for (int i=0;i<NDIM;i++) {
    302         Log() << Verbose(0) << "Enter axis " << i << " boundary: ";
     307        cout << Verbose(0) << "Enter axis " << i << " boundary: ";
    303308        cin >> y.x[i];
    304309      }
     
    311316      break;
    312317    case 'd':
    313       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;
    314319      for (int i=0;i<NDIM;i++) {
    315         Log() << Verbose(0) << "Enter axis " << i << " boundary: ";
     320        cout << Verbose(0) << "Enter axis " << i << " boundary: ";
    316321        cin >> x.x[i];
    317322      }
     
    334339  char choice;  // menu choice char
    335340
    336   Log() << Verbose(0) << "===========ALIGN ATOMS=========================" << endl;
    337   Log() << Verbose(0) << " a - state three atoms defining align plane" << endl;
    338   Log() << Verbose(0) << " b - state alignment vector" << endl;
    339   Log() << Verbose(0) << " c - state two atoms in alignment direction" << endl;
    340   Log() << Verbose(0) << " d - align automatically by least square fit" << endl;
    341   Log() << Verbose(0) << "all else - go back" << endl;
    342   Log() << Verbose(0) << "===============================================" << endl;
    343   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: ";
    344349  cin >> choice;
    345350
     
    354359      break;
    355360    case 'b': // normal vector of mirror plane
    356       Log() << Verbose(0) << "Enter normal vector of mirror plane." << endl;
    357       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);
    358363      n.Normalize();
    359364      break;
     
    374379        fscanf(stdin, "%3s", shorthand);
    375380      } while ((param.type = periode->FindElement(shorthand)) == NULL);
    376       Log() << Verbose(0) << "Element is " << param.type->name << endl;
     381      cout << Verbose(0) << "Element is " << param.type->name << endl;
    377382      mol->GetAlignvector(&param);
    378383      for (int i=NDIM;i--;) {
     
    381386      }
    382387      gsl_vector_free(param.x);
    383       Log() << Verbose(0) << "Offset vector: ";
     388      cout << Verbose(0) << "Offset vector: ";
    384389      x.Output();
    385       Log() << Verbose(0) << endl;
     390      DoLog(0) && (Log() << Verbose(0) << endl);
    386391      n.Normalize();
    387392      break;
    388393  };
    389   Log() << Verbose(0) << "Alignment vector: ";
     394  DoLog(0) && (Log() << Verbose(0) << "Alignment vector: ");
    390395  n.Output();
    391   Log() << Verbose(0) << endl;
     396  DoLog(0) && (Log() << Verbose(0) << endl);
    392397  mol->Align(&n);
    393398};
     
    402407  char choice;  // menu choice char
    403408
    404   Log() << Verbose(0) << "===========MIRROR ATOMS=========================" << endl;
    405   Log() << Verbose(0) << " a - state three atoms defining mirror plane" << endl;
    406   Log() << Verbose(0) << " b - state normal vector of mirror plane" << endl;
    407   Log() << Verbose(0) << " c - state two atoms in normal direction" << endl;
    408   Log() << Verbose(0) << "all else - go back" << endl;
    409   Log() << Verbose(0) << "===============================================" << endl;
    410   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: ");
    411416  cin >> choice;
    412417
     
    421426      break;
    422427    case 'b': // normal vector of mirror plane
    423       Log() << Verbose(0) << "Enter normal vector of mirror plane." << endl;
    424       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);
    425430      n.Normalize();
    426431      break;
     
    434439      break;
    435440  };
    436   Log() << Verbose(0) << "Normal vector: ";
     441  DoLog(0) && (Log() << Verbose(0) << "Normal vector: ");
    437442  n.Output();
    438   Log() << Verbose(0) << endl;
     443  DoLog(0) && (Log() << Verbose(0) << endl);
    439444  mol->Mirror((const Vector *)&n);
    440445};
     
    450455  char choice;  // menu choice char
    451456
    452   Log() << Verbose(0) << "===========REMOVE ATOMS=========================" << endl;
    453   Log() << Verbose(0) << " a - state atom for removal by number" << endl;
    454   Log() << Verbose(0) << " b - keep only in radius around atom" << endl;
    455   Log() << Verbose(0) << " c - remove this with one axis greater value" << endl;
    456   Log() << Verbose(0) << "all else - go back" << endl;
    457   Log() << Verbose(0) << "===============================================" << endl;
    458   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: ");
    459464  cin >> choice;
    460465
     
    463468    case 'a':
    464469      if (mol->RemoveAtom(mol->AskAtom("Enter number of atom within molecule: ")))
    465         Log() << Verbose(1) << "Atom removed." << endl;
     470        DoLog(1) && (Log() << Verbose(1) << "Atom removed." << endl);
    466471      else
    467         Log() << Verbose(1) << "Atom not found." << endl;
     472        DoLog(1) && (Log() << Verbose(1) << "Atom not found." << endl);
    468473      break;
    469474    case 'b':
    470475      second = mol->AskAtom("Enter number of atom as reference point: ");
    471       Log() << Verbose(0) << "Enter radius: ";
     476      DoLog(0) && (Log() << Verbose(0) << "Enter radius: ");
    472477      cin >> tmp1;
    473478      first = mol->start;
     
    481486      break;
    482487    case 'c':
    483       Log() << Verbose(0) << "Which axis is it: ";
     488      DoLog(0) && (Log() << Verbose(0) << "Which axis is it: ");
    484489      cin >> axis;
    485       Log() << Verbose(0) << "Lower boundary: ";
     490      DoLog(0) && (Log() << Verbose(0) << "Lower boundary: ");
    486491      cin >> tmp1;
    487       Log() << Verbose(0) << "Upper boundary: ";
     492      DoLog(0) && (Log() << Verbose(0) << "Upper boundary: ");
    488493      cin >> tmp2;
    489494      first = mol->start;
     
    515520  char choice;  // menu choice char
    516521
    517   Log() << Verbose(0) << "===========MEASURE ATOMS=========================" << endl;
    518   Log() << Verbose(0) << " a - calculate bond length between one atom and all others" << endl;
    519   Log() << Verbose(0) << " b - calculate bond length between two atoms" << endl;
    520   Log() << Verbose(0) << " c - calculate bond angle" << endl;
    521   Log() << Verbose(0) << " d - calculate principal axis of the system" << endl;
    522   Log() << Verbose(0) << " e - calculate volume of the convex envelope" << endl;
    523   Log() << Verbose(0) << " f - calculate temperature from current velocity" << endl;
    524   Log() << Verbose(0) << " g - output all temperatures per step from velocities" << endl;
    525   Log() << Verbose(0) << "all else - go back" << endl;
    526   Log() << Verbose(0) << "===============================================" << endl;
    527   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: ");
    528533  cin >> choice;
    529534
    530535  switch(choice) {
    531536    default:
    532       Log() << Verbose(1) << "Not a valid choice." << endl;
     537      DoLog(1) && (Log() << Verbose(1) << "Not a valid choice." << endl);
    533538      break;
    534539    case 'a':
     
    562567      x.SubtractVector((const Vector *)&second->x);
    563568      tmp1 = x.Norm();
    564       Log() << Verbose(1) << "Distance vector is ";
     569      DoLog(1) && (Log() << Verbose(1) << "Distance vector is ");
    565570      x.Output();
    566       Log() << Verbose(0) << "." << endl << "Norm of distance is " << tmp1 << "." << endl;
     571      DoLog(0) && (Log() << Verbose(0) << "." << endl << "Norm of distance is " << tmp1 << "." << endl);
    567572      break;
    568573
    569574    case 'c':
    570       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);
    571576      first = mol->AskAtom("Enter first atom: ");
    572577      second = mol->AskAtom("Enter central atom: ");
     
    577582      y.CopyVector((const Vector *)&third->x);
    578583      y.SubtractVector((const Vector *)&second->x);
    579       Log() << Verbose(0) << "Bond angle between first atom Nr." << first->nr << ", central atom Nr." << second->nr << " and last atom Nr." << third->nr << ": ";
    580       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);
    581586      break;
    582587    case 'd':
    583       Log() << Verbose(0) << "Evaluating prinicipal axis." << endl;
    584       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]: ");
    585590      cin >> Z;
    586591      if ((Z >=0) && (Z <=1))
     
    591596    case 'e':
    592597      {
    593         Log() << Verbose(0) << "Evaluating volume of the convex envelope.";
     598        DoLog(0) && (Log() << Verbose(0) << "Evaluating volume of the convex envelope.");
    594599        class Tesselation *TesselStruct = NULL;
    595600        const LinkedCell *LCList = NULL;
     
    597602        FindConvexBorder(mol, TesselStruct, LCList, NULL);
    598603        double clustervolume = VolumeOfConvexEnvelope(TesselStruct, configuration);
    599         Log() << Verbose(0) << "The tesselated surface area is " << clustervolume << "." << endl;\
     604        DoLog(0) && (Log() << Verbose(0) << "The tesselated surface area is " << clustervolume << "." << endl);\
    600605        delete(LCList);
    601606        delete(TesselStruct);
     
    608613      {
    609614        char filename[255];
    610         Log() << Verbose(0) << "Please enter filename: " << endl;
     615        DoLog(0) && (Log() << Verbose(0) << "Please enter filename: " << endl);
    611616        cin >> filename;
    612         Log() << Verbose(1) << "Storing temperatures in " << filename << "." << endl;
     617        DoLog(1) && (Log() << Verbose(1) << "Storing temperatures in " << filename << "." << endl);
    613618        ofstream *output = new ofstream(filename, ios::trunc);
    614619        if (!mol->OutputTemperatureFromTrajectories(output, 0, mol->MDSteps))
    615           Log() << Verbose(2) << "File could not be written." << endl;
     620          DoLog(2) && (Log() << Verbose(2) << "File could not be written." << endl);
    616621        else
    617           Log() << Verbose(2) << "File stored." << endl;
     622          DoLog(2) && (Log() << Verbose(2) << "File stored." << endl);
    618623        output->close();
    619624        delete(output);
     
    632637  clock_t start, end;
    633638
    634   Log() << Verbose(0) << "Fragmenting molecule with current connection matrix ..." << endl;
    635   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: ");
    636641  cin >> Order1;
    637642  if (mol->first->next != mol->last) {  // there are bonds
     
    639644    mol->FragmentMolecule(Order1, configuration);
    640645    end = clock();
    641     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);
    642647  } else
    643     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);
    644649};
    645650
     
    652657static void ManipulateAtoms(periodentafel *periode, MoleculeListClass *molecules, config *configuration)
    653658{
    654   atom *first, *second;
     659  atom *first, *second, *third;
    655660  molecule *mol = NULL;
    656661  Vector x,y,z,n; // coordinates for absolute point in cell volume
     
    660665  bool valid;
    661666
    662   Log() << Verbose(0) << "=========MANIPULATE ATOMS======================" << endl;
    663   Log() << Verbose(0) << "a - add an atom" << endl;
    664   Log() << Verbose(0) << "r - remove an atom" << endl;
    665   Log() << Verbose(0) << "b - scale a bond between atoms" << endl;
    666   Log() << Verbose(0) << "u - change an atoms element" << endl;
    667   Log() << Verbose(0) << "l - measure lengths, angles, ... for an atom" << endl;
    668   Log() << Verbose(0) << "all else - go back" << endl;
    669   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);
    670676  if (molecules->NumberOfActiveMolecules() > 1)
    671     eLog() << Verbose(2) << "There is more than one molecule active! Atoms will be added to each." << endl;
    672   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: ");
    673679  cin >> choice;
    674680
    675681  switch (choice) {
    676682    default:
    677       Log() << Verbose(0) << "Not a valid choice." << endl;
     683      DoLog(0) && (Log() << Verbose(0) << "Not a valid choice." << endl);
    678684      break;
    679685
     
    682688        if ((*ListRunner)->ActiveFlag) {
    683689        mol = *ListRunner;
    684         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);
    685691        AddAtoms(periode, mol);
    686692      }
     
    691697        if ((*ListRunner)->ActiveFlag) {
    692698        mol = *ListRunner;
    693         Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
    694         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);
    695701        first = mol->AskAtom("Enter first (fixed) atom: ");
    696702        second = mol->AskAtom("Enter second (shifting) atom: ");
     
    699705          minBond += (first->x.x[i]-second->x.x[i])*(first->x.x[i] - second->x.x[i]);
    700706        minBond = sqrt(minBond);
    701         Log() << Verbose(0) << "Current Bond length between " << first->type->name << " Atom " << first->nr << " and " << second->type->name << " Atom " << second->nr << ": " << minBond << " a.u." << endl;
    702         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.]: ");
    703709        cin >> bond;
    704710        for (int i=NDIM;i--;) {
     
    714720        if ((*ListRunner)->ActiveFlag) {
    715721        mol = *ListRunner;
    716         Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
    717        Log() << Verbose(0) << "Angstroem -> Bohrradius: 1.8897261\t\tBohrradius -> Angstroem: 0.52917721" << endl;
    718        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: ");
    719725       factor = new double[NDIM];
    720726       cin >> factor[0];
     
    731737        if ((*ListRunner)->ActiveFlag) {
    732738        mol = *ListRunner;
    733         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);
    734740        MeasureAtoms(periode, mol, configuration);
    735741      }
     
    740746        if ((*ListRunner)->ActiveFlag) {
    741747        mol = *ListRunner;
    742         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);
    743749        RemoveAtoms(mol);
    744750      }
     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        }
    745784      break;
    746785
     
    750789        int Z;
    751790        mol = *ListRunner;
    752         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);
    753792        first = NULL;
    754793        do {
    755           Log() << Verbose(0) << "Change the element of which atom: ";
     794          DoLog(0) && (Log() << Verbose(0) << "Change the element of which atom: ");
    756795          cin >> Z;
    757796        } while ((first = mol->FindAtom(Z)) == NULL);
    758         Log() << Verbose(0) << "New element by atomic number Z: ";
     797        DoLog(0) && (Log() << Verbose(0) << "New element by atomic number Z: ");
    759798        cin >> Z;
    760799        first->type = periode->FindElement(Z);
    761         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);
    762801      }
    763802      break;
     
    780819  MoleculeLeafClass *Subgraphs = NULL;
    781820
    782   Log() << Verbose(0) << "=========MANIPULATE GLOBALLY===================" << endl;
    783   Log() << Verbose(0) << "c - scale by unit transformation" << endl;
    784   Log() << Verbose(0) << "d - duplicate molecule/periodic cell" << endl;
    785   Log() << Verbose(0) << "f - fragment molecule many-body bond order style" << endl;
    786   Log() << Verbose(0) << "g - center atoms in box" << endl;
    787   Log() << Verbose(0) << "i - realign molecule" << endl;
    788   Log() << Verbose(0) << "m - mirror all molecules" << endl;
    789   Log() << Verbose(0) << "o - create connection matrix" << endl;
    790   Log() << Verbose(0) << "t - translate molecule by vector" << endl;
    791   Log() << Verbose(0) << "all else - go back" << endl;
    792   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);
    793832  if (molecules->NumberOfActiveMolecules() > 1)
    794     eLog() << Verbose(2) << "There is more than one molecule active! Atoms will be added to each." << endl;
    795   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: ");
    796835  cin >> choice;
    797836
    798837  switch (choice) {
    799838    default:
    800       Log() << Verbose(0) << "Not a valid choice." << endl;
     839      DoLog(0) && (Log() << Verbose(0) << "Not a valid choice." << endl);
    801840      break;
    802841
     
    805844        if ((*ListRunner)->ActiveFlag) {
    806845        mol = *ListRunner;
    807         Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
    808         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]: ");
    809848        cin >> axis;
    810         Log() << Verbose(0) << "State the factor: ";
     849        DoLog(0) && (Log() << Verbose(0) << "State the factor: ");
    811850        cin >> faktor;
    812851
     
    825864          }
    826865          if (count != j)
    827             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);
    828867          x.Zero();
    829868          y.Zero();
    830           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
    831870          for (int i=1;i<faktor;i++) {  // then add this list with respective translation factor times
    832871            x.AddVector(&y); // per factor one cell width further
     
    851890            mol->Translate(&x);
    852891          }
    853           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;
    854893        }
    855894      }
     
    864903        if ((*ListRunner)->ActiveFlag) {
    865904        mol = *ListRunner;
    866         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);
    867906        CenterAtoms(mol);
    868907      }
     
    873912        if ((*ListRunner)->ActiveFlag) {
    874913        mol = *ListRunner;
    875         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);
    876915        AlignAtoms(periode, mol);
    877916      }
     
    882921        if ((*ListRunner)->ActiveFlag) {
    883922        mol = *ListRunner;
    884         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);
    885924        MirrorAtoms(mol);
    886925      }
     
    893932          double bonddistance;
    894933          clock_t start,end;
    895           Log() << Verbose(0) << "What's the maximum bond distance: ";
     934          DoLog(0) && (Log() << Verbose(0) << "What's the maximum bond distance: ");
    896935          cin >> bonddistance;
    897936          start = clock();
    898937          mol->CreateAdjacencyList(bonddistance, configuration->GetIsAngstroem(), &BondGraph::CovalentMinMaxDistance, NULL);
    899938          end = clock();
    900           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);
    901940        }
    902941      break;
     
    906945        if ((*ListRunner)->ActiveFlag) {
    907946        mol = *ListRunner;
    908         Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
    909         Log() << Verbose(0) << "Enter translation vector." << endl;
    910         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);
    911950        mol->Center.AddVector((const Vector *)&x);
    912951     }
     
    935974  molecule *mol = NULL;
    936975
    937   Log() << Verbose(0) << "==========EDIT MOLECULES=====================" << endl;
    938   Log() << Verbose(0) << "c - create new molecule" << endl;
    939   Log() << Verbose(0) << "l - load molecule from xyz file" << endl;
    940   Log() << Verbose(0) << "n - change molecule's name" << endl;
    941   Log() << Verbose(0) << "N - give molecules filename" << endl;
    942   Log() << Verbose(0) << "p - parse atoms in xyz file into molecule" << endl;
    943   Log() << Verbose(0) << "r - remove a molecule" << endl;
    944   Log() << Verbose(0) << "all else - go back" << endl;
    945   Log() << Verbose(0) << "===============================================" << endl;
    946   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: ");
    947986  cin >> choice;
    948987
    949988  switch (choice) {
    950989    default:
    951       Log() << Verbose(0) << "Not a valid choice." << endl;
     990      DoLog(0) && (Log() << Verbose(0) << "Not a valid choice." << endl);
    952991      break;
    953992    case 'c':
     
    959998      {
    960999        char filename[MAXSTRINGSIZE];
    961         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);
    9621001        mol = new molecule(periode);
    9631002        do {
    964           Log() << Verbose(0) << "Enter file name: ";
     1003          DoLog(0) && (Log() << Verbose(0) << "Enter file name: ");
    9651004          cin >> filename;
    9661005        } while (!mol->AddXYZFile(filename));
     
    9681007        // center at set box dimensions
    9691008        mol->CenterEdge(&center);
    970         mol->cell_size[0] = center.x[0];
    971         mol->cell_size[1] = 0;
    972         mol->cell_size[2] = center.x[1];
    973         mol->cell_size[3] = 0;
    974         mol->cell_size[4] = 0;
    975         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];
    9761016        molecules->insert(mol);
    9771017      }
     
    9821022        char filename[MAXSTRINGSIZE];
    9831023        do {
    984           Log() << Verbose(0) << "Enter index of molecule: ";
     1024          DoLog(0) && (Log() << Verbose(0) << "Enter index of molecule: ");
    9851025          cin >> nr;
    9861026          mol = molecules->ReturnIndex(nr);
    9871027        } while (mol == NULL);
    988         Log() << Verbose(0) << "Enter name: ";
     1028        DoLog(0) && (Log() << Verbose(0) << "Enter name: ");
    9891029        cin >> filename;
    9901030        strcpy(mol->name, filename);
     
    9961036        char filename[MAXSTRINGSIZE];
    9971037        do {
    998           Log() << Verbose(0) << "Enter index of molecule: ";
     1038          DoLog(0) && (Log() << Verbose(0) << "Enter index of molecule: ");
    9991039          cin >> nr;
    10001040          mol = molecules->ReturnIndex(nr);
    10011041        } while (mol == NULL);
    1002         Log() << Verbose(0) << "Enter name: ";
     1042        DoLog(0) && (Log() << Verbose(0) << "Enter name: ");
    10031043        cin >> filename;
    10041044        mol->SetNameFromFilename(filename);
     
    10111051        mol = NULL;
    10121052        do {
    1013           Log() << Verbose(0) << "Enter index of molecule: ";
     1053          DoLog(0) && (Log() << Verbose(0) << "Enter index of molecule: ");
    10141054          cin >> nr;
    10151055          mol = molecules->ReturnIndex(nr);
    10161056        } while (mol == NULL);
    1017         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);
    10181058        do {
    1019           Log() << Verbose(0) << "Enter file name: ";
     1059          DoLog(0) && (Log() << Verbose(0) << "Enter file name: ");
    10201060          cin >> filename;
    10211061        } while (!mol->AddXYZFile(filename));
     
    10251065
    10261066    case 'r':
    1027       Log() << Verbose(0) << "Enter index of molecule: ";
     1067      DoLog(0) && (Log() << Verbose(0) << "Enter index of molecule: ");
    10281068      cin >> nr;
    10291069      count = 1;
     
    10481088  char choice;  // menu choice char
    10491089
    1050   Log() << Verbose(0) << "===========MERGE MOLECULES=====================" << endl;
    1051   Log() << Verbose(0) << "a - simple add of one molecule to another" << endl;
    1052   Log() << Verbose(0) << "e - embedding merge of two molecules" << endl;
    1053   Log() << Verbose(0) << "m - multi-merge of all molecules" << endl;
    1054   Log() << Verbose(0) << "s - scatter merge of two molecules" << endl;
    1055   Log() << Verbose(0) << "t - simple merge of two molecules" << endl;
    1056   Log() << Verbose(0) << "all else - go back" << endl;
    1057   Log() << Verbose(0) << "===============================================" << endl;
    1058   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: ");
    10591103  cin >> choice;
    10601104
    10611105  switch (choice) {
    10621106    default:
    1063       Log() << Verbose(0) << "Not a valid choice." << endl;
     1107      DoLog(0) && (Log() << Verbose(0) << "Not a valid choice." << endl);
    10641108      break;
    10651109
     
    10701114        {
    10711115          do {
    1072             Log() << Verbose(0) << "Enter index of destination molecule: ";
     1116            DoLog(0) && (Log() << Verbose(0) << "Enter index of destination molecule: ");
    10731117            cin >> dest;
    10741118            destmol = molecules->ReturnIndex(dest);
    10751119          } while ((destmol == NULL) && (dest != -1));
    10761120          do {
    1077             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: ");
    10781122            cin >> src;
    10791123            srcmol = molecules->ReturnIndex(src);
     
    10851129      break;
    10861130
     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
    10871183    case 'e':
    10881184      {
     
    10901186        molecule *srcmol = NULL, *destmol = NULL;
    10911187        do {
    1092           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): ");
    10931189          cin >> src;
    10941190          srcmol = molecules->ReturnIndex(src);
    10951191        } while ((srcmol == NULL) && (src != -1));
    10961192        do {
    1097           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): ");
    10981194          cin >> dest;
    10991195          destmol = molecules->ReturnIndex(dest);
     
    11041200      break;
    11051201
     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
    11061212    case 'm':
    11071213      {
     
    11091215        molecule *mol = NULL;
    11101216        do {
    1111           Log() << Verbose(0) << "Enter index of molecule to merge into: ";
     1217          DoLog(0) && (Log() << Verbose(0) << "Enter index of molecule to merge into: ");
    11121218          cin >> nr;
    11131219          mol = molecules->ReturnIndex(nr);
     
    11261232
    11271233    case 's':
    1128       Log() << Verbose(0) << "Not implemented yet." << endl;
     1234      DoLog(0) && (Log() << Verbose(0) << "Not implemented yet." << endl);
    11291235      break;
    11301236
     
    11351241        {
    11361242          do {
    1137             Log() << Verbose(0) << "Enter index of destination molecule: ";
     1243            DoLog(0) && (Log() << Verbose(0) << "Enter index of destination molecule: ");
    11381244            cin >> dest;
    11391245            destmol = molecules->ReturnIndex(dest);
    11401246          } while ((destmol == NULL) && (dest != -1));
    11411247          do {
    1142             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: ");
    11431249            cin >> src;
    11441250            srcmol = molecules->ReturnIndex(src);
     
    11691275    mol = (molecules->ListOfMolecules.front())->CopyMolecule();
    11701276  else {
    1171     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 ... ");
    11721278    performCriticalExit();
    11731279    return;
     
    11761282
    11771283  // generate some KeySets
    1178   Log() << Verbose(0) << "Generating KeySets." << endl;
     1284  DoLog(0) && (Log() << Verbose(0) << "Generating KeySets." << endl);
    11791285  KeySet TestSets[mol->AtomCount+1];
    11801286  i=1;
     
    11861292    i++;
    11871293  }
    1188   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);
    11891295  KeySetTestPair test;
    11901296  test = TestSets[mol->AtomCount-1].insert(Walker->nr);
    11911297  if (test.second) {
    1192     Log() << Verbose(1) << "Insertion worked?!" << endl;
     1298    DoLog(1) && (Log() << Verbose(1) << "Insertion worked?!" << endl);
    11931299  } else {
    1194     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);
    11951301  }
    11961302  TestSets[mol->AtomCount].insert(mol->end->previous->nr);
     
    11981304
    11991305  // constructing Graph structure
    1200   Log() << Verbose(0) << "Generating Subgraph class." << endl;
     1306  DoLog(0) && (Log() << Verbose(0) << "Generating Subgraph class." << endl);
    12011307  Graph Subgraphs;
    12021308
    12031309  // insert KeySets into Subgraphs
    1204   Log() << Verbose(0) << "Inserting KeySets into Subgraph class." << endl;
     1310  DoLog(0) && (Log() << Verbose(0) << "Inserting KeySets into Subgraph class." << endl);
    12051311  for (int j=0;j<mol->AtomCount;j++) {
    12061312    Subgraphs.insert(GraphPair (TestSets[j],pair<int, double>(counter++, 1.)));
    12071313  }
    1208   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);
    12091315  GraphTestPair test2;
    12101316  test2 = Subgraphs.insert(GraphPair (TestSets[mol->AtomCount],pair<int, double>(counter++, 1.)));
    12111317  if (test2.second) {
    1212     Log() << Verbose(1) << "Insertion worked?!" << endl;
     1318    DoLog(1) && (Log() << Verbose(1) << "Insertion worked?!" << endl);
    12131319  } else {
    1214     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);
    12151321  }
    12161322
    12171323  // show graphs
    1218   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);
    12191325  Graph::iterator A = Subgraphs.begin();
    12201326  while (A !=  Subgraphs.end()) {
    1221     Log() << Verbose(0) << (*A).second.first << ": ";
     1327    DoLog(0) && (Log() << Verbose(0) << (*A).second.first << ": ");
    12221328    KeySet::iterator key = (*A).first.begin();
    12231329    comp = -1;
    12241330    while (key != (*A).first.end()) {
    12251331      if ((*key) > comp)
    1226         Log() << Verbose(0) << (*key) << " ";
     1332        DoLog(0) && (Log() << Verbose(0) << (*key) << " ");
    12271333      else
    1228         Log() << Verbose(0) << (*key) << "! ";
     1334        DoLog(0) && (Log() << Verbose(0) << (*key) << "! ");
    12291335      comp = (*key);
    12301336      key++;
    12311337    }
    1232     Log() << Verbose(0) << endl;
     1338    DoLog(0) && (Log() << Verbose(0) << endl);
    12331339    A++;
    12341340  }
     
    12501356
    12511357  if (!strcmp(configuration->configpath, configuration->GetDefaultPath())) {
    1252     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);
    12531359  }
    12541360
     
    12591365  if (output == NULL)
    12601366    strcpy(filename,"main_pcp_linux");
    1261   Log() << Verbose(0) << "Saving as pdb input ";
     1367  DoLog(0) && (Log() << Verbose(0) << "Saving as pdb input ");
    12621368  if (configuration->SavePDB(filename, molecules))
    1263     Log() << Verbose(0) << "done." << endl;
     1369    DoLog(0) && (Log() << Verbose(0) << "done." << endl);
    12641370  else
    1265     Log() << Verbose(0) << "failed." << endl;
     1371    DoLog(0) && (Log() << Verbose(0) << "failed." << endl);
    12661372
    12671373  // then save as tremolo data file
     
    12701376  if (output == NULL)
    12711377    strcpy(filename,"main_pcp_linux");
    1272   Log() << Verbose(0) << "Saving as tremolo data input ";
     1378  DoLog(0) && (Log() << Verbose(0) << "Saving as tremolo data input ");
    12731379  if (configuration->SaveTREMOLO(filename, molecules))
    1274     Log() << Verbose(0) << "done." << endl;
     1380    DoLog(0) && (Log() << Verbose(0) << "done." << endl);
    12751381  else
    1276     Log() << Verbose(0) << "failed." << endl;
     1382    DoLog(0) && (Log() << Verbose(0) << "failed." << endl);
    12771383
    12781384  // translate each to its center and merge all molecules in MoleculeListClass into this molecule
     
    12941400  }
    12951401
    1296   Log() << Verbose(0) << "Storing configuration ... " << endl;
     1402  DoLog(0) && (Log() << Verbose(0) << "Storing configuration ... " << endl);
    12971403  // get correct valence orbitals
    12981404  mol->CalculateOrbitals(*configuration);
     
    13101416  output.close();
    13111417  output.clear();
    1312   Log() << Verbose(0) << "Saving of config file ";
     1418  DoLog(0) && (Log() << Verbose(0) << "Saving of config file ");
    13131419  if (configuration->Save(filename, periode, mol))
    1314     Log() << Verbose(0) << "successful." << endl;
     1420    DoLog(0) && (Log() << Verbose(0) << "successful." << endl);
    13151421  else
    1316     Log() << Verbose(0) << "failed." << endl;
     1422    DoLog(0) && (Log() << Verbose(0) << "failed." << endl);
    13171423
    13181424  // and save to xyz file
     
    13271433    output.open(filename, ios::trunc);
    13281434  }
    1329   Log() << Verbose(0) << "Saving of XYZ file ";
     1435  DoLog(0) && (Log() << Verbose(0) << "Saving of XYZ file ");
    13301436  if (mol->MDSteps <= 1) {
    13311437    if (mol->OutputXYZ(&output))
    1332       Log() << Verbose(0) << "successful." << endl;
     1438      DoLog(0) && (Log() << Verbose(0) << "successful." << endl);
    13331439    else
    1334       Log() << Verbose(0) << "failed." << endl;
     1440      DoLog(0) && (Log() << Verbose(0) << "failed." << endl);
    13351441  } else {
    13361442    if (mol->OutputTrajectoriesXYZ(&output))
    1337       Log() << Verbose(0) << "successful." << endl;
     1443      DoLog(0) && (Log() << Verbose(0) << "successful." << endl);
    13381444    else
    1339       Log() << Verbose(0) << "failed." << endl;
     1445      DoLog(0) && (Log() << Verbose(0) << "failed." << endl);
    13401446  }
    13411447  output.close();
     
    13471453  if (output == NULL)
    13481454    strcpy(filename,"main_pcp_linux");
    1349   Log() << Verbose(0) << "Saving as mpqc input ";
     1455  DoLog(0) && (Log() << Verbose(0) << "Saving as mpqc input ");
    13501456  if (configuration->SaveMPQC(filename, mol))
    1351     Log() << Verbose(0) << "done." << endl;
     1457    DoLog(0) && (Log() << Verbose(0) << "done." << endl);
    13521458  else
    1353     Log() << Verbose(0) << "failed." << endl;
     1459    DoLog(0) && (Log() << Verbose(0) << "failed." << endl);
    13541460
    13551461  if (!strcmp(configuration->configpath, configuration->GetDefaultPath())) {
    1356     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);
    13571463  }
    13581464
     
    13841490  enum ConfigStatus configPresent = absent;
    13851491  clock_t start,end;
     1492  double MaxDistance = -1;
    13861493  int argptr;
    13871494  molecule *mol = NULL;
     
    13951502    do {
    13961503      if (argv[argptr][0] == '-') {
    1397         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");
    13981505        argptr++;
    13991506        switch(argv[argptr-1][1]) {
     
    14011508          case 'H':
    14021509          case '?':
    1403             Log() << Verbose(0) << "MoleCuilder suite" << endl << "==================" << endl << endl;
    1404             Log() << Verbose(0) << "Usage: " << argv[0] << "[config file] [-{acefpsthH?vfrp}] [further arguments]" << endl;
    1405             Log() << Verbose(0) << "or simply " << argv[0] << " without arguments for interactive session." << endl;
    1406             Log() << Verbose(0) << "\t-a Z x1 x2 x3\tAdd new atom of element Z at coordinates (x1,x2,x3)." << endl;
    1407             Log() << Verbose(0) << "\t-A <source>\tCreate adjacency list from bonds parsed from 'dbond'-style file." <<endl;
    1408             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;
    1409             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;
    1410             Log() << Verbose(0) << "\t-c x1 x2 x3\tCenter atoms in domain with a minimum distance to boundary of (x1,x2,x3)." << endl;
    1411             Log() << Verbose(0) << "\t-C\tPair Correlation analysis." << endl;
    1412             Log() << Verbose(0) << "\t-d x1 x2 x3\tDuplicate cell along each axis by given factor." << endl;
    1413             Log() << Verbose(0) << "\t-D <bond distance>\tDepth-First-Search Analysis of the molecule, giving cycles and tree/back edges." << endl;
    1414             Log() << Verbose(0) << "\t-e <file>\tSets the databases path to be parsed (default: ./)." << endl;
    1415             Log() << Verbose(0) << "\t-E <id> <Z>\tChange atom <id>'s element to <Z>, <id> begins at 0." << endl;
    1416             Log() << Verbose(0) << "\t-f/F <dist> <order>\tFragments the molecule in BOSSANOVA manner (with/out rings compressed) and stores config files in same dir as config (return code 0 - fragmented, 2 - no fragmentation necessary)." << endl;
    1417             Log() << Verbose(0) << "\t-g <file>\tParses a bond length table from the given file." << endl;
    1418             Log() << Verbose(0) << "\t-h/-H/-?\tGive this help screen." << endl;
    1419             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;
    1420             Log() << Verbose(0) << "\t-m <0/1>\tCalculate (0)/ Align in(1) PAS with greatest EV along z axis." << endl;
    1421             Log() << Verbose(0) << "\t-M <basis>\tSetting basis to store to MPQC config files." << endl;
    1422             Log() << Verbose(0) << "\t-n\tFast parsing (i.e. no trajectories are looked for)." << endl;
    1423             Log() << Verbose(0) << "\t-N <radius> <file>\tGet non-convex-envelope." << endl;
    1424             Log() << Verbose(0) << "\t-o <out>\tGet volume of the convex envelope (and store to tecplot file)." << endl;
    1425             Log() << Verbose(0) << "\t-O\tCenter atoms in origin." << endl;
    1426             Log() << Verbose(0) << "\t-p <file>\tParse given xyz file and create raw config file from it." << endl;
    1427             Log() << Verbose(0) << "\t-P <file>\tParse given forces file and append as an MD step to config file via Verlet." << endl;
    1428             Log() << Verbose(0) << "\t-r <id>\t\tRemove an atom with given id." << endl;
    1429             Log() << Verbose(0) << "\t-R <id> <radius>\t\tRemove all atoms out of sphere around a given one." << endl;
    1430             Log() << Verbose(0) << "\t-s x1 x2 x3\tScale all atom coordinates by this vector (x1,x2,x3)." << endl;
    1431             Log() << Verbose(0) << "\t-S <file> Store temperatures from the config file in <file>." << endl;
    1432             Log() << Verbose(0) << "\t-t x1 x2 x3\tTranslate all atoms by this vector (x1,x2,x3)." << endl;
    1433             Log() << Verbose(0) << "\t-T x1 x2 x3\tTranslate periodically all atoms by this vector (x1,x2,x3)." << endl;
    1434             Log() << Verbose(0) << "\t-u rho\tsuspend in water solution and output necessary cell lengths, average density rho and repetition." << endl;
    1435             Log() << Verbose(0) << "\t-v\t\tsets verbosity (more is more)." << endl;
    1436             Log() << Verbose(0) << "\t-V\t\tGives version information." << endl;
    1437             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);
    14381551            return (1);
    14391552            break;
     
    14431556            }
    14441557            setVerbosity(verbosity);
    1445             Log() << Verbose(0) << "Setting verbosity to " << verbosity << "." << endl;
     1558            DoLog(0) && (Log() << Verbose(0) << "Setting verbosity to " << verbosity << "." << endl);
    14461559            break;
    14471560          case 'V':
    1448             Log() << Verbose(0) << argv[0] << " " << VERSIONSTRING << endl;
    1449             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);
    14501563            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            }
    14511581            break;
    14521582          case 'e':
    14531583            if ((argptr >= argc) || (argv[argptr][0] == '-')) {
    1454               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);
    14551585              performCriticalExit();
    14561586            } else {
    1457               Log() << Verbose(0) << "Using " << argv[argptr] << " as elements database." << endl;
     1587              DoLog(0) && (Log() << Verbose(0) << "Using " << argv[argptr] << " as elements database." << endl);
    14581588              strncpy (configuration.databasepath, argv[argptr], MAXSTRINGSIZE-1);
    14591589              argptr+=1;
     
    14621592          case 'g':
    14631593            if ((argptr >= argc) || (argv[argptr][0] == '-')) {
    1464               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);
    14651595              performCriticalExit();
    14661596            } else {
    14671597              BondGraphFileName = argv[argptr];
    1468               Log() << Verbose(0) << "Using " << BondGraphFileName << " as bond length table." << endl;
     1598              DoLog(0) && (Log() << Verbose(0) << "Using " << BondGraphFileName << " as bond length table." << endl);
    14691599              argptr+=1;
    14701600            }
    14711601            break;
    14721602          case 'n':
    1473             Log() << Verbose(0) << "I won't parse trajectories." << endl;
     1603            DoLog(0) && (Log() << Verbose(0) << "I won't parse trajectories." << endl);
    14741604            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            }
    14751615            break;
    14761616          default:   // no match? Step on
     
    14841624    // 3a. Parse the element database
    14851625    if (periode->LoadPeriodentafel(configuration.databasepath)) {
    1486       Log() << Verbose(0) << "Element list loaded successfully." << endl;
     1626      DoLog(0) && (Log() << Verbose(0) << "Element list loaded successfully." << endl);
    14871627      //periode->Output();
    14881628    } else {
    1489       Log() << Verbose(0) << "Element list loading failed." << endl;
     1629      DoLog(0) && (Log() << Verbose(0) << "Element list loading failed." << endl);
    14901630      return 1;
    14911631    }
     
    14931633    if (argv[1][0] != '-') {
    14941634      // simply create a new molecule, wherein the config file is loaded and the manipulation takes place
    1495       Log() << Verbose(0) << "Config file given." << endl;
     1635      DoLog(0) && (Log() << Verbose(0) << "Config file given." << endl);
    14961636      test.open(argv[1], ios::in);
    14971637      if (test == NULL) {
     
    14991639        output.open(argv[1], ios::out);
    15001640        if (output == NULL) {
    1501           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);
    15021642          configPresent = absent;
    15031643        } else {
    1504           Log() << Verbose(0) << "Empty configuration file." << endl;
     1644          DoLog(0) && (Log() << Verbose(0) << "Empty configuration file." << endl);
    15051645          ConfigFileName = argv[1];
    15061646          configPresent = empty;
     
    15101650        test.close();
    15111651        ConfigFileName = argv[1];
    1512         Log() << Verbose(1) << "Specified config file found, parsing ... ";
     1652        DoLog(1) && (Log() << Verbose(1) << "Specified config file found, parsing ... ");
    15131653        switch (configuration.TestSyntax(ConfigFileName, periode)) {
    15141654          case 1:
    1515             Log() << Verbose(0) << "new syntax." << endl;
     1655            DoLog(0) && (Log() << Verbose(0) << "new syntax." << endl);
    15161656            configuration.Load(ConfigFileName, BondGraphFileName, periode, molecules);
    15171657            configPresent = present;
    15181658            break;
    15191659          case 0:
    1520             Log() << Verbose(0) << "old syntax." << endl;
     1660            DoLog(0) && (Log() << Verbose(0) << "old syntax." << endl);
    15211661            configuration.LoadOld(ConfigFileName, BondGraphFileName, periode, molecules);
    15221662            configPresent = present;
    15231663            break;
    15241664          default:
    1525             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);
    15261666            configPresent = empty;
    15271667       }
     
    15461686     if (configuration.BG == NULL) {
    15471687       configuration.BG = new BondGraph(configuration.GetIsAngstroem());
    1548        if ((BondGraphFileName.empty()) && (configuration.BG->LoadBondLengthTable(BondGraphFileName))) {
    1549          Log() << Verbose(0) << "Bond length table loaded successfully." << endl;
     1688       if ((!BondGraphFileName.empty()) && (configuration.BG->LoadBondLengthTable(BondGraphFileName))) {
     1689         DoLog(0) && (Log() << Verbose(0) << "Bond length table loaded successfully." << endl);
    15501690       } else {
    1551          eLog() << Verbose(1) << "Bond length table loading failed." << endl;
     1691         DoeLog(1) && (eLog()<< Verbose(1) << "Bond length table loading failed." << endl);
    15521692       }
    15531693     }
     
    15561696    argptr = 1;
    15571697    do {
    1558       Log() << Verbose(0) << "Current Command line argument: " << argv[argptr] << "." << endl;
     1698      DoLog(0) && (Log() << Verbose(0) << "Current Command line argument: " << argv[argptr] << "." << endl);
    15591699      if (argv[argptr][0] == '-') {
    15601700        argptr++;
     
    15651705              if ((argptr >= argc) || (argv[argptr][0] == '-')) {
    15661706                ExitFlag = 255;
    1567                 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);
    15681708                performCriticalExit();
    15691709              } else {
    15701710                SaveFlag = true;
    1571                 Log() << Verbose(1) << "Parsing xyz file for new atoms." << endl;
     1711                DoLog(1) && (Log() << Verbose(1) << "Parsing xyz file for new atoms." << endl);
    15721712                if (!mol->AddXYZFile(argv[argptr]))
    1573                   Log() << Verbose(2) << "File not found." << endl;
     1713                  DoLog(2) && (Log() << Verbose(2) << "File not found." << endl);
    15741714                else {
    1575                   Log() << Verbose(2) << "File found and parsed." << endl;
    1576                   // @TODO rather do the dissection afterwards
    1577 //                  mol->SetNameFromFilename(argv[argptr]);
    1578 //                  molecules->ListOfMolecules.remove(mol);
    1579 //                  molecules->DissectMoleculeIntoConnectedSubgraphs(mol,&configuration);
    1580 //                  delete(mol);
    1581 //                  if (molecules->ListOfMolecules.size() != 0) {
    1582 //                    for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
    1583 //                      if ((*ListRunner)->ActiveFlag) {
    1584 //                        mol = *ListRunner;
    1585 //                        break;
    1586 //                      }
    1587 //                  }
     1715                  DoLog(2) && (Log() << Verbose(2) << "File found and parsed." << endl);
    15881716                  configPresent = present;
    15891717                }
     
    15941722              if ((argptr >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) || (!IsValidNumber(argv[argptr+3]))) {
    15951723                ExitFlag = 255;
    1596                 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);
    15971725                performCriticalExit();
    15981726              } else {
    15991727                SaveFlag = true;
    1600                 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] << "), ");
    16011729                first = new atom;
    16021730                first->type = periode->FindElement(atoi(argv[argptr]));
    16031731                if (first->type != NULL)
    1604                   Log() << Verbose(2) << "found element " << first->type->name << endl;
     1732                  DoLog(2) && (Log() << Verbose(2) << "found element " << first->type->name << endl);
    16051733                for (int i=NDIM;i--;)
    16061734                  first->x.x[i] = atof(argv[argptr+1+i]);
     
    16101738                    configPresent = present;
    16111739                } else
    1612                   eLog() << Verbose(1) << "Could not find the specified element." << endl;
     1740                  DoeLog(1) && (eLog()<< Verbose(1) << "Could not find the specified element." << endl);
    16131741                argptr+=4;
    16141742              }
     
    16231751              if ((argptr >= argc) || (argv[argptr][0] == '-')) {
    16241752                ExitFlag = 255;
    1625                 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);
    16261754                performCriticalExit();
    16271755              } else {
    16281756                configuration.basis = argv[argptr];
    1629                 Log() << Verbose(1) << "Setting MPQC basis to " << configuration.basis << "." << endl;
     1757                DoLog(1) && (Log() << Verbose(1) << "Setting MPQC basis to " << configuration.basis << "." << endl);
    16301758                argptr+=1;
    16311759              }
     
    16341762              if (ExitFlag == 0) ExitFlag = 1;
    16351763              {
    1636                 Log() << Verbose(1) << "Depth-First-Search Analysis." << endl;
     1764                DoLog(1) && (Log() << Verbose(1) << "Depth-First-Search Analysis." << endl);
    16371765                MoleculeLeafClass *Subgraphs = NULL;      // list of subgraphs from DFS analysis
    16381766                int *MinimumRingSize = new int[mol->AtomCount];
     
    16641792              //argptr+=1;
    16651793              break;
     1794            case 'I':
     1795              DoLog(1) && (Log() << Verbose(1) << "Dissecting molecular system into a set of disconnected subgraphs ... " << endl);
     1796              // @TODO rather do the dissection afterwards
     1797              molecules->DissectMoleculeIntoConnectedSubgraphs(periode, &configuration);
     1798              mol = NULL;
     1799              if (molecules->ListOfMolecules.size() != 0) {
     1800                for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     1801                  if ((*ListRunner)->ActiveFlag) {
     1802                    mol = *ListRunner;
     1803                    break;
     1804                  }
     1805              }
     1806              if ((mol == NULL) && (!molecules->ListOfMolecules.empty())) {
     1807                mol = *(molecules->ListOfMolecules.begin());
     1808                if (mol != NULL)
     1809                  mol->ActiveFlag = true;
     1810              }
     1811              break;
    16661812            case 'C':
    1667               if (ExitFlag == 0) ExitFlag = 1;
    1668               if ((argptr+2 >= argc) || (!IsValidNumber(argv[argptr])) || (argv[argptr][0] == '-') || (argv[argptr+1][0] == '-') || (argv[argptr+2][0] == '-')) {
    1669                 ExitFlag = 255;
    1670                 eLog() << Verbose(0) << "Not enough or invalid arguments given for pair correlation analysis: -C <Z> <output> <bin output>" << endl;
    1671                 performCriticalExit();
    1672               } else {
    1673                 SaveFlag = false;
    1674                 ofstream output(argv[argptr+1]);
    1675                 ofstream binoutput(argv[argptr+2]);
    1676                 const double radius = 5.;
    1677 
    1678                 // get the boundary
    1679                 class molecule *Boundary = NULL;
    1680                 class Tesselation *TesselStruct = NULL;
    1681                 const LinkedCell *LCList = NULL;
    1682                 // find biggest molecule
    1683                 int counter  = 0;
    1684                 for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) {
    1685                   if ((Boundary == NULL) || (Boundary->AtomCount < (*BigFinder)->AtomCount)) {
    1686                     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;
    16871962                  }
    1688                   counter++;
    16891963                }
    1690                 bool *Actives = Malloc<bool>(counter, "ParseCommandLineOptions() - case C -- *Actives");
    1691                 counter = 0;
    1692                 for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) {
    1693                   Actives[counter] = (*BigFinder)->ActiveFlag;
    1694                   (*BigFinder)->ActiveFlag = (*BigFinder == Boundary) ? false : true;
    1695                 }
    1696                 LCList = new LinkedCell(Boundary, 2.*radius);
    1697                 element *elemental = periode->FindElement((const int) atoi(argv[argptr]));
    1698                 FindNonConvexBorder(Boundary, TesselStruct, LCList, radius, NULL);
    1699                 int ranges[NDIM] = {1,1,1};
    1700                 CorrelationToSurfaceMap *surfacemap = PeriodicCorrelationToSurface( molecules, elemental, TesselStruct, LCList, ranges );
    1701                 BinPairMap *binmap = BinData( surfacemap, 0.5, 0., 0. );
    1702                 OutputCorrelation ( &binoutput, binmap );
    1703                 output.close();
    1704                 binoutput.close();
    1705                 for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++)
    1706                   (*BigFinder)->ActiveFlag = Actives[counter];
    1707                 Free(&Actives);
    1708                 delete(LCList);
    1709                 delete(TesselStruct);
    1710                 argptr+=3;
    1711               }
    1712               break;
     1964                break;
     1965              }
    17131966            case 'E':
    17141967              if (ExitFlag == 0) ExitFlag = 1;
    17151968              if ((argptr+1 >= argc) || (!IsValidNumber(argv[argptr])) || (argv[argptr+1][0] == '-')) {
    17161969                ExitFlag = 255;
    1717                 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);
    17181971                performCriticalExit();
    17191972              } else {
    17201973                SaveFlag = true;
    1721                 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);
    17221975                first = mol->FindAtom(atoi(argv[argptr]));
    17231976                first->type = periode->FindElement(atoi(argv[argptr+1]));
     
    17271980            case 'F':
    17281981              if (ExitFlag == 0) ExitFlag = 1;
    1729               if (argptr+5 >=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]))) {
    17301989                ExitFlag = 255;
    1731                 eLog() << Verbose(0) << "Not enough or invalid arguments given for filling box with water: -F <dist_x> <dist_y> <dist_z> <randatom> <randmol> <DoRotate>" << endl;
     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);
    17321991                performCriticalExit();
    17331992              } else {
    17341993                SaveFlag = true;
    1735                 Log() << Verbose(1) << "Filling Box with water molecules." << endl;
     1994                DoLog(1) && (Log() << Verbose(1) << "Filling Box with water molecules." << endl);
    17361995                // construct water molecule
    1737                 molecule *filler = new molecule(periode);;
     1996                molecule *filler = new molecule(periode);
     1997                if (!filler->AddXYZFile(argv[argptr])) {
     1998                  DoeLog(0) && (eLog()<< Verbose(0) << "Could not parse filler molecule from " << argv[argptr] << "." << endl);
     1999                }
     2000                filler->SetNameFromFilename(argv[argptr]);
     2001                configuration.BG->ConstructBondGraph(filler);
    17382002                molecule *Filling = NULL;
    1739                 atom *second = NULL, *third = NULL;
    1740                 first = new atom();
    1741                 first->type = periode->FindElement(1);
    1742                 first->x.Init(0.441, -0.143, 0.);
    1743                 filler->AddAtom(first);
    1744                 second = new atom();
    1745                 second->type = periode->FindElement(1);
    1746                 second->x.Init(-0.464, 1.137, 0.0);
    1747                 filler->AddAtom(second);
    1748                 third = new atom();
    1749                 third->type = periode->FindElement(8);
    1750                 third->x.Init(-0.464, 0.177, 0.);
    1751                 filler->AddAtom(third);
    1752                 filler->AddBond(first, third, 1);
    1753                 filler->AddBond(second, third, 1);
    17542003                // call routine
    17552004                double distance[NDIM];
    17562005                for (int i=0;i<NDIM;i++)
    1757                   distance[i] = atof(argv[argptr+i]);
    1758                 Filling = FillBoxWithMolecule(molecules, filler, configuration, distance, atof(argv[argptr+3]), atof(argv[argptr+4]), atoi(argv[argptr+5]));
     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]));
    17592008                if (Filling != NULL) {
     2009                  Filling->ActiveFlag = false;
    17602010                  molecules->insert(Filling);
    17612011                }
     
    17682018              if ((argptr >= argc) || (argv[argptr][0] == '-')) {
    17692019                ExitFlag =255;
    1770                 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);
    17712021                performCriticalExit();
    17722022              } else {
    1773                 Log() << Verbose(0) << "Parsing bonds from " << argv[argptr] << "." << endl;
     2023                DoLog(0) && (Log() << Verbose(0) << "Parsing bonds from " << argv[argptr] << "." << endl);
    17742024                ifstream *input = new ifstream(argv[argptr]);
    17752025                mol->CreateAdjacencyListFromDbondFile(input);
     
    17782028              }
    17792029              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
    17802059            case 'N':
    17812060              if (ExitFlag == 0) ExitFlag = 1;
    17822061              if ((argptr+1 >= argc) || (argv[argptr+1][0] == '-')){
    17832062                ExitFlag = 255;
    1784                 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);
    17852064                performCriticalExit();
    17862065              } else {
     
    17902069                //string filename(argv[argptr+1]);
    17912070                //filename.append(".csv");
    1792                 Log() << Verbose(0) << "Evaluating non-convex envelope of biggest molecule.";
    1793                 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);
    17942073                // find biggest molecule
    17952074                int counter  = 0;
     
    18012080                  counter++;
    18022081                }
    1803                 Log() << Verbose(1) << "Biggest molecule has " << Boundary->AtomCount << " atoms." << endl;
     2082                DoLog(1) && (Log() << Verbose(1) << "Biggest molecule has " << Boundary->AtomCount << " atoms." << endl);
    18042083                start = clock();
    18052084                LCList = new LinkedCell(Boundary, atof(argv[argptr])*2.);
     
    18082087                //FindDistributionOfEllipsoids(T, &LCList, N, number, filename.c_str());
    18092088                end = clock();
    1810                 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);
    18112090                delete(LCList);
    18122091                delete(T);
     
    18182097              if ((argptr >= argc) || (argv[argptr][0] == '-')) {
    18192098                ExitFlag = 255;
    1820                 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);
    18212100                performCriticalExit();
    18222101              } else {
    1823                 Log() << Verbose(1) << "Storing temperatures in " << argv[argptr] << "." << endl;
     2102                DoLog(1) && (Log() << Verbose(1) << "Storing temperatures in " << argv[argptr] << "." << endl);
    18242103                ofstream *output = new ofstream(argv[argptr], ios::trunc);
    18252104                if (!mol->OutputTemperatureFromTrajectories(output, 0, mol->MDSteps))
    1826                   Log() << Verbose(2) << "File could not be written." << endl;
     2105                  DoLog(2) && (Log() << Verbose(2) << "File could not be written." << endl);
    18272106                else
    1828                   Log() << Verbose(2) << "File stored." << endl;
     2107                  DoLog(2) && (Log() << Verbose(2) << "File stored." << endl);
    18292108                output->close();
    18302109                delete(output);
     
    18362115              if ((argptr >= argc) || (argv[argptr][0] == '-')) {
    18372116                ExitFlag = 255;
    1838                 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);
    18392118                performCriticalExit();
    18402119              } else {
    18412120                SaveFlag = true;
    1842                 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);
    18432122                if (atoi(argv[argptr+3]) == 1)
    1844                   Log() << Verbose(1) << "Using Identity for the permutation map." << endl;
     2123                  DoLog(1) && (Log() << Verbose(1) << "Using Identity for the permutation map." << endl);
    18452124                if (!mol->LinearInterpolationBetweenConfiguration(atoi(argv[argptr]), atoi(argv[argptr+1]), argv[argptr+2], configuration, atoi(argv[argptr+3])) == 1 ? true : false)
    1846                   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);
    18472126                else
    1848                   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);
    18492128                argptr+=4;
    18502129              }
     
    18542133              if ((argptr >= argc) || (argv[argptr][0] == '-')) {
    18552134                ExitFlag = 255;
    1856                 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);
    18572136                performCriticalExit();
    18582137              } else {
    18592138                SaveFlag = true;
    1860                 Log() << Verbose(1) << "Parsing forces file and Verlet integrating." << endl;
     2139                DoLog(1) && (Log() << Verbose(1) << "Parsing forces file and Verlet integrating." << endl);
    18612140                if (!mol->VerletForceIntegration(argv[argptr], configuration))
    1862                   Log() << Verbose(2) << "File not found." << endl;
     2141                  DoLog(2) && (Log() << Verbose(2) << "File not found." << endl);
    18632142                else
    1864                   Log() << Verbose(2) << "File found and parsed." << endl;
     2143                  DoLog(2) && (Log() << Verbose(2) << "File found and parsed." << endl);
    18652144                argptr+=1;
    18662145              }
     
    18702149              if ((argptr+1 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])))  {
    18712150                ExitFlag = 255;
    1872                 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);
    18732152                performCriticalExit();
    18742153              } else {
    18752154                SaveFlag = true;
    1876                 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);
    18772156                double tmp1 = atof(argv[argptr+1]);
    18782157                atom *third = mol->FindAtom(atoi(argv[argptr]));
     
    18872166                  }
    18882167                } else {
    1889                   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);
    18902169                }
    18912170                argptr+=2;
     
    18962175              if ((argptr+2 >= argc) || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) ) {
    18972176                ExitFlag = 255;
    1898                 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);
    18992178                performCriticalExit();
    19002179              } else {
    19012180                if (ExitFlag == 0) ExitFlag = 1;
    19022181                SaveFlag = true;
    1903                 Log() << Verbose(1) << "Translating all ions by given vector." << endl;
     2182                DoLog(1) && (Log() << Verbose(1) << "Translating all ions by given vector." << endl);
    19042183                for (int i=NDIM;i--;)
    19052184                  x.x[i] = atof(argv[argptr+i]);
     
    19122191              if ((argptr+2 >= argc) || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) ) {
    19132192                ExitFlag = 255;
    1914                 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);
    19152194                performCriticalExit();
    19162195              } else {
    19172196                if (ExitFlag == 0) ExitFlag = 1;
    19182197                SaveFlag = true;
    1919                 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);
    19202199                for (int i=NDIM;i--;)
    19212200                  x.x[i] = atof(argv[argptr+i]);
     
    19282207              if ((argptr >= argc) || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) ) {
    19292208                ExitFlag = 255;
    1930                 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);
    19312210                performCriticalExit();
    19322211              } else {
    19332212                SaveFlag = true;
    19342213                j = -1;
    1935                 Log() << Verbose(1) << "Scaling all ion positions by factor." << endl;
     2214                DoLog(1) && (Log() << Verbose(1) << "Scaling all ion positions by factor." << endl);
    19362215                factor = new double[NDIM];
    19372216                factor[0] = atof(argv[argptr]);
     
    19392218                factor[2] = atof(argv[argptr+2]);
    19402219                mol->Scale((const double ** const)&factor);
     2220                double * const cell_size = World::get()->cell_size;
    19412221                for (int i=0;i<NDIM;i++) {
    19422222                  j += i+1;
    19432223                  x.x[i] = atof(argv[NDIM+i]);
    1944                   mol->cell_size[j]*=factor[i];
     2224                  cell_size[j]*=factor[i];
    19452225                }
    19462226                delete[](factor);
     
    19522232              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])) ) {
    19532233                ExitFlag = 255;
    1954                 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);
    19552235                performCriticalExit();
    19562236              } else {
    19572237                SaveFlag = true;
    19582238                j = -1;
    1959                 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;
    19602241                for (int i=0;i<6;i++) {
    1961                   mol->cell_size[i] = atof(argv[argptr+i]);
     2242                  cell_size[i] = atof(argv[argptr+i]);
    19622243                }
    19632244                // center
     
    19702251              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])) ) {
    19712252                ExitFlag = 255;
    1972                 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);
    19732254                performCriticalExit();
    19742255              } else {
    19752256                SaveFlag = true;
    19762257                j = -1;
    1977                 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;
    19782260                for (int i=0;i<6;i++) {
    1979                   mol->cell_size[i] = atof(argv[argptr+i]);
     2261                  cell_size[i] = atof(argv[argptr+i]);
    19802262                }
    19812263                // center
     
    19882270              if ((argptr+2 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) ) {
    19892271                ExitFlag = 255;
    1990                 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);
    19912273                performCriticalExit();
    19922274              } else {
    19932275                SaveFlag = true;
    19942276                j = -1;
    1995                 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);
    19962278                // make every coordinate positive
    19972279                mol->CenterEdge(&x);
     
    19992281                mol->SetBoxDimension(&x);
    20002282                // translate each coordinate by boundary
     2283                double * const cell_size = World::get()->cell_size;
    20012284                j=-1;
    20022285                for (int i=0;i<NDIM;i++) {
    20032286                  j += i+1;
    20042287                  x.x[i] = atof(argv[argptr+i]);
    2005                   mol->cell_size[j] += x.x[i]*2.;
     2288                  cell_size[j] += x.x[i]*2.;
    20062289                }
    20072290                mol->Translate((const Vector *)&x);
     
    20122295              if (ExitFlag == 0) ExitFlag = 1;
    20132296              SaveFlag = true;
    2014               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);
    20152298              x.Zero();
    20162299              mol->CenterEdge(&x);
     
    20222305              if ((argptr >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])))  {
    20232306                ExitFlag = 255;
    2024                 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);
    20252308                performCriticalExit();
    20262309              } else {
    20272310                SaveFlag = true;
    2028                 Log() << Verbose(1) << "Removing atom " << argv[argptr] << "." << endl;
     2311                DoLog(1) && (Log() << Verbose(1) << "Removing atom " << argv[argptr] << "." << endl);
    20292312                atom *first = mol->FindAtom(atoi(argv[argptr]));
    20302313                mol->RemoveAtom(first);
     
    20362319              if ((argptr+1 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1]))) {
    20372320                ExitFlag = 255;
    2038                 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);
    20392322                performCriticalExit();
    20402323              } else {
    2041                 Log() << Verbose(0) << "Fragmenting molecule with bond distance " << argv[argptr] << " angstroem, order of " << argv[argptr+1] << "." << endl;
    2042                 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);
    20432326                start = clock();
    20442327                mol->CreateAdjacencyList(atof(argv[argptr++]), configuration.GetIsAngstroem(), &BondGraph::CovalentMinMaxDistance, NULL);
    2045                 Log() << Verbose(0) << "Fragmenting molecule with current connection matrix ..." << endl;
     2328                DoLog(0) && (Log() << Verbose(0) << "Fragmenting molecule with current connection matrix ..." << endl);
    20462329                if (mol->first->next != mol->last) {
    20472330                  ExitFlag = mol->FragmentMolecule(atoi(argv[argptr]), &configuration);
    20482331                }
    20492332                end = clock();
    2050                 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);
    20512334                argptr+=2;
    20522335              }
     
    20562339              j = atoi(argv[argptr++]);
    20572340              if ((j<0) || (j>1)) {
    2058                 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);
    20592342                j = 0;
    20602343              }
    20612344              if (j) {
    20622345                SaveFlag = true;
    2063                 Log() << Verbose(0) << "Converting to prinicipal axis system." << endl;
     2346                DoLog(0) && (Log() << Verbose(0) << "Converting to prinicipal axis system." << endl);
    20642347              } else
    2065                 Log() << Verbose(0) << "Evaluating prinicipal axis." << endl;
     2348                DoLog(0) && (Log() << Verbose(0) << "Evaluating prinicipal axis." << endl);
    20662349              mol->PrincipalAxisSystem((bool)j);
    20672350              break;
     
    20702353              if ((argptr+1 >= argc) || (argv[argptr][0] == '-')){
    20712354                ExitFlag = 255;
    2072                 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);
    20732356                performCriticalExit();
    20742357              } else {
    20752358                class Tesselation *TesselStruct = NULL;
    20762359                const LinkedCell *LCList = NULL;
    2077                 Log() << Verbose(0) << "Evaluating volume of the convex envelope.";
    2078                 Log() << Verbose(1) << "Storing tecplot convex data in " << argv[argptr] << "." << endl;
    2079                 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);
    20802363                LCList = new LinkedCell(mol, 10.);
    20812364                //FindConvexBorder(mol, LCList, argv[argptr]);
     
    20842367                double volumedifference = ConvexizeNonconvexEnvelope(TesselStruct, mol, argv[argptr]);
    20852368                double clustervolume = VolumeOfConvexEnvelope(TesselStruct, &configuration);
    2086                 Log() << Verbose(0) << "The tesselated volume area is " << clustervolume << " " << (configuration.GetIsAngstroem() ? "angstrom" : "atomiclength") << "^3." << endl;
    2087                 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);
    20882371                delete(TesselStruct);
    20892372                delete(LCList);
     
    20952378              if ((argptr+1 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) ) {
    20962379                ExitFlag = 255;
    2097                 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);
    20982381                performCriticalExit();
    20992382              } else {
    21002383                volume = atof(argv[argptr++]);
    2101                 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);
    21022385              }
    21032386            case 'u':
     
    21062389                if (volume != -1)
    21072390                  ExitFlag = 255;
    2108                   eLog() << Verbose(0) << "Not enough arguments given for suspension: -u <density>" << endl;
     2391                  DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for suspension: -u <density>" << endl);
    21092392                  performCriticalExit();
    21102393              } else {
    21112394                double density;
    21122395                SaveFlag = true;
    2113                 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.");
    21142397                density = atof(argv[argptr++]);
    21152398                if (density < 1.0) {
    2116                   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);
    21172400                  density = 1.3;
    21182401                }
     
    21202403//                  repetition[i] = atoi(argv[argptr++]);
    21212404//                  if (repetition[i] < 1)
    2122 //                    eLog() << Verbose(1) << "repetition value must be greater 1!" << endl;
     2405//                    DoeLog(1) && (eLog()<< Verbose(1) << "repetition value must be greater 1!" << endl);
    21232406//                  repetition[i] = 1;
    21242407//                }
     
    21302413              if ((argptr+2 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) ) {
    21312414                ExitFlag = 255;
    2132                 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);
    21332416                performCriticalExit();
    21342417              } else {
    21352418                SaveFlag = true;
     2419                double * const cell_size = World::get()->cell_size;
    21362420                for (int axis = 1; axis <= NDIM; axis++) {
    21372421                  int faktor = atoi(argv[argptr++]);
     
    21402424                  Vector ** vectors;
    21412425                  if (faktor < 1) {
    2142                     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);
    21432427                    faktor = 1;
    21442428                  }
     
    21572441                    }
    21582442                    if (count != j)
    2159                       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);
    21602444                    x.Zero();
    21612445                    y.Zero();
    2162                     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
    21632447                    for (int i=1;i<faktor;i++) {  // then add this list with respective translation factor times
    21642448                      x.AddVector(&y); // per factor one cell width further
     
    21812465                      mol->Translate(&x);
    21822466                    }
    2183                     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;
    21842468                  }
    21852469                }
     
    21982482  } else {  // no arguments, hence scan the elements db
    21992483    if (periode->LoadPeriodentafel(configuration.databasepath))
    2200       Log() << Verbose(0) << "Element list loaded successfully." << endl;
     2484      DoLog(0) && (Log() << Verbose(0) << "Element list loaded successfully." << endl);
    22012485    else
    2202       Log() << Verbose(0) << "Element list loading failed." << endl;
     2486      DoLog(0) && (Log() << Verbose(0) << "Element list loading failed." << endl);
    22032487    configuration.RetrieveConfigPathAndName("main_pcp_linux");
    22042488  }
     
    22212505  char *ConfigFileName = NULL;
    22222506  int j;
     2507
     2508  cout << ESPACKVersion << endl;
     2509
     2510  DoLog(1) && (Log() << Verbose(1) << "test" << endl);
     2511  DoLog(3) && (Log() << Verbose(1) << "test");
    22232512
    22242513  setVerbosity(0);
     
    22482537  if (molecules->ListOfMolecules.size() == 0) {
    22492538    mol = new molecule(periode);
    2250     if (mol->cell_size[0] == 0.) {
    2251       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);
    22522542      for (int i=0;i<6;i++) {
    2253         Log() << Verbose(1) << "Cell size" << i << ": ";
    2254         cin >> mol->cell_size[i];
     2543        DoLog(1) && (Log() << Verbose(1) << "Cell size" << i << ": ");
     2544        cin >> cell_size[i];
    22552545      }
    22562546    }
     
    22622552
    22632553  // now the main construction loop
    2264   Log() << Verbose(0) << endl << "Now comes the real construction..." << endl;
     2554  DoLog(0) && (Log() << Verbose(0) << endl << "Now comes the real construction..." << endl);
    22652555  do {
    2266     Log() << Verbose(0) << endl << endl;
    2267     Log() << Verbose(0) << "============Molecule list=======================" << endl;
     2556    DoLog(0) && (Log() << Verbose(0) << endl << endl);
     2557    DoLog(0) && (Log() << Verbose(0) << "============Molecule list=======================" << endl);
    22682558    molecules->Enumerate((ofstream *)&cout);
    2269     Log() << Verbose(0) << "============Menu===============================" << endl;
    2270     Log() << Verbose(0) << "a - set molecule (in)active" << endl;
    2271     Log() << Verbose(0) << "e - edit molecules (load, parse, save)" << endl;
    2272     Log() << Verbose(0) << "g - globally manipulate atoms in molecule" << endl;
    2273     Log() << Verbose(0) << "M - Merge molecules" << endl;
    2274     Log() << Verbose(0) << "m - manipulate atoms" << endl;
    2275     Log() << Verbose(0) << "-----------------------------------------------" << endl;
    2276     Log() << Verbose(0) << "c - edit the current configuration" << endl;
    2277     Log() << Verbose(0) << "-----------------------------------------------" << endl;
    2278     Log() << Verbose(0) << "s - save current setup to config file" << endl;
    2279     Log() << Verbose(0) << "T - call the current test routine" << endl;
    2280     Log() << Verbose(0) << "q - quit" << endl;
    2281     Log() << Verbose(0) << "===============================================" << endl;
    2282     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: ");
    22832573    cin >> choice;
    22842574
     
    22862576      case 'a':  // (in)activate molecule
    22872577        {
    2288           Log() << Verbose(0) << "Enter index of molecule: ";
     2578          DoLog(0) && (Log() << Verbose(0) << "Enter index of molecule: ");
    22892579          cin >> j;
    22902580          for(MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     
    23322622  // save element data base
    23332623  if (periode->StorePeriodentafel(configuration->databasepath)) //ElementsFileName
    2334     Log() << Verbose(0) << "Saving of elements.db successful." << endl;
     2624    DoLog(0) && (Log() << Verbose(0) << "Saving of elements.db successful." << endl);
    23352625  else
    2336     Log() << Verbose(0) << "Saving of elements.db failed." << endl;
     2626    DoLog(0) && (Log() << Verbose(0) << "Saving of elements.db failed." << endl);
    23372627
    23382628  delete(molecules); // also free's all molecules contained
Note: See TracChangeset for help on using the changeset viewer.