Changes in / [8ab0407:c7b1e7]


Ignore:
Location:
src
Files:
4 added
41 edited

Legend:

Unmodified
Added
Removed
  • src/Makefile.am

    r8ab0407 rc7b1e7  
    88ANALYSISHEADER = analysis_bonds.hpp analysis_correlation.hpp
    99
    10 SOURCE = ${ANALYSISSOURCE} ${ATOMSOURCE} bond.cpp bondgraph.cpp boundary.cpp config.cpp element.cpp ellipsoid.cpp errorlogger.cpp graph.cpp helpers.cpp info.cpp leastsquaremin.cpp linkedcell.cpp log.cpp logger.cpp memoryusageobserver.cpp moleculelist.cpp molecule.cpp molecule_dynamics.cpp molecule_fragmentation.cpp molecule_geometry.cpp molecule_graph.cpp molecule_pointcloud.cpp parser.cpp periodentafel.cpp tesselation.cpp tesselationhelpers.cpp vector.cpp verbose.cpp
    11 HEADER = ${ANALYSISHEADER} ${ATOMHEADER} bond.hpp bondgraph.hpp boundary.hpp config.hpp defs.hpp element.hpp ellipsoid.hpp errorlogger.hpp graph.hpp helpers.hpp info.hpp leastsquaremin.hpp linkedcell.hpp lists.hpp log.hpp logger.hpp memoryallocator.hpp memoryusageobserver.hpp molecule.hpp molecule_template.hpp parser.hpp periodentafel.hpp stackclass.hpp tesselation.hpp tesselationhelpers.hpp vector.hpp verbose.hpp
     10SOURCE = ${ANALYSISSOURCE} ${ATOMSOURCE} bond.cpp bondgraph.cpp boundary.cpp config.cpp element.cpp ellipsoid.cpp errorlogger.cpp graph.cpp helpers.cpp info.cpp leastsquaremin.cpp linkedcell.cpp log.cpp logger.cpp memoryusageobserver.cpp moleculelist.cpp molecule.cpp molecule_dynamics.cpp molecule_fragmentation.cpp molecule_geometry.cpp molecule_graph.cpp molecule_pointcloud.cpp parser.cpp periodentafel.cpp tesselation.cpp tesselationhelpers.cpp triangleintersectionlist.cpp vector.cpp verbose.cpp World.cpp
     11HEADER = ${ANALYSISHEADER} ${ATOMHEADER} bond.hpp bondgraph.hpp boundary.hpp config.hpp defs.hpp element.hpp ellipsoid.hpp errorlogger.hpp graph.hpp helpers.hpp info.hpp leastsquaremin.hpp linkedcell.hpp lists.hpp log.hpp logger.hpp memoryallocator.hpp memoryusageobserver.hpp molecule.hpp molecule_template.hpp parser.hpp periodentafel.hpp stackclass.hpp tesselation.hpp tesselationhelpers.hpp triangleintersectionlist.cpp vector.hpp verbose.hpp World.hpp
    1212
    1313BOOST_LIB = $(BOOST_LDFLAGS) $(BOOST_MPL_LIB)
  • src/analysis_bonds.cpp

    r8ab0407 rc7b1e7  
    3737  }
    3838  if (((int)Mean % 2) != 0)
    39     eLog() << Verbose(1) << "Something is wrong with the bond structure, the number of bonds is not even!" << endl;
     39    DoeLog(1) && (eLog()<< Verbose(1) << "Something is wrong with the bond structure, the number of bonds is not even!" << endl);
    4040  Mean /= (double)AtomCount;
    4141};
  • src/analysis_correlation.cpp

    r8ab0407 rc7b1e7  
    1515#include "tesselation.hpp"
    1616#include "tesselationhelpers.hpp"
     17#include "triangleintersectionlist.hpp"
    1718#include "vector.hpp"
    1819#include "verbose.hpp"
     20#include "World.hpp"
    1921
    2022
     
    3436
    3537  if (molecules->ListOfMolecules.empty()) {
    36     eLog() << Verbose(1) <<"No molecule given." << endl;
     38    DoeLog(1) && (eLog()<< Verbose(1) <<"No molecule given." << endl);
    3739    return outmap;
    3840  }
     
    4042  for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++)
    4143    if ((*MolWalker)->ActiveFlag) {
    42       eLog() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl;
     44      DoeLog(2) && (eLog()<< Verbose(2) << "Current molecule is " << *MolWalker << "." << endl);
    4345      atom *Walker = (*MolWalker)->start;
    4446      while (Walker->next != (*MolWalker)->end) {
     
    5557                if (Walker->nr < OtherWalker->nr)
    5658                  if ((type2 == NULL) || (OtherWalker->type == type2)) {
    57                     distance = Walker->node->PeriodicDistance(OtherWalker->node, (*MolWalker)->cell_size);
     59                    distance = Walker->node->PeriodicDistance(OtherWalker->node, World::get()->cell_size);
    5860                    //Log() << Verbose(1) <<"Inserting " << *Walker << " and " << *OtherWalker << endl;
    5961                    outmap->insert ( pair<double, pair <atom *, atom*> > (distance, pair<atom *, atom*> (Walker, OtherWalker) ) );
     
    9092
    9193  if (molecules->ListOfMolecules.empty()) {
    92     eLog() << Verbose(1) <<"No molecule given." << endl;
     94    DoeLog(1) && (eLog()<< Verbose(1) <<"No molecule given." << endl);
    9395    return outmap;
    9496  }
     
    9698  for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++)
    9799    if ((*MolWalker)->ActiveFlag) {
    98       double * FullMatrix = ReturnFullMatrixforSymmetric((*MolWalker)->cell_size);
     100      double * FullMatrix = ReturnFullMatrixforSymmetric(World::get()->cell_size);
    99101      double * FullInverseMatrix = InverseMatrix(FullMatrix);
    100       eLog() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl;
     102      DoeLog(2) && (eLog()<< Verbose(2) << "Current molecule is " << *MolWalker << "." << endl);
    101103      atom *Walker = (*MolWalker)->start;
    102104      while (Walker->next != (*MolWalker)->end) {
     
    174176        Log() << Verbose(3) << "Current atom is " << *Walker << "." << endl;
    175177        if ((type == NULL) || (Walker->type == type)) {
    176           distance = Walker->node->PeriodicDistance(point, (*MolWalker)->cell_size);
     178          distance = Walker->node->PeriodicDistance(point, World::get()->cell_size);
    177179          Log() << Verbose(4) << "Current distance is " << distance << "." << endl;
    178180          outmap->insert ( pair<double, pair<atom *, const Vector*> >(distance, pair<atom *, const Vector*> (Walker, point) ) );
     
    208210  for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++)
    209211    if ((*MolWalker)->ActiveFlag) {
    210       double * FullMatrix = ReturnFullMatrixforSymmetric((*MolWalker)->cell_size);
     212      double * FullMatrix = ReturnFullMatrixforSymmetric(World::get()->cell_size);
    211213      double * FullInverseMatrix = InverseMatrix(FullMatrix);
    212214      Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl;
     
    255257
    256258  if ((Surface == NULL) || (LC == NULL) || (molecules->ListOfMolecules.empty())) {
    257     Log() << Verbose(1) <<"No Tesselation, no LinkedCell or no molecule given." << endl;
     259    DoeLog(1) && (eLog()<< Verbose(1) <<"No Tesselation, no LinkedCell or no molecule given." << endl);
    258260    return outmap;
    259261  }
     
    261263  for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++)
    262264    if ((*MolWalker)->ActiveFlag) {
    263       Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl;
    264       atom *Walker = (*MolWalker)->start;
    265       while (Walker->next != (*MolWalker)->end) {
    266         Walker = Walker->next;
    267         Log() << Verbose(3) << "Current atom is " << *Walker << "." << endl;
     265      Log() << Verbose(1) << "Current molecule is " << (*MolWalker)->name << "." << endl;
     266      atom *Walker = (*MolWalker)->start;
     267      while (Walker->next != (*MolWalker)->end) {
     268        Walker = Walker->next;
     269        //Log() << Verbose(1) << "Current atom is " << *Walker << "." << endl;
    268270        if ((type == NULL) || (Walker->type == type)) {
    269           triangle = Surface->FindClosestTriangleToVector(Walker->node, LC );
    270           if (triangle != NULL) {
    271             distance = DistanceToTrianglePlane(Walker->node, triangle);
    272             outmap->insert ( pair<double, pair<atom *, BoundaryTriangleSet*> >(distance, pair<atom *, BoundaryTriangleSet*> (Walker, triangle) ) );
    273           }
    274         }
    275       }
    276     }
     271          TriangleIntersectionList Intersections(Walker->node,Surface,LC);
     272          distance = Intersections.GetSmallestDistance();
     273          triangle = Intersections.GetClosestTriangle();
     274          outmap->insert ( pair<double, pair<atom *, BoundaryTriangleSet*> >(distance, pair<atom *, BoundaryTriangleSet*> (Walker, triangle) ) );
     275        }
     276      }
     277    } else
     278      Log() << Verbose(1) << "molecule " << (*MolWalker)->name << " is not active." << endl;
     279
    277280
    278281  return outmap;
     
    312315  for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++)
    313316    if ((*MolWalker)->ActiveFlag) {
    314       double * FullMatrix = ReturnFullMatrixforSymmetric((*MolWalker)->cell_size);
     317      double * FullMatrix = ReturnFullMatrixforSymmetric(World::get()->cell_size);
    315318      double * FullInverseMatrix = InverseMatrix(FullMatrix);
    316319      Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl;
     
    330333                checkX.AddVector(&periodicX);
    331334                checkX.MatrixMultiplication(FullMatrix);
    332                 triangle = Surface->FindClosestTriangleToVector(&checkX, LC);
    333                 distance = Surface->GetDistanceSquaredToTriangle(checkX, triangle);
     335                TriangleIntersectionList Intersections(&checkX,Surface,LC);
     336                distance = Intersections.GetSmallestDistance();
     337                triangle = Intersections.GetClosestTriangle();
    334338                if ((ShortestDistance == -1.) || (distance < ShortestDistance)) {
    335339                  ShortestDistance = distance;
     
    338342              }
    339343          // insert
    340           ShortestDistance = sqrt(ShortestDistance);
    341344          outmap->insert ( pair<double, pair<atom *, BoundaryTriangleSet*> >(ShortestDistance, pair<atom *, BoundaryTriangleSet*> (Walker, ShortestTriangle) ) );
    342345          //Log() << Verbose(1) << "INFO: Inserting " << Walker << " with distance " << ShortestDistance << " to " << *ShortestTriangle << "." << endl;
     
    350353};
    351354
    352 /** Returns the start of the bin for a given value.
     355/** Returns the index of the bin for a given value.
    353356 * \param value value whose bin to look for
    354357 * \param BinWidth width of bin
    355358 * \param BinStart first bin
    356359 */
    357 double GetBin ( const double value, const double BinWidth, const double BinStart )
    358 {
    359   Info FunctionInfo(__func__);
    360   double bin =(double) (floor((value - BinStart)/BinWidth));
    361   return (bin*BinWidth+BinStart);
     360int GetBin ( const double value, const double BinWidth, const double BinStart )
     361{
     362  Info FunctionInfo(__func__);
     363  int bin =(int) (floor((value - BinStart)/BinWidth));
     364  return (bin);
    362365};
    363366
     
    372375  *file << "BinStart\tCount" << endl;
    373376  for (BinPairMap::const_iterator runner = map->begin(); runner != map->end(); ++runner) {
    374     *file << runner->first << "\t" << runner->second << endl;
     377    *file << setprecision(8) << runner->first << "\t" << runner->second << endl;
    375378  }
    376379};
     
    385388  *file << "BinStart\tAtom1\tAtom2" << endl;
    386389  for (PairCorrelationMap::const_iterator runner = map->begin(); runner != map->end(); ++runner) {
    387     *file << runner->first << "\t" << *(runner->second.first) << "\t" << *(runner->second.second) << endl;
     390    *file << setprecision(8) << runner->first << "\t" << *(runner->second.first) << "\t" << *(runner->second.second) << endl;
    388391  }
    389392};
     
    400403    *file << runner->first;
    401404    for (int i=0;i<NDIM;i++)
    402       *file << "\t" << (runner->second.first->node->x[i] - runner->second.second->x[i]);
     405      *file << "\t" << setprecision(8) << (runner->second.first->node->x[i] - runner->second.second->x[i]);
    403406    *file << endl;
    404407  }
     
    413416  Info FunctionInfo(__func__);
    414417  *file << "BinStart\tTriangle" << endl;
    415   for (CorrelationToSurfaceMap::const_iterator runner = map->begin(); runner != map->end(); ++runner) {
    416     *file << runner->first << "\t" << *(runner->second.first) << "\t" << *(runner->second.second) << endl;
    417   }
    418 };
    419 
     418  if (!map->empty())
     419    for (CorrelationToSurfaceMap::const_iterator runner = map->begin(); runner != map->end(); ++runner) {
     420      *file << setprecision(8) << runner->first << "\t" << *(runner->second.first) << "\t" << *(runner->second.second) << endl;
     421    }
     422};
     423
  • src/analysis_correlation.hpp

    r8ab0407 rc7b1e7  
    5151CorrelationToPointMap *PeriodicCorrelationToPoint(MoleculeListClass * const &molecules, const element * const type, const Vector *point, const int ranges[NDIM] );
    5252CorrelationToSurfaceMap *PeriodicCorrelationToSurface(MoleculeListClass * const &molecules, const element * const type, const Tesselation * const Surface, const LinkedCell *LC, const int ranges[NDIM] );
    53 double GetBin ( const double value, const double BinWidth, const double BinStart );
     53int GetBin ( const double value, const double BinWidth, const double BinStart );
    5454void OutputCorrelation( ofstream * const file, const BinPairMap * const map );
    5555void OutputPairCorrelation( ofstream * const file, const PairCorrelationMap * const map );
     
    7171
    7272  if (map == NULL) {
    73     eLog() << Verbose(0) << "Nothing to min/max, map is NULL!" << endl;
     73    DoeLog(0) && (eLog()<< Verbose(0) << "Nothing to min/max, map is NULL!" << endl);
    7474    performCriticalExit();
    7575    return;
     
    103103{
    104104  BinPairMap *outmap = new BinPairMap;
    105   double bin = 0.;
     105  int bin = 0;
    106106  double start = 0.;
    107107  double end = 0.;
     
    109109
    110110  if (map == NULL) {
    111     eLog() << Verbose(0) << "Nothing to bin, is NULL!" << endl;
     111    DoeLog(0) && (eLog()<< Verbose(0) << "Nothing to bin, is NULL!" << endl);
    112112    performCriticalExit();
    113113    return outmap;
     
    122122    start = BinStart;
    123123    end = BinEnd;
    124     for (double runner = start; runner <= end; runner += BinWidth)
    125       outmap->insert( pair<double, int> (runner, 0) );
    126124  }
     125  for (int runner = 0; runner <= ceil((end-start)/BinWidth); runner++)
     126    outmap->insert( pair<double, int> ((double)runner*BinWidth+start, 0) );
    127127
    128128  for (typename T::iterator runner = map->begin(); runner != map->end(); ++runner) {
    129129    bin = GetBin (runner->first, BinWidth, start);
    130     BinPairMapInserter = outmap->insert ( pair<double, int> (bin, 1) );
     130    BinPairMapInserter = outmap->insert ( pair<double, int> ((double)bin*BinWidth+start, 1) );
    131131    if (!BinPairMapInserter.second) {  // bin already present, increase
    132132      BinPairMapInserter.first->second += 1;
  • src/analyzer.cpp

    r8ab0407 rc7b1e7  
    9696  if (!Hcorrection.ParseFragmentMatrix(argv[1], "", HCORRECTIONSUFFIX,0,0)) {
    9797    NoHCorrection = true;
    98     eLog() << Verbose(2) << "No HCorrection file found, skipping these." << endl;
     98    DoeLog(2) && (eLog()<< Verbose(2) << "No HCorrection file found, skipping these." << endl);
    9999  }
    100100 
     
    102102  if (!Hessian.ParseFragmentMatrix(argv[1], dir, HessianSuffix,0,0)) {
    103103    NoHessian = true;
    104     eLog() << Verbose(2) << "No Hessian file found, skipping these." << endl;
     104    DoeLog(2) && (eLog()<< Verbose(2) << "No Hessian file found, skipping these." << endl);
    105105  }
    106106  if (!Time.ParseFragmentMatrix(argv[1], dir, TimeSuffix, 10,1)) {
    107107    NoTime = true;
    108     eLog() << Verbose(2) << "No speed file found, skipping these." << endl;
     108    DoeLog(2) && (eLog()<< Verbose(2) << "No speed file found, skipping these." << endl);
    109109  }
    110110  if (periode != NULL) { // also look for PAS values
  • src/atom_bondedparticle.cpp

    r8ab0407 rc7b1e7  
    8686      status = true;
    8787    } else {
    88       eLog() << Verbose(1) << *Binder << " does not contain " << *this << "." << endl;
     88      DoeLog(1) && (eLog()<< Verbose(1) << *Binder << " does not contain " << *this << "." << endl);
    8989    }
    9090  } else {
    91     eLog() << Verbose(1) << "Binder is " << Binder << "." << endl;
     91    DoeLog(1) && (eLog()<< Verbose(1) << "Binder is " << Binder << "." << endl);
    9292  }
    9393  return status;
     
    105105      status = true;
    106106    } else {
    107       eLog() << Verbose(1) << *Binder << " does not contain " << *this << "." << endl;
     107      DoeLog(1) && (eLog()<< Verbose(1) << *Binder << " does not contain " << *this << "." << endl);
    108108    }
    109109  } else {
    110     eLog() << Verbose(1) << "Binder is " << Binder << "." << endl;
     110    DoeLog(1) && (eLog()<< Verbose(1) << "Binder is " << Binder << "." << endl);
    111111  }
    112112  return status;
     
    150150      //Log() << Verbose(2) << "Increased bond degree for bond " << *CandidateBond << "." << endl;
    151151    } else {
    152       eLog() << Verbose(2) << "Could not find correct degree for atom " << *this << "." << endl;
     152      DoeLog(2) && (eLog()<< Verbose(2) << "Could not find correct degree for atom " << *this << "." << endl);
    153153      FalseBondDegree++;
    154154    }
  • src/bond.cpp

    r8ab0407 rc7b1e7  
    6363  if(rightatom == Atom)
    6464    return leftatom;
    65   eLog() << Verbose(1) << "Bond " << *this << " does not contain atom " << *Atom << "!" << endl;
     65  DoeLog(1) && (eLog()<< Verbose(1) << "Bond " << *this << " does not contain atom " << *Atom << "!" << endl);
    6666  return NULL;
    6767};
     
    9999bool bond::MarkUsed(const enum Shading color) {
    100100  if (Used == black) {
    101     eLog() << Verbose(1) << "Bond " << this << " was already marked black!." << endl;
     101    DoeLog(1) && (eLog()<< Verbose(1) << "Bond " << this << " was already marked black!." << endl);
    102102    return false;
    103103  } else {
  • src/bondgraph.cpp

    r8ab0407 rc7b1e7  
    5858    Log() << Verbose(1) << "Parsing bond length matrix successful." << endl;
    5959  } else {
    60     eLog() << Verbose(1) << "Parsing bond length matrix failed." << endl;
     60    DoeLog(1) && (eLog()<< Verbose(1) << "Parsing bond length matrix failed." << endl);
    6161  }
    6262
     
    159159{
    160160  if (BondLengthMatrix == NULL) {// safety measure if no matrix has been parsed yet
    161     eLog() << Verbose(2) << "BondLengthMatrixMinMaxDistance() called without having parsed the bond length matrix yet!" << endl;
     161    DoeLog(2) && (eLog()<< Verbose(2) << "BondLengthMatrixMinMaxDistance() called without having parsed the bond length matrix yet!" << endl);
    162162    CovalentMinMaxDistance(Walker, OtherWalker, MinDistance, MaxDistance, IsAngstroem);
    163163  } else {
  • src/bondgraph.hpp

    r8ab0407 rc7b1e7  
    1919
    2020#include <iostream>
     21
     22/*********************************************** defines ***********************************/
     23
     24#define BONDTHRESHOLD 0.4   //!< CSD threshold in bond check which is the width of the interval whose center is the sum of the covalent radii
    2125
    2226/****************************************** forward declarations *****************************/
  • src/boundary.cpp

    r8ab0407 rc7b1e7  
    1717#include "tesselation.hpp"
    1818#include "tesselationhelpers.hpp"
     19#include "World.hpp"
    1920
    2021#include<gsl/gsl_poly.h>
     
    341342    for (Boundaries::iterator runner = BoundaryPoints[axis].begin(); runner != BoundaryPoints[axis].end(); runner++)
    342343        if (!TesselStruct->AddBoundaryPoint(runner->second.second, 0))
    343           eLog() << Verbose(2) << "Point " << *(runner->second.second) << " is already present!" << endl;
     344          DoeLog(2) && (eLog()<< Verbose(2) << "Point " << *(runner->second.second) << " is already present!" << endl);
    344345
    345346  Log() << Verbose(0) << "I found " << TesselStruct->PointsOnBoundaryCount << " points on the convex boundary." << endl;
     
    361362  // 3c. check whether all atoms lay inside the boundary, if not, add to boundary points, segment triangle into three with the new point
    362363  if (!TesselStruct->InsertStraddlingPoints(mol, LCList))
    363     eLog() << Verbose(1) << "Insertion of straddling points failed!" << endl;
     364    DoeLog(1) && (eLog()<< Verbose(1) << "Insertion of straddling points failed!" << endl);
    364365
    365366  Log() << Verbose(0) << "I created " << TesselStruct->TrianglesOnBoundary.size() << " intermediate triangles with " << TesselStruct->LinesOnBoundary.size() << " lines and " << TesselStruct->PointsOnBoundary.size() << " points." << endl;
     
    400401        // flip the line
    401402        if (TesselStruct->PickFarthestofTwoBaselines(line) == 0.)
    402           eLog() << Verbose(1) << "Correction of concave baselines failed!" << endl;
     403          DoeLog(1) && (eLog()<< Verbose(1) << "Correction of concave baselines failed!" << endl);
    403404        else {
    404405          TesselStruct->FlipBaseline(line);
     
    455456
    456457  if ((TesselStruct == NULL) || (TesselStruct->PointsOnBoundary.empty())) {
    457     eLog() << Verbose(1) << "TesselStruct is empty." << endl;
     458    DoeLog(1) && (eLog()<< Verbose(1) << "TesselStruct is empty." << endl);
    458459    return false;
    459460  }
     
    520521  // check whether there is something to work on
    521522  if (TesselStruct == NULL) {
    522     eLog() << Verbose(1) << "TesselStruct is empty!" << endl;
     523    DoeLog(1) && (eLog()<< Verbose(1) << "TesselStruct is empty!" << endl);
    523524    return volume;
    524525  }
     
    747748  Log() << Verbose(1) << "Minimum volume of the convex envelope contained in a rectangular box is " << minimumvolume << " atomicmassunit/" << (IsAngstroem ? "angstrom" : "atomiclength") << "^3." << endl;
    748749  if (minimumvolume > cellvolume) {
    749     eLog() << Verbose(1) << "the containing box already has a greater volume than the envisaged cell volume!" << endl;
     750    DoeLog(1) && (eLog()<< Verbose(1) << "the containing box already has a greater volume than the envisaged cell volume!" << endl);
    750751    Log() << Verbose(0) << "Setting Box dimensions to minimum possible, the greatest diameters." << endl;
    751752    for (int i = 0; i < NDIM; i++)
     
    789790 * \param *filler molecule which the box is to be filled with
    790791 * \param configuration contains box dimensions
     792 * \param MaxDistance fills in molecules only up to this distance (set to -1 if whole of the domain)
    791793 * \param distance[NDIM] distance between filling molecules in each direction
    792794 * \param boundary length of boundary zone between molecule and filling mollecules
     
    797799 * \return *mol pointer to new molecule with filled atoms
    798800 */
    799 molecule * FillBoxWithMolecule(MoleculeListClass *List, molecule *filler, config &configuration, const double distance[NDIM], const double boundary, const double RandomAtomDisplacement, const double RandomMolDisplacement, const bool DoRandomRotation)
     801molecule * FillBoxWithMolecule(MoleculeListClass *List, molecule *filler, config &configuration, const double MaxDistance, const double distance[NDIM], const double boundary, const double RandomAtomDisplacement, const double RandomMolDisplacement, const bool DoRandomRotation)
    800802{
    801803        Info FunctionInfo(__func__);
     
    804806  int N[NDIM];
    805807  int n[NDIM];
    806   double *M =  ReturnFullMatrixforSymmetric(filler->cell_size);
     808  double *M =  ReturnFullMatrixforSymmetric(World::get()->cell_size);
    807809  double Rotations[NDIM*NDIM];
     810  double *MInverse = InverseMatrix(M);
    808811  Vector AtomTranslations;
    809812  Vector FillerTranslations;
    810813  Vector FillerDistance;
     814  Vector Inserter;
    811815  double FillIt = false;
    812816  atom *Walker = NULL;
    813817  bond *Binder = NULL;
    814   int i = 0;
    815   LinkedCell *LCList[List->ListOfMolecules.size()];
    816818  double phi[NDIM];
    817   class Tesselation *TesselStruct[List->ListOfMolecules.size()];
    818 
    819   i=0;
    820   for (MoleculeList::iterator ListRunner = List->ListOfMolecules.begin(); ListRunner != List->ListOfMolecules.end(); ListRunner++) {
    821     Log() << Verbose(1) << "Pre-creating linked cell lists for molecule " << *ListRunner << "." << endl;
    822     LCList[i] = new LinkedCell((*ListRunner), 10.); // get linked cell list
    823     Log() << Verbose(1) << "Pre-creating tesselation for molecule " << *ListRunner << "." << endl;
    824     TesselStruct[i] = NULL;
    825     FindNonConvexBorder((*ListRunner), TesselStruct[i], (const LinkedCell *&)LCList[i], 5., NULL);
    826     i++;
    827   }
     819  map<molecule *, Tesselation *> TesselStruct;
     820  map<molecule *, LinkedCell *> LCList;
     821
     822  for (MoleculeList::iterator ListRunner = List->ListOfMolecules.begin(); ListRunner != List->ListOfMolecules.end(); ListRunner++)
     823    if ((*ListRunner)->AtomCount > 0) {
     824      Log() << Verbose(1) << "Pre-creating linked cell lists for molecule " << *ListRunner << "." << endl;
     825      LCList[(*ListRunner)] = new LinkedCell((*ListRunner), 10.); // get linked cell list
     826      Log() << Verbose(1) << "Pre-creating tesselation for molecule " << *ListRunner << "." << endl;
     827      TesselStruct[(*ListRunner)] = NULL;
     828      FindNonConvexBorder((*ListRunner), TesselStruct[(*ListRunner)], (const LinkedCell *&)LCList[(*ListRunner)], 5., NULL);
     829    }
    828830
    829831  // Center filler at origin
    830   filler->CenterOrigin();
     832  filler->CenterEdge(&Inserter);
    831833  filler->Center.Zero();
     834  Log() << Verbose(2) << "INFO: Filler molecule has the following bonds:" << endl;
     835  Binder = filler->first;
     836  while(Binder->next != filler->last) {
     837    Binder = Binder->next;
     838    Log() << Verbose(2) << "  " << *Binder << endl;
     839  }
    832840
    833841  filler->CountAtoms();
     
    851859        CurrentPosition.Init((double)n[0]/(double)N[0], (double)n[1]/(double)N[1], (double)n[2]/(double)N[2]);
    852860        CurrentPosition.MatrixMultiplication(M);
    853         Log() << Verbose(2) << "INFO: Current Position is " << CurrentPosition << "." << endl;
    854         // Check whether point is in- or outside
    855         FillIt = true;
    856         i=0;
    857         for (MoleculeList::iterator ListRunner = List->ListOfMolecules.begin(); ListRunner != List->ListOfMolecules.end(); ListRunner++) {
    858           // get linked cell list
    859           if (TesselStruct[i] == NULL) {
    860             eLog() << Verbose(0) << "TesselStruct of " << (*ListRunner) << " is NULL. Didn't we pre-create it?" << endl;
    861             FillIt = false;
     861        // create molecule random translation vector ...
     862        for (int i=0;i<NDIM;i++)
     863          FillerTranslations.x[i] = RandomMolDisplacement*(rand()/(RAND_MAX/2.) - 1.);
     864        Log() << Verbose(2) << "INFO: Current Position is " << CurrentPosition << "+" << FillerTranslations << "." << endl;
     865
     866        // go through all atoms
     867        for (int i=0;i<filler->AtomCount;i++)
     868          CopyAtoms[i] = NULL;
     869        Walker = filler->start;
     870        while (Walker->next != filler->end) {
     871          Walker = Walker->next;
     872
     873          // create atomic random translation vector ...
     874          for (int i=0;i<NDIM;i++)
     875            AtomTranslations.x[i] = RandomAtomDisplacement*(rand()/(RAND_MAX/2.) - 1.);
     876
     877          // ... and rotation matrix
     878          if (DoRandomRotation) {
     879            for (int i=0;i<NDIM;i++) {
     880              phi[i] = rand()/(RAND_MAX/(2.*M_PI));
     881            }
     882
     883            Rotations[0] =   cos(phi[0])            *cos(phi[2]) + (sin(phi[0])*sin(phi[1])*sin(phi[2]));
     884            Rotations[3] =   sin(phi[0])            *cos(phi[2]) - (cos(phi[0])*sin(phi[1])*sin(phi[2]));
     885            Rotations[6] =               cos(phi[1])*sin(phi[2])                                     ;
     886            Rotations[1] = - sin(phi[0])*cos(phi[1])                                                ;
     887            Rotations[4] =   cos(phi[0])*cos(phi[1])                                                ;
     888            Rotations[7] =               sin(phi[1])                                                ;
     889            Rotations[3] = - cos(phi[0])            *sin(phi[2]) + (sin(phi[0])*sin(phi[1])*cos(phi[2]));
     890            Rotations[5] = - sin(phi[0])            *sin(phi[2]) - (cos(phi[0])*sin(phi[1])*cos(phi[2]));
     891            Rotations[8] =               cos(phi[1])*cos(phi[2])                                     ;
     892          }
     893
     894          // ... and put at new position
     895          Inserter.CopyVector(&(Walker->x));
     896          if (DoRandomRotation)
     897            Inserter.MatrixMultiplication(Rotations);
     898          Inserter.AddVector(&AtomTranslations);
     899          Inserter.AddVector(&FillerTranslations);
     900          Inserter.AddVector(&CurrentPosition);
     901
     902          // check whether inserter is inside box
     903          Inserter.MatrixMultiplication(MInverse);
     904          FillIt = true;
     905          for (int i=0;i<NDIM;i++)
     906            FillIt = FillIt && (Inserter.x[i] >= -MYEPSILON) && ((Inserter.x[i]-1.) <= MYEPSILON);
     907          Inserter.MatrixMultiplication(M);
     908
     909          // Check whether point is in- or outside
     910          for (MoleculeList::iterator ListRunner = List->ListOfMolecules.begin(); ListRunner != List->ListOfMolecules.end(); ListRunner++) {
     911            // get linked cell list
     912            if (TesselStruct[(*ListRunner)] != NULL) {
     913              const double distance = (TesselStruct[(*ListRunner)]->GetDistanceToSurface(Inserter, LCList[(*ListRunner)]));
     914              FillIt = FillIt && (distance > boundary) && ((MaxDistance < 0) || (MaxDistance > distance));
     915            }
     916          }
     917          // insert into Filling
     918          if (FillIt) {
     919            Log() << Verbose(1) << "INFO: Position at " << Inserter << " is outer point." << endl;
     920            // copy atom ...
     921            CopyAtoms[Walker->nr] = new atom(Walker);
     922            CopyAtoms[Walker->nr]->x.CopyVector(&Inserter);
     923            Filling->AddAtom(CopyAtoms[Walker->nr]);
     924            Log() << Verbose(4) << "Filling atom " << *Walker << ", translated to " << AtomTranslations << ", at final position is " << (CopyAtoms[Walker->nr]->x) << "." << endl;
    862925          } else {
    863             const double distance = (TesselStruct[i]->GetDistanceSquaredToSurface(CurrentPosition, LCList[i]));
    864             FillIt = FillIt && (distance > boundary*boundary);
    865             if (FillIt) {
    866               Log() << Verbose(1) << "INFO: Position at " << CurrentPosition << " is outer point." << endl;
    867             } else {
    868               Log() << Verbose(1) << "INFO: Position at " << CurrentPosition << " is inner point or within boundary." << endl;
    869               break;
    870             }
    871             i++;
     926            Log() << Verbose(1) << "INFO: Position at " << Inserter << " is inner point, within boundary or outside of MaxDistance." << endl;
     927            CopyAtoms[Walker->nr] = NULL;
     928            continue;
    872929          }
    873930        }
    874 
    875         if (FillIt) {
    876           // fill in Filler
    877           Log() << Verbose(2) << "Space at " << CurrentPosition << " is unoccupied by any molecule, filling in." << endl;
    878 
    879           // create molecule random translation vector ...
    880           for (int i=0;i<NDIM;i++)
    881             FillerTranslations.x[i] = RandomMolDisplacement*(rand()/(RAND_MAX/2.) - 1.);
    882           Log() << Verbose(2) << "INFO: Translating this filler by " << FillerTranslations << "." << endl;
    883 
    884           // go through all atoms
    885           Walker = filler->start;
    886           while (Walker->next != filler->end) {
    887             Walker = Walker->next;
    888             // copy atom ...
    889             CopyAtoms[Walker->nr] = new atom(Walker);
    890 
    891             // create atomic random translation vector ...
    892             for (int i=0;i<NDIM;i++)
    893               AtomTranslations.x[i] = RandomAtomDisplacement*(rand()/(RAND_MAX/2.) - 1.);
    894 
    895             // ... and rotation matrix
    896             if (DoRandomRotation) {
    897               for (int i=0;i<NDIM;i++) {
    898                 phi[i] = rand()/(RAND_MAX/(2.*M_PI));
    899               }
    900 
    901               Rotations[0] =   cos(phi[0])            *cos(phi[2]) + (sin(phi[0])*sin(phi[1])*sin(phi[2]));
    902               Rotations[3] =   sin(phi[0])            *cos(phi[2]) - (cos(phi[0])*sin(phi[1])*sin(phi[2]));
    903               Rotations[6] =               cos(phi[1])*sin(phi[2])                                     ;
    904               Rotations[1] = - sin(phi[0])*cos(phi[1])                                                ;
    905               Rotations[4] =   cos(phi[0])*cos(phi[1])                                                ;
    906               Rotations[7] =               sin(phi[1])                                                ;
    907               Rotations[3] = - cos(phi[0])            *sin(phi[2]) + (sin(phi[0])*sin(phi[1])*cos(phi[2]));
    908               Rotations[5] = - sin(phi[0])            *sin(phi[2]) - (cos(phi[0])*sin(phi[1])*cos(phi[2]));
    909               Rotations[8] =               cos(phi[1])*cos(phi[2])                                     ;
    910             }
    911 
    912             // ... and put at new position
    913             if (DoRandomRotation)
    914               CopyAtoms[Walker->nr]->x.MatrixMultiplication(Rotations);
    915             CopyAtoms[Walker->nr]->x.AddVector(&AtomTranslations);
    916             CopyAtoms[Walker->nr]->x.AddVector(&FillerTranslations);
    917             CopyAtoms[Walker->nr]->x.AddVector(&CurrentPosition);
    918 
    919             // insert into Filling
    920 
    921             // FIXME: gives completely different results if CopyAtoms[..] used instead of Walker, why???
    922             Log() << Verbose(4) << "Filling atom " << *Walker << ", translated to " << AtomTranslations << ", at final position is " << (CopyAtoms[Walker->nr]->x) << "." << endl;
    923             Filling->AddAtom(CopyAtoms[Walker->nr]);
    924           }
    925 
    926           // go through all bonds and add as well
    927           Binder = filler->first;
    928           while(Binder->next != filler->last) {
    929             Binder = Binder->next;
    930             Log() << Verbose(3) << "Adding Bond between " << *CopyAtoms[Binder->leftatom->nr] << " and " << *CopyAtoms[Binder->rightatom->nr]<< "." << endl;
     931        // go through all bonds and add as well
     932        Binder = filler->first;
     933        while(Binder->next != filler->last) {
     934          Binder = Binder->next;
     935          if ((CopyAtoms[Binder->leftatom->nr] != NULL) && (CopyAtoms[Binder->rightatom->nr] != NULL)) {
     936            Log()  << Verbose(3) << "Adding Bond between " << *CopyAtoms[Binder->leftatom->nr] << " and " << *CopyAtoms[Binder->rightatom->nr]<< "." << endl;
    931937            Filling->AddBond(CopyAtoms[Binder->leftatom->nr], CopyAtoms[Binder->rightatom->nr], Binder->BondDegree);
    932938          }
    933         } else {
    934           // leave empty
    935           Log() << Verbose(2) << "Space at " << CurrentPosition << " is occupied." << endl;
    936939        }
    937940      }
    938941  Free(&M);
    939 
    940   // output to file
    941   TesselStruct[0]->LastTriangle = NULL;
    942   StoreTrianglesinFile(Filling, TesselStruct[0], "Tesselated", ".dat");
    943 
    944   for (size_t i=0;i<List->ListOfMolecules.size();i++) {
    945         delete(LCList[i]);
    946         delete(TesselStruct[i]);
    947   }
     942  Free(&MInverse);
     943
    948944  return Filling;
    949945};
  • src/boundary.hpp

    r8ab0407 rc7b1e7  
    4949
    5050double ConvexizeNonconvexEnvelope(class Tesselation *&TesselStruct, const molecule * const mol, const char * const filename);
    51 molecule * FillBoxWithMolecule(MoleculeListClass *List, molecule *filler, config &configuration, const double distance[NDIM], const double boundary, const double RandomAtomDisplacement, const double RandomMolDisplacement, const bool DoRandomRotation);
     51molecule * FillBoxWithMolecule(MoleculeListClass *List, molecule *filler, config &configuration, const double MaxDistance, const double distance[NDIM], const double boundary, const double RandomAtomDisplacement, const double RandomMolDisplacement, const bool DoRandomRotation);
    5252void FindConvexBorder(const molecule* const mol, Tesselation *&TesselStruct, const LinkedCell *LCList, const char *filename);
    5353Vector* FindEmbeddingHole(MoleculeListClass *mols, molecule *srcmol);
  • src/builder.cpp

    r8ab0407 rc7b1e7  
    6868#include "periodentafel.hpp"
    6969#include "version.h"
     70#include "World.hpp"
    7071
    7172/********************************************* Subsubmenu routine ************************************/
     
    8485  bool valid;
    8586
    86   Log() << Verbose(0) << "===========ADD ATOM============================" << endl;
    87   Log() << Verbose(0) << " a - state absolute coordinates of atom" << endl;
    88   Log() << Verbose(0) << " b - state relative coordinates of atom wrt to reference point" << endl;
    89   Log() << Verbose(0) << " c - state relative coordinates of atom wrt to already placed atom" << endl;
    90   Log() << Verbose(0) << " d - state two atoms, two angles and a distance" << endl;
    91   Log() << Verbose(0) << " e - least square distance position to a set of atoms" << endl;
    92   Log() << Verbose(0) << "all else - go back" << endl;
    93   Log() << Verbose(0) << "===============================================" << endl;
    94   Log() << Verbose(0) << "Note: Specifiy angles in degrees not multiples of Pi!" << endl;
    95   Log() << Verbose(0) << "INPUT: ";
     87  cout << Verbose(0) << "===========ADD ATOM============================" << endl;
     88  cout << Verbose(0) << " a - state absolute coordinates of atom" << endl;
     89  cout << Verbose(0) << " b - state relative coordinates of atom wrt to reference point" << endl;
     90  cout << Verbose(0) << " c - state relative coordinates of atom wrt to already placed atom" << endl;
     91  cout << Verbose(0) << " d - state two atoms, two angles and a distance" << endl;
     92  cout << Verbose(0) << " e - least square distance position to a set of atoms" << endl;
     93  cout << Verbose(0) << "all else - go back" << endl;
     94  cout << Verbose(0) << "===============================================" << endl;
     95  cout << Verbose(0) << "Note: Specifiy angles in degrees not multiples of Pi!" << endl;
     96  cout << Verbose(0) << "INPUT: ";
    9697  cin >> choice;
    9798
    9899  switch (choice) {
    99100    default:
    100       eLog() << Verbose(2) << "Not a valid choice." << endl;
     101      DoeLog(2) && (eLog()<< Verbose(2) << "Not a valid choice." << endl);
    101102      break;
    102103      case 'a': // absolute coordinates of atom
    103         Log() << Verbose(0) << "Enter absolute coordinates." << endl;
     104        cout << Verbose(0) << "Enter absolute coordinates." << endl;
    104105        first = new atom;
    105         first->x.AskPosition(mol->cell_size, false);
     106        first->x.AskPosition(World::get()->cell_size, false);
    106107        first->type = periode->AskElement();  // give type
    107108        mol->AddAtom(first);  // add to molecule
     
    112113        valid = true;
    113114        do {
    114           if (!valid) eLog() << Verbose(2) << "Resulting position out of cell." << endl;
    115           Log() << Verbose(0) << "Enter reference coordinates." << endl;
    116           x.AskPosition(mol->cell_size, true);
    117           Log() << Verbose(0) << "Enter relative coordinates." << endl;
    118           first->x.AskPosition(mol->cell_size, false);
     115          if (!valid) DoeLog(2) && (eLog()<< Verbose(2) << "Resulting position out of cell." << endl);
     116          cout << Verbose(0) << "Enter reference coordinates." << endl;
     117          x.AskPosition(World::get()->cell_size, true);
     118          cout << Verbose(0) << "Enter relative coordinates." << endl;
     119          first->x.AskPosition(World::get()->cell_size, false);
    119120          first->x.AddVector((const Vector *)&x);
    120           Log() << Verbose(0) << "\n";
     121          cout << Verbose(0) << "\n";
    121122        } while (!(valid = mol->CheckBounds((const Vector *)&first->x)));
    122123        first->type = periode->AskElement();  // give type
     
    128129        valid = true;
    129130        do {
    130           if (!valid) eLog() << Verbose(2) << "Resulting position out of cell." << endl;
     131          if (!valid) DoeLog(2) && (eLog()<< Verbose(2) << "Resulting position out of cell." << endl);
    131132          second = mol->AskAtom("Enter atom number: ");
    132133          Log() << Verbose(0) << "Enter relative coordinates." << endl;
    133           first->x.AskPosition(mol->cell_size, false);
     134          first->x.AskPosition(World::get()->cell_size, false);
    134135          for (int i=NDIM;i--;) {
    135136            first->x.x[i] += second->x.x[i];
     
    145146        do {
    146147          if (!valid) {
    147             eLog() << Verbose(2) << "Resulting coordinates out of cell - " << first->x << endl;
     148            DoeLog(2) && (eLog()<< Verbose(2) << "Resulting coordinates out of cell - " << first->x << endl);
    148149          }
    149           Log() << Verbose(0) << "First, we need two atoms, the first atom is the central, while the second is the outer one." << endl;
     150          cout << Verbose(0) << "First, we need two atoms, the first atom is the central, while the second is the outer one." << endl;
    150151          second = mol->AskAtom("Enter central atom: ");
    151152          third = mol->AskAtom("Enter second atom (specifying the axis for first angle): ");
     
    158159          c *= M_PI/180.;
    159160          bound(&c, -M_PI, M_PI);
    160           Log() << Verbose(0) << "radius: " << a << "\t phi: " << b*180./M_PI << "\t theta: " << c*180./M_PI << endl;
     161          cout << Verbose(0) << "radius: " << a << "\t phi: " << b*180./M_PI << "\t theta: " << c*180./M_PI << endl;
    161162/*
    162163          second->Output(1,1,(ofstream *)&cout);
     
    170171
    171172          if (!z.SolveSystem(&x,&y,&n, b, c, a)) {
    172             Log() << Verbose(0) << "Failure solving self-dependent linear system!" << endl;
     173         coutg() << Verbose(0) << "Failure solving self-dependent linear system!" << endl;
    173174            continue;
    174175          }
     
    247248          atoms[i] = NULL;
    248249        int i=0, j=0;
    249         Log() << Verbose(0) << "Now we need at least three molecules.\n";
     250        cout << Verbose(0) << "Now we need at least three molecules.\n";
    250251        do {
    251           Log() << Verbose(0) << "Enter " << i+1 << "th atom: ";
     252          cout << Verbose(0) << "Enter " << i+1 << "th atom: ";
    252253          cin >> j;
    253254          if (j != -1) {
     
    264265        } else {
    265266          delete first;
    266           Log() << Verbose(0) << "Please enter at least two vectors!\n";
     267          cout << Verbose(0) << "Please enter at least two vectors!\n";
    267268        }
    268269        break;
     
    278279  char choice;  // menu choice char
    279280
    280   Log() << Verbose(0) << "===========CENTER ATOMS=========================" << endl;
    281   Log() << Verbose(0) << " a - on origin" << endl;
    282   Log() << Verbose(0) << " b - on center of gravity" << endl;
    283   Log() << Verbose(0) << " c - within box with additional boundary" << endl;
    284   Log() << Verbose(0) << " d - within given simulation box" << endl;
    285   Log() << Verbose(0) << "all else - go back" << endl;
    286   Log() << Verbose(0) << "===============================================" << endl;
    287   Log() << Verbose(0) << "INPUT: ";
     281  cout << Verbose(0) << "===========CENTER ATOMS=========================" << endl;
     282  cout << Verbose(0) << " a - on origin" << endl;
     283  cout << Verbose(0) << " b - on center of gravity" << endl;
     284  cout << Verbose(0) << " c - within box with additional boundary" << endl;
     285  cout << Verbose(0) << " d - within given simulation box" << endl;
     286  cout << Verbose(0) << "all else - go back" << endl;
     287  cout << Verbose(0) << "===============================================" << endl;
     288  cout << Verbose(0) << "INPUT: ";
    288289  cin >> choice;
    289290
    290291  switch (choice) {
    291292    default:
    292       Log() << Verbose(0) << "Not a valid choice." << endl;
     293      cout << Verbose(0) << "Not a valid choice." << endl;
    293294      break;
    294295    case 'a':
    295       Log() << Verbose(0) << "Centering atoms in config file on origin." << endl;
     296      cout << Verbose(0) << "Centering atoms in config file on origin." << endl;
    296297      mol->CenterOrigin();
    297298      break;
    298299    case 'b':
    299       Log() << Verbose(0) << "Centering atoms in config file on center of gravity." << endl;
     300      cout << Verbose(0) << "Centering atoms in config file on center of gravity." << endl;
    300301      mol->CenterPeriodic();
    301302      break;
    302303    case 'c':
    303       Log() << Verbose(0) << "Centering atoms in config file within given additional boundary." << endl;
     304      cout << Verbose(0) << "Centering atoms in config file within given additional boundary." << endl;
    304305      for (int i=0;i<NDIM;i++) {
    305         Log() << Verbose(0) << "Enter axis " << i << " boundary: ";
     306        cout << Verbose(0) << "Enter axis " << i << " boundary: ";
    306307        cin >> y.x[i];
    307308      }
     
    314315      break;
    315316    case 'd':
    316       Log() << Verbose(1) << "Centering atoms in config file within given simulation box." << endl;
     317      cout << Verbose(1) << "Centering atoms in config file within given simulation box." << endl;
    317318      for (int i=0;i<NDIM;i++) {
    318         Log() << Verbose(0) << "Enter axis " << i << " boundary: ";
     319        cout << Verbose(0) << "Enter axis " << i << " boundary: ";
    319320        cin >> x.x[i];
    320321      }
     
    337338  char choice;  // menu choice char
    338339
    339   Log() << Verbose(0) << "===========ALIGN ATOMS=========================" << endl;
    340   Log() << Verbose(0) << " a - state three atoms defining align plane" << endl;
    341   Log() << Verbose(0) << " b - state alignment vector" << endl;
    342   Log() << Verbose(0) << " c - state two atoms in alignment direction" << endl;
    343   Log() << Verbose(0) << " d - align automatically by least square fit" << endl;
    344   Log() << Verbose(0) << "all else - go back" << endl;
    345   Log() << Verbose(0) << "===============================================" << endl;
    346   Log() << Verbose(0) << "INPUT: ";
     340  cout << Verbose(0) << "===========ALIGN ATOMS=========================" << endl;
     341  cout << Verbose(0) << " a - state three atoms defining align plane" << endl;
     342  cout << Verbose(0) << " b - state alignment vector" << endl;
     343  cout << Verbose(0) << " c - state two atoms in alignment direction" << endl;
     344  cout << Verbose(0) << " d - align automatically by least square fit" << endl;
     345  cout << Verbose(0) << "all else - go back" << endl;
     346  cout << Verbose(0) << "===============================================" << endl;
     347  cout << Verbose(0) << "INPUT: ";
    347348  cin >> choice;
    348349
     
    357358      break;
    358359    case 'b': // normal vector of mirror plane
    359       Log() << Verbose(0) << "Enter normal vector of mirror plane." << endl;
    360       n.AskPosition(mol->cell_size,0);
     360      cout << Verbose(0) << "Enter normal vector of mirror plane." << endl;
     361      n.AskPosition(World::get()->cell_size,0);
    361362      n.Normalize();
    362363      break;
     
    377378        fscanf(stdin, "%3s", shorthand);
    378379      } while ((param.type = periode->FindElement(shorthand)) == NULL);
    379       Log() << Verbose(0) << "Element is " << param.type->name << endl;
     380      cout << Verbose(0) << "Element is " << param.type->name << endl;
    380381      mol->GetAlignvector(&param);
    381382      for (int i=NDIM;i--;) {
     
    384385      }
    385386      gsl_vector_free(param.x);
    386       Log() << Verbose(0) << "Offset vector: ";
     387      cout << Verbose(0) << "Offset vector: ";
    387388      x.Output();
    388389      Log() << Verbose(0) << endl;
     
    425426    case 'b': // normal vector of mirror plane
    426427      Log() << Verbose(0) << "Enter normal vector of mirror plane." << endl;
    427       n.AskPosition(mol->cell_size,0);
     428      n.AskPosition(World::get()->cell_size,0);
    428429      n.Normalize();
    429430      break;
     
    655656static void ManipulateAtoms(periodentafel *periode, MoleculeListClass *molecules, config *configuration)
    656657{
    657   atom *first, *second;
     658  atom *first, *second, *third;
    658659  molecule *mol = NULL;
    659660  Vector x,y,z,n; // coordinates for absolute point in cell volume
     
    667668  Log() << Verbose(0) << "r - remove an atom" << endl;
    668669  Log() << Verbose(0) << "b - scale a bond between atoms" << endl;
     670  Log() << Verbose(0) << "t - turn an atom round another bond" << endl;
    669671  Log() << Verbose(0) << "u - change an atoms element" << endl;
    670672  Log() << Verbose(0) << "l - measure lengths, angles, ... for an atom" << endl;
     
    672674  Log() << Verbose(0) << "===============================================" << endl;
    673675  if (molecules->NumberOfActiveMolecules() > 1)
    674     eLog() << Verbose(2) << "There is more than one molecule active! Atoms will be added to each." << endl;
     676    DoeLog(2) && (eLog()<< Verbose(2) << "There is more than one molecule active! Atoms will be added to each." << endl);
    675677  Log() << Verbose(0) << "INPUT: ";
    676678  cin >> choice;
     
    748750      break;
    749751
     752    case 't': // turn/rotate atom
     753      for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     754        if ((*ListRunner)->ActiveFlag) {
     755          mol = *ListRunner;
     756          Log() << Verbose(0) << "Turning atom around another bond - first is atom to turn, second (central) and third specify bond" << endl;
     757          first = mol->AskAtom("Enter turning atom: ");
     758          second = mol->AskAtom("Enter central atom: ");
     759          third  = mol->AskAtom("Enter bond atom: ");
     760          cout << Verbose(0) << "Enter new angle in degrees: ";
     761          double tmp = 0.;
     762          cin >> tmp;
     763          // calculate old angle
     764          x.CopyVector((const Vector *)&first->x);
     765          x.SubtractVector((const Vector *)&second->x);
     766          y.CopyVector((const Vector *)&third->x);
     767          y.SubtractVector((const Vector *)&second->x);
     768          double alpha = (acos(x.ScalarProduct((const Vector *)&y)/(y.Norm()*x.Norm()))/M_PI*180.);
     769          cout << Verbose(0) << "Bond angle between first atom Nr." << first->nr << ", central atom Nr." << second->nr << " and last atom Nr." << third->nr << ": ";
     770          cout << Verbose(0) << alpha << " degrees" << endl;
     771          // rotate
     772          z.MakeNormalVector(&x,&y);
     773          x.RotateVector(&z,(alpha-tmp)*M_PI/180.);
     774          x.AddVector(&second->x);
     775          first->x.CopyVector(&x);
     776          // check new angle
     777          x.CopyVector((const Vector *)&first->x);
     778          x.SubtractVector((const Vector *)&second->x);
     779          alpha = (acos(x.ScalarProduct((const Vector *)&y)/(y.Norm()*x.Norm()))/M_PI*180.);
     780          cout << Verbose(0) << "new Bond angle between first atom Nr." << first->nr << ", central atom Nr." << second->nr << " and last atom Nr." << third->nr << ": ";
     781          cout << Verbose(0) << alpha << " degrees" << endl;
     782        }
     783      break;
     784
    750785    case 'u': // change an atom's element
    751786      for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     
    795830  Log() << Verbose(0) << "===============================================" << endl;
    796831  if (molecules->NumberOfActiveMolecules() > 1)
    797     eLog() << Verbose(2) << "There is more than one molecule active! Atoms will be added to each." << endl;
     832    DoeLog(2) && (eLog()<< Verbose(2) << "There is more than one molecule active! Atoms will be added to each." << endl);
    798833  Log() << Verbose(0) << "INPUT: ";
    799834  cin >> choice;
     
    828863          }
    829864          if (count != j)
    830             eLog() << Verbose(1) << "AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!" << endl;
     865            DoeLog(1) && (eLog()<< Verbose(1) << "AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!" << endl);
    831866          x.Zero();
    832867          y.Zero();
    833           y.x[abs(axis)-1] = mol->cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] * abs(axis)/axis; // last term is for sign, first is for magnitude
     868          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
    834869          for (int i=1;i<faktor;i++) {  // then add this list with respective translation factor times
    835870            x.AddVector(&y); // per factor one cell width further
     
    854889            mol->Translate(&x);
    855890          }
    856           mol->cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] *= faktor;
     891          World::get()->cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] *= faktor;
    857892        }
    858893      }
     
    911946        Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
    912947        Log() << Verbose(0) << "Enter translation vector." << endl;
    913         x.AskPosition(mol->cell_size,0);
     948        x.AskPosition(World::get()->cell_size,0);
    914949        mol->Center.AddVector((const Vector *)&x);
    915950     }
     
    9711006        // center at set box dimensions
    9721007        mol->CenterEdge(&center);
    973         mol->cell_size[0] = center.x[0];
    974         mol->cell_size[1] = 0;
    975         mol->cell_size[2] = center.x[1];
    976         mol->cell_size[3] = 0;
    977         mol->cell_size[4] = 0;
    978         mol->cell_size[5] = center.x[2];
     1008        double * const cell_size = World::get()->cell_size;
     1009        cell_size[0] = center.x[0];
     1010        cell_size[1] = 0;
     1011        cell_size[2] = center.x[1];
     1012        cell_size[3] = 0;
     1013        cell_size[4] = 0;
     1014        cell_size[5] = center.x[2];
    9791015        molecules->insert(mol);
    9801016      }
     
    11721208    mol = (molecules->ListOfMolecules.front())->CopyMolecule();
    11731209  else {
    1174     eLog() << Verbose(0) << "I don't have anything to test on ... ";
     1210    DoeLog(0) && (eLog()<< Verbose(0) << "I don't have anything to test on ... ");
    11751211    performCriticalExit();
    11761212    return;
     
    12531289
    12541290  if (!strcmp(configuration->configpath, configuration->GetDefaultPath())) {
    1255     eLog() << Verbose(2) << "config is found under different path then stated in config file::defaultpath!" << endl;
     1291    DoeLog(2) && (eLog()<< Verbose(2) << "config is found under different path then stated in config file::defaultpath!" << endl);
    12561292  }
    12571293
     
    13571393
    13581394  if (!strcmp(configuration->configpath, configuration->GetDefaultPath())) {
    1359     eLog() << Verbose(2) << "config is found under different path then stated in config file::defaultpath!" << endl;
     1395    DoeLog(2) && (eLog()<< Verbose(2) << "config is found under different path then stated in config file::defaultpath!" << endl);
    13601396  }
    13611397
     
    13871423  enum ConfigStatus configPresent = absent;
    13881424  clock_t start,end;
     1425  double MaxDistance = -1;
    13891426  int argptr;
    13901427  molecule *mol = NULL;
     
    14121449            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;
    14131450            Log() << Verbose(0) << "\t-c x1 x2 x3\tCenter atoms in domain with a minimum distance to boundary of (x1,x2,x3)." << endl;
    1414             Log() << Verbose(0) << "\t-C <Z> <output> <bin output>\tPair Correlation analysis." << endl;
     1451            Log() << Verbose(0) << "\t-C <type> [params] <output> <bin output> <BinWidth> <BinStart> <BinEnd>\tPair Correlation analysis." << endl;
    14151452            Log() << Verbose(0) << "\t-d x1 x2 x3\tDuplicate cell along each axis by given factor." << endl;
    14161453            Log() << Verbose(0) << "\t-D <bond distance>\tDepth-First-Search Analysis of the molecule, giving cycles and tree/back edges." << endl;
     
    14181455            Log() << Verbose(0) << "\t-E <id> <Z>\tChange atom <id>'s element to <Z>, <id> begins at 0." << endl;
    14191456            Log() << Verbose(0) << "\t-f <dist> <order>\tFragments the molecule in BOSSANOVA manner (with/out rings compressed) and stores config files in same dir as config (return code 0 - fragmented, 2 - no fragmentation necessary)." << endl;
    1420             Log() << Verbose(0) << "\t-F <dist_x> <dist_y> <dist_z> <epsilon> <randatom> <randmol> <DoRotate>\tFilling Box with water molecules." << endl;
     1457            Log() << Verbose(0) << "\t-F <xyz of filler> <dist_x> <dist_y> <dist_z> <epsilon> <randatom> <randmol> <DoRotate>\tFilling Box with water molecules." << endl;
     1458            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;
    14211459            Log() << Verbose(0) << "\t-g <file>\tParses a bond length table from the given file." << endl;
    14221460            Log() << Verbose(0) << "\t-h/-H/-?\tGive this help screen." << endl;
     
    14421480            Log() << Verbose(0) << "\t-v\t\tsets verbosity (more is more)." << endl;
    14431481            Log() << Verbose(0) << "\t-V\t\tGives version information." << endl;
     1482            Log() << Verbose(0) << "\t-X\t\tset default name of a molecule." << endl;
    14441483            Log() << Verbose(0) << "Note: config files must not begin with '-' !" << endl;
    14451484            return (1);
     
    14571496            return (1);
    14581497            break;
     1498          case 'B':
     1499            if (ExitFlag == 0) ExitFlag = 1;
     1500            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])) ) {
     1501              ExitFlag = 255;
     1502              DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for bounding in box: -B <xx> <xy> <xz> <yy> <yz> <zz>" << endl);
     1503              performCriticalExit();
     1504            } else {
     1505              SaveFlag = true;
     1506              j = -1;
     1507              Log() << Verbose(1) << "Centering atoms in config file within given simulation box." << endl;
     1508              double * const cell_size = World::get()->cell_size;
     1509              for (int i=0;i<6;i++) {
     1510                cell_size[i] = atof(argv[argptr+i]);
     1511              }
     1512              argptr+=6;
     1513            }
     1514            break;
    14591515          case 'e':
    14601516            if ((argptr >= argc) || (argv[argptr][0] == '-')) {
    1461               eLog() << Verbose(0) << "Not enough or invalid arguments for specifying element db: -e <db file>" << endl;
     1517              DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments for specifying element db: -e <db file>" << endl);
    14621518              performCriticalExit();
    14631519            } else {
     
    14691525          case 'g':
    14701526            if ((argptr >= argc) || (argv[argptr][0] == '-')) {
    1471               eLog() << Verbose(0) << "Not enough or invalid arguments for specifying bond length table: -g <table file>" << endl;
     1527              DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments for specifying bond length table: -g <table file>" << endl);
    14721528              performCriticalExit();
    14731529            } else {
     
    14801536            Log() << Verbose(0) << "I won't parse trajectories." << endl;
    14811537            configuration.FastParsing = true;
     1538            break;
     1539          case 'X':
     1540            {
     1541              char **name = &(World::get()->DefaultName);
     1542              delete[](*name);
     1543              const int length = strlen(argv[argptr]);
     1544              *name = new char[length+2];
     1545              strncpy(*name, argv[argptr], length);
     1546              Log() << Verbose(0) << "Default name of new molecules set to " << *name << "." << endl;
     1547            }
    14821548            break;
    14831549          default:   // no match? Step on
     
    15561622         Log() << Verbose(0) << "Bond length table loaded successfully." << endl;
    15571623       } else {
    1558          eLog() << Verbose(1) << "Bond length table loading failed." << endl;
     1624         DoeLog(1) && (eLog()<< Verbose(1) << "Bond length table loading failed." << endl);
    15591625       }
    15601626     }
     
    15721638              if ((argptr >= argc) || (argv[argptr][0] == '-')) {
    15731639                ExitFlag = 255;
    1574                 eLog() << Verbose(0) << "Not enough arguments for parsing: -p <xyz file>" << endl;
     1640                DoeLog(0) && (eLog()<< Verbose(0) << "Not enough arguments for parsing: -p <xyz file>" << endl);
    15751641                performCriticalExit();
    15761642              } else {
     
    15891655              if ((argptr >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) || (!IsValidNumber(argv[argptr+3]))) {
    15901656                ExitFlag = 255;
    1591                 eLog() << Verbose(0) << "Not enough or invalid arguments for adding atom: -a <element> <x> <y> <z>" << endl;
     1657                DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments for adding atom: -a <element> <x> <y> <z>" << endl);
    15921658                performCriticalExit();
    15931659              } else {
     
    16051671                    configPresent = present;
    16061672                } else
    1607                   eLog() << Verbose(1) << "Could not find the specified element." << endl;
     1673                  DoeLog(1) && (eLog()<< Verbose(1) << "Could not find the specified element." << endl);
    16081674                argptr+=4;
    16091675              }
     
    16181684              if ((argptr >= argc) || (argv[argptr][0] == '-')) {
    16191685                ExitFlag = 255;
    1620                 eLog() << Verbose(0) << "Not enough or invalid arguments given for setting MPQC basis: -B <basis name>" << endl;
     1686                DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for setting MPQC basis: -B <basis name>" << endl);
    16211687                performCriticalExit();
    16221688              } else {
     
    16711737                  }
    16721738              }
    1673               if (mol == NULL) {
     1739              if ((mol == NULL) && (!molecules->ListOfMolecules.empty())) {
    16741740                mol = *(molecules->ListOfMolecules.begin());
    1675                 mol->ActiveFlag = true;
     1741                if (mol != NULL)
     1742                  mol->ActiveFlag = true;
    16761743              }
    16771744              break;
    16781745            case 'C':
    1679               if (ExitFlag == 0) ExitFlag = 1;
    1680               if ((argptr+2 >= argc) || (!IsValidNumber(argv[argptr])) || (argv[argptr][0] == '-') || (argv[argptr+1][0] == '-') || (argv[argptr+2][0] == '-')) {
    1681                 ExitFlag = 255;
    1682                 eLog() << Verbose(0) << "Not enough or invalid arguments given for pair correlation analysis: -C <Z> <output> <bin output>" << endl;
    1683                 performCriticalExit();
    1684               } else {
    1685                 ofstream output(argv[argptr+1]);
    1686                 ofstream binoutput(argv[argptr+2]);
    1687                 const double radius = 5.;
    1688 
    1689                 // get the boundary
    1690                 class molecule *Boundary = NULL;
    1691                 class Tesselation *TesselStruct = NULL;
    1692                 const LinkedCell *LCList = NULL;
    1693                 // find biggest molecule
    1694                 int counter  = 0;
    1695                 for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) {
    1696                   if ((Boundary == NULL) || (Boundary->AtomCount < (*BigFinder)->AtomCount)) {
    1697                     Boundary = *BigFinder;
     1746              {
     1747                int ranges[3] = {1, 1, 1};
     1748                bool periodic = (argv[argptr-1][2] =='p');
     1749                if (ExitFlag == 0) ExitFlag = 1;
     1750                if ((argptr >= argc)) {
     1751                  ExitFlag = 255;
     1752                  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);
     1753                  performCriticalExit();
     1754                } else {
     1755                  switch(argv[argptr][0]) {
     1756                    case 'E':
     1757                      {
     1758                        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] == '-')) {
     1759                          ExitFlag = 255;
     1760                          DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for pair correlation analysis: -C E <Z1> <Z2> <output> <bin output>" << endl);
     1761                          performCriticalExit();
     1762                        } else {
     1763                          ofstream output(argv[argptr+3]);
     1764                          ofstream binoutput(argv[argptr+4]);
     1765                          const double BinStart = atof(argv[argptr+5]);
     1766                          const double BinEnd = atof(argv[argptr+6]);
     1767
     1768                          element *elemental = periode->FindElement((const int) atoi(argv[argptr+1]));
     1769                          element *elemental2 = periode->FindElement((const int) atoi(argv[argptr+2]));
     1770                          PairCorrelationMap *correlationmap = NULL;
     1771                          if (periodic)
     1772                            correlationmap = PeriodicPairCorrelation(molecules, elemental, elemental2, ranges);
     1773                          else
     1774                            correlationmap = PairCorrelation(molecules, elemental, elemental2);
     1775                          //OutputCorrelationToSurface(&output, correlationmap);
     1776                          BinPairMap *binmap = BinData( correlationmap, 0.5, BinStart, BinEnd );
     1777                          OutputCorrelation ( &binoutput, binmap );
     1778                          output.close();
     1779                          binoutput.close();
     1780                          delete(binmap);
     1781                          delete(correlationmap);
     1782                          argptr+=7;
     1783                        }
     1784                      }
     1785                      break;
     1786
     1787                    case 'P':
     1788                      {
     1789                        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] == '-')) {
     1790                          ExitFlag = 255;
     1791                          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);
     1792                          performCriticalExit();
     1793                        } else {
     1794                          ofstream output(argv[argptr+5]);
     1795                          ofstream binoutput(argv[argptr+6]);
     1796                          const double BinStart = atof(argv[argptr+7]);
     1797                          const double BinEnd = atof(argv[argptr+8]);
     1798
     1799                          element *elemental = periode->FindElement((const int) atoi(argv[argptr+1]));
     1800                          Vector *Point = new Vector((const double) atof(argv[argptr+1]),(const double) atof(argv[argptr+2]),(const double) atof(argv[argptr+3]));
     1801                          CorrelationToPointMap *correlationmap = NULL;
     1802                          if (periodic)
     1803                            correlationmap  = PeriodicCorrelationToPoint(molecules, elemental, Point, ranges);
     1804                          else
     1805                            correlationmap = CorrelationToPoint(molecules, elemental, Point);
     1806                          //OutputCorrelationToSurface(&output, correlationmap);
     1807                          BinPairMap *binmap = BinData( correlationmap, 0.5, BinStart, BinEnd );
     1808                          OutputCorrelation ( &binoutput, binmap );
     1809                          output.close();
     1810                          binoutput.close();
     1811                          delete(Point);
     1812                          delete(binmap);
     1813                          delete(correlationmap);
     1814                          argptr+=9;
     1815                        }
     1816                      }
     1817                      break;
     1818
     1819                    case 'S':
     1820                      {
     1821                        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] == '-')) {
     1822                          ExitFlag = 255;
     1823                          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);
     1824                          performCriticalExit();
     1825                        } else {
     1826                          ofstream output(argv[argptr+2]);
     1827                          ofstream binoutput(argv[argptr+3]);
     1828                          const double radius = 4.;
     1829                          const double BinWidth = atof(argv[argptr+4]);
     1830                          const double BinStart = atof(argv[argptr+5]);
     1831                          const double BinEnd = atof(argv[argptr+6]);
     1832                          double LCWidth = 20.;
     1833                          if (BinEnd > 0) {
     1834                            if (BinEnd > 2.*radius)
     1835                                LCWidth = BinEnd;
     1836                            else
     1837                              LCWidth = 2.*radius;
     1838                          }
     1839
     1840                          // get the boundary
     1841                          class molecule *Boundary = NULL;
     1842                          class Tesselation *TesselStruct = NULL;
     1843                          const LinkedCell *LCList = NULL;
     1844                          // find biggest molecule
     1845                          int counter  = 0;
     1846                          for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) {
     1847                            if ((Boundary == NULL) || (Boundary->AtomCount < (*BigFinder)->AtomCount)) {
     1848                              Boundary = *BigFinder;
     1849                            }
     1850                            counter++;
     1851                          }
     1852                          bool *Actives = Malloc<bool>(counter, "ParseCommandLineOptions() - case C -- *Actives");
     1853                          counter = 0;
     1854                          for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) {
     1855                            Actives[counter++] = (*BigFinder)->ActiveFlag;
     1856                            (*BigFinder)->ActiveFlag = (*BigFinder == Boundary) ? false : true;
     1857                          }
     1858                          LCList = new LinkedCell(Boundary, LCWidth);
     1859                          element *elemental = periode->FindElement((const int) atoi(argv[argptr+1]));
     1860                          FindNonConvexBorder(Boundary, TesselStruct, LCList, radius, NULL);
     1861                          CorrelationToSurfaceMap *surfacemap = NULL;
     1862                          if (periodic)
     1863                            surfacemap = PeriodicCorrelationToSurface( molecules, elemental, TesselStruct, LCList, ranges);
     1864                          else
     1865                            surfacemap = CorrelationToSurface( molecules, elemental, TesselStruct, LCList);
     1866                          OutputCorrelationToSurface(&output, surfacemap);
     1867                          // check whether radius was appropriate
     1868                          {
     1869                            double start; double end;
     1870                            GetMinMax( surfacemap, start, end);
     1871                            if (LCWidth < end)
     1872                              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);
     1873                          }
     1874                          BinPairMap *binmap = BinData( surfacemap, BinWidth, BinStart, BinEnd );
     1875                          OutputCorrelation ( &binoutput, binmap );
     1876                          output.close();
     1877                          binoutput.close();
     1878                          for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++)
     1879                            (*BigFinder)->ActiveFlag = Actives[counter++];
     1880                          Free(&Actives);
     1881                          delete(LCList);
     1882                          delete(TesselStruct);
     1883                          delete(binmap);
     1884                          delete(surfacemap);
     1885                          argptr+=7;
     1886                        }
     1887                      }
     1888                      break;
     1889
     1890                    default:
     1891                      ExitFlag = 255;
     1892                      DoeLog(0) && (eLog()<< Verbose(0) << "Invalid type given for pair correlation analysis: -C <type: E/P/S> [more params] <output> <bin output>" << endl);
     1893                      performCriticalExit();
     1894                      break;
    16981895                  }
    1699                   counter++;
    17001896                }
    1701                 bool *Actives = Malloc<bool>(counter, "ParseCommandLineOptions() - case C -- *Actives");
    1702                 counter = 0;
    1703                 for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) {
    1704                   Actives[counter++] = (*BigFinder)->ActiveFlag;
    1705                   (*BigFinder)->ActiveFlag = (*BigFinder == Boundary) ? false : true;
    1706                 }
    1707                 LCList = new LinkedCell(Boundary, 2.*radius);
    1708                 element *elemental = periode->FindElement((const int) atoi(argv[argptr]));
    1709                 FindNonConvexBorder(Boundary, TesselStruct, LCList, radius, NULL);
    1710                 int ranges[NDIM] = {1,1,1};
    1711                 CorrelationToSurfaceMap *surfacemap = PeriodicCorrelationToSurface( molecules, elemental, TesselStruct, LCList, ranges );
    1712                 OutputCorrelationToSurface(&output, surfacemap);
    1713                 BinPairMap *binmap = BinData( surfacemap, 0.5, 0., 20. );
    1714                 OutputCorrelation ( &binoutput, binmap );
    1715                 output.close();
    1716                 binoutput.close();
    1717                 for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++)
    1718                   (*BigFinder)->ActiveFlag = Actives[counter++];
    1719                 Free(&Actives);
    1720                 delete(LCList);
    1721                 delete(TesselStruct);
    1722                 argptr+=3;
    1723               }
    1724               break;
     1897                break;
     1898              }
    17251899            case 'E':
    17261900              if (ExitFlag == 0) ExitFlag = 1;
    17271901              if ((argptr+1 >= argc) || (!IsValidNumber(argv[argptr])) || (argv[argptr+1][0] == '-')) {
    17281902                ExitFlag = 255;
    1729                 eLog() << Verbose(0) << "Not enough or invalid arguments given for changing element: -E <atom nr.> <element>" << endl;
     1903                DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for changing element: -E <atom nr.> <element>" << endl);
    17301904                performCriticalExit();
    17311905              } else {
     
    17391913            case 'F':
    17401914              if (ExitFlag == 0) ExitFlag = 1;
    1741               if (argptr+6 >=argc) {
     1915              MaxDistance = -1;
     1916              if (argv[argptr-1][2] == 'F') { // option is -FF?
     1917                // fetch first argument as max distance to surface
     1918                MaxDistance = atof(argv[argptr++]);
     1919                Log() << Verbose(0) << "Filling with maximum layer distance of " << MaxDistance << "." << endl;
     1920              }
     1921              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]))) {
    17421922                ExitFlag = 255;
    1743                 eLog() << Verbose(0) << "Not enough or invalid arguments given for filling box with water: -F <dist_x> <dist_y> <dist_z> <boundary> <randatom> <randmol> <DoRotate>" << endl;
     1923                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);
    17441924                performCriticalExit();
    17451925              } else {
     
    17481928                // construct water molecule
    17491929                molecule *filler = new molecule(periode);
     1930                if (!filler->AddXYZFile(argv[argptr])) {
     1931                  DoeLog(0) && (eLog()<< Verbose(0) << "Could not parse filler molecule from " << argv[argptr] << "." << endl);
     1932                }
     1933                filler->SetNameFromFilename(argv[argptr]);
     1934                configuration.BG->ConstructBondGraph(filler);
    17501935                molecule *Filling = NULL;
    1751                 atom *second = NULL, *third = NULL;
    1752 //                first = new atom();
    1753 //                first->type = periode->FindElement(5);
    1754 //                first->x.Zero();
    1755 //                filler->AddAtom(first);
    1756                 first = new atom();
    1757                 first->type = periode->FindElement(1);
    1758                 first->x.Init(0.441, -0.143, 0.);
    1759                 filler->AddAtom(first);
    1760                 second = new atom();
    1761                 second->type = periode->FindElement(1);
    1762                 second->x.Init(-0.464, 1.137, 0.0);
    1763                 filler->AddAtom(second);
    1764                 third = new atom();
    1765                 third->type = periode->FindElement(8);
    1766                 third->x.Init(-0.464, 0.177, 0.);
    1767                 filler->AddAtom(third);
    1768                 filler->AddBond(first, third, 1);
    1769                 filler->AddBond(second, third, 1);
    17701936                // call routine
    17711937                double distance[NDIM];
    17721938                for (int i=0;i<NDIM;i++)
    1773                   distance[i] = atof(argv[argptr+i]);
    1774                 Filling = FillBoxWithMolecule(molecules, filler, configuration, distance, atof(argv[argptr+3]), atof(argv[argptr+4]), atof(argv[argptr+5]), atoi(argv[argptr+6]));
     1939                  distance[i] = atof(argv[argptr+i+1]);
     1940                Filling = FillBoxWithMolecule(molecules, filler, configuration, MaxDistance, distance, atof(argv[argptr+4]), atof(argv[argptr+5]), atof(argv[argptr+6]), atoi(argv[argptr+7]));
    17751941                if (Filling != NULL) {
    17761942                  Filling->ActiveFlag = false;
     
    17851951              if ((argptr >= argc) || (argv[argptr][0] == '-')) {
    17861952                ExitFlag =255;
    1787                 eLog() << Verbose(0) << "Missing source file for bonds in molecule: -A <bond sourcefile>" << endl;
     1953                DoeLog(0) && (eLog()<< Verbose(0) << "Missing source file for bonds in molecule: -A <bond sourcefile>" << endl);
    17881954                performCriticalExit();
    17891955              } else {
     
    18001966              if ((argptr >= argc) || (argv[argptr][0] == '-')) {
    18011967                ExitFlag =255;
    1802                 eLog() << Verbose(0) << "Missing path of adjacency file: -j <path>" << endl;
     1968                DoeLog(0) && (eLog()<< Verbose(0) << "Missing path of adjacency file: -j <path>" << endl);
    18031969                performCriticalExit();
    18041970              } else {
    18051971                Log() << Verbose(0) << "Storing adjacency to path " << argv[argptr] << "." << endl;
    18061972                configuration.BG->ConstructBondGraph(mol);
    1807                 mol->StoreAdjacencyToFile(argv[argptr]);
     1973                mol->StoreAdjacencyToFile(NULL, argv[argptr]);
    18081974                argptr+=1;
    18091975              }
     
    18141980              if ((argptr >= argc) || (argv[argptr][0] == '-')) {
    18151981                ExitFlag =255;
    1816                 eLog() << Verbose(0) << "Missing path of bonds file: -j <path>" << endl;
     1982                DoeLog(0) && (eLog()<< Verbose(0) << "Missing path of bonds file: -j <path>" << endl);
    18171983                performCriticalExit();
    18181984              } else {
    18191985                Log() << Verbose(0) << "Storing bonds to path " << argv[argptr] << "." << endl;
    18201986                configuration.BG->ConstructBondGraph(mol);
    1821                 mol->StoreBondsToFile(argv[argptr]);
     1987                mol->StoreBondsToFile(NULL, argv[argptr]);
    18221988                argptr+=1;
    18231989              }
     
    18281994              if ((argptr+1 >= argc) || (argv[argptr+1][0] == '-')){
    18291995                ExitFlag = 255;
    1830                 eLog() << Verbose(0) << "Not enough or invalid arguments given for non-convex envelope: -o <radius> <tecplot output file>" << endl;
     1996                DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for non-convex envelope: -o <radius> <tecplot output file>" << endl);
    18311997                performCriticalExit();
    18321998              } else {
     
    18642030              if ((argptr >= argc) || (argv[argptr][0] == '-')) {
    18652031                ExitFlag = 255;
    1866                 eLog() << Verbose(0) << "Not enough or invalid arguments given for storing tempature: -S <temperature file>" << endl;
     2032                DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for storing tempature: -S <temperature file>" << endl);
    18672033                performCriticalExit();
    18682034              } else {
     
    18822048              if ((argptr >= argc) || (argv[argptr][0] == '-')) {
    18832049                ExitFlag = 255;
    1884                 eLog() << Verbose(0) << "Not enough or invalid arguments given for storing tempature: -L <step0> <step1> <prefix> <identity mapping?>" << endl;
     2050                DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for storing tempature: -L <step0> <step1> <prefix> <identity mapping?>" << endl);
    18852051                performCriticalExit();
    18862052              } else {
     
    19002066              if ((argptr >= argc) || (argv[argptr][0] == '-')) {
    19012067                ExitFlag = 255;
    1902                 eLog() << Verbose(0) << "Not enough or invalid arguments given for parsing and integrating forces: -P <forces file>" << endl;
     2068                DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for parsing and integrating forces: -P <forces file>" << endl);
    19032069                performCriticalExit();
    19042070              } else {
     
    19162082              if ((argptr+1 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])))  {
    19172083                ExitFlag = 255;
    1918                 eLog() << Verbose(0) << "Not enough or invalid arguments given for removing atoms: -R <id> <distance>" << endl;
     2084                DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for removing atoms: -R <id> <distance>" << endl);
    19192085                performCriticalExit();
    19202086              } else {
     
    19332099                  }
    19342100                } else {
    1935                   eLog() << Verbose(1) << "Removal failed due to missing atoms on molecule or wrong id." << endl;
     2101                  DoeLog(1) && (eLog()<< Verbose(1) << "Removal failed due to missing atoms on molecule or wrong id." << endl);
    19362102                }
    19372103                argptr+=2;
     
    19422108              if ((argptr+2 >= argc) || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) ) {
    19432109                ExitFlag = 255;
    1944                 eLog() << Verbose(0) << "Not enough or invalid arguments given for translation: -t <x> <y> <z>" << endl;
     2110                DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for translation: -t <x> <y> <z>" << endl);
    19452111                performCriticalExit();
    19462112              } else {
     
    19582124              if ((argptr+2 >= argc) || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) ) {
    19592125                ExitFlag = 255;
    1960                 eLog() << Verbose(0) << "Not enough or invalid arguments given for periodic translation: -T <x> <y> <z>" << endl;
     2126                DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for periodic translation: -T <x> <y> <z>" << endl);
    19612127                performCriticalExit();
    19622128              } else {
     
    19742140              if ((argptr >= argc) || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) ) {
    19752141                ExitFlag = 255;
    1976                 eLog() << Verbose(0) << "Not enough or invalid arguments given for scaling: -s <factor_x> [factor_y] [factor_z]" << endl;
     2142                DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for scaling: -s <factor_x> [factor_y] [factor_z]" << endl);
    19772143                performCriticalExit();
    19782144              } else {
     
    19852151                factor[2] = atof(argv[argptr+2]);
    19862152                mol->Scale((const double ** const)&factor);
     2153                double * const cell_size = World::get()->cell_size;
    19872154                for (int i=0;i<NDIM;i++) {
    19882155                  j += i+1;
    19892156                  x.x[i] = atof(argv[NDIM+i]);
    1990                   mol->cell_size[j]*=factor[i];
     2157                  cell_size[j]*=factor[i];
    19912158                }
    19922159                delete[](factor);
     
    19982165              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])) ) {
    19992166                ExitFlag = 255;
    2000                 eLog() << Verbose(0) << "Not enough or invalid arguments given for centering in box: -b <xx> <xy> <xz> <yy> <yz> <zz>" << endl;
     2167                DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for centering in box: -b <xx> <xy> <xz> <yy> <yz> <zz>" << endl);
    20012168                performCriticalExit();
    20022169              } else {
     
    20042171                j = -1;
    20052172                Log() << Verbose(1) << "Centering atoms in config file within given simulation box." << endl;
     2173                double * const cell_size = World::get()->cell_size;
    20062174                for (int i=0;i<6;i++) {
    2007                   mol->cell_size[i] = atof(argv[argptr+i]);
     2175                  cell_size[i] = atof(argv[argptr+i]);
    20082176                }
    20092177                // center
     
    20162184              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])) ) {
    20172185                ExitFlag = 255;
    2018                 eLog() << Verbose(0) << "Not enough or invalid arguments given for bounding in box: -B <xx> <xy> <xz> <yy> <yz> <zz>" << endl;
     2186                DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for bounding in box: -B <xx> <xy> <xz> <yy> <yz> <zz>" << endl);
    20192187                performCriticalExit();
    20202188              } else {
     
    20222190                j = -1;
    20232191                Log() << Verbose(1) << "Centering atoms in config file within given simulation box." << endl;
     2192                double * const cell_size = World::get()->cell_size;
    20242193                for (int i=0;i<6;i++) {
    2025                   mol->cell_size[i] = atof(argv[argptr+i]);
     2194                  cell_size[i] = atof(argv[argptr+i]);
    20262195                }
    20272196                // center
     
    20342203              if ((argptr+2 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) ) {
    20352204                ExitFlag = 255;
    2036                 eLog() << Verbose(0) << "Not enough or invalid arguments given for centering with boundary: -c <boundary_x> <boundary_y> <boundary_z>" << endl;
     2205                DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for centering with boundary: -c <boundary_x> <boundary_y> <boundary_z>" << endl);
    20372206                performCriticalExit();
    20382207              } else {
     
    20452214                mol->SetBoxDimension(&x);
    20462215                // translate each coordinate by boundary
     2216                double * const cell_size = World::get()->cell_size;
    20472217                j=-1;
    20482218                for (int i=0;i<NDIM;i++) {
    20492219                  j += i+1;
    20502220                  x.x[i] = atof(argv[argptr+i]);
    2051                   mol->cell_size[j] += x.x[i]*2.;
     2221                  cell_size[j] += x.x[i]*2.;
    20522222                }
    20532223                mol->Translate((const Vector *)&x);
     
    20682238              if ((argptr >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])))  {
    20692239                ExitFlag = 255;
    2070                 eLog() << Verbose(0) << "Not enough or invalid arguments given for removing atoms: -r <id>" << endl;
     2240                DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for removing atoms: -r <id>" << endl);
    20712241                performCriticalExit();
    20722242              } else {
     
    20822252              if ((argptr+1 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1]))) {
    20832253                ExitFlag = 255;
    2084                 eLog() << Verbose(0) << "Not enough or invalid arguments for fragmentation: -f <max. bond distance> <bond order>" << endl;
     2254                DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments for fragmentation: -f <max. bond distance> <bond order>" << endl);
    20852255                performCriticalExit();
    20862256              } else {
     
    21022272              j = atoi(argv[argptr++]);
    21032273              if ((j<0) || (j>1)) {
    2104                 eLog() << Verbose(1) << "Argument of '-m' should be either 0 for no-rotate or 1 for rotate." << endl;
     2274                DoeLog(1) && (eLog()<< Verbose(1) << "Argument of '-m' should be either 0 for no-rotate or 1 for rotate." << endl);
    21052275                j = 0;
    21062276              }
     
    21162286              if ((argptr+1 >= argc) || (argv[argptr][0] == '-')){
    21172287                ExitFlag = 255;
    2118                 eLog() << Verbose(0) << "Not enough or invalid arguments given for convex envelope: -o <convex output file> <non-convex output file>" << endl;
     2288                DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for convex envelope: -o <convex output file> <non-convex output file>" << endl);
    21192289                performCriticalExit();
    21202290              } else {
     
    21412311              if ((argptr+1 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) ) {
    21422312                ExitFlag = 255;
    2143                 eLog() << Verbose(0) << "Not enough or invalid arguments given for suspension with specified volume: -U <volume> <density>" << endl;
     2313                DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for suspension with specified volume: -U <volume> <density>" << endl);
    21442314                performCriticalExit();
    21452315              } else {
     
    21522322                if (volume != -1)
    21532323                  ExitFlag = 255;
    2154                   eLog() << Verbose(0) << "Not enough or invalid arguments given for suspension: -u <density>" << endl;
     2324                  DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for suspension: -u <density>" << endl);
    21552325                  performCriticalExit();
    21562326              } else {
     
    21602330                density = atof(argv[argptr++]);
    21612331                if (density < 1.0) {
    2162                   eLog() << Verbose(1) << "Density must be greater than 1.0g/cm^3 !" << endl;
     2332                  DoeLog(1) && (eLog()<< Verbose(1) << "Density must be greater than 1.0g/cm^3 !" << endl);
    21632333                  density = 1.3;
    21642334                }
     
    21662336//                  repetition[i] = atoi(argv[argptr++]);
    21672337//                  if (repetition[i] < 1)
    2168 //                    eLog() << Verbose(1) << "repetition value must be greater 1!" << endl;
     2338//                    DoeLog(1) && (eLog()<< Verbose(1) << "repetition value must be greater 1!" << endl);
    21692339//                  repetition[i] = 1;
    21702340//                }
     
    21762346              if ((argptr+2 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) ) {
    21772347                ExitFlag = 255;
    2178                 eLog() << Verbose(0) << "Not enough or invalid arguments given for repeating cells: -d <repeat_x> <repeat_y> <repeat_z>" << endl;
     2348                DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for repeating cells: -d <repeat_x> <repeat_y> <repeat_z>" << endl);
    21792349                performCriticalExit();
    21802350              } else {
    21812351                SaveFlag = true;
     2352                double * const cell_size = World::get()->cell_size;
    21822353                for (int axis = 1; axis <= NDIM; axis++) {
    21832354                  int faktor = atoi(argv[argptr++]);
     
    21862357                  Vector ** vectors;
    21872358                  if (faktor < 1) {
    2188                     eLog() << Verbose(1) << "Repetition factor mus be greater than 1!" << endl;
     2359                    DoeLog(1) && (eLog()<< Verbose(1) << "Repetition factor mus be greater than 1!" << endl);
    21892360                    faktor = 1;
    21902361                  }
     
    22032374                    }
    22042375                    if (count != j)
    2205                       eLog() << Verbose(1) << "AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!" << endl;
     2376                      DoeLog(1) && (eLog()<< Verbose(1) << "AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!" << endl);
    22062377                    x.Zero();
    22072378                    y.Zero();
    2208                     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
     2379                    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
    22092380                    for (int i=1;i<faktor;i++) {  // then add this list with respective translation factor times
    22102381                      x.AddVector(&y); // per factor one cell width further
     
    22272398                      mol->Translate(&x);
    22282399                    }
    2229                     mol->cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] *= faktor;
     2400                    cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] *= faktor;
    22302401                  }
    22312402                }
     
    22692440
    22702441  cout << ESPACKVersion << endl;
     2442
     2443  Log() << Verbose(1) << "test" << endl;
     2444  DoLog(3) && (Log() << Verbose(1) << "test");
    22712445
    22722446  setVerbosity(0);
     
    22962470  if (molecules->ListOfMolecules.size() == 0) {
    22972471    mol = new molecule(periode);
    2298     if (mol->cell_size[0] == 0.) {
     2472    double * const cell_size = World::get()->cell_size;
     2473    if (cell_size[0] == 0.) {
    22992474      Log() << Verbose(0) << "enter lower tridiagonal form of basis matrix" << endl << endl;
    23002475      for (int i=0;i<6;i++) {
    23012476        Log() << Verbose(1) << "Cell size" << i << ": ";
    2302         cin >> mol->cell_size[i];
     2477        cin >> cell_size[i];
    23032478      }
    23042479    }
  • src/config.cpp

    r8ab0407 rc7b1e7  
    1919#include "molecule.hpp"
    2020#include "periodentafel.hpp"
     21#include "World.hpp"
    2122
    2223/******************************** Functions for class ConfigFileBuffer **********************/
     
    7374  file= new ifstream(filename);
    7475  if (file == NULL) {
    75     eLog() << Verbose(1) << "config file " << filename << " missing!" << endl;
     76    DoeLog(1) && (eLog()<< Verbose(1) << "config file " << filename << " missing!" << endl);
    7677    return;
    7778  }
     
    8889  // allocate buffer's 1st dimension
    8990  if (buffer != NULL) {
    90     eLog() << Verbose(1) << "FileBuffer->buffer is not NULL!" << endl;
     91    DoeLog(1) && (eLog()<< Verbose(1) << "FileBuffer->buffer is not NULL!" << endl);
    9192    return;
    9293  } else
     
    143144  map<const char *, int, IonTypeCompare> IonTypeLineMap;
    144145  if (LineMapping == NULL) {
    145     eLog() << Verbose(0) << "map pointer is NULL: " << LineMapping << endl;
     146    DoeLog(0) && (eLog()<< Verbose(0) << "map pointer is NULL: " << LineMapping << endl);
    146147    performCriticalExit();
    147148    return;
     
    159160      LineMapping[CurrentLine+(nr++)] = runner->second;
    160161    else {
    161       eLog() << Verbose(0) << "config::MapIonTypesInBuffer - NoAtoms is wrong: We are past the end of the file!" << endl;
     162      DoeLog(0) && (eLog()<< Verbose(0) << "config::MapIonTypesInBuffer - NoAtoms is wrong: We are past the end of the file!" << endl);
    162163      performCriticalExit();
    163164    }
     
    499500//        case 'j': // BoxLength
    500501//          Log() << Verbose(0) << "enter lower triadiagonalo form of basis matrix" << endl << endl;
     502//          double * const cell_size = World::get()->cell_size;
    501503//          for (int i=0;i<6;i++) {
    502504//            Log() << Verbose(0) << "Cell size" << i << ": ";
    503 //            cin >> mol->cell_size[i];
     505//            cin >> cell_size[i];
    504506//          }
    505507//          break;
     
    657659{
    658660  if (FileBuffer != NULL) {
    659     eLog() << Verbose(2) << "deleting present FileBuffer in PrepareFileBuffer()." << endl;
     661    DoeLog(2) && (eLog()<< Verbose(2) << "deleting present FileBuffer in PrepareFileBuffer()." << endl);
    660662    delete(FileBuffer);
    661663  }
     
    683685
    684686  if (mol == NULL) {
    685     eLog() << Verbose(0) << "Molecule is not allocated in LoadMolecule(), exit.";
     687    DoeLog(0) && (eLog()<< Verbose(0) << "Molecule is not allocated in LoadMolecule(), exit.");
    686688    performCriticalExit();
    687689  }
     
    689691  ParseForParameter(verbose,FileBuffer,"MaxTypes", 0, 1, 1, int_type, &(MaxTypes), 1, critical);
    690692  if (MaxTypes == 0) {
    691     eLog() << Verbose(0) << "There are no atoms according to MaxTypes in this config file." << endl;
    692     performCriticalExit();
     693    DoeLog(1) && (eLog()<< Verbose(1) << "There are no atoms according to MaxTypes in this config file." << endl);
     694    //performCriticalExit();
    693695  } else {
    694696    // prescan number of ions per type
     
    708710    sprintf(name,"Ion_Type%i",MaxTypes);
    709711    if (!ParseForParameter(verbose,FileBuffer, (const char*)name, 1, 1, 1, int_type, &value[0], 1, critical)) {
    710       eLog() << Verbose(0) << "There are no atoms in the config file!" << endl;
     712      DoeLog(0) && (eLog()<< Verbose(0) << "There are no atoms in the config file!" << endl);
    711713      performCriticalExit();
    712714      return;
     
    853855  ifstream *file = new ifstream(filename);
    854856  if (file == NULL) {
    855     eLog() << Verbose(1) << "config file " << filename << " missing!" << endl;
     857    DoeLog(1) && (eLog()<< Verbose(1) << "config file " << filename << " missing!" << endl);
    856858    return;
    857859  }
     
    965967  // Unit cell and magnetic field
    966968  ParseForParameter(verbose,FileBuffer, "BoxLength", 0, 3, 3, lower_trigrid, BoxLength, 1, critical); /* Lattice->RealBasis */
    967   mol->cell_size[0] = BoxLength[0];
    968   mol->cell_size[1] = BoxLength[3];
    969   mol->cell_size[2] = BoxLength[4];
    970   mol->cell_size[3] = BoxLength[6];
    971   mol->cell_size[4] = BoxLength[7];
    972   mol->cell_size[5] = BoxLength[8];
     969  double * const cell_size = World::get()->cell_size;
     970  cell_size[0] = BoxLength[0];
     971  cell_size[1] = BoxLength[3];
     972  cell_size[2] = BoxLength[4];
     973  cell_size[3] = BoxLength[6];
     974  cell_size[4] = BoxLength[7];
     975  cell_size[5] = BoxLength[8];
    973976  //if (1) fprintf(stderr,"\n");
    974977
     
    10621065      Log() << Verbose(0) << "Bond length table loaded successfully." << endl;
    10631066    } else {
    1064       eLog() << Verbose(1) << "Bond length table loading failed." << endl;
     1067      DoeLog(1) && (eLog()<< Verbose(1) << "Bond length table loading failed." << endl);
    10651068    }
    10661069  }
     
    10911094  ifstream *file = new ifstream(filename);
    10921095  if (file == NULL) {
    1093     eLog() << Verbose(1) << "config file " << filename << " missing!" << endl;
     1096    DoeLog(1) && (eLog()<< Verbose(1) << "config file " << filename << " missing!" << endl);
    10941097    return;
    10951098  }
     
    11691172
    11701173  ParseForParameter(verbose,file, "BoxLength", 0, 3, 3, lower_trigrid, BoxLength, 1, critical); /* Lattice->RealBasis */
    1171   mol->cell_size[0] = BoxLength[0];
    1172   mol->cell_size[1] = BoxLength[3];
    1173   mol->cell_size[2] = BoxLength[4];
    1174   mol->cell_size[3] = BoxLength[6];
    1175   mol->cell_size[4] = BoxLength[7];
    1176   mol->cell_size[5] = BoxLength[8];
     1174  double * const cell_size = World::get()->cell_size;
     1175  cell_size[0] = BoxLength[0];
     1176  cell_size[1] = BoxLength[3];
     1177  cell_size[2] = BoxLength[4];
     1178  cell_size[3] = BoxLength[6];
     1179  cell_size[4] = BoxLength[7];
     1180  cell_size[5] = BoxLength[8];
    11771181  if (1) fprintf(stderr,"\n");
    11781182  config::DoPerturbation = 0;
     
    13121316  // bring MaxTypes up to date
    13131317  mol->CountElements();
     1318  const double * const cell_size = World::get()->cell_size;
    13141319  ofstream * const output = new ofstream(filename, ios::out);
    13151320  if (output != NULL) {
     
    13821387    *output << endl;
    13831388    *output << "BoxLength\t\t\t# (Length of a unit cell)" << endl;
    1384     *output << mol->cell_size[0] << "\t" << endl;
    1385     *output << mol->cell_size[1] << "\t" << mol->cell_size[2] << "\t" << endl;
    1386     *output << mol->cell_size[3] << "\t" << mol->cell_size[4] << "\t" << mol->cell_size[5] << "\t" << endl;
     1389    *output << cell_size[0] << "\t" << endl;
     1390    *output << cell_size[1] << "\t" << cell_size[2] << "\t" << endl;
     1391    *output << cell_size[3] << "\t" << cell_size[4] << "\t" << cell_size[5] << "\t" << endl;
    13871392    // FIXME
    13881393    *output << endl;
     
    14281433    return result;
    14291434  } else {
    1430     eLog() << Verbose(1) << "Cannot open output file:" << filename << endl;
     1435    DoeLog(1) && (eLog()<< Verbose(1) << "Cannot open output file:" << filename << endl);
    14311436    return false;
    14321437  }
     
    14501455    output = new ofstream(fname->str().c_str(), ios::out);
    14511456    if (output == NULL) {
    1452       eLog() << Verbose(1) << "Cannot open mpqc output file:" << fname << endl;
     1457      DoeLog(1) && (eLog()<< Verbose(1) << "Cannot open mpqc output file:" << fname << endl);
    14531458      delete(fname);
    14541459      return false;
     
    14931498    output = new ofstream(fname->str().c_str(), ios::out);
    14941499    if (output == NULL) {
    1495       eLog() << Verbose(1) << "Cannot open mpqc hessian output file:" << fname << endl;
     1500      DoeLog(1) && (eLog()<< Verbose(1) << "Cannot open mpqc hessian output file:" << fname << endl);
    14961501      delete(fname);
    14971502      return false;
     
    15491554  f = fopen(name, "w" );
    15501555  if (f == NULL) {
    1551     eLog() << Verbose(1) << "Cannot open pdb output file:" << name << endl;
     1556    DoeLog(1) && (eLog()<< Verbose(1) << "Cannot open pdb output file:" << name << endl);
    15521557    return false;
    15531558  }
     
    16041609  f = fopen(name, "w" );
    16051610  if (f == NULL) {
    1606     eLog() << Verbose(1) << "Cannot open pdb output file:" << name << endl;
     1611    DoeLog(1) && (eLog()<< Verbose(1) << "Cannot open pdb output file:" << name << endl);
    16071612    Free(&elementNo);
    16081613    return false;
     
    16411646/** Stores all atoms in a TREMOLO data input file.
    16421647 * Note that this format cannot be parsed again.
     1648 * Note that TREMOLO does not like Id starting at 0, but at 1. Atoms with Id 0 are discarded!
    16431649 * \param *filename name of file (without ".in" suffix!)
    16441650 * \param *mol pointer to molecule
     
    16531659  output = new ofstream(fname->str().c_str(), ios::out);
    16541660  if (output == NULL) {
    1655     eLog() << Verbose(1) << "Cannot open tremolo output file:" << fname << endl;
     1661    DoeLog(1) && (eLog()<< Verbose(1) << "Cannot open tremolo output file:" << fname << endl);
    16561662    delete(fname);
    16571663    return false;
     
    16951701/** Stores all atoms from all molecules in a TREMOLO data input file.
    16961702 * Note that this format cannot be parsed again.
     1703 * Note that TREMOLO does not like Id starting at 0, but at 1. Atoms with Id 0 are discarded!
    16971704 * \param *filename name of file (without ".in" suffix!)
    16981705 * \param *MolList pointer to MoleculeListClass containing all atoms
     
    17071714  output = new ofstream(fname->str().c_str(), ios::out);
    17081715  if (output == NULL) {
    1709     eLog() << Verbose(1) << "Cannot open tremolo output file:" << fname << endl;
     1716    DoeLog(1) && (eLog()<< Verbose(1) << "Cannot open tremolo output file:" << fname << endl);
    17101717    delete(fname);
    17111718    return false;
     
    17471754      while (Walker->next != (*MolWalker)->end) {
    17481755        Walker = Walker->next;
    1749         *output << AtomNo << "\t";
     1756        *output << AtomNo+1 << "\t";
    17501757        *output << Walker->Name << "\t";
    17511758        *output << (*MolWalker)->name << "\t";
    1752         *output << MolCounter << "\t";
     1759        *output << MolCounter+1 << "\t";
    17531760        *output << Walker->node->x[0] << "\t" << Walker->node->x[1] << "\t" << Walker->node->x[2] << "\t";
    17541761        *output << (double)Walker->type->Valence << "\t";
    17551762        *output << Walker->type->symbol << "\t";
    17561763        for (BondList::iterator runner = Walker->ListOfBonds.begin(); runner != Walker->ListOfBonds.end(); runner++)
    1757           *output << LocalNotoGlobalNoMap[MolCounter][ (*runner)->GetOtherAtom(Walker)->nr ] << "\t";
     1764          *output << LocalNotoGlobalNoMap[MolCounter][ (*runner)->GetOtherAtom(Walker)->nr ]+1 << "\t";
    17581765        for(int i=Walker->ListOfBonds.size(); i < MaxNeighbours; i++)
    17591766          *output << "-\t";
  • src/defs.hpp

    r8ab0407 rc7b1e7  
    1212#define MAX_ELEMENTS 128  //!< maximum number of elements for certain lookup tables
    1313#define AtomicLengthToAngstroem  0.52917721 //!< conversion factor from atomic length/bohrradius to angstroem
    14 #define BONDTHRESHOLD 0.5   //!< CSD threshold in bond check which is the width of the interval whose center is the sum of the covalent radii
    1514#define AtomicEnergyToKelvin 315774.67  //!< conversion factor from atomic energy to kelvin via boltzmann factor
    1615#define KelvinToAtomicTemperature 3.1668152e-06    //!< conversion factor for Kelvin to atomic temperature (Hartree over k_B)
  • src/ellipsoid.cpp

    r8ab0407 rc7b1e7  
    241241    x = new Vector[PointsToPick];
    242242  } else {
    243     eLog() << Verbose(2) << "Given pointer to vector array seems already allocated." << endl;
     243    DoeLog(2) && (eLog()<< Verbose(2) << "Given pointer to vector array seems already allocated." << endl);
    244244  }
    245245
     
    341341    x = new Vector[PointsToPick];
    342342  } else {
    343     eLog() << Verbose(2) << "Given pointer to vector array seems already allocated." << endl;
     343    DoeLog(2) && (eLog()<< Verbose(2) << "Given pointer to vector array seems already allocated." << endl);
    344344  }
    345345
  • src/gslvector.cpp

    r8ab0407 rc7b1e7  
    66 */
    77
     8#include <cassert>
     9#include <cmath>
     10
    811#include "gslvector.hpp"
     12#include "defs.hpp"
    913
    1014/** Constructor of class GSLVector.
     
    2731};
    2832
     33/** Copy constructor of class GSLVector.
     34 * Allocates GSL structures and copies components from \a *src.
     35 * \param *src source vector
     36 */
     37GSLVector::GSLVector(const GSLVector & src) : dimension(src.dimension)
     38{
     39  vector = gsl_vector_alloc(dimension);
     40  gsl_vector_memcpy (vector, src.vector);
     41};
     42
    2943/** Destructor of class GSLVector.
    3044 * Frees GSL structures
     
    3347{
    3448  gsl_vector_free(vector);
    35   dimension = 0;
    3649};
    3750
     
    5265 * \return  m-th element of vector
    5366 */
    54 double GSLVector::Get(size_t m)
     67double GSLVector::Get(size_t m) const
    5568{
    5669  return gsl_vector_get (vector, m);
     
    7285 * \return pointer to \a m-th element
    7386 */
    74 double *GSLVector::Pointer(size_t m)
     87double *GSLVector::Pointer(size_t m) const
    7588{
    7689  return gsl_vector_ptr (vector, m);
     
    8295 * \return const pointer to \a m-th element
    8396 */
    84 const double *GSLVector::const_Pointer(size_t m)
     97const double *GSLVector::const_Pointer(size_t m) const
    8598{
    8699  return gsl_vector_const_ptr (vector, m);
     100};
     101
     102/** Returns the dimension of the vector.
     103 * \return dimension of vector
     104 */
     105#ifdef HAVE_INLINE
     106inline
     107#endif
     108size_t GSLVector::GetDimension() const
     109{
     110  return dimension;
    87111};
    88112
     
    128152  return gsl_vector_reverse (vector);
    129153};
     154
     155
     156/* ========================== Operators =============================== */
     157/** Compares GSLVector \a to GSLVector \a b component-wise.
     158 * \param a base GSLVector
     159 * \param b GSLVector components to add
     160 * \return a == b
     161 */
     162bool operator==(const GSLVector& a, const GSLVector& b)
     163{
     164  bool status = true;
     165  assert(a.GetDimension() == b.GetDimension() && "Dimenions of GSLVectors to compare differ");
     166  for (size_t i=0;i<a.GetDimension();i++)
     167    status = status && (fabs(a.Get(i) - b.Get(i)) < MYEPSILON);
     168  return status;
     169};
     170
     171/** Sums GSLVector \a to this lhs component-wise.
     172 * \param a base GSLVector
     173 * \param b GSLVector components to add
     174 * \return lhs + a
     175 */
     176const GSLVector& operator+=(GSLVector& a, const GSLVector& b)
     177{
     178  assert(a.GetDimension() == b.GetDimension() && "Dimenions of GSLVectors to compare differ");
     179  for (size_t i=0;i<a.GetDimension();i++)
     180    a.Set(i,a.Get(i)+b.Get(i));
     181  return a;
     182};
     183
     184/** Subtracts GSLVector \a from this lhs component-wise.
     185 * \param a base GSLVector
     186 * \param b GSLVector components to add
     187 * \return lhs - a
     188 */
     189const GSLVector& operator-=(GSLVector& a, const GSLVector& b)
     190{
     191  assert(a.GetDimension() == b.GetDimension() && "Dimenions of GSLVectors to compare differ");
     192  for (size_t i=0;i<a.GetDimension();i++)
     193    a.Set(i,a.Get(i)-b.Get(i));
     194  return a;
     195};
     196
     197/** factor each component of \a a times a double \a m.
     198 * \param a base GSLVector
     199 * \param m factor
     200 * \return lhs.Get(i) * m
     201 */
     202const GSLVector& operator*=(GSLVector& a, const double m)
     203{
     204  for (size_t i=0;i<a.GetDimension();i++)
     205    a.Set(i,a.Get(i)*m);
     206  return a;
     207};
     208
     209/** Sums two GSLVectors \a  and \b component-wise.
     210 * \param a first GSLVector
     211 * \param b second GSLVector
     212 * \return a + b
     213 */
     214GSLVector const operator+(const GSLVector& a, const GSLVector& b)
     215{
     216  GSLVector x(a);
     217  for (size_t i=0;i<a.GetDimension();i++)
     218    x.Set(i,a.Get(i)+b.Get(i));
     219  return x;
     220};
     221
     222/** Subtracts GSLVector \a from \b component-wise.
     223 * \param a first GSLVector
     224 * \param b second GSLVector
     225 * \return a - b
     226 */
     227GSLVector const operator-(const GSLVector& a, const GSLVector& b)
     228{
     229  assert(a.GetDimension() == b.GetDimension() && "Dimenions of GSLVectors to compare differ");
     230  GSLVector x(a);
     231  for (size_t i=0;i<a.GetDimension();i++)
     232    x.Set(i,a.Get(i)-b.Get(i));
     233  return x;
     234};
     235
     236/** Factors given GSLVector \a a times \a m.
     237 * \param a GSLVector
     238 * \param m factor
     239 * \return m * a
     240 */
     241GSLVector const operator*(const GSLVector& a, const double m)
     242{
     243  GSLVector x(a);
     244  for (size_t i=0;i<a.GetDimension();i++)
     245    x.Set(i,a.Get(i)*m);
     246  return x;
     247};
     248
     249/** Factors given GSLVector \a a times \a m.
     250 * \param m factor
     251 * \param a GSLVector
     252 * \return m * a
     253 */
     254GSLVector const operator*(const double m, const GSLVector& a )
     255{
     256  GSLVector x(a);
     257  for (size_t i=0;i<a.GetDimension();i++)
     258    x.Set(i,a.Get(i)*m);
     259  return x;
     260};
     261
     262ostream& operator<<(ostream& ost, const GSLVector& m)
     263{
     264  ost << "(";
     265  for (size_t i=0;i<m.GetDimension();i++) {
     266    ost << m.Get(i);
     267    if (i != 2)
     268      ost << ",";
     269  }
     270  ost << ")";
     271  return ost;
     272};
     273
     274/* ====================== Checking State ============================ */
     275/** Checks whether vector has all components zero.
     276 * @return true - vector is zero, false - vector is not
     277 */
     278bool GSLVector::IsZero() const
     279{
     280  return (fabs(Get(0))+fabs(Get(1))+fabs(Get(2)) < MYEPSILON);
     281};
     282
     283/** Checks whether vector has length of 1.
     284 * @return true - vector is normalized, false - vector is not
     285 */
     286bool GSLVector::IsOne() const
     287{
     288  double NormValue = 0.;
     289  for (size_t i=dimension;--i;)
     290    NormValue += Get(i)*Get(i);
     291  return (fabs(NormValue - 1.) < MYEPSILON);
     292};
     293
  • src/gslvector.hpp

    r8ab0407 rc7b1e7  
    1818#endif
    1919
     20#include <iostream>
    2021#include <gsl/gsl_vector.h>
    2122
     
    3233  GSLVector(size_t m);
    3334  GSLVector(const GSLVector * const src);
     35  GSLVector(const GSLVector & src);
    3436  ~GSLVector();
    3537
    3638  // Accessing
    3739  void SetFromDoubleArray(double *x);
    38   double Get(size_t m);
     40  double Get(size_t m) const;
    3941  void Set(size_t m, double x);
    40   double *Pointer(size_t m);
    41   const double *const_Pointer(size_t m);
     42  double *Pointer(size_t m) const;
     43  const double *const_Pointer(size_t m) const;
     44  size_t GetDimension() const;
    4245
    4346  // Initializing
     
    5053  int Reverse();
    5154
     55  // checking state
     56  bool IsZero() const;
     57  bool IsOne() const;
     58
    5259private:
    5360  gsl_vector *vector;
    5461
    55   size_t dimension;
     62  const size_t dimension;
    5663};
     64
     65ostream & operator << (ostream& ost, const GSLVector &m);
     66bool operator==(const GSLVector& a, const GSLVector& b);
     67const GSLVector& operator+=(GSLVector& a, const GSLVector& b);
     68const GSLVector& operator-=(GSLVector& a, const GSLVector& b);
     69const GSLVector& operator*=(GSLVector& a, const double m);
     70GSLVector const operator*(const GSLVector& a, const double m);
     71GSLVector const operator*(const double m, const GSLVector& a);
     72GSLVector const operator+(const GSLVector& a, const GSLVector& b);
     73GSLVector const operator-(const GSLVector& a, const GSLVector& b);
     74
    5775
    5876
  • src/helpers.hpp

    r8ab0407 rc7b1e7  
    134134  LookupTable = Calloc<T*>(count, "CreateFatherLookupTable - **LookupTable");
    135135  if (LookupTable == NULL) {
    136     eLog() << Verbose(0) << "LookupTable memory allocation failed!" << endl;
     136    DoeLog(0) && (eLog()<< Verbose(0) << "LookupTable memory allocation failed!" << endl);
    137137    performCriticalExit();
    138138    status = false;
  • src/linkedcell.cpp

    r8ab0407 rc7b1e7  
    4646  min.Zero();
    4747  Log() << Verbose(1) << "Begin of LinkedCell" << endl;
    48   if (set->IsEmpty()) {
    49     eLog() << Verbose(1) << "set contains no linked cell nodes!" << endl;
     48  if ((set == NULL) || (set->IsEmpty())) {
     49    DoeLog(1) && (eLog()<< Verbose(1) << "set is NULL or contains no linked cell nodes!" << endl);
    5050    return;
    5151  }
     
    7979  Log() << Verbose(2) << "Allocating cells ... ";
    8080  if (LC != NULL) {
    81     eLog() << Verbose(1) << "Linked Cell list is already allocated, I do nothing." << endl;
     81    DoeLog(1) && (eLog()<< Verbose(1) << "Linked Cell list is already allocated, I do nothing." << endl);
    8282    return;
    8383  }
     
    122122  Log() << Verbose(1) << "Begin of LinkedCell" << endl;
    123123  if (set->empty()) {
    124     eLog() << Verbose(1) << "set contains no linked cell nodes!" << endl;
     124    DoeLog(1) && (eLog()<< Verbose(1) << "set contains no linked cell nodes!" << endl);
    125125    return;
    126126  }
     
    151151  Log() << Verbose(2) << "Allocating cells ... ";
    152152  if (LC != NULL) {
    153     eLog() << Verbose(1) << "Linked Cell list is already allocated, I do nothing." << endl;
     153    DoeLog(1) && (eLog()<< Verbose(1) << "Linked Cell list is already allocated, I do nothing." << endl);
    154154    return;
    155155  }
     
    199199    status = status && ((n[i] >=0) && (n[i] < N[i]));
    200200  if (!status)
    201   eLog() << Verbose(1) << "indices are out of bounds!" << endl;
     201  DoeLog(1) && (eLog()<< Verbose(1) << "indices are out of bounds!" << endl);
    202202  return status;
    203203};
     
    260260    return status;
    261261  } else {
    262     eLog() << Verbose(1) << "Node at " << *Walker << " is out of bounds." << endl;
     262    DoeLog(1) && (eLog()<< Verbose(1) << "Node at " << *Walker << " is out of bounds." << endl);
    263263    return false;
    264264  }
  • src/log.cpp

    r8ab0407 rc7b1e7  
    2828}
    2929
     30/** Checks verbosity for logger.
     31 * Is supposed to be used in construct as this:
     32 * DoLog(2) && (Log() << Verbose(2) << "message." << endl);
     33 * If DoLog does not return true, the right-hand side is not evaluated and we save some time.
     34 * \param verbose verbosity level of this message
     35 * \return true - print, false - don't
     36 */
     37bool DoLog(int verbose) {
     38  return verbose <= logger::getInstance()->verbosity;
     39}
     40
     41/** Checks verbosity for errorlogger.
     42 * Is supposed to be used in construct as this:
     43 * DoLog(2) && (Log() << Verbose(2) << "message." << endl);
     44 * If DoLog does not return true, the right-hand side is not evaluated and we save some time.
     45 * \param verbose verbosity level of this message
     46 * \return true - print, false - don't
     47 */
     48bool DoeLog(int verbose) {
     49  return verbose <= errorLogger::getInstance()->verbosity;
     50}
     51
    3052/**
    3153 * Prints an error log entry.
  • src/log.hpp

    r8ab0407 rc7b1e7  
    1515class errorLogger * eLog();
    1616void setVerbosity(int verbosityLevel);
     17bool DoLog(int verbose);
     18bool DoeLog(int verbose);
    1719
    1820#endif /* LOG_HPP_ */
  • src/molecule.cpp

    r8ab0407 rc7b1e7  
    2323#include "tesselation.hpp"
    2424#include "vector.hpp"
     25#include "World.hpp"
    2526
    2627/************************************* Functions for class molecule *********************************/
     
    4546  for(int i=MAX_ELEMENTS;i--;)
    4647    ElementsInMolecule[i] = 0;
    47   cell_size[0] = cell_size[2] = cell_size[5]= 20.;
    48   cell_size[1] = cell_size[3] = cell_size[4]= 0.;
    49   strcpy(name,"none");
     48  strcpy(name,World::get()->DefaultName);
    5049};
    5150
     
    159158  double *matrix = NULL;
    160159  bond *Binder = NULL;
     160  double * const cell_size = World::get()->cell_size;
    161161
    162162//  Log() << Verbose(3) << "Begin of AddHydrogenReplacementAtom." << endl;
     
    194194  BondRescale = TopOrigin->type->HBondDistance[TopBond->BondDegree-1];
    195195  if (BondRescale == -1) {
    196     eLog() << Verbose(1) << "There is no typical hydrogen bond distance in replacing bond (" << TopOrigin->Name << "<->" << TopReplacement->Name << ") of degree " << TopBond->BondDegree << "!" << endl;
     196    DoeLog(1) && (eLog()<< Verbose(1) << "There is no typical hydrogen bond distance in replacing bond (" << TopOrigin->Name << "<->" << TopReplacement->Name << ") of degree " << TopBond->BondDegree << "!" << endl);
    197197    return false;
    198198    BondRescale = bondlength;
     
    237237            SecondOtherAtom = (*Runner)->GetOtherAtom(TopOrigin);
    238238          } else {
    239             eLog() << Verbose(2) << "Detected more than four bonds for atom " << TopOrigin->Name;
     239            DoeLog(2) && (eLog()<< Verbose(2) << "Detected more than four bonds for atom " << TopOrigin->Name);
    240240          }
    241241        }
     
    274274      bondangle = TopOrigin->type->HBondAngle[1];
    275275      if (bondangle == -1) {
    276         eLog() << Verbose(1) << "There is no typical hydrogen bond angle in replacing bond (" << TopOrigin->Name << "<->" << TopReplacement->Name << ") of degree " << TopBond->BondDegree << "!" << endl;
     276        DoeLog(1) && (eLog()<< Verbose(1) << "There is no typical hydrogen bond angle in replacing bond (" << TopOrigin->Name << "<->" << TopReplacement->Name << ") of degree " << TopBond->BondDegree << "!" << endl);
    277277        return false;
    278278        bondangle = 0;
     
    396396      break;
    397397    default:
    398       eLog() << Verbose(1) << "BondDegree does not state single, double or triple bond!" << endl;
     398      DoeLog(1) && (eLog()<< Verbose(1) << "BondDegree does not state single, double or triple bond!" << endl);
    399399      AllWentWell = false;
    400400      break;
     
    447447    Walker->type = elemente->FindElement(shorthand);
    448448    if (Walker->type == NULL) {
    449       eLog() << Verbose(1) << "Could not parse the element at line: '" << line << "', setting to H.";
     449      DoeLog(1) && (eLog()<< Verbose(1) << "Could not parse the element at line: '" << line << "', setting to H.");
    450450      Walker->type = elemente->FindElement(1);
    451451    }
     
    543543    add(Binder, last);
    544544  } else {
    545     eLog() << Verbose(1) << "Could not add bond between " << atom1->Name << " and " << atom2->Name << " as one or both are not present in the molecule." << endl;
     545    DoeLog(1) && (eLog()<< Verbose(1) << "Could not add bond between " << atom1->Name << " and " << atom2->Name << " as one or both are not present in the molecule." << endl);
    546546  }
    547547  return Binder;
     
    555555bool molecule::RemoveBond(bond *pointer)
    556556{
    557   //eLog() << Verbose(1) << "molecule::RemoveBond: Function not implemented yet." << endl;
     557  //DoeLog(1) && (eLog()<< Verbose(1) << "molecule::RemoveBond: Function not implemented yet." << endl);
    558558  pointer->leftatom->RegisterBond(pointer);
    559559  pointer->rightatom->RegisterBond(pointer);
     
    569569bool molecule::RemoveBonds(atom *BondPartner)
    570570{
    571   //eLog() << Verbose(1) << "molecule::RemoveBond: Function not implemented yet." << endl;
     571  //DoeLog(1) && (eLog()<< Verbose(1) << "molecule::RemoveBond: Function not implemented yet." << endl);
    572572  BondList::const_iterator ForeRunner;
    573573  while (!BondPartner->ListOfBonds.empty()) {
     
    603603void molecule::SetBoxDimension(Vector *dim)
    604604{
     605  double * const cell_size = World::get()->cell_size;
    605606  cell_size[0] = dim->x[0];
    606607  cell_size[1] = 0.;
     
    621622    AtomCount--;
    622623  } else
    623     eLog() << Verbose(1) << "Atom " << pointer->Name << " is of element " << pointer->type->Z << " but the entry in the table of the molecule is 0!" << endl;
     624    DoeLog(1) && (eLog()<< Verbose(1) << "Atom " << pointer->Name << " is of element " << pointer->type->Z << " but the entry in the table of the molecule is 0!" << endl);
    624625  if (ElementsInMolecule[pointer->type->Z] == 0)  // was last atom of this element?
    625626    ElementCount--;
     
    639640    ElementsInMolecule[pointer->type->Z]--; // decrease number of atom of this element
    640641  else
    641     eLog() << Verbose(1) << "Atom " << pointer->Name << " is of element " << pointer->type->Z << " but the entry in the table of the molecule is 0!" << endl;
     642    DoeLog(1) && (eLog()<< Verbose(1) << "Atom " << pointer->Name << " is of element " << pointer->type->Z << " but the entry in the table of the molecule is 0!" << endl);
    642643  if (ElementsInMolecule[pointer->type->Z] == 0)  // was last atom of this element?
    643644    ElementCount--;
     
    693694bool molecule::CheckBounds(const Vector *x) const
    694695{
     696  double * const cell_size = World::get()->cell_size;
    695697  bool result = true;
    696698  int j =-1;
  • src/molecule.hpp

    r8ab0407 rc7b1e7  
    8282class molecule : public PointCloud {
    8383  public:
    84     double cell_size[6];//!< cell size
    8584    const periodentafel * const elemente; //!< periodic table with each element
    8685    atom *start;        //!< start of atom list
  • src/molecule_dynamics.cpp

    r8ab0407 rc7b1e7  
    306306  for (int i=mol->AtomCount; i--;) // now each single entry in the DoubleList should be <=1
    307307    if (Params.DoubleList[i] > 1) {
    308       eLog() << Verbose(0) << "Failed to create an injective PermutationMap!" << endl;
     308      DoeLog(0) && (eLog()<< Verbose(0) << "Failed to create an injective PermutationMap!" << endl);
    309309      performCriticalExit();
    310310    }
     
    428428            }
    429429            if (Potential > Params.PenaltyConstants[2]) {
    430               eLog() << Verbose(1) << "The two-step permutation procedure did not maintain injectivity!" << endl;
     430              DoeLog(1) && (eLog()<< Verbose(1) << "The two-step permutation procedure did not maintain injectivity!" << endl);
    431431              exit(255);
    432432            }
    433433            //Log() << Verbose(0) << endl;
    434434          } else {
    435             eLog() << Verbose(1) << *Runner << " was not the owner of " << *Sprinter << "!" << endl;
     435            DoeLog(1) && (eLog()<< Verbose(1) << *Runner << " was not the owner of " << *Sprinter << "!" << endl);
    436436            exit(255);
    437437          }
     
    568568    // parse file into ForceMatrix
    569569    if (!Force.ParseMatrix(file, 0,0,0)) {
    570       eLog() << Verbose(0) << "Could not parse Force Matrix file " << file << "." << endl;
     570      DoeLog(0) && (eLog()<< Verbose(0) << "Could not parse Force Matrix file " << file << "." << endl);
    571571      performCriticalExit();
    572572      return false;
    573573    }
    574574    if (Force.RowCounter[0] != AtomCount) {
    575       eLog() << Verbose(0) << "Mismatch between number of atoms in file " << Force.RowCounter[0] << " and in molecule " << AtomCount << "." << endl;
     575      DoeLog(0) && (eLog()<< Verbose(0) << "Mismatch between number of atoms in file " << Force.RowCounter[0] << " and in molecule " << AtomCount << "." << endl);
    576576      performCriticalExit();
    577577      return false;
  • src/molecule_fragmentation.cpp

    r8ab0407 rc7b1e7  
    1818#include "molecule.hpp"
    1919#include "periodentafel.hpp"
     20#include "World.hpp"
    2021
    2122/************************************* Functions for class molecule *********************************/
     
    112113        testGraphInsert = FragmentList->insert(GraphPair (CurrentSet,pair<int,double>(NumberOfFragments++,1)));  // store fragment number and current factor
    113114        if (!testGraphInsert.second) {
    114           eLog() << Verbose(0) << "KeySet file must be corrupt as there are two equal key sets therein!" << endl;
     115          DoeLog(0) && (eLog()<< Verbose(0) << "KeySet file must be corrupt as there are two equal key sets therein!" << endl);
    115116          performCriticalExit();
    116117        }
     
    213214    Log() << Verbose(0) << "done." << endl;
    214215  } else {
    215     eLog() << Verbose(0) << "Unable to open " << line << " for writing keysets!" << endl;
     216    DoeLog(0) && (eLog()<< Verbose(0) << "Unable to open " << line << " for writing keysets!" << endl);
    216217    performCriticalExit();
    217218    status = false;
     
    371372      }
    372373    } else {
    373       eLog() << Verbose(0) << "Atom No. " << (*runner).second.first << " was not found in this molecule." << endl;
     374      DoeLog(0) && (eLog()<< Verbose(0) << "Atom No. " << (*runner).second.first << " was not found in this molecule." << endl);
    374375      performCriticalExit();
    375376    }
     
    446447    // transmorph graph keyset list into indexed KeySetList
    447448    if (GlobalKeySetList == NULL) {
    448       eLog() << Verbose(1) << "Given global key set list (graph) is NULL!" << endl;
     449      DoeLog(1) && (eLog()<< Verbose(1) << "Given global key set list (graph) is NULL!" << endl);
    449450      return false;
    450451    }
     
    454455    map<int, pair<double,int> > *AdaptiveCriteriaList = ScanAdaptiveFileIntoMap(path, *IndexKeySetList); // (Root No., (Value, Order)) !
    455456    if (AdaptiveCriteriaList->empty()) {
    456       eLog() << Verbose(2) << "Unable to parse file, incrementing all." << endl;
     457      DoeLog(2) && (eLog()<< Verbose(2) << "Unable to parse file, incrementing all." << endl);
    457458      while (Walker->next != end) {
    458459        Walker = Walker->next;
     
    643644        MolecularWalker->Leaf->FragmentBOSSANOVA(FragmentList[FragmentCounter], RootStack[FragmentCounter], MinimumRingSize);
    644645      } else {
    645         eLog() << Verbose(1) << "Subgraph " << MolecularWalker << " has no atoms!" << endl;
     646        DoeLog(1) && (eLog()<< Verbose(1) << "Subgraph " << MolecularWalker << " has no atoms!" << endl);
    646647      }
    647648      FragmentCounter++;  // next fragment list
     
    847848
    848849  Leaf->BondDistance = mol->BondDistance;
    849   for(int i=NDIM*2;i--;)
    850     Leaf->cell_size[i] = mol->cell_size[i];
    851850
    852851  // first create the minimal set of atoms from the KeySet
     
    907906      }
    908907    } else {
    909       eLog() << Verbose(1) << "Son " << Runner->Name << " has father " << FatherOfRunner->Name << " but its entry in SonList is " << SonList[FatherOfRunner->nr] << "!" << endl;
     908      DoeLog(1) && (eLog()<< Verbose(1) << "Son " << Runner->Name << " has father " << FatherOfRunner->Name << " but its entry in SonList is " << SonList[FatherOfRunner->nr] << "!" << endl);
    910909    }
    911910    if ((LonelyFlag) && (Leaf->AtomCount > 1)) {
     
    11421141        Log() << Verbose(0) << endl;
    11431142        //if (!CheckForConnectedSubgraph(FragmentSearch->FragmentSet))
    1144           //eLog() << Verbose(1) << "The found fragment is not a connected subgraph!" << endl;
     1143          //DoeLog(1) && (eLog()<< Verbose(1) << "The found fragment is not a connected subgraph!" << endl);
    11451144        InsertFragmentIntoGraph(FragmentSearch);
    11461145      }
     
    16581657  atom *Walker = NULL;
    16591658  atom *OtherWalker = NULL;
     1659  double * const cell_size = World::get()->cell_size;
    16601660  double *matrix = ReturnFullMatrixforSymmetric(cell_size);
    16611661  enum Shading *ColorList = NULL;
  • src/molecule_geometry.cpp

    r8ab0407 rc7b1e7  
    1515#include "memoryallocator.hpp"
    1616#include "molecule.hpp"
     17#include "World.hpp"
    1718
    1819/************************************* Functions for class molecule *********************************/
     
    2627  bool status = true;
    2728  const Vector *Center = DetermineCenterOfAll();
     29  double * const cell_size = World::get()->cell_size;
    2830  double *M = ReturnFullMatrixforSymmetric(cell_size);
    2931  double *Minv = InverseMatrix(M);
     
    4648{
    4749  bool status = true;
     50  double * const cell_size = World::get()->cell_size;
    4851  double *M = ReturnFullMatrixforSymmetric(cell_size);
    4952  double *Minv = InverseMatrix(M);
     
    226229void molecule::TranslatePeriodically(const Vector *trans)
    227230{
     231  double * const cell_size = World::get()->cell_size;
    228232  double *M = ReturnFullMatrixforSymmetric(cell_size);
    229233  double *Minv = InverseMatrix(M);
     
    252256{
    253257  atom *Walker = start;
     258  double * const cell_size = World::get()->cell_size;
    254259  double *matrix = ReturnFullMatrixforSymmetric(cell_size);
    255260  double *inversematrix = InverseMatrix(cell_size);
  • src/molecule_graph.cpp

    r8ab0407 rc7b1e7  
    1717#include "memoryallocator.hpp"
    1818#include "molecule.hpp"
     19#include "World.hpp"
    1920
    2021struct BFSAccounting
     
    106107  LinkedCell *LC = NULL;
    107108  bool free_BG = false;
     109  double * const cell_size = World::get()->cell_size;
    108110
    109111  if (BG == NULL) {
     
    493495  bond *Binder = NULL;
    494496
     497  if (AtomCount == 0)
     498    return SubGraphs;
    495499  Log() << Verbose(0) << "Begin of DepthFirstSearchAnalysis" << endl;
    496500  DepthFirstSearchAnalysis_Init(DFS, this);
     
    927931    }
    928932    if (i == vertex->ListOfBonds.size()) {
    929       eLog() << Verbose(0) << "Error: All Component entries are already occupied!" << endl;
     933      DoeLog(0) && (eLog()<< Verbose(0) << "Error: All Component entries are already occupied!" << endl);
    930934      performCriticalExit();
    931935    }
    932936  } else {
    933     eLog() << Verbose(0) << "Error: Given vertex is NULL!" << endl;
     937    DoeLog(0) && (eLog()<< Verbose(0) << "Error: Given vertex is NULL!" << endl);
    934938    performCriticalExit();
    935939  }
  • src/moleculelist.cpp

    r8ab0407 rc7b1e7  
    1919#include "memoryallocator.hpp"
    2020#include "periodentafel.hpp"
     21#include "World.hpp"
    2122
    2223/*********************************** Functions for class MoleculeListClass *************************/
     
    313314  Tesselation *TesselStruct = NULL;
    314315  if ((srcmol == NULL) || (mol == NULL)) {
    315     eLog() << Verbose(1) << "Either fixed or variable molecule is given as NULL." << endl;
     316    DoeLog(1) && (eLog()<< Verbose(1) << "Either fixed or variable molecule is given as NULL." << endl);
    316317    return false;
    317318  }
     
    321322  FindNonConvexBorder(mol, TesselStruct, (const LinkedCell *&)LCList, 4., NULL);
    322323  if (TesselStruct == NULL) {
    323     eLog() << Verbose(1) << "Could not tesselate the fixed molecule." << endl;
     324    DoeLog(1) && (eLog()<< Verbose(1) << "Could not tesselate the fixed molecule." << endl);
    324325    return false;
    325326  }
     
    442443    input.open(line.c_str());
    443444    if (input == NULL) {
    444       eLog() << Verbose(0) << endl << "Unable to open " << line << ", is the directory correct?" << endl;
     445      DoeLog(0) && (eLog()<< Verbose(0) << endl << "Unable to open " << line << ", is the directory correct?" << endl);
    445446      performCriticalExit();
    446447      return false;
     
    638639  int FragmentCounter = 0;
    639640  ofstream output;
    640 
     641  double cell_size_backup[6];
     642  double * const cell_size = World::get()->cell_size;
     643
     644  // backup cell_size
     645  for (int i=0;i<6;i++)
     646    cell_size_backup[i] = cell_size[i];
    641647  // store the fragments as config and as xyz
    642648  for (MoleculeList::iterator ListRunner = ListOfMolecules.begin(); ListRunner != ListOfMolecules.end(); ListRunner++) {
     
    646652      strcpy(PathBackup, path);
    647653    else {
    648       eLog() << Verbose(0) << "OutputConfigForListOfFragments: NULL default path obtained from config!" << endl;
     654      DoeLog(0) && (eLog()<< Verbose(0) << "OutputConfigForListOfFragments: NULL default path obtained from config!" << endl);
    649655      performCriticalExit();
    650656    }
     
    682688      j += k + 1;
    683689      BoxDimension.x[k] = 2.5 * (configuration->GetIsAngstroem() ? 1. : 1. / AtomicLengthToAngstroem);
    684       (*ListRunner)->cell_size[j] += BoxDimension.x[k] * 2.;
     690      cell_size[j] = BoxDimension.x[k] * 2.;
    685691    }
    686692    (*ListRunner)->Translate(&BoxDimension);
     
    724730  // printing final number
    725731  Log() << Verbose(2) << "Final number of fragments: " << FragmentCounter << "." << endl;
     732
     733  // restore cell_size
     734  for (int i=0;i<6;i++)
     735    cell_size[i] = cell_size_backup[i];
    726736
    727737  return result;
     
    776786
    777787  // 1. dissect the molecule into connected subgraphs
    778   configuration->BG->ConstructBondGraph(mol);
     788  if (!configuration->BG->ConstructBondGraph(mol)) {
     789    delete (mol);
     790    DoeLog(1) && (eLog()<< Verbose(1) << "There are no bonds." << endl);
     791    return;
     792  }
    779793
    780794  // 2. scan for connected subgraphs
     
    783797  Subgraphs = mol->DepthFirstSearchAnalysis(BackEdgeStack);
    784798  delete(BackEdgeStack);
     799  if ((Subgraphs == NULL) || (Subgraphs->next == NULL)) {
     800    delete (mol);
     801    DoeLog(1) && (eLog()<< Verbose(1) << "There are no atoms." << endl);
     802    return;
     803  }
    785804
    786805  // 3. dissect (the following construct is needed to have the atoms not in the order of the DFS, but in
     
    824843    Walker = mol->start->next;
    825844    if ((Walker->nr <0) || (Walker->nr >= mol->AtomCount)) {
    826       eLog() << Verbose(0) << "Index of atom " << *Walker << " is invalid!" << endl;
     845      DoeLog(0) && (eLog()<< Verbose(0) << "Index of atom " << *Walker << " is invalid!" << endl);
    827846      performCriticalExit();
    828847    }
     
    833852      molecules[FragmentCounter-1]->AddAtom(Walker);    // counting starts at 1
    834853    } else {
    835       eLog() << Verbose(0) << "Atom " << *Walker << " not associated to molecule!" << endl;
     854      DoeLog(0) && (eLog()<< Verbose(0) << "Atom " << *Walker << " not associated to molecule!" << endl);
    836855      performCriticalExit();
    837856    }
  • src/parser.cpp

    r8ab0407 rc7b1e7  
    160160  //Log() << Verbose(1) << "Opening " << name << " ... "  << input << endl;
    161161  if (input == NULL) {
    162     eLog() << Verbose(1) << endl << "Unable to open " << name << ", is the directory correct?" << endl;
     162    DoeLog(1) && (eLog()<< Verbose(1) << endl << "Unable to open " << name << ", is the directory correct?" << endl);
    163163    //performCriticalExit();
    164164    return false;
     
    183183  //Log() << Verbose(1) << "ColumnCounter[" << MatrixNr << "]: " << ColumnCounter[MatrixNr] << "." << endl;
    184184  if (ColumnCounter[MatrixNr] == 0) {
    185     eLog() << Verbose(0) << "ColumnCounter[" << MatrixNr << "]: " << ColumnCounter[MatrixNr] << " from file " << name << ", this is probably an error!" << endl;
     185    DoeLog(0) && (eLog()<< Verbose(0) << "ColumnCounter[" << MatrixNr << "]: " << ColumnCounter[MatrixNr] << " from file " << name << ", this is probably an error!" << endl);
    186186    performCriticalExit();
    187187  }
     
    199199  //Log() << Verbose(1) << "RowCounter[" << MatrixNr << "]: " << RowCounter[MatrixNr] << " from file " << name << "." << endl;
    200200  if (RowCounter[MatrixNr] == 0) {
    201     eLog() << Verbose(0) << "RowCounter[" << MatrixNr << "]: " << RowCounter[MatrixNr] << " from file " << name << ", this is probably an error!" << endl;
     201    DoeLog(0) && (eLog()<< Verbose(0) << "RowCounter[" << MatrixNr << "]: " << RowCounter[MatrixNr] << " from file " << name << ", this is probably an error!" << endl);
    202202    performCriticalExit();
    203203  }
     
    232232    }
    233233  } else {
    234     eLog() << Verbose(1) << "Matrix nr. " << MatrixNr << " has column and row count of (" << ColumnCounter[MatrixNr] << "," << RowCounter[MatrixNr] << "), could not allocate nor parse!" << endl;
     234    DoeLog(1) && (eLog()<< Verbose(1) << "Matrix nr. " << MatrixNr << " has column and row count of (" << ColumnCounter[MatrixNr] << "," << RowCounter[MatrixNr] << "), could not allocate nor parse!" << endl);
    235235  }
    236236  input.close();
     
    433433              //Log() << Verbose(0) << "Corresponding index in CurrentFragment is " << m << "." << endl;
    434434              if (m > RowCounter[ KeySets.OrderSet[Order][CurrentFragment] ]) {
    435                 eLog() << Verbose(0) << "In fragment No. " << KeySets.OrderSet[Order][CurrentFragment]   << " current force index " << m << " is greater than " << RowCounter[ KeySets.OrderSet[Order][CurrentFragment] ] << "!" << endl;
     435                DoeLog(0) && (eLog()<< Verbose(0) << "In fragment No. " << KeySets.OrderSet[Order][CurrentFragment]   << " current force index " << m << " is greater than " << RowCounter[ KeySets.OrderSet[Order][CurrentFragment] ] << "!" << endl);
    436436                performCriticalExit();
    437437                return false;
     
    477477    output.open(line.str().c_str(), ios::out);
    478478    if (output == NULL) {
    479       eLog() << Verbose(0) << "Unable to open output energy file " << line.str() << "!" << endl;
     479      DoeLog(0) && (eLog()<< Verbose(0) << "Unable to open output energy file " << line.str() << "!" << endl);
    480480      performCriticalExit();
    481481      return false;
     
    507507  output.open(line.str().c_str(), ios::out);
    508508  if (output == NULL) {
    509     eLog() << Verbose(0) << "Unable to open output matrix file " << line.str() << "!" << endl;
     509    DoeLog(0) && (eLog()<< Verbose(0) << "Unable to open output matrix file " << line.str() << "!" << endl);
    510510    performCriticalExit();
    511511    return false;
     
    664664      int j = Indices[ FragmentNr ][l];
    665665      if (j > RowCounter[MatrixCounter]) {
    666         eLog() << Verbose(0) << "Current force index " << j << " is greater than " << RowCounter[MatrixCounter] << "!" << endl;
     666        DoeLog(0) && (eLog()<< Verbose(0) << "Current force index " << j << " is greater than " << RowCounter[MatrixCounter] << "!" << endl);
    667667        performCriticalExit();
    668668        return false;
     
    802802      int j = Indices[ FragmentNr ][l];
    803803      if (j > RowCounter[MatrixCounter]) {
    804         eLog() << Verbose(0) << "Current hessian index " << j << " is greater than " << RowCounter[MatrixCounter] << ", where i=" << i << ", Order=" << Order << ", l=" << l << " and FragmentNr=" << FragmentNr << "!" << endl;
     804        DoeLog(0) && (eLog()<< Verbose(0) << "Current hessian index " << j << " is greater than " << RowCounter[MatrixCounter] << ", where i=" << i << ", Order=" << Order << ", l=" << l << " and FragmentNr=" << FragmentNr << "!" << endl);
    805805        performCriticalExit();
    806806        return false;
     
    810810          int k = Indices[ FragmentNr ][m];
    811811          if (k > ColumnCounter[MatrixCounter]) {
    812             eLog() << Verbose(0) << "Current hessian index " << k << " is greater than " << ColumnCounter[MatrixCounter] << ", where m=" << m << ", j=" << j << ", i=" << i << ", Order=" << Order << ", l=" << l << " and FragmentNr=" << FragmentNr << "!" << endl;
     812            DoeLog(0) && (eLog()<< Verbose(0) << "Current hessian index " << k << " is greater than " << ColumnCounter[MatrixCounter] << ", where m=" << m << ", j=" << j << ", i=" << i << ", Order=" << Order << ", l=" << l << " and FragmentNr=" << FragmentNr << "!" << endl);
    813813            performCriticalExit();
    814814            return false;
     
    863863              //Log() << Verbose(0) << "Corresponding row index for " << k << " in CurrentFragment is " << m << "." << endl;
    864864              if (m > RowCounter[ KeySets.OrderSet[Order][CurrentFragment] ]) {
    865                 eLog() << Verbose(0) << "In fragment No. " << KeySets.OrderSet[Order][CurrentFragment]   << " current row index " << m << " is greater than " << RowCounter[ KeySets.OrderSet[Order][CurrentFragment] ] << "!" << endl;
     865                DoeLog(0) && (eLog()<< Verbose(0) << "In fragment No. " << KeySets.OrderSet[Order][CurrentFragment]   << " current row index " << m << " is greater than " << RowCounter[ KeySets.OrderSet[Order][CurrentFragment] ] << "!" << endl);
    866866                performCriticalExit();
    867867                return false;
     
    881881                  //Log() << Verbose(0) << "Corresponding column index for " << l << " in CurrentFragment is " << n << "." << endl;
    882882                  if (n > ColumnCounter[ KeySets.OrderSet[Order][CurrentFragment] ]) {
    883                     eLog() << Verbose(0) << "In fragment No. " << KeySets.OrderSet[Order][CurrentFragment]   << " current column index " << n << " is greater than " << ColumnCounter[ KeySets.OrderSet[Order][CurrentFragment] ] << "!" << endl;
     883                    DoeLog(0) && (eLog()<< Verbose(0) << "In fragment No. " << KeySets.OrderSet[Order][CurrentFragment]   << " current column index " << n << " is greater than " << ColumnCounter[ KeySets.OrderSet[Order][CurrentFragment] ] << "!" << endl);
    884884                    performCriticalExit();
    885885                    return false;
  • src/periodentafel.cpp

    r8ab0407 rc7b1e7  
    314314
    315315  if (!otherstatus)
    316     eLog() << Verbose(2) << "Something went wrong while parsing the other databases!" << endl;
     316    DoeLog(2) && (eLog()<< Verbose(2) << "Something went wrong while parsing the other databases!" << endl);
    317317
    318318  return status;
  • src/stackclass.hpp

    r8ab0407 rc7b1e7  
    7272    return true;
    7373  } else {
    74     eLog() << Verbose(1) << "Stack is full, " << "Stack: CurrentLastEntry " << CurrentLastEntry<< "\tCurrentFirstEntry " << CurrentFirstEntry << "\tNextFreeField " << NextFreeField << "\tEntryCount " << EntryCount << "!" << endl;
     74    DoeLog(1) && (eLog()<< Verbose(1) << "Stack is full, " << "Stack: CurrentLastEntry " << CurrentLastEntry<< "\tCurrentFirstEntry " << CurrentFirstEntry << "\tNextFreeField " << NextFreeField << "\tEntryCount " << EntryCount << "!" << endl);
    7575    return false;
    7676  }
     
    8787    Walker = StackList[CurrentFirstEntry];
    8888    if (Walker == NULL)
    89       eLog() << Verbose(1) << "Stack's field is empty!" << endl;
     89      DoeLog(1) && (eLog()<< Verbose(1) << "Stack's field is empty!" << endl);
    9090    StackList[CurrentFirstEntry] = NULL;
    9191    if (CurrentFirstEntry != CurrentLastEntry) { // hasn't last item been popped as well?
     
    9696    }
    9797  } else
    98     eLog() << Verbose(1) << "Stack is empty!" << endl;
     98    DoeLog(1) && (eLog()<< Verbose(1) << "Stack is empty!" << endl);
    9999  return Walker;
    100100};
     
    111111    StackList[CurrentLastEntry] = NULL;
    112112    if (Walker == NULL)
    113       eLog() << Verbose(1) << "Stack's field is empty!" << endl;
     113      DoeLog(1) && (eLog()<< Verbose(1) << "Stack's field is empty!" << endl);
    114114    NextFreeField = CurrentLastEntry;
    115115    if (CurrentLastEntry != CurrentFirstEntry)  // has there been more than one item on stack
    116116      CurrentLastEntry = (CurrentLastEntry + (EntryCount-1)) % EntryCount; // step back from current free field to last (modulo does not work in -1, thus go EntryCount-1 instead)
    117117  } else {
    118     eLog() << Verbose(1) << "Stack is empty!" << endl;
     118    DoeLog(1) && (eLog()<< Verbose(1) << "Stack is empty!" << endl);
    119119  }
    120120  return Walker;
     
    151151    } while (i!=NextFreeField);
    152152  else
    153     eLog() << Verbose(1) << "Stack is already empty!" << endl;
     153    DoeLog(1) && (eLog()<< Verbose(1) << "Stack is already empty!" << endl);
    154154  if (found) {
    155155    NextFreeField = CurrentLastEntry;
  • src/tesselation.cpp

    r8ab0407 rc7b1e7  
    1414#include "tesselation.hpp"
    1515#include "tesselationhelpers.hpp"
     16#include "triangleintersectionlist.hpp"
    1617#include "vector.hpp"
    1718#include "verbose.hpp"
     
    5455  //Log() << Verbose(0) << "Erasing point nr. " << Nr << "." << endl;
    5556  if (!lines.empty())
    56     eLog() << Verbose(2) << "Memory Leak! I " << *this << " am still connected to some lines." << endl;
     57    DoeLog(2) && (eLog()<< Verbose(2) << "Memory Leak! I " << *this << " am still connected to some lines." << endl);
    5758  node = NULL;
    5859};
     
    187188  }
    188189  if (!triangles.empty())
    189     eLog() << Verbose(2) << "Memory Leak! I " << *this << " am still connected to some triangles." << endl;
     190    DoeLog(2) && (eLog()<< Verbose(2) << "Memory Leak! I " << *this << " am still connected to some triangles." << endl);
    190191};
    191192
     
    225226  // get the two triangles
    226227  if (triangles.size() != 2) {
    227     eLog() << Verbose(0) << "Baseline " << *this << " is connected to less than two triangles, Tesselation incomplete!" << endl;
     228    DoeLog(0) && (eLog()<< Verbose(0) << "Baseline " << *this << " is connected to less than two triangles, Tesselation incomplete!" << endl);
    228229    return true;
    229230  }
     
    251252      BaseLineNormal.CopyVector(&runner->second->NormalVector);   // yes, copy second on top of first
    252253    else {
    253       eLog() << Verbose(0) << "Triangle " << *runner->second << " has zero normal vector!" << endl;
     254      DoeLog(0) && (eLog()<< Verbose(0) << "Triangle " << *runner->second << " has zero normal vector!" << endl);
    254255    }
    255256    node = runner->second->GetThirdEndpoint(this);
     
    262263      i++;
    263264    } else {
    264       eLog() << Verbose(1) << "I cannot find third node in triangle, something's wrong." << endl;
     265      DoeLog(1) && (eLog()<< Verbose(1) << "I cannot find third node in triangle, something's wrong." << endl);
    265266      return true;
    266267    }
     
    367368  }
    368369  if (Counter < 3) {
    369     eLog() << Verbose(0) << "We have a triangle with only two distinct endpoints!" << endl;
     370    DoeLog(0) && (eLog()<< Verbose(0) << "We have a triangle with only two distinct endpoints!" << endl);
    370371    performCriticalExit();
    371372  }
     
    429430
    430431  if (!Intersection->GetIntersectionWithPlane(&NormalVector, endpoints[0]->node->node, MolCenter, x)) {
    431     eLog() << Verbose(1) << "Alas! Intersection with plane failed - at least numerically - the intersection is not on the plane!" << endl;
     432    DoeLog(1) && (eLog()<< Verbose(1) << "Alas! Intersection with plane failed - at least numerically - the intersection is not on the plane!" << endl);
    432433    return false;
    433434  }
     
    474475};
    475476
    476 /** Finds the point on the triangle \a *BTS through which the line defined by \a *MolCenter and \a *x crosses.
    477  * We call Vector::GetIntersectionWithPlane() to receive the intersection point with the plane
     477/** Finds the point on the triangle to the point \a *x.
     478 * We call Vector::GetIntersectionWithPlane() with \a * and the center of the triangle to receive an intersection point.
     479 * Then we check the in-plane part (the part projected down onto plane). We check whether it crosses one of the
     480 * boundary lines. If it does, we return this intersection as closest point, otherwise the projected point down.
    478481 * Thus we test if it's really on the plane and whether it's inside the triangle on the plane or not.
    479482 * The latter is done as follows: We calculate the cross point of one of the triangle's baseline with the line
     
    723726      Runner[i]++;
    724727      if (Runner[i] == endpoints.end()) {
    725         eLog() << Verbose(0) << "There are less than three endpoints in the polygon!" << endl;
     728        DoeLog(0) && (eLog()<< Verbose(0) << "There are less than three endpoints in the polygon!" << endl);
    726729        performCriticalExit();
    727730      }
     
    10691072      runner->second = NULL;
    10701073    } else
    1071       eLog() << Verbose(1) << "The triangle " << runner->first << " has already been free'd." << endl;
     1074      DoeLog(1) && (eLog()<< Verbose(1) << "The triangle " << runner->first << " has already been free'd." << endl);
    10721075  }
    10731076  Log() << Verbose(0) << "This envelope was written to file " << TriangleFilesWritten << " times(s)." << endl;
     
    13221325  else
    13231326    {
    1324       eLog() << Verbose(0) << "No starting triangle found." << endl;
     1327      DoeLog(0) && (eLog()<< Verbose(0) << "No starting triangle found." << endl);
    13251328    }
    13261329}
     
    15211524          TrianglesOnBoundaryCount++;
    15221525        } else {
    1523           eLog() << Verbose(2) << "I could not determine a winner for this baseline " << *(baseline->second) << "." << endl;
     1526          DoeLog(2) && (eLog()<< Verbose(2) << "I could not determine a winner for this baseline " << *(baseline->second) << "." << endl);
    15241527        }
    15251528
     
    16141617            if (NewLines[j]->IsConnectedTo(BLS[0])) {
    16151618              if (n>2) {
    1616                 eLog() << Verbose(2) << BLS[0] << " connects to all of the new lines?!" << endl;
     1619                DoeLog(2) && (eLog()<< Verbose(2) << BLS[0] << " connects to all of the new lines?!" << endl);
    16171620                return false;
    16181621              } else
     
    16311634      }
    16321635    } else { // something is wrong with FindClosestTriangleToPoint!
    1633       eLog() << Verbose(1) << "The closest triangle did not produce an intersection!" << endl;
     1636      DoeLog(1) && (eLog()<< Verbose(1) << "The closest triangle did not produce an intersection!" << endl);
    16341637      return false;
    16351638    }
     
    17341737          OpenLines.erase(CandidateLine);
    17351738        } else {
    1736           eLog() << Verbose(1) << "Line exists and is attached to less than two triangles, but not in OpenLines!" << endl;
     1739          DoeLog(1) && (eLog()<< Verbose(1) << "Line exists and is attached to less than two triangles, but not in OpenLines!" << endl);
    17371740        }
    17381741
     
    18401843      triangle->lines[i] = NULL;  // free'd or not: disconnect
    18411844    } else
    1842       eLog() << Verbose(1) << "This line " << i << " has already been free'd." << endl;
     1845      DoeLog(1) && (eLog()<< Verbose(1) << "This line " << i << " has already been free'd." << endl);
    18431846  }
    18441847
     
    18941897      line->endpoints[i] = NULL;  // free'd or not: disconnect
    18951898    } else
    1896       eLog() << Verbose(1) << "Endpoint " << i << " has already been free'd." << endl;
     1899      DoeLog(1) && (eLog()<< Verbose(1) << "Endpoint " << i << " has already been free'd." << endl);
    18971900  }
    18981901  if (!line->triangles.empty())
    1899     eLog() << Verbose(2) << "Memory Leak! I " << *line << " am still connected to some triangles." << endl;
     1902    DoeLog(2) && (eLog()<< Verbose(2) << "Memory Leak! I " << *line << " am still connected to some triangles." << endl);
    19001903
    19011904  if (LinesOnBoundary.erase(line->Nr))
     
    20702073          }
    20712074        } else {
    2072           eLog() << Verbose(1) << "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << " is invalid!" << endl;
     2075          DoeLog(1) && (eLog()<< Verbose(1) << "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << " is invalid!" << endl);
    20732076        }
    20742077      }
     
    22142217//            if (fabs(OldSphereCenter.ScalarProduct(&SearchDirection)) > HULLEPSILON) {
    22152218//              // rotated the wrong way!
    2216 //              eLog() << Verbose(1) << "SearchDirection and RelativeOldSphereCenter are still not orthogonal!" << endl;
     2219//              DoeLog(1) && (eLog()<< Verbose(1) << "SearchDirection and RelativeOldSphereCenter are still not orthogonal!" << endl);
    22172220//            }
    22182221//
     
    22712274//          }
    22722275//        } else {
    2273 //          eLog() << Verbose(2) << "Baseline is connected to two triangles already?" << endl;
     2276//          DoeLog(2) && (eLog()<< Verbose(2) << "Baseline is connected to two triangles already?" << endl);
    22742277//        }
    22752278//      } else {
     
    22782281//    }
    22792282//  } else {
    2280 //    eLog() << Verbose(1) << "Could not find the TesselPoint " << *ThirdNode << "." << endl;
     2283//    DoeLog(1) && (eLog()<< Verbose(1) << "Could not find the TesselPoint " << *ThirdNode << "." << endl);
    22812284//  }
    22822285//
     
    23442347    if (fabs(RelativeSphereCenter.ScalarProduct(&SearchDirection)) > HULLEPSILON) {
    23452348      // rotated the wrong way!
    2346       eLog() << Verbose(1) << "SearchDirection and RelativeOldSphereCenter are still not orthogonal!" << endl;
     2349      DoeLog(1) && (eLog()<< Verbose(1) << "SearchDirection and RelativeOldSphereCenter are still not orthogonal!" << endl);
    23472350    }
    23482351
     
    23552358
    23562359  if (CandidateLine.pointlist.empty()) {
    2357     eLog() << Verbose(2) << "Could not find a suitable candidate." << endl;
     2360    DoeLog(2) && (eLog()<< Verbose(2) << "Could not find a suitable candidate." << endl);
    23582361    return false;
    23592362  }
     
    23972400//          CandidateLine.ShortestAngle = ShortestAngle;
    23982401//        } else {
    2399 ////          eLog() << Verbose(1) << "This triangle consisting of ";
     2402////          DoeLog(1) && (eLog()<< Verbose(1) << "This triangle consisting of ");
    24002403////          Log() << Verbose(0) << *(*it)->point << ", ";
    24012404////          Log() << Verbose(0) << *BaseRay->endpoints[0]->node << " and ";
     
    24182421//
    24192422//          } else {
    2420 ////            eLog() << Verbose(1) << "This triangle consisting of " << *(*it)->point << ", " << *BaseRay->endpoints[0]->node << " and " << *BaseRay->endpoints[1]->node << " " << "exists and is not added, as it does not seem helpful!" << endl;
     2423////            DoeLog(1) && (eLog()<< Verbose(1) << "This triangle consisting of " << *(*it)->point << ", " << *BaseRay->endpoints[0]->node << " and " << *BaseRay->endpoints[1]->node << " " << "exists and is not added, as it does not seem helpful!" << endl);
    24212424//            result = false;
    24222425//          }
     
    24342437//    BaseRay = BLS[0];
    24352438//    if ((BTS != NULL) && (BTS->NormalVector.NormSquared() < MYEPSILON)) {
    2436 //      eLog() << Verbose(1) << "Triangle " << *BTS << " has zero normal vector!" << endl;
     2439//      DoeLog(1) && (eLog()<< Verbose(1) << "Triangle " << *BTS << " has zero normal vector!" << endl);
    24372440//      exit(255);
    24382441//    }
     
    26322635    BaseLineNormal.Zero();
    26332636    if (Base->triangles.size() < 2) {
    2634       eLog() << Verbose(1) << "Less than two triangles are attached to this baseline!" << endl;
     2637      DoeLog(1) && (eLog()<< Verbose(1) << "Less than two triangles are attached to this baseline!" << endl);
    26352638      return 0.;
    26362639    }
     
    26712674  BaseLineNormal.Zero();
    26722675  if (Base->triangles.size() < 2) {
    2673     eLog() << Verbose(1) << "Less than two triangles are attached to this baseline!" << endl;
     2676    DoeLog(1) && (eLog()<< Verbose(1) << "Less than two triangles are attached to this baseline!" << endl);
    26742677    return NULL;
    26752678  }
     
    27072710  // check whether everything is in place to create new lines and triangles
    27082711  if (i<4) {
    2709     eLog() << Verbose(1) << "We have not gathered enough baselines!" << endl;
     2712    DoeLog(1) && (eLog()<< Verbose(1) << "We have not gathered enough baselines!" << endl);
    27102713    return NULL;
    27112714  }
    27122715  for (int j=0;j<4;j++)
    27132716    if (OldLines[j] == NULL) {
    2714       eLog() << Verbose(1) << "We have not gathered enough baselines!" << endl;
     2717      DoeLog(1) && (eLog()<< Verbose(1) << "We have not gathered enough baselines!" << endl);
    27152718      return NULL;
    27162719    }
    27172720  for (int j=0;j<2;j++)
    27182721    if (OldPoints[j] == NULL) {
    2719       eLog() << Verbose(1) << "We have not gathered enough endpoints!" << endl;
     2722      DoeLog(1) && (eLog()<< Verbose(1) << "We have not gathered enough endpoints!" << endl);
    27202723      return NULL;
    27212724    }
     
    27612764    Log() << Verbose(0) << "INFO: Created new triangle " << *BTS << "." << endl;
    27622765  } else {
    2763     eLog() << Verbose(0) << "The four old lines do not connect, something's utterly wrong here!" << endl;
     2766    DoeLog(0) && (eLog()<< Verbose(0) << "The four old lines do not connect, something's utterly wrong here!" << endl);
    27642767    return NULL;
    27652768  }
     
    27922795      N[i] = LC->n[i];
    27932796  } else {
    2794     eLog() << Verbose(1) << "Point " << *a << " is not found in cell " << LC->index << "." << endl;
     2797    DoeLog(1) && (eLog()<< Verbose(1) << "Point " << *a << " is not found in cell " << LC->index << "." << endl);
    27952798    return;
    27962799  }
     
    29322935    // test whether old center is on the band's plane
    29332936    if (fabs(RelativeOldSphereCenter.ScalarProduct(&CirclePlaneNormal)) > HULLEPSILON) {
    2934       eLog() << Verbose(1) << "Something's very wrong here: RelativeOldSphereCenter is not on the band's plane as desired by " << fabs(RelativeOldSphereCenter.ScalarProduct(&CirclePlaneNormal)) << "!" << endl;
     2937      DoeLog(1) && (eLog()<< Verbose(1) << "Something's very wrong here: RelativeOldSphereCenter is not on the band's plane as desired by " << fabs(RelativeOldSphereCenter.ScalarProduct(&CirclePlaneNormal)) << "!" << endl);
    29352938      RelativeOldSphereCenter.ProjectOntoPlane(&CirclePlaneNormal);
    29362939    }
     
    29422945      Log() << Verbose(1) << "INFO: SearchDirection is " << SearchDirection << "." << endl;
    29432946      if (fabs(RelativeOldSphereCenter.ScalarProduct(&SearchDirection)) > HULLEPSILON) {  // rotated the wrong way!
    2944         eLog() << Verbose(1) << "SearchDirection and RelativeOldSphereCenter are not orthogonal!" << endl;
     2947        DoeLog(1) && (eLog()<< Verbose(1) << "SearchDirection and RelativeOldSphereCenter are not orthogonal!" << endl);
    29452948      }
    29462949
     
    29512954        //Log() << Verbose(1) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl;
    29522955      } else {
    2953         eLog() << Verbose(1) << "Vector " << CircleCenter << " is outside of LinkedCell's bounding box." << endl;
     2956        DoeLog(1) && (eLog()<< Verbose(1) << "Vector " << CircleCenter << " is outside of LinkedCell's bounding box." << endl);
    29542957        return;
    29552958      }
     
    29902993                      otherradius = CandidateLine.BaseLine->endpoints[1]->node->node->DistanceSquared(&NewPlaneCenter);
    29912994                      if (fabs(radius - otherradius) > HULLEPSILON) {
    2992                         eLog() << Verbose(1) << "Distance to center of circumcircle is not the same from each corner of the triangle: " << fabs(radius-otherradius) << endl;
     2995                        DoeLog(1) && (eLog()<< Verbose(1) << "Distance to center of circumcircle is not the same from each corner of the triangle: " << fabs(radius-otherradius) << endl);
    29932996                      }
    29942997                      // construct both new centers
     
    30573060          }
    30583061    } else {
    3059       eLog() << Verbose(1) << "The projected center of the old sphere has radius " << radius << " instead of " << CircleRadius << "." << endl;
     3062      DoeLog(1) && (eLog()<< Verbose(1) << "The projected center of the old sphere has radius " << radius << " instead of " << CircleRadius << "." << endl);
    30603063    }
    30613064  } else {
     
    31163119
    31173120  if (LinesOnBoundary.empty()) {
    3118     eLog() << Verbose(1) << "There is no tesselation structure to compare the point with, please create one first." << endl;
     3121    DoeLog(1) && (eLog()<< Verbose(1) << "There is no tesselation structure to compare the point with, please create one first." << endl);
    31193122    return NULL;
    31203123  }
     
    31433146          }
    31443147        } else {
    3145           eLog() << Verbose(1) << "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << " is invalid!" << endl;
     3148          DoeLog(1) && (eLog()<< Verbose(1) << "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << " is invalid!" << endl);
    31463149        }
    31473150      }
     
    31493152  // check whether we found some points
    31503153  if (points->empty()) {
    3151     eLog() << Verbose(1) << "There is no nearest point: too far away from the surface." << endl;
     3154    DoeLog(1) && (eLog()<< Verbose(1) << "There is no nearest point: too far away from the surface." << endl);
    31523155    delete(points);
    31533156    return NULL;
     
    31683171  DistanceToPointMap * points = FindClosestBoundaryPointsToVector(x,LC);
    31693172  if (points == NULL) {
    3170     eLog() << Verbose(1) << "There is no nearest point: too far away from the surface." << endl;
     3173    DoeLog(1) && (eLog()<< Verbose(1) << "There is no nearest point: too far away from the surface." << endl);
    31713174    return NULL;
    31723175  }
     
    32223225};
    32233226
    3224 
    32253227/** Finds the triangle that is closest to a given Vector \a *x.
    32263228 * \param *out output stream for debugging
     
    32353237        DistanceToPointMap * points = FindClosestBoundaryPointsToVector(x,LC);
    32363238  if (points == NULL) {
    3237     eLog() << Verbose(1) << "There is no nearest point: too far away from the surface." << endl;
     3239    DoeLog(1) && (eLog()<< Verbose(1) << "There is no nearest point: too far away from the surface." << endl);
    32383240    return NULL;
    32393241  }
     
    32843286        const double distance = BaseLineIntersection.NormSquared();
    32853287        if (Center.NormSquared() > BaseLine.NormSquared()) {
    3286           eLog() << Verbose(0) << "Algorithmic error: In second case we have intersection outside of baseline!" << endl;
     3288          DoeLog(0) && (eLog()<< Verbose(0) << "Algorithmic error: In second case we have intersection outside of baseline!" << endl);
    32873289        }
    32883290        if ((ClosestLines.empty()) || (distance < MinDistance)) {
     
    33153317 * \param *out output stream for debugging
    33163318 * \param *x Vector to look from
     3319 * \param &distance contains found distance on return
    33173320 * \return list of BoundaryTriangleSet of nearest triangles or NULL.
    33183321 */
     
    33583361bool Tesselation::IsInnerPoint(const Vector &Point, const LinkedCell* const LC) const
    33593362{
    3360   return (GetDistanceSquaredToSurface(Point, LC) < MYEPSILON);
    3361 }
     3363  Info FunctionInfo(__func__);
     3364  TriangleIntersectionList Intersections(&Point,this,LC);
     3365
     3366  return Intersections.IsInside();
     3367};
    33623368
    33633369/** Returns the distance to the surface given by the tesselation.
     
    34323438};
    34333439
    3434 /** Calculates distance to a tesselated surface.
     3440/** Calculates minimum distance from \a&Point to a tesselated surface.
    34353441 * Combines \sa FindClosestTrianglesToVector() and \sa GetDistanceSquaredToTriangle().
    34363442 * \param &Point point to calculate distance from
     
    34383444 * \return distance squared to closest point on surface
    34393445 */
    3440 double Tesselation::GetDistanceSquaredToSurface(const Vector &Point, const LinkedCell* const LC) const
    3441 {
    3442   BoundaryTriangleSet *triangle = FindClosestTriangleToVector(&Point, LC);
    3443   const double distance = GetDistanceSquaredToTriangle(Point, triangle);
    3444   return Min(distance, LC->RADIUS);
     3446double Tesselation::GetDistanceToSurface(const Vector &Point, const LinkedCell* const LC) const
     3447{
     3448  Info FunctionInfo(__func__);
     3449  TriangleIntersectionList Intersections(&Point,this,LC);
     3450
     3451  return Intersections.GetSmallestDistance();
     3452};
     3453
     3454/** Calculates minimum distance from \a&Point to a tesselated surface.
     3455 * Combines \sa FindClosestTrianglesToVector() and \sa GetDistanceSquaredToTriangle().
     3456 * \param &Point point to calculate distance from
     3457 * \param *LC needed for finding closest points fast
     3458 * \return distance squared to closest point on surface
     3459 */
     3460BoundaryTriangleSet * Tesselation::GetClosestTriangleOnSurface(const Vector &Point, const LinkedCell* const LC) const
     3461{
     3462  Info FunctionInfo(__func__);
     3463  TriangleIntersectionList Intersections(&Point,this,LC);
     3464
     3465  return Intersections.GetClosestTriangle();
    34453466};
    34463467
     
    34643485    ReferencePoint = PointRunner->second;
    34653486  } else {
    3466     eLog() << Verbose(2) << "GetAllConnectedPoints() could not find the BoundaryPoint belonging to " << *Point << "." << endl;
     3487    DoeLog(2) && (eLog()<< Verbose(2) << "GetAllConnectedPoints() could not find the BoundaryPoint belonging to " << *Point << "." << endl);
    34673488    ReferencePoint = NULL;
    34683489  }
     
    34963517
    34973518  if (connectedPoints->empty()) { // if have not found any points
    3498     eLog() << Verbose(1) << "We have not found any connected points to " << *Point<< "." << endl;
     3519    DoeLog(1) && (eLog()<< Verbose(1) << "We have not found any connected points to " << *Point<< "." << endl);
    34993520    return NULL;
    35003521  }
     
    35293550
    35303551  if (SetOfNeighbours == NULL) {
    3531     eLog() << Verbose(2) << "Could not find any connected points!" << endl;
     3552    DoeLog(2) && (eLog()<< Verbose(2) << "Could not find any connected points!" << endl);
    35323553    delete(connectedCircle);
    35333554    return NULL;
     
    35403561      PlaneNormal.AddVector(&(*Runner)->NormalVector);
    35413562  } else {
    3542     eLog() << Verbose(0) << "Could not find any triangles for point " << *Point << "." << endl;
     3563    DoeLog(0) && (eLog()<< Verbose(0) << "Could not find any triangles for point " << *Point << "." << endl);
    35433564    performCriticalExit();
    35443565  }
     
    35593580    AngleZero.ProjectOntoPlane(&PlaneNormal);
    35603581    if (AngleZero.NormSquared() < MYEPSILON) {
    3561       eLog() << Verbose(0) << "CRITIAL: AngleZero is 0 even with alternative reference. The algorithm has to be changed here!" << endl;
     3582      DoeLog(0) && (eLog()<< Verbose(0) << "CRITIAL: AngleZero is 0 even with alternative reference. The algorithm has to be changed here!" << endl);
    35623583      performCriticalExit();
    35633584    }
     
    36103631
    36113632  if (SetOfNeighbours == NULL) {
    3612     eLog() << Verbose(2) << "Could not find any connected points!" << endl;
     3633    DoeLog(2) && (eLog()<< Verbose(2) << "Could not find any connected points!" << endl);
    36133634    delete(connectedCircle);
    36143635    return NULL;
     
    36643685    AngleZero.ProjectOntoPlane(&PlaneNormal);
    36653686    if (AngleZero.NormSquared() < MYEPSILON) {
    3666       eLog() << Verbose(0) << "CRITIAL: AngleZero is 0 even with alternative reference. The algorithm has to be changed here!" << endl;
     3687      DoeLog(0) && (eLog()<< Verbose(0) << "CRITIAL: AngleZero is 0 even with alternative reference. The algorithm has to be changed here!" << endl);
    36673688      performCriticalExit();
    36683689    }
     
    36873708    InserterTest = anglesOfPoints.insert(pair<double, TesselPoint*>(angle, (*listRunner)));
    36883709    if (!InserterTest.second) {
    3689       eLog() << Verbose(0) << "GetCircleOfSetOfPoints() got two atoms with same angle: " << *((InserterTest.first)->second) << " and " << (*listRunner) << endl;
     3710      DoeLog(0) && (eLog()<< Verbose(0) << "GetCircleOfSetOfPoints() got two atoms with same angle: " << *((InserterTest.first)->second) << " and " << (*listRunner) << endl);
    36903711      performCriticalExit();
    36913712    }
     
    37273748    ReferencePoint = PointRunner->second;
    37283749  } else {
    3729     eLog() << Verbose(1) << "GetPathOfConnectedPoints() could not find the BoundaryPoint belonging to " << *Point << "." << endl;
     3750    DoeLog(1) && (eLog()<< Verbose(1) << "GetPathOfConnectedPoints() could not find the BoundaryPoint belonging to " << *Point << "." << endl);
    37303751    return NULL;
    37313752  }
     
    37443765      LineRunner = TouchedLine.find(runner->second);
    37453766      if (LineRunner == TouchedLine.end()) {
    3746         eLog() << Verbose(1) << "I could not find " << *runner->second << " in the touched list." << endl;
     3767        DoeLog(1) && (eLog()<< Verbose(1) << "I could not find " << *runner->second << " in the touched list." << endl);
    37473768      } else if (!LineRunner->second) {
    37483769        LineRunner->second = true;
     
    37743795                }
    37753796              } else {
    3776                 eLog() << Verbose(1) << "I could not find " << *triangle << " in the touched list." << endl;
     3797                DoeLog(1) && (eLog()<< Verbose(1) << "I could not find " << *triangle << " in the touched list." << endl);
    37773798                triangle = NULL;
    37783799              }
     
    37913812          LineRunner = TouchedLine.find(CurrentLine);
    37923813          if (LineRunner == TouchedLine.end())
    3793             eLog() << Verbose(1) << "I could not find " << *CurrentLine << " in the touched list." << endl;
     3814            DoeLog(1) && (eLog()<< Verbose(1) << "I could not find " << *CurrentLine << " in the touched list." << endl);
    37943815          else
    37953816            LineRunner->second = true;
     
    38093830    }
    38103831  } else {
    3811     eLog() << Verbose(1) << "There are no lines attached to " << *ReferencePoint << "." << endl;
     3832    DoeLog(1) && (eLog()<< Verbose(1) << "There are no lines attached to " << *ReferencePoint << "." << endl);
    38123833  }
    38133834
     
    38893910
    38903911  if (Point == NULL) {
    3891     eLog() << Verbose(1) << "Point given is NULL." << endl;
     3912    DoeLog(1) && (eLog()<< Verbose(1) << "Point given is NULL." << endl);
    38923913  } else {
    38933914    // go through its lines and insert all triangles
     
    39213942
    39223943  if (point == NULL) {
    3923     eLog() << Verbose(1) << "Cannot remove the point " << point << ", it's NULL!" << endl;
     3944    DoeLog(1) && (eLog()<< Verbose(1) << "Cannot remove the point " << point << ", it's NULL!" << endl);
    39243945    return 0.;
    39253946  } else
     
    39313952  // get list of connected points
    39323953  if (point->lines.empty()) {
    3933     eLog() << Verbose(1) << "Cannot remove the point " << *point << ", it's connected to no lines!" << endl;
     3954    DoeLog(1) && (eLog()<< Verbose(1) << "Cannot remove the point " << *point << ", it's connected to no lines!" << endl);
    39343955    return 0.;
    39353956  }
     
    40124033        MiddleNode = EndNode;
    40134034        if (MiddleNode == connectedPath->end()) {
    4014           eLog() << Verbose(0) << "CRITICAL: Could not find a smallest angle!" << endl;
     4035          DoeLog(0) && (eLog()<< Verbose(0) << "CRITICAL: Could not find a smallest angle!" << endl);
    40154036          performCriticalExit();
    40164037        }
     
    40314052        triangle = GetPresentTriangle(TriangleCandidates);
    40324053        if (triangle != NULL) {
    4033           eLog() << Verbose(0) << "New triangle already present, skipping!" << endl;
     4054          DoeLog(0) && (eLog()<< Verbose(0) << "New triangle already present, skipping!" << endl);
    40344055          StartNode++;
    40354056          MiddleNode++;
     
    40694090          break;
    40704091        } else if (connectedPath->size() < 2) { // something's gone wrong!
    4071           eLog() << Verbose(0) << "CRITICAL: There are only two endpoints left!" << endl;
     4092          DoeLog(0) && (eLog()<< Verbose(0) << "CRITICAL: There are only two endpoints left!" << endl);
    40724093          performCriticalExit();
    40734094        } else {
     
    42224243    }
    42234244    default:
    4224       eLog() << Verbose(0) << "Number of wildcards is greater than 3, cannot happen!" << endl;
     4245      DoeLog(0) && (eLog()<< Verbose(0) << "Number of wildcards is greater than 3, cannot happen!" << endl);
    42254246      performCriticalExit();
    42264247      break;
     
    42754296  // sanity check
    42764297  if (LinesOnBoundary.empty()) {
    4277     eLog() << Verbose(2) << "FindAllDegeneratedTriangles() was called without any tesselation structure.";
     4298    DoeLog(2) && (eLog()<< Verbose(2) << "FindAllDegeneratedTriangles() was called without any tesselation structure.");
    42784299    return DegeneratedLines;
    42794300  }
     
    42994320      Log() << Verbose(0) << *Line1->second << " => " << *Line2->second << endl;
    43004321    else
    4301       eLog() << Verbose(1) << "Either " << (*it).first << " or " << (*it).second << " are not in LinesOnBoundary!" << endl;
     4322      DoeLog(1) && (eLog()<< Verbose(1) << "Either " << (*it).first << " or " << (*it).second << " are not in LinesOnBoundary!" << endl);
    43024323  }
    43034324
     
    44594480    NearestBoundaryPoint = PointRunner->second;
    44604481  } else {
    4461     eLog() << Verbose(1) << "I cannot find the boundary point." << endl;
     4482    DoeLog(1) && (eLog()<< Verbose(1) << "I cannot find the boundary point." << endl);
    44624483    return;
    44634484  }
     
    45274548    if ((BTS->lines[i]->ContainsBoundaryPoint(BestLine->endpoints[0])) && (BTS->lines[i]->ContainsBoundaryPoint(BestLine->endpoints[1]))) {
    45284549      if (BestLine == BTS->lines[i]){
    4529         eLog() << Verbose(0) << "BestLine is same as found line, something's wrong here!" << endl;
     4550        DoeLog(0) && (eLog()<< Verbose(0) << "BestLine is same as found line, something's wrong here!" << endl);
    45304551        performCriticalExit();
    45314552      }
     
    47194740    // connections to either polygon ...
    47204741    if (T->size() % 2 != 0) {
    4721       eLog() << Verbose(0) << " degenerated polygon contains an odd number of triangles, probably contains bridging non-degenerated ones, too!" << endl;
     4742      DoeLog(0) && (eLog()<< Verbose(0) << " degenerated polygon contains an odd number of triangles, probably contains bridging non-degenerated ones, too!" << endl);
    47224743      performCriticalExit();
    47234744    }
     
    47544775      AddTesselationLine(TPS[1], TPS[2], 2);
    47554776      if (TriangleNrs.empty())
    4756         eLog() << Verbose(0) << "No more free triangle numbers!" << endl;
     4777        DoeLog(0) && (eLog()<< Verbose(0) << "No more free triangle numbers!" << endl);
    47574778      BTS = new BoundaryTriangleSet(BLS, TriangleNrs.top()); // copy triangle ...
    47584779      AddTesselationTriangle(); // ... and add
     
    47634784    }
    47644785    if (!TriangleNrs.empty()) {
    4765       eLog() << Verbose(0) << "There have been less triangles created than removed!" << endl;
     4786      DoeLog(0) && (eLog()<< Verbose(0) << "There have been less triangles created than removed!" << endl);
    47664787    }
    47674788    delete(T);  // remove the triangleset
  • src/tesselation.hpp

    r8ab0407 rc7b1e7  
    318318    bool IsInnerPoint(const Vector &Point, const LinkedCell* const LC) const;
    319319    double GetDistanceSquaredToTriangle(const Vector &Point, const BoundaryTriangleSet* const triangle) const;
    320     double GetDistanceSquaredToSurface(const Vector &Point, const LinkedCell* const LC) const;
     320    double GetDistanceToSurface(const Vector &Point, const LinkedCell* const LC) const;
     321    BoundaryTriangleSet * GetClosestTriangleOnSurface(const Vector &Point, const LinkedCell* const LC) const;
    321322    bool AddBoundaryPoint(TesselPoint * Walker, const int n);
    322323    DistanceToPointMap * FindClosestBoundaryPointsToVector(const Vector *x, const LinkedCell* LC) const;
  • src/tesselationhelpers.cpp

    r8ab0407 rc7b1e7  
    8181
    8282  if (fabs(m11) < MYEPSILON)
    83     eLog() << Verbose(1) << "three points are colinear." << endl;
     83    DoeLog(1) && (eLog()<< Verbose(1) << "three points are colinear." << endl);
    8484
    8585  center->x[0] =  0.5 * m12/ m11;
     
    8888
    8989  if (fabs(a.Distance(center) - RADIUS) > MYEPSILON)
    90     eLog() << Verbose(1) << "The given center is further way by " << fabs(a.Distance(center) - RADIUS) << " from a than RADIUS." << endl;
     90    DoeLog(1) && (eLog()<< Verbose(1) << "The given center is further way by " << fabs(a.Distance(center) - RADIUS) << " from a than RADIUS." << endl);
    9191
    9292  gsl_matrix_free(A);
     
    192192  //Log() << Verbose(1) << "INFO: alpha = " << alpha/M_PI*180. << ", beta = " << beta/M_PI*180. << ", gamma = " << gamma/M_PI*180. << "." << endl;
    193193  if (fabs(M_PI - alpha - beta - gamma) > HULLEPSILON) {
    194     eLog() << Verbose(1) << "GetCenterofCircumcircle: Sum of angles " << (alpha+beta+gamma)/M_PI*180. << " > 180 degrees by " << fabs(M_PI - alpha - beta - gamma)/M_PI*180. << "!" << endl;
     194    DoeLog(1) && (eLog()<< Verbose(1) << "GetCenterofCircumcircle: Sum of angles " << (alpha+beta+gamma)/M_PI*180. << " > 180 degrees by " << fabs(M_PI - alpha - beta - gamma)/M_PI*180. << "!" << endl);
    195195  }
    196196
     
    236236  // test whether new center is on the parameter circle's plane
    237237  if (fabs(helper.ScalarProduct(&CirclePlaneNormal)) > HULLEPSILON) {
    238     eLog() << Verbose(1) << "Something's very wrong here: NewSphereCenter is not on the band's plane as desired by " <<fabs(helper.ScalarProduct(&CirclePlaneNormal))  << "!" << endl;
     238    DoeLog(1) && (eLog()<< Verbose(1) << "Something's very wrong here: NewSphereCenter is not on the band's plane as desired by " <<fabs(helper.ScalarProduct(&CirclePlaneNormal))  << "!" << endl);
    239239    helper.ProjectOntoPlane(&CirclePlaneNormal);
    240240  }
     
    242242  // test whether the new center vector has length of CircleRadius
    243243  if (fabs(radius - CircleRadius) > HULLEPSILON)
    244     eLog() << Verbose(1) << "The projected center of the new sphere has radius " << radius << " instead of " << CircleRadius << "." << endl;
     244    DoeLog(1) && (eLog()<< Verbose(1) << "The projected center of the new sphere has radius " << radius << " instead of " << CircleRadius << "." << endl);
    245245  alpha = helper.Angle(&RelativeOldSphereCenter);
    246246  // make the angle unique by checking the halfplanes/search direction
     
    512512//  Vector BaseLineVector, OrthogonalVector, helper;
    513513//  if (candidate1->BaseLine != candidate2->BaseLine) {  // sanity check
    514 //    eLog() << Verbose(1) << "sortCandidates was called for two different baselines: " << candidate1->BaseLine << " and " << candidate2->BaseLine << "." << endl;
     514//    DoeLog(1) && (eLog()<< Verbose(1) << "sortCandidates was called for two different baselines: " << candidate1->BaseLine << " and " << candidate2->BaseLine << "." << endl);
    515515//    //return false;
    516516//    exit(1);
     
    764764    }
    765765  } else {
    766     eLog() << Verbose(1) << "Given vrmlfile is " << vrmlfile << "." << endl;
     766    DoeLog(1) && (eLog()<< Verbose(1) << "Given vrmlfile is " << vrmlfile << "." << endl);
    767767  }
    768768  delete(center);
     
    839839    *rasterfile << "9\n#  terminating special property\n";
    840840  } else {
    841     eLog() << Verbose(1) << "Given rasterfile is " << rasterfile << "." << endl;
     841    DoeLog(1) && (eLog()<< Verbose(1) << "Given rasterfile is " << rasterfile << "." << endl);
    842842  }
    843843  IncludeSphereinRaster3D(rasterfile, Tess, cloud);
     
    951951  // check number of endpoints in *P
    952952  if (P->endpoints.size() != 4) {
    953     eLog() << Verbose(1) << "CountTrianglePairContainingPolygon works only on polygons with 4 nodes!" << endl;
     953    DoeLog(1) && (eLog()<< Verbose(1) << "CountTrianglePairContainingPolygon works only on polygons with 4 nodes!" << endl);
    954954    return 0;
    955955  }
     
    957957  // check number of triangles in *T
    958958  if (T->size() < 2) {
    959     eLog() << Verbose(1) << "Not enough triangles to have pairs!" << endl;
     959    DoeLog(1) && (eLog()<< Verbose(1) << "Not enough triangles to have pairs!" << endl);
    960960    return 0;
    961961  }
  • src/unittests/AnalysisCorrelationToSurfaceUnitTest.cpp

    r8ab0407 rc7b1e7  
    6060
    6161  // construct molecule (tetraeder of hydrogens) base
     62  TestSurfaceMolecule = new molecule(tafel);
     63  Walker = new atom();
     64  Walker->type = hydrogen;
     65  Walker->node->Init(1., 0., 1. );
     66  TestSurfaceMolecule->AddAtom(Walker);
     67  Walker = new atom();
     68  Walker->type = hydrogen;
     69  Walker->node->Init(0., 1., 1. );
     70  TestSurfaceMolecule->AddAtom(Walker);
     71  Walker = new atom();
     72  Walker->type = hydrogen;
     73  Walker->node->Init(1., 1., 0. );
     74  TestSurfaceMolecule->AddAtom(Walker);
     75  Walker = new atom();
     76  Walker->type = hydrogen;
     77  Walker->node->Init(0., 0., 0. );
     78  TestSurfaceMolecule->AddAtom(Walker);
     79
     80  // check that TestMolecule was correctly constructed
     81  CPPUNIT_ASSERT_EQUAL( TestSurfaceMolecule->AtomCount, 4 );
     82
     83  TestList = new MoleculeListClass;
     84  TestSurfaceMolecule->ActiveFlag = true;
     85  TestList->insert(TestSurfaceMolecule);
     86
     87  // init tesselation and linked cell
     88  Surface = new Tesselation;
     89  LC = new LinkedCell(TestSurfaceMolecule, 5.);
     90  FindNonConvexBorder(TestSurfaceMolecule, Surface, (const LinkedCell *&)LC, 2.5, NULL);
     91
     92  // add outer atoms
    6293  TestMolecule = new molecule(tafel);
    6394  Walker = new atom();
    64   Walker->type = hydrogen;
    65   Walker->node->Init(1., 0., 1. );
    66   TestMolecule->AddAtom(Walker);
    67   Walker = new atom();
    68   Walker->type = hydrogen;
    69   Walker->node->Init(0., 1., 1. );
    70   TestMolecule->AddAtom(Walker);
    71   Walker = new atom();
    72   Walker->type = hydrogen;
    73   Walker->node->Init(1., 1., 0. );
    74   TestMolecule->AddAtom(Walker);
    75   Walker = new atom();
    76   Walker->type = hydrogen;
    77   Walker->node->Init(0., 0., 0. );
    78   TestMolecule->AddAtom(Walker);
    79 
    80   // check that TestMolecule was correctly constructed
    81   CPPUNIT_ASSERT_EQUAL( TestMolecule->AtomCount, 4 );
    82 
    83   TestList = new MoleculeListClass;
     95  Walker->type = carbon;
     96  Walker->node->Init(4., 0., 4. );
     97  TestMolecule->AddAtom(Walker);
     98  Walker = new atom();
     99  Walker->type = carbon;
     100  Walker->node->Init(0., 4., 4. );
     101  TestMolecule->AddAtom(Walker);
     102  Walker = new atom();
     103  Walker->type = carbon;
     104  Walker->node->Init(4., 4., 0. );
     105  TestMolecule->AddAtom(Walker);
     106  // add inner atoms
     107  Walker = new atom();
     108  Walker->type = carbon;
     109  Walker->node->Init(0.5, 0.5, 0.5 );
     110  TestMolecule->AddAtom(Walker);
    84111  TestMolecule->ActiveFlag = true;
    85112  TestList->insert(TestMolecule);
    86 
    87   // init tesselation and linked cell
    88   Surface = new Tesselation;
    89   FindNonConvexBorder(TestMolecule, Surface, (const LinkedCell *&)LC, 2.5, NULL);
    90   LC = new LinkedCell(TestMolecule, 5.);
    91   CPPUNIT_ASSERT_EQUAL( (size_t)4, Surface->PointsOnBoundary.size() );
    92   CPPUNIT_ASSERT_EQUAL( (size_t)6, Surface->LinesOnBoundary.size() );
    93   CPPUNIT_ASSERT_EQUAL( (size_t)4, Surface->TrianglesOnBoundary.size() );
    94 
    95   // add outer atoms
    96   Walker = new atom();
    97   Walker->type = carbon;
    98   Walker->node->Init(4., 0., 4. );
    99   TestMolecule->AddAtom(Walker);
    100   Walker = new atom();
    101   Walker->type = carbon;
    102   Walker->node->Init(0., 4., 4. );
    103   TestMolecule->AddAtom(Walker);
    104   Walker = new atom();
    105   Walker->type = carbon;
    106   Walker->node->Init(4., 4., 0. );
    107   TestMolecule->AddAtom(Walker);
    108   // add inner atoms
    109   Walker = new atom();
    110   Walker->type = carbon;
    111   Walker->node->Init(0.5, 0.5, 0.5 );
    112   TestMolecule->AddAtom(Walker);
    113113
    114114  // init maps
     
    136136
    137137
     138/** Checks whether setup() does the right thing.
     139 */
     140void AnalysisCorrelationToSurfaceUnitTest::SurfaceTest()
     141{
     142  CPPUNIT_ASSERT_EQUAL( 4, TestSurfaceMolecule->AtomCount );
     143  CPPUNIT_ASSERT_EQUAL( 4, TestMolecule->AtomCount );
     144  CPPUNIT_ASSERT_EQUAL( (size_t)2, TestList->ListOfMolecules.size() );
     145  CPPUNIT_ASSERT_EQUAL( (size_t)4, Surface->PointsOnBoundary.size() );
     146  CPPUNIT_ASSERT_EQUAL( (size_t)6, Surface->LinesOnBoundary.size() );
     147  CPPUNIT_ASSERT_EQUAL( (size_t)4, Surface->TrianglesOnBoundary.size() );
     148};
     149
    138150void AnalysisCorrelationToSurfaceUnitTest::CorrelationToSurfaceTest()
    139151{
    140152  // do the pair correlation
    141153  surfacemap = CorrelationToSurface( TestList, hydrogen, Surface, LC );
     154//  OutputCorrelationToSurface ( (ofstream *)&cout, surfacemap );
    142155  CPPUNIT_ASSERT( surfacemap != NULL );
    143156  CPPUNIT_ASSERT_EQUAL( (size_t)4, surfacemap->size() );
     
    149162  surfacemap = CorrelationToSurface( TestList, hydrogen, Surface, LC );
    150163  // put pair correlation into bins and check with no range
     164//  OutputCorrelationToSurface ( (ofstream *)&cout, surfacemap );
    151165  binmap = BinData( surfacemap, 0.5, 0., 0. );
    152166  CPPUNIT_ASSERT_EQUAL( (size_t)1, binmap->size() );
    153   //OutputCorrelation ( binmap );
     167  OutputCorrelation ( (ofstream *)&cout, binmap );
    154168  tester = binmap->begin();
    155169  CPPUNIT_ASSERT_EQUAL( 0., tester->first );
     
    162176  BinPairMap::iterator tester;
    163177  surfacemap = CorrelationToSurface( TestList, hydrogen, Surface, LC );
     178//  OutputCorrelationToSurface ( (ofstream *)&cout, surfacemap );
    164179  // ... and check with [0., 2.] range
    165180  binmap = BinData( surfacemap, 0.5, 0., 2. );
    166181  CPPUNIT_ASSERT_EQUAL( (size_t)5, binmap->size() );
    167   //OutputCorrelation ( binmap );
     182//  OutputCorrelation ( (ofstream *)&cout, binmap );
    168183  tester = binmap->begin();
    169184  CPPUNIT_ASSERT_EQUAL( 0., tester->first );
     
    179194  BinPairMap::iterator tester;
    180195  surfacemap = CorrelationToSurface( TestList, carbon, Surface, LC );
     196//  OutputCorrelationToSurface ( (ofstream *)&cout, surfacemap );
    181197  // put pair correlation into bins and check with no range
    182198  binmap = BinData( surfacemap, 0.5, 0., 0. );
     
    184200  OutputCorrelation ( (ofstream *)&cout, binmap );
    185201  // inside point is first and must have negative value
    186   tester = binmap->lower_bound(2.95); // start depends on the min value and
     202  tester = binmap->lower_bound(4.25-0.5); // start depends on the min value and
    187203  CPPUNIT_ASSERT( tester != binmap->end() );
    188204  CPPUNIT_ASSERT_EQUAL( 3, tester->second );
    189205  // inner point
    190   tester = binmap->lower_bound(-0.5);
     206  tester = binmap->lower_bound(0.);
    191207  CPPUNIT_ASSERT( tester != binmap->end() );
    192208  CPPUNIT_ASSERT_EQUAL( 1, tester->second );
     
    197213  BinPairMap::iterator tester;
    198214  surfacemap = CorrelationToSurface( TestList, carbon, Surface, LC );
     215//  OutputCorrelationToSurface ( (ofstream *)&cout, surfacemap );
    199216  // ... and check with [0., 2.] range
    200217  binmap = BinData( surfacemap, 0.5, -2., 4. );
    201218  CPPUNIT_ASSERT_EQUAL( (size_t)13, binmap->size() );
    202   OutputCorrelation ( (ofstream *)&cout, binmap );
     219//  OutputCorrelation ( (ofstream *)&cout, binmap );
    203220  // three outside points
    204   tester = binmap->lower_bound(3.);
     221  tester = binmap->lower_bound(4.25-0.5);
    205222  CPPUNIT_ASSERT( tester != binmap->end() );
    206223  CPPUNIT_ASSERT_EQUAL( 3, tester->second );
    207224  // inner point
    208   tester = binmap->lower_bound(-0.5);
     225  tester = binmap->lower_bound(0.);
    209226  CPPUNIT_ASSERT( tester != binmap->end() );
    210227  CPPUNIT_ASSERT_EQUAL( 1, tester->second );
    211 
    212228};
    213229
  • src/unittests/AnalysisCorrelationToSurfaceUnitTest.hpp

    r8ab0407 rc7b1e7  
    2323{
    2424    CPPUNIT_TEST_SUITE( AnalysisCorrelationToSurfaceUnitTest ) ;
     25    CPPUNIT_TEST ( SurfaceTest );
    2526    CPPUNIT_TEST ( CorrelationToSurfaceTest );
    2627    CPPUNIT_TEST ( CorrelationToSurfaceHydrogenBinNoRangeTest );
     
    3334      void setUp();
    3435      void tearDown();
     36      void SurfaceTest();
    3537      void CorrelationToSurfaceTest();
    3638      void CorrelationToSurfaceHydrogenBinNoRangeTest();
     
    4345      MoleculeListClass *TestList;
    4446      molecule *TestMolecule;
     47      molecule *TestSurfaceMolecule;
    4548      element *hydrogen;
    4649      element *carbon;
  • src/unittests/gslvectorunittest.cpp

    r8ab0407 rc7b1e7  
    115115
    116116
     117/** UnitTest for operators.
     118 */
     119void GSLVectorTest::OperatorIsTest()
     120{
     121  GSLVector zero(3);
     122  GSLVector unit(3);
     123  zero.SetZero();
     124  unit.SetZero();
     125  unit.Set(1,1.);
     126  // summation and scaling
     127  CPPUNIT_ASSERT_EQUAL( true, unit.IsOne() );
     128  CPPUNIT_ASSERT_EQUAL( false, zero.IsOne() );
     129  CPPUNIT_ASSERT_EQUAL( false, unit.IsZero() );
     130  CPPUNIT_ASSERT_EQUAL( true, zero.IsZero() );
     131};
     132
     133/** UnitTest for operators.
     134 */
     135void GSLVectorTest::OperatorAlgebraTest()
     136{
     137  GSLVector zero(3);
     138  GSLVector unit(3);
     139  zero.SetZero();
     140  unit.SetZero();
     141  unit.Set(1,1.);
     142  // summation and scaling
     143  CPPUNIT_ASSERT_EQUAL( true, (zero+unit).IsOne() );
     144  CPPUNIT_ASSERT_EQUAL( true, (zero+unit).IsOne() );
     145  CPPUNIT_ASSERT_EQUAL( true, (zero-unit).IsOne() );
     146  CPPUNIT_ASSERT_EQUAL( false, (zero-unit).IsZero() );
     147  CPPUNIT_ASSERT_EQUAL( true, (zero+zero).IsZero() );
     148  CPPUNIT_ASSERT_EQUAL( false, (unit*0.98).IsOne() );
     149  CPPUNIT_ASSERT_EQUAL( false, (0.98*unit).IsOne() );
     150  CPPUNIT_ASSERT_EQUAL( true, (unit*1.).IsOne() );
     151  CPPUNIT_ASSERT_EQUAL( true, (1.*unit).IsOne() );
     152
     153  CPPUNIT_ASSERT_EQUAL( unit, (zero+unit) );
     154  CPPUNIT_ASSERT_EQUAL( zero, (zero+zero) );
     155  CPPUNIT_ASSERT_EQUAL( unit, (unit+zero) );
     156
     157  unit += zero;
     158  CPPUNIT_ASSERT_EQUAL( true, unit.IsOne() );
     159  unit *= 1.;
     160  CPPUNIT_ASSERT_EQUAL( true, unit.IsOne() );
     161};
     162
    117163/********************************************** Main routine **************************************/
    118164
  • src/unittests/gslvectorunittest.hpp

    r8ab0407 rc7b1e7  
    2222    CPPUNIT_TEST (CopyTest );
    2323    CPPUNIT_TEST (ExchangeTest );
     24    CPPUNIT_TEST (OperatorAlgebraTest );
     25    CPPUNIT_TEST (OperatorIsTest );
    2426    CPPUNIT_TEST_SUITE_END();
    2527
     
    3234    void CopyTest();
    3335    void ExchangeTest();
     36    void OperatorIsTest();
     37    void OperatorAlgebraTest();
    3438
    3539private:
  • src/unittests/logunittest.cpp

    r8ab0407 rc7b1e7  
    4343
    4444  Log() << Verbose(0) << "Output a log message." << endl;
    45   eLog() << Verbose(0) << "Output an error message." << endl;
     45  DoeLog(0) && (eLog()<< Verbose(0) << "Output an error message." << endl);
    4646  setVerbosity(3);
    4747  Log() << Verbose(4) << "This should not be printed." << endl;
    48   eLog() << Verbose(4) << "This should not be printed." << endl;
     48  DoeLog(4) && (eLog()<< Verbose(4) << "This should not be printed." << endl);
    4949};
    5050
  • src/vector.cpp

    r8ab0407 rc7b1e7  
    1515#include "vector.hpp"
    1616#include "verbose.hpp"
     17#include "World.hpp"
    1718
    1819#include <gsl/gsl_linalg.h>
     
    2627 */
    2728Vector::Vector() { x[0] = x[1] = x[2] = 0.; };
     29
     30/** Constructor of class vector.
     31 */
     32Vector::Vector(const Vector * const a)
     33{
     34  x[0] = a->x[0];
     35  x[1] = a->x[1];
     36  x[2] = a->x[2];
     37};
     38
     39/** Constructor of class vector.
     40 */
     41Vector::Vector(const Vector &a)
     42{
     43  x[0] = a.x[0];
     44  x[1] = a.x[1];
     45  x[2] = a.x[2];
     46};
    2847
    2948/** Constructor of class vector.
     
    262281    return true;
    263282  } else {
    264     eLog() << Verbose(2) << "Intersection point " << *this << " is not on plane." << endl;
     283    DoeLog(2) && (eLog()<< Verbose(2) << "Intersection point " << *this << " is not on plane." << endl);
    265284    return false;
    266285  }
    267286};
    268287
    269 /** Calculates the minimum distance of this vector to the plane.
     288/** Calculates the minimum distance vector of this vector to the plane.
    270289 * \param *out output stream for debugging
    271290 * \param *PlaneNormal normal of plane
    272291 * \param *PlaneOffset offset of plane
    273  * \return distance to plane
    274  */
    275 double Vector::DistanceToPlane(const Vector * const PlaneNormal, const Vector * const PlaneOffset) const
     292 * \return distance vector onto to plane
     293 */
     294Vector Vector::GetDistanceVectorToPlane(const Vector * const PlaneNormal, const Vector * const PlaneOffset) const
    276295{
    277296  Vector temp;
     
    291310    sign = 0.;
    292311
    293   return (temp.Norm()*sign);
     312  temp.Normalize();
     313  temp.Scale(sign);
     314  return temp;
     315};
     316
     317/** Calculates the minimum distance of this vector to the plane.
     318 * \sa Vector::GetDistanceVectorToPlane()
     319 * \param *out output stream for debugging
     320 * \param *PlaneNormal normal of plane
     321 * \param *PlaneOffset offset of plane
     322 * \return distance to plane
     323 */
     324double Vector::DistanceToPlane(const Vector * const PlaneNormal, const Vector * const PlaneOffset) const
     325{
     326  return GetDistanceVectorToPlane(PlaneNormal,PlaneOffset).Norm();
    294327};
    295328
     
    783816      x[i] = C.x[i];
    784817  } else {
    785     eLog() << Verbose(1) << "inverse of matrix does not exists: det A = " << detA << "." << endl;
     818    DoeLog(1) && (eLog()<< Verbose(1) << "inverse of matrix does not exists: det A = " << detA << "." << endl);
    786819  }
    787820};
     
    835868  x2.SubtractVector(y2);
    836869  if ((fabs(x1.Norm()) < MYEPSILON) || (fabs(x2.Norm()) < MYEPSILON) || (fabs(x1.Angle(&x2)) < MYEPSILON)) {
    837     eLog() << Verbose(2) << "Given vectors are linear dependent." << endl;
     870    DoeLog(2) && (eLog()<< Verbose(2) << "Given vectors are linear dependent." << endl);
    838871    return false;
    839872  }
     
    869902  Zero();
    870903  if ((fabs(x1.Norm()) < MYEPSILON) || (fabs(x2.Norm()) < MYEPSILON) || (fabs(x1.Angle(&x2)) < MYEPSILON)) {
    871     eLog() << Verbose(2) << "Given vectors are linear dependent." << endl;
     904    DoeLog(2) && (eLog()<< Verbose(2) << "Given vectors are linear dependent." << endl);
    872905    return false;
    873906  }
  • src/vector.hpp

    r8ab0407 rc7b1e7  
    2727
    2828  Vector();
     29  Vector(const Vector * const a);
     30  Vector(const Vector &a);
    2931  Vector(const double x1, const double x2, const double x3);
    3032  ~Vector();
     
    6769  void LinearCombinationOfVectors(const Vector * const x1, const Vector * const x2, const Vector * const x3, const double * const factors);
    6870  double CutsPlaneAt(const Vector * const A, const Vector * const B, const Vector * const C) const;
     71  Vector GetDistanceVectorToPlane(const Vector * const PlaneNormal, const Vector * const PlaneOffset) const;
    6972  bool GetIntersectionWithPlane(const Vector * const PlaneNormal, const Vector * const PlaneOffset, const Vector * const Origin, const Vector * const LineVector);
    7073  bool GetIntersectionOfTwoLinesOnPlane(const Vector * const Line1a, const Vector * const Line1b, const Vector * const Line2a, const Vector * const Line2b, const Vector *Normal = NULL);
Note: See TracChangeset for help on using the changeset viewer.