Changes in / [e588312:b5c53d]


Ignore:
Files:
42 added
3 deleted
138 edited

Legend:

Unmodified
Added
Removed
  • TestRunnerClient.cpp

    re588312 rb5c53d  
    4545#endif
    4646
    47 #define MAX_HOSTNAME_SIZE               255
     47enum { MAX_HOSTNAME_SIZE=255 };
    4848
    4949/*
  • src/Actions/AnalysisAction/MolecularVolumeAction.cpp

    re588312 rb5c53d  
    1616#include "Helpers/Log.hpp"
    1717#include "Helpers/Verbose.hpp"
     18#include "tesselation.hpp"
    1819#include "World.hpp"
    1920
     
    6061    LCList = new LinkedCell(mol, 10.);
    6162    config * const configuration = World::getInstance().getConfig();
    62     Boundaries *BoundaryPoints = NULL;
     63    //Boundaries *BoundaryPoints = NULL;
    6364    //FindConvexBorder(mol, BoundaryPoints, TesselStruct, LCList, argv[argptr]);
    6465    FindNonConvexBorder(mol, TesselStruct, LCList, 5., NULL);
  • src/Actions/AnalysisAction/PairCorrelationAction.cpp

    re588312 rb5c53d  
    7070  double BinStart = 0.;
    7171  double BinWidth = 0.;
    72   molecule *Boundary = NULL;
    7372  string outputname;
    7473  string binoutputname;
  • src/Actions/AnalysisAction/PointCorrelationAction.cpp

    re588312 rb5c53d  
    7171  double BinStart = 0.;
    7272  double BinWidth = 0.;
    73   molecule *Boundary = NULL;
    7473  string outputname;
    7574  string binoutputname;
  • src/Actions/AnalysisAction/PrincipalAxisSystemAction.cpp

    re588312 rb5c53d  
    1010#include "Actions/AnalysisAction/PrincipalAxisSystemAction.hpp"
    1111#include "Actions/ActionRegistry.hpp"
    12 #include "molecule.hpp"
    1312#include "Helpers/Log.hpp"
    1413#include "Helpers/Verbose.hpp"
     14#include "LinearAlgebra/Matrix.hpp"
     15#include "LinearAlgebra/Vector.hpp"
     16#include "element.hpp"
     17#include "molecule.hpp"
    1518
    1619#include <iostream>
     
    4649Action::state_ptr AnalysisPrincipalAxisSystemAction::performCall() {
    4750  molecule *mol = NULL;
     51  Matrix InertiaTensor;
    4852
    4953  ValueStorage::getInstance().queryCurrentValue(NAME, mol);
     
    5155  for (World::MoleculeSelectionIterator iter = World::getInstance().beginMoleculeSelection(); iter != World::getInstance().endMoleculeSelection(); ++iter) {
    5256    molecule *mol = iter->second;
    53     mol->PrincipalAxisSystem(false);
     57    Vector *CenterOfGravity = mol->DetermineCenterOfGravity();
     58
     59    // reset inertia tensor
     60    InertiaTensor.zero();
     61
     62    // sum up inertia tensor
     63    for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
     64      Vector x = (*iter)->getPosition();
     65      x -= *CenterOfGravity;
     66      const double mass = (*iter)->getType()->mass;
     67      InertiaTensor.at(0,0) += mass*(x[1]*x[1] + x[2]*x[2]);
     68      InertiaTensor.at(0,1) += mass*(-x[0]*x[1]);
     69      InertiaTensor.at(0,2) += mass*(-x[0]*x[2]);
     70      InertiaTensor.at(1,0) += mass*(-x[1]*x[0]);
     71      InertiaTensor.at(1,1) += mass*(x[0]*x[0] + x[2]*x[2]);
     72      InertiaTensor.at(1,2) += mass*(-x[1]*x[2]);
     73      InertiaTensor.at(2,0) += mass*(-x[2]*x[0]);
     74      InertiaTensor.at(2,1) += mass*(-x[2]*x[1]);
     75      InertiaTensor.at(2,2) += mass*(x[0]*x[0] + x[1]*x[1]);
     76    }
     77    // print InertiaTensor for debugging
     78    DoLog(0) && (Log() << Verbose(0) << "The inertia tensor is:" << InertiaTensor << endl);
    5479  }
    5580  return Action::success;
  • src/Actions/AnalysisAction/SurfaceCorrelationAction.cpp

    re588312 rb5c53d  
    1818#include "molecule.hpp"
    1919#include "periodentafel.hpp"
     20#include "tesselation.hpp"
    2021#include "LinearAlgebra/Vector.hpp"
    2122#include "World.hpp"
     
    111112  // find biggest molecule
    112113  std::vector<molecule*> molecules = World::getInstance().getSelectedMolecules();
    113   int counter  = molecules.size();
    114114  LCList = new LinkedCell(Boundary, LCWidth);
    115115  FindNonConvexBorder(Boundary, TesselStruct, LCList, radius, NULL);
  • src/Actions/AtomAction/AddAction.cpp

    re588312 rb5c53d  
    6161  // execute action
    6262  atom * first = World::getInstance().createAtom();
    63   first->type = elemental;
    64   first->x = position;
    65   DoLog(1) && (Log() << Verbose(1) << "Adding new atom with element " << *first->type << " at " << (first->x) << "." << endl);
     63  first->setType(elemental);
     64  first->setPosition(position);
     65  DoLog(1) && (Log() << Verbose(1) << "Adding new atom with element " << first->getType()->getName() << " at " << (first->getPosition()) << "." << endl);
    6666  // TODO: remove when all of World's atoms are stored.
    6767  std::vector<molecule *> molecules = World::getInstance().getAllMolecules();
  • src/Actions/AtomAction/ChangeElementAction.cpp

    re588312 rb5c53d  
    1515#include "LinearAlgebra/Vector.hpp"
    1616#include "Helpers/Verbose.hpp"
     17#include "molecule.hpp"
    1718#include "World.hpp"
    1819
     
    5051Action::state_ptr AtomChangeElementAction::performCall() {
    5152  atom *first = NULL;
    52   const element *elemental = NULL;
     53  const element *elemental;
     54  molecule *mol = NULL;
    5355
    5456  ValueStorage::getInstance().queryCurrentValue(NAME, elemental);
     
    5759    first = iter->second;
    5860    DoLog(1) && (Log() << Verbose(1) << "Changing atom " << *first << " to element " << *elemental << "." << endl);
    59     first->type = elemental;
     61    mol = first->getMolecule();
     62    first->removeFromMolecule(); // remove atom
     63    first->setType(elemental);
     64    mol->AddAtom(first);  // add atom to ensure correctness of formula
    6065  }
    6166  return Action::success;
  • src/Actions/FragmentationAction/SubgraphDissectionAction.cpp

    re588312 rb5c53d  
    1010#include "Actions/FragmentationAction/SubgraphDissectionAction.hpp"
    1111#include "Actions/ActionRegistry.hpp"
     12#include "Descriptors/MoleculeDescriptor.hpp"
     13
    1214#include "atom.hpp"
     15#include "bond.hpp"
     16#include "bondgraph.hpp"
    1317#include "config.hpp"
    1418#include "Helpers/Log.hpp"
    1519#include "molecule.hpp"
    16 #include "Descriptors/MoleculeDescriptor.hpp"
    1720#include "stackclass.hpp"
    1821#include "World.hpp"
     
    5356  // @TODO rather do the dissection afterwards
    5457  MoleculeListClass *molecules = World::getInstance().getMolecules();
    55   molecules->DissectMoleculeIntoConnectedSubgraphs(World::getInstance().getPeriode(), World::getInstance().getConfig());
     58  config * const configuration = World::getInstance().getConfig();
     59
     60  // 0a. remove all present molecules
     61  vector<molecule *> allmolecules = World::getInstance().getAllMolecules();
     62  for (vector<molecule *>::iterator MolRunner = allmolecules.begin(); MolRunner != allmolecules.end(); ++MolRunner) {
     63    molecules->erase(*MolRunner);
     64    World::getInstance().destroyMolecule(*MolRunner);
     65  }
     66
     67  // 0b. remove all bonds and construct a molecule with all atoms
     68  molecule *mol = World::getInstance().createMolecule();
     69  vector <atom *> allatoms = World::getInstance().getAllAtoms();
     70  for(vector<atom *>::iterator AtomRunner = allatoms.begin(); AtomRunner != allatoms.end(); ++AtomRunner) {
     71    for(BondList::iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); !(*AtomRunner)->ListOfBonds.empty(); BondRunner = (*AtomRunner)->ListOfBonds.begin())
     72      delete(*BondRunner);
     73    mol->AddAtom(*AtomRunner);
     74  }
     75
     76  // 1. create the bond structure of the single molecule
     77  if (configuration->BG != NULL) {
     78    if (!configuration->BG->ConstructBondGraph(mol)) {
     79      World::getInstance().destroyMolecule(mol);
     80      DoeLog(1) && (eLog()<< Verbose(1) << "There are no bonds." << endl);
     81      return Action::failure;
     82    }
     83  } else {
     84    DoeLog(1) && (eLog()<< Verbose(1) << "There is no BondGraph class present to create bonds." << endl);
     85    return Action::failure;
     86  }
     87
     88  // 2. scan for connected subgraphs
     89  MoleculeLeafClass *Subgraphs = NULL;      // list of subgraphs from DFS analysis
     90  class StackClass<bond *> *BackEdgeStack = NULL;
     91  Subgraphs = mol->DepthFirstSearchAnalysis(BackEdgeStack);
     92  delete(BackEdgeStack);
     93  if ((Subgraphs == NULL) || (Subgraphs->next == NULL)) {
     94    World::getInstance().destroyMolecule(mol);
     95    DoeLog(1) && (eLog()<< Verbose(1) << "There are no atoms." << endl);
     96    return Action::failure;
     97  }
     98
     99  // 3. dissect (the following construct is needed to have the atoms not in the order of the DFS, but in
     100  // the original one as parsed in)
     101  // TODO: Optimize this, when molecules just contain pointer list of global atoms!
     102
     103  // 4a. create array of molecules to fill
     104  const int MolCount = Subgraphs->next->Count();
     105  char number[MAXSTRINGSIZE];
     106  molecule **moleculelist = new molecule *[MolCount];
     107  MoleculeLeafClass *MolecularWalker = Subgraphs;
     108  for (int i=0;i<MolCount;i++) {
     109    MolecularWalker = MolecularWalker->next;
     110    moleculelist[i] = World::getInstance().createMolecule();
     111    moleculelist[i]->ActiveFlag = true;
     112    strncpy(moleculelist[i]->name, mol->name, MAXSTRINGSIZE);
     113    if (MolCount > 1) {
     114      sprintf(number, "-%d", i+1);
     115      strncat(moleculelist[i]->name, number, MAXSTRINGSIZE - strlen(mol->name) - 1);
     116    }
     117    DoLog(1) && (Log() << Verbose(1) << "MolName is " << moleculelist[i]->name << ", id is " << moleculelist[i]->getId() << endl);
     118    for (molecule::iterator iter = MolecularWalker->Leaf->begin(); iter != MolecularWalker->Leaf->end(); ++iter) {
     119      DoLog(1) && (Log() << Verbose(1) << **iter << endl);
     120    }
     121    molecules->insert(moleculelist[i]);
     122  }
     123
     124  // 4b. create and fill map of which atom is associated to which connected molecule (note, counting starts at 1)
     125  int FragmentCounter = 0;
     126  map<int, atom *> AtomToFragmentMap;
     127  MolecularWalker = Subgraphs;
     128  while (MolecularWalker->next != NULL) {
     129    MolecularWalker = MolecularWalker->next;
     130    for (molecule::iterator iter = MolecularWalker->Leaf->begin(); !MolecularWalker->Leaf->empty(); iter = MolecularWalker->Leaf->begin()) {
     131      atom * Walker = *iter;
     132      DoLog(1) && (Log() << Verbose(1) << "Re-linking " << Walker << "..." << endl);
     133      MolecularWalker->Leaf->erase(iter);
     134      moleculelist[FragmentCounter]->AddAtom(Walker);    // counting starts at 1
     135    }
     136    FragmentCounter++;
     137  }
     138  // TODO: When DepthFirstSearchAnalysis does not use AddCopyAtom() anymore, we don't need to delete all original atoms.
     139  // 4d. destroy the original molecule
     140  for (molecule::iterator AtomRunner = mol->begin(); !mol->empty(); AtomRunner = mol->begin())
     141    World::getInstance().destroyAtom(*AtomRunner);
     142  World::getInstance().destroyMolecule(mol);
     143
     144  // 4d. we don't need to redo bonds, as they are connected subgraphs and still maintain their ListOfBonds, but we have to remove them from first..last list
     145  // TODO: check whether this is really not needed anymore
     146  // 4e. free Leafs
     147  MolecularWalker = Subgraphs;
     148  while (MolecularWalker->next != NULL) {
     149    MolecularWalker = MolecularWalker->next;
     150    delete(MolecularWalker->previous);
     151  }
     152  delete(MolecularWalker);
     153  delete[](moleculelist);
     154  DoLog(1) && (Log() << Verbose(1) << "I scanned " << FragmentCounter << " molecules." << endl);
     155
    56156  return Action::success;
    57157}
  • src/Actions/Makefile.am

    re588312 rb5c53d  
    8585  MoleculeAction/FillWithMoleculeAction.cpp \
    8686  MoleculeAction/LinearInterpolationofTrajectoriesAction.cpp \
     87  MoleculeAction/RotateAroundOriginByAngleAction.cpp \
     88  MoleculeAction/RotateAroundSelfByAngleAction.cpp \
    8789  MoleculeAction/RotateToPrincipalAxisSystemAction.cpp \
    8890  MoleculeAction/SaveAdjacencyAction.cpp \
     
    9799  MoleculeAction/FillWithMoleculeAction.hpp \
    98100  MoleculeAction/LinearInterpolationofTrajectoriesAction.hpp \
     101  MoleculeAction/RotateAroundOriginByAngleAction.hpp \
     102  MoleculeAction/RotateAroundSelfByAngleAction.hpp \
    99103  MoleculeAction/RotateToPrincipalAxisSystemAction.hpp \
    100104  MoleculeAction/SaveAdjacencyAction.hpp \
  • src/Actions/MapOfActions.cpp

    re588312 rb5c53d  
    5555#include "Actions/MoleculeAction/FillWithMoleculeAction.hpp"
    5656#include "Actions/MoleculeAction/LinearInterpolationofTrajectoriesAction.hpp"
     57#include "Actions/MoleculeAction/RotateAroundOriginByAngleAction.hpp"
     58#include "Actions/MoleculeAction/RotateAroundSelfByAngleAction.hpp"
    5759#include "Actions/MoleculeAction/RotateToPrincipalAxisSystemAction.hpp"
    5860#include "Actions/MoleculeAction/SaveAdjacencyAction.hpp"
     
    203205  DescriptionMap["remove-sphere"] = "remove sphere of atoms of around a specified atom";
    204206  DescriptionMap["repeat-box"] = "create periodic copies of the simulation box per axis";
     207  DescriptionMap["rotate-origin"] = "rotates molecules by a specific angle around origin";
     208  DescriptionMap["rotate-self"] = "rotates molecules by a specific angle around own center of gravity";
    205209  DescriptionMap["rotate-to-pas"] = "calculate the principal axis system of the specified molecule and rotate specified axis to align with main axis";
    206210  DescriptionMap["save-adjacency"] = "name of the adjacency file to write to";
     
    319323  TypeMap["remove-sphere"] = &typeid(double);
    320324  TypeMap["repeat-box"] = &typeid(VectorValue);
    321   TypeMap["rotate-to-pas"] = &typeid(molecule);
     325  TypeMap["rotate-origin"] = &typeid(double);
     326  TypeMap["rotate-self"] = &typeid(double);
     327  TypeMap["rotate-to-pas"] = &typeid(VectorValue);
    322328  TypeMap["save-adjacency"] = &typeid(std::string);
    323329  TypeMap["save-bonds"] = &typeid(std::string);
     
    423429  MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "fill-molecule") );
    424430  MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "linear-interpolate") );
     431  MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "rotate-origin") );
     432  MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "rotate-self") );
    425433  MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "rotate-to-pas") );
    426434  MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "save-adjacency") );
     
    487495  generic.insert("remove-sphere");
    488496  generic.insert("repeat-box");
     497  generic.insert("rotate-origin");
     498  generic.insert("rotate-self");
    489499  generic.insert("rotate-to-pas");
    490500        generic.insert("save-adjacency");
     
    807817  new MoleculeFillWithMoleculeAction();
    808818  new MoleculeLinearInterpolationofTrajectoriesAction();
     819  new MoleculeRotateAroundOriginByAngleAction();
     820  new MoleculeRotateAroundSelfByAngleAction();
    809821  new MoleculeRotateToPrincipalAxisSystemAction();
    810822  new MoleculeSaveAdjacencyAction();
  • src/Actions/MoleculeAction/BondFileAction.hpp

    re588312 rb5c53d  
    1010
    1111#include "Actions/Action.hpp"
    12 #include "Actions/Process.hpp"
     12
    1313
    1414class MoleculeListClass;
  • src/Actions/MoleculeAction/ChangeNameAction.hpp

    re588312 rb5c53d  
    1010
    1111#include "Actions/Action.hpp"
    12 #include "Actions/Process.hpp"
     12
    1313
    1414class MoleculeListClass;
  • src/Actions/MoleculeAction/FillWithMoleculeAction.hpp

    re588312 rb5c53d  
    1010
    1111#include "Actions/Action.hpp"
    12 #include "Actions/Process.hpp"
    1312#include "LinearAlgebra/Vector.hpp"
    1413
  • src/Actions/MoleculeAction/LinearInterpolationofTrajectoriesAction.hpp

    re588312 rb5c53d  
    1010
    1111#include "Actions/Action.hpp"
    12 #include "Actions/Process.hpp"
     12
    1313
    1414class MoleculeListClass;
  • src/Actions/MoleculeAction/RotateToPrincipalAxisSystemAction.cpp

    re588312 rb5c53d  
    1111#include "Actions/ActionRegistry.hpp"
    1212#include "Helpers/Log.hpp"
     13#include "Helpers/Verbose.hpp"
     14#include "LinearAlgebra/Line.hpp"
     15#include "LinearAlgebra/Matrix.hpp"
     16#include "LinearAlgebra/Vector.hpp"
     17#include "element.hpp"
    1318#include "molecule.hpp"
    14 #include "Helpers/Verbose.hpp"
    1519
    1620
     
    4852{}
    4953
    50 void MoleculeRotateToPrincipalAxisSystem() {
     54void MoleculeRotateToPrincipalAxisSystem(Vector &Axis) {
     55  ValueStorage::getInstance().setCurrentValue(MoleculeRotateToPrincipalAxisSystemAction::NAME, Axis);
    5156  ActionRegistry::getInstance().getActionByName(MoleculeRotateToPrincipalAxisSystemAction::NAME)->call(Action::NonInteractive);
    5257};
     
    5560  ASSERT(dialog,"No Dialog given when filling action dialog");
    5661
    57   dialog->queryEmpty(NAME, MapOfActions::getInstance().getDescription(NAME));
     62  dialog->queryVector(NAME, false, MapOfActions::getInstance().getDescription(NAME));
    5863
    5964  return dialog;
     
    6267Action::state_ptr MoleculeRotateToPrincipalAxisSystemAction::performCall() {
    6368  molecule *mol = NULL;
     69  Vector Axis;
     70
     71  // obtain axis to rotate to
     72  ValueStorage::getInstance().queryCurrentValue(NAME, Axis);
    6473
    6574  for (World::MoleculeSelectionIterator iter = World::getInstance().beginMoleculeSelection(); iter != World::getInstance().endMoleculeSelection(); ++iter) {
    6675    mol = iter->second;
    6776    DoLog(0) && (Log() << Verbose(0) << "Converting to prinicipal axis system." << endl);
    68     mol->PrincipalAxisSystem(true);
     77    Matrix InertiaTensor;
     78    Vector *CenterOfGravity = mol->DetermineCenterOfGravity();
     79
     80    // reset inertia tensor
     81    InertiaTensor.zero();
     82
     83    // sum up inertia tensor
     84    for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
     85      Vector x = (*iter)->getPosition();
     86      x -= *CenterOfGravity;
     87      const double mass = (*iter)->getType()->mass;
     88      InertiaTensor.at(0,0) += mass*(x[1]*x[1] + x[2]*x[2]);
     89      InertiaTensor.at(0,1) += mass*(-x[0]*x[1]);
     90      InertiaTensor.at(0,2) += mass*(-x[0]*x[2]);
     91      InertiaTensor.at(1,0) += mass*(-x[1]*x[0]);
     92      InertiaTensor.at(1,1) += mass*(x[0]*x[0] + x[2]*x[2]);
     93      InertiaTensor.at(1,2) += mass*(-x[1]*x[2]);
     94      InertiaTensor.at(2,0) += mass*(-x[2]*x[0]);
     95      InertiaTensor.at(2,1) += mass*(-x[2]*x[1]);
     96      InertiaTensor.at(2,2) += mass*(x[0]*x[0] + x[1]*x[1]);
     97    }
     98    // print InertiaTensor for debugging
     99    DoLog(0) && (Log() << Verbose(0) << "The inertia tensor is:" << InertiaTensor << endl);
     100
     101    // diagonalize to determine principal axis system
     102    Vector Eigenvalues = InertiaTensor.transformToEigenbasis();
     103
     104    for(int i=0;i<NDIM;i++)
     105      DoLog(0) && (Log() << Verbose(0) << "eigenvalue = " << Eigenvalues[i] << ", eigenvector = " << InertiaTensor.column(i) << endl);
     106
     107    // check whether we rotate or not
     108    DoLog(0) && (Log() << Verbose(0) << "Transforming molecule into PAS ... ");
     109
     110    // obtain first column, eigenvector to biggest eigenvalue
     111    Vector BiggestEigenvector(InertiaTensor.column(Eigenvalues.SmallestComponent()));
     112    Vector DesiredAxis(Axis);
     113
     114    // Creation Line that is the rotation axis
     115    DesiredAxis.VectorProduct(BiggestEigenvector);
     116    Line RotationAxis(Vector(0.,0.,0.), DesiredAxis);
     117
     118    // determine angle
     119    const double alpha = BiggestEigenvector.Angle(Axis);
     120
     121    DoLog(0) && (Log() << Verbose(0) << alpha << endl);
     122
     123    for (molecule::iterator iter = mol->begin(); iter != mol->end(); ++iter) {
     124      *(*iter) -= *CenterOfGravity;
     125      (*iter)->setPosition(RotationAxis.rotateVector((*iter)->getPosition(), alpha));
     126      *(*iter) += *CenterOfGravity;
     127    }
     128    DoLog(0) && (Log() << Verbose(0) << "done." << endl);
     129
     130    // summing anew for debugging (resulting matrix has to be diagonal!)
     131    // reset inertia tensor
     132    InertiaTensor.zero();
     133
     134    // sum up inertia tensor
     135    for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
     136      Vector x = (*iter)->getPosition();
     137      x -= *CenterOfGravity;
     138      const double mass = (*iter)->getType()->mass;
     139      InertiaTensor.at(0,0) += mass*(x[1]*x[1] + x[2]*x[2]);
     140      InertiaTensor.at(0,1) += mass*(-x[0]*x[1]);
     141      InertiaTensor.at(0,2) += mass*(-x[0]*x[2]);
     142      InertiaTensor.at(1,0) += mass*(-x[1]*x[0]);
     143      InertiaTensor.at(1,1) += mass*(x[0]*x[0] + x[2]*x[2]);
     144      InertiaTensor.at(1,2) += mass*(-x[1]*x[2]);
     145      InertiaTensor.at(2,0) += mass*(-x[2]*x[0]);
     146      InertiaTensor.at(2,1) += mass*(-x[2]*x[1]);
     147      InertiaTensor.at(2,2) += mass*(x[0]*x[0] + x[1]*x[1]);
     148      // print InertiaTensor for debugging
     149      DoLog(0) && (Log() << Verbose(0) << "The inertia tensor is:" << InertiaTensor << endl);
     150    }
     151
     152    // free everything
     153    delete(CenterOfGravity);
    69154  }
    70155  return Action::success;
  • src/Actions/MoleculeAction/RotateToPrincipalAxisSystemAction.hpp

    re588312 rb5c53d  
    1010
    1111#include "Actions/Action.hpp"
    12 #include "Actions/Process.hpp"
    1312
    1413class MoleculeListClass;
     14class Vector;
    1515
    16 void MoleculeRotateToPrincipalAxisSystem();
     16void MoleculeRotateToPrincipalAxisSystem(Vector &Axis);
    1717
    1818class MoleculeRotateToPrincipalAxisSystemAction : public Action {
    19   friend void MoleculeRotateToPrincipalAxisSystem();
     19  friend void MoleculeRotateToPrincipalAxisSystem(Vector &Axis);
    2020
    2121public:
  • src/Actions/MoleculeAction/SaveAdjacencyAction.hpp

    re588312 rb5c53d  
    1010
    1111#include "Actions/Action.hpp"
    12 #include "Actions/Process.hpp"
     12
    1313
    1414class MoleculeListClass;
  • src/Actions/MoleculeAction/SaveBondsAction.hpp

    re588312 rb5c53d  
    1010
    1111#include "Actions/Action.hpp"
    12 #include "Actions/Process.hpp"
     12
    1313
    1414class MoleculeListClass;
  • src/Actions/MoleculeAction/SaveTemperatureAction.hpp

    re588312 rb5c53d  
    1010
    1111#include "Actions/Action.hpp"
    12 #include "Actions/Process.hpp"
     12
    1313
    1414class MoleculeListClass;
  • src/Actions/MoleculeAction/SuspendInWaterAction.hpp

    re588312 rb5c53d  
    1010
    1111#include "Actions/Action.hpp"
    12 #include "Actions/Process.hpp"
     12
    1313
    1414class MoleculeListClass;
  • src/Actions/MoleculeAction/TranslateAction.hpp

    re588312 rb5c53d  
    1010
    1111#include "Actions/Action.hpp"
    12 #include "Actions/Process.hpp"
    1312#include "LinearAlgebra/Vector.hpp"
    1413
  • src/Actions/MoleculeAction/VerletIntegrationAction.hpp

    re588312 rb5c53d  
    1010
    1111#include "Actions/Action.hpp"
    12 #include "Actions/Process.hpp"
     12
    1313
    1414class MoleculeListClass;
  • src/Actions/ParserAction/LoadXyzAction.hpp

    re588312 rb5c53d  
    1010
    1111#include "Actions/Action.hpp"
    12 #include "Actions/Process.hpp"
     12
    1313
    1414void ParserLoadXyz(std::string &filename);
  • src/Actions/ParserAction/SaveXyzAction.hpp

    re588312 rb5c53d  
    1010
    1111#include "Actions/Action.hpp"
    12 #include "Actions/Process.hpp"
     12
    1313
    1414void ParserSaveXyz(std::string &filename);
  • src/Actions/TesselationAction/ConvexEnvelopeAction.cpp

    re588312 rb5c53d  
    1515#include "Helpers/Log.hpp"
    1616#include "molecule.hpp"
     17#include "tesselation.hpp"
    1718#include "Helpers/Verbose.hpp"
    1819#include "World.hpp"
     
    8485    DoLog(1) && (Log() << Verbose(1) << "Storing tecplot non-convex data in " << filenameNonConvex << "." << endl);
    8586    LCList = new LinkedCell(mol, 100.);
    86     Boundaries *BoundaryPoints = NULL;
     87    //Boundaries *BoundaryPoints = NULL;
    8788    //FindConvexBorder(mol, BoundaryPoints, TesselStruct, LCList, argv[argptr]);
    8889    // TODO: Beide Funktionen sollten streams anstelle des Filenamen benutzen, besser fuer unit tests
  • src/Actions/TesselationAction/ConvexEnvelopeAction.hpp

    re588312 rb5c53d  
    1010
    1111#include "Actions/Action.hpp"
    12 #include "Actions/Process.hpp"
     12
    1313
    1414class TesselationListClass;
  • src/Actions/TesselationAction/NonConvexEnvelopeAction.cpp

    re588312 rb5c53d  
    1414#include "Helpers/Log.hpp"
    1515#include "molecule.hpp"
     16#include "tesselation.hpp"
    1617#include "Helpers/Verbose.hpp"
    1718#include "World.hpp"
  • src/Actions/TesselationAction/NonConvexEnvelopeAction.hpp

    re588312 rb5c53d  
    1010
    1111#include "Actions/Action.hpp"
    12 #include "Actions/Process.hpp"
     12
    1313
    1414class TesselationListClass;
  • src/Actions/WorldAction/AddEmptyBoundaryAction.cpp

    re588312 rb5c53d  
    6060  ASSERT(AllAtoms.size() > 0, "There must be atoms present for AddingEmptyBoundary.");
    6161  vector<atom *>::iterator AtomRunner = AllAtoms.begin();
    62   Min = (*AtomRunner)->x;
    63   Max = (*AtomRunner)->x;
     62  Min = (*AtomRunner)->getPosition();
     63  Max = (*AtomRunner)->getPosition();
    6464  for (; AtomRunner != AllAtoms.end(); ++AtomRunner) {
    6565    for (int i=0;i<NDIM;i++) {
    66       if ((*AtomRunner)->x[i] > Max[i])
    67         Max[i] = (*AtomRunner)->x[i];
    68       if ((*AtomRunner)->x[i] < Min[i])
    69         Min[i] = (*AtomRunner)->x[i];
     66      if ((*AtomRunner)->at(i) > Max[i])
     67        Max[i] = (*AtomRunner)->at(i);
     68      if ((*AtomRunner)->at(i) < Min[i])
     69        Min[i] = (*AtomRunner)->at(i);
    7070    }
    7171  }
     
    8484  AtomRunner = AllAtoms.begin();
    8585  for (; AtomRunner != AllAtoms.end(); ++AtomRunner)
    86     (*AtomRunner)->x -= Min - boundary;
     86    *(*AtomRunner) -= Min - boundary;
    8787  return Action::success;
    8888}
  • src/Actions/WorldAction/CenterOnEdgeAction.cpp

    re588312 rb5c53d  
    5555  ASSERT(AllAtoms.size() > 0, "For CenteronEdge atoms must be present.");
    5656  vector<atom *>::iterator AtomRunner = AllAtoms.begin();
    57   Min = (*AtomRunner)->x;
    58   Max = (*AtomRunner)->x;
     57  Min = (*AtomRunner)->getPosition();
     58  Max = (*AtomRunner)->getPosition();
    5959  for (; AtomRunner != AllAtoms.end(); ++AtomRunner) {
    6060    for (int i=0;i<NDIM;i++) {
    61       if ((*AtomRunner)->x[i] > Max[i])
    62         Max[i] = (*AtomRunner)->x[i];
    63       if ((*AtomRunner)->x[i] < Min[i])
    64         Min[i] = (*AtomRunner)->x[i];
     61      if ((*AtomRunner)->at(i) > Max[i])
     62        Max[i] = (*AtomRunner)->at(i);
     63      if ((*AtomRunner)->at(i) < Min[i])
     64        Min[i] = (*AtomRunner)->at(i);
    6565    }
    6666  }
     
    7575  // translate all atoms, such that Min is aty (0,0,0)
    7676  for (vector<atom*>::iterator AtomRunner = AllAtoms.begin(); AtomRunner != AllAtoms.end(); ++AtomRunner)
    77     (*AtomRunner)->x -= Min;
     77    *(*AtomRunner) -= Min;
    7878
    7979  return Action::success;
  • src/Actions/WorldAction/RemoveSphereOfAtomsAction.cpp

    re588312 rb5c53d  
    6262  vector<molecule *> molecules = World::getInstance().getAllMolecules();
    6363  for (vector<atom*>::iterator AtomRunner = AllAtoms.begin(); AtomRunner != AllAtoms.end(); ++AtomRunner) {
    64     if (point.DistanceSquared((*AtomRunner)->x) > radius*radius) { // distance to first above radius ...
     64    if ((*AtomRunner)->DistanceSquared(point) > radius*radius) { // distance to first above radius ...
     65//      cout << "Removing " << (*AtomRunner)->getType()->symbol << (*AtomRunner)->getId() << " at " << (*AtomRunner)->getPosition() << " as distance is " << sqrt((*AtomRunner)->DistanceSquared(point)) << endl;
    6566      // TODO: This is not necessary anymore when atoms are completely handled by World (create/destroy and load/save)
    6667      for (vector<molecule *>::iterator iter = molecules.begin();iter != molecules.end();++iter)
     
    6869      World::getInstance().destroyAtom(*AtomRunner);
    6970    }
     71//    else {
     72//      cout << "Keeping" << (*AtomRunner)->getType()->symbol << (*AtomRunner)->getId() << " at " << (*AtomRunner)->getPosition() << " as distance is " << sqrt((*AtomRunner)->DistanceSquared(point)) << endl;
     73//    }
    7074  }
    7175  return Action::success;
  • src/Actions/WorldAction/RepeatBoxAction.cpp

    re588312 rb5c53d  
    2121#include <iostream>
    2222#include <string>
     23#include <vector>
    2324
    2425using namespace std;
     
    9091
    9192  molecule *newmol = NULL;
    92   Vector ** vectors = NULL;
     93  std::vector<Vector> vectors;
    9394  for (n[0] = 0; n[0] < Repeater[0]; n[0]++) {
    9495    y[0] = n[0];
     
    105106          if (count != 0) {  // if there is more than none
    106107            Elements = new const element *[count];
    107             vectors = new Vector *[count];
     108            vectors.resize(count);
    108109            j = 0;
    109110            for(molecule::iterator AtomRunner = mol->begin(); AtomRunner != mol->end(); ++AtomRunner) {
    110               Elements[j] = (*AtomRunner)->type;
    111               vectors[j] = &(*AtomRunner)->x;
     111              Elements[j] = (*AtomRunner)->getType();
     112              vectors[j] = (*AtomRunner)->getPosition();
    112113              j++;
    113114            }
     
    120121            for (int k=count;k--;) { // go through every atom of the original cell
    121122              Walker = World::getInstance().createAtom(); // create a new body
    122               Walker->x = (*vectors[k]) + x;
    123               Walker->type = Elements[k];  // insert original element
     123              Walker->setPosition((vectors[k]) + x);
     124              Walker->setType(Elements[k]);  // insert original element
    124125              cout << "new atom is " << *Walker << endl;
    125126              newmol->AddAtom(Walker);        // and add to the molecule (which increments ElementsInMolecule, AtomCount, ...)
     
    127128            // free memory
    128129            delete[](Elements);
    129             delete[](vectors);
    130130          } else {
    131131            DoLog(1) && (Log() << Verbose(1) << "\t ... is empty." << endl);
  • src/Actions/WorldAction/ScaleBoxAction.cpp

    re588312 rb5c53d  
    6060  vector<atom*> AllAtoms = World::getInstance().getAllAtoms();
    6161  for(vector<atom*>::iterator AtomRunner = AllAtoms.begin(); AtomRunner != AllAtoms.end(); ++AtomRunner) {
    62     (*AtomRunner)->x.ScaleAll(x);
     62    (*AtomRunner)->ScaleAll(x);
    6363  }
    6464
  • src/AtomSet.hpp

    re588312 rb5c53d  
    6565    workOnNodePointer(Function &_f) : f(_f){}
    6666    void operator()(atom *atom){
    67       if(atom->node)
    68         *atom->node = f(*atom->node);
     67      atom->setPosition(f(atom->getPosition()));
    6968    }
    7069    Function &f;
     
    7574inline void AtomSetMixin<Set>::translate(const Vector &translater){
    7675  BOOST_FOREACH(atom *atom,*this){
    77     if(atom->node){
    78       *(atom->node) += translater;
    79     }
     76    *(atom) += translater;
    8077  }
    8178}
  • src/ConfigFileBuffer.cpp

    re588312 rb5c53d  
    5151/** Constructor for ConfigFileBuffer class.
    5252 */
    53 ConfigFileBuffer::ConfigFileBuffer() : buffer(NULL), LineMapping(NULL), CurrentLine(0), NoLines(0)
     53ConfigFileBuffer::ConfigFileBuffer() :
     54    buffer(NULL),
     55    LineMapping(NULL),
     56    CurrentLine(0),
     57    NoLines(0)
    5458{
    5559};
     
    5862 * \param *filename file name
    5963 */
    60 ConfigFileBuffer::ConfigFileBuffer(const char * const filename) : buffer(NULL), LineMapping(NULL), CurrentLine(0), NoLines(0)
     64ConfigFileBuffer::ConfigFileBuffer(const char * const filename) :
     65    buffer(NULL),
     66    LineMapping(NULL),
     67    CurrentLine(0),
     68    NoLines(0)
    6169{
    6270  InitFileBuffer(filename);
  • src/Helpers/Info.cpp

    re588312 rb5c53d  
    1919 * \return Info instance
    2020 */
    21 Info::Info(const char *msg)
     21Info::Info(const char *msg) :
     22  FunctionName(msg)
    2223{
    2324  verbosity++;
    24   FunctionName = msg;
    2525  DoLog(0) && (Log() << Verbose(0) << "Begin of " << FunctionName << endl);
    2626};
  • src/Helpers/errorlogger.cpp

    re588312 rb5c53d  
    2424 */
    2525errorLogger::errorLogger()
    26 {
    27   verbosity = 2;
    28 };
     26{};
    2927
    3028/**
    3129 * Destructor. Better use purgeInstance().
    3230 */
    33 errorLogger::~errorLogger() {
    34   verbosity = 2;
    35 }
     31errorLogger::~errorLogger()
     32{}
    3633
    3734CONSTRUCT_SINGLETON(errorLogger)
  • src/Helpers/logger.cpp

    re588312 rb5c53d  
    2525 */
    2626logger::logger()
    27 {
    28   verbosity = 2;
    29 };
     27{};
    3028
    3129/**
    3230 * Destructor. Better use purgeInstance().
    3331 */
    34 logger::~logger() {
    35   verbosity = 2;
    36 }
     32logger::~logger() {}
    3733
    3834CONSTRUCT_SINGLETON(logger)
  • src/Legacy/oldmenu.cpp

    re588312 rb5c53d  
    8989        first = World::getInstance().createAtom();
    9090        std::vector<element *> elements;
    91         dialog->queryVector("Please enter coordinates: ",&first->x,World::getInstance().getDomain(), false);
     91        dialog->queryVector("Please enter coordinates: ",&first->AtomicPosition,World::getInstance().getDomain(), false);
    9292        dialog->queryElement("Please choose element: ",&elements);
    9393        if(dialog->display()){
    9494          if (elements.size() == 1) {
    95             first->type = elements.at(0);
     95            first->setType(elements.at(0));
    9696            mol->AddAtom(first);  // add to molecule
    9797          } else {
     
    113113          auto_ptr<Dialog> dialog(UIFactory::getInstance().makeDialog());
    114114          dialog->queryVector("Enter reference coordinates.",&x,World::getInstance().getDomain(), true);
    115           dialog->queryVector("Enter relative coordinates.",&first->x,World::getInstance().getDomain(), false);
     115          dialog->queryVector("Enter relative coordinates.",&first->AtomicPosition,World::getInstance().getDomain(), false);
    116116          if((aborted = !dialog->display())){
    117117            continue;
    118118          }
    119           first->x += x;
    120         } while (!aborted && !(valid = mol->CheckBounds((const Vector *)&first->x)));
     119          first->AtomicPosition += x;
     120        } while (!aborted && !(valid = mol->CheckBounds((const Vector *)&first->AtomicPosition)));
    121121        if(!aborted){
    122           first->type = periode->AskElement();  // give type
     122          first->AtomicElement = periode->AskElement();  // give type
    123123          mol->AddAtom(first);  // add to molecule
    124124        }
     
    136136          auto_ptr<Dialog> dialog(UIFactory::getInstance().makeDialog());
    137137          second = mol->AskAtom("Enter atom number: ");
    138           dialog->queryVector("Enter relative coordinates.",&first->x,World::getInstance().getDomain(), false);
     138          dialog->queryVector("Enter relative coordinates.",&first->AtomicPosition,World::getInstance().getDomain(), false);
    139139          dialog->display();
    140140          for (int i=NDIM;i--;) {
    141             first->x[i] += second->x[i];
     141            first->AtomicPosition[i] += second->AtomicPosition[i];
    142142          }
    143         } while (!(valid = mol->CheckBounds((const Vector *)&first->x)));
    144         first->type = periode->AskElement();  // give type
     143        } while (!(valid = mol->CheckBounds((const Vector *)&first->AtomicPosition)));
     144        first->AtomicElement = periode->AskElement();  // give type
    145145        mol->AddAtom(first);  // add to molecule
    146146      }
     
    152152        do {
    153153          if (!valid) {
    154             eLog() << Verbose(2) << "Resulting coordinates out of cell - " << first->x << endl;
     154            eLog() << Verbose(2) << "Resulting coordinates out of cell - " << first->AtomicPosition << endl;
    155155          }
    156156          Log() << Verbose(0) << "First, we need two atoms, the first atom is the central, while the second is the outer one." << endl;
     
    185185          */
    186186          // calc axis vector
    187           x= second->x - third->x;
     187          x= second->AtomicPosition - third->AtomicPosition;
    188188          x.Normalize();
    189189          Log() << Verbose(0) << "x: " << x << endl;
    190           z = Plane(second->x,third->x,fourth->x).getNormal();
     190          z = Plane(second->AtomicPosition,third->AtomicPosition,fourth->AtomicPosition).getNormal();
    191191          Log() << Verbose(0) << "z: " << z << endl;
    192192          y = Plane(x,z,0).getNormal();
     
    194194
    195195          // rotate vector around first angle
    196           first->x = x;
    197           first->x = Line(zeroVec,z).rotateVector(first->x,b - M_PI);
    198           Log() << Verbose(0) << "Rotated vector: " << first->x << endl,
     196          first->AtomicPosition = x;
     197          first->AtomicPosition = Line(zeroVec,z).rotateVector(first->AtomicPosition,b - M_PI);
     198          Log() << Verbose(0) << "Rotated vector: " << first->AtomicPosition << endl,
    199199          // remove the projection onto the rotation plane of the second angle
    200200          n = y;
    201           n.Scale(first->x.ScalarProduct(y));
     201          n.Scale(first->AtomicPosition.ScalarProduct(y));
    202202          Log() << Verbose(0) << "N1: " << n << endl;
    203           first->x -= n;
    204           Log() << Verbose(0) << "Subtracted vector: " << first->x << endl;
     203          first->AtomicPosition -= n;
     204          Log() << Verbose(0) << "Subtracted vector: " << first->AtomicPosition << endl;
    205205          n = z;
    206           n.Scale(first->x.ScalarProduct(z));
     206          n.Scale(first->AtomicPosition.ScalarProduct(z));
    207207          Log() << Verbose(0) << "N2: " << n << endl;
    208           first->x -= n;
    209           Log() << Verbose(0) << "2nd subtracted vector: " << first->x << endl;
     208          first->AtomicPosition -= n;
     209          Log() << Verbose(0) << "2nd subtracted vector: " << first->AtomicPosition << endl;
    210210
    211211          // rotate another vector around second angle
     
    215215
    216216          // add the two linear independent vectors
    217           first->x += n;
    218           first->x.Normalize();
    219           first->x.Scale(a);
    220           first->x += second->x;
    221 
    222           Log() << Verbose(0) << "resulting coordinates: " << first->x << endl;
    223         } while (!(valid = mol->CheckBounds((const Vector *)&first->x)));
    224         first->type = periode->AskElement();  // give type
     217          first->AtomicPosition += n;
     218          first->AtomicPosition.Normalize();
     219          first->AtomicPosition.Scale(a);
     220          first->AtomicPosition += second->AtomicPosition;
     221
     222          Log() << Verbose(0) << "resulting coordinates: " << first->AtomicPosition << endl;
     223        } while (!(valid = mol->CheckBounds((const Vector *)&first->AtomicPosition)));
     224        first->AtomicElement = periode->AskElement();  // give type
    225225        mol->AddAtom(first);  // add to molecule
    226226        break;
     
    239239          if (j != -1) {
    240240            second = mol->FindAtom(j);
    241             atoms[i++] = &(second->x);
     241            atoms[i++] = &(second->AtomicPosition);
    242242          }
    243243        } while ((j != -1) && (i<128));
    244244        if (i >= 2) {
    245           LSQdistance(first->x,(const Vector **)atoms, i);
    246 
    247           Log() << Verbose(0) << first->x;
    248           first->type = periode->AskElement();  // give type
     245          LSQdistance(first->AtomicPosition,(const Vector **)atoms, i);
     246
     247          Log() << Verbose(0) << first->AtomicPosition;
     248          first->AtomicElement = periode->AskElement();  // give type
    249249          mol->AddAtom(first);  // add to molecule
    250250        } else {
     
    338338      third = mol->AskAtom("Enter third atom: ");
    339339
    340       n = Plane(first->x,second->x,third->x).getNormal();
     340      n = Plane(first->AtomicPosition,second->AtomicPosition,third->AtomicPosition).getNormal();
    341341      break;
    342342    case 'b': // normal vector of mirror plane
     
    354354      second = mol->AskAtom("Enter second atom: ");
    355355
    356       n = first->x - second->x;
     356      n = first->AtomicPosition - second->AtomicPosition;
    357357      n.Normalize();
    358358      break;
     
    405405      third = mol->AskAtom("Enter third atom: ");
    406406
    407       n = Plane(first->x,second->x,third->x).getNormal();
     407      n = Plane(first->AtomicPosition,second->AtomicPosition,third->AtomicPosition).getNormal();
    408408      break;
    409409    case 'b': // normal vector of mirror plane
     
    421421      second = mol->AskAtom("Enter second atom: ");
    422422
    423       n = first->x - second->x;
     423      n = first->AtomicPosition - second->AtomicPosition;
    424424      n.Normalize();
    425425      break;
     
    464464        for (molecule::iterator iter = mol->begin(); iter != mol->end(); ) {
    465465          runner = iter++;
    466           if ((*runner)->x.DistanceSquared((*runner)->x) > tmp1*tmp1) // distance to first above radius ...
     466          if ((*runner)->AtomicPosition.DistanceSquared((*runner)->AtomicPosition) > tmp1*tmp1) // distance to first above radius ...
    467467            mol->RemoveAtom((*runner));
    468468        }
     
    479479      for (molecule::iterator iter = mol->begin(); iter != mol->end(); ) {
    480480        runner = iter++;
    481         if (((*runner)->x[axis] < tmp1) || ((*runner)->x[axis] > tmp2)) {// out of boundary ...
     481        if (((*runner)->AtomicPosition[axis] < tmp1) || ((*runner)->AtomicPosition[axis] > tmp2)) {// out of boundary ...
    482482          //Log() << Verbose(0) << "Atom " << *(*runner) << " with " << (*runner)->x.x[axis] << " on axis " << axis << " is out of bounds [" << tmp1 << "," << tmp2 << "]." << endl;
    483483          mol->RemoveAtom((*runner));
     
    526526
    527527      for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    528         Z = (*iter)->type->Z;
     528        Z = (*iter)->getType()->Z;
    529529        tmp1 = 0.;
    530530        if (first != (*iter)) {
    531           x = first->x - (*iter)->x;
     531          x = first->AtomicPosition - (*iter)->AtomicPosition;
    532532          tmp1 = x.Norm();
    533533        }
     
    536536      }
    537537      for (int i=MAX_ELEMENTS;i--;)
    538         if (min[i] != 0.) Log() << Verbose(0) << "Minimum Bond length between " << first->type->name << " Atom " << first->nr << " and next Ion of type " << (periode->FindElement(i))->name << ": " << min[i] << " a.u." << endl;
     538        if (min[i] != 0.) Log() << Verbose(0) << "Minimum Bond length between " << first->getType()->name << " Atom " << first->nr << " and next Ion of type " << (periode->FindElement(i))->name << ": " << min[i] << " a.u." << endl;
    539539      break;
    540540
     
    544544      for (int i=NDIM;i--;)
    545545        min[i] = 0.;
    546       x = first->x - second->x;
     546      x = first->AtomicPosition - second->AtomicPosition;
    547547      tmp1 = x.Norm();
    548548      Log() << Verbose(1) << "Distance vector is " << x << "." << "/n"
     
    556556      third  = mol->AskAtom("Enter last atom: ");
    557557      tmp1 = tmp2 = tmp3 = 0.;
    558       x = first->x - second->x;
    559       y = third->x - second->x;
     558      x = first->AtomicPosition - second->AtomicPosition;
     559      y = third->AtomicPosition - second->AtomicPosition;
    560560      Log() << Verbose(0) << "Bond angle between first atom Nr." << first->nr << ", central atom Nr." << second->nr << " and last atom Nr." << third->nr << ": ";
    561561      Log() << Verbose(0) << (acos(x.ScalarProduct(y)/(y.Norm()*x.Norm()))/M_PI*180.) << " degrees" << endl;
     
    695695        minBond = 0.;
    696696        for (int i=NDIM;i--;)
    697           minBond += (first->x[i]-second->x[i])*(first->x[i] - second->x[i]);
     697          minBond += (first->AtomicPosition[i]-second->AtomicPosition[i])*(first->AtomicPosition[i] - second->AtomicPosition[i]);
    698698        minBond = sqrt(minBond);
    699         Log() << Verbose(0) << "Current Bond length between " << first->type->name << " Atom " << first->nr << " and " << second->type->name << " Atom " << second->nr << ": " << minBond << " a.u." << endl;
     699        Log() << Verbose(0) << "Current Bond length between " << first->getType()->name << " Atom " << first->nr << " and " << second->getType()->name << " Atom " << second->nr << ": " << minBond << " a.u." << endl;
    700700        Log() << Verbose(0) << "Enter new bond length [a.u.]: ";
    701701        cin >> bond;
    702702        for (int i=NDIM;i--;) {
    703           second->x[i] -= (second->x[i]-first->x[i])/minBond*(minBond-bond);
     703          second->AtomicPosition[i] -= (second->AtomicPosition[i]-first->AtomicPosition[i])/minBond*(minBond-bond);
    704704        }
    705705        //Log() << Verbose(0) << "New coordinates of Atom " << second->nr << " are: ";
     
    757757        cin >> Z;
    758758        first->setType(Z);
    759         Log() << Verbose(0) << "Atom " << first->nr << "'s element is " << first->type->name << "." << endl;
     759        Log() << Verbose(0) << "Atom " << first->nr << "'s element is " << first->getType()->name << "." << endl;
    760760      }
    761761      break;
     
    785785      j = 0;
    786786      for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    787         Elements[j] = (*iter)->type;
    788         vectors[j] = &(*iter)->x;
     787        Elements[j] = (*iter)->AtomicElement;
     788        vectors[j] = &(*iter)->AtomicPosition;
    789789        j++;
    790790      }
     
    798798        for (int k=count;k--;) { // go through every atom of the original cell
    799799          first = World::getInstance().createAtom(); // create a new body
    800           first->x = (*vectors[k]) + x;  // use coordinate of original atom
    801           first->type = Elements[k];  // insert original element
     800          first->AtomicPosition = (*vectors[k]) + x;  // use coordinate of original atom
     801          first->AtomicElement = Elements[k];  // insert original element
    802802          mol->AddAtom(first);        // and add to the molecule (which increments ElementsInMolecule, AtomCount, ...)
    803803        }
  • src/LinearAlgebra/Line.cpp

    re588312 rb5c53d  
    1111
    1212#include <cmath>
     13#include <iostream>
    1314
    1415#include "LinearAlgebra/Vector.hpp"
     
    240241  return Line(x1,x1-x2);
    241242}
     243
     244ostream& operator<<(ostream& ost, const Line& m)
     245{
     246  const Vector origin = m.getOrigin();
     247  const Vector direction = m.getDirection();
     248  ost << "(";
     249  for (int i=0;i<NDIM;i++) {
     250    ost << origin[i];
     251    if (i != 2)
     252      ost << ",";
     253  }
     254  ost << ") -> (";
     255  for (int i=0;i<NDIM;i++) {
     256    ost << direction[i];
     257    if (i != 2)
     258      ost << ",";
     259  }
     260  ost << ")";
     261  return ost;
     262};
     263
  • src/LinearAlgebra/Line.hpp

    re588312 rb5c53d  
    1111#include "LinearAlgebra/Space.hpp"
    1212
     13#include <iosfwd>
    1314#include <memory>
    1415#include <vector>
     
    4546};
    4647
     48std::ostream & operator << (std::ostream& ost, const Line &m);
     49
    4750/**
    4851 * Named constructor to make a line through two points
  • src/LinearAlgebra/Makefile.am

    re588312 rb5c53d  
    1717  Plane.cpp \
    1818  Space.cpp \
    19   Vector.cpp
     19  vector_ops.cpp \
     20  Vector.cpp \
     21  VectorInterface.cpp
    2022                           
    2123LINALGHEADER = \
     
    2729  Plane.hpp \
    2830  Space.hpp \
    29   Vector.hpp
     31  vector_ops.hpp \
     32  Vector.hpp \
     33  VectorInterface.hpp
    3034
    3135
  • src/LinearAlgebra/Matrix.cpp

    re588312 rb5c53d  
    1616
    1717#include <gsl/gsl_blas.h>
     18#include <gsl/gsl_eigen.h>
     19#include <gsl/gsl_matrix.h>
     20#include <gsl/gsl_multimin.h>
     21#include <gsl/gsl_vector.h>
    1822#include <cmath>
    1923#include <iostream>
     
    96100}
    97101
     102void Matrix::zero(){
     103  for(int i=NDIM;i--;){
     104    for(int j=NDIM;j--;){
     105      set(i,j,0.);
     106    }
     107  }
     108}
     109
    98110Matrix &Matrix::operator=(const Matrix &src){
    99111  if(&src!=this){
     
    103115}
    104116
    105 Matrix &Matrix::operator+=(const Matrix &rhs){
     117const Matrix &Matrix::operator+=(const Matrix &rhs){
    106118  gsl_matrix_add(content->content, rhs.content->content);
    107119  return *this;
    108120}
    109121
    110 Matrix &Matrix::operator-=(const Matrix &rhs){
     122const Matrix &Matrix::operator-=(const Matrix &rhs){
    111123  gsl_matrix_sub(content->content, rhs.content->content);
    112124  return *this;
    113125}
    114126
    115 Matrix &Matrix::operator*=(const Matrix &rhs){
     127const Matrix &Matrix::operator*=(const Matrix &rhs){
    116128  (*this) = (*this)*rhs;
    117129  return *this;
    118130}
    119131
    120 Matrix Matrix::operator+(const Matrix &rhs) const{
     132const Matrix Matrix::operator+(const Matrix &rhs) const{
    121133  Matrix tmp = *this;
    122134  tmp+=rhs;
     
    124136}
    125137
    126 Matrix Matrix::operator-(const Matrix &rhs) const{
     138const Matrix Matrix::operator-(const Matrix &rhs) const{
    127139  Matrix tmp = *this;
    128140  tmp-=rhs;
     
    130142}
    131143
    132 Matrix Matrix::operator*(const Matrix &rhs) const{
     144const Matrix Matrix::operator*(const Matrix &rhs) const{
    133145  gsl_matrix *res = gsl_matrix_alloc(NDIM, NDIM);
    134146  gsl_blas_dgemm(CblasNoTrans, CblasNoTrans, 1.0, content->content, rhs.content->content, 0.0, res);
     
    192204       - at(2,2)*at(1,0)*at(0,1);
    193205}
     206
     207Matrix Matrix::transpose() const
     208{
     209  Matrix copy(*this);
     210  copy.transpose();
     211  return copy;
     212}
     213
     214
     215void Matrix::transpose()
     216{
     217  double tmp;
     218  for (int i=0;i<NDIM;i++)
     219    for (int j=i+1;j<NDIM;j++) {
     220      tmp = at(j,i);
     221      at(i,j) = tmp;
     222      at(j,i) = tmp;
     223    }
     224}
     225
    194226
    195227Matrix Matrix::invert() const{
     
    213245}
    214246
    215 Matrix &Matrix::operator*=(const double factor){
     247Vector Matrix::transformToEigenbasis()
     248{
     249  gsl_eigen_symmv_workspace *T = gsl_eigen_symmv_alloc(NDIM);
     250  gsl_vector *eval = gsl_vector_alloc(NDIM);
     251  gsl_matrix *evec = gsl_matrix_alloc(NDIM, NDIM);
     252  gsl_eigen_symmv(content->content, eval, evec, T);
     253  gsl_eigen_symmv_free(T);
     254  gsl_matrix_memcpy(content->content, evec);
     255  Vector evalues(gsl_vector_get(eval,0), gsl_vector_get(eval,1), gsl_vector_get(eval,2));
     256  return evalues;
     257}
     258
     259const Matrix &Matrix::operator*=(const double factor){
    216260  gsl_matrix_scale(content->content, factor);
    217261  return *this;
    218262}
    219263
    220 Matrix operator*(const double factor,const Matrix& mat){
     264const Matrix operator*(const double factor,const Matrix& mat){
    221265  Matrix tmp = mat;
    222266  tmp*=factor;
     
    224268}
    225269
    226 Matrix operator*(const Matrix &mat,const double factor){
     270const Matrix operator*(const Matrix &mat,const double factor){
    227271  return factor*mat;
    228272}
  • src/LinearAlgebra/Matrix.hpp

    re588312 rb5c53d  
    5151
    5252  /**
     53   * Set all matrix entries to zero.
     54   */
     55  void zero();
     56
     57  /**
    5358   * Access the matrix at index (i,j)
    5459   */
     
    96101  Matrix invert() const;
    97102
     103  /**
     104   * Diagonalizes a matrix and sets its rows to the resulting eigenvalues.
     105   * The eigenvalues are returned as a vector.
     106   *
     107   * Rather costly, so use precomputation as often as possible.
     108   */
     109  Vector transformToEigenbasis();
     110
     111  /**
     112   * Calculate the transpose of the matrix.
     113   */
     114  Matrix transpose() const;
     115  void transpose();
     116
    98117  // operators
    99118  Matrix &operator=(const Matrix&);
    100119
    101   Matrix &operator+=(const Matrix&);
    102   Matrix &operator-=(const Matrix&);
    103   Matrix &operator*=(const Matrix&);
     120  const Matrix &operator+=(const Matrix&);
     121  const Matrix &operator-=(const Matrix&);
     122  const Matrix &operator*=(const Matrix&);
    104123
    105   Matrix &operator*=(const double);
     124  const Matrix &operator*=(const double);
    106125
    107   Matrix operator+(const Matrix&) const;
    108   Matrix operator-(const Matrix&) const;
    109   Matrix operator*(const Matrix&) const;
     126  const Matrix operator+(const Matrix&) const;
     127  const Matrix operator-(const Matrix&) const;
     128  const Matrix operator*(const Matrix&) const;
    110129
    111130  bool operator==(const Matrix&) const;
     
    121140};
    122141
    123 Matrix operator*(const double,const Matrix&);
    124 Matrix operator*(const Matrix&,const double);
     142const Matrix operator*(const double,const Matrix&);
     143const Matrix operator*(const Matrix&,const double);
    125144
    126145/**
  • src/LinearAlgebra/Vector.cpp

    re588312 rb5c53d  
    1717#include <iostream>
    1818#include <gsl/gsl_blas.h>
     19#include <gsl/gsl_vector.h>
    1920
    2021
     
    5152};
    5253
     54/** Constructor of class vector.
     55 */
     56Vector::Vector(const double x[3])
     57{
     58  content = new VectorContent();
     59  gsl_vector_set(content->content,0,x[0]);
     60  gsl_vector_set(content->content,1,x[1]);
     61  gsl_vector_set(content->content,2,x[2]);
     62};
     63
    5364Vector::Vector(VectorContent *_content) :
    5465  content(_content)
     
    92103  return (sqrt(DistanceSquared(y)));
    93104};
     105
     106size_t Vector::GreatestComponent() const
     107{
     108  int greatest = 0;
     109  for (int i=1;i<NDIM;i++) {
     110    if (at(i) > at(greatest))
     111      greatest = i;
     112  }
     113  return greatest;
     114}
     115
     116size_t Vector::SmallestComponent() const
     117{
     118  int smallest = 0;
     119  for (int i=1;i<NDIM;i++) {
     120    if (at(i) < at(smallest))
     121      smallest = i;
     122  }
     123  return smallest;
     124}
     125
    94126
    95127Vector Vector::getClosestPoint(const Vector &point) const{
  • src/LinearAlgebra/Vector.hpp

    re588312 rb5c53d  
    3636  Vector();
    3737  Vector(const double x1, const double x2, const double x3);
     38  Vector(const double x[3]);
    3839  Vector(const Vector& src);
    3940  virtual ~Vector();
     
    6364  std::pair<Vector,Vector> partition(const Vector&) const;
    6465  std::pair<pointset,Vector> partition(const pointset&) const;
     66  size_t GreatestComponent() const;
     67  size_t SmallestComponent() const;
    6568
    6669  // Accessors ussually come in pairs... and sometimes even more than that
  • src/Makefile.am

    re588312 rb5c53d  
    120120QTUI_DEFS =
    121121
     122TESSELATIONSOURCE = \
     123  BoundaryLineSet.cpp \
     124  BoundaryPointSet.cpp \
     125  BoundaryPolygonSet.cpp \
     126  BoundaryTriangleSet.cpp \
     127  CandidateForTesselation.cpp \
     128  PointCloud.cpp \
     129  tesselation.cpp \
     130  tesselationhelpers.cpp \
     131  TesselPoint.cpp
     132 
     133TESSELATIONHEADER = \
     134  BoundaryLineSet.hpp \
     135  BoundaryPointSet.hpp \
     136  BoundaryPolygonSet.hpp \
     137  BoundaryTriangleSet.hpp \
     138  CandidateForTesselation.hpp \
     139  PointCloud.hpp \
     140  tesselation.hpp \
     141  tesselationhelpers.hpp \
     142  TesselPoint.hpp
     143
    122144MOLECUILDERSOURCE = \
    123145  ${ANALYSISSOURCE} \
     
    125147  ${ATOMSOURCE} \
    126148  ${PATTERNSOURCE} \
    127   ${PARSERSOURCE} \
    128149  ${SHAPESOURCE} \
    129150  ${DESCRIPTORSOURCE} \
     151  ${TESSELATIONSOURCE} \
    130152  bond.cpp \
    131153  bondgraph.cpp \
     
    135157  config.cpp \
    136158  ConfigFileBuffer.cpp \
     159  defs.cpp \
    137160  element.cpp \
    138161  elements_db.cpp \
     
    151174  parser.cpp \
    152175  periodentafel.cpp \
    153   tesselation.cpp \
    154   tesselationhelpers.cpp \
    155176  ThermoStatContainer.cpp \
    156177  triangleintersectionlist.cpp \
    157178  UIElements/UIFactory.cpp \
    158   vector_ops.cpp \
    159179  World.cpp
    160180
     
    163183  ${ACTIONSHEADER} \
    164184  ${ATOMHEADER} \
    165   ${PARSERHEADER} \
    166185  ${PATTERNHEADER} \
    167186  ${SHAPEHEADER} \
    168187  ${DESCRIPTORHEADER} \
     188  ${TESSELATIONHEADER} \
    169189  bond.hpp \
    170190  bondgraph.hpp \
     
    188208  periodentafel.hpp \
    189209  stackclass.hpp \
    190   tesselation.hpp \
    191   tesselationhelpers.hpp \
    192210  ThermoStatContainer.hpp \
    193211  triangleintersectionlist.hpp \
    194212  UIElements/UIFactory.hpp \
    195   vector_ops.hpp \
    196213  World.hpp
    197214
     
    303320joiner_SOURCES = joiner.cpp datacreator.cpp datacreator.hpp periodentafel.hpp
    304321joiner_LDADD = \
     322        Actions/libMolecuilderActions-@MOLECUILDER_API_VERSION@.la \
    305323        libMolecuilder-@MOLECUILDER_API_VERSION@.la \
     324        Parser/libMolecuilderParser-@MOLECUILDER_API_VERSION@.la \
    306325        LinearAlgebra/libMolecuilderLinearAlgebra-@MOLECUILDER_API_VERSION@.la \
    307326        Exceptions/libMolecuilderExceptions-@MOLECUILDER_API_VERSION@.la \
     
    313332analyzer_SOURCES = analyzer.cpp datacreator.cpp periodentafel.hpp datacreator.hpp
    314333analyzer_LDADD = \
     334        Actions/libMolecuilderActions-@MOLECUILDER_API_VERSION@.la \
    315335        libMolecuilder-@MOLECUILDER_API_VERSION@.la \
     336        Parser/libMolecuilderParser-@MOLECUILDER_API_VERSION@.la \
    316337        LinearAlgebra/libMolecuilderLinearAlgebra-@MOLECUILDER_API_VERSION@.la \
    317338        Exceptions/libMolecuilderExceptions-@MOLECUILDER_API_VERSION@.la \
  • src/Parser/ChangeTracker.cpp

    re588312 rb5c53d  
    99#include "Parser/ChangeTracker.hpp"
    1010#include "Patterns/Singleton_impl.hpp"
    11 
     11#include "Helpers/Log.hpp"
     12#include "Helpers/Verbose.hpp"
    1213
    1314/**
     
    1516 */
    1617ChangeTracker::ChangeTracker() :
    17   Observable("ChangeTracker")
     18  Observable("ChangeTracker"),
     19  isConsistent(true)
    1820{
    19   isConsistent = true;
    2021  World::getInstance().signOn(this);
    2122}
     
    4950 */
    5051void ChangeTracker::saveStatus() {
     52  DoLog(0) && (Log() << Verbose(0) << "Saving changes." << std::endl);
    5153  if (hasChanged()) {
    5254    notifyAll();
  • src/Parser/FormatParser.cpp

    re588312 rb5c53d  
    1717 */
    1818FormatParser::FormatParser() :
    19   Observer("FormatParser")
     19  Observer("FormatParser"),
     20  saveStream(NULL)
    2021{
    2122  ChangeTracker::getInstance().signOn(this);
    22   saveStream = NULL;
    2323}
    2424
  • src/Parser/MpqcParser.cpp

    re588312 rb5c53d  
    1212#include "element.hpp"
    1313#include "Helpers/Log.hpp"
     14#include "Helpers/Verbose.hpp"
     15#include "LinearAlgebra/Vector.hpp"
    1416#include "periodentafel.hpp"
    15 #include "LinearAlgebra/Vector.hpp"
    16 #include "Helpers/Verbose.hpp"
    1717#include "World.hpp"
    1818
     
    2222 */
    2323MpqcParser::MpqcParser() : HessianPresent(false)
    24 {
    25 
    26 }
     24{}
    2725
    2826/** Destructor of MpqcParser.
    2927 *
    3028 */
    31 MpqcParser::~MpqcParser() {
    32 
    33 }
     29MpqcParser::~MpqcParser()
     30{}
    3431
    3532/** Load an MPQC config file into the World.
     
    4340void MpqcParser::save(ostream *file)
    4441{
     42  DoLog(0) && (Log() << Verbose(0) << "Saving changes to MPQC ." << std::endl);
     43
    4544  if (HessianPresent)
    4645    saveHessian(file);
     
    6059  // calculate center
    6160  for (vector<atom *>::iterator runner = allatoms.begin();runner != allatoms.end(); ++runner)
    62     center += (*runner)->x;
     61    center += (*runner)->getPosition();
    6362  center.Scale(1./allatoms.size());
    6463
     
    108107  // calculate center
    109108  for (vector<atom *>::iterator runner = allatoms.begin();runner != allatoms.end(); ++runner)
    110     center += (*runner)->x;
     109    center += (*runner)->getPosition();
    111110  center.Scale(1./allatoms.size());
    112111
  • src/Parser/PcpParser.cpp

    re588312 rb5c53d  
    1515#include "Helpers/Assert.hpp"
    1616#include "Helpers/Log.hpp"
     17#include "Helpers/Verbose.hpp"
     18#include "LinearAlgebra/Matrix.hpp"
    1719#include "molecule.hpp"
    1820#include "PcpParser.hpp"
    1921#include "periodentafel.hpp"
    2022#include "ThermoStatContainer.hpp"
    21 #include "Helpers/Verbose.hpp"
    2223#include "World.hpp"
    23 #include "LinearAlgebra/Matrix.hpp"
    2424#include "Box.hpp"
     25
     26
     27PcpParser::StructParallelization::StructParallelization() :
     28  ProcPEGamma(8),
     29  ProcPEPsi(1)
     30{}
     31
     32PcpParser::StructParallelization::~StructParallelization()
     33{}
     34
     35PcpParser::StructPaths::StructPaths() :
     36  databasepath(NULL),
     37  configname(NULL),
     38  mainname(NULL),
     39  defaultpath(NULL),
     40  pseudopotpath(NULL)
     41{}
     42
     43PcpParser::StructPaths::~StructPaths()
     44{}
     45
     46PcpParser::StructSwitches::StructSwitches() :
     47  DoConstrainedMD(0),
     48  DoOutVis(0),
     49  DoOutMes(1),
     50  DoOutNICS(0),
     51  DoOutOrbitals(0),
     52  DoOutCurrent(0),
     53  DoFullCurrent(0),
     54  DoPerturbation(0),
     55  DoWannier(0)
     56{}
     57
     58PcpParser::StructSwitches::~StructSwitches()
     59{}
     60
     61PcpParser::StructLocalizedOrbitals::StructLocalizedOrbitals() :
     62  CommonWannier(0),
     63  SawtoothStart(0.01),
     64  VectorPlane(0),
     65  VectorCut(0),
     66  UseAddGramSch(1),
     67  Seed(1),
     68  EpsWannier(1e-7)
     69{}
     70
     71PcpParser::StructLocalizedOrbitals::~StructLocalizedOrbitals()
     72{}
     73
     74PcpParser::StructStepCounts::StructStepCounts() :
     75  MaxMinStopStep(1),
     76  InitMaxMinStopStep(1),
     77  OutVisStep(10),
     78  OutSrcStep(5),
     79  MaxPsiStep(0),
     80  MaxOuterStep(0),
     81  MaxMinStep(100),
     82  RelEpsTotalEnergy(1e-07),
     83  RelEpsKineticEnergy(1e-05),
     84  MaxMinGapStopStep(0),
     85  MaxInitMinStep(100),
     86  InitRelEpsTotalEnergy(1e-05),
     87  InitRelEpsKineticEnergy(0.0001),
     88  InitMaxMinGapStopStep(0)
     89{}
     90
     91PcpParser::StructStepCounts::~StructStepCounts()
     92{}
     93
     94PcpParser::StructPlaneWaveSpecifics::StructPlaneWaveSpecifics() :
     95  PsiType(0),
     96  MaxPsiDouble(0),
     97  PsiMaxNoUp(0),
     98  PsiMaxNoDown(0),
     99  ECut(128),
     100  MaxLevel(5),
     101  RiemannTensor(0),
     102  LevRFactor(0),
     103  RiemannLevel(0),
     104  Lev0Factor(2),
     105  RTActualUse(0),
     106  AddPsis(0),
     107  RCut(20)
     108{}
     109
     110PcpParser::StructPlaneWaveSpecifics::~StructPlaneWaveSpecifics()
     111{}
    25112
    26113/** Constructor of PcpParser.
    27114 *
    28115 */
    29 PcpParser::PcpParser()
    30 {
    31   Parallelization.ProcPEGamma = 8;
    32   Parallelization.ProcPEPsi = 1;
    33 
    34   Paths.databasepath = NULL;
    35   Paths.configname = NULL;
    36   Paths.mainname = NULL;
    37   Paths.defaultpath = NULL;
    38   Paths.pseudopotpath = NULL;
    39 
    40   Switches.DoConstrainedMD = 0;
    41   Switches.DoOutVis = 0;
    42   Switches.DoOutMes = 1;
    43   Switches.DoOutNICS = 0;
    44   Switches.DoOutOrbitals = 0;
    45   Switches.DoOutCurrent = 0;
    46   Switches.DoFullCurrent = 0;
    47   Switches.DoPerturbation = 0;
    48   Switches.DoWannier = 0;
    49 
    50   LocalizedOrbitals.CommonWannier = 0;
    51   LocalizedOrbitals.SawtoothStart = 0.01;
    52   LocalizedOrbitals.VectorPlane = 0;
    53   LocalizedOrbitals.VectorCut = 0;
    54   LocalizedOrbitals.UseAddGramSch = 1;
    55   LocalizedOrbitals.Seed = 1;
    56   LocalizedOrbitals.EpsWannier = 1e-7;
    57 
    58   StepCounts.MaxMinStopStep = 1;
    59   StepCounts.InitMaxMinStopStep = 1;
    60   StepCounts.OutVisStep = 10;
    61   StepCounts.OutSrcStep = 5;
    62   StepCounts.MaxPsiStep = 0;
    63   StepCounts.MaxOuterStep = 0;
    64   StepCounts.MaxMinStep = 100;
    65   StepCounts.RelEpsTotalEnergy = 1e-07;
    66   StepCounts.RelEpsKineticEnergy = 1e-05;
    67   StepCounts.MaxMinGapStopStep = 0;
    68   StepCounts.MaxInitMinStep = 100;
    69   StepCounts.InitRelEpsTotalEnergy = 1e-05;
    70   StepCounts.InitRelEpsKineticEnergy = 0.0001;
    71   StepCounts.InitMaxMinGapStopStep = 0;
    72 
    73   PlaneWaveSpecifics.PsiType = 0;
    74   PlaneWaveSpecifics.MaxPsiDouble = 0;
    75   PlaneWaveSpecifics.PsiMaxNoUp = 0;
    76   PlaneWaveSpecifics.PsiMaxNoDown = 0;
    77   PlaneWaveSpecifics.ECut = 128;
    78   PlaneWaveSpecifics.MaxLevel = 5;
    79   PlaneWaveSpecifics.RiemannTensor = 0;
    80   PlaneWaveSpecifics.LevRFactor = 0;
    81   PlaneWaveSpecifics.RiemannLevel = 0;
    82   PlaneWaveSpecifics.Lev0Factor = 2;
    83   PlaneWaveSpecifics.RTActualUse = 0;
    84   PlaneWaveSpecifics.AddPsis = 0;
    85   PlaneWaveSpecifics.RCut = 20;
    86   PlaneWaveSpecifics.PsiType = 0;
    87 
    88   FastParsing = false;
    89 
    90   Deltat = 0.01;
    91   IsAngstroem = 1;
    92   RelativeCoord = 0;
    93   StructOpt = 0;
    94   MaxTypes = 0;
    95 }
     116PcpParser::PcpParser() :
     117  FastParsing(false),
     118  Deltat(0.01),
     119  IsAngstroem(1),
     120  RelativeCoord(0),
     121  StructOpt(0),
     122  MaxTypes(0)
     123{}
    96124
    97125/** Destructor of PcpParser.
     
    332360void PcpParser::save(std::ostream* file)
    333361{
     362  DoLog(0) && (Log() << Verbose(0) << "Saving changes to pcp." << std::endl);
     363
    334364  const Matrix &domain = World::getInstance().getDomain().getM();
    335365  class ThermoStatContainer *Thermostats = World::getInstance().getThermostats();
     
    460490  PlaneWaveSpecifics.MaxPsiDouble = PlaneWaveSpecifics.PsiMaxNoDown = PlaneWaveSpecifics.PsiMaxNoUp = PlaneWaveSpecifics.PsiType = 0;
    461491  for (vector<atom *>::iterator runner = allatoms.begin(); runner != allatoms.end(); ++runner) {
    462     PlaneWaveSpecifics.MaxPsiDouble += (*runner)->type->NoValenceOrbitals;
     492    PlaneWaveSpecifics.MaxPsiDouble += (*runner)->getType()->NoValenceOrbitals;
    463493  }
    464494  cout << PlaneWaveSpecifics.MaxPsiDouble << endl;
     
    495525  // insert all found elements into the map
    496526  for (vector<atom *>::iterator AtomRunner = allatoms.begin();AtomRunner != allatoms.end();++AtomRunner) {
    497     Inserter = PresentElements.insert(pair<int, int>((*AtomRunner)->type->Z, 1));
     527    Inserter = PresentElements.insert(pair<int, int>((*AtomRunner)->getType()->Z, 1));
    498528    if (!Inserter.second) // increase if present
    499529      Inserter.first->second += 1;
     
    526556  int nr = 0;
    527557  for (vector<atom *>::iterator AtomRunner = allatoms.begin();AtomRunner != allatoms.end();++AtomRunner) {
    528     Inserter = ZtoCountMap.insert( pair<int, int>((*AtomRunner)->type->Z, 1) );
     558    Inserter = ZtoCountMap.insert( pair<int, int>((*AtomRunner)->getType()->Z, 1) );
    529559    if (!Inserter.second)
    530560      Inserter.first->second += 1;
    531     const int Z = (*AtomRunner)->type->Z;
     561    const int Z = (*AtomRunner)->getType()->Z;
    532562    *file << "Ion_Type" << ZtoIndexMap[Z] << "_" << ZtoCountMap[Z] << "\t"  << fixed << setprecision(9) << showpoint;
    533     *file << (*AtomRunner)->x[0] << "\t" << (*AtomRunner)->x[1] << "\t" << (*AtomRunner)->x[2];
     563    *file << (*AtomRunner)->at(0) << "\t" << (*AtomRunner)->at(1) << "\t" << (*AtomRunner)->at(2);
    534564    *file << "\t" << (*AtomRunner)->FixedIon;
    535     if ((*AtomRunner)->v.Norm() > MYEPSILON)
    536       *file << "\t" << scientific << setprecision(6) << (*AtomRunner)->v[0] << "\t" << (*AtomRunner)->v[1] << "\t" << (*AtomRunner)->v[2] << "\t";
     565    if ((*AtomRunner)->AtomicVelocity.Norm() > MYEPSILON)
     566      *file << "\t" << scientific << setprecision(6) << (*AtomRunner)->AtomicVelocity[0] << "\t" << (*AtomRunner)->AtomicVelocity[1] << "\t" << (*AtomRunner)->AtomicVelocity[2] << "\t";
    537567    *file << " # molecule nr " << nr++ << endl;
    538568  }
  • src/Parser/PcpParser.hpp

    re588312 rb5c53d  
    3131  void CalculateOrbitals(vector<atom *> &allatoms);
    3232
    33   struct StructParallelization {
     33  class StructParallelization {
     34  public:
     35    StructParallelization();
     36    ~StructParallelization();
     37
    3438    int ProcPEGamma;
    3539    int ProcPEPsi;
     
    3943   * Contains all the paths and names
    4044   */
    41   struct StructPaths {
     45  class StructPaths {
     46  public:
     47    StructPaths();
     48    ~StructPaths();
     49
    4250    char *databasepath;
    4351    char *configname;
     
    5058   * Contains all Do/Don't switches
    5159   */
    52   struct StructSwitches {
     60  class StructSwitches {
     61  public:
     62    StructSwitches();
     63    ~StructSwitches();
     64
    5365    int DoConstrainedMD;
    5466    int DoOutVis;
     
    6577   * Contains parameters regarding localization of orbitals or magnetic perturbation
    6678   */
    67   struct StructLocalizedOrbitals {
     79  class StructLocalizedOrbitals {
     80  public:
     81    StructLocalizedOrbitals();
     82    ~StructLocalizedOrbitals();
     83
    6884    int CommonWannier;
    6985    double SawtoothStart;
     
    7894   * Contains all step count and other epsilon threshold parameters
    7995   */
    80   struct StructStepCounts {
     96  class StructStepCounts {
     97  public:
     98    StructStepCounts();
     99    ~StructStepCounts();
     100
    81101    int MaxMinStopStep;
    82102    int InitMaxMinStopStep;
     
    101121   * Contains all parameters specific to the plane wave basis set
    102122   */
    103   struct StructPlaneWaveSpecifics {
     123  class StructPlaneWaveSpecifics {
     124  public:
     125    StructPlaneWaveSpecifics();
     126    ~StructPlaneWaveSpecifics();
     127
    104128    int PsiType;
    105129    int MaxPsiDouble;
  • src/Parser/TremoloParser.cpp

    re588312 rb5c53d  
    99
    1010#include "Helpers/Assert.hpp"
     11#include "Helpers/Log.hpp"
     12#include "Helpers/Verbose.hpp"
    1113#include "TremoloParser.hpp"
    1214#include "World.hpp"
     
    98100 */
    99101void TremoloParser::save(ostream* file) {
     102  DoLog(0) && (Log() << Verbose(0) << "Saving changes to tremolo." << std::endl);
     103
    100104  vector<atom*>::iterator atomIt;
    101105  vector<string>::iterator it;
     
    139143      case TremoloKey::x :
    140144        // for the moment, assume there are always three dimensions
    141         *file << currentAtom->x[0] << "\t";
    142         *file << currentAtom->x[1] << "\t";
    143         *file << currentAtom->x[2] << "\t";
     145        *file << currentAtom->at(0) << "\t";
     146        *file << currentAtom->at(1) << "\t";
     147        *file << currentAtom->at(2) << "\t";
    144148        break;
    145149      case TremoloKey::u :
    146150        // for the moment, assume there are always three dimensions
    147         *file << currentAtom->v[0] << "\t";
    148         *file << currentAtom->v[1] << "\t";
    149         *file << currentAtom->v[2] << "\t";
     151        *file << currentAtom->AtomicVelocity[0] << "\t";
     152        *file << currentAtom->AtomicVelocity[1] << "\t";
     153        *file << currentAtom->AtomicVelocity[2] << "\t";
    150154        break;
    151155      case TremoloKey::Type :
     
    224228  string word;
    225229  int oldId;
     230  double tmp;
    226231
    227232  lineStream << line;
     
    231236      case TremoloKey::x :
    232237        // for the moment, assume there are always three dimensions
    233         lineStream >> newAtom->x[0];
    234         lineStream >> newAtom->x[1];
    235         lineStream >> newAtom->x[2];
     238        for (int i=0;i<NDIM;i++) {
     239          lineStream >> tmp;
     240          newAtom->set(i, tmp);
     241        }
    236242        break;
    237243      case TremoloKey::u :
    238244        // for the moment, assume there are always three dimensions
    239         lineStream >> newAtom->v[0];
    240         lineStream >> newAtom->v[1];
    241         lineStream >> newAtom->v[2];
     245        lineStream >> newAtom->AtomicVelocity[0];
     246        lineStream >> newAtom->AtomicVelocity[1];
     247        lineStream >> newAtom->AtomicVelocity[2];
    242248        break;
    243249      case TremoloKey::Type :
     
    384390
    385391
    386 TremoloAtomInfoContainer::TremoloAtomInfoContainer() {
    387   F = "0";
    388   stress = "0";
    389   imprData = "-";
    390   GroupMeasureTypeNo = "0";
    391   extType = "-";
    392   name = "-";
    393   resName = "-";
    394   chainID = "0";
    395   resSeq = "0";
    396   occupancy = "0";
    397   tempFactor = "0";
    398   segID = "0";
    399   Charge = "0";
    400   charge = "0";
    401   GrpTypeNo = "0";
    402   torsion = "-";
    403   neighbors = vector<int>(0, 5);
    404 }
     392TremoloAtomInfoContainer::TremoloAtomInfoContainer() :
     393  F("0"),
     394  stress("0"),
     395  imprData("-"),
     396  GroupMeasureTypeNo("0"),
     397  extType("-"),
     398  name("-"),
     399  resName("-"),
     400  chainID("0"),
     401  resSeq("0"),
     402  occupancy("0"),
     403  tempFactor("0"),
     404  segID("0"),
     405  Charge("0"),
     406  charge("0"),
     407  GrpTypeNo("0"),
     408  torsion("-"),
     409  neighbors(vector<int>(0, 5))
     410{}
    405411
    406412void TremoloAtomInfoContainer::set(TremoloKey::atomDataKey key, string value) {
  • src/Parser/XyzParser.cpp

    re588312 rb5c53d  
    88#include "Helpers/MemDebug.hpp"
    99
     10#include "Helpers/Log.hpp"
     11#include "Helpers/Verbose.hpp"
    1012#include "XyzParser.hpp"
    1113#include "World.hpp"
    1214#include "atom.hpp"
     15#include "molecule.hpp"
    1316#include "element.hpp"
    1417#include "periodentafel.hpp"
     
    1922 * Constructor.
    2023 */
    21 XyzParser::XyzParser() {
    22   comment = "";
    23 }
     24XyzParser::XyzParser() :
     25  comment("")
     26{}
    2427
    2528/**
     
    3538 */
    3639void XyzParser::load(istream* file) {
    37   atom* newAtom;
     40  atom* newAtom = NULL;
     41  molecule* newmol = NULL;
    3842  int numberOfAtoms;
    3943  char commentBuffer[512], type[3];
     44  double tmp;
    4045
    4146  // the first line tells number of atoms, the second line is always a comment
     
    4449  comment = commentBuffer;
    4550
     51  newmol = World::getInstance().createMolecule();
     52  newmol->ActiveFlag = true;
     53  World::getInstance().getMolecules()->insert(newmol);
    4654  for (int i = 0; i < numberOfAtoms; i++) {
    4755    newAtom = World::getInstance().createAtom();
    48     *file >> type >> ws >> newAtom->x[0] >> ws >> newAtom->x[1] >> ws >> newAtom->x[2];
     56    *file >> type;
     57    for (int j=0;j<NDIM;j++) {
     58      *file >> tmp;
     59      newAtom->set(j, tmp);
     60    }
    4961    newAtom->setType(World::getInstance().getPeriode()->FindElement(type));
     62    newmol->AddAtom(newAtom);
    5063  }
    5164}
     
    5770 */
    5871void XyzParser::save(ostream* file) {
     72  DoLog(0) && (Log() << Verbose(0) << "Saving changes to xyz." << std::endl);
    5973  if (comment == "") {
    6074    time_t now = time((time_t *)NULL);   // Get the system time and put it into 'now' as 'calender time'
     
    7286  vector<atom*> atoms = World::getInstance().getAllAtoms();
    7387  for(vector<atom*>::iterator it = atoms.begin(); it != atoms.end(); it++) {
    74     *file << noshowpoint << (*it)->getType()->getSymbol() << "\t" << (*it)->x[0] << "\t" << (*it)->x[1] << "\t" << (*it)->x[2] << endl;
     88    *file << noshowpoint << (*it)->getType()->getSymbol() << "\t" << (*it)->at(0) << "\t" << (*it)->at(1) << "\t" << (*it)->at(2) << endl;
    7589  }
    7690}
  • src/ThermoStatContainer.cpp

    re588312 rb5c53d  
    1717 *
    1818 */
    19 ThermoStatContainer::ThermoStatContainer() : Thermostat(4), ThermostatImplemented(NULL),
    20 ThermostatNames(NULL), TempFrequency(2.5), alpha(0.), HooverMass(0.), TargetTemp(0.00095004455), ScaleTempStep(25)
     19ThermoStatContainer::ThermoStatContainer() :
     20  Thermostat(4),
     21  ThermostatImplemented(NULL),
     22  ThermostatNames(NULL),
     23  TempFrequency(2.5),
     24  alpha(0.),
     25  HooverMass(0.),
     26  TargetTemp(0.00095004455),
     27  ScaleTempStep(25)
    2128{
    2229  ThermostatImplemented = new int[MaxThermostats];
  • src/ThermoStatContainer.hpp

    re588312 rb5c53d  
    1616class ConfigFileBuffer;
    1717
    18 #define MaxThermostats 6      //!< maximum number of thermostat entries in Ions#ThermostatNames and Ions#ThermostatImplemented
     18enum { MaxThermostats=6 };      //!< maximum number of thermostat entries in Ions#ThermostatNames and Ions#ThermostatImplemented
    1919enum thermostats { None, Woodcock, Gaussian, Langevin, Berendsen, NoseHoover };   //!< Thermostat names for output
    2020
  • src/UIElements/Menu/DisplayMenuItem.cpp

    re588312 rb5c53d  
    1616
    1717DisplayMenuItem::DisplayMenuItem(Menu* _menu, StringView *_view):
    18 MenuItem('\0',"",_menu),
    19 view(_view),
    20 title("")
     18  MenuItem('\0',"",_menu),
     19  view(_view),
     20  title("")
    2121{
    2222}
  • src/UIElements/Menu/MenuItem.cpp

    re588312 rb5c53d  
    1818 */
    1919MenuItem::MenuItem(char _trigger, const char* _description,Menu* menu) :
    20 trigger(_trigger),
    21 added(false)
     20  trigger(_trigger),
     21  added(false)
    2222{
    2323  description = new string(_description);
  • src/UIElements/Menu/SeperatorItem.cpp

    re588312 rb5c53d  
    1717
    1818SeperatorItem::SeperatorItem(Menu* menu):
    19 MenuItem('\0',"",menu),
    20 spacer(STD_SEPERATOR_SPACER),
    21 length(STD_MENU_LENGTH)
     19  MenuItem('\0',"",menu),
     20  spacer(STD_SEPERATOR_SPACER),
     21  length(STD_MENU_LENGTH)
    2222{
    2323  // TODO Auto-generated constructor stub
     
    2626
    2727SeperatorItem::SeperatorItem(Menu* menu,char _spacer, int _length):
    28 MenuItem('\0',"",menu),
    29 spacer(_spacer),
    30 length(_length)
     28  MenuItem('\0',"",menu),
     29  spacer(_spacer),
     30  length(_length)
    3131{
    3232  // TODO Auto-generated constructor stub
  • src/UIElements/Menu/SubMenuItem.cpp

    re588312 rb5c53d  
    1111
    1212SubMenuItem::SubMenuItem(char _trigger,const char* _description,Menu* _parent, Menu* _theMenu) :
    13 MenuItem(_trigger,_description,_parent),
    14 theMenu(_theMenu)
     13  MenuItem(_trigger,_description,_parent),
     14  theMenu(_theMenu)
    1515{
    1616}
  • src/UIElements/Menu/TextMenu.cpp

    re588312 rb5c53d  
    113113
    114114TextMenu::LeaveAction::LeaveAction(TextMenu* _menu) :
    115 Action(nameBase+_menu->getTitle()),
    116 menu(_menu)
     115  Action(nameBase+_menu->getTitle()),
     116  menu(_menu)
    117117{}
    118118
  • src/UIElements/QT4/QTDialog.cpp

    re588312 rb5c53d  
    481481    parent(_parent)
    482482{
    483   const Matrix& M = World::getInstance().getDomain().getM();
    484   const char *coords[3] = {"x:","y:","z:"};
    485483  mainLayout= new QHBoxLayout();
    486484  titleLabel = new QLabel(QString(getTitle().c_str()));
     
    515513    parent(_parent)
    516514{
    517   const Matrix& M = World::getInstance().getDomain().getM();
    518   const char *coords[3] = {"x:","y:","z:"};
    519515  mainLayout= new QHBoxLayout();
    520516  titleLabel = new QLabel(QString(getTitle().c_str()));
  • src/UIElements/QT4/QTUIFactory.cpp

    re588312 rb5c53d  
    2020#include "Helpers/MemDebug.hpp"
    2121
    22 QTUIFactory::QTUIFactory()
     22QTUIFactory::QTUIFactory() :
     23  argc(1)
    2324{
    2425  // For now we just fake the command line parameters to make QT happy
    25   argc=1;
    2626  argv = new char*[1];
    2727  argv[0] = new char[256];
  • src/UIElements/TextUI/TextDialog.cpp

    re588312 rb5c53d  
    525525    }
    526526  }
     527
    527528  return true;
    528529}
  • src/UIElements/Views/MethodStringView.cpp

    re588312 rb5c53d  
    1313
    1414MethodStringView::MethodStringView(boost::function<string()> _displayMethod) :
    15 StringView(),
    16 displayMethod(_displayMethod)
     15  StringView(),
     16  displayMethod(_displayMethod)
    1717{
    1818  // TODO Auto-generated constructor stub
  • src/UIElements/Views/StreamStringView.cpp

    re588312 rb5c53d  
    1616
    1717StreamStringView::StreamStringView(boost::function<void(ostream *)> _displayMethod) :
    18 StringView(),
    19 displayMethod(_displayMethod)
     18  StringView(),
     19  displayMethod(_displayMethod)
    2020{}
    2121
  • src/analysis_bonds.cpp

    re588312 rb5c53d  
    6060  int AtomNo = 0;
    6161  for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    62     if ((*iter)->type == type1)
     62    if ((*iter)->getType() == type1)
    6363      for (BondList::const_iterator BondRunner = (*iter)->ListOfBonds.begin(); BondRunner != (*iter)->ListOfBonds.end(); BondRunner++)
    64         if ((*BondRunner)->GetOtherAtom((*iter))->type == type2) {
     64        if ((*BondRunner)->GetOtherAtom((*iter))->getType() == type2) {
    6565          const double distance = (*BondRunner)->GetDistanceSquared();
    6666          if (Min > distance)
     
    8787 * \return angle between \a *first and \a *second, both relative to origin at \a *origin.
    8888 */
    89 double CalculateAngle(Vector *first, Vector *central, Vector *second)
     89double CalculateAngle(const Vector &first, const Vector &central, const Vector &second)
    9090{
    9191  Vector OHBond;
    9292  Vector OOBond;
    9393
    94   OHBond = (*first) - (*central);
    95   OOBond = (*second) - (*central);
     94  OHBond = first - central;
     95  OOBond = second - central;
    9696  const double angle = OHBond.Angle(OOBond);
    9797  return angle;
     
    110110
    111111  // check angle
    112   if (CalculateAngle(&Hydrogen->x, &Oxygen->x, &OtherOxygen->x) < M_PI*(30./180.)) {
     112  if (CalculateAngle(Hydrogen->getPosition(), Oxygen->getPosition(), OtherOxygen->getPosition()) < M_PI*(30./180.)) {
    113113    return true;
    114114  } else {
     
    138138        molecule::iterator Runner = (*MolRunner)->begin();
    139139        for(;Runner!=(*MolRunner)->end();++Runner){
    140           if (((*Walker)->type->Z  == 8) && ((*Runner)->type->Z  == 8)) {
     140          if (((*Walker)->getType()->Z  == 8) && ((*Runner)->getType()->Z  == 8)) {
    141141            // check distance
    142             const double distance = (*Runner)->x.DistanceSquared((*Walker)->x);
     142            const double distance = (*Runner)->DistanceSquared(*(*Walker));
    143143            if ((distance > MYEPSILON) && (distance < HBRIDGEDISTANCE*HBRIDGEDISTANCE)) { // distance >0 means  different atoms
    144144              // on other atom(Runner) we check for bond to interface element and
     
    152152                atom * const OtherAtom = (*BondRunner)->GetOtherAtom(*Runner);
    153153                // if hydrogen, check angle to be greater(!) than 30 degrees
    154                 if (OtherAtom->type->Z == 1) {
    155                   const double angle = CalculateAngle(&OtherAtom->x, &(*Runner)->x, &(*Walker)->x);
     154                if (OtherAtom->getType()->Z == 1) {
     155                  const double angle = CalculateAngle(OtherAtom->getPosition(), (*Runner)->getPosition(), (*Walker)->getPosition());
    156156                  OtherHydrogenFlag = OtherHydrogenFlag && (angle > M_PI*(30./180.) + MYEPSILON);
    157157                  Otherangle += angle;
    158158                  OtherHydrogens++;
    159159                }
    160                 InterfaceFlag = InterfaceFlag || (OtherAtom->type == InterfaceElement);
    161                 Interface2Flag = Interface2Flag || (OtherAtom->type == Interface2Element);
     160                InterfaceFlag = InterfaceFlag || (OtherAtom->getType() == InterfaceElement);
     161                Interface2Flag = Interface2Flag || (OtherAtom->getType() == Interface2Element);
    162162              }
    163163              DoLog(1) && (Log() << Verbose(1) << "Otherangle is " << Otherangle << " for " << OtherHydrogens << " hydrogens." << endl);
     
    177177                for (BondList::const_iterator BondRunner = (*Walker)->ListOfBonds.begin(); BondRunner != (*Walker)->ListOfBonds.end(); BondRunner++) {
    178178                  atom * const OtherAtom = (*BondRunner)->GetOtherAtom(*Walker);
    179                   if (OtherAtom->type->Z == 1) {
     179                  if (OtherAtom->getType()->Z == 1) {
    180180                    // check angle
    181181                    if (CheckHydrogenBridgeBondAngle(*Walker, OtherAtom, *Runner)) {
    182                       DoLog(1) && (Log() << Verbose(1) << (*Walker)->getName() << ", " << OtherAtom->getName() << " and " << (*Runner)->getName() << " has a hydrogen bridge bond with distance " << sqrt(distance) << " and angle " << CalculateAngle(&OtherAtom->x, &(*Walker)->x, &(*Runner)->x)*(180./M_PI) << "." << endl);
     182                      DoLog(1) && (Log() << Verbose(1) << (*Walker)->getName() << ", " << OtherAtom->getName() << " and " << (*Runner)->getName() << " has a hydrogen bridge bond with distance " << sqrt(distance) << " and angle " << CalculateAngle(OtherAtom->getPosition(), (*Walker)->getPosition(), (*Runner)->getPosition())*(180./M_PI) << "." << endl);
    183183                      count++;
    184184                      break;
     
    210210    for(;Walker!=(*MolWalker)->end();++Walker){
    211211      atom * theAtom = *Walker;
    212       if ((theAtom->type == first) || (theAtom->type == second)) {  // first element matches
     212      if ((theAtom->getType() == first) || (theAtom->getType() == second)) {  // first element matches
    213213        for (BondList::const_iterator BondRunner = theAtom->ListOfBonds.begin(); BondRunner != theAtom->ListOfBonds.end(); BondRunner++) {
    214214          atom * const OtherAtom = (*BondRunner)->GetOtherAtom(theAtom);
    215           if (((OtherAtom->type == first) || (OtherAtom->type == second)) && (theAtom->nr < OtherAtom->nr)) {
     215          if (((OtherAtom->getType() == first) || (OtherAtom->getType() == second)) && (theAtom->nr < OtherAtom->nr)) {
    216216            count++;
    217217            DoLog(1) && (Log() << Verbose(1) << *first << "-" << *second << " bond found between " << *Walker << " and " << *OtherAtom << "." << endl);
     
    246246    for(;Walker!=(*MolWalker)->end();++Walker){
    247247      atom *theAtom = *Walker;
    248       if (theAtom->type == second) {  // first element matches
     248      if (theAtom->getType() == second) {  // first element matches
    249249        for (int i=0;i<2;i++)
    250250          MatchFlag[i] = false;
     
    252252          atom * const OtherAtom = (*BondRunner)->GetOtherAtom(theAtom);
    253253          for (int i=0;i<2;i++)
    254             if ((!MatchFlag[i]) && (OtherAtom->type == ElementArray[i])) {
     254            if ((!MatchFlag[i]) && (OtherAtom->getType() == ElementArray[i])) {
    255255              MatchFlag[i] = true;
    256256              break;  // each bonding atom can match at most one element we are looking for
  • src/analysis_bonds.hpp

    re588312 rb5c53d  
    2020/*********************************************** defines ***********************************/
    2121
    22 #define HBRIDGEDISTANCE 3.5   //!< HBridge distance from PCCP Vol 10. 4802-4813
     22const double HBRIDGEDISTANCE=3.5;   //!< HBridge distance from PCCP Vol 10. 4802-4813
    2323
    2424/****************************************** forward declarations *****************************/
  • src/analysis_correlation.cpp

    re588312 rb5c53d  
    1111#include <iomanip>
    1212
     13#include "BoundaryTriangleSet.hpp"
    1314#include "analysis_correlation.hpp"
    1415#include "element.hpp"
     
    7374          DoLog(3) && (Log() << Verbose(3) << "Current otheratom is " << **runner << "." << endl);
    7475          if ((*iter)->getId() < (*runner)->getId()){
    75             for (set <pair<const element *,const element *> >::iterator PairRunner = PairsOfElements.begin(); PairRunner != PairsOfElements.end(); ++PairRunner)
    76               if ((PairRunner->first == (**iter).type) && (PairRunner->second == (**runner).type)) {
    77                 distance = domain.periodicDistance(*(*iter)->node,*(*runner)->node);
     76            for (set <pair<const element *, const element *> >::iterator PairRunner = PairsOfElements.begin(); PairRunner != PairsOfElements.end(); ++PairRunner)
     77              if ((PairRunner->first == (**iter).getType()) && (PairRunner->second == (**runner).getType())) {
     78                distance = domain.periodicDistance((*iter)->getPosition(),(*runner)->getPosition());
    7879                //Log() << Verbose(1) <<"Inserting " << *(*iter) << " and " << *(*runner) << endl;
    7980                outmap->insert ( pair<double, pair <atom *, atom*> > (distance, pair<atom *, atom*> ((*iter), (*runner)) ) );
     
    137138    for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
    138139      DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl);
    139       periodicX = FullInverseMatrix * (*(*iter)->node); // x now in [0,1)^3
     140      periodicX = FullInverseMatrix * ((*iter)->getPosition()); // x now in [0,1)^3
    140141      // go through every range in xyz and get distance
    141142      for (n[0]=-ranges[0]; n[0] <= ranges[0]; n[0]++)
     
    149150                  if ((*iter)->getId() < (*runner)->getId()){
    150151                    for (set <pair<const element *,const element *> >::iterator PairRunner = PairsOfElements.begin(); PairRunner != PairsOfElements.end(); ++PairRunner)
    151                       if ((PairRunner->first == (**iter).type) && (PairRunner->second == (**runner).type)) {
    152                         periodicOtherX = FullInverseMatrix * (*(*runner)->node); // x now in [0,1)^3
     152                      if ((PairRunner->first == (**iter).getType()) && (PairRunner->second == (**runner).getType())) {
     153                        periodicOtherX = FullInverseMatrix * ((*runner)->getPosition()); // x now in [0,1)^3
    153154                        // go through every range in xyz and get distance
    154155                        for (Othern[0]=-ranges[0]; Othern[0] <= ranges[0]; Othern[0]++)
     
    196197      DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl);
    197198      for (vector<const element *>::const_iterator type = elements.begin(); type != elements.end(); ++type)
    198         if ((*type == NULL) || ((*iter)->type == *type)) {
    199           distance = domain.periodicDistance(*(*iter)->node,*point);
     199        if ((*type == NULL) || ((*iter)->getType() == *type)) {
     200          distance = domain.periodicDistance((*iter)->getPosition(),*point);
    200201          DoLog(4) && (Log() << Verbose(4) << "Current distance is " << distance << "." << endl);
    201202          outmap->insert ( pair<double, pair<atom *, const Vector*> >(distance, pair<atom *, const Vector*> ((*iter), point) ) );
     
    237238      DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl);
    238239      for (vector<const element *>::const_iterator type = elements.begin(); type != elements.end(); ++type)
    239         if ((*type == NULL) || ((*iter)->type == *type)) {
    240           periodicX = FullInverseMatrix * (*(*iter)->node); // x now in [0,1)^3
     240        if ((*type == NULL) || ((*iter)->getType() == *type)) {
     241          periodicX = FullInverseMatrix * ((*iter)->getPosition()); // x now in [0,1)^3
    241242          // go through every range in xyz and get distance
    242243          for (n[0]=-ranges[0]; n[0] <= ranges[0]; n[0]++)
     
    284285      DoLog(3) && (Log() << Verbose(3) << "\tCurrent atom is " << *(*iter) << "." << endl);
    285286      for (vector<const element *>::const_iterator type = elements.begin(); type != elements.end(); ++type)
    286         if ((*type == NULL) || ((*iter)->type == *type)) {
    287           TriangleIntersectionList Intersections((*iter)->node,Surface,LC);
     287        if ((*type == NULL) || ((*iter)->getType() == *type)) {
     288          TriangleIntersectionList Intersections((*iter)->getPosition(),Surface,LC);
    288289          distance = Intersections.GetSmallestDistance();
    289290          triangle = Intersections.GetClosestTriangle();
     
    335336      DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl);
    336337      for (vector<const element *>::const_iterator type = elements.begin(); type != elements.end(); ++type)
    337         if ((*type == NULL) || ((*iter)->type == *type)) {
    338           periodicX = FullInverseMatrix * (*(*iter)->node); // x now in [0,1)^3
     338        if ((*type == NULL) || ((*iter)->getType() == *type)) {
     339          periodicX = FullInverseMatrix * ((*iter)->getPosition()); // x now in [0,1)^3
    339340          // go through every range in xyz and get distance
    340341          ShortestDistance = -1.;
     
    343344              for (n[2]=-ranges[2]; n[2] <= ranges[2]; n[2]++) {
    344345                checkX = FullMatrix * (Vector(n[0], n[1], n[2]) + periodicX);
    345                 TriangleIntersectionList Intersections(&checkX,Surface,LC);
     346                TriangleIntersectionList Intersections(checkX,Surface,LC);
    346347                distance = Intersections.GetSmallestDistance();
    347348                triangle = Intersections.GetClosestTriangle();
     
    411412    *file << runner->first;
    412413    for (int i=0;i<NDIM;i++)
    413       *file << "\t" << setprecision(8) << (runner->second.first->node->at(i) - runner->second.second->at(i));
     414      *file << "\t" << setprecision(8) << (runner->second.first->at(i) - runner->second.second->at(i));
    414415    *file << endl;
    415416  }
     
    426427  if (!map->empty())
    427428    for (CorrelationToSurfaceMap::const_iterator runner = map->begin(); runner != map->end(); ++runner) {
    428       *file << setprecision(8) << runner->first << "\t" << *(runner->second.first) << "\t" << *(runner->second.second) << endl;
    429     }
    430 };
    431 
     429      *file << setprecision(8) << runner->first << "\t";
     430      *file << *(runner->second.first) << "\t";
     431      *file << *(runner->second.second) << endl;
     432    }
     433};
     434
  • src/atom.cpp

    re588312 rb5c53d  
    2727 */
    2828atom::atom() :
    29   father(this), sort(&nr), mol(0)
    30 {
    31   node = &x;  // TesselPoint::x can only be referenced from here
    32 };
     29  father(this),
     30  sort(&nr),
     31  mol(0)
     32{};
    3333
    3434/** Constructor of class atom.
    3535 */
    3636atom::atom(atom *pointer) :
    37     ParticleInfo(pointer),father(pointer), sort(&nr)
    38 {
    39   type = pointer->type;  // copy element of atom
    40   x = pointer->x; // copy coordination
    41   v = pointer->v; // copy velocity
     37    ParticleInfo(pointer),
     38    father(pointer),
     39    sort(&nr)
     40{
     41  setType(pointer->getType());  // copy element of atom
     42  setPosition(pointer->getPosition()); // copy coordination
     43  AtomicVelocity = pointer->AtomicVelocity; // copy velocity
    4244  FixedIon = pointer->FixedIon;
    43   node = &x;
    4445  mol = 0;
    4546};
     
    4950  res->father = this;
    5051  res->sort = &res->nr;
    51   res->type = type;
    52   res->x = this->x;
    53   res->v = this->v;
     52  res->setType(getType());
     53  res->setPosition(this->getPosition());
     54  res->AtomicVelocity = this->AtomicVelocity;
    5455  res->FixedIon = FixedIon;
    55   res->node = &x;
    5656  res->mol = 0;
    5757  World::getInstance().registerAtom(res);
     
    121121bool atom::IsInShape(const Shape& shape) const
    122122{
    123   return shape.isInside(*node);
     123  return shape.isInside(getPosition());
    124124};
    125125
     
    146146  if (out != NULL) {
    147147    *out << "Ion_Type" << ElementNo << "_" << AtomNo << "\t"  << fixed << setprecision(9) << showpoint;
    148     *out << x[0] << "\t" << x[1] << "\t" << x[2];
     148    *out << at(0) << "\t" << at(1) << "\t" << at(2);
    149149    *out << "\t" << FixedIon;
    150     if (v.Norm() > MYEPSILON)
    151       *out << "\t" << scientific << setprecision(6) << v[0] << "\t" << v[1] << "\t" << v[2] << "\t";
     150    if (AtomicVelocity.Norm() > MYEPSILON)
     151      *out << "\t" << scientific << setprecision(6) << AtomicVelocity[0] << "\t" << AtomicVelocity[1] << "\t" << AtomicVelocity[2] << "\t";
    152152    if (comment != NULL)
    153153      *out << " # " << comment << endl;
     
    168168bool atom::OutputArrayIndexed(ostream * const out,const enumeration<const element*> &elementLookup, int *AtomNo, const char *comment) const
    169169{
    170   AtomNo[type->Z]++;  // increment number
    171   if (out != NULL) {
    172     cout << "Looking for atom with element " << *type << endl;
    173     ASSERT(elementLookup.there.find(type)!=elementLookup.there.end(),"Type of this atom was not in the formula upon enumeration");
    174     *out << "Ion_Type" << elementLookup.there.find(type)->second << "_" << AtomNo[type->Z] << "\t"  << fixed << setprecision(9) << showpoint;
    175     *out << x[0] << "\t" << x[1] << "\t" << x[2];
     170  AtomNo[getType()->Z]++;  // increment number
     171  if (out != NULL) {
     172    const element *elemental = getType();
     173    cout << "Looking for atom with element " << *elemental << endl;
     174    ASSERT(elementLookup.there.find(elemental)!=elementLookup.there.end(),"Type of this atom was not in the formula upon enumeration");
     175    *out << "Ion_Type" << elementLookup.there.find(elemental)->second << "_" << AtomNo[elemental->Z] << "\t"  << fixed << setprecision(9) << showpoint;
     176    *out << at(0) << "\t" << at(1) << "\t" << at(2);
    176177    *out << "\t" << FixedIon;
    177     if (v.Norm() > MYEPSILON)
    178       *out << "\t" << scientific << setprecision(6) << v[0] << "\t" << v[1] << "\t" << v[2] << "\t";
     178    if (AtomicVelocity.Norm() > MYEPSILON)
     179      *out << "\t" << scientific << setprecision(6) << AtomicVelocity[0] << "\t" << AtomicVelocity[1] << "\t" << AtomicVelocity[2] << "\t";
    179180    if (comment != NULL)
    180181      *out << " # " << comment << endl;
     
    193194{
    194195  if (out != NULL) {
    195     *out << type->getSymbol() << "\t" << x[0] << "\t" << x[1] << "\t" << x[2] << "\t" << endl;
     196    *out << getType()->getSymbol() << "\t" << at(0) << "\t" << at(1) << "\t" << at(2) << "\t" << endl;
    196197    return true;
    197198  } else
     
    208209bool atom::OutputTrajectory(ofstream * const out, const int *ElementNo, int *AtomNo, const int step) const
    209210{
    210   AtomNo[type->Z]++;
    211   if (out != NULL) {
    212     *out << "Ion_Type" << ElementNo[type->Z] << "_" << AtomNo[type->Z] << "\t"  << fixed << setprecision(9) << showpoint;
     211  AtomNo[getType()->Z]++;
     212  if (out != NULL) {
     213    *out << "Ion_Type" << ElementNo[getType()->Z] << "_" << AtomNo[getType()->Z] << "\t"  << fixed << setprecision(9) << showpoint;
    213214    *out << Trajectory.R.at(step)[0] << "\t" << Trajectory.R.at(step)[1] << "\t" << Trajectory.R.at(step)[2];
    214215    *out << "\t" << FixedIon;
     
    231232{
    232233  if (out != NULL) {
    233     *out << type->getSymbol() << "\t";
     234    *out << getType()->getSymbol() << "\t";
    234235    *out << Trajectory.R.at(step)[0] << "\t";
    235236    *out << Trajectory.R.at(step)[1] << "\t";
     
    247248void atom::OutputMPQCLine(ostream * const out, const Vector *center, int *AtomNo = NULL) const
    248249{
    249   *out << "\t\t" << type->getSymbol() << " [ " << x[0]-center->at(0) << "\t" << x[1]-center->at(1) << "\t" << x[2]-center->at(2) << " ]" << endl;
     250  Vector recentered(getPosition());
     251  recentered -= *center;
     252  *out << "\t\t" << getType()->getSymbol() << " [ " << recentered[0] << "\t" << recentered[1] << "\t" << recentered[2] << " ]" << endl;
    250253  if (AtomNo != NULL)
    251254    *AtomNo++;
     
    270273double atom::DistanceSquaredToVector(const Vector &origin) const
    271274{
    272   return origin.DistanceSquared(x);
     275  return DistanceSquared(origin);
    273276};
    274277
     
    279282double atom::DistanceToVector(const Vector &origin) const
    280283{
    281   return origin.distance(x);
     284  return distance(origin);
    282285};
    283286
     
    294297};
    295298
     299std::ostream & atom::operator << (std::ostream &ost) const
     300{
     301  ParticleInfo::operator<<(ost);
     302  ost << "," << getPosition();
     303  return ost;
     304}
     305
     306std::ostream & operator << (std::ostream &ost, const atom &a)
     307{
     308  a.ParticleInfo::operator<<(ost);
     309  ost << "," << a.getPosition();
     310  return ost;
     311}
    296312
    297313bool operator < (atom &a, atom &b)
     
    333349  mol = _mol;
    334350  if(!mol->containsAtom(this)){
    335     mol->AddAtom(this);
     351    mol->insert(this);
    336352  }
    337353}
  • src/atom.hpp

    re588312 rb5c53d  
    2222#include <vector>
    2323
     24#include "Helpers/helpers.hpp"
    2425#include "atom_atominfo.hpp"
    2526#include "atom_bondedparticle.hpp"
     
    2728#include "atom_particleinfo.hpp"
    2829#include "atom_trajectoryparticle.hpp"
    29 #include "tesselation.hpp"
     30#include "TesselPoint.hpp"
    3031#include "types.hpp"
    3132
     
    4243 * Class incorporates position, type
    4344 */
    44 class atom : public TesselPoint, public TrajectoryParticle, public GraphNode, public BondedParticle, public virtual ParticleInfo, public virtual AtomInfo {
     45class atom : public TrajectoryParticle, public GraphNode, public BondedParticle, public TesselPoint {
    4546  friend atom* NewAtom(atomId_t);
    4647  friend void  DeleteAtom(atom*);
     
    9495   void removeFromMolecule();
    9596
     97   // Output operator
     98   std::ostream & operator << (std::ostream &ost) const;
     99
    96100  protected:
    97101
     
    120124
    121125/**
     126 * Global output operator for class atom.
     127 */
     128std::ostream & operator << (std::ostream &ost, const atom &_atom);
     129
     130/**
    122131 * internal method used by the world. Do not use if you don't know what you are doing.
    123132 * You might get burned...
  • src/atom_atominfo.cpp

    re588312 rb5c53d  
    1010#include "periodentafel.hpp"
    1111#include "World.hpp"
     12#include "element.hpp"
    1213#include "atom_atominfo.hpp"
    1314
    1415/** Constructor of class AtomInfo.
    1516 */
    16 AtomInfo::AtomInfo() : type(NULL) {};
     17AtomInfo::AtomInfo() :
     18  AtomicElement(NULL)
     19{};
     20
     21/** Copy constructor of class AtomInfo.
     22 */
     23AtomInfo::AtomInfo(const AtomInfo &_atom) :
     24    AtomicPosition(_atom.AtomicPosition),
     25    AtomicElement(_atom.AtomicElement)
     26{};
     27
     28AtomInfo::AtomInfo(const VectorInterface &_v) :
     29    AtomicPosition(_v.getPosition()),
     30    AtomicElement(NULL)
     31{};
    1732
    1833/** Destructor of class AtomInfo.
     
    2237};
    2338
    24 const element *AtomInfo::getType(){
    25   return type;
     39const element *AtomInfo::getType() const
     40{
     41  return AtomicElement;
     42}
     43
     44const double& AtomInfo::operator[](size_t i) const
     45{
     46  return AtomicPosition[i];
     47}
     48
     49const double& AtomInfo::at(size_t i) const
     50{
     51  return AtomicPosition.at(i);
     52}
     53
     54void AtomInfo::set(size_t i, const double value)
     55{
     56  AtomicPosition.at(i) = value;
     57}
     58
     59const Vector& AtomInfo::getPosition() const
     60{
     61  return AtomicPosition;
    2662}
    2763
    2864void AtomInfo::setType(const element* _type) {
    29   type = _type;
     65  AtomicElement = _type;
    3066}
    3167
    32 void AtomInfo::setType(int Z) {
     68void AtomInfo::setType(const int Z) {
    3369  const element *elem = World::getInstance().getPeriode()->FindElement(Z);
    3470  setType(elem);
    3571}
     72
     73void AtomInfo::setPosition(const Vector& _vector)
     74{
     75  AtomicPosition = _vector;
     76  //cout << "AtomInfo::setPosition: " << getType()->symbol << " at " << getPosition() << endl;
     77}
     78
     79const VectorInterface& AtomInfo::operator+=(const Vector& b)
     80{
     81  AtomicPosition += b;
     82  return *this;
     83}
     84
     85const VectorInterface& AtomInfo::operator-=(const Vector& b)
     86{
     87  AtomicPosition -= b;
     88  return *this;
     89}
     90
     91Vector const AtomInfo::operator+(const Vector& b) const
     92{
     93  Vector a(AtomicPosition);
     94  a += b;
     95  return a;
     96}
     97
     98Vector const AtomInfo::operator-(const Vector& b) const
     99{
     100  Vector a(AtomicPosition);
     101  a -= b;
     102  return a;
     103}
     104
     105double AtomInfo::distance(const Vector &point) const
     106{
     107  return AtomicPosition.distance(point);
     108}
     109
     110double AtomInfo::DistanceSquared(const Vector &y) const
     111{
     112  return AtomicPosition.DistanceSquared(y);
     113}
     114
     115double AtomInfo::distance(const VectorInterface &_atom) const
     116{
     117  return _atom.distance(AtomicPosition);
     118}
     119
     120double AtomInfo::DistanceSquared(const VectorInterface &_atom) const
     121{
     122  return _atom.DistanceSquared(AtomicPosition);
     123}
     124
     125VectorInterface &AtomInfo::operator=(const Vector& _vector)
     126{
     127  AtomicPosition = _vector;
     128  return *this;
     129}
     130
     131void AtomInfo::ScaleAll(const double *factor)
     132{
     133  AtomicPosition.ScaleAll(factor);
     134}
     135
     136void AtomInfo::ScaleAll(const Vector &factor)
     137{
     138  AtomicPosition.ScaleAll(factor);
     139}
     140
     141void AtomInfo::Scale(const double factor)
     142{
     143  AtomicPosition.Scale(factor);
     144}
     145
     146void AtomInfo::Zero()
     147{
     148  AtomicPosition.Zero();
     149}
     150
     151void AtomInfo::One(const double one)
     152{
     153  AtomicPosition.One(one);
     154}
     155
     156void AtomInfo::LinearCombinationOfVectors(const Vector &x1, const Vector &x2, const Vector &x3, const double * const factors)
     157{
     158  AtomicPosition.LinearCombinationOfVectors(x1,x2,x3,factors);
     159}
     160
     161const AtomInfo& operator*=(AtomInfo& a, const double m)
     162{
     163  a.Scale(m);
     164  return a;
     165}
     166
     167AtomInfo const operator*(const AtomInfo& a, const double m)
     168{
     169  AtomInfo copy(a);
     170  copy *= m;
     171  return copy;
     172}
     173
     174AtomInfo const operator*(const double m, const AtomInfo& a)
     175{
     176  AtomInfo copy(a);
     177  copy *= m;
     178  return copy;
     179}
     180
     181std::ostream & AtomInfo::operator << (std::ostream &ost) const
     182{
     183  return (ost << getPosition());
     184}
     185
     186std::ostream & operator << (std::ostream &ost, const AtomInfo &a)
     187{
     188  ost << a;
     189  return ost;
     190}
     191
  • src/atom_atominfo.hpp

    re588312 rb5c53d  
    2020
    2121#include "LinearAlgebra/Vector.hpp"
     22#include "LinearAlgebra/VectorInterface.hpp"
    2223
    2324/****************************************** forward declarations *****************************/
    2425
     26class AtomInfo;
    2527class element;
     28class Matrix;
    2629
    2730/********************************************** declarations *******************************/
    2831
    29 class AtomInfo {
     32class AtomInfo : public VectorInterface {
     33
    3034public:
    31   Vector x;       //!< coordinate vector of atom, giving last position within cell
    32   Vector v;       //!< velocity vector of atom, giving last velocity within cell
    33   Vector F;       //!< Force vector of atom, giving last force within cell
    34   const element *type;  //!< pointing to element
     35  Vector AtomicVelocity;       //!< velocity vector of atom, giving last velocity within cell
     36  Vector AtomicForce;       //!< Force vector of atom, giving last force within cell
    3537
    3638  AtomInfo();
    37   ~AtomInfo();
     39  AtomInfo(const AtomInfo &_atom);
     40  AtomInfo(const VectorInterface &_v);
     41  virtual ~AtomInfo();
    3842
    39   const element *getType();
     43  const element *getType() const;
    4044  void setType(const element *);
    41   void setType(int);
     45  void setType(const int);
     46
     47  ///// manipulation of the atomic position
     48
     49  // Accessors ussually come in pairs... and sometimes even more than that
     50  const double& operator[](size_t i) const;
     51  const double& at(size_t i) const;
     52  void set(size_t i, const double value);
     53  const Vector& getPosition() const;
     54
     55  // Assignment operator
     56  void setPosition(const Vector& _vector);
     57  class VectorInterface &operator=(const Vector& _vector);
     58
     59  // operators for mathematical operations
     60  const VectorInterface& operator+=(const Vector& b);
     61  const VectorInterface& operator-=(const Vector& b);
     62  Vector const operator+(const Vector& b) const;
     63  Vector const operator-(const Vector& b) const;
     64
     65  void Zero();
     66  void One(const double one);
     67  void LinearCombinationOfVectors(const Vector &x1, const Vector &x2, const Vector &x3, const double * const factors);
     68
     69  double distance(const Vector &point) const;
     70  double DistanceSquared(const Vector &y) const;
     71  double distance(const VectorInterface &_atom) const;
     72  double DistanceSquared(const VectorInterface &_atom) const;
     73
     74  void ScaleAll(const double *factor);
     75  void ScaleAll(const Vector &factor);
     76  void Scale(const double factor);
     77
     78  std::ostream & operator << (std::ostream &ost) const;
    4279
    4380private:
     81  Vector AtomicPosition;       //!< coordinate vector of atom, giving last position within cell
     82  const element *AtomicElement;  //!< pointing to element
    4483};
    4584
     85std::ostream & operator << (std::ostream &ost, const AtomInfo &a);
     86
     87const AtomInfo& operator*=(AtomInfo& a, const double m);
     88AtomInfo const operator*(const AtomInfo& a, const double m);
     89AtomInfo const operator*(const double m, const AtomInfo& a);
     90
    4691#endif /* ATOM_ATOMINFO_HPP_ */
  • src/atom_bondedparticle.cpp

    re588312 rb5c53d  
    152152  NoBonds = CountBonds();
    153153  //Log() << Verbose(3) << "Walker " << *this << ": " << (int)this->type->NoValenceOrbitals << " > " << NoBonds << "?" << endl;
    154   if ((int)(type->NoValenceOrbitals) > NoBonds) { // we have a mismatch, check all bonding partners for mismatch
     154  if ((int)(getType()->NoValenceOrbitals) > NoBonds) { // we have a mismatch, check all bonding partners for mismatch
    155155    for (BondList::const_iterator Runner = ListOfBonds.begin(); Runner != ListOfBonds.end(); (++Runner)) {
    156156      OtherWalker = (*Runner)->GetOtherAtom(this);
    157157      OtherNoBonds = OtherWalker->CountBonds();
    158158      //Log() << Verbose(3) << "OtherWalker " << *OtherWalker << ": " << (int)OtherWalker->type->NoValenceOrbitals << " > " << OtherNoBonds << "?" << endl;
    159       if ((int)(OtherWalker->type->NoValenceOrbitals) > OtherNoBonds) { // check if possible candidate
     159      if ((int)(OtherWalker->getType()->NoValenceOrbitals) > OtherNoBonds) { // check if possible candidate
    160160        if ((CandidateBond == NULL) || (ListOfBonds.size() > OtherWalker->ListOfBonds.size())) { // pick the one with fewer number of bonds first
    161161          CandidateBond = (*Runner);
     
    189189};
    190190
     191std::ostream & BondedParticle::operator << (std::ostream &ost) const
     192{
     193  ParticleInfo::operator<<(ost);
     194  ost << "," << getPosition();
     195  return ost;
     196}
     197
     198std::ostream & operator << (std::ostream &ost, const BondedParticle &a)
     199{
     200  a.ParticleInfo::operator<<(ost);
     201  ost << "," << a.getPosition();
     202  return ost;
     203}
     204
  • src/atom_bondedparticle.hpp

    re588312 rb5c53d  
    4949  void OutputOrder(ofstream *file) const;
    5050
     51  std::ostream & operator << (std::ostream &ost) const;
     52
    5153private:
    5254
    5355};
    5456
     57std::ostream & operator << (std::ostream &ost, const BondedParticle &a);
    5558
    5659#endif /* ATOM_BONDEDPARTICLE_HPP_ */
  • src/atom_bondedparticleinfo.cpp

    re588312 rb5c53d  
    1212/** Constructor of class BondedParticleInfo.
    1313 */
    14 BondedParticleInfo::BondedParticleInfo() : AdaptiveOrder(0), MaxOrder(false) {};
     14BondedParticleInfo::BondedParticleInfo() :
     15  AdaptiveOrder(0),
     16  MaxOrder(false)
     17{};
    1518
    1619/** Destructor of class BondedParticleInfo.
  • src/atom_bondedparticleinfo.hpp

    re588312 rb5c53d  
    3636
    3737  BondedParticleInfo();
    38   ~BondedParticleInfo();
     38  virtual ~BondedParticleInfo();
    3939
    4040private:
  • src/atom_graphnodeinfo.cpp

    re588312 rb5c53d  
    1212/** Constructor of class GraphNodeInfo.
    1313 */
    14 GraphNodeInfo::GraphNodeInfo() : GraphNr(-1), ComponentNr(0), LowpointNr(-1), SeparationVertex(false), IsCyclic(false), Ancestor(0) {};
     14GraphNodeInfo::GraphNodeInfo() :
     15  GraphNr(-1),
     16  ComponentNr(0),
     17  LowpointNr(-1),
     18  SeparationVertex(false),
     19  IsCyclic(false),
     20  Ancestor(0)
     21{};
    1522
    1623/** Destructor of class GraphNodeInfo.
  • src/atom_graphnodeinfo.hpp

    re588312 rb5c53d  
    3737
    3838  GraphNodeInfo();
    39   ~GraphNodeInfo();
     39  virtual ~GraphNodeInfo();
    4040private:
    4141
  • src/atom_particleinfo.cpp

    re588312 rb5c53d  
    1414/** Constructor of ParticleInfo.
    1515 */
    16 ParticleInfo::ParticleInfo() : nr(-1), name("Unknown") {
    17 };
     16ParticleInfo::ParticleInfo() :
     17  nr(-1),
     18  name("Unknown")
     19{};
    1820
    1921ParticleInfo::ParticleInfo(ParticleInfo *pointer) :
    20     nr(pointer->nr),
    21     name(pointer->name)
    22     {}
     22  nr(pointer->nr),
     23  name(pointer->name)
     24{}
    2325
    2426
     
    3840ostream & operator << (ostream &ost, const ParticleInfo &a)
    3941{
    40   ost << "[" << a.getName() << "|" << &a << "]";
     42  ost << a.getName();
    4143  return ost;
    4244};
     
    4446ostream & ParticleInfo::operator << (ostream &ost) const
    4547{
    46   ost << "[" << name << "|" << this << "]";
     48  ost << getName();
    4749  return ost;
    4850};
  • src/atom_particleinfo.hpp

    re588312 rb5c53d  
    3232  ParticleInfo();
    3333  ParticleInfo(ParticleInfo*);
    34   ~ParticleInfo();
     34  virtual ~ParticleInfo();
    3535
    3636  const std::string& getName() const;
  • src/atom_trajectoryparticle.cpp

    re588312 rb5c53d  
    3838{
    3939  for (int i=NDIM;i--;)
    40     *temperature += type->mass * Trajectory.U.at(step)[i]* Trajectory.U.at(step)[i];
     40    *temperature += getType()->mass * Trajectory.U.at(step)[i]* Trajectory.U.at(step)[i];
    4141};
    4242
     
    6565  for(int d=0;d<NDIM;d++) {
    6666    Trajectory.U.at(Step)[d] -= CoGVelocity->at(d);
    67     *ActualTemp += 0.5 * type->mass * Trajectory.U.at(Step)[d] * Trajectory.U.at(Step)[d];
     67    *ActualTemp += 0.5 * getType()->mass * Trajectory.U.at(Step)[d] * Trajectory.U.at(Step)[d];
    6868  }
    6969};
     
    113113    Trajectory.R.at(NextStep)[d] = Trajectory.R.at(NextStep-1)[d];
    114114    Trajectory.R.at(NextStep)[d] += configuration->Deltat*(Trajectory.U.at(NextStep-1)[d]);     // s(t) = s(0) + v * deltat + 1/2 a * deltat^2
    115     Trajectory.R.at(NextStep)[d] += 0.5*configuration->Deltat*configuration->Deltat*(Trajectory.F.at(NextStep)[d]/type->mass);     // F = m * a and s =
     115    Trajectory.R.at(NextStep)[d] += 0.5*configuration->Deltat*configuration->Deltat*(Trajectory.F.at(NextStep)[d]/getType()->mass);     // F = m * a and s =
    116116  }
    117117  // Update U
    118118  for (int d=0; d<NDIM; d++) {
    119119    Trajectory.U.at(NextStep)[d] = Trajectory.U.at(NextStep-1)[d];
    120     Trajectory.U.at(NextStep)[d] += configuration->Deltat * (Trajectory.F.at(NextStep)[d]+Trajectory.F.at(NextStep-1)[d]/type->mass); // v = F/m * t
     120    Trajectory.U.at(NextStep)[d] += configuration->Deltat * (Trajectory.F.at(NextStep)[d]+Trajectory.F.at(NextStep-1)[d]/getType()->mass); // v = F/m * t
    121121  }
    122122  // Update R (and F)
     
    137137void TrajectoryParticle::SumUpKineticEnergy( int Step, double *TotalMass, Vector *TotalVelocity ) const
    138138{
    139   *TotalMass += type->mass;  // sum up total mass
     139  *TotalMass += getType()->mass;  // sum up total mass
    140140  for(int d=0;d<NDIM;d++) {
    141     TotalVelocity->at(d) += Trajectory.U.at(Step)[d]*type->mass;
     141    TotalVelocity->at(d) += Trajectory.U.at(Step)[d]*getType()->mass;
    142142  }
    143143};
     
    154154    for (int d=0; d<NDIM; d++) {
    155155      U[d] *= ScaleTempFactor;
    156       *ekin += 0.5*type->mass * U[d]*U[d];
     156      *ekin += 0.5*getType()->mass * U[d]*U[d];
    157157    }
    158158};
     
    170170    for (int d=0; d<NDIM; d++) {
    171171      *G += U[d] * F[d];
    172       *E += U[d]*U[d]*type->mass;
     172      *E += U[d]*U[d]*getType()->mass;
    173173    }
    174174};
     
    185185  if (FixedIon == 0) // even FixedIon moves, only not by other's forces
    186186    for (int d=0; d<NDIM; d++) {
    187       U[d] += configuration->Deltat/type->mass * ( (G_over_E) * (U[d]*type->mass) );
    188       *ekin += type->mass * U[d]*U[d];
     187      U[d] += configuration->Deltat/getType()->mass * ( (G_over_E) * (U[d]*getType()->mass) );
     188      *ekin += getType()->mass * U[d]*U[d];
    189189    }
    190190};
     
    198198void TrajectoryParticle::Thermostat_Langevin(int Step, gsl_rng * r, double *ekin, config *configuration)
    199199{
    200   double sigma  = sqrt(configuration->Thermostats->TargetTemp/type->mass); // sigma = (k_b T)/m (Hartree/atomicmass = atomiclength/atomictime)
     200  double sigma  = sqrt(configuration->Thermostats->TargetTemp/getType()->mass); // sigma = (k_b T)/m (Hartree/atomicmass = atomiclength/atomictime)
    201201  Vector &U = Trajectory.U.at(Step);
    202202  if (FixedIon == 0) { // even FixedIon moves, only not by other's forces
     
    211211    }
    212212    for (int d=0; d<NDIM; d++)
    213       *ekin += 0.5*type->mass * U[d]*U[d];
     213      *ekin += 0.5*getType()->mass * U[d]*U[d];
    214214  }
    215215};
     
    227227    for (int d=0; d<NDIM; d++) {
    228228      U[d] *= sqrt(1+(configuration->Deltat/configuration->Thermostats->TempFrequency)*(ScaleTempFactor-1));
    229       *ekin += 0.5*type->mass * U[d]*U[d];
     229      *ekin += 0.5*getType()->mass * U[d]*U[d];
    230230    }
    231231  }
     
    241241  if (FixedIon == 0) { // even FixedIon moves, only not by other's forces
    242242    for (int d=0; d<NDIM; d++) {
    243       *delta_alpha += U[d]*U[d]*type->mass;
     243      *delta_alpha += U[d]*U[d]*getType()->mass;
    244244    }
    245245  }
     
    256256  if (FixedIon == 0) { // even FixedIon moves, only not by other's forces
    257257    for (int d=0; d<NDIM; d++) {
    258         U[d] += configuration->Deltat/type->mass * (configuration->Thermostats->alpha * (U[d] * type->mass));
    259         *ekin += (0.5*type->mass) * U[d]*U[d];
     258        U[d] += configuration->Deltat/getType()->mass * (configuration->Thermostats->alpha * (U[d] * getType()->mass));
     259        *ekin += (0.5*getType()->mass) * U[d]*U[d];
    260260      }
    261261  }
    262262};
     263
     264
     265std::ostream & TrajectoryParticle::operator << (std::ostream &ost) const
     266{
     267  ParticleInfo::operator<<(ost);
     268  ost << "," << getPosition();
     269  return ost;
     270}
     271
     272std::ostream & operator << (std::ostream &ost, const TrajectoryParticle &a)
     273{
     274  a.ParticleInfo::operator<<(ost);
     275  ost << "," << a.getPosition();
     276  return ost;
     277}
     278
  • src/atom_trajectoryparticle.hpp

    re588312 rb5c53d  
    6363  void Thermostat_NoseHoover_scale(int Step, double *ekin, config *configuration);
    6464
     65  std::ostream & operator << (std::ostream &ost) const;
     66
    6567private:
    66 
    6768};
    6869
     70ostream & operator << (ostream &ost, const TrajectoryParticle &a);
    6971
    7072#endif /* ATOM_TRAJECTORYPARTICLE_HPP_ */
  • src/atom_trajectoryparticleinfo.cpp

    re588312 rb5c53d  
    1212/** Constructor of class TrajectoryParticleInfo.
    1313 */
    14 TrajectoryParticleInfo::TrajectoryParticleInfo() : FixedIon(0) {};
     14TrajectoryParticleInfo::TrajectoryParticleInfo() :
     15  FixedIon(0)
     16{};
    1517
    1618/** Destructor of class TrajectoryParticleInfo.
  • src/atom_trajectoryparticleinfo.hpp

    re588312 rb5c53d  
    3636
    3737  TrajectoryParticleInfo();
    38   ~TrajectoryParticleInfo();
     38  virtual ~TrajectoryParticleInfo();
    3939
    4040private:
  • src/bond.cpp

    re588312 rb5c53d  
    77#include "Helpers/MemDebug.hpp"
    88
     9#include "Helpers/Log.hpp"
    910#include "Helpers/Verbose.hpp"
    1011#include "atom.hpp"
     
    1819/** Empty Constructor for class bond.
    1920 */
    20 bond::bond()
    21   : leftatom(NULL), rightatom(NULL), previous(NULL), next(NULL), HydrogenBond(0),
    22     BondDegree(0), nr(-1), Cyclic(false), Type(Undetermined), Used(white)
    23 {
    24 };
     21bond::bond() :
     22  leftatom(NULL),
     23  rightatom(NULL),
     24  previous(NULL),
     25  next(NULL),
     26  HydrogenBond(0),
     27  BondDegree(0),
     28  nr(-1),
     29  Cyclic(false),
     30  Type(Undetermined),
     31  Used(white)
     32{};
    2533
    2634/** Constructor for class bond, taking right and left bond partner
     
    3038 * \param number increasing index
    3139 */
    32 bond::bond(atom *left, atom *right, const int degree, const int number)
    33   : leftatom(left), rightatom(right), previous(NULL), next(NULL), HydrogenBond(0),
    34     BondDegree(degree), nr(number), Cyclic(false), Type(Undetermined), Used(white)
     40bond::bond(atom *left, atom *right, const int degree, const int number) :
     41  leftatom(left),
     42  rightatom(right),
     43  previous(NULL),
     44  next(NULL),
     45  HydrogenBond(0),
     46  BondDegree(degree),
     47  nr(number),
     48  Cyclic(false),
     49  Type(Undetermined),
     50  Used(white)
    3551{
    3652  if ((left != NULL) && (right != NULL)) {
    37     if ((left->type != NULL) && (left->type->Z == 1))
     53    if ((left->getType() != NULL) && (left->getType()->Z == 1))
    3854      HydrogenBond++;
    39     if ((right->type != NULL) && (right->type->Z == 1))
     55    if ((right->getType() != NULL) && (right->getType()->Z == 1))
    4056      HydrogenBond++;
    4157  }
     
    126142double bond::GetDistance() const
    127143{
    128   return (leftatom->node->distance(*rightatom->node));
     144  return (leftatom->distance(*rightatom));
    129145};
    130146
     
    134150double bond::GetDistanceSquared() const
    135151{
    136   return (leftatom->node->DistanceSquared(*rightatom->node));
     152  return (leftatom->DistanceSquared(*rightatom));
    137153};
  • src/bondgraph.cpp

    re588312 rb5c53d  
    2222#include "LinearAlgebra/Vector.hpp"
    2323
     24const double BondGraph::BondThreshold = 0.4;   //!< CSD threshold in bond check which is the width of the interval whose center is the sum of the covalent radii
     25
    2426/** Constructor of class BondGraph.
    2527 * This classes contains typical bond lengths and thus may be used to construct a bond graph for a given molecule.
    2628 */
    27 BondGraph::BondGraph(bool IsA) : BondLengthMatrix(NULL), max_distance(0), IsAngstroem(IsA)
    28 {
    29 };
     29BondGraph::BondGraph(bool IsA) :
     30    BondLengthMatrix(NULL),
     31    max_distance(0),
     32    IsAngstroem(IsA)
     33{};
    3034
    3135/** Destructor of class BondGraph.
     
    128132
    129133  for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    130     if ((*iter)->type->CovalentRadius > max_distance)
    131       max_distance = (*iter)->type->CovalentRadius;
     134    if ((*iter)->getType()->CovalentRadius > max_distance)
     135      max_distance = (*iter)->getType()->CovalentRadius;
    132136  }
    133137  max_distance *= 2.;
     
    145149void BondGraph::CovalentMinMaxDistance(BondedParticle * const Walker, BondedParticle * const OtherWalker, double &MinDistance, double &MaxDistance, bool IsAngstroem)
    146150{
    147   MinDistance = OtherWalker->type->CovalentRadius + Walker->type->CovalentRadius;
     151  MinDistance = OtherWalker->getType()->CovalentRadius + Walker->getType()->CovalentRadius;
    148152  MinDistance *= (IsAngstroem) ? 1. : 1. / AtomicLengthToAngstroem;
    149   MaxDistance = MinDistance + BONDTHRESHOLD;
    150   MinDistance -= BONDTHRESHOLD;
     153  MaxDistance = MinDistance + BondThreshold;
     154  MinDistance -= BondThreshold;
    151155};
    152156
     
    166170    CovalentMinMaxDistance(Walker, OtherWalker, MinDistance, MaxDistance, IsAngstroem);
    167171  } else {
    168     MinDistance = GetBondLength(Walker->type->Z-1, OtherWalker->type->Z-1);
     172    MinDistance = GetBondLength(Walker->getType()->Z-1, OtherWalker->getType()->Z-1);
    169173    MinDistance *= (IsAngstroem) ? 1. : 1. / AtomicLengthToAngstroem;
    170     MaxDistance = MinDistance + BONDTHRESHOLD;
    171     MinDistance -= BONDTHRESHOLD;
     174    MaxDistance = MinDistance + BondThreshold;
     175    MinDistance -= BondThreshold;
    172176  }
    173177};
  • src/bondgraph.hpp

    re588312 rb5c53d  
    2020#include <iosfwd>
    2121
    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
    2522
    2623/****************************************** forward declarations *****************************/
     
    4845
    4946private:
     47  static const double BondThreshold;
     48
    5049  MatrixContainer *BondLengthMatrix;
    5150  double max_distance;
  • src/boundary.cpp

    re588312 rb5c53d  
    66#include "Helpers/MemDebug.hpp"
    77
     8#include "Actions/MoleculeAction/RotateToPrincipalAxisSystemAction.hpp"
     9#include "BoundaryPointSet.hpp"
     10#include "BoundaryLineSet.hpp"
     11#include "BoundaryTriangleSet.hpp"
     12#include "CandidateForTesselation.hpp"
     13//#include "TesselPoint.hpp"
    814#include "World.hpp"
    915#include "atom.hpp"
     
    8692              if (Neighbour == BoundaryPoints[axis].end()) // make it wrap around
    8793                Neighbour = BoundaryPoints[axis].begin();
    88               DistanceVector = runner->second.second->x - Neighbour->second.second->x;
     94              DistanceVector = (runner->second.second->getPosition()) - (Neighbour->second.second->getPosition());
    8995              do { // seek for neighbour pair where it flips
    9096                  OldComponent = DistanceVector[Othercomponent];
     
    9298                  if (Neighbour == BoundaryPoints[axis].end()) // make it wrap around
    9399                    Neighbour = BoundaryPoints[axis].begin();
    94                   DistanceVector = runner->second.second->x - Neighbour->second.second->x;
     100                  DistanceVector = (runner->second.second->getPosition()) - (Neighbour->second.second->getPosition());
    95101                  //Log() << Verbose(2) << "OldComponent is " << OldComponent << ", new one is " << DistanceVector.x[Othercomponent] << "." << endl;
    96102                } while ((runner != Neighbour) && (fabs(OldComponent / fabs(
     
    104110                  //Log() << Verbose(1) << "The pair, where the sign of OtherComponent flips, is: " << *(Neighbour->second.second) << " and " << *(OtherNeighbour->second.second) << "." << endl;
    105111                  // now we have found the pair: Neighbour and OtherNeighbour
    106                   OtherVector = runner->second.second->x - OtherNeighbour->second.second->x;
     112                  OtherVector = (runner->second.second->getPosition()) - (OtherNeighbour->second.second->getPosition());
    107113                  //Log() << Verbose(1) << "Distances to Neighbour and OtherNeighbour are " << DistanceVector.x[component] << " and " << OtherVector.x[component] << "." << endl;
    108114                  //Log() << Verbose(1) << "OtherComponents to Neighbour and OtherNeighbour are " << DistanceVector.x[Othercomponent] << " and " << OtherVector.x[Othercomponent] << "." << endl;
     
    172178    // 3b. construct set of all points, transformed into cylindrical system and with left and right neighbours
    173179    for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    174       ProjectedVector = (*iter)->x - (*MolCenter);
     180      ProjectedVector = (*iter)->getPosition() - (*MolCenter);
    175181      ProjectedVector.ProjectOntoPlane(AxisVector);
    176182
     
    198204          DoLog(2) && (Log() << Verbose(2) << "Keeping new vector due to larger projected distance " << ProjectedVectorNorm << "." << endl);
    199205        } else if (fabs(ProjectedVectorNorm - BoundaryTestPair.first->second.first) < MYEPSILON) {
    200           helper = (*iter)->x;
    201           helper -= *MolCenter;
     206          helper = (*iter)->getPosition() - (*MolCenter);
    202207          const double oldhelperNorm = helper.NormSquared();
    203           helper = BoundaryTestPair.first->second.second->x - (*MolCenter);
     208          helper = BoundaryTestPair.first->second.second->getPosition() - (*MolCenter);
    204209          if (helper.NormSquared() < oldhelperNorm) {
    205210            BoundaryTestPair.first->second.second = (*iter);
     
    254259        {
    255260          Vector SideA, SideB, SideC, SideH;
    256           SideA = left->second.second->x - (*MolCenter);
     261          SideA = left->second.second->getPosition() - (*MolCenter);
    257262          SideA.ProjectOntoPlane(AxisVector);
    258263          //          Log() << Verbose(1) << "SideA: " << SideA << endl;
    259264
    260           SideB = right->second.second->x -(*MolCenter);
     265          SideB = right->second.second->getPosition() -(*MolCenter);
    261266          SideB.ProjectOntoPlane(AxisVector);
    262267          //          Log() << Verbose(1) << "SideB: " << SideB << endl;
    263268
    264           SideC = left->second.second->x - right->second.second->x;
     269          SideC = left->second.second->getPosition() - right->second.second->getPosition();
    265270          SideC.ProjectOntoPlane(AxisVector);
    266271          //          Log() << Verbose(1) << "SideC: " << SideC << endl;
    267272
    268           SideH = runner->second.second->x -(*MolCenter);
     273          SideH = runner->second.second->getPosition() -(*MolCenter);
    269274          SideH.ProjectOntoPlane(AxisVector);
    270275          //          Log() << Verbose(1) << "SideH: " << SideH << endl;
     
    674679  double cellvolume = 0.;
    675680
    676   // transform to PAS
    677   mol->PrincipalAxisSystem(true);
     681  // transform to PAS by Action
     682  Vector MainAxis(0.,0.,1.);
     683  MoleculeRotateToPrincipalAxisSystem(MainAxis);
    678684
    679685  IsAngstroem = configuration->GetIsAngstroem();
     
    699705  // sum up the atomic masses
    700706  for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    701       totalmass += (*iter)->type->mass;
     707      totalmass += (*iter)->getType()->mass;
    702708  }
    703709  DoLog(0) && (Log() << Verbose(0) << "RESULT: The summed mass is " << setprecision(10) << totalmass << " atomicmassunit." << endl);
     
    855861
    856862          // ... and put at new position
    857           Inserter = (*iter)->x;
     863          Inserter = (*iter)->getPosition();
    858864          if (DoRandomRotation)
    859865            Inserter *= Rotations;
     
    880886            // copy atom ...
    881887            CopyAtoms[(*iter)->nr] = (*iter)->clone();
    882             CopyAtoms[(*iter)->nr]->x = Inserter;
     888            (*CopyAtoms[(*iter)->nr]).setPosition(Inserter);
    883889            Filling->AddAtom(CopyAtoms[(*iter)->nr]);
    884             DoLog(4) && (Log() << Verbose(4) << "Filling atom " << **iter << ", translated to " << AtomTranslations << ", at final position is " << (CopyAtoms[(*iter)->nr]->x) << "." << endl);
     890            DoLog(1) && (Log() << Verbose(1) << "Filling atom " << **iter << ", translated to " << AtomTranslations << ", at final position is " << (CopyAtoms[(*iter)->nr]->getPosition()) << "." << endl);
    885891          } else {
    886892            DoLog(1) && (Log() << Verbose(1) << "INFO: Position at " << Inserter << " is inner point, within boundary or outside of MaxDistance." << endl);
  • src/boundary.hpp

    re588312 rb5c53d  
    3434/********************************************** definitions *********************************/
    3535
    36 #define DEBUG 1
    37 #define DoSingleStepOutput 0
    38 #define SingleStepWidth 10
     36enum { DEBUG=1 };
     37enum { DoSingleStepOutput=0 };
     38enum { SingleStepWidth=10 };
    3939
    40 #define DistancePair pair < double, atom* >
    41 #define DistanceMap multimap < double, atom* >
    42 #define DistanceTestPair pair < DistanceMap::iterator, bool>
     40typedef std::pair < double, class atom* > DistancePair;
     41typedef std::multimap < double, class atom* > DistanceMap;
     42typedef std::pair < DistanceMap::iterator, bool> DistanceTestPair;
    4343
    44 #define Boundaries map <double, DistancePair >
    45 #define BoundariesPair pair<double, DistancePair >
    46 #define BoundariesTestPair pair< Boundaries::iterator, bool>
     44typedef std::map <double, DistancePair > Boundaries;
     45typedef std::pair<double, DistancePair > BoundariesPair;
     46typedef std::pair< Boundaries::iterator, bool> BoundariesTestPair;
    4747
    4848/********************************************** declarations *******************************/
  • src/config.cpp

    re588312 rb5c53d  
    3333/** Constructor for config file class.
    3434 */
    35 config::config() : BG(NULL), Thermostats(0), PsiType(0), MaxPsiDouble(0), PsiMaxNoUp(0), PsiMaxNoDown(0), MaxMinStopStep(1), InitMaxMinStopStep(1), ProcPEGamma(8), ProcPEPsi(1),
    36     configname(NULL), FastParsing(false), Deltat(0.01), basis(""), databasepath(NULL), DoConstrainedMD(0), MaxOuterStep(0), mainname(NULL), defaultpath(NULL), pseudopotpath(NULL),
    37     DoOutVis(0), DoOutMes(1), DoOutNICS(0), DoOutOrbitals(0), DoOutCurrent(0), DoFullCurrent(0), DoPerturbation(0), DoWannier(0), CommonWannier(0), SawtoothStart(0.01),
    38     VectorPlane(0), VectorCut(0.), UseAddGramSch(1), Seed(1), OutVisStep(10), OutSrcStep(5), MaxPsiStep(0), EpsWannier(1e-7), MaxMinStep(100), RelEpsTotalEnergy(1e-7),
    39     RelEpsKineticEnergy(1e-5), MaxMinGapStopStep(0), MaxInitMinStep(100), InitRelEpsTotalEnergy(1e-5), InitRelEpsKineticEnergy(1e-4), InitMaxMinGapStopStep(0), ECut(128.),
    40     MaxLevel(5), RiemannTensor(0), LevRFactor(0), RiemannLevel(0), Lev0Factor(2), RTActualUse(0), AddPsis(0), RCut(20.), StructOpt(0), IsAngstroem(1), RelativeCoord(0),
    41     MaxTypes(0) {
     35config::config() :
     36  BG(NULL),
     37  Thermostats(0),
     38  PsiType(0),
     39  MaxPsiDouble(0),
     40  PsiMaxNoUp(0),
     41  PsiMaxNoDown(0),
     42  MaxMinStopStep(1),
     43  InitMaxMinStopStep(1),
     44  ProcPEGamma(8),
     45  ProcPEPsi(1),
     46  configname(NULL),
     47  FastParsing(false),
     48  Deltat(0.01),
     49  basis(""),
     50  databasepath(NULL),
     51  DoConstrainedMD(0),
     52  MaxOuterStep(0),
     53  mainname(NULL),
     54  defaultpath(NULL),
     55  pseudopotpath(NULL),
     56  DoOutVis(0),
     57  DoOutMes(1),
     58  DoOutNICS(0),
     59  DoOutOrbitals(0),
     60  DoOutCurrent(0),
     61  DoFullCurrent(0),
     62  DoPerturbation(0),
     63  DoWannier(0),
     64  CommonWannier(0),
     65  SawtoothStart(0.01),
     66  VectorPlane(0),
     67  VectorCut(0.),
     68  UseAddGramSch(1),
     69  Seed(1),
     70  OutVisStep(10),
     71  OutSrcStep(5),
     72  MaxPsiStep(0),
     73  EpsWannier(1e-7),
     74  MaxMinStep(100),
     75  RelEpsTotalEnergy(1e-7),
     76  RelEpsKineticEnergy(1e-5),
     77  MaxMinGapStopStep(0),
     78  MaxInitMinStep(100),
     79  InitRelEpsTotalEnergy(1e-5),
     80  InitRelEpsKineticEnergy(1e-4),
     81  InitMaxMinGapStopStep(0),
     82  ECut(128.),
     83  MaxLevel(5),
     84  RiemannTensor(0),
     85  LevRFactor(0),
     86  RiemannLevel(0),
     87  Lev0Factor(2),
     88  RTActualUse(0),
     89  AddPsis(0),
     90  RCut(20.),
     91  StructOpt(0),
     92  IsAngstroem(1),
     93  RelativeCoord(0),
     94  MaxTypes(0)
     95{
    4296  mainname = new char[MAXSTRINGSIZE];
    4397  defaultpath = new char[MAXSTRINGSIZE];
     
    439493    map<int, atom *> LinearList;
    440494    atom *neues = NULL;
     495    Vector position;
    441496    if (!FastParsing) {
    442497      // parse in trajectories
     
    452507              AtomList[i][j] = neues;
    453508              LinearList[ FileBuffer->LineMapping[FileBuffer->CurrentLine] ] = neues;
    454               neues->type = elementhash[i]; // find element type
     509              neues->setType(elementhash[i]); // find element type
    455510            } else
    456511              neues = AtomList[i][j];
    457512            status = (status &&
    458                     ParseForParameter(verbose,FileBuffer, keyword, 0, 1, 1, double_type, &neues->x[0], 1, (repetition == 0) ? critical : optional) &&
    459                     ParseForParameter(verbose,FileBuffer, keyword, 0, 2, 1, double_type, &neues->x[1], 1, (repetition == 0) ? critical : optional) &&
    460                     ParseForParameter(verbose,FileBuffer, keyword, 0, 3, 1, double_type, &neues->x[2], 1, (repetition == 0) ? critical : optional) &&
     513                    ParseForParameter(verbose,FileBuffer, keyword, 0, 1, 1, double_type, &position[0], 1, (repetition == 0) ? critical : optional) &&
     514                    ParseForParameter(verbose,FileBuffer, keyword, 0, 2, 1, double_type, &position[1], 1, (repetition == 0) ? critical : optional) &&
     515                    ParseForParameter(verbose,FileBuffer, keyword, 0, 3, 1, double_type, &position[2], 1, (repetition == 0) ? critical : optional) &&
    461516                    ParseForParameter(verbose,FileBuffer, keyword, 0, 4, 1, int_type, &neues->FixedIon, 1, (repetition == 0) ? critical : optional));
    462             if (!status) break;
     517            if (!status)
     518              break;
     519            neues ->setPosition(position);
    463520
    464521            // check size of vectors
     
    472529            // put into trajectories list
    473530            for (int d=0;d<NDIM;d++)
    474               neues->Trajectory.R.at(repetition)[d] = neues->x[d];
     531              neues->Trajectory.R.at(repetition)[d] = neues->at(d);
    475532
    476533            // parse velocities if present
    477             if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 5, 1, double_type, &neues->v[0], 1,optional))
    478               neues->v[0] = 0.;
    479             if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 6, 1, double_type, &neues->v[1], 1,optional))
    480               neues->v[1] = 0.;
    481             if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 7, 1, double_type, &neues->v[2], 1,optional))
    482               neues->v[2] = 0.;
     534            if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 5, 1, double_type, &neues->AtomicVelocity[0], 1,optional))
     535              neues->AtomicVelocity[0] = 0.;
     536            if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 6, 1, double_type, &neues->AtomicVelocity[1], 1,optional))
     537              neues->AtomicVelocity[1] = 0.;
     538            if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 7, 1, double_type, &neues->AtomicVelocity[2], 1,optional))
     539              neues->AtomicVelocity[2] = 0.;
    483540            for (int d=0;d<NDIM;d++)
    484               neues->Trajectory.U.at(repetition)[d] = neues->v[d];
     541              neues->Trajectory.U.at(repetition)[d] = neues->AtomicVelocity[d];
    485542
    486543            // parse forces if present
     
    531588            AtomList[i][j] = neues;
    532589            LinearList[ FileBuffer->LineMapping[FileBuffer->CurrentLine] ] = neues;
    533             neues->type = elementhash[i]; // find element type
     590            neues->setType(elementhash[i]); // find element type
    534591          } else
    535592            neues = AtomList[i][j];
    536593          // then parse for each atom the coordinates as often as present
    537           ParseForParameter(verbose,FileBuffer, keyword, 0, 1, 1, double_type, &neues->x[0], repetition,critical);
    538           ParseForParameter(verbose,FileBuffer, keyword, 0, 2, 1, double_type, &neues->x[1], repetition,critical);
    539           ParseForParameter(verbose,FileBuffer, keyword, 0, 3, 1, double_type, &neues->x[2], repetition,critical);
     594          ParseForParameter(verbose,FileBuffer, keyword, 0, 1, 1, double_type, &position[0], repetition,critical);
     595          ParseForParameter(verbose,FileBuffer, keyword, 0, 2, 1, double_type, &position[1], repetition,critical);
     596          ParseForParameter(verbose,FileBuffer, keyword, 0, 3, 1, double_type, &position[2], repetition,critical);
     597          neues->setPosition(position);
    540598          ParseForParameter(verbose,FileBuffer, keyword, 0, 4, 1, int_type, &neues->FixedIon, repetition,critical);
    541           if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 5, 1, double_type, &neues->v[0], repetition,optional))
    542             neues->v[0] = 0.;
    543           if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 6, 1, double_type, &neues->v[1], repetition,optional))
    544             neues->v[1] = 0.;
    545           if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 7, 1, double_type, &neues->v[2], repetition,optional))
    546             neues->v[2] = 0.;
     599          if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 5, 1, double_type, &neues->AtomicVelocity[0], repetition,optional))
     600            neues->AtomicVelocity[0] = 0.;
     601          if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 6, 1, double_type, &neues->AtomicVelocity[1], repetition,optional))
     602            neues->AtomicVelocity[1] = 0.;
     603          if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 7, 1, double_type, &neues->AtomicVelocity[2], repetition,optional))
     604            neues->AtomicVelocity[2] = 0.;
    547605          // here we don't care if forces are present (last in trajectories is always equal to current position)
    548           neues->type = elementhash[i]; // find element type
     606          neues->setType(elementhash[i]); // find element type
    549607          mol->AddAtom(neues);
    550608        }
     
    10091067        istringstream input2(zeile);
    10101068        atom *neues = World::getInstance().createAtom();
    1011         input2 >> neues->x[0]; // x
    1012         input2 >> neues->x[1]; // y
    1013         input2 >> neues->x[2]; // z
     1069        double tmp;
     1070        for (int j=0;j<NDIM;j++) {
     1071          input2 >> tmp;
     1072          neues->set(j,tmp);
     1073        }
    10141074        input2 >> l;
    1015         neues->type = elementhash[No]; // find element type
     1075        neues->setType(elementhash[No]); // find element type
    10161076        mol->AddAtom(neues);
    10171077      }
     
    12791339    AtomNo = 0;
    12801340    for (molecule::const_iterator iter = (*MolRunner)->begin(); iter != (*MolRunner)->end(); ++iter) {
    1281       sprintf(name, "%2s%2d",(*iter)->type->getSymbol().c_str(), elementNo[(*iter)->type->Z]);
    1282       elementNo[(*iter)->type->Z] = (elementNo[(*iter)->type->Z]+1) % 100;   // confine to two digits
     1341      sprintf(name, "%2s%2d",(*iter)->getType()->getSymbol().c_str(), elementNo[(*iter)->getType()->Z]);
     1342      elementNo[(*iter)->getType()->Z] = (elementNo[(*iter)->getType()->Z]+1) % 100;   // confine to two digits
    12831343      fprintf(f,
    12841344             "ATOM %6u %-4s %4s%c%4u    %8.3f%8.3f%8.3f%6.2f%6.2f      %4s%2s%2s\n",
     
    12881348             'a'+(unsigned char)(AtomNo % 26),           /* letter for chain */
    12891349             MolNo,         /* residue sequence number */
    1290              (*iter)->node->at(0),                 /* position X in Angstroem */
    1291              (*iter)->node->at(1),                 /* position Y in Angstroem */
    1292              (*iter)->node->at(2),                 /* position Z in Angstroem */
    1293              (double)(*iter)->type->Valence,         /* occupancy */
    1294              (double)(*iter)->type->NoValenceOrbitals,          /* temperature factor */
     1350             (*iter)->at(0),                 /* position X in Angstroem */
     1351             (*iter)->at(1),                 /* position Y in Angstroem */
     1352             (*iter)->at(2),                 /* position Z in Angstroem */
     1353             (double)(*iter)->getType()->Valence,         /* occupancy */
     1354             (double)(*iter)->getType()->NoValenceOrbitals,          /* temperature factor */
    12951355             "0",            /* segment identifier */
    1296              (*iter)->type->getSymbol().c_str(),    /* element symbol */
     1356             (*iter)->getType()->getSymbol().c_str(),    /* element symbol */
    12971357             "0");           /* charge */
    12981358      AtomNo++;
     
    13321392  AtomNo = 0;
    13331393  for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    1334     sprintf(name, "%2s%2d",(*iter)->type->getSymbol().c_str(), elementNo[(*iter)->type->Z]);
    1335     elementNo[(*iter)->type->Z] = (elementNo[(*iter)->type->Z]+1) % 100;   // confine to two digits
     1394    sprintf(name, "%2s%2d",(*iter)->getType()->getSymbol().c_str(), elementNo[(*iter)->getType()->Z]);
     1395    elementNo[(*iter)->getType()->Z] = (elementNo[(*iter)->getType()->Z]+1) % 100;   // confine to two digits
    13361396    fprintf(f,
    13371397           "ATOM %6u %-4s %4s%c%4u    %8.3f%8.3f%8.3f%6.2f%6.2f      %4s%2s%2s\n",
     
    13411401           'a'+(unsigned char)(AtomNo % 26),           /* letter for chain */
    13421402           0,         /* residue sequence number */
    1343            (*iter)->node->at(0),                 /* position X in Angstroem */
    1344            (*iter)->node->at(1),                 /* position Y in Angstroem */
    1345            (*iter)->node->at(2),                 /* position Z in Angstroem */
    1346            (double)(*iter)->type->Valence,         /* occupancy */
    1347            (double)(*iter)->type->NoValenceOrbitals,          /* temperature factor */
     1403           (*iter)->at(0),                 /* position X in Angstroem */
     1404           (*iter)->at(1),                 /* position Y in Angstroem */
     1405           (*iter)->at(2),                 /* position Z in Angstroem */
     1406           (double)(*iter)->getType()->Valence,         /* occupancy */
     1407           (double)(*iter)->getType()->NoValenceOrbitals,          /* temperature factor */
    13481408           "0",            /* segment identifier */
    1349            (*iter)->type->getSymbol().c_str(),    /* element symbol */
     1409           (*iter)->getType()->getSymbol().c_str(),    /* element symbol */
    13501410           "0");           /* charge */
    13511411    AtomNo++;
     
    13901450    *output << mol->name << "\t";
    13911451    *output << 0 << "\t";
    1392     *output << (*iter)->node->at(0) << "\t" << (*iter)->node->at(1) << "\t" << (*iter)->node->at(2) << "\t";
    1393     *output << static_cast<double>((*iter)->type->Valence) << "\t";
    1394     *output << (*iter)->type->getSymbol() << "\t";
     1452    *output << (*iter)->at(0) << "\t" << (*iter)->at(1) << "\t" << (*iter)->at(2) << "\t";
     1453    *output << static_cast<double>((*iter)->getType()->Valence) << "\t";
     1454    *output << (*iter)->getType()->getSymbol() << "\t";
    13951455    for (BondList::iterator runner = (*iter)->ListOfBonds.begin(); runner != (*iter)->ListOfBonds.end(); runner++)
    13961456      *output << (*runner)->GetOtherAtom(*iter)->nr << "\t";
     
    14621522        *output << (*MolWalker)->name << "\t";
    14631523        *output << MolCounter+1 << "\t";
    1464         *output << (*iter)->node->at(0) << "\t" << (*iter)->node->at(1) << "\t" << (*iter)->node->at(2) << "\t";
    1465         *output << (double)(*iter)->type->Valence << "\t";
    1466         *output << (*iter)->type->getSymbol() << "\t";
     1524        *output << (*iter)->at(0) << "\t" << (*iter)->at(1) << "\t" << (*iter)->at(2) << "\t";
     1525        *output << (double)(*iter)->getType()->Valence << "\t";
     1526        *output << (*iter)->getType()->getSymbol() << "\t";
    14671527        for (BondList::iterator runner = (*iter)->ListOfBonds.begin(); runner != (*iter)->ListOfBonds.end(); runner++)
    14681528          *output << LocalNotoGlobalNoMap[ (*runner)->GetOtherAtom((*iter))->getId() ] << "\t";
  • src/defs.hpp

    re588312 rb5c53d  
    88#define DEFS_HPP_
    99
    10 #define MYEPSILON 1e-13   //!< machine epsilon precision
    11 #define NDIM  3   //!< number of spatial dimensions
    12 #define MAX_ELEMENTS 128  //!< maximum number of elements for certain lookup tables
    13 #define AtomicLengthToAngstroem  0.52917721 //!< conversion factor from atomic length/bohrradius to angstroem
    14 #define AtomicEnergyToKelvin 315774.67  //!< conversion factor from atomic energy to kelvin via boltzmann factor
    15 #define KelvinToAtomicTemperature 3.1668152e-06    //!< conversion factor for Kelvin to atomic temperature (Hartree over k_B)
    16 #define KelvinToeV 8.6173422e-05                   //!< conversion factor for Kelvin to Ht (k_B * T = energy), thus Boltzmann constant in eV/K
    17 #define AtomicMassUnitsToeV 931494088.        //!< conversion factor for atomic weight in units to mass in eV
    18 #define AtomicMassUnitsToHt 34480864.        //!< conversion factor for atomic weight in units to mass in Ht (protonmass/electronmass * electron_mass_in_Ht
    19 #define ElectronMass_Ht 18778.865            //!< electron mass in Ht
    20 #define ElectronMass_eV 510998.903           //!< electron mass in eV
    21 #define Units2Electronmass (AtomicMassUnitsToeV/ElectronMass_eV) //!< atomic mass unit in eV/ electron mass in eV = 1 822.88863
    22 #define Atomictime2Femtoseconds 0.024188843     //!< Atomictime in fs
     10enum { NDIM = 3 };   //!< number of spatial dimensions
     11enum { MAX_ELEMENTS = 128}; //!< maximum number of elements for certain lookup tables
    2312
    24 #define VERSIONSTRING "v1.0"
     13extern "C" const double MYEPSILON;  //!< machine epsilon precision
     14extern "C" const double AtomicLengthToAngstroem; //!< conversion factor from atomic length/bohrradius to angstroem
     15extern "C" const double AtomicEnergyToKelvin;  //!< conversion factor from atomic energy to kelvin via boltzmann factor
     16extern "C" const double KelvinToAtomicTemperature;    //!< conversion factor for Kelvin to atomic temperature (Hartree over k_B)
     17extern "C" const double KelvinToeV;                   //!< conversion factor for Kelvin to Ht (k_B * T = energy), thus Boltzmann constant in eV/K
     18extern "C" const double AtomicMassUnitsToeV;        //!< conversion factor for atomic weight in units to mass in eV
     19extern "C" const double AtomicMassUnitsToHt;        //!< conversion factor for atomic weight in units to mass in Ht (protonmass/electronmass * electron_mass_in_Ht
     20extern "C" const double ElectronMass_Ht;            //!< electron mass in Ht
     21extern "C" const double ElectronMass_eV;           //!< electron mass in eV
     22extern "C" const double Units2Electronmass; //!< atomic mass unit in eV/ electron mass in eV = 1 822.88863
     23extern "C" const double Atomictime2Femtoseconds;     //!< Atomictime in fs
    2524
    26 #define LocalPath "./"
     25extern "C" const char* VERSIONSTRING;
     26
     27extern "C" const char* LocalPath;
    2728
    2829//enum BondOrderScheme { NoScheme, BottomUp, TopDown, ANOVA, Combined }; //!< Fragmentation scheme used in BOSS
     
    4849
    4950// maximum length of any char array
    50 #define MAXSTRINGSIZE 255
     51enum { MAXSTRINGSIZE = 255 };
    5152
    5253// various standard filenames
    53 #define DEFAULTCONFIG "main_pcp_linux"    //!< default filename of config file
    54 #define CONVEXENVELOPE "ConvexEnvelope.dat"    //!< default filename of convex envelope tecplot data file
    55 #define KEYSETFILE "KeySets.dat"    //!< default filename of BOSSANOVA key sets file
    56 #define ADJACENCYFILE "Adjacency.dat"    //!< default filename of BOSSANOVA adjacancy file
    57 #define TEFACTORSFILE "TE-Factors.dat"    //!< default filename of BOSSANOVA total energy factors file
    58 #define FORCESFILE "Forces-Factors.dat"    //!< default filename of BOSSANOVA force factors file
    59 #define HCORRECTIONSUFFIX "Hcorrection.dat"    //!< default filename of BOSSANOVA H correction file (unwanted saturation interaction)
    60 #define FITCONSTANTSUFFIX "FitConstant.dat"   //!< suffix of default filename of BOSSANOVA fit constants file (unwanted saturation interaction)
    61 #define SHIELDINGSUFFIX "sigma_all.csv"                //!< default filename of BOSSANOVA shieldings file
    62 #define SHIELDINGPASSUFFIX "sigma_all_PAS.csv"                 //!< default filename of BOSSANOVA shieldings PAS file
    63 #define ORDERATSITEFILE "OrderAtSite.dat"    //!< default filename of BOSSANOVA Bond Order at each atom file
    64 #define ENERGYPERFRAGMENT "EnergyPerFragment"    //!< default filename of BOSSANOVA Energy contribution Per Fragment file
    65 #define FRAGMENTPREFIX "BondFragment"    //!< default filename prefix of BOSSANOVA fragment config and directories
    66 #define STANDARDCONFIG "unknown.conf"    //!< default filename of standard config file
    67 #define STANDARDELEMENTSDB "elements.db"    //!< default filename of elements data base with masses, Z, VanDerWaals radii, ...
    68 #define STANDARDVALENCEDB "valence.db"    //!< default filename of valence number per element database
    69 #define STANDARDORBITALDB "orbitals.db"    //!< default filename of orbitals per element database
    70 #define STANDARDHBONDDISTANCEDB "Hbonddistance.db"    //!< default filename of typial bond distance to hydrogen database
    71 #define STANDARDHBONDANGLEDB "Hbondangle.db"    //!< default filename of typial bond angle to hydrogen database
     54extern "C" const char *DEFAULTCONFIG;    //!< default filename of config file
     55extern "C" const char *CONVEXENVELOPE;    //!< default filename of convex envelope tecplot data file
     56extern "C" const char *KEYSETFILE;    //!< default filename of BOSSANOVA key sets file
     57extern "C" const char *ADJACENCYFILE;    //!< default filename of BOSSANOVA adjacancy file
     58extern "C" const char *TEFACTORSFILE;    //!< default filename of BOSSANOVA total energy factors file
     59extern "C" const char *FORCESFILE;    //!< default filename of BOSSANOVA force factors file
     60extern "C" const char *HCORRECTIONSUFFIX;    //!< default filename of BOSSANOVA H correction file (unwanted saturation interaction)
     61extern "C" const char *FITCONSTANTSUFFIX;   //!< suffix of default filename of BOSSANOVA fit constants file (unwanted saturation interaction)
     62extern "C" const char *SHIELDINGSUFFIX;                //!< default filename of BOSSANOVA shieldings file
     63extern "C" const char *SHIELDINGPASSUFFIX;                 //!< default filename of BOSSANOVA shieldings PAS file
     64extern "C" const char *ORDERATSITEFILE;    //!< default filename of BOSSANOVA Bond Order at each atom file
     65extern "C" const char *ENERGYPERFRAGMENT;    //!< default filename of BOSSANOVA Energy contribution Per Fragment file
     66extern "C" const char *FRAGMENTPREFIX;    //!< default filename prefix of BOSSANOVA fragment config and directories
     67extern "C" const char *STANDARDCONFIG;    //!< default filename of standard config file
     68extern "C" const char *STANDARDELEMENTSDB;    //!< default filename of elements data base with masses, Z, VanDerWaals radii, ...
     69extern "C" const char *STANDARDVALENCEDB;    //!< default filename of valence number per element database
     70extern "C" const char *STANDARDORBITALDB;    //!< default filename of orbitals per element database
     71extern "C" const char *STANDARDHBONDDISTANCEDB;    //!< default filename of typial bond distance to hydrogen database
     72extern "C" const char *STANDARDHBONDANGLEDB;    //!< default filename of typial bond angle to hydrogen database
    7273
    7374// some values
    74 #define SOLVENTDENSITY_A 0.6022142
    75 #define SOLVENTDENSITY_a0 0.089238936
     75extern "C" const double SOLVENTDENSITY_A;
     76extern "C" const double SOLVENTDENSITY_a0;
    7677
    7778
    78 #define UPDATECOUNT 10  //!< update ten sites per BOSSANOVA interval
     79extern "C" const int UPDATECOUNT;  //!< update ten sites per BOSSANOVA interval
    7980
    80 #define STD_MENU_LENGTH 60
    81 #define STD_MENU_TITLE_SPACER '='
    82 #define STD_SEPERATOR_SPACER '-'
     81extern "C" const int STD_MENU_LENGTH;
     82extern "C" const char STD_MENU_TITLE_SPACER;
     83extern "C" const char STD_SEPERATOR_SPACER;
    8384
    84 #define MOLECUILDER_NAME "Molecuilder"
     85extern "C" const char *MOLECUILDER_NAME;
    8586
    8687const extern unsigned int MAX_POOL_FRAGMENTATION;
  • src/ellipsoid.cpp

    re588312 rb5c53d  
    1515#include <set>
    1616
     17#include "BoundaryPointSet.hpp"
    1718#include "boundary.hpp"
    1819#include "ellipsoid.hpp"
     
    304305              if ((current != PickedAtomNrs.end()) && (*current == index)) {
    305306                Candidate = (*Runner);
    306                 DoLog(2) && (Log() << Verbose(2) << "Current picked node is " << **Runner << " with index " << index << "." << endl);
    307                 x[PointsPicked++] = *Candidate->node;    // we have one more atom picked
     307                DoLog(2) && (Log() << Verbose(2) << "Current picked node is " << (*Runner)->getName() << " with index " << index << "." << endl);
     308                x[PointsPicked++] = Candidate->getPosition();    // we have one more atom picked
    308309                current++;    // next pre-picked atom
    309310              }
     
    351352      //Log() << Verbose(3) << "Current node is " << *Runner->second->node << " with " << value << " ... " << threshold << ": ";
    352353      if (value > threshold) {
    353         x[PointsPicked] = (*Runner->second->node->node);
     354        x[PointsPicked] = (Runner->second->node->getPosition());
    354355        PointsPicked++;
    355356        //Log() << Verbose(0) << "IN." << endl;
     
    388389  Center.Zero();
    389390  for (PointMap::iterator Runner = T->PointsOnBoundary.begin(); Runner != T->PointsOnBoundary.end(); Runner++)
    390     Center += (*Runner->second->node->node);
     391    Center += (Runner->second->node->getPosition());
    391392  Center.Scale(1./T->PointsOnBoundaryCount);
    392393  DoLog(1) && (Log() << Verbose(1) << "Center is at " << Center << "." << endl);
  • src/joiner.cpp

    re588312 rb5c53d  
    209209  prefix << dir << ForceFragmentSuffix;
    210210  if (!ForceFragments.WriteTotalFragments(argv[1], (prefix.str()).c_str())) return 1;
    211   if (!CreateDataFragment(EnergyFragments, KeySet, argv[1], FRAGMENTPREFIX ENERGYPERFRAGMENT, "fragment energy versus the Fragment No", "today", CreateEnergy)) return 1;
     211  {
     212    std::string fileprefix(FRAGMENTPREFIX);
     213    fileprefix += ENERGYPERFRAGMENT;
     214    if (!CreateDataFragment(EnergyFragments, KeySet, argv[1], fileprefix.c_str(), "fragment energy versus the Fragment No", "today", CreateEnergy)) return 1;
     215  }
    212216  if (!NoHessian) {
    213217    prefix.str(" ");
  • src/linkedcell.cpp

    re588312 rb5c53d  
    2121/** Constructor for class LinkedCell.
    2222 */
    23 LinkedCell::LinkedCell()
    24 {
    25   LC = NULL;
     23LinkedCell::LinkedCell() :
     24  LC(NULL),
     25  index(-1),
     26  RADIUS(0.)
     27{
    2628  for(int i=0;i<NDIM;i++)
    2729    N[i] = 0;
    28   index = -1;
    29   RADIUS = 0.;
    3030  max.Zero();
    3131  min.Zero();
     
    3636 * \param RADIUS edge length of cells
    3737 */
    38 LinkedCell::LinkedCell(const PointCloud * const set, const double radius)
     38LinkedCell::LinkedCell(const PointCloud * const set, const double radius) :
     39  RADIUS(radius),
     40  LC(NULL),
     41  index(-1)
    3942{
    4043  TesselPoint *Walker = NULL;
    4144
    42   RADIUS = radius;
    43   LC = NULL;
    4445  for(int i=0;i<NDIM;i++)
    4546    N[i] = 0;
    46   index = -1;
    4747  max.Zero();
    4848  min.Zero();
     
    5656  Walker = set->GetPoint();
    5757  for (int i=0;i<NDIM;i++) {
    58     max[i] = Walker->node->at(i);
    59     min[i] = Walker->node->at(i);
     58    max[i] = Walker->at(i);
     59    min[i] = Walker->at(i);
    6060  }
    6161  set->GoToFirst();
     
    6363    Walker = set->GetPoint();
    6464    for (int i=0;i<NDIM;i++) {
    65       if (max[i] < Walker->node->at(i))
    66         max[i] = Walker->node->at(i);
    67       if (min[i] > Walker->node->at(i))
    68         min[i] = Walker->node->at(i);
     65      if (max[i] < Walker->at(i))
     66        max[i] = Walker->at(i);
     67      if (min[i] > Walker->at(i))
     68        min[i] = Walker->at(i);
    6969    }
    7070    set->GoToNext();
     
    9696    Walker = set->GetPoint();
    9797    for (int i=0;i<NDIM;i++) {
    98       n[i] = static_cast<int>(floor((Walker->node->at(i) - min[i])/RADIUS));
     98      n[i] = static_cast<int>(floor((Walker->at(i) - min[i])/RADIUS));
    9999    }
    100100    index = n[0] * N[1] * N[2] + n[1] * N[2] + n[2];
     
    112112 * \param RADIUS edge length of cells
    113113 */
    114 LinkedCell::LinkedCell(LinkedNodes *set, const double radius)
     114LinkedCell::LinkedCell(LinkedNodes *set, const double radius) :
     115  RADIUS(radius),
     116  LC(NULL),
     117  index(-1)
    115118{
    116119  class TesselPoint *Walker = NULL;
    117   RADIUS = radius;
    118   LC = NULL;
    119120  for(int i=0;i<NDIM;i++)
    120121    N[i] = 0;
    121   index = -1;
    122122  max.Zero();
    123123  min.Zero();
     
    130130  LinkedNodes::iterator Runner = set->begin();
    131131  for (int i=0;i<NDIM;i++) {
    132     max[i] = (*Runner)->node->at(i);
    133     min[i] = (*Runner)->node->at(i);
     132    max[i] = (*Runner)->at(i);
     133    min[i] = (*Runner)->at(i);
    134134  }
    135135  for (LinkedNodes::iterator Runner = set->begin(); Runner != set->end(); Runner++) {
    136136    Walker = *Runner;
    137137    for (int i=0;i<NDIM;i++) {
    138       if (max[i] < Walker->node->at(i))
    139         max[i] = Walker->node->at(i);
    140       if (min[i] > Walker->node->at(i))
    141         min[i] = Walker->node->at(i);
     138      if (max[i] < Walker->at(i))
     139        max[i] = Walker->at(i);
     140      if (min[i] > Walker->at(i))
     141        min[i] = Walker->at(i);
    142142    }
    143143  }
     
    167167    Walker = *Runner;
    168168    for (int i=0;i<NDIM;i++) {
    169       n[i] = static_cast<int>(floor((Walker->node->at(i) - min[i])/RADIUS));
     169      n[i] = static_cast<int>(floor((Walker->at(i) - min[i])/RADIUS));
    170170    }
    171171    index = n[0] * N[1] * N[2] + n[1] * N[2] + n[2];
     
    248248 * \return Vector is inside bounding box - true, else - false
    249249 */
    250 bool LinkedCell::SetIndexToVector(const Vector * const x) const
     250bool LinkedCell::SetIndexToVector(const Vector & x) const
    251251{
    252252  for (int i=0;i<NDIM;i++)
    253     n[i] = (int)floor((x->at(i) - min[i])/RADIUS);
     253    n[i] = (int)floor((x.at(i) - min[i])/RADIUS);
    254254
    255255  return CheckBounds();
     
    264264  bool status = false;
    265265  for (int i=0;i<NDIM;i++) {
    266     n[i] = static_cast<int>(floor((Walker->node->at(i) - min[i])/RADIUS));
     266    n[i] = static_cast<int>(floor((Walker->at(i) - min[i])/RADIUS));
    267267  }
    268268  index = n[0] * N[1] * N[2] + n[1] * N[2] + n[2];
     
    404404      Walker = *Runner;
    405405      //Log() << Verbose(1) << "Current neighbour is at " << *Walker->node << "." << endl;
    406       if ((center->DistanceSquared(*Walker->node) - radiusSquared) < MYEPSILON) {
     406      if ((Walker->DistanceSquared(*center) - radiusSquared) < MYEPSILON) {
    407407        TesselList->push_back(Walker);
    408408      }
  • src/linkedcell.hpp

    re588312 rb5c53d  
    6060    const LinkedCell::LinkedNodes* GetRelativeToCurrentCell(const int relative[NDIM])const ;
    6161    bool SetIndexToNode(const TesselPoint * const Walker)const ;
    62     bool SetIndexToVector(const Vector * const x)const ;
     62    bool SetIndexToVector(const Vector &x)const ;
    6363    double SetClosestIndexToOutsideVector(const Vector * const x) const;
    6464    bool CheckBounds()const ;
  • src/molecule.cpp

    re588312 rb5c53d  
    157157  atomIds.erase( atom->getId() );
    158158  atoms.remove( atom );
    159   formula-=atom->type;
     159  formula-=atom->getType();
    160160  atom->removeFromMolecule();
    161161  return iter;
     
    169169    atomIds.erase( key->getId() );
    170170    atoms.remove( key );
    171     formula-=key->type;
     171    formula-=key->getType();
    172172    key->removeFromMolecule();
    173173  }
     
    191191  if (res.second) { // push atom if went well
    192192    atoms.push_back(key);
    193     formula+=key->type;
     193    formula+=key->getType();
    194194    return pair<iterator,bool>(molecule::iterator(--end()),res.second);
    195195  } else {
     
    212212  if (pointer != NULL) {
    213213    pointer->sort = &pointer->nr;
    214     if (pointer->type != NULL) {
    215       formula += pointer->type;
    216       if (pointer->type->Z != 1)
     214    if (pointer->getType() != NULL) {
     215      formula += pointer->getType();
     216      if (pointer->getType()->Z != 1)
    217217        NoNonHydrogen++;
    218218      if(pointer->getName() == "Unknown"){
    219219        stringstream sstr;
    220         sstr << pointer->type->getSymbol() << pointer->nr+1;
     220        sstr << pointer->getType()->getSymbol() << pointer->nr+1;
    221221        pointer->setName(sstr.str());
    222222      }
     
    239239  if (pointer != NULL) {
    240240    atom *walker = pointer->clone();
    241     formula += walker->type;
     241    formula += walker->getType();
    242242    walker->setName(pointer->getName());
    243243    walker->nr = last_atom++;  // increase number within molecule
    244244    insert(walker);
    245     if ((pointer->type != NULL) && (pointer->type->Z != 1))
     245    if ((pointer->getType() != NULL) && (pointer->getType()->Z != 1))
    246246      NoNonHydrogen++;
    247247    retval=walker;
     
    301301//  Log() << Verbose(3) << "Begin of AddHydrogenReplacementAtom." << endl;
    302302  // create vector in direction of bond
    303   InBondvector = TopReplacement->x - TopOrigin->x;
     303  InBondvector = TopReplacement->getPosition() - TopOrigin->getPosition();
    304304  bondlength = InBondvector.Norm();
    305305
     
    313313    Orthovector1.Zero();
    314314    for (int i=NDIM;i--;) {
    315       l = TopReplacement->x[i] - TopOrigin->x[i];
     315      l = TopReplacement->at(i) - TopOrigin->at(i);
    316316      if (fabs(l) > BondDistance) { // is component greater than bond distance
    317317        Orthovector1[i] = (l < 0) ? -1. : +1.;
     
    328328  InBondvector.Normalize();
    329329  // get typical bond length and store as scale factor for later
    330   ASSERT(TopOrigin->type != NULL, "AddHydrogenReplacementAtom: element of TopOrigin is not given.");
    331   BondRescale = TopOrigin->type->HBondDistance[TopBond->BondDegree-1];
     330  ASSERT(TopOrigin->getType() != NULL, "AddHydrogenReplacementAtom: element of TopOrigin is not given.");
     331  BondRescale = TopOrigin->getType()->HBondDistance[TopBond->BondDegree-1];
    332332  if (BondRescale == -1) {
    333333    DoeLog(1) && (eLog()<< Verbose(1) << "There is no typical hydrogen bond distance in replacing bond (" << TopOrigin->getName() << "<->" << TopReplacement->getName() << ") of degree " << TopBond->BondDegree << "!" << endl);
     
    343343    case 1:
    344344      FirstOtherAtom = World::getInstance().createAtom();    // new atom
    345       FirstOtherAtom->type = elemente->FindElement(1);  // element is Hydrogen
    346       FirstOtherAtom->v = TopReplacement->v; // copy velocity
     345      FirstOtherAtom->setType(1);  // element is Hydrogen
     346      FirstOtherAtom->AtomicVelocity = TopReplacement->AtomicVelocity; // copy velocity
    347347      FirstOtherAtom->FixedIon = TopReplacement->FixedIon;
    348       if (TopReplacement->type->Z == 1) { // neither rescale nor replace if it's already hydrogen
     348      if (TopReplacement->getType()->Z == 1) { // neither rescale nor replace if it's already hydrogen
    349349        FirstOtherAtom->father = TopReplacement;
    350350        BondRescale = bondlength;
     
    353353      }
    354354      InBondvector *= BondRescale;   // rescale the distance vector to Hydrogen bond length
    355       FirstOtherAtom->x = TopOrigin->x; // set coordination to origin ...
    356       FirstOtherAtom->x += InBondvector;  // ... and add distance vector to replacement atom
     355      FirstOtherAtom->setPosition(TopOrigin->getPosition() + InBondvector); // set coordination to origin and add distance vector to replacement atom
    357356      AllWentWell = AllWentWell && AddAtom(FirstOtherAtom);
    358357//      Log() << Verbose(4) << "Added " << *FirstOtherAtom << " at: ";
     
    387386        // determine the plane of these two with the *origin
    388387        try {
    389           Orthovector1 =Plane(TopOrigin->x, FirstOtherAtom->x, SecondOtherAtom->x).getNormal();
     388          Orthovector1 =Plane(TopOrigin->getPosition(), FirstOtherAtom->getPosition(), SecondOtherAtom->getPosition()).getNormal();
    390389        }
    391390        catch(LinearDependenceException &excp){
     
    408407      FirstOtherAtom = World::getInstance().createAtom();
    409408      SecondOtherAtom = World::getInstance().createAtom();
    410       FirstOtherAtom->type = elemente->FindElement(1);
    411       SecondOtherAtom->type = elemente->FindElement(1);
    412       FirstOtherAtom->v = TopReplacement->v; // copy velocity
     409      FirstOtherAtom->setType(1);
     410      SecondOtherAtom->setType(1);
     411      FirstOtherAtom->AtomicVelocity = TopReplacement->AtomicVelocity; // copy velocity
    413412      FirstOtherAtom->FixedIon = TopReplacement->FixedIon;
    414       SecondOtherAtom->v = TopReplacement->v; // copy velocity
     413      SecondOtherAtom->AtomicVelocity = TopReplacement->AtomicVelocity; // copy velocity
    415414      SecondOtherAtom->FixedIon = TopReplacement->FixedIon;
    416415      FirstOtherAtom->father = NULL;  // we are just an added hydrogen with no father
    417416      SecondOtherAtom->father = NULL;  //  we are just an added hydrogen with no father
    418       bondangle = TopOrigin->type->HBondAngle[1];
     417      bondangle = TopOrigin->getType()->HBondAngle[1];
    419418      if (bondangle == -1) {
    420419        DoeLog(1) && (eLog()<< Verbose(1) << "There is no typical hydrogen bond angle in replacing bond (" << TopOrigin->getName() << "<->" << TopReplacement->getName() << ") of degree " << TopBond->BondDegree << "!" << endl);
     
    430429//      Log() << Verbose(0) << endl;
    431430//      Log() << Verbose(3) << "Half the bond angle is " << bondangle << ", sin and cos of it: " << sin(bondangle) << ", " << cos(bondangle) << endl;
    432       FirstOtherAtom->x.Zero();
    433       SecondOtherAtom->x.Zero();
     431      FirstOtherAtom->Zero();
     432      SecondOtherAtom->Zero();
    434433      for(int i=NDIM;i--;) { // rotate by half the bond angle in both directions (InBondvector is bondangle = 0 direction)
    435         FirstOtherAtom->x[i] = InBondvector[i] * cos(bondangle) + Orthovector1[i] * (sin(bondangle));
    436         SecondOtherAtom->x[i] = InBondvector[i] * cos(bondangle) + Orthovector1[i] * (-sin(bondangle));
    437       }
    438       FirstOtherAtom->x *= BondRescale;  // rescale by correct BondDistance
    439       SecondOtherAtom->x *= BondRescale;
     434        FirstOtherAtom->set(i, InBondvector[i] * cos(bondangle) + Orthovector1[i] * (sin(bondangle)));
     435        SecondOtherAtom->set(i, InBondvector[i] * cos(bondangle) + Orthovector1[i] * (-sin(bondangle)));
     436      }
     437      FirstOtherAtom->Scale(BondRescale);  // rescale by correct BondDistance
     438      SecondOtherAtom->Scale(BondRescale);
    440439      //Log() << Verbose(3) << "ReScaleCheck: " << FirstOtherAtom->x.Norm() << " and " << SecondOtherAtom->x.Norm() << "." << endl;
    441       for(int i=NDIM;i--;) { // and make relative to origin atom
    442         FirstOtherAtom->x[i] += TopOrigin->x[i];
    443         SecondOtherAtom->x[i] += TopOrigin->x[i];
    444       }
     440      *FirstOtherAtom += TopOrigin->getPosition();
     441      *SecondOtherAtom += TopOrigin->getPosition();
    445442      // ... and add to molecule
    446443      AllWentWell = AllWentWell && AddAtom(FirstOtherAtom);
     
    464461      SecondOtherAtom = World::getInstance().createAtom();
    465462      ThirdOtherAtom = World::getInstance().createAtom();
    466       FirstOtherAtom->type = elemente->FindElement(1);
    467       SecondOtherAtom->type = elemente->FindElement(1);
    468       ThirdOtherAtom->type = elemente->FindElement(1);
    469       FirstOtherAtom->v = TopReplacement->v; // copy velocity
     463      FirstOtherAtom->setType(1);
     464      SecondOtherAtom->setType(1);
     465      ThirdOtherAtom->setType(1);
     466      FirstOtherAtom->AtomicVelocity = TopReplacement->AtomicVelocity; // copy velocity
    470467      FirstOtherAtom->FixedIon = TopReplacement->FixedIon;
    471       SecondOtherAtom->v = TopReplacement->v; // copy velocity
     468      SecondOtherAtom->AtomicVelocity = TopReplacement->AtomicVelocity; // copy velocity
    472469      SecondOtherAtom->FixedIon = TopReplacement->FixedIon;
    473       ThirdOtherAtom->v = TopReplacement->v; // copy velocity
     470      ThirdOtherAtom->AtomicVelocity = TopReplacement->AtomicVelocity; // copy velocity
    474471      ThirdOtherAtom->FixedIon = TopReplacement->FixedIon;
    475472      FirstOtherAtom->father = NULL;  //  we are just an added hydrogen with no father
     
    494491
    495492      // create correct coordination for the three atoms
    496       alpha = (TopOrigin->type->HBondAngle[2])/180.*M_PI/2.;  // retrieve triple bond angle from database
     493      alpha = (TopOrigin->getType()->HBondAngle[2])/180.*M_PI/2.;  // retrieve triple bond angle from database
    497494      l = BondRescale;        // desired bond length
    498495      b = 2.*l*sin(alpha);    // base length of isosceles triangle
     
    505502      factors[1] = f;
    506503      factors[2] = 0.;
    507       FirstOtherAtom->x.LinearCombinationOfVectors(InBondvector, Orthovector1, Orthovector2, factors);
     504      FirstOtherAtom->LinearCombinationOfVectors(InBondvector, Orthovector1, Orthovector2, factors);
    508505      factors[1] = -0.5*f;
    509506      factors[2] = g;
    510       SecondOtherAtom->x.LinearCombinationOfVectors(InBondvector, Orthovector1, Orthovector2, factors);
     507      SecondOtherAtom->LinearCombinationOfVectors(InBondvector, Orthovector1, Orthovector2, factors);
    511508      factors[2] = -g;
    512       ThirdOtherAtom->x.LinearCombinationOfVectors(InBondvector, Orthovector1, Orthovector2, factors);
     509      ThirdOtherAtom->LinearCombinationOfVectors(InBondvector, Orthovector1, Orthovector2, factors);
    513510
    514511      // rescale each to correct BondDistance
     
    518515
    519516      // and relative to *origin atom
    520       FirstOtherAtom->x += TopOrigin->x;
    521       SecondOtherAtom->x += TopOrigin->x;
    522       ThirdOtherAtom->x += TopOrigin->x;
     517      *FirstOtherAtom += TopOrigin->getPosition();
     518      *SecondOtherAtom += TopOrigin->getPosition();
     519      *ThirdOtherAtom += TopOrigin->getPosition();
    523520
    524521      // ... and add to molecule
     
    596593    *item >> x[1];
    597594    *item >> x[2];
    598     Walker->type = elemente->FindElement(shorthand);
    599     if (Walker->type == NULL) {
     595    Walker->setType(elemente->FindElement(shorthand));
     596    if (Walker->getType() == NULL) {
    600597      DoeLog(1) && (eLog()<< Verbose(1) << "Could not parse the element at line: '" << line << "', setting to H.");
    601       Walker->type = elemente->FindElement(1);
     598      Walker->setType(1);
    602599    }
    603600    if (Walker->Trajectory.R.size() <= (unsigned int)MDSteps) {
     
    606603      Walker->Trajectory.F.resize(MDSteps+10);
    607604    }
     605    Walker->setPosition(Vector(x));
    608606    for(j=NDIM;j--;) {
    609       Walker->x[j] = x[j];
    610607      Walker->Trajectory.R.at(MDSteps-1)[j] = x[j];
    611608      Walker->Trajectory.U.at(MDSteps-1)[j] = 0;
     
    702699  atom1->RegisterBond(Binder);
    703700  atom2->RegisterBond(Binder);
    704   if ((atom1->type != NULL) && (atom1->type->Z != 1) && (atom2->type != NULL) && (atom2->type->Z != 1))
     701  if ((atom1->getType() != NULL) && (atom1->getType()->Z != 1) && (atom2->getType() != NULL) && (atom2->getType()->Z != 1))
    705702    NoNonBonds++;
    706703
     
    776773  ASSERT(pointer, "Null pointer passed to molecule::RemoveAtom().");
    777774  OBSERVE;
    778   formula-=pointer->type;
     775  formula-=pointer->getType();
    779776  RemoveBonds(pointer);
    780777  erase(pointer);
     
    790787  if (pointer == NULL)
    791788    return false;
    792   formula-=pointer->type;
     789  formula-=pointer->getType();
    793790  erase(pointer);
    794791  return true;
     
    972969  for (molecule::const_iterator iter = atoms.begin(); iter != atoms.end(); ++iter) {
    973970    (*iter)->nr = i;   // update number in molecule (for easier referencing in FragmentMolecule lateron)
    974     if ((*iter)->type->Z != 1) // count non-hydrogen atoms whilst at it
     971    if ((*iter)->getType()->Z != 1) // count non-hydrogen atoms whilst at it
    975972      NoNonHydrogen++;
    976973    stringstream sstr;
    977     sstr << (*iter)->type->getSymbol() << (*iter)->nr+1;
     974    sstr << (*iter)->getType()->getSymbol() << (*iter)->nr+1;
    978975    (*iter)->setName(sstr.str());
    979976    DoLog(3) && (Log() << Verbose(3) << "Naming atom nr. " << (*iter)->nr << " " << (*iter)->getName() << "." << endl);
  • src/molecule.hpp

    re588312 rb5c53d  
    2424#include "types.hpp"
    2525#include "graph.hpp"
    26 #include "tesselation.hpp"
     26#include "PointCloud.hpp"
    2727#include "Patterns/Observer.hpp"
    2828#include "Patterns/ObservedIterator.hpp"
     
    165165  bool IsEnd() const ;
    166166
    167   // templates for allowing global manipulation of all vectors
    168   template <typename res> void ActOnAllVectors( res (Vector::*f)() ) const;
    169   template <typename res> void ActOnAllVectors( res (Vector::*f)() const) const;
    170   template <typename res, typename T> void ActOnAllVectors( res (Vector::*f)(T), T t ) const;
    171   template <typename res, typename T> void ActOnAllVectors( res (Vector::*f)(T) const, T t ) const;
    172   template <typename res, typename T> void ActOnAllVectors( res (Vector::*f)(T&), T &t ) const;
    173   template <typename res, typename T> void ActOnAllVectors( res (Vector::*f)(T&) const, T &t ) const;
    174   template <typename res, typename T, typename U> void ActOnAllVectors( res (Vector::*f)(T, U), T t, U u ) const;
    175   template <typename res, typename T, typename U> void ActOnAllVectors( res (Vector::*f)(T, U) const, T t, U u ) const;
    176   template <typename res, typename T, typename U, typename V> void ActOnAllVectors( res (Vector::*f)(T, U, V), T t, U u, V v) const;
    177   template <typename res, typename T, typename U, typename V> void ActOnAllVectors( res (Vector::*f)(T, U, V) const, T t, U u, V v) const;
    178 
    179167  // templates for allowing global manipulation of molecule with each atom as single argument
    180168  template <typename res> void ActWithEachAtom( res (molecule::*f)(atom *) ) const;
     
    270258  void Scale(const double ** const factor);
    271259  void DeterminePeriodicCenter(Vector &center);
    272   Vector * DetermineCenterOfGravity();
     260  Vector * DetermineCenterOfGravity() const;
    273261  Vector * DetermineCenterOfAll() const;
    274262  Vector * DetermineCenterOfBox() const;
     
    278266  bool VerletForceIntegration(char *file, config &configuration, const size_t offset);
    279267  void Thermostats(config &configuration, double ActualTemp, int Thermostat);
    280   void PrincipalAxisSystem(bool DoRotate);
    281268  double VolumeOfConvexEnvelope(bool IsAngstroem);
    282269
  • src/molecule_dynamics.cpp

    re588312 rb5c53d  
    513513      Sprinter = mol->AddCopyAtom((*iter));
    514514      for (int n=NDIM;n--;) {
    515         Sprinter->x[n] = (*iter)->Trajectory.R.at(startstep)[n] + (PermutationMap[(*iter)->nr]->Trajectory.R.at(endstep)[n] - (*iter)->Trajectory.R.at(startstep)[n])*((double)step/(double)MaxSteps);
     515        Sprinter->set(n, (*iter)->Trajectory.R.at(startstep)[n] + (PermutationMap[(*iter)->nr]->Trajectory.R.at(endstep)[n] - (*iter)->Trajectory.R.at(startstep)[n])*((double)step/(double)MaxSteps));
    516516        // add to Trajectories
    517517        //Log() << Verbose(3) << step << ">=" << MDSteps-1 << endl;
  • src/molecule_fragmentation.cpp

    re588312 rb5c53d  
    451451      for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
    452452    #ifdef ADDHYDROGEN
    453         if ((*iter)->type->Z != 1) // skip hydrogen
     453        if ((*iter)->getType()->Z != 1) // skip hydrogen
    454454    #endif
    455455        {
     
    471471    for(molecule::const_iterator iter = begin(); iter != end(); ++iter) {
    472472  #ifdef ADDHYDROGEN
    473       if ((*iter)->type->Z != 1) // skip hydrogen
     473      if ((*iter)->getType()->Z != 1) // skip hydrogen
    474474  #endif
    475475      {
     
    880880  for (KeySet::iterator runner = Leaf->begin(); runner != Leaf->end(); runner++) {
    881881    Runner = FindAtom((*runner));
    882     if (Runner->type->Z != 1) { // skip all those added hydrogens when re-filling snake stack
     882    if (Runner->getType()->Z != 1) { // skip all those added hydrogens when re-filling snake stack
    883883      if (ShortestPathList[(*runner)] > SP) {  // remove the oldest one with longest shortest path
    884884        SP = ShortestPathList[(*runner)];
     
    969969    ++iter;
    970970#ifdef ADDHYDROGEN
    971     while ((iter != Leaf->end()) && ((*iter)->type->Z == 1)){ // skip added hydrogen
     971    while ((iter != Leaf->end()) && ((*iter)->getType()->Z == 1)){ // skip added hydrogen
    972972      iter++;
    973973    }
     
    13471347        if ((RestrictedKeySet.find(OtherWalker->nr) != RestrictedKeySet.end())
    13481348  #ifdef ADDHYDROGEN
    1349          && (OtherWalker->type->Z != 1)
     1349         && (OtherWalker->getType()->Z != 1)
    13501350  #endif
    13511351                                                              ) {  // skip hydrogens and restrict to fragment
     
    17411741        Binder = (*BondRunner);
    17421742        for (int i=NDIM;i--;) {
    1743           tmp = fabs(Binder->leftatom->x[i] - Binder->rightatom->x[i]);
     1743          tmp = fabs(Binder->leftatom->at(i) - Binder->rightatom->at(i));
    17441744          //Log() << Verbose(3) << "Checking " << i << "th distance of " << *Binder->leftatom << " to " << *Binder->rightatom << ": " << tmp << "." << endl;
    17451745          if (tmp > BondDistance) {
     
    17551755      // create translation vector from their periodically modified distance
    17561756      for (int i=NDIM;i--;) {
    1757         tmp = Binder->leftatom->x[i] - Binder->rightatom->x[i];
     1757        tmp = Binder->leftatom->at(i) - Binder->rightatom->at(i);
    17581758        if (fabs(tmp) > BondDistance)
    17591759          Translationvector[i] = (tmp < 0) ? +1. : -1.;
     
    17701770        //Log() << Verbose (3) << "Current Walker is: " << *Walker << "." << endl;
    17711771        ColorList[Walker->nr] = black;    // mark as explored
    1772         Walker->x += Translationvector; // translate
     1772        *Walker += Translationvector; // translate
    17731773        for (BondList::const_iterator Runner = Walker->ListOfBonds.begin(); Runner != Walker->ListOfBonds.end(); (++Runner)) {
    17741774          if ((*Runner) != Binder) {
  • src/molecule_geometry.cpp

    re588312 rb5c53d  
    1010#endif
    1111
     12#include "Helpers/helpers.hpp"
     13#include "Helpers/Log.hpp"
    1214#include "Helpers/MemDebug.hpp"
     15#include "Helpers/Verbose.hpp"
     16#include "LinearAlgebra/Line.hpp"
     17#include "LinearAlgebra/Matrix.hpp"
     18#include "LinearAlgebra/Plane.hpp"
    1319
    1420#include "atom.hpp"
     
    1622#include "config.hpp"
    1723#include "element.hpp"
    18 #include "Helpers/helpers.hpp"
    1924#include "leastsquaremin.hpp"
    20 #include "Helpers/Verbose.hpp"
    21 #include "Helpers/Log.hpp"
    2225#include "molecule.hpp"
    2326#include "World.hpp"
    24 #include "LinearAlgebra/Plane.hpp"
    25 #include "LinearAlgebra/Matrix.hpp"
     27
    2628#include "Box.hpp"
     29
    2730#include <boost/foreach.hpp>
    2831
     
    4548
    4649  // go through all atoms
    47   ActOnAllVectors( &Vector::SubtractVector, *Center);
    48   ActOnAllVectors( &Vector::SubtractVector, *CenterBox);
     50  BOOST_FOREACH(atom* iter, atoms){
     51    *iter -= *Center;
     52    *iter -= *CenterBox;
     53  }
    4954  atoms.transformNodes(boost::bind(&Box::WrapPeriodically,domain,_1));
    5055
     
    6368  Box &domain = World::getInstance().getDomain();
    6469
     70  // go through all atoms
    6571  atoms.transformNodes(boost::bind(&Box::WrapPeriodically,domain,_1));
    6672
     
    8086  if (iter != end()) { //list not empty?
    8187    for (int i=NDIM;i--;) {
    82       max->at(i) = (*iter)->x[i];
    83       min->at(i) = (*iter)->x[i];
     88      max->at(i) = (*iter)->at(i);
     89      min->at(i) = (*iter)->at(i);
    8490    }
    8591    for (; iter != end(); ++iter) {// continue with second if present
    8692      //(*iter)->Output(1,1,out);
    8793      for (int i=NDIM;i--;) {
    88         max->at(i) = (max->at(i) < (*iter)->x[i]) ? (*iter)->x[i] : max->at(i);
    89         min->at(i) = (min->at(i) > (*iter)->x[i]) ? (*iter)->x[i] : min->at(i);
     94        max->at(i) = (max->at(i) < (*iter)->at(i)) ? (*iter)->at(i) : max->at(i);
     95        min->at(i) = (min->at(i) > (*iter)->at(i)) ? (*iter)->at(i) : min->at(i);
    9096      }
    9197    }
     
    118124    for (; iter != end(); ++iter) {  // continue with second if present
    119125      Num++;
    120       Center += (*iter)->x;
     126      Center += (*iter)->getPosition();
    121127    }
    122128    Center.Scale(-1./(double)Num); // divide through total number (and sign for direction)
     
    140146    for (; iter != end(); ++iter) {  // continue with second if present
    141147      Num++;
    142       (*a) += (*iter)->x;
     148      (*a) += (*iter)->getPosition();
    143149    }
    144150    a->Scale(1./(double)Num); // divide through total mass (and sign for direction)
     
    162168 * \return pointer to center of gravity vector
    163169 */
    164 Vector * molecule::DetermineCenterOfGravity()
     170Vector * molecule::DetermineCenterOfGravity() const
    165171{
    166172  molecule::const_iterator iter = begin();  // start at first in list
     
    173179  if (iter != end()) {   //list not empty?
    174180    for (; iter != end(); ++iter) {  // continue with second if present
    175       Num += (*iter)->type->mass;
    176       tmp = (*iter)->type->mass * (*iter)->x;
     181      Num += (*iter)->getType()->mass;
     182      tmp = (*iter)->getType()->mass * (*iter)->getPosition();
    177183      (*a) += tmp;
    178184    }
     
    218224    for (int j=0;j<MDSteps;j++)
    219225      (*iter)->Trajectory.R.at(j).ScaleAll(*factor);
    220     (*iter)->x.ScaleAll(*factor);
     226    (*iter)->ScaleAll(*factor);
    221227  }
    222228};
     
    230236    for (int j=0;j<MDSteps;j++)
    231237      (*iter)->Trajectory.R.at(j) += (*trans);
    232     (*iter)->x += (*trans);
     238    *(*iter) += (*trans);
    233239  }
    234240};
     
    243249
    244250  // go through all atoms
    245   ActOnAllVectors( &Vector::AddVector, *trans);
     251  BOOST_FOREACH(atom* iter, atoms){
     252    *iter += *trans;
     253  }
    246254  atoms.transformNodes(boost::bind(&Box::WrapPeriodically,domain,_1));
    247255
     
    275283    for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
    276284#ifdef ADDHYDROGEN
    277       if ((*iter)->type->Z != 1) {
     285      if ((*iter)->getType()->Z != 1) {
    278286#endif
    279         Testvector = inversematrix * (*iter)->x;
     287        Testvector = inversematrix * (*iter)->getPosition();
    280288        Translationvector.Zero();
    281289        for (BondList::const_iterator Runner = (*iter)->ListOfBonds.begin(); Runner != (*iter)->ListOfBonds.end(); (++Runner)) {
    282290         if ((*iter)->nr < (*Runner)->GetOtherAtom((*iter))->nr) // otherwise we shift one to, the other fro and gain nothing
    283291            for (int j=0;j<NDIM;j++) {
    284               tmp = (*iter)->x[j] - (*Runner)->GetOtherAtom(*iter)->x[j];
     292              tmp = (*iter)->at(j) - (*Runner)->GetOtherAtom(*iter)->at(j);
    285293              if ((fabs(tmp)) > BondDistance) {
    286294                flag = false;
     
    300308        // now also change all hydrogens
    301309        for (BondList::const_iterator Runner = (*iter)->ListOfBonds.begin(); Runner != (*iter)->ListOfBonds.end(); (++Runner)) {
    302           if ((*Runner)->GetOtherAtom((*iter))->type->Z == 1) {
    303             Testvector = inversematrix * (*Runner)->GetOtherAtom((*iter))->x;
     310          if ((*Runner)->GetOtherAtom((*iter))->getType()->Z == 1) {
     311            Testvector = inversematrix * (*Runner)->GetOtherAtom((*iter))->getPosition();
    304312            Testvector += Translationvector;
    305313            Testvector *= matrix;
     
    316324};
    317325
    318 /** Transforms/Rotates the given molecule into its principal axis system.
    319  * \param *out output stream for debugging
    320  * \param DoRotate whether to rotate (true) or only to determine the PAS.
    321  * TODO treatment of trajetories missing
    322  */
    323 void molecule::PrincipalAxisSystem(bool DoRotate)
    324 {
    325   double InertiaTensor[NDIM*NDIM];
    326   Vector *CenterOfGravity = DetermineCenterOfGravity();
    327 
    328   CenterPeriodic();
    329 
    330   // reset inertia tensor
    331   for(int i=0;i<NDIM*NDIM;i++)
    332     InertiaTensor[i] = 0.;
    333 
    334   // sum up inertia tensor
    335   for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
    336     Vector x = (*iter)->x;
    337     //x.SubtractVector(CenterOfGravity);
    338     InertiaTensor[0] += (*iter)->type->mass*(x[1]*x[1] + x[2]*x[2]);
    339     InertiaTensor[1] += (*iter)->type->mass*(-x[0]*x[1]);
    340     InertiaTensor[2] += (*iter)->type->mass*(-x[0]*x[2]);
    341     InertiaTensor[3] += (*iter)->type->mass*(-x[1]*x[0]);
    342     InertiaTensor[4] += (*iter)->type->mass*(x[0]*x[0] + x[2]*x[2]);
    343     InertiaTensor[5] += (*iter)->type->mass*(-x[1]*x[2]);
    344     InertiaTensor[6] += (*iter)->type->mass*(-x[2]*x[0]);
    345     InertiaTensor[7] += (*iter)->type->mass*(-x[2]*x[1]);
    346     InertiaTensor[8] += (*iter)->type->mass*(x[0]*x[0] + x[1]*x[1]);
    347   }
    348   // print InertiaTensor for debugging
    349   DoLog(0) && (Log() << Verbose(0) << "The inertia tensor is:" << endl);
    350   for(int i=0;i<NDIM;i++) {
    351     for(int j=0;j<NDIM;j++)
    352       DoLog(0) && (Log() << Verbose(0) << InertiaTensor[i*NDIM+j] << " ");
    353     DoLog(0) && (Log() << Verbose(0) << endl);
    354   }
    355   DoLog(0) && (Log() << Verbose(0) << endl);
    356 
    357   // diagonalize to determine principal axis system
    358   gsl_eigen_symmv_workspace *T = gsl_eigen_symmv_alloc(NDIM);
    359   gsl_matrix_view m = gsl_matrix_view_array(InertiaTensor, NDIM, NDIM);
    360   gsl_vector *eval = gsl_vector_alloc(NDIM);
    361   gsl_matrix *evec = gsl_matrix_alloc(NDIM, NDIM);
    362   gsl_eigen_symmv(&m.matrix, eval, evec, T);
    363   gsl_eigen_symmv_free(T);
    364   gsl_eigen_symmv_sort(eval, evec, GSL_EIGEN_SORT_ABS_DESC);
    365 
    366   for(int i=0;i<NDIM;i++) {
    367     DoLog(1) && (Log() << Verbose(1) << "eigenvalue = " << gsl_vector_get(eval, i));
    368     DoLog(0) && (Log() << Verbose(0) << ", eigenvector = (" << evec->data[i * evec->tda + 0] << "," << evec->data[i * evec->tda + 1] << "," << evec->data[i * evec->tda + 2] << ")" << endl);
    369   }
    370 
    371   // check whether we rotate or not
    372   if (DoRotate) {
    373     DoLog(1) && (Log() << Verbose(1) << "Transforming molecule into PAS ... ");
    374     // the eigenvectors specify the transformation matrix
    375     Matrix M = Matrix(evec->data);
    376 
    377     BOOST_FOREACH(atom* iter, atoms){
    378       (*iter->node) *= M;
    379     }
    380     DoLog(0) && (Log() << Verbose(0) << "done." << endl);
    381 
    382     // summing anew for debugging (resulting matrix has to be diagonal!)
    383     // reset inertia tensor
    384     for(int i=0;i<NDIM*NDIM;i++)
    385       InertiaTensor[i] = 0.;
    386 
    387     // sum up inertia tensor
    388     for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
    389       Vector x = (*iter)->x;
    390       InertiaTensor[0] += (*iter)->type->mass*(x[1]*x[1] + x[2]*x[2]);
    391       InertiaTensor[1] += (*iter)->type->mass*(-x[0]*x[1]);
    392       InertiaTensor[2] += (*iter)->type->mass*(-x[0]*x[2]);
    393       InertiaTensor[3] += (*iter)->type->mass*(-x[1]*x[0]);
    394       InertiaTensor[4] += (*iter)->type->mass*(x[0]*x[0] + x[2]*x[2]);
    395       InertiaTensor[5] += (*iter)->type->mass*(-x[1]*x[2]);
    396       InertiaTensor[6] += (*iter)->type->mass*(-x[2]*x[0]);
    397       InertiaTensor[7] += (*iter)->type->mass*(-x[2]*x[1]);
    398       InertiaTensor[8] += (*iter)->type->mass*(x[0]*x[0] + x[1]*x[1]);
    399     }
    400     // print InertiaTensor for debugging
    401     DoLog(0) && (Log() << Verbose(0) << "The inertia tensor is:" << endl);
    402     for(int i=0;i<NDIM;i++) {
    403       for(int j=0;j<NDIM;j++)
    404         DoLog(0) && (Log() << Verbose(0) << InertiaTensor[i*NDIM+j] << " ");
    405       DoLog(0) && (Log() << Verbose(0) << endl);
    406     }
    407     DoLog(0) && (Log() << Verbose(0) << endl);
    408   }
    409 
    410   // free everything
    411   delete(CenterOfGravity);
    412   gsl_vector_free(eval);
    413   gsl_matrix_free(evec);
    414 };
    415 
    416 
    417326/** Align all atoms in such a manner that given vector \a *n is along z axis.
    418327 * \param n[] alignment vector.
     
    431340  DoLog(1) && (Log() << Verbose(1) << "Z-X-angle: " << alpha << " ... ");
    432341  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
    433     tmp = (*iter)->x[0];
    434     (*iter)->x[0] =  cos(alpha) * tmp + sin(alpha) * (*iter)->x[2];
    435     (*iter)->x[2] = -sin(alpha) * tmp + cos(alpha) * (*iter)->x[2];
     342    tmp = (*iter)->at(0);
     343    (*iter)->set(0,  cos(alpha) * tmp + sin(alpha) * (*iter)->at(2));
     344    (*iter)->set(2, -sin(alpha) * tmp + cos(alpha) * (*iter)->at(2));
    436345    for (int j=0;j<MDSteps;j++) {
    437346      tmp = (*iter)->Trajectory.R.at(j)[0];
     
    450359  DoLog(1) && (Log() << Verbose(1) << "Z-Y-angle: " << alpha << " ... ");
    451360  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
    452     tmp = (*iter)->x[1];
    453     (*iter)->x[1] =  cos(alpha) * tmp + sin(alpha) * (*iter)->x[2];
    454     (*iter)->x[2] = -sin(alpha) * tmp + cos(alpha) * (*iter)->x[2];
     361    tmp = (*iter)->at(1);
     362    (*iter)->set(1,  cos(alpha) * tmp + sin(alpha) * (*iter)->at(2));
     363    (*iter)->set(2, -sin(alpha) * tmp + cos(alpha) * (*iter)->at(2));
    455364    for (int j=0;j<MDSteps;j++) {
    456365      tmp = (*iter)->Trajectory.R.at(j)[1];
     
    490399  // go through all atoms
    491400  for (molecule::const_iterator iter = par->mol->begin(); iter != par->mol->end(); ++iter) {
    492     if ((*iter)->type == ((struct lsq_params *)params)->type) { // for specific type
    493       c = (*iter)->x - a;
     401    if ((*iter)->getType() == ((struct lsq_params *)params)->type) { // for specific type
     402      c = (*iter)->getPosition() - a;
    494403      t = c.ScalarProduct(b);           // get direction parameter
    495404      d = t*b;       // and create vector
  • src/molecule_graph.cpp

    re588312 rb5c53d  
    184184                          //Log() << Verbose(1) << "Checking distance " << OtherWalker->x.PeriodicDistanceSquared(&(Walker->x), cell_size) << " against typical bond length of " << bonddistance*bonddistance << "." << endl;
    185185                          (BG->*minmaxdistance)(Walker, OtherWalker, MinDistance, MaxDistance, IsAngstroem);
    186                           const double distance = domain.periodicDistanceSquared(OtherWalker->x,Walker->x);
     186                          const double distance = domain.periodicDistanceSquared(OtherWalker->getPosition(),Walker->getPosition());
    187187                          const bool status = (distance <= MaxDistance * MaxDistance) && (distance >= MinDistance * MinDistance);
    188188//                          Log() << Verbose(1) << "MinDistance is " << MinDistance << " and MaxDistance is " << MaxDistance << "." << endl;
     
    737737        OtherAtom = (*Runner)->GetOtherAtom(Walker);
    738738#ifdef ADDHYDROGEN
    739         if (OtherAtom->type->Z != 1) {
     739        if (OtherAtom->getType()->Z != 1) {
    740740#endif
    741741        DoLog(2) && (Log() << Verbose(2) << "Current OtherAtom is: " << OtherAtom->getName() << " for bond " << *(*Runner) << "." << endl);
  • src/molecule_template.hpp

    re588312 rb5c53d  
    1919/********************************************** declarations *******************************/
    2020
    21 // ================== Acting on all Vectors ========================== //
    22 
    23 // zero arguments
    24 template <typename res> void molecule::ActOnAllVectors( res (Vector::*f)() ) const
    25     {
    26   for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
    27     (((*iter)->node)->*f)();
    28   }
    29 };
    30 template <typename res> void molecule::ActOnAllVectors( res (Vector::*f)() const ) const
    31     {
    32   for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
    33     (((*iter)->node)->*f)();
    34   }
    35 };
    36 // one argument
    37 template <typename res, typename T> void molecule::ActOnAllVectors( res (Vector::*f)(T), T t ) const
    38 {
    39   for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
    40     (((*iter)->node)->*f)(t);
    41   }
    42 };
    43 template <typename res, typename T> void molecule::ActOnAllVectors( res (Vector::*f)(T) const, T t ) const
    44 {
    45   for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
    46     (((*iter)->node)->*f)(t);
    47   }
    48 };
    49 template <typename res, typename T> void molecule::ActOnAllVectors( res (Vector::*f)(T&), T &t ) const
    50 {
    51   for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
    52     (((*iter)->node)->*f)(t);
    53   }
    54 };
    55 template <typename res, typename T> void molecule::ActOnAllVectors( res (Vector::*f)(T&) const, T &t ) const
    56 {
    57   for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
    58     (((*iter)->node)->*f)(t);
    59   }
    60 };
    61 // two arguments
    62 template <typename res, typename T, typename U> void molecule::ActOnAllVectors( res (Vector::*f)(T, U), T t, U u ) const
    63 {
    64   for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
    65     (((*iter)->node)->*f)(t, u);
    66   }
    67 };
    68 template <typename res, typename T, typename U> void molecule::ActOnAllVectors( res (Vector::*f)(T, U) const, T t, U u ) const
    69 {
    70   for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
    71     (((*iter)->node)->*f)(t, u);
    72   }
    73 };
    74 // three arguments
    75 template <typename res, typename T, typename U, typename V> void molecule::ActOnAllVectors( res (Vector::*f)(T, U, V), T t, U u, V v) const
    76 {
    77   for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
    78     (((*iter)->node)->*f)(t, u, v);
    79   }
    80 };
    81 template <typename res, typename T, typename U, typename V> void molecule::ActOnAllVectors( res (Vector::*f)(T, U, V) const, T t, U u, V v) const
    82 {
    83   for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
    84     (((*iter)->node)->*f)(t, u, v);
    85   }
    86 };
    8721
    8822// ========================= Summing over each Atoms =================================== //
     
    370304  int inc = 1;
    371305  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
    372     (*Setor) (&array[((*iter)->type->*index)], &inc);
     306    (*Setor) (&array[((*iter)->getType()->*index)], &inc);
    373307  }
    374308};
     
    376310{
    377311  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
    378     (*Setor) (&array[((*iter)->type->*index)], &value);
     312    (*Setor) (&array[((*iter)->getType()->*index)], &value);
    379313  }
    380314};
     
    382316{
    383317  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
    384     (*Setor) (&array[((*iter)->type->*index)], value);
     318    (*Setor) (&array[((*iter)->getType()->*index)], value);
    385319  }
    386320};
  • src/moleculelist.cpp

    re588312 rb5c53d  
    3030#include "molecule.hpp"
    3131#include "periodentafel.hpp"
     32#include "tesselation.hpp"
    3233#include "Helpers/Assert.hpp"
    3334#include "LinearAlgebra/Matrix.hpp"
     
    4344MoleculeListClass::MoleculeListClass(World *_world) :
    4445  Observable("MoleculeListClass"),
    45   world(_world)
    46 {
    47   // empty lists
    48   ListOfMolecules.clear();
    49   MaxIndex = 1;
    50 };
     46  world(_world),
     47  MaxIndex(1)
     48{};
    5149
    5250/** Destructor for MoleculeListClass.
     
    182180      size=0.;
    183181      for (molecule::const_iterator iter = (*ListRunner)->begin(); iter != (*ListRunner)->end(); ++iter) {
    184         counts[(*iter)->type->getNumber()]++;
    185         if ((*iter)->x.DistanceSquared(Origin) > size)
    186           size = (*iter)->x.DistanceSquared(Origin);
     182        counts[(*iter)->getType()->getNumber()]++;
     183        if ((*iter)->DistanceSquared(Origin) > size)
     184          size = (*iter)->DistanceSquared(Origin);
    187185      }
    188186      // output Index, Name, number of atoms, chemical formula
     
    354352  for (molecule::const_iterator iter = srcmol->begin(); iter != srcmol->end(); ++iter) {
    355353    DoLog(2) && (Log() << Verbose(2) << "INFO: Current Walker is " << **iter << "." << endl);
    356     if (!TesselStruct->IsInnerPoint((*iter)->x, LCList)) {
     354    if (!TesselStruct->IsInnerPoint((*iter)->getPosition(), LCList)) {
    357355      CopyAtoms[(*iter)->nr] = (*iter)->clone();
    358356      mol->AddAtom(CopyAtoms[(*iter)->nr]);
     
    501499    for (molecule::const_iterator iter = (*ListRunner)->begin(); iter != (*ListRunner)->end(); ++iter) {
    502500      //Log() << Verbose(1) << "(*iter): " << *(*iter) << " with first bond " << *((*iter)->ListOfBonds.begin()) << "." << endl;
    503       if (((*iter)->type->Z == 1) && (((*iter)->father == NULL)
    504           || ((*iter)->father->type->Z != 1))) { // if it's a hydrogen
     501      if (((*iter)->getType()->Z == 1) && (((*iter)->father == NULL)
     502          || ((*iter)->father->getType()->Z != 1))) { // if it's a hydrogen
    505503        for (molecule::const_iterator runner = (*ListRunner)->begin(); runner != (*ListRunner)->end(); ++runner) {
    506504          //Log() << Verbose(2) << "Runner: " << *(*runner) << " with first bond " << *((*iter)->ListOfBonds.begin()) << "." << endl;
    507505          // 3. take every other hydrogen that is the not the first and not bound to same bonding partner
    508506          Binder = *((*runner)->ListOfBonds.begin());
    509           if (((*runner)->type->Z == 1) && ((*runner)->nr > (*iter)->nr) && (Binder->GetOtherAtom((*runner)) != Binder->GetOtherAtom((*iter)))) { // (hydrogens have only one bonding partner!)
     507          if (((*runner)->getType()->Z == 1) && ((*runner)->nr > (*iter)->nr) && (Binder->GetOtherAtom((*runner)) != Binder->GetOtherAtom((*iter)))) { // (hydrogens have only one bonding partner!)
    510508            // 4. evaluate the morse potential for each matrix component and add up
    511             distance = (*runner)->x.distance((*iter)->x);
     509            distance = (*runner)->distance(*(*iter));
    512510            //Log() << Verbose(0) << "Fragment " << (*ListRunner)->name << ": " << *(*runner) << "<= " << distance << "=>" << *(*iter) << ":" << endl;
    513511            for (int k = 0; k < a; k++) {
     
    599597        if ((*ListRunner)->hasElement((*elemIter).first)) { // if this element got atoms
    600598          for(molecule::iterator atomIter = (*ListRunner)->begin(); atomIter !=(*ListRunner)->end();++atomIter){
    601             if ((*atomIter)->type->getNumber() == (*elemIter).first) {
     599            if ((*atomIter)->getType()->getNumber() == (*elemIter).first) {
    602600              if (((*atomIter)->GetTrueFather() != NULL) && ((*atomIter)->GetTrueFather() != (*atomIter))) {// if there is a rea
    603601                //Log() << Verbose(0) << "Walker is " << *Walker << " with true father " << *( Walker->GetTrueFather()) << ", it
     
    952950 */
    953951//MoleculeLeafClass::MoleculeLeafClass(MoleculeLeafClass *Up = NULL, MoleculeLeafClass *Previous = NULL)
    954 MoleculeLeafClass::MoleculeLeafClass(MoleculeLeafClass *PreviousLeaf = NULL)
     952MoleculeLeafClass::MoleculeLeafClass(MoleculeLeafClass *PreviousLeaf = NULL) :
     953  Leaf(NULL),
     954  previous(PreviousLeaf)
    955955{
    956956  //  if (Up != NULL)
     
    959959  //  UpLeaf = Up;
    960960  //  DownLeaf = NULL;
    961   Leaf = NULL;
    962   previous = PreviousLeaf;
    963961  if (previous != NULL) {
    964962    MoleculeLeafClass *Walker = previous->next;
     
    10891087        if (AtomMask[Father->nr]) // apply mask
    10901088#ifdef ADDHYDROGEN
    1091           if ((*iter)->type->Z != 1) // skip hydrogen
     1089          if ((*iter)->getType()->Z != 1) // skip hydrogen
    10921090#endif
    10931091          RootStack[FragmentCounter].push_front((*iter)->nr);
  • src/parser.cpp

    re588312 rb5c53d  
    5959/** Constructor of MatrixContainer class.
    6060 */
    61 MatrixContainer::MatrixContainer() {
    62   Indices = NULL;
     61MatrixContainer::MatrixContainer() :
     62  Indices(NULL)
     63{
    6364  Header = new char*[1];
    6465  Matrix = new double**[1]; // one more each for the total molecule
     
    850851/** Constructor for class HessianMatrix.
    851852 */
    852 HessianMatrix::HessianMatrix() : MatrixContainer()
    853 {
    854    IsSymmetric = true;
    855 }
     853HessianMatrix::HessianMatrix() :
     854  MatrixContainer(),
     855  IsSymmetric(true)
     856{}
    856857
    857858/** Sums the hessian entries with each factor and put into last element of \a ***Matrix.
     
    995996/** Constructor of KeySetsContainer class.
    996997 */
    997 KeySetsContainer::KeySetsContainer() {
    998   KeySets = NULL;
    999   AtomCounter = NULL;
    1000   FragmentCounter = 0;
    1001   Order = 0;
    1002   FragmentsPerOrder = 0;
    1003   OrderSet = NULL;
    1004 };
     998KeySetsContainer::KeySetsContainer() :
     999  KeySets(NULL),
     1000  AtomCounter(NULL),
     1001  FragmentCounter(0),
     1002  Order(0),
     1003  FragmentsPerOrder(0),
     1004  OrderSet(NULL)
     1005{};
    10051006
    10061007/** Destructor of KeySetsContainer class.
  • src/tesselation.cpp

    re588312 rb5c53d  
    1313#include "Helpers/helpers.hpp"
    1414#include "Helpers/Info.hpp"
     15#include "BoundaryPointSet.hpp"
     16#include "BoundaryLineSet.hpp"
     17#include "BoundaryTriangleSet.hpp"
     18#include "BoundaryPolygonSet.hpp"
     19#include "TesselPoint.hpp"
     20#include "CandidateForTesselation.hpp"
     21#include "PointCloud.hpp"
    1522#include "linkedcell.hpp"
    1623#include "Helpers/Log.hpp"
     
    2027#include "LinearAlgebra/Vector.hpp"
    2128#include "LinearAlgebra/Line.hpp"
    22 #include "vector_ops.hpp"
     29#include "LinearAlgebra/vector_ops.hpp"
    2330#include "Helpers/Verbose.hpp"
    2431#include "LinearAlgebra/Plane.hpp"
     
    2835class molecule;
    2936
    30 // ======================================== Points on Boundary =================================
    31 
    32 /** Constructor of BoundaryPointSet.
    33  */
    34 BoundaryPointSet::BoundaryPointSet() :
    35   LinesCount(0), value(0.), Nr(-1)
    36 {
    37   Info FunctionInfo(__func__);
    38   DoLog(1) && (Log() << Verbose(1) << "Adding noname." << endl);
    39 }
    40 ;
    41 
    42 /** Constructor of BoundaryPointSet with Tesselpoint.
    43  * \param *Walker TesselPoint this boundary point represents
    44  */
    45 BoundaryPointSet::BoundaryPointSet(TesselPoint * const Walker) :
    46   LinesCount(0), node(Walker), value(0.), Nr(Walker->nr)
    47 {
    48   Info FunctionInfo(__func__);
    49   DoLog(1) && (Log() << Verbose(1) << "Adding Node " << *Walker << endl);
    50 }
    51 ;
    52 
    53 /** Destructor of BoundaryPointSet.
    54  * Sets node to NULL to avoid removing the original, represented TesselPoint.
    55  * \note When removing point from a class Tesselation, use RemoveTesselationPoint()
    56  */
    57 BoundaryPointSet::~BoundaryPointSet()
    58 {
    59   Info FunctionInfo(__func__);
    60   //Log() << Verbose(0) << "Erasing point nr. " << Nr << "." << endl;
    61   if (!lines.empty())
    62     DoeLog(2) && (eLog() << Verbose(2) << "Memory Leak! I " << *this << " am still connected to some lines." << endl);
    63   node = NULL;
    64 }
    65 ;
    66 
    67 /** Add a line to the LineMap of this point.
    68  * \param *line line to add
    69  */
    70 void BoundaryPointSet::AddLine(BoundaryLineSet * const line)
    71 {
    72   Info FunctionInfo(__func__);
    73   DoLog(1) && (Log() << Verbose(1) << "Adding " << *this << " to line " << *line << "." << endl);
    74   if (line->endpoints[0] == this) {
    75     lines.insert(LinePair(line->endpoints[1]->Nr, line));
    76   } else {
    77     lines.insert(LinePair(line->endpoints[0]->Nr, line));
    78   }
    79   LinesCount++;
    80 }
    81 ;
    82 
    83 /** output operator for BoundaryPointSet.
    84  * \param &ost output stream
    85  * \param &a boundary point
    86  */
    87 ostream & operator <<(ostream &ost, const BoundaryPointSet &a)
    88 {
    89   ost << "[" << a.Nr << "|" << a.node->getName() << " at " << *a.node->node << "]";
    90   return ost;
    91 }
    92 ;
    93 
    94 // ======================================== Lines on Boundary =================================
    95 
    96 /** Constructor of BoundaryLineSet.
    97  */
    98 BoundaryLineSet::BoundaryLineSet() :
    99   Nr(-1)
    100 {
    101   Info FunctionInfo(__func__);
    102   for (int i = 0; i < 2; i++)
    103     endpoints[i] = NULL;
    104 }
    105 ;
    106 
    107 /** Constructor of BoundaryLineSet with two endpoints.
    108  * Adds line automatically to each endpoints' LineMap
    109  * \param *Point[2] array of two boundary points
    110  * \param number number of the list
    111  */
    112 BoundaryLineSet::BoundaryLineSet(BoundaryPointSet * const Point[2], const int number)
    113 {
    114   Info FunctionInfo(__func__);
    115   // set number
    116   Nr = number;
    117   // set endpoints in ascending order
    118   SetEndpointsOrdered(endpoints, Point[0], Point[1]);
    119   // add this line to the hash maps of both endpoints
    120   Point[0]->AddLine(this); //Taken out, to check whether we can avoid unwanted double adding.
    121   Point[1]->AddLine(this); //
    122   // set skipped to false
    123   skipped = false;
    124   // clear triangles list
    125   DoLog(0) && (Log() << Verbose(0) << "New Line with endpoints " << *this << "." << endl);
    126 }
    127 ;
    128 
    129 /** Constructor of BoundaryLineSet with two endpoints.
    130  * Adds line automatically to each endpoints' LineMap
    131  * \param *Point1 first boundary point
    132  * \param *Point2 second boundary point
    133  * \param number number of the list
    134  */
    135 BoundaryLineSet::BoundaryLineSet(BoundaryPointSet * const Point1, BoundaryPointSet * const Point2, const int number)
    136 {
    137   Info FunctionInfo(__func__);
    138   // set number
    139   Nr = number;
    140   // set endpoints in ascending order
    141   SetEndpointsOrdered(endpoints, Point1, Point2);
    142   // add this line to the hash maps of both endpoints
    143   Point1->AddLine(this); //Taken out, to check whether we can avoid unwanted double adding.
    144   Point2->AddLine(this); //
    145   // set skipped to false
    146   skipped = false;
    147   // clear triangles list
    148   DoLog(0) && (Log() << Verbose(0) << "New Line with endpoints " << *this << "." << endl);
    149 }
    150 ;
    151 
    152 /** Destructor for BoundaryLineSet.
    153  * Removes itself from each endpoints' LineMap, calling RemoveTrianglePoint() when point not connected anymore.
    154  * \note When removing lines from a class Tesselation, use RemoveTesselationLine()
    155  */
    156 BoundaryLineSet::~BoundaryLineSet()
    157 {
    158   Info FunctionInfo(__func__);
    159   int Numbers[2];
    160 
    161   // get other endpoint number of finding copies of same line
    162   if (endpoints[1] != NULL)
    163     Numbers[0] = endpoints[1]->Nr;
    164   else
    165     Numbers[0] = -1;
    166   if (endpoints[0] != NULL)
    167     Numbers[1] = endpoints[0]->Nr;
    168   else
    169     Numbers[1] = -1;
    170 
    171   for (int i = 0; i < 2; i++) {
    172     if (endpoints[i] != NULL) {
    173       if (Numbers[i] != -1) { // as there may be multiple lines with same endpoints, we have to go through each and find in the endpoint's line list this line set
    174         pair<LineMap::iterator, LineMap::iterator> erasor = endpoints[i]->lines.equal_range(Numbers[i]);
    175         for (LineMap::iterator Runner = erasor.first; Runner != erasor.second; Runner++)
    176           if ((*Runner).second == this) {
    177             //Log() << Verbose(0) << "Removing Line Nr. " << Nr << " in boundary point " << *endpoints[i] << "." << endl;
    178             endpoints[i]->lines.erase(Runner);
    179             break;
    180           }
    181       } else { // there's just a single line left
    182         if (endpoints[i]->lines.erase(Nr)) {
    183           //Log() << Verbose(0) << "Removing Line Nr. " << Nr << " in boundary point " << *endpoints[i] << "." << endl;
    184         }
    185       }
    186       if (endpoints[i]->lines.empty()) {
    187         //Log() << Verbose(0) << *endpoints[i] << " has no more lines it's attached to, erasing." << endl;
    188         if (endpoints[i] != NULL) {
    189           delete (endpoints[i]);
    190           endpoints[i] = NULL;
    191         }
    192       }
    193     }
    194   }
    195   if (!triangles.empty())
    196     DoeLog(2) && (eLog() << Verbose(2) << "Memory Leak! I " << *this << " am still connected to some triangles." << endl);
    197 }
    198 ;
    199 
    200 /** Add triangle to TriangleMap of this boundary line.
    201  * \param *triangle to add
    202  */
    203 void BoundaryLineSet::AddTriangle(BoundaryTriangleSet * const triangle)
    204 {
    205   Info FunctionInfo(__func__);
    206   DoLog(0) && (Log() << Verbose(0) << "Add " << triangle->Nr << " to line " << *this << "." << endl);
    207   triangles.insert(TrianglePair(triangle->Nr, triangle));
    208 }
    209 ;
    210 
    211 /** Checks whether we have a common endpoint with given \a *line.
    212  * \param *line other line to test
    213  * \return true - common endpoint present, false - not connected
    214  */
    215 bool BoundaryLineSet::IsConnectedTo(const BoundaryLineSet * const line) const
    216 {
    217   Info FunctionInfo(__func__);
    218   if ((endpoints[0] == line->endpoints[0]) || (endpoints[1] == line->endpoints[0]) || (endpoints[0] == line->endpoints[1]) || (endpoints[1] == line->endpoints[1]))
    219     return true;
    220   else
    221     return false;
    222 }
    223 ;
    224 
    225 /** Checks whether the adjacent triangles of a baseline are convex or not.
    226  * We sum the two angles of each height vector with respect to the center of the baseline.
    227  * If greater/equal M_PI than we are convex.
    228  * \param *out output stream for debugging
    229  * \return true - triangles are convex, false - concave or less than two triangles connected
    230  */
    231 bool BoundaryLineSet::CheckConvexityCriterion() const
    232 {
    233   Info FunctionInfo(__func__);
    234   double angle = CalculateConvexity();
    235   if (angle > -MYEPSILON) {
    236     DoLog(0) && (Log() << Verbose(0) << "ACCEPT: Angle is greater than pi: convex." << endl);
    237     return true;
    238   } else {
    239     DoLog(0) && (Log() << Verbose(0) << "REJECT: Angle is less than pi: concave." << endl);
    240     return false;
    241   }
    242 }
    243 
    244 
    245 /** Calculates the angle between two triangles with respect to their normal vector.
    246  * We sum the two angles of each height vector with respect to the center of the baseline.
    247  * \return angle > 0 then convex, if < 0 then concave
    248  */
    249 double BoundaryLineSet::CalculateConvexity() const
    250 {
    251   Info FunctionInfo(__func__);
    252   Vector BaseLineCenter, BaseLineNormal, BaseLine, helper[2], NormalCheck;
    253   // get the two triangles
    254   if (triangles.size() != 2) {
    255     DoeLog(0) && (eLog() << Verbose(0) << "Baseline " << *this << " is connected to less than two triangles, Tesselation incomplete!" << endl);
    256     return true;
    257   }
    258   // check normal vectors
    259   // have a normal vector on the base line pointing outwards
    260   //Log() << Verbose(0) << "INFO: " << *this << " has vectors at " << *(endpoints[0]->node->node) << " and at " << *(endpoints[1]->node->node) << "." << endl;
    261   BaseLineCenter = (1./2.)*((*endpoints[0]->node->node) + (*endpoints[1]->node->node));
    262   BaseLine = (*endpoints[0]->node->node) - (*endpoints[1]->node->node);
    263 
    264   //Log() << Verbose(0) << "INFO: Baseline is " << BaseLine << " and its center is at " << BaseLineCenter << "." << endl;
    265 
    266   BaseLineNormal.Zero();
    267   NormalCheck.Zero();
    268   double sign = -1.;
    269   int i = 0;
    270   class BoundaryPointSet *node = NULL;
    271   for (TriangleMap::const_iterator runner = triangles.begin(); runner != triangles.end(); runner++) {
    272     //Log() << Verbose(0) << "INFO: NormalVector of " << *(runner->second) << " is " << runner->second->NormalVector << "." << endl;
    273     NormalCheck += runner->second->NormalVector;
    274     NormalCheck *= sign;
    275     sign = -sign;
    276     if (runner->second->NormalVector.NormSquared() > MYEPSILON)
    277       BaseLineNormal = runner->second->NormalVector;   // yes, copy second on top of first
    278     else {
    279       DoeLog(0) && (eLog() << Verbose(0) << "Triangle " << *runner->second << " has zero normal vector!" << endl);
    280     }
    281     node = runner->second->GetThirdEndpoint(this);
    282     if (node != NULL) {
    283       //Log() << Verbose(0) << "INFO: Third node for triangle " << *(runner->second) << " is " << *node << " at " << *(node->node->node) << "." << endl;
    284       helper[i] = (*node->node->node) - BaseLineCenter;
    285       helper[i].MakeNormalTo(BaseLine);  // we want to compare the triangle's heights' angles!
    286       //Log() << Verbose(0) << "INFO: Height vector with respect to baseline is " << helper[i] << "." << endl;
    287       i++;
    288     } else {
    289       DoeLog(1) && (eLog() << Verbose(1) << "I cannot find third node in triangle, something's wrong." << endl);
    290       return true;
    291     }
    292   }
    293   //Log() << Verbose(0) << "INFO: BaselineNormal is " << BaseLineNormal << "." << endl;
    294   if (NormalCheck.NormSquared() < MYEPSILON) {
    295     DoLog(0) && (Log() << Verbose(0) << "ACCEPT: Normalvectors of both triangles are the same: convex." << endl);
    296     return true;
    297   }
    298   BaseLineNormal.Scale(-1.);
    299   double angle = GetAngle(helper[0], helper[1], BaseLineNormal);
    300   return (angle - M_PI);
    301 }
    302 
    303 /** Checks whether point is any of the two endpoints this line contains.
    304  * \param *point point to test
    305  * \return true - point is of the line, false - is not
    306  */
    307 bool BoundaryLineSet::ContainsBoundaryPoint(const BoundaryPointSet * const point) const
    308 {
    309   Info FunctionInfo(__func__);
    310   for (int i = 0; i < 2; i++)
    311     if (point == endpoints[i])
    312       return true;
    313   return false;
    314 }
    315 ;
    316 
    317 /** Returns other endpoint of the line.
    318  * \param *point other endpoint
    319  * \return NULL - if endpoint not contained in BoundaryLineSet::lines, or pointer to BoundaryPointSet otherwise
    320  */
    321 class BoundaryPointSet *BoundaryLineSet::GetOtherEndpoint(const BoundaryPointSet * const point) const
    322 {
    323   Info FunctionInfo(__func__);
    324   if (endpoints[0] == point)
    325     return endpoints[1];
    326   else if (endpoints[1] == point)
    327     return endpoints[0];
    328   else
    329     return NULL;
    330 }
    331 ;
    332 
    333 /** Returns other triangle of the line.
    334  * \param *point other endpoint
    335  * \return NULL - if triangle not contained in BoundaryLineSet::triangles, or pointer to BoundaryTriangleSet otherwise
    336  */
    337 class BoundaryTriangleSet *BoundaryLineSet::GetOtherTriangle(const BoundaryTriangleSet * const triangle) const
    338 {
    339   Info FunctionInfo(__func__);
    340   if (triangles.size() == 2) {
    341     for (TriangleMap::const_iterator TriangleRunner = triangles.begin(); TriangleRunner != triangles.end(); ++TriangleRunner)
    342       if (TriangleRunner->second != triangle)
    343         return TriangleRunner->second;
    344   }
    345   return NULL;
    346 }
    347 ;
    348 
    349 /** output operator for BoundaryLineSet.
    350  * \param &ost output stream
    351  * \param &a boundary line
    352  */
    353 ostream & operator <<(ostream &ost, const BoundaryLineSet &a)
    354 {
    355   ost << "[" << a.Nr << "|" << a.endpoints[0]->node->getName() << " at " << *a.endpoints[0]->node->node << "," << a.endpoints[1]->node->getName() << " at " << *a.endpoints[1]->node->node << "]";
    356   return ost;
    357 }
    358 ;
    359 
    360 // ======================================== Triangles on Boundary =================================
    361 
    362 /** Constructor for BoundaryTriangleSet.
    363  */
    364 BoundaryTriangleSet::BoundaryTriangleSet() :
    365   Nr(-1)
    366 {
    367   Info FunctionInfo(__func__);
    368   for (int i = 0; i < 3; i++) {
    369     endpoints[i] = NULL;
    370     lines[i] = NULL;
    371   }
    372 }
    373 ;
    374 
    375 /** Constructor for BoundaryTriangleSet with three lines.
    376  * \param *line[3] lines that make up the triangle
    377  * \param number number of triangle
    378  */
    379 BoundaryTriangleSet::BoundaryTriangleSet(class BoundaryLineSet * const line[3], const int number) :
    380   Nr(number)
    381 {
    382   Info FunctionInfo(__func__);
    383   // set number
    384   // set lines
    385   for (int i = 0; i < 3; i++) {
    386     lines[i] = line[i];
    387     lines[i]->AddTriangle(this);
    388   }
    389   // get ascending order of endpoints
    390   PointMap OrderMap;
    391   for (int i = 0; i < 3; i++) {
    392     // for all three lines
    393     for (int j = 0; j < 2; j++) { // for both endpoints
    394       OrderMap.insert(pair<int, class BoundaryPointSet *> (line[i]->endpoints[j]->Nr, line[i]->endpoints[j]));
    395       // and we don't care whether insertion fails
    396     }
    397   }
    398   // set endpoints
    399   int Counter = 0;
    400   DoLog(0) && (Log() << Verbose(0) << "New triangle " << Nr << " with end points: " << endl);
    401   for (PointMap::iterator runner = OrderMap.begin(); runner != OrderMap.end(); runner++) {
    402     endpoints[Counter] = runner->second;
    403     DoLog(0) && (Log() << Verbose(0) << " " << *endpoints[Counter] << endl);
    404     Counter++;
    405   }
    406   ASSERT(Counter >= 3,"We have a triangle with only two distinct endpoints!");
    407 };
    408 
    409 
    410 /** Destructor of BoundaryTriangleSet.
    411  * Removes itself from each of its lines' LineMap and removes them if necessary.
    412  * \note When removing triangles from a class Tesselation, use RemoveTesselationTriangle()
    413  */
    414 BoundaryTriangleSet::~BoundaryTriangleSet()
    415 {
    416   Info FunctionInfo(__func__);
    417   for (int i = 0; i < 3; i++) {
    418     if (lines[i] != NULL) {
    419       if (lines[i]->triangles.erase(Nr)) {
    420         //Log() << Verbose(0) << "Triangle Nr." << Nr << " erased in line " << *lines[i] << "." << endl;
    421       }
    422       if (lines[i]->triangles.empty()) {
    423         //Log() << Verbose(0) << *lines[i] << " is no more attached to any triangle, erasing." << endl;
    424         delete (lines[i]);
    425         lines[i] = NULL;
    426       }
    427     }
    428   }
    429   //Log() << Verbose(0) << "Erasing triangle Nr." << Nr << " itself." << endl;
    430 }
    431 ;
    432 
    433 /** Calculates the normal vector for this triangle.
    434  * Is made unique by comparison with \a OtherVector to point in the other direction.
    435  * \param &OtherVector direction vector to make normal vector unique.
    436  */
    437 void BoundaryTriangleSet::GetNormalVector(const Vector &OtherVector)
    438 {
    439   Info FunctionInfo(__func__);
    440   // get normal vector
    441   NormalVector = Plane(*(endpoints[0]->node->node),
    442                        *(endpoints[1]->node->node),
    443                        *(endpoints[2]->node->node)).getNormal();
    444 
    445   // make it always point inward (any offset vector onto plane projected onto normal vector suffices)
    446   if (NormalVector.ScalarProduct(OtherVector) > 0.)
    447     NormalVector.Scale(-1.);
    448   DoLog(1) && (Log() << Verbose(1) << "Normal Vector is " << NormalVector << "." << endl);
    449 }
    450 ;
    451 
    452 /** Finds the point on the triangle \a *BTS through which the line defined by \a *MolCenter and \a *x crosses.
    453  * We call Vector::GetIntersectionWithPlane() to receive the intersection point with the plane
    454  * Thus we test if it's really on the plane and whether it's inside the triangle on the plane or not.
    455  * The latter is done as follows: We calculate the cross point of one of the triangle's baseline with the line
    456  * given by the intersection and the third basepoint. Then, we check whether it's on the baseline (i.e. between
    457  * the first two basepoints) or not.
    458  * \param *out output stream for debugging
    459  * \param *MolCenter offset vector of line
    460  * \param *x second endpoint of line, minus \a *MolCenter is directional vector of line
    461  * \param *Intersection intersection on plane on return
    462  * \return true - \a *Intersection contains intersection on plane defined by triangle, false - zero vector if outside of triangle.
    463  */
    464 
    465 bool BoundaryTriangleSet::GetIntersectionInsideTriangle(const Vector * const MolCenter, const Vector * const x, Vector * const Intersection) const
    466 {
    467   Info FunctionInfo(__func__);
    468   Vector CrossPoint;
    469   Vector helper;
    470 
    471   try {
    472     Line centerLine = makeLineThrough(*MolCenter, *x);
    473     *Intersection = Plane(NormalVector, *(endpoints[0]->node->node)).GetIntersection(centerLine);
    474 
    475     DoLog(1) && (Log() << Verbose(1) << "INFO: Triangle is " << *this << "." << endl);
    476     DoLog(1) && (Log() << Verbose(1) << "INFO: Line is from " << *MolCenter << " to " << *x << "." << endl);
    477     DoLog(1) && (Log() << Verbose(1) << "INFO: Intersection is " << *Intersection << "." << endl);
    478 
    479     if (Intersection->DistanceSquared(*endpoints[0]->node->node) < MYEPSILON) {
    480       DoLog(1) && (Log() << Verbose(1) << "Intersection coindices with first endpoint." << endl);
    481       return true;
    482     }   else if (Intersection->DistanceSquared(*endpoints[1]->node->node) < MYEPSILON) {
    483       DoLog(1) && (Log() << Verbose(1) << "Intersection coindices with second endpoint." << endl);
    484       return true;
    485     }   else if (Intersection->DistanceSquared(*endpoints[2]->node->node) < MYEPSILON) {
    486       DoLog(1) && (Log() << Verbose(1) << "Intersection coindices with third endpoint." << endl);
    487       return true;
    488     }
    489     // Calculate cross point between one baseline and the line from the third endpoint to intersection
    490     int i = 0;
    491     do {
    492       Line line1 = makeLineThrough(*(endpoints[i%3]->node->node),*(endpoints[(i+1)%3]->node->node));
    493       Line line2 = makeLineThrough(*(endpoints[(i+2)%3]->node->node),*Intersection);
    494       CrossPoint = line1.getIntersection(line2);
    495       helper = (*endpoints[(i+1)%3]->node->node) - (*endpoints[i%3]->node->node);
    496       CrossPoint -= (*endpoints[i%3]->node->node);  // cross point was returned as absolute vector
    497       const double s = CrossPoint.ScalarProduct(helper)/helper.NormSquared();
    498       DoLog(1) && (Log() << Verbose(1) << "INFO: Factor s is " << s << "." << endl);
    499       if ((s < -MYEPSILON) || ((s-1.) > MYEPSILON)) {
    500         DoLog(1) && (Log() << Verbose(1) << "INFO: Crosspoint " << CrossPoint << "outside of triangle." << endl);
    501         return false;
    502       }
    503       i++;
    504     } while (i < 3);
    505     DoLog(1) && (Log() << Verbose(1) << "INFO: Crosspoint " << CrossPoint << " inside of triangle." << endl);
    506     return true;
    507   }
    508   catch (MathException &excp) {
    509     Log() << Verbose(1) << excp;
    510     DoeLog(1) && (eLog() << Verbose(1) << "Alas! Intersection with plane failed - at least numerically - the intersection is not on the plane!" << endl);
    511     return false;
    512   }
    513 }
    514 ;
    515 
    516 /** Finds the point on the triangle to the point \a *x.
    517  * We call Vector::GetIntersectionWithPlane() with \a * and the center of the triangle to receive an intersection point.
    518  * Then we check the in-plane part (the part projected down onto plane). We check whether it crosses one of the
    519  * boundary lines. If it does, we return this intersection as closest point, otherwise the projected point down.
    520  * Thus we test if it's really on the plane and whether it's inside the triangle on the plane or not.
    521  * The latter is done as follows: We calculate the cross point of one of the triangle's baseline with the line
    522  * given by the intersection and the third basepoint. Then, we check whether it's on the baseline (i.e. between
    523  * the first two basepoints) or not.
    524  * \param *x point
    525  * \param *ClosestPoint desired closest point inside triangle to \a *x, is absolute vector
    526  * \return Distance squared between \a *x and closest point inside triangle
    527  */
    528 double BoundaryTriangleSet::GetClosestPointInsideTriangle(const Vector * const x, Vector * const ClosestPoint) const
    529 {
    530   Info FunctionInfo(__func__);
    531   Vector Direction;
    532 
    533   // 1. get intersection with plane
    534   DoLog(1) && (Log() << Verbose(1) << "INFO: Looking for closest point of triangle " << *this << " to " << *x << "." << endl);
    535   GetCenter(&Direction);
    536   try {
    537     Line l = makeLineThrough(*x, Direction);
    538     *ClosestPoint = Plane(NormalVector, *(endpoints[0]->node->node)).GetIntersection(l);
    539   }
    540   catch (MathException &excp) {
    541     (*ClosestPoint) = (*x);
    542   }
    543 
    544   // 2. Calculate in plane part of line (x, intersection)
    545   Vector InPlane = (*x) - (*ClosestPoint); // points from plane intersection to straight-down point
    546   InPlane.ProjectOntoPlane(NormalVector);
    547   InPlane += *ClosestPoint;
    548 
    549   DoLog(2) && (Log() << Verbose(2) << "INFO: Triangle is " << *this << "." << endl);
    550   DoLog(2) && (Log() << Verbose(2) << "INFO: Line is from " << Direction << " to " << *x << "." << endl);
    551   DoLog(2) && (Log() << Verbose(2) << "INFO: In-plane part is " << InPlane << "." << endl);
    552 
    553   // Calculate cross point between one baseline and the desired point such that distance is shortest
    554   double ShortestDistance = -1.;
    555   bool InsideFlag = false;
    556   Vector CrossDirection[3];
    557   Vector CrossPoint[3];
    558   Vector helper;
    559   for (int i = 0; i < 3; i++) {
    560     // treat direction of line as normal of a (cut)plane and the desired point x as the plane offset, the intersect line with point
    561     Direction = (*endpoints[(i+1)%3]->node->node) - (*endpoints[i%3]->node->node);
    562     // calculate intersection, line can never be parallel to Direction (is the same vector as PlaneNormal);
    563     Line l = makeLineThrough(*(endpoints[i%3]->node->node), *(endpoints[(i+1)%3]->node->node));
    564     CrossPoint[i] = Plane(Direction, InPlane).GetIntersection(l);
    565     CrossDirection[i] = CrossPoint[i] - InPlane;
    566     CrossPoint[i] -= (*endpoints[i%3]->node->node);  // cross point was returned as absolute vector
    567     const double s = CrossPoint[i].ScalarProduct(Direction)/Direction.NormSquared();
    568     DoLog(2) && (Log() << Verbose(2) << "INFO: Factor s is " << s << "." << endl);
    569     if ((s >= -MYEPSILON) && ((s-1.) <= MYEPSILON)) {
    570           CrossPoint[i] += (*endpoints[i%3]->node->node);  // make cross point absolute again
    571       DoLog(2) && (Log() << Verbose(2) << "INFO: Crosspoint is " << CrossPoint[i] << ", intersecting BoundaryLine between " << *endpoints[i % 3]->node->node << " and " << *endpoints[(i + 1) % 3]->node->node << "." << endl);
    572       const double distance = CrossPoint[i].DistanceSquared(*x);
    573       if ((ShortestDistance < 0.) || (ShortestDistance > distance)) {
    574         ShortestDistance = distance;
    575         (*ClosestPoint) = CrossPoint[i];
    576       }
    577     } else
    578       CrossPoint[i].Zero();
    579   }
    580   InsideFlag = true;
    581   for (int i = 0; i < 3; i++) {
    582     const double sign = CrossDirection[i].ScalarProduct(CrossDirection[(i + 1) % 3]);
    583     const double othersign = CrossDirection[i].ScalarProduct(CrossDirection[(i + 2) % 3]);
    584 
    585     if ((sign > -MYEPSILON) && (othersign > -MYEPSILON)) // have different sign
    586       InsideFlag = false;
    587   }
    588   if (InsideFlag) {
    589     (*ClosestPoint) = InPlane;
    590     ShortestDistance = InPlane.DistanceSquared(*x);
    591   } else { // also check endnodes
    592     for (int i = 0; i < 3; i++) {
    593       const double distance = x->DistanceSquared(*endpoints[i]->node->node);
    594       if ((ShortestDistance < 0.) || (ShortestDistance > distance)) {
    595         ShortestDistance = distance;
    596         (*ClosestPoint) = (*endpoints[i]->node->node);
    597       }
    598     }
    599   }
    600   DoLog(1) && (Log() << Verbose(1) << "INFO: Closest Point is " << *ClosestPoint << " with shortest squared distance is " << ShortestDistance << "." << endl);
    601   return ShortestDistance;
    602 }
    603 ;
    604 
    605 /** Checks whether lines is any of the three boundary lines this triangle contains.
    606  * \param *line line to test
    607  * \return true - line is of the triangle, false - is not
    608  */
    609 bool BoundaryTriangleSet::ContainsBoundaryLine(const BoundaryLineSet * const line) const
    610 {
    611   Info FunctionInfo(__func__);
    612   for (int i = 0; i < 3; i++)
    613     if (line == lines[i])
    614       return true;
    615   return false;
    616 }
    617 ;
    618 
    619 /** Checks whether point is any of the three endpoints this triangle contains.
    620  * \param *point point to test
    621  * \return true - point is of the triangle, false - is not
    622  */
    623 bool BoundaryTriangleSet::ContainsBoundaryPoint(const BoundaryPointSet * const point) const
    624 {
    625   Info FunctionInfo(__func__);
    626   for (int i = 0; i < 3; i++)
    627     if (point == endpoints[i])
    628       return true;
    629   return false;
    630 }
    631 ;
    632 
    633 /** Checks whether point is any of the three endpoints this triangle contains.
    634  * \param *point TesselPoint to test
    635  * \return true - point is of the triangle, false - is not
    636  */
    637 bool BoundaryTriangleSet::ContainsBoundaryPoint(const TesselPoint * const point) const
    638 {
    639   Info FunctionInfo(__func__);
    640   for (int i = 0; i < 3; i++)
    641     if (point == endpoints[i]->node)
    642       return true;
    643   return false;
    644 }
    645 ;
    646 
    647 /** Checks whether three given \a *Points coincide with triangle's endpoints.
    648  * \param *Points[3] pointer to BoundaryPointSet
    649  * \return true - is the very triangle, false - is not
    650  */
    651 bool BoundaryTriangleSet::IsPresentTupel(const BoundaryPointSet * const Points[3]) const
    652 {
    653   Info FunctionInfo(__func__);
    654   DoLog(1) && (Log() << Verbose(1) << "INFO: Checking " << Points[0] << "," << Points[1] << "," << Points[2] << " against " << endpoints[0] << "," << endpoints[1] << "," << endpoints[2] << "." << endl);
    655   return (((endpoints[0] == Points[0]) || (endpoints[0] == Points[1]) || (endpoints[0] == Points[2])) && ((endpoints[1] == Points[0]) || (endpoints[1] == Points[1]) || (endpoints[1] == Points[2])) && ((endpoints[2] == Points[0]) || (endpoints[2] == Points[1]) || (endpoints[2] == Points[2])
    656 
    657   ));
    658 }
    659 ;
    660 
    661 /** Checks whether three given \a *Points coincide with triangle's endpoints.
    662  * \param *Points[3] pointer to BoundaryPointSet
    663  * \return true - is the very triangle, false - is not
    664  */
    665 bool BoundaryTriangleSet::IsPresentTupel(const BoundaryTriangleSet * const T) const
    666 {
    667   Info FunctionInfo(__func__);
    668   return (((endpoints[0] == T->endpoints[0]) || (endpoints[0] == T->endpoints[1]) || (endpoints[0] == T->endpoints[2])) && ((endpoints[1] == T->endpoints[0]) || (endpoints[1] == T->endpoints[1]) || (endpoints[1] == T->endpoints[2])) && ((endpoints[2] == T->endpoints[0]) || (endpoints[2] == T->endpoints[1]) || (endpoints[2] == T->endpoints[2])
    669 
    670   ));
    671 }
    672 ;
    673 
    674 /** Returns the endpoint which is not contained in the given \a *line.
    675  * \param *line baseline defining two endpoints
    676  * \return pointer third endpoint or NULL if line does not belong to triangle.
    677  */
    678 class BoundaryPointSet *BoundaryTriangleSet::GetThirdEndpoint(const BoundaryLineSet * const line) const
    679 {
    680   Info FunctionInfo(__func__);
    681   // sanity check
    682   if (!ContainsBoundaryLine(line))
    683     return NULL;
    684   for (int i = 0; i < 3; i++)
    685     if (!line->ContainsBoundaryPoint(endpoints[i]))
    686       return endpoints[i];
    687   // actually, that' impossible :)
    688   return NULL;
    689 }
    690 ;
    691 
    692 /** Returns the baseline which does not contain the given boundary point \a *point.
    693  * \param *point endpoint which is neither endpoint of the desired line
    694  * \return pointer to desired third baseline
    695  */
    696 class BoundaryLineSet *BoundaryTriangleSet::GetThirdLine(const BoundaryPointSet * const point) const
    697 {
    698   Info FunctionInfo(__func__);
    699   // sanity check
    700   if (!ContainsBoundaryPoint(point))
    701     return NULL;
    702   for (int i = 0; i < 3; i++)
    703     if (!lines[i]->ContainsBoundaryPoint(point))
    704       return lines[i];
    705   // actually, that' impossible :)
    706   return NULL;
    707 }
    708 ;
    709 
    710 /** Calculates the center point of the triangle.
    711  * Is third of the sum of all endpoints.
    712  * \param *center central point on return.
    713  */
    714 void BoundaryTriangleSet::GetCenter(Vector * const center) const
    715 {
    716   Info FunctionInfo(__func__);
    717   center->Zero();
    718   for (int i = 0; i < 3; i++)
    719     (*center) += (*endpoints[i]->node->node);
    720   center->Scale(1. / 3.);
    721   DoLog(1) && (Log() << Verbose(1) << "INFO: Center is at " << *center << "." << endl);
    722 }
    723 
    724 /**
    725  * gets the Plane defined by the three triangle Basepoints
    726  */
    727 Plane BoundaryTriangleSet::getPlane() const{
    728   ASSERT(endpoints[0] && endpoints[1] && endpoints[2], "Triangle not fully defined");
    729 
    730   return Plane(*endpoints[0]->node->node,
    731                *endpoints[1]->node->node,
    732                *endpoints[2]->node->node);
    733 }
    734 
    735 Vector BoundaryTriangleSet::getEndpoint(int i) const{
    736   ASSERT(i>=0 && i<3,"Index of Endpoint out of Range");
    737 
    738   return *endpoints[i]->node->node;
    739 }
    740 
    741 string BoundaryTriangleSet::getEndpointName(int i) const{
    742   ASSERT(i>=0 && i<3,"Index of Endpoint out of Range");
    743 
    744   return endpoints[i]->node->getName();
    745 }
    746 
    747 /** output operator for BoundaryTriangleSet.
    748  * \param &ost output stream
    749  * \param &a boundary triangle
    750  */
    751 ostream &operator <<(ostream &ost, const BoundaryTriangleSet &a)
    752 {
    753   ost << "[" << a.Nr << "|" << a.getEndpointName(0) << "," << a.getEndpointName(1) << "," << a.getEndpointName(2) << "]";
    754   //  ost << "[" << a.Nr << "|" << a.endpoints[0]->node->Name << " at " << *a.endpoints[0]->node->node << ","
    755   //      << a.endpoints[1]->node->Name << " at " << *a.endpoints[1]->node->node << "," << a.endpoints[2]->node->Name << " at " << *a.endpoints[2]->node->node << "]";
    756   return ost;
    757 }
    758 ;
    759 
    760 // ======================================== Polygons on Boundary =================================
    761 
    762 /** Constructor for BoundaryPolygonSet.
    763  */
    764 BoundaryPolygonSet::BoundaryPolygonSet() :
    765   Nr(-1)
    766 {
    767   Info FunctionInfo(__func__);
    768 }
    769 ;
    770 
    771 /** Destructor of BoundaryPolygonSet.
    772  * Just clears endpoints.
    773  * \note When removing triangles from a class Tesselation, use RemoveTesselationTriangle()
    774  */
    775 BoundaryPolygonSet::~BoundaryPolygonSet()
    776 {
    777   Info FunctionInfo(__func__);
    778   endpoints.clear();
    779   DoLog(1) && (Log() << Verbose(1) << "Erasing polygon Nr." << Nr << " itself." << endl);
    780 }
    781 ;
    782 
    783 /** Calculates the normal vector for this triangle.
    784  * Is made unique by comparison with \a OtherVector to point in the other direction.
    785  * \param &OtherVector direction vector to make normal vector unique.
    786  * \return allocated vector in normal direction
    787  */
    788 Vector * BoundaryPolygonSet::GetNormalVector(const Vector &OtherVector) const
    789 {
    790   Info FunctionInfo(__func__);
    791   // get normal vector
    792   Vector TemporaryNormal;
    793   Vector *TotalNormal = new Vector;
    794   PointSet::const_iterator Runner[3];
    795   for (int i = 0; i < 3; i++) {
    796     Runner[i] = endpoints.begin();
    797     for (int j = 0; j < i; j++) { // go as much further
    798       Runner[i]++;
    799       if (Runner[i] == endpoints.end()) {
    800         DoeLog(0) && (eLog() << Verbose(0) << "There are less than three endpoints in the polygon!" << endl);
    801         performCriticalExit();
    802       }
    803     }
    804   }
    805   TotalNormal->Zero();
    806   int counter = 0;
    807   for (; Runner[2] != endpoints.end();) {
    808     TemporaryNormal = Plane(*((*Runner[0])->node->node),
    809                             *((*Runner[1])->node->node),
    810                             *((*Runner[2])->node->node)).getNormal();
    811     for (int i = 0; i < 3; i++) // increase each of them
    812       Runner[i]++;
    813     (*TotalNormal) += TemporaryNormal;
    814   }
    815   TotalNormal->Scale(1. / (double) counter);
    816 
    817   // make it always point inward (any offset vector onto plane projected onto normal vector suffices)
    818   if (TotalNormal->ScalarProduct(OtherVector) > 0.)
    819     TotalNormal->Scale(-1.);
    820   DoLog(1) && (Log() << Verbose(1) << "Normal Vector is " << *TotalNormal << "." << endl);
    821 
    822   return TotalNormal;
    823 }
    824 ;
    825 
    826 /** Calculates the center point of the triangle.
    827  * Is third of the sum of all endpoints.
    828  * \param *center central point on return.
    829  */
    830 void BoundaryPolygonSet::GetCenter(Vector * const center) const
    831 {
    832   Info FunctionInfo(__func__);
    833   center->Zero();
    834   int counter = 0;
    835   for(PointSet::const_iterator Runner = endpoints.begin(); Runner != endpoints.end(); Runner++) {
    836     (*center) += (*(*Runner)->node->node);
    837     counter++;
    838   }
    839   center->Scale(1. / (double) counter);
    840   DoLog(1) && (Log() << Verbose(1) << "Center is at " << *center << "." << endl);
    841 }
    842 
    843 /** Checks whether the polygons contains all three endpoints of the triangle.
    844  * \param *triangle triangle to test
    845  * \return true - triangle is contained polygon, false - is not
    846  */
    847 bool BoundaryPolygonSet::ContainsBoundaryTriangle(const BoundaryTriangleSet * const triangle) const
    848 {
    849   Info FunctionInfo(__func__);
    850   return ContainsPresentTupel(triangle->endpoints, 3);
    851 }
    852 ;
    853 
    854 /** Checks whether the polygons contains both endpoints of the line.
    855  * \param *line line to test
    856  * \return true - line is of the triangle, false - is not
    857  */
    858 bool BoundaryPolygonSet::ContainsBoundaryLine(const BoundaryLineSet * const line) const
    859 {
    860   Info FunctionInfo(__func__);
    861   return ContainsPresentTupel(line->endpoints, 2);
    862 }
    863 ;
    864 
    865 /** Checks whether point is any of the three endpoints this triangle contains.
    866  * \param *point point to test
    867  * \return true - point is of the triangle, false - is not
    868  */
    869 bool BoundaryPolygonSet::ContainsBoundaryPoint(const BoundaryPointSet * const point) const
    870 {
    871   Info FunctionInfo(__func__);
    872   for (PointSet::const_iterator Runner = endpoints.begin(); Runner != endpoints.end(); Runner++) {
    873     DoLog(0) && (Log() << Verbose(0) << "Checking against " << **Runner << endl);
    874     if (point == (*Runner)) {
    875       DoLog(0) && (Log() << Verbose(0) << " Contained." << endl);
    876       return true;
    877     }
    878   }
    879   DoLog(0) && (Log() << Verbose(0) << " Not contained." << endl);
    880   return false;
    881 }
    882 ;
    883 
    884 /** Checks whether point is any of the three endpoints this triangle contains.
    885  * \param *point TesselPoint to test
    886  * \return true - point is of the triangle, false - is not
    887  */
    888 bool BoundaryPolygonSet::ContainsBoundaryPoint(const TesselPoint * const point) const
    889 {
    890   Info FunctionInfo(__func__);
    891   for (PointSet::const_iterator Runner = endpoints.begin(); Runner != endpoints.end(); Runner++)
    892     if (point == (*Runner)->node) {
    893       DoLog(0) && (Log() << Verbose(0) << " Contained." << endl);
    894       return true;
    895     }
    896   DoLog(0) && (Log() << Verbose(0) << " Not contained." << endl);
    897   return false;
    898 }
    899 ;
    900 
    901 /** Checks whether given array of \a *Points coincide with polygons's endpoints.
    902  * \param **Points pointer to an array of BoundaryPointSet
    903  * \param dim dimension of array
    904  * \return true - set of points is contained in polygon, false - is not
    905  */
    906 bool BoundaryPolygonSet::ContainsPresentTupel(const BoundaryPointSet * const * Points, const int dim) const
    907 {
    908   Info FunctionInfo(__func__);
    909   int counter = 0;
    910   DoLog(1) && (Log() << Verbose(1) << "Polygon is " << *this << endl);
    911   for (int i = 0; i < dim; i++) {
    912     DoLog(1) && (Log() << Verbose(1) << " Testing endpoint " << *Points[i] << endl);
    913     if (ContainsBoundaryPoint(Points[i])) {
    914       counter++;
    915     }
    916   }
    917 
    918   if (counter == dim)
    919     return true;
    920   else
    921     return false;
    922 }
    923 ;
    924 
    925 /** Checks whether given PointList coincide with polygons's endpoints.
    926  * \param &endpoints PointList
    927  * \return true - set of points is contained in polygon, false - is not
    928  */
    929 bool BoundaryPolygonSet::ContainsPresentTupel(const PointSet &endpoints) const
    930 {
    931   Info FunctionInfo(__func__);
    932   size_t counter = 0;
    933   DoLog(1) && (Log() << Verbose(1) << "Polygon is " << *this << endl);
    934   for (PointSet::const_iterator Runner = endpoints.begin(); Runner != endpoints.end(); Runner++) {
    935     DoLog(1) && (Log() << Verbose(1) << " Testing endpoint " << **Runner << endl);
    936     if (ContainsBoundaryPoint(*Runner))
    937       counter++;
    938   }
    939 
    940   if (counter == endpoints.size())
    941     return true;
    942   else
    943     return false;
    944 }
    945 ;
    946 
    947 /** Checks whether given set of \a *Points coincide with polygons's endpoints.
    948  * \param *P pointer to BoundaryPolygonSet
    949  * \return true - is the very triangle, false - is not
    950  */
    951 bool BoundaryPolygonSet::ContainsPresentTupel(const BoundaryPolygonSet * const P) const
    952 {
    953   return ContainsPresentTupel((const PointSet) P->endpoints);
    954 }
    955 ;
    956 
    957 /** Gathers all the endpoints' triangles in a unique set.
    958  * \return set of all triangles
    959  */
    960 TriangleSet * BoundaryPolygonSet::GetAllContainedTrianglesFromEndpoints() const
    961 {
    962   Info FunctionInfo(__func__);
    963   pair<TriangleSet::iterator, bool> Tester;
    964   TriangleSet *triangles = new TriangleSet;
    965 
    966   for (PointSet::const_iterator Runner = endpoints.begin(); Runner != endpoints.end(); Runner++)
    967     for (LineMap::const_iterator Walker = (*Runner)->lines.begin(); Walker != (*Runner)->lines.end(); Walker++)
    968       for (TriangleMap::const_iterator Sprinter = (Walker->second)->triangles.begin(); Sprinter != (Walker->second)->triangles.end(); Sprinter++) {
    969         //Log() << Verbose(0) << " Testing triangle " << *(Sprinter->second) << endl;
    970         if (ContainsBoundaryTriangle(Sprinter->second)) {
    971           Tester = triangles->insert(Sprinter->second);
    972           if (Tester.second)
    973             DoLog(0) && (Log() << Verbose(0) << "Adding triangle " << *(Sprinter->second) << endl);
    974         }
    975       }
    976 
    977   DoLog(1) && (Log() << Verbose(1) << "The Polygon of " << endpoints.size() << " endpoints has " << triangles->size() << " unique triangles in total." << endl);
    978   return triangles;
    979 }
    980 ;
    981 
    982 /** Fills the endpoints of this polygon from the triangles attached to \a *line.
    983  * \param *line lines with triangles attached
    984  * \return true - polygon contains endpoints, false - line was NULL
    985  */
    986 bool BoundaryPolygonSet::FillPolygonFromTrianglesOfLine(const BoundaryLineSet * const line)
    987 {
    988   Info FunctionInfo(__func__);
    989   pair<PointSet::iterator, bool> Tester;
    990   if (line == NULL)
    991     return false;
    992   DoLog(1) && (Log() << Verbose(1) << "Filling polygon from line " << *line << endl);
    993   for (TriangleMap::const_iterator Runner = line->triangles.begin(); Runner != line->triangles.end(); Runner++) {
    994     for (int i = 0; i < 3; i++) {
    995       Tester = endpoints.insert((Runner->second)->endpoints[i]);
    996       if (Tester.second)
    997         DoLog(1) && (Log() << Verbose(1) << "  Inserting endpoint " << *((Runner->second)->endpoints[i]) << endl);
    998     }
    999   }
    1000 
    1001   return true;
    1002 }
    1003 ;
    1004 
    1005 /** output operator for BoundaryPolygonSet.
    1006  * \param &ost output stream
    1007  * \param &a boundary polygon
    1008  */
    1009 ostream &operator <<(ostream &ost, const BoundaryPolygonSet &a)
    1010 {
    1011   ost << "[" << a.Nr << "|";
    1012   for (PointSet::const_iterator Runner = a.endpoints.begin(); Runner != a.endpoints.end();) {
    1013     ost << (*Runner)->node->getName();
    1014     Runner++;
    1015     if (Runner != a.endpoints.end())
    1016       ost << ",";
    1017   }
    1018   ost << "]";
    1019   return ost;
    1020 }
    1021 ;
    1022 
    1023 // =========================================================== class TESSELPOINT ===========================================
    1024 
    1025 /** Constructor of class TesselPoint.
    1026  */
    1027 TesselPoint::TesselPoint()
    1028 {
    1029   //Info FunctionInfo(__func__);
    1030   node = NULL;
    1031   nr = -1;
    1032 }
    1033 ;
    1034 
    1035 /** Destructor for class TesselPoint.
    1036  */
    1037 TesselPoint::~TesselPoint()
    1038 {
    1039   //Info FunctionInfo(__func__);
    1040 }
    1041 ;
    1042 
    1043 /** Prints LCNode to screen.
    1044  */
    1045 ostream & operator <<(ostream &ost, const TesselPoint &a)
    1046 {
    1047   ost << "[" << a.getName() << "|" << *a.node << "]";
    1048   return ost;
    1049 }
    1050 ;
    1051 
    1052 /** Prints LCNode to screen.
    1053  */
    1054 ostream & TesselPoint::operator <<(ostream &ost)
    1055 {
    1056   Info FunctionInfo(__func__);
    1057   ost << "[" << (nr) << "|" << this << "]";
    1058   return ost;
    1059 }
    1060 ;
    1061 
    1062 // =========================================================== class POINTCLOUD ============================================
    1063 
    1064 /** Constructor of class PointCloud.
    1065  */
    1066 PointCloud::PointCloud()
    1067 {
    1068   //Info FunctionInfo(__func__);
    1069 }
    1070 ;
    1071 
    1072 /** Destructor for class PointCloud.
    1073  */
    1074 PointCloud::~PointCloud()
    1075 {
    1076   //Info FunctionInfo(__func__);
    1077 }
    1078 ;
    1079 
    1080 // ============================ CandidateForTesselation =============================
    1081 
    1082 /** Constructor of class CandidateForTesselation.
    1083  */
    1084 CandidateForTesselation::CandidateForTesselation(BoundaryLineSet* line) :
    1085   BaseLine(line), ThirdPoint(NULL), T(NULL), ShortestAngle(2. * M_PI), OtherShortestAngle(2. * M_PI)
    1086 {
    1087   Info FunctionInfo(__func__);
    1088 }
    1089 ;
    1090 
    1091 /** Constructor of class CandidateForTesselation.
    1092  */
    1093 CandidateForTesselation::CandidateForTesselation(TesselPoint *candidate, BoundaryLineSet* line, BoundaryPointSet* point, Vector OptCandidateCenter, Vector OtherOptCandidateCenter) :
    1094   BaseLine(line), ThirdPoint(point), T(NULL), ShortestAngle(2. * M_PI), OtherShortestAngle(2. * M_PI)
    1095 {
    1096         Info FunctionInfo(__func__);
    1097   OptCenter = OptCandidateCenter;
    1098   OtherOptCenter = OtherOptCandidateCenter;
    1099 };
    1100 
    1101 
    1102 /** Destructor for class CandidateForTesselation.
    1103  */
    1104 CandidateForTesselation::~CandidateForTesselation()
    1105 {
    1106 }
    1107 ;
    1108 
    1109 /** Checks validity of a given sphere of a candidate line.
    1110  * Sphere must touch all candidates and the baseline endpoints and there must be no other atoms inside.
    1111  * \param RADIUS radius of sphere
    1112  * \param *LC LinkedCell structure with other atoms
    1113  * \return true - sphere is valid, false - sphere contains other points
    1114  */
    1115 bool CandidateForTesselation::CheckValidity(const double RADIUS, const LinkedCell *LC) const
    1116 {
    1117   Info FunctionInfo(__func__);
    1118 
    1119   const double radiusSquared = RADIUS * RADIUS;
    1120   list<const Vector *> VectorList;
    1121   VectorList.push_back(&OptCenter);
    1122   //VectorList.push_back(&OtherOptCenter);  // don't check the other (wrong) center
    1123 
    1124   if (!pointlist.empty())
    1125     DoLog(1) && (Log() << Verbose(1) << "INFO: Checking whether sphere contains candidate list and baseline " << *BaseLine->endpoints[0] << "<->" << *BaseLine->endpoints[1] << " only ..." << endl);
    1126   else
    1127     DoLog(1) && (Log() << Verbose(1) << "INFO: Checking whether sphere with no candidates contains baseline " << *BaseLine->endpoints[0] << "<->" << *BaseLine->endpoints[1] << " only ..." << endl);
    1128   // check baseline for OptCenter and OtherOptCenter being on sphere's surface
    1129   for (list<const Vector *>::const_iterator VRunner = VectorList.begin(); VRunner != VectorList.end(); ++VRunner) {
    1130     for (int i = 0; i < 2; i++) {
    1131       const double distance = fabs((*VRunner)->DistanceSquared(*BaseLine->endpoints[i]->node->node) - radiusSquared);
    1132       if (distance > HULLEPSILON) {
    1133         DoeLog(1) && (eLog() << Verbose(1) << "Endpoint " << *BaseLine->endpoints[i] << " is out of sphere at " << *(*VRunner) << " by " << distance << "." << endl);
    1134         return false;
    1135       }
    1136     }
    1137   }
    1138 
    1139   // check Candidates for OptCenter and OtherOptCenter being on sphere's surface
    1140   for (TesselPointList::const_iterator Runner = pointlist.begin(); Runner != pointlist.end(); ++Runner) {
    1141     const TesselPoint *Walker = *Runner;
    1142     for (list<const Vector *>::const_iterator VRunner = VectorList.begin(); VRunner != VectorList.end(); ++VRunner) {
    1143       const double distance = fabs((*VRunner)->DistanceSquared(*Walker->node) - radiusSquared);
    1144       if (distance > HULLEPSILON) {
    1145         DoeLog(1) && (eLog() << Verbose(1) << "Candidate " << *Walker << " is out of sphere at " << *(*VRunner) << " by " << distance << "." << endl);
    1146         return false;
    1147       } else {
    1148         DoLog(1) && (Log() << Verbose(1) << "Candidate " << *Walker << " is inside by " << distance << "." << endl);
    1149       }
    1150     }
    1151   }
    1152 
    1153   DoLog(1) && (Log() << Verbose(1) << "INFO: Checking whether sphere contains no others points ..." << endl);
    1154   bool flag = true;
    1155   for (list<const Vector *>::const_iterator VRunner = VectorList.begin(); VRunner != VectorList.end(); ++VRunner) {
    1156     // get all points inside the sphere
    1157     TesselPointList *ListofPoints = LC->GetPointsInsideSphere(RADIUS, (*VRunner));
    1158 
    1159     DoLog(1) && (Log() << Verbose(1) << "The following atoms are inside sphere at " << (*VRunner) << ":" << endl);
    1160     for (TesselPointList::const_iterator Runner = ListofPoints->begin(); Runner != ListofPoints->end(); ++Runner)
    1161       DoLog(1) && (Log() << Verbose(1) << "  " << *(*Runner) << " with distance " << (*Runner)->node->distance(*(*VRunner)) << "." << endl);
    1162 
    1163     // remove baseline's endpoints and candidates
    1164     for (int i = 0; i < 2; i++) {
    1165       DoLog(1) && (Log() << Verbose(1) << "INFO: removing baseline tesselpoint " << *BaseLine->endpoints[i]->node << "." << endl);
    1166       ListofPoints->remove(BaseLine->endpoints[i]->node);
    1167     }
    1168     for (TesselPointList::const_iterator Runner = pointlist.begin(); Runner != pointlist.end(); ++Runner) {
    1169       DoLog(1) && (Log() << Verbose(1) << "INFO: removing candidate tesselpoint " << *(*Runner) << "." << endl);
    1170       ListofPoints->remove(*Runner);
    1171     }
    1172     if (!ListofPoints->empty()) {
    1173       DoeLog(1) && (eLog() << Verbose(1) << "CheckValidity: There are still " << ListofPoints->size() << " points inside the sphere." << endl);
    1174       flag = false;
    1175       DoeLog(1) && (eLog() << Verbose(1) << "External atoms inside of sphere at " << *(*VRunner) << ":" << endl);
    1176       for (TesselPointList::const_iterator Runner = ListofPoints->begin(); Runner != ListofPoints->end(); ++Runner)
    1177         DoeLog(1) && (eLog() << Verbose(1) << "  " << *(*Runner) << " at distance " << setprecision(13) << (*Runner)->node->distance(*(*VRunner)) << setprecision(6) << "." << endl);
    1178 
    1179       // check with animate_sphere.tcl VMD script
    1180       if (ThirdPoint != NULL) {
    1181         DoeLog(1) && (eLog() << Verbose(1) << "Check by: animate_sphere 0 " << BaseLine->endpoints[0]->Nr + 1 << " " << BaseLine->endpoints[1]->Nr + 1 << " " << ThirdPoint->Nr + 1 << " " << RADIUS << " " << OldCenter[0] << " " << OldCenter[1] << " " << OldCenter[2] << " " << (*VRunner)->at(0) << " " << (*VRunner)->at(1) << " " << (*VRunner)->at(2) << endl);
    1182       } else {
    1183         DoeLog(1) && (eLog() << Verbose(1) << "Check by: ... missing third point ..." << endl);
    1184         DoeLog(1) && (eLog() << Verbose(1) << "Check by: animate_sphere 0 " << BaseLine->endpoints[0]->Nr + 1 << " " << BaseLine->endpoints[1]->Nr + 1 << " ??? " << RADIUS << " " << OldCenter[0] << " " << OldCenter[1] << " " << OldCenter[2] << " " << (*VRunner)->at(0) << " " << (*VRunner)->at(1) << " " << (*VRunner)->at(2) << endl);
    1185       }
    1186     }
    1187     delete (ListofPoints);
    1188 
    1189   }
    1190   return flag;
    1191 }
    1192 ;
    1193 
    1194 /** output operator for CandidateForTesselation.
    1195  * \param &ost output stream
    1196  * \param &a boundary line
    1197  */
    1198 ostream & operator <<(ostream &ost, const CandidateForTesselation &a)
    1199 {
    1200   ost << "[" << a.BaseLine->Nr << "|" << a.BaseLine->endpoints[0]->node->getName() << "," << a.BaseLine->endpoints[1]->node->getName() << "] with ";
    1201   if (a.pointlist.empty())
    1202     ost << "no candidate.";
    1203   else {
    1204     ost << "candidate";
    1205     if (a.pointlist.size() != 1)
    1206       ost << "s ";
    1207     else
    1208       ost << " ";
    1209     for (TesselPointList::const_iterator Runner = a.pointlist.begin(); Runner != a.pointlist.end(); Runner++)
    1210       ost << *(*Runner) << " ";
    1211     ost << " at angle " << (a.ShortestAngle) << ".";
    1212   }
    1213 
    1214   return ost;
    1215 }
    1216 ;
    1217 
    1218 // =========================================================== class TESSELATION ===========================================
     37const char *TecplotSuffix=".dat";
     38const char *Raster3DSuffix=".r3d";
     39const char *VRMLSUffix=".wrl";
     40
     41const double ParallelEpsilon=1e-3;
     42const double Tesselation::HULLEPSILON = 1e-9;
    121943
    122044/** Constructor of class Tesselation.
    122145 */
    122246Tesselation::Tesselation() :
    1223   PointsOnBoundaryCount(0), LinesOnBoundaryCount(0), TrianglesOnBoundaryCount(0), LastTriangle(NULL), TriangleFilesWritten(0), InternalPointer(PointsOnBoundary.begin())
     47  PointsOnBoundaryCount(0),
     48  LinesOnBoundaryCount(0),
     49  TrianglesOnBoundaryCount(0),
     50  LastTriangle(NULL),
     51  TriangleFilesWritten(0),
     52  InternalPointer(PointsOnBoundary.begin())
    122453{
    122554  Info FunctionInfo(__func__);
     
    125483  int num = 0;
    125584  for (GoToFirst(); (!IsEnd()); GoToNext()) {
    1256     (*Center) += (*GetPoint()->node);
     85    (*Center) += (GetPoint()->getPosition());
    125786    num++;
    125887  }
     
    1337166      C++;
    1338167      for (; C != PointsOnBoundary.end(); C++) {
    1339         tmp = A->second->node->node->DistanceSquared(*B->second->node->node);
     168        tmp = A->second->node->DistanceSquared(B->second->node->getPosition());
    1340169        distance = tmp * tmp;
    1341         tmp = A->second->node->node->DistanceSquared(*C->second->node->node);
     170        tmp = A->second->node->DistanceSquared(C->second->node->getPosition());
    1342171        distance += tmp * tmp;
    1343         tmp = B->second->node->node->DistanceSquared(*C->second->node->node);
     172        tmp = B->second->node->DistanceSquared(C->second->node->getPosition());
    1344173        distance += tmp * tmp;
    1345174        DistanceMMap.insert(DistanceMultiMapPair(distance, pair<PointMap::iterator, PointMap::iterator> (B, C)));
     
    1360189    // 2. next, we have to check whether all points reside on only one side of the triangle
    1361190    // 3. construct plane vector
    1362     PlaneVector = Plane(*A->second->node->node,
    1363                         *baseline->second.first->second->node->node,
    1364                         *baseline->second.second->second->node->node).getNormal();
     191    PlaneVector = Plane(A->second->node->getPosition(),
     192                        baseline->second.first->second->node->getPosition(),
     193                        baseline->second.second->second->node->getPosition()).getNormal();
    1365194    DoLog(2) && (Log() << Verbose(2) << "Plane vector of candidate triangle is " << PlaneVector << endl);
    1366195    // 4. loop over all points
     
    1372201        continue;
    1373202      // 4a. project onto plane vector
    1374       TrialVector = (*checker->second->node->node);
    1375       TrialVector.SubtractVector(*A->second->node->node);
     203      TrialVector = (checker->second->node->getPosition() - A->second->node->getPosition());
    1376204      distance = TrialVector.ScalarProduct(PlaneVector);
    1377205      if (fabs(distance) < 1e-4) // we need to have a small epsilon around 0 which is still ok
     
    1389217      }
    1390218      // 4d. Check whether the point is inside the triangle (check distance to each node
    1391       tmp = checker->second->node->node->DistanceSquared(*A->second->node->node);
     219      tmp = checker->second->node->DistanceSquared(A->second->node->getPosition());
    1392220      int innerpoint = 0;
    1393       if ((tmp < A->second->node->node->DistanceSquared(*baseline->second.first->second->node->node)) && (tmp < A->second->node->node->DistanceSquared(*baseline->second.second->second->node->node)))
     221      if ((tmp < A->second->node->DistanceSquared(baseline->second.first->second->node->getPosition())) && (tmp < A->second->node->DistanceSquared(baseline->second.second->second->node->getPosition())))
    1394222        innerpoint++;
    1395       tmp = checker->second->node->node->DistanceSquared(*baseline->second.first->second->node->node);
    1396       if ((tmp < baseline->second.first->second->node->node->DistanceSquared(*A->second->node->node)) && (tmp < baseline->second.first->second->node->node->DistanceSquared(*baseline->second.second->second->node->node)))
     223      tmp = checker->second->node->DistanceSquared(baseline->second.first->second->node->getPosition());
     224      if ((tmp < baseline->second.first->second->node->DistanceSquared(A->second->node->getPosition())) && (tmp < baseline->second.first->second->node->DistanceSquared(baseline->second.second->second->node->getPosition())))
    1397225        innerpoint++;
    1398       tmp = checker->second->node->node->DistanceSquared(*baseline->second.second->second->node->node);
    1399       if ((tmp < baseline->second.second->second->node->node->DistanceSquared(*baseline->second.first->second->node->node)) && (tmp < baseline->second.second->second->node->node->DistanceSquared(*A->second->node->node)))
     226      tmp = checker->second->node->DistanceSquared(baseline->second.second->second->node->getPosition());
     227      if ((tmp < baseline->second.second->second->node->DistanceSquared(baseline->second.first->second->node->getPosition())) && (tmp < baseline->second.second->second->node->DistanceSquared(A->second->node->getPosition())))
    1400228        innerpoint++;
    1401229      // 4e. If so, break 4. loop and continue with next candidate in 1. loop
     
    1478306        // prepare some auxiliary vectors
    1479307        Vector BaseLineCenter, BaseLine;
    1480         BaseLineCenter = 0.5 * ((*baseline->second->endpoints[0]->node->node) +
    1481                                 (*baseline->second->endpoints[1]->node->node));
    1482         BaseLine = (*baseline->second->endpoints[0]->node->node) - (*baseline->second->endpoints[1]->node->node);
     308        BaseLineCenter = 0.5 * ((baseline->second->endpoints[0]->node->getPosition()) +
     309                                (baseline->second->endpoints[1]->node->getPosition()));
     310        BaseLine = (baseline->second->endpoints[0]->node->getPosition()) - (baseline->second->endpoints[1]->node->getPosition());
    1483311
    1484312        // offset to center of triangle
     
    1498326        // project center vector onto triangle plane (points from intersection plane-NormalVector to plane-CenterVector intersection)
    1499327        PropagationVector = Plane(BaseLine, NormalVector,0).getNormal();
    1500         TempVector = CenterVector - (*baseline->second->endpoints[0]->node->node); // TempVector is vector on triangle plane pointing from one baseline egde towards center!
     328        TempVector = CenterVector - (baseline->second->endpoints[0]->node->getPosition()); // TempVector is vector on triangle plane pointing from one baseline egde towards center!
    1501329        //Log() << Verbose(0) << "Projection of propagation onto temp: " << PropagationVector.Projection(&TempVector) << "." << endl;
    1502330        if (PropagationVector.ScalarProduct(TempVector) > 0) // make sure normal propagation vector points outward from baseline
     
    1511339
    1512340            // first check direction, so that triangles don't intersect
    1513             VirtualNormalVector = (*target->second->node->node) - BaseLineCenter;
     341            VirtualNormalVector = (target->second->node->getPosition()) - BaseLineCenter;
    1514342            VirtualNormalVector.ProjectOntoPlane(NormalVector);
    1515343            TempAngle = VirtualNormalVector.Angle(PropagationVector);
     
    1540368
    1541369            // check for linear dependence
    1542             TempVector = (*baseline->second->endpoints[0]->node->node) - (*target->second->node->node);
    1543             helper = (*baseline->second->endpoints[1]->node->node) - (*target->second->node->node);
     370            TempVector = (baseline->second->endpoints[0]->node->getPosition()) - (target->second->node->getPosition());
     371            helper = (baseline->second->endpoints[1]->node->getPosition()) - (target->second->node->getPosition());
    1544372            helper.ProjectOntoPlane(TempVector);
    1545373            if (fabs(helper.NormSquared()) < MYEPSILON) {
     
    1550378            // in case NOT both were found, create virtually this triangle, get its normal vector, calculate angle
    1551379            flag = true;
    1552             VirtualNormalVector = Plane(*(baseline->second->endpoints[0]->node->node),
    1553                                         *(baseline->second->endpoints[1]->node->node),
    1554                                         *(target->second->node->node)).getNormal();
    1555             TempVector = (1./3.) * ((*baseline->second->endpoints[0]->node->node) +
    1556                                     (*baseline->second->endpoints[1]->node->node) +
    1557                                     (*target->second->node->node));
     380            VirtualNormalVector = Plane((baseline->second->endpoints[0]->node->getPosition()),
     381                                        (baseline->second->endpoints[1]->node->getPosition()),
     382                                        (target->second->node->getPosition())).getNormal();
     383            TempVector = (1./3.) * ((baseline->second->endpoints[0]->node->getPosition()) +
     384                                    (baseline->second->endpoints[1]->node->getPosition()) +
     385                                    (target->second->node->getPosition()));
    1558386            TempVector -= (*Center);
    1559387            // make it always point outward
     
    1569397            } else if (fabs(SmallestAngle - TempAngle) < MYEPSILON) { // check the angle to propagation, both possible targets are in one plane! (their normals have same angle)
    1570398              // hence, check the angles to some normal direction from our base line but in this common plane of both targets...
    1571               helper = (*target->second->node->node) - BaseLineCenter;
     399              helper = (target->second->node->getPosition()) - BaseLineCenter;
    1572400              helper.ProjectOntoPlane(BaseLine);
    1573401              // ...the one with the smaller angle is the better candidate
    1574               TempVector = (*target->second->node->node) - BaseLineCenter;
     402              TempVector = (target->second->node->getPosition()) - BaseLineCenter;
    1575403              TempVector.ProjectOntoPlane(VirtualNormalVector);
    1576404              TempAngle = TempVector.Angle(helper);
    1577               TempVector = (*winner->second->node->node) - BaseLineCenter;
     405              TempVector = (winner->second->node->getPosition()) - BaseLineCenter;
    1578406              TempVector.ProjectOntoPlane(VirtualNormalVector);
    1579407              if (TempAngle < TempVector.Angle(helper)) {
     
    1614442            BLS[2] = LineChecker[1]->second;
    1615443          BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount);
    1616           BTS->GetCenter(&helper);
     444          BTS->GetCenter(helper);
    1617445          helper -= (*Center);
    1618446          helper *= -1;
     
    1662490    DoLog(0) && (Log() << Verbose(0) << "Current point is " << *Walker << "." << endl);
    1663491    // get the next triangle
    1664     triangles = FindClosestTrianglesToVector(Walker->node, BoundaryPoints);
     492    triangles = FindClosestTrianglesToVector(Walker->getPosition(), BoundaryPoints);
    1665493    if (triangles != NULL)
    1666494      BTS = triangles->front();
     
    1676504    DoLog(0) && (Log() << Verbose(0) << "Closest triangle is " << *BTS << "." << endl);
    1677505    // get the intersection point
    1678     if (BTS->GetIntersectionInsideTriangle(Center, Walker->node, &Intersection)) {
     506    if (BTS->GetIntersectionInsideTriangle(*Center, Walker->getPosition(), Intersection)) {
    1679507      DoLog(0) && (Log() << Verbose(0) << "We have an intersection at " << Intersection << "." << endl);
    1680508      // we have the intersection, check whether in- or outside of boundary
    1681       if ((Center->DistanceSquared(*Walker->node) - Center->DistanceSquared(Intersection)) < -MYEPSILON) {
     509      if ((Center->DistanceSquared(Walker->getPosition()) - Center->DistanceSquared(Intersection)) < -MYEPSILON) {
    1682510        // inside, next!
    1683511        DoLog(0) && (Log() << Verbose(0) << *Walker << " is inside wrt triangle " << *BTS << "." << endl);
     
    2086914  DoLog(1) && (Log() << Verbose(1) << "The following atoms are inside sphere at " << CandidateLine.OtherOptCenter << ":" << endl);
    2087915  for (TesselPointList::const_iterator Runner = ListofPoints->begin(); Runner != ListofPoints->end(); ++Runner)
    2088     DoLog(1) && (Log() << Verbose(1) << "  " << *(*Runner) << " with distance " << (*Runner)->node->distance(CandidateLine.OtherOptCenter) << "." << endl);
     916    DoLog(1) && (Log() << Verbose(1) << "  " << *(*Runner) << " with distance " << (*Runner)->distance(CandidateLine.OtherOptCenter) << "." << endl);
    2089917
    2090918  // remove triangles's endpoints
     
    2102930    DoLog(1) && (Log() << Verbose(1) << "External atoms inside of sphere at " << CandidateLine.OtherOptCenter << ":" << endl);
    2103931    for (TesselPointList::const_iterator Runner = ListofPoints->begin(); Runner != ListofPoints->end(); ++Runner)
    2104       DoLog(1) && (Log() << Verbose(1) << "  " << *(*Runner) << " with distance " << (*Runner)->node->distance(CandidateLine.OtherOptCenter) << "." << endl);
     932      DoLog(1) && (Log() << Verbose(1) << "  " << *(*Runner) << " with distance " << (*Runner)->distance(CandidateLine.OtherOptCenter) << "." << endl);
    2105933  }
    2106934  delete (ListofPoints);
     
    22571085        if (List != NULL) {
    22581086          for (LinkedCell::LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) {
    2259             if ((*Runner)->node->at(map[0]) > maxCoordinate[map[0]]) {
    2260               DoLog(1) && (Log() << Verbose(1) << "New maximal for axis " << map[0] << " node is " << *(*Runner) << " at " << *(*Runner)->node << "." << endl);
    2261               maxCoordinate[map[0]] = (*Runner)->node->at(map[0]);
     1087            if ((*Runner)->at(map[0]) > maxCoordinate[map[0]]) {
     1088              DoLog(1) && (Log() << Verbose(1) << "New maximal for axis " << map[0] << " node is " << *(*Runner) << " at " << (*Runner)->getPosition() << "." << endl);
     1089              maxCoordinate[map[0]] = (*Runner)->at(map[0]);
    22621090              MaxPoint[map[0]] = (*Runner);
    22631091            }
     
    22951123
    22961124    // construct center of circle
    2297     CircleCenter = 0.5 * ((*BaseLine->endpoints[0]->node->node) + (*BaseLine->endpoints[1]->node->node));
     1125    CircleCenter = 0.5 * ((BaseLine->endpoints[0]->node->getPosition()) + (BaseLine->endpoints[1]->node->getPosition()));
    22981126
    22991127    // construct normal vector of circle
    2300     CirclePlaneNormal = (*BaseLine->endpoints[0]->node->node) - (*BaseLine->endpoints[1]->node->node);
     1128    CirclePlaneNormal = (BaseLine->endpoints[0]->node->getPosition()) - (BaseLine->endpoints[1]->node->getPosition());
    23011129
    23021130    double radius = CirclePlaneNormal.NormSquared();
     
    25151343
    25161344  // construct center of circle
    2517   CircleCenter = 0.5 * ((*CandidateLine.BaseLine->endpoints[0]->node->node) +
    2518                         (*CandidateLine.BaseLine->endpoints[1]->node->node));
     1345  CircleCenter = 0.5 * ((CandidateLine.BaseLine->endpoints[0]->node->getPosition()) +
     1346                        (CandidateLine.BaseLine->endpoints[1]->node->getPosition()));
    25191347
    25201348  // construct normal vector of circle
    2521   CirclePlaneNormal = (*CandidateLine.BaseLine->endpoints[0]->node->node) -
    2522                       (*CandidateLine.BaseLine->endpoints[1]->node->node);
     1349  CirclePlaneNormal = (CandidateLine.BaseLine->endpoints[0]->node->getPosition()) -
     1350                      (CandidateLine.BaseLine->endpoints[1]->node->getPosition());
    25231351
    25241352  // calculate squared radius of circle
     
    25361364    // construct SearchDirection and an "outward pointer"
    25371365    SearchDirection = Plane(RelativeSphereCenter, CirclePlaneNormal,0).getNormal();
    2538     helper = CircleCenter - (*ThirdPoint->node->node);
     1366    helper = CircleCenter - (ThirdPoint->node->getPosition());
    25391367    if (helper.ScalarProduct(SearchDirection) < -HULLEPSILON)// ohoh, SearchDirection points inwards!
    25401368      SearchDirection.Scale(-1.);
     
    26111439  for (TesselPointList::iterator Runner = CandidateLine.pointlist.begin(); Runner != CandidateLine.pointlist.end(); Runner++)
    26121440    SetOfNeighbours.insert(*Runner);
    2613   TesselPointList *connectedClosestPoints = GetCircleOfSetOfPoints(&SetOfNeighbours, TurningPoint, CandidateLine.BaseLine->endpoints[1]->node->node);
     1441  TesselPointList *connectedClosestPoints = GetCircleOfSetOfPoints(&SetOfNeighbours, TurningPoint, CandidateLine.BaseLine->endpoints[1]->node->getPosition());
    26141442
    26151443  DoLog(0) && (Log() << Verbose(0) << "List of Candidates for Turning Point " << *TurningPoint << ":" << endl);
     
    27121540
    27131541  // create normal vector
    2714   BTS->GetCenter(&Center);
     1542  BTS->GetCenter(Center);
    27151543  Center -= CandidateLine.OptCenter;
    27161544  BTS->SphereCenter = CandidateLine.OptCenter;
     
    27911619
    27921620  // create normal vector
    2793   BTS->GetCenter(&Center);
     1621  BTS->GetCenter(Center);
    27941622  Center.SubtractVector(*OptCenter);
    27951623  BTS->SphereCenter = *OptCenter;
     
    28371665  Vector DistanceToIntersection[2], BaseLine;
    28381666  double distance[2];
    2839   BaseLine = (*Base->endpoints[1]->node->node) - (*Base->endpoints[0]->node->node);
     1667  BaseLine = (Base->endpoints[1]->node->getPosition()) - (Base->endpoints[0]->node->getPosition());
    28401668  for (int i = 0; i < 2; i++) {
    2841     DistanceToIntersection[i] = (*ClosestPoint) - (*Base->endpoints[i]->node->node);
     1669    DistanceToIntersection[i] = (*ClosestPoint) - (Base->endpoints[i]->node->getPosition());
    28421670    distance[i] = BaseLine.ScalarProduct(DistanceToIntersection[i]);
    28431671  }
     
    29191747
    29201748  // calculate volume
    2921   volume = CalculateVolumeofGeneralTetraeder(*Base->endpoints[1]->node->node, *OtherBase->endpoints[0]->node->node, *OtherBase->endpoints[1]->node->node, *Base->endpoints[0]->node->node);
     1749  volume = CalculateVolumeofGeneralTetraeder(Base->endpoints[1]->node->getPosition(), OtherBase->endpoints[0]->node->getPosition(), OtherBase->endpoints[1]->node->getPosition(), Base->endpoints[0]->node->getPosition());
    29221750
    29231751  // delete the temporary other base line and the closest points
     
    31251953
    31261954              OrthogonalizedOben = Oben;
    3127               aCandidate = (*a->node) - (*Candidate->node);
     1955              aCandidate = (a->getPosition()) - (Candidate->getPosition());
    31281956              OrthogonalizedOben.ProjectOntoPlane(aCandidate);
    31291957              OrthogonalizedOben.Normalize();
     
    31321960              OrthogonalizedOben.Scale(scaleFactor);
    31331961
    3134               Center = 0.5 * ((*Candidate->node) + (*a->node));
     1962              Center = 0.5 * ((Candidate->getPosition()) + (a->getPosition()));
    31351963              Center += OrthogonalizedOben;
    31361964
    3137               AngleCheck = Center - (*a->node);
     1965              AngleCheck = Center - (a->getPosition());
    31381966              norm = aCandidate.Norm();
    31391967              // second point shall have smallest angle with respect to Oben vector
     
    32202048
    32212049  // construct center of circle
    3222   CircleCenter = 0.5 * ((*CandidateLine.BaseLine->endpoints[0]->node->node) +
    3223                         (*CandidateLine.BaseLine->endpoints[1]->node->node));
     2050  CircleCenter = 0.5 * ((CandidateLine.BaseLine->endpoints[0]->node->getPosition()) +
     2051                        (CandidateLine.BaseLine->endpoints[1]->node->getPosition()));
    32242052
    32252053  // construct normal vector of circle
    3226   CirclePlaneNormal = (*CandidateLine.BaseLine->endpoints[0]->node->node) -
    3227                       (*CandidateLine.BaseLine->endpoints[1]->node->node);
     2054  CirclePlaneNormal = (CandidateLine.BaseLine->endpoints[0]->node->getPosition()) -
     2055                      (CandidateLine.BaseLine->endpoints[1]->node->getPosition());
    32282056
    32292057  RelativeOldSphereCenter = OldSphereCenter - CircleCenter;
     
    32522080
    32532081      // get cell for the starting point
    3254       if (LC->SetIndexToVector(&CircleCenter)) {
     2082      if (LC->SetIndexToVector(CircleCenter)) {
    32552083        for (int i = 0; i < NDIM; i++) // store indices of this cell
    32562084          N[i] = LC->n[i];
     
    32822110
    32832111                  // find center on the plane
    3284                   GetCenterofCircumcircle(&NewPlaneCenter, *CandidateLine.BaseLine->endpoints[0]->node->node, *CandidateLine.BaseLine->endpoints[1]->node->node, *Candidate->node);
     2112                  GetCenterofCircumcircle(NewPlaneCenter, CandidateLine.BaseLine->endpoints[0]->node->getPosition(), CandidateLine.BaseLine->endpoints[1]->node->getPosition(), Candidate->getPosition());
    32852113                  DoLog(1) && (Log() << Verbose(1) << "INFO: NewPlaneCenter is " << NewPlaneCenter << "." << endl);
    32862114
    32872115                  try {
    3288                     NewNormalVector = Plane(*(CandidateLine.BaseLine->endpoints[0]->node->node),
    3289                                             *(CandidateLine.BaseLine->endpoints[1]->node->node),
    3290                                             *(Candidate->node)).getNormal();
     2116                    NewNormalVector = Plane((CandidateLine.BaseLine->endpoints[0]->node->getPosition()),
     2117                                            (CandidateLine.BaseLine->endpoints[1]->node->getPosition()),
     2118                                            (Candidate->getPosition())).getNormal();
    32912119                    DoLog(1) && (Log() << Verbose(1) << "INFO: NewNormalVector is " << NewNormalVector << "." << endl);
    3292                     radius = CandidateLine.BaseLine->endpoints[0]->node->node->DistanceSquared(NewPlaneCenter);
     2120                    radius = CandidateLine.BaseLine->endpoints[0]->node->DistanceSquared(NewPlaneCenter);
    32932121                    DoLog(1) && (Log() << Verbose(1) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl);
    32942122                    DoLog(1) && (Log() << Verbose(1) << "INFO: SearchDirection is " << SearchDirection << "." << endl);
    32952123                    DoLog(1) && (Log() << Verbose(1) << "INFO: Radius of CircumCenterCircle is " << radius << "." << endl);
    32962124                    if (radius < RADIUS * RADIUS) {
    3297                       otherradius = CandidateLine.BaseLine->endpoints[1]->node->node->DistanceSquared(NewPlaneCenter);
     2125                      otherradius = CandidateLine.BaseLine->endpoints[1]->node->DistanceSquared(NewPlaneCenter);
    32982126                      if (fabs(radius - otherradius) < HULLEPSILON) {
    32992127                        // construct both new centers
     
    33092137                        OtherNewSphereCenter += helper;
    33102138                        DoLog(2) && (Log() << Verbose(2) << "INFO: OtherNewSphereCenter is at " << OtherNewSphereCenter << "." << endl);
    3311                         alpha = GetPathLengthonCircumCircle(CircleCenter, CirclePlaneNormal, CircleRadius, NewSphereCenter, OldSphereCenter, NormalVector, SearchDirection);
    3312                         Otheralpha = GetPathLengthonCircumCircle(CircleCenter, CirclePlaneNormal, CircleRadius, OtherNewSphereCenter, OldSphereCenter, NormalVector, SearchDirection);
     2139                        alpha = GetPathLengthonCircumCircle(CircleCenter, CirclePlaneNormal, CircleRadius, NewSphereCenter, OldSphereCenter, NormalVector, SearchDirection, HULLEPSILON);
     2140                        Otheralpha = GetPathLengthonCircumCircle(CircleCenter, CirclePlaneNormal, CircleRadius, OtherNewSphereCenter, OldSphereCenter, NormalVector, SearchDirection, HULLEPSILON);
    33132141                        if ((ThirdPoint != NULL) && (Candidate == ThirdPoint->node)) { // in that case only the other circlecenter is valid
    33142142                          if (OldSphereCenter.DistanceSquared(NewSphereCenter) < OldSphereCenter.DistanceSquared(OtherNewSphereCenter))
     
    34222250 * \return map of BoundaryPointSet of closest points sorted by squared distance or NULL.
    34232251 */
    3424 DistanceToPointMap * Tesselation::FindClosestBoundaryPointsToVector(const Vector *x, const LinkedCell* LC) const
     2252DistanceToPointMap * Tesselation::FindClosestBoundaryPointsToVector(const Vector &x, const LinkedCell* LC) const
    34252253{
    34262254  Info FunctionInfo(__func__);
     
    34502278            FindPoint = PointsOnBoundary.find((*Runner)->nr);
    34512279            if (FindPoint != PointsOnBoundary.end()) {
    3452               points->insert(DistanceToPointPair(FindPoint->second->node->node->DistanceSquared(*x), FindPoint->second));
     2280              points->insert(DistanceToPointPair(FindPoint->second->node->DistanceSquared(x), FindPoint->second));
    34532281              DoLog(1) && (Log() << Verbose(1) << "INFO: Putting " << *FindPoint->second << " into the list." << endl);
    34542282            }
     
    34742302 * \return closest BoundaryLineSet or NULL in degenerate case.
    34752303 */
    3476 BoundaryLineSet * Tesselation::FindClosestBoundaryLineToVector(const Vector *x, const LinkedCell* LC) const
     2304BoundaryLineSet * Tesselation::FindClosestBoundaryLineToVector(const Vector &x, const LinkedCell* LC) const
    34772305{
    34782306  Info FunctionInfo(__func__);
     
    34852313
    34862314  // for each point, check its lines, remember closest
    3487   DoLog(1) && (Log() << Verbose(1) << "Finding closest BoundaryLine to " << *x << " ... " << endl);
     2315  DoLog(1) && (Log() << Verbose(1) << "Finding closest BoundaryLine to " << x << " ... " << endl);
    34882316  BoundaryLineSet *ClosestLine = NULL;
    34892317  double MinDistance = -1.;
     
    34942322    for (LineMap::iterator LineRunner = Runner->second->lines.begin(); LineRunner != Runner->second->lines.end(); LineRunner++) {
    34952323      // calculate closest point on line to desired point
    3496       helper = 0.5 * ((*(LineRunner->second)->endpoints[0]->node->node) +
    3497                       (*(LineRunner->second)->endpoints[1]->node->node));
    3498       Center = (*x) - helper;
    3499       BaseLine = (*(LineRunner->second)->endpoints[0]->node->node) -
    3500                  (*(LineRunner->second)->endpoints[1]->node->node);
     2324      helper = 0.5 * (((LineRunner->second)->endpoints[0]->node->getPosition()) +
     2325                      ((LineRunner->second)->endpoints[1]->node->getPosition()));
     2326      Center = (x) - helper;
     2327      BaseLine = ((LineRunner->second)->endpoints[0]->node->getPosition()) -
     2328                 ((LineRunner->second)->endpoints[1]->node->getPosition());
    35012329      Center.ProjectOntoPlane(BaseLine);
    35022330      const double distance = Center.NormSquared();
    35032331      if ((ClosestLine == NULL) || (distance < MinDistance)) {
    35042332        // additionally calculate intersection on line (whether it's on the line section or not)
    3505         helper = (*x) - (*(LineRunner->second)->endpoints[0]->node->node) - Center;
     2333        helper = (x) - ((LineRunner->second)->endpoints[0]->node->getPosition()) - Center;
    35062334        const double lengthA = helper.ScalarProduct(BaseLine);
    3507         helper = (*x) - (*(LineRunner->second)->endpoints[1]->node->node) - Center;
     2335        helper = (x) - ((LineRunner->second)->endpoints[1]->node->getPosition()) - Center;
    35082336        const double lengthB = helper.ScalarProduct(BaseLine);
    35092337        if (lengthB * lengthA < 0) { // if have different sign
     
    35342362 * \return BoundaryTriangleSet of nearest triangle or NULL.
    35352363 */
    3536 TriangleList * Tesselation::FindClosestTrianglesToVector(const Vector *x, const LinkedCell* LC) const
     2364TriangleList * Tesselation::FindClosestTrianglesToVector(const Vector &x, const LinkedCell* LC) const
    35372365{
    35382366  Info FunctionInfo(__func__);
     
    35452373
    35462374  // for each point, check its lines, remember closest
    3547   DoLog(1) && (Log() << Verbose(1) << "Finding closest BoundaryTriangle to " << *x << " ... " << endl);
     2375  DoLog(1) && (Log() << Verbose(1) << "Finding closest BoundaryTriangle to " << x << " ... " << endl);
    35482376  LineSet ClosestLines;
    35492377  double MinDistance = 1e+16;
     
    35552383    for (LineMap::iterator LineRunner = Runner->second->lines.begin(); LineRunner != Runner->second->lines.end(); LineRunner++) {
    35562384
    3557       BaseLine = (*(LineRunner->second)->endpoints[0]->node->node) -
    3558                  (*(LineRunner->second)->endpoints[1]->node->node);
     2385      BaseLine = ((LineRunner->second)->endpoints[0]->node->getPosition()) -
     2386                 ((LineRunner->second)->endpoints[1]->node->getPosition());
    35592387      const double lengthBase = BaseLine.NormSquared();
    35602388
    3561       BaseLineIntersection = (*x) - (*(LineRunner->second)->endpoints[0]->node->node);
     2389      BaseLineIntersection = (x) - ((LineRunner->second)->endpoints[0]->node->getPosition());
    35622390      const double lengthEndA = BaseLineIntersection.NormSquared();
    35632391
    3564       BaseLineIntersection = (*x) - (*(LineRunner->second)->endpoints[1]->node->node);
     2392      BaseLineIntersection = (x) - ((LineRunner->second)->endpoints[1]->node->getPosition());
    35652393      const double lengthEndB = BaseLineIntersection.NormSquared();
    35662394
     
    35802408      } else { // intersection is closer, calculate
    35812409        // calculate closest point on line to desired point
    3582         BaseLineIntersection = (*x) - (*(LineRunner->second)->endpoints[1]->node->node);
     2410        BaseLineIntersection = (x) - ((LineRunner->second)->endpoints[1]->node->getPosition());
    35832411        Center = BaseLineIntersection;
    35842412        Center.ProjectOntoPlane(BaseLine);
     
    36212449 * \return list of BoundaryTriangleSet of nearest triangles or NULL.
    36222450 */
    3623 class BoundaryTriangleSet * Tesselation::FindClosestTriangleToVector(const Vector *x, const LinkedCell* LC) const
     2451class BoundaryTriangleSet * Tesselation::FindClosestTriangleToVector(const Vector &x, const LinkedCell* LC) const
    36242452{
    36252453  Info FunctionInfo(__func__);
     
    36362464  double MinAlignment = 2. * M_PI;
    36372465  for (TriangleList::iterator Runner = triangles->begin(); Runner != triangles->end(); Runner++) {
    3638     (*Runner)->GetCenter(&Center);
    3639     helper = (*x) - Center;
     2466    (*Runner)->GetCenter(Center);
     2467    helper = (x) - Center;
    36402468    const double Alignment = helper.Angle((*Runner)->NormalVector);
    36412469    if (Alignment < MinAlignment) {
     
    36632491{
    36642492  Info FunctionInfo(__func__);
    3665   TriangleIntersectionList Intersections(&Point, this, LC);
     2493  TriangleIntersectionList Intersections(Point, this, LC);
    36662494
    36672495  return Intersections.IsInside();
     
    37032531  }
    37042532
    3705   triangle->GetCenter(&Center);
     2533  triangle->GetCenter(Center);
    37062534  DoLog(2) && (Log() << Verbose(2) << "INFO: Central point of the triangle is " << Center << "." << endl);
    37072535  DistanceToCenter = Center - Point;
     
    37142542    Center = Point - triangle->NormalVector; // points towards MolCenter
    37152543    DoLog(1) && (Log() << Verbose(1) << "INFO: Calling Intersection with " << Center << " and " << DistanceToCenter << "." << endl);
    3716     if (triangle->GetIntersectionInsideTriangle(&Center, &DistanceToCenter, &Intersection)) {
     2544    if (triangle->GetIntersectionInsideTriangle(Center, DistanceToCenter, Intersection)) {
    37172545      DoLog(1) && (Log() << Verbose(1) << Point << " is inner point: sufficiently close to boundary, " << Intersection << "." << endl);
    37182546      return 0.;
     
    37232551  } else {
    37242552    // calculate smallest distance
    3725     distance = triangle->GetClosestPointInsideTriangle(&Point, &Intersection);
     2553    distance = triangle->GetClosestPointInsideTriangle(Point, Intersection);
    37262554    DoLog(1) && (Log() << Verbose(1) << "Closest point on triangle is " << Intersection << "." << endl);
    37272555
     
    37472575{
    37482576  Info FunctionInfo(__func__);
    3749   TriangleIntersectionList Intersections(&Point, this, LC);
     2577  TriangleIntersectionList Intersections(Point, this, LC);
    37502578
    37512579  return Intersections.GetSmallestDistance();
     
    37622590{
    37632591  Info FunctionInfo(__func__);
    3764   TriangleIntersectionList Intersections(&Point, this, LC);
     2592  TriangleIntersectionList Intersections(Point, this, LC);
    37652593
    37662594  return Intersections.GetClosestTriangle();
     
    38392667 * @return list of the all points linked to the provided one
    38402668 */
    3841 TesselPointList * Tesselation::GetCircleOfConnectedTriangles(TesselPointSet *SetOfNeighbours, const TesselPoint* const Point, const Vector * const Reference) const
     2669TesselPointList * Tesselation::GetCircleOfConnectedTriangles(TesselPointSet *SetOfNeighbours, const TesselPoint* const Point, const Vector &Reference) const
    38422670{
    38432671  Info FunctionInfo(__func__);
     
    38712699
    38722700  // construct one orthogonal vector
    3873   if (Reference != NULL) {
    3874     AngleZero = (*Reference) - (*Point->node);
    3875     AngleZero.ProjectOntoPlane(PlaneNormal);
    3876   }
    3877   if ((Reference == NULL) || (AngleZero.NormSquared() < MYEPSILON)) {
    3878     DoLog(1) && (Log() << Verbose(1) << "Using alternatively " << *(*SetOfNeighbours->begin())->node << " as angle 0 referencer." << endl);
    3879     AngleZero = (*(*SetOfNeighbours->begin())->node) - (*Point->node);
     2701  AngleZero = (Reference) - (Point->getPosition());
     2702  AngleZero.ProjectOntoPlane(PlaneNormal);
     2703  if ((AngleZero.NormSquared() < MYEPSILON)) {
     2704    DoLog(1) && (Log() << Verbose(1) << "Using alternatively " << (*SetOfNeighbours->begin())->getPosition() << " as angle 0 referencer." << endl);
     2705    AngleZero = ((*SetOfNeighbours->begin())->getPosition()) - (Point->getPosition());
    38802706    AngleZero.ProjectOntoPlane(PlaneNormal);
    38812707    if (AngleZero.NormSquared() < MYEPSILON) {
     
    38932719  // go through all connected points and calculate angle
    38942720  for (TesselPointSet::iterator listRunner = SetOfNeighbours->begin(); listRunner != SetOfNeighbours->end(); listRunner++) {
    3895     helper = (*(*listRunner)->node) - (*Point->node);
     2721    helper = ((*listRunner)->getPosition()) - (Point->getPosition());
    38962722    helper.ProjectOntoPlane(PlaneNormal);
    38972723    double angle = GetAngle(helper, AngleZero, OrthogonalVector);
     
    39152741 * @param *SetOfNeighbours all points for which the angle should be calculated
    39162742 * @param *Point of which get all connected points
    3917  * @param *Reference Reference vector for zero angle or NULL for no preference
     2743 * @param *Reference Reference vector for zero angle or (0,0,0) for no preference
    39182744 * @return list of the all points linked to the provided one
    39192745 */
    3920 TesselPointList * Tesselation::GetCircleOfSetOfPoints(TesselPointSet *SetOfNeighbours, const TesselPoint* const Point, const Vector * const Reference) const
     2746TesselPointList * Tesselation::GetCircleOfSetOfPoints(TesselPointSet *SetOfNeighbours, const TesselPoint* const Point, const Vector &Reference) const
    39212747{
    39222748  Info FunctionInfo(__func__);
     
    39422768  }
    39432769
    3944   DoLog(1) && (Log() << Verbose(1) << "INFO: Point is " << *Point << " and Reference is " << *Reference << "." << endl);
     2770  DoLog(1) && (Log() << Verbose(1) << "INFO: Point is " << *Point << " and Reference is " << Reference << "." << endl);
    39452771  // calculate central point
    39462772  TesselPointSet::const_iterator TesselA = SetOfNeighbours->begin();
     
    39522778  int counter = 0;
    39532779  while (TesselC != SetOfNeighbours->end()) {
    3954     helper = Plane(*((*TesselA)->node),
    3955                    *((*TesselB)->node),
    3956                    *((*TesselC)->node)).getNormal();
     2780    helper = Plane(((*TesselA)->getPosition()),
     2781                   ((*TesselB)->getPosition()),
     2782                   ((*TesselC)->getPosition())).getNormal();
    39572783    DoLog(0) && (Log() << Verbose(0) << "Making normal vector out of " << *(*TesselA) << ", " << *(*TesselB) << " and " << *(*TesselC) << ":" << helper << endl);
    39582784    counter++;
     
    39742800
    39752801  // construct one orthogonal vector
    3976   if (Reference != NULL) {
    3977     AngleZero = (*Reference) - (*Point->node);
     2802  if (!Reference.IsZero()) {
     2803    AngleZero = (Reference) - (Point->getPosition());
    39782804    AngleZero.ProjectOntoPlane(PlaneNormal);
    39792805  }
    3980   if ((Reference == NULL) || (AngleZero.NormSquared() < MYEPSILON )) {
    3981     DoLog(1) && (Log() << Verbose(1) << "Using alternatively " << *(*SetOfNeighbours->begin())->node << " as angle 0 referencer." << endl);
    3982     AngleZero = (*(*SetOfNeighbours->begin())->node) - (*Point->node);
     2806  if ((Reference.IsZero()) || (AngleZero.NormSquared() < MYEPSILON )) {
     2807    DoLog(1) && (Log() << Verbose(1) << "Using alternatively " << (*SetOfNeighbours->begin())->getPosition() << " as angle 0 referencer." << endl);
     2808    AngleZero = ((*SetOfNeighbours->begin())->getPosition()) - (Point->getPosition());
    39832809    AngleZero.ProjectOntoPlane(PlaneNormal);
    39842810    if (AngleZero.NormSquared() < MYEPSILON) {
     
    39972823  pair<map<double, TesselPoint*>::iterator, bool> InserterTest;
    39982824  for (TesselPointSet::iterator listRunner = SetOfNeighbours->begin(); listRunner != SetOfNeighbours->end(); listRunner++) {
    3999     helper = (*(*listRunner)->node) - (*Point->node);
     2825    helper = ((*listRunner)->getPosition()) - (Point->getPosition());
    40002826    helper.ProjectOntoPlane(PlaneNormal);
    40012827    double angle = GetAngle(helper, AngleZero, OrthogonalVector);
     
    42423068
    42433069  // copy old location for the volume
    4244   OldPoint = (*point->node->node);
     3070  OldPoint = (point->node->getPosition());
    42453071
    42463072  // get list of connected points
     
    43053131          StartNode--;
    43063132          //Log() << Verbose(3) << "INFO: StartNode is " << **StartNode << "." << endl;
    4307           Point = (*(*StartNode)->node) - (*(*MiddleNode)->node);
     3133          Point = ((*StartNode)->getPosition()) - ((*MiddleNode)->getPosition());
    43083134          StartNode = MiddleNode;
    43093135          StartNode++;
     
    43113137            StartNode = connectedPath->begin();
    43123138          //Log() << Verbose(3) << "INFO: EndNode is " << **StartNode << "." << endl;
    4313           Reference = (*(*StartNode)->node) - (*(*MiddleNode)->node);
    4314           OrthogonalVector = (*(*MiddleNode)->node) - OldPoint;
     3139          Reference = ((*StartNode)->getPosition()) - ((*MiddleNode)->getPosition());
     3140          OrthogonalVector = ((*MiddleNode)->getPosition()) - OldPoint;
    43153141          OrthogonalVector.MakeNormalTo(Reference);
    43163142          angle = GetAngle(Point, Reference, OrthogonalVector);
     
    43673193        AddTesselationTriangle();
    43683194        // calculate volume summand as a general tetraeder
    4369         volume += CalculateVolumeofGeneralTetraeder(*TPS[0]->node->node, *TPS[1]->node->node, *TPS[2]->node->node, OldPoint);
     3195        volume += CalculateVolumeofGeneralTetraeder(TPS[0]->node->getPosition(), TPS[1]->node->getPosition(), TPS[2]->node->getPosition(), OldPoint);
    43703196        // advance number
    43713197        count++;
     
    47523578  // find nearest boundary point
    47533579  class TesselPoint *BackupPoint = NULL;
    4754   class TesselPoint *NearestPoint = FindClosestTesselPoint(point->node, BackupPoint, LC);
     3580  class TesselPoint *NearestPoint = FindClosestTesselPoint(point->getPosition(), BackupPoint, LC);
    47553581  class BoundaryPointSet *NearestBoundaryPoint = NULL;
    47563582  PointMap::iterator PointRunner;
     
    47733599  class BoundaryLineSet *BestLine = NULL;
    47743600  for (LineMap::iterator Runner = NearestBoundaryPoint->lines.begin(); Runner != NearestBoundaryPoint->lines.end(); Runner++) {
    4775     BaseLine = (*Runner->second->endpoints[0]->node->node) -
    4776                (*Runner->second->endpoints[1]->node->node);
    4777     CenterToPoint = 0.5 * ((*Runner->second->endpoints[0]->node->node) +
    4778                            (*Runner->second->endpoints[1]->node->node));
    4779     CenterToPoint -= (*point->node);
     3601    BaseLine = (Runner->second->endpoints[0]->node->getPosition()) -
     3602               (Runner->second->endpoints[1]->node->getPosition());
     3603    CenterToPoint = 0.5 * ((Runner->second->endpoints[0]->node->getPosition()) +
     3604                           (Runner->second->endpoints[1]->node->getPosition()));
     3605    CenterToPoint -= (point->getPosition());
    47803606    angle = CenterToPoint.Angle(BaseLine);
    47813607    if (fabs(angle - M_PI/2.) < fabs(BestAngle - M_PI/2.)) {
  • src/tesselation.hpp

    re588312 rb5c53d  
    22 * tesselation.hpp
    33 *
    4  *  The tesselation class is meant to contain the envelope (concave, convex or neither) of a set of Vectors. As we actually mean this stuff for atoms, we have to encapsulate it all a bit.
     4 *  The tesselation class is meant to contain the envelope (concave, convex or neither) of a set of Vectors.
     5 *  As we actually mean this stuff for atoms, we have to encapsulate it all a bit.
    56 *
    67 *  Created on: Aug 3, 2009
     
    2526#include <stack>
    2627
     28#include "BoundaryMaps.hpp"
     29#include "PointCloud.hpp"
     30#include "TesselPoint.hpp"
    2731#include "atom_particleinfo.hpp"
    2832#include "Helpers/helpers.hpp"
    2933#include "LinearAlgebra/Vector.hpp"
     34
    3035
    3136/****************************************** forward declarations *****************************/
     
    3439class BoundaryLineSet;
    3540class BoundaryTriangleSet;
     41class CandidateForTesselation;
    3642class LinkedCell;
    37 class TesselPoint;
    38 class PointCloud;
    3943class Tesselation;
    4044class Plane;
     
    4246/********************************************** definitions *********************************/
    4347
    44 #define DoTecplotOutput 1
    45 #define DoRaster3DOutput 1
    46 #define DoVRMLOutput 0
    47 #define TecplotSuffix ".dat"
    48 #define Raster3DSuffix ".r3d"
    49 #define VRMLSUffix ".wrl"
     48enum { DoTecplotOutput=1 };
     49enum { DoRaster3DOutput=1 };
     50enum { DoVRMLOutput=0 };
    5051
    51 #define ParallelEpsilon 1e-3
     52extern "C" const char *TecplotSuffix;
     53extern "C" const char *Raster3DSuffix;
     54extern "C" const char *VRMLSUffix;
     55
     56extern "C" const double ParallelEpsilon;
    5257
    5358// ======================================================= some template functions =========================================
    5459
    55 #define IndexToIndex map <int, int>
    56 
    57 #define PointMap map < int, class BoundaryPointSet * >
    58 #define PointSet set < class BoundaryPointSet * >
    59 #define PointList list < class BoundaryPointSet * >
    60 #define PointPair pair < int, class BoundaryPointSet * >
    61 #define PointTestPair pair < PointMap::iterator, bool >
    62 
    63 #define CandidateList list <class CandidateForTesselation *>
    64 #define CandidateMap map <class BoundaryLineSet *, class CandidateForTesselation *>
    65 
    66 #define LineMap multimap < int, class BoundaryLineSet * >
    67 #define LineSet set < class BoundaryLineSet * >
    68 #define LineList list < class BoundaryLineSet * >
    69 #define LinePair pair < int, class BoundaryLineSet * >
    70 #define LineTestPair pair < LineMap::iterator, bool >
    71 
    72 #define TriangleMap map < int, class BoundaryTriangleSet * >
    73 #define TriangleSet set < class BoundaryTriangleSet * >
    74 #define TriangleList list < class BoundaryTriangleSet * >
    75 #define TrianglePair pair < int, class BoundaryTriangleSet * >
    76 #define TriangleTestPair pair < TrianglePair::iterator, bool >
    77 
    78 #define PolygonMap map < int, class BoundaryPolygonSet * >
    79 #define PolygonSet set < class BoundaryPolygonSet * >
    80 #define PolygonList list < class BoundaryPolygonSet * >
    81 
    82 #define DistanceToPointMap multimap <double, class BoundaryPointSet * >
    83 #define DistanceToPointPair pair <double, class BoundaryPointSet * >
    84 
    85 #define DistanceMultiMap multimap <double, pair < PointMap::iterator, PointMap::iterator> >
    86 #define DistanceMultiMapPair pair <double, pair < PointMap::iterator, PointMap::iterator> >
    87 
    88 #define TesselPointList list <TesselPoint *>
    89 #define TesselPointSet set <TesselPoint *>
    90 
    91 #define ListOfTesselPointList list<list <TesselPoint *> *>
    92 
    93 enum centers {Opt, OtherOpt};
    94 
    9560/********************************************** declarations *******************************/
    96 
    97 template <typename T> void SetEndpointsOrdered(T endpoints[2], T endpoint1, T endpoint2)
    98 {
    99   if (endpoint1->Nr < endpoint2->Nr) {
    100     endpoints[0] = endpoint1;
    101     endpoints[1] = endpoint2;
    102   } else {
    103     endpoints[0] = endpoint2;
    104     endpoints[1] = endpoint1;
    105   }
    106 };
    107 
    108 // ======================================================== class BoundaryPointSet =========================================
    109 
    110 class BoundaryPointSet {
    111   public:
    112     BoundaryPointSet();
    113     BoundaryPointSet(TesselPoint * const Walker);
    114     ~BoundaryPointSet();
    115 
    116     void AddLine(BoundaryLineSet * const line);
    117 
    118     LineMap lines;
    119     int LinesCount;
    120     TesselPoint *node;
    121     double value;
    122     int Nr;
    123 };
    124 
    125 ostream & operator << (ostream &ost, const BoundaryPointSet &a);
    126 
    127 // ======================================================== class BoundaryLineSet ==========================================
    128 
    129 class BoundaryLineSet {
    130   public:
    131     BoundaryLineSet();
    132     BoundaryLineSet(BoundaryPointSet * const Point[2], const int number);
    133     BoundaryLineSet(BoundaryPointSet * const Point1, BoundaryPointSet * const Point2, const int number);
    134     ~BoundaryLineSet();
    135 
    136     void AddTriangle(BoundaryTriangleSet * const triangle);
    137     bool IsConnectedTo(const BoundaryLineSet * const line) const;
    138     bool ContainsBoundaryPoint(const BoundaryPointSet * const point) const;
    139     bool CheckConvexityCriterion() const;
    140     double CalculateConvexity() const;
    141     class BoundaryPointSet *GetOtherEndpoint(const BoundaryPointSet * const point) const;
    142     class BoundaryTriangleSet *GetOtherTriangle(const BoundaryTriangleSet * const triangle) const;
    143 
    144     class BoundaryPointSet *endpoints[2];
    145     TriangleMap triangles;
    146     int Nr;
    147     bool skipped;
    148 };
    149 
    150 ostream & operator << (ostream &ost, const BoundaryLineSet &a);
    151 
    152 // ======================================================== class BoundaryTriangleSet =======================================
    153 
    154 class BoundaryTriangleSet {
    155   public:
    156     BoundaryTriangleSet();
    157     BoundaryTriangleSet(class BoundaryLineSet * const line[3], const int number);
    158     ~BoundaryTriangleSet();
    159 
    160     void GetNormalVector(const Vector &NormalVector);
    161     void GetCenter(Vector * const center) const;
    162     bool GetIntersectionInsideTriangle(const Vector * const MolCenter, const Vector * const x, Vector * const Intersection) const;
    163     double GetClosestPointInsideTriangle(const Vector * const x, Vector * const ClosestPoint) const;
    164     bool ContainsBoundaryLine(const BoundaryLineSet * const line) const;
    165     bool ContainsBoundaryPoint(const BoundaryPointSet * const point) const;
    166     bool ContainsBoundaryPoint(const TesselPoint * const point) const;
    167     class BoundaryPointSet *GetThirdEndpoint(const BoundaryLineSet * const line) const;
    168     class BoundaryLineSet *GetThirdLine(const BoundaryPointSet * const point) const;
    169     bool IsPresentTupel(const BoundaryPointSet * const Points[3]) const;
    170     bool IsPresentTupel(const BoundaryTriangleSet * const T) const;
    171 
    172     Plane getPlane() const;
    173     Vector getEndpoint(int) const;
    174     std::string getEndpointName(int) const;
    175 
    176     class BoundaryPointSet *endpoints[3];
    177     class BoundaryLineSet *lines[3];
    178     Vector NormalVector;
    179     Vector SphereCenter;
    180     int Nr;
    181 
    182   private:
    183 
    184 };
    185 
    186 ostream & operator << (ostream &ost, const BoundaryTriangleSet &a);
    187 
    188 
    189 // ======================================================== class BoundaryTriangleSet =======================================
    190 
    191 /** Set of BoundaryPointSet.
    192  * This is just meant as a container for a group of endpoints, extending the node, line, triangle concept. However, this has
    193  * only marginally something to do with the tesselation. Hence, there is no incorporation into the bookkeeping of the Tesselation
    194  * class (i.e. no allocation, no deletion).
    195  * \note we assume that the set of endpoints reside (more or less) on a plane.
    196  */
    197 class BoundaryPolygonSet {
    198   public:
    199     BoundaryPolygonSet();
    200     ~BoundaryPolygonSet();
    201 
    202     Vector * GetNormalVector(const Vector &NormalVector) const;
    203     void GetCenter(Vector *center) const;
    204     bool ContainsBoundaryLine(const BoundaryLineSet * const line) const;
    205     bool ContainsBoundaryPoint(const BoundaryPointSet * const point) const;
    206     bool ContainsBoundaryPoint(const TesselPoint * const point) const;
    207     bool ContainsBoundaryTriangle(const BoundaryTriangleSet * const point) const;
    208     bool ContainsPresentTupel(const BoundaryPointSet * const * Points, const int dim) const;
    209     bool ContainsPresentTupel(const BoundaryPolygonSet * const P) const;
    210     bool ContainsPresentTupel(const PointSet &endpoints) const;
    211     TriangleSet * GetAllContainedTrianglesFromEndpoints() const;
    212     bool FillPolygonFromTrianglesOfLine(const BoundaryLineSet * const line);
    213 
    214     PointSet endpoints;
    215     int Nr;
    216 };
    217 
    218 ostream & operator << (ostream &ost, const BoundaryPolygonSet &a);
    219 
    220 // =========================================================== class TESSELPOINT ===========================================
    221 
    222 /** Is a single point of the set of Vectors, also a super-class to be inherited and and its functions to be implemented.
    223  */
    224 class TesselPoint : virtual public ParticleInfo {
    225 public:
    226   TesselPoint();
    227   virtual ~TesselPoint();
    228 
    229   Vector *node;   // pointer to position of the dot in space
    230 
    231   virtual ostream & operator << (ostream &ost);
    232 };
    233 
    234 ostream & operator << (ostream &ost, const TesselPoint &a);
    235 
    236 // =========================================================== class POINTCLOUD ============================================
    237 
    238 /** Super-class for all point clouds structures, also molecules. They have to inherit this structure and implement the virtual function to access the Vectors.
    239  * This basically encapsulates a list structure.
    240  */
    241 class PointCloud {
    242 public:
    243   PointCloud();
    244   virtual ~PointCloud();
    245 
    246   virtual const char * const GetName() const { return "unknown"; };
    247   virtual Vector *GetCenter() const { return NULL; };
    248   virtual TesselPoint *GetPoint() const { return NULL; };
    249   virtual int GetMaxId() const { return 0; };
    250   virtual void GoToNext() const {};
    251   virtual void GoToFirst() const {};
    252   virtual bool IsEmpty() const { return true; };
    253   virtual bool IsEnd() const { return true; };
    254 };
    255 
    256 // ======================================================== class CandidateForTesselation =========================================
    257 
    258 class CandidateForTesselation {
    259   public :
    260   CandidateForTesselation(BoundaryLineSet* currentBaseLine);
    261   CandidateForTesselation(TesselPoint* candidate, BoundaryLineSet* currentBaseLine, BoundaryPointSet *point, Vector OptCandidateCenter, Vector OtherOptCandidateCenter);
    262   ~CandidateForTesselation();
    263 
    264   bool CheckValidity(const double RADIUS, const LinkedCell *LC) const;
    265 
    266   TesselPointList pointlist;
    267   const BoundaryLineSet * BaseLine;
    268   const BoundaryPointSet * ThirdPoint;
    269   const BoundaryTriangleSet *T;
    270   Vector OldCenter;
    271   Vector OptCenter;
    272   Vector OtherOptCenter;
    273   double ShortestAngle;
    274   double OtherShortestAngle;
    275 };
    276 
    277 ostream & operator <<(ostream &ost, const  CandidateForTesselation &a);
    27861
    27962// =========================================================== class TESSELATION ===========================================
     
    28972    void AddTesselationPoint(TesselPoint* Candidate, const int n);
    29073    void SetTesselationPoint(TesselPoint* Candidate, const int n) const;
    291     void AddTesselationLine(const Vector * const OptCenter, const BoundaryPointSet * const candidate, class BoundaryPointSet *a, class BoundaryPointSet *b, const int n);
     74    void AddTesselationLine(const Vector * OptCenter, const BoundaryPointSet * const candidate, class BoundaryPointSet *a, class BoundaryPointSet *b, const int n);
    29275    void AddNewTesselationTriangleLine(class BoundaryPointSet *a, class BoundaryPointSet *b, const int n);
    29376    void AddExistingTesselationTriangleLine(class BoundaryLineSet *FindLine, int n);
     
    330113    ListOfTesselPointList * GetPathsOfConnectedPoints(const TesselPoint* const Point) const;
    331114    ListOfTesselPointList * GetClosedPathsOfConnectedPoints(const TesselPoint* const Point) const;
    332     TesselPointList * GetCircleOfSetOfPoints(TesselPointSet *SetOfNeighbours, const TesselPoint* const Point, const Vector * const Reference = NULL) const;
    333     TesselPointList * GetCircleOfConnectedTriangles(TesselPointSet *SetOfNeighbours, const TesselPoint* const Point, const Vector * const Reference) const;
     115    TesselPointList * GetCircleOfSetOfPoints(TesselPointSet *SetOfNeighbours, const TesselPoint* const Point, const Vector &Reference) const;
     116    TesselPointList * GetCircleOfConnectedTriangles(TesselPointSet *SetOfNeighbours, const TesselPoint* const Point, const Vector &Reference) const;
    334117    class BoundaryPointSet * GetCommonEndpoint(const BoundaryLineSet * line1, const BoundaryLineSet * line2) const;
    335118    TriangleList * FindTriangles(const TesselPoint* const Points[3]) const;
    336     TriangleList * FindClosestTrianglesToVector(const Vector *x, const LinkedCell* LC) const;
    337     BoundaryTriangleSet * FindClosestTriangleToVector(const Vector *x, const LinkedCell* LC) const;
     119    TriangleList * FindClosestTrianglesToVector(const Vector &x, const LinkedCell* LC) const;
     120    BoundaryTriangleSet * FindClosestTriangleToVector(const Vector &x, const LinkedCell* LC) const;
    338121    bool IsInnerPoint(const Vector &Point, const LinkedCell* const LC) const;
    339122    double GetDistanceSquaredToTriangle(const Vector &Point, const BoundaryTriangleSet* const triangle) const;
     
    341124    BoundaryTriangleSet * GetClosestTriangleOnSurface(const Vector &Point, const LinkedCell* const LC) const;
    342125    bool AddBoundaryPoint(TesselPoint * Walker, const int n);
    343     DistanceToPointMap * FindClosestBoundaryPointsToVector(const Vector *x, const LinkedCell* LC) const;
    344     BoundaryLineSet * FindClosestBoundaryLineToVector(const Vector *x, const LinkedCell* LC) const;
     126    DistanceToPointMap * FindClosestBoundaryPointsToVector(const Vector &x, const LinkedCell* LC) const;
     127    BoundaryLineSet * FindClosestBoundaryLineToVector(const Vector &x, const LinkedCell* LC) const;
    345128
    346129    // print for debugging
     
    375158
    376159  private:
     160    static const double HULLEPSILON; //!< TODO: Get rid of HULLEPSILON, points to numerical instabilities
     161
    377162    mutable class BoundaryPointSet *TPS[3]; //this is a Storage for pointers to triangle points, this and BPS[2] needed due to AddLine restrictions
    378163
  • src/tesselationhelpers.cpp

    re588312 rb5c53d  
    1010#include <fstream>
    1111
     12#include "BoundaryLineSet.hpp"
     13#include "BoundaryPointSet.hpp"
     14#include "BoundaryPolygonSet.hpp"
     15#include "BoundaryTriangleSet.hpp"
     16#include "CandidateForTesselation.hpp"
    1217#include "Helpers/Info.hpp"
    1318#include "linkedcell.hpp"
     
    1823#include "LinearAlgebra/Vector.hpp"
    1924#include "LinearAlgebra/Line.hpp"
    20 #include "vector_ops.hpp"
     25#include "LinearAlgebra/vector_ops.hpp"
    2126#include "Helpers/Verbose.hpp"
    2227#include "LinearAlgebra/Plane.hpp"
     
    144149 * \param *c third point
    145150 */
    146 void GetCenterofCircumcircle(Vector * const Center, const Vector &a, const Vector &b, const Vector &c)
     151void GetCenterofCircumcircle(Vector &Center, const Vector &a, const Vector &b, const Vector &c)
    147152{
    148153        Info FunctionInfo(__func__);
     
    156161  helper[2] = SideC.NormSquared()*(SideA.NormSquared()+SideB.NormSquared() - SideC.NormSquared());
    157162
    158   Center->Zero();
    159   *Center += helper[0] * a;
    160   *Center += helper[1] * b;
    161   *Center += helper[2] * c;
    162   Center->Scale(1./(helper[0]+helper[1]+helper[2]));
    163   Log() << Verbose(1) << "INFO: Center (2nd algo) is at " << *Center << "." << endl;
     163  Center.Zero();
     164  Center += helper[0] * a;
     165  Center += helper[1] * b;
     166  Center += helper[2] * c;
     167  Center.Scale(1./(helper[0]+helper[1]+helper[2]));
     168  Log() << Verbose(1) << "INFO: Center (2nd algo) is at " << Center << "." << endl;
    164169};
    165170
     
    175180 * \param NormalVector normal vector
    176181 * \param SearchDirection search direction to make angle unique on return.
     182 * \param HULLEPSILON machine precision for tesselation points
    177183 * \return Angle between \a NewSphereCenter and \a OldSphereCenter relative to \a CircleCenter, 2.*M_PI if one test fails
    178184 */
    179 double GetPathLengthonCircumCircle(const Vector &CircleCenter, const Vector &CirclePlaneNormal, const double CircleRadius, const Vector &NewSphereCenter, const Vector &OldSphereCenter, const Vector &NormalVector, const Vector &SearchDirection)
     185double GetPathLengthonCircumCircle(const Vector &CircleCenter, const Vector &CirclePlaneNormal, const double CircleRadius, const Vector &NewSphereCenter, const Vector &OldSphereCenter, const Vector &NormalVector, const Vector &SearchDirection, const double HULLEPSILON)
    180186{
    181187        Info FunctionInfo(__func__);
     
    388394 * @return point which is second closest to the provided one
    389395 */
    390 TesselPoint* FindSecondClosestTesselPoint(const Vector* Point, const LinkedCell* const LC)
     396TesselPoint* FindSecondClosestTesselPoint(const Vector& Point, const LinkedCell* const LC)
    391397{
    392398        Info FunctionInfo(__func__);
     
    412418        if (List != NULL) {
    413419          for (LinkedCell::LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) {
    414             helper = (*Point) - (*(*Runner)->node);
     420            helper = (Point) - ((*Runner)->getPosition());
    415421            double currentNorm = helper. Norm();
    416422            if (currentNorm < distance) {
     
    441447 * @return point which is closest to the provided one, NULL if none found
    442448 */
    443 TesselPoint* FindClosestTesselPoint(const Vector* Point, TesselPoint *&SecondPoint, const LinkedCell* const LC)
     449TesselPoint* FindClosestTesselPoint(const Vector& Point, TesselPoint *&SecondPoint, const LinkedCell* const LC)
    444450{
    445451        Info FunctionInfo(__func__);
     
    465471        if (List != NULL) {
    466472          for (LinkedCell::LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) {
    467             helper = (*Point) - (*(*Runner)->node);
     473            helper = (Point) - ((*Runner)->getPosition());
    468474            double currentNorm = helper.NormSquared();
    469475            if (currentNorm < distance) {
     
    503509        Info FunctionInfo(__func__);
    504510  // construct the plane of the two baselines (i.e. take both their directional vectors)
    505   Vector Baseline = (*Base->endpoints[1]->node->node) - (*Base->endpoints[0]->node->node);
    506   Vector OtherBaseline = (*OtherBase->endpoints[1]->node->node) - (*OtherBase->endpoints[0]->node->node);
     511  Vector Baseline = (Base->endpoints[1]->node->getPosition()) - (Base->endpoints[0]->node->getPosition());
     512  Vector OtherBaseline = (OtherBase->endpoints[1]->node->getPosition()) - (OtherBase->endpoints[0]->node->getPosition());
    507513  Vector Normal = Baseline;
    508514  Normal.VectorProduct(OtherBaseline);
     
    511517
    512518  // project one offset point of OtherBase onto this plane (and add plane offset vector)
    513   Vector NewOffset = (*OtherBase->endpoints[0]->node->node) - (*Base->endpoints[0]->node->node);
     519  Vector NewOffset = (OtherBase->endpoints[0]->node->getPosition()) - (Base->endpoints[0]->node->getPosition());
    514520  NewOffset.ProjectOntoPlane(Normal);
    515   NewOffset += (*Base->endpoints[0]->node->node);
     521  NewOffset += (Base->endpoints[0]->node->getPosition());
    516522  Vector NewDirection = NewOffset + OtherBaseline;
    517523
    518524  // calculate the intersection between this projected baseline and Base
    519525  Vector *Intersection = new Vector;
    520   Line line1 = makeLineThrough(*(Base->endpoints[0]->node->node),*(Base->endpoints[1]->node->node));
     526  Line line1 = makeLineThrough((Base->endpoints[0]->node->getPosition()),(Base->endpoints[1]->node->getPosition()));
    521527  Line line2 = makeLineThrough(NewOffset, NewDirection);
    522528  *Intersection = line1.getIntersection(line2);
    523   Normal = (*Intersection) - (*Base->endpoints[0]->node->node);
     529  Normal = (*Intersection) - (Base->endpoints[0]->node->getPosition());
    524530  DoLog(1) && (Log() << Verbose(1) << "Found closest point on " << *Base << " at " << *Intersection << ", factor in line is " << fabs(Normal.ScalarProduct(Baseline)/Baseline.NormSquared()) << "." << endl);
    525531
     
    566572      *vrmlfile << "Sphere {" << endl << "  "; // 2 is sphere type
    567573      for (i=0;i<NDIM;i++)
    568         *vrmlfile << Walker->node->at(i)-center->at(i) << " ";
     574        *vrmlfile << Walker->at(i)-center->at(i) << " ";
    569575      *vrmlfile << "\t0.1\t1. 1. 1." << endl; // radius 0.05 and white as colour
    570576      cloud->GoToNext();
     
    576582      for (i=0;i<3;i++) { // print each node
    577583        for (int j=0;j<NDIM;j++)  // and for each node all NDIM coordinates
    578           *vrmlfile << TriangleRunner->second->endpoints[i]->node->node->at(j)-center->at(j) << " ";
     584          *vrmlfile << TriangleRunner->second->endpoints[i]->node->at(j)-center->at(j) << " ";
    579585        *vrmlfile << "\t";
    580586      }
     
    603609    Vector *center = cloud->GetCenter();
    604610    // make the circumsphere's center absolute again
    605     Vector helper = (1./3.) * ((*Tess->LastTriangle->endpoints[0]->node->node) +
    606                                (*Tess->LastTriangle->endpoints[1]->node->node) +
    607                                (*Tess->LastTriangle->endpoints[2]->node->node));
     611    Vector helper = (1./3.) * ((Tess->LastTriangle->endpoints[0]->node->getPosition()) +
     612                               (Tess->LastTriangle->endpoints[1]->node->getPosition()) +
     613                               (Tess->LastTriangle->endpoints[2]->node->getPosition()));
    608614    helper -= (*center);
    609615    // and add to file plus translucency object
     
    638644      *rasterfile << "2" << endl << "  ";  // 2 is sphere type
    639645      for (int j=0;j<NDIM;j++) { // and for each node all NDIM coordinates
    640         const double tmp = Walker->node->at(j)-center->at(j);
     646        const double tmp = Walker->at(j)-center->at(j);
    641647        *rasterfile << ((fabs(tmp) < MYEPSILON) ? 0 : tmp) << " ";
    642648      }
     
    651657      for (i=0;i<3;i++) {  // print each node
    652658        for (int j=0;j<NDIM;j++) { // and for each node all NDIM coordinates
    653           const double tmp = TriangleRunner->second->endpoints[i]->node->node->at(j)-center->at(j);
     659          const double tmp = TriangleRunner->second->endpoints[i]->node->at(j)-center->at(j);
    654660          *rasterfile << ((fabs(tmp) < MYEPSILON) ? 0 : tmp) << " ";
    655661        }
     
    705711      LookupList[Walker->nr] = Counter++;
    706712      for (int i=0;i<NDIM;i++) {
    707         const double tmp = Walker->node->at(i);
     713        const double tmp = Walker->at(i);
    708714        *tecplot << ((fabs(tmp) < MYEPSILON) ? 0 : tmp) << " ";
    709715      }
     
    754760    TriangleSet *triangles = TesselStruct->GetAllTriangles(PointRunner->second);
    755761    for (TriangleSet::iterator TriangleRunner = triangles->begin(); TriangleRunner != triangles->end(); ++TriangleRunner) {
    756       totalarea += CalculateAreaofGeneralTriangle(*(*TriangleRunner)->endpoints[0]->node->node, *(*TriangleRunner)->endpoints[1]->node->node, *(*TriangleRunner)->endpoints[2]->node->node);
     762      totalarea += CalculateAreaofGeneralTriangle((*TriangleRunner)->endpoints[0]->node->getPosition() , (*TriangleRunner)->endpoints[1]->node->getPosition() , (*TriangleRunner)->endpoints[2]->node->getPosition());
    757763    }
    758764    ConcavityPerLine *= totalarea;
     
    763769      line = (*TriangleRunner)->GetThirdLine(PointRunner->second);
    764770      triangle = line->GetOtherTriangle(*TriangleRunner);
    765       area = CalculateAreaofGeneralTriangle(*triangle->endpoints[0]->node->node, *triangle->endpoints[1]->node->node, *triangle->endpoints[2]->node->node);
    766       area += CalculateAreaofGeneralTriangle(*(*TriangleRunner)->endpoints[0]->node->node, *(*TriangleRunner)->endpoints[1]->node->node, *(*TriangleRunner)->endpoints[2]->node->node);
     771      area = CalculateAreaofGeneralTriangle(triangle->endpoints[0]->node->getPosition() , triangle->endpoints[1]->node->getPosition() , triangle->endpoints[2]->node->getPosition());
     772      area += CalculateAreaofGeneralTriangle((*TriangleRunner)->endpoints[0]->node->getPosition() , (*TriangleRunner)->endpoints[1]->node->getPosition() , (*TriangleRunner)->endpoints[2]->node->getPosition());
    767773      area *= -line->CalculateConvexity();
    768774      if (area > 0)
     
    797803    distance = 0.;
    798804    for (TriangleMap::const_iterator TriangleRunner = Convex->TrianglesOnBoundary.begin(); TriangleRunner != Convex->TrianglesOnBoundary.end(); TriangleRunner++) {
    799       const double CurrentDistance = Convex->GetDistanceSquaredToTriangle(*PointRunner->second->node->node, TriangleRunner->second);
     805      const double CurrentDistance = Convex->GetDistanceSquaredToTriangle(PointRunner->second->node->getPosition() , TriangleRunner->second);
    800806      if (CurrentDistance < distance)
    801807        distance = CurrentDistance;
  • src/tesselationhelpers.hpp

    re588312 rb5c53d  
    2222#include <iosfwd>
    2323
     24#include "BoundaryMaps.hpp"
    2425#include "defs.hpp"
    2526
     
    2930class BoundaryLineSet;
    3031class BoundaryTriangleSet;
     32class BoundaryPolygonSet;
     33class CandidateForTesselation;
    3134class LinkedCell;
    3235class TesselPoint;
     
    3740/********************************************** definitions *********************************/
    3841
    39 #define HULLEPSILON 1e-9 //!< TODO: Get rid of HULLEPSILON, points to numerical instabilities
    40 
    4142/********************************************** declarations *******************************/
    4243
    43 void GetSphere(Vector * const Center, const Vector &a, const Vector &b, const Vector &c, const double RADIUS);
    44 void GetCenterOfSphere(Vector* const Center, const Vector &a, const Vector &b, const Vector &c, Vector * const NewUmkreismittelpunkt, const Vector* const Direction, const Vector* const AlternativeDirection, const double HalfplaneIndicator, const double AlternativeIndicator, const double alpha, const double beta, const double gamma, const double RADIUS, const double Umkreisradius);
    45 void GetCenterofCircumcircle(Vector * const Center, const Vector &a, const Vector &b, const Vector &c);
    46 double GetPathLengthonCircumCircle(const Vector &CircleCenter, const Vector &CirclePlaneNormal, const double CircleRadius, const Vector &NewSphereCenter, const Vector &OldSphereCenter, const Vector &NormalVector, const Vector &SearchDirection);
     44void GetSphere(Vector & Center, const Vector &a, const Vector &b, const Vector &c, const double RADIUS);
     45void GetCenterOfSphere(Vector& Center, const Vector &a, const Vector &b, const Vector &c, Vector &NewUmkreismittelpunkt, const Vector &Direction, const Vector* const AlternativeDirection, const double HalfplaneIndicator, const double AlternativeIndicator, const double alpha, const double beta, const double gamma, const double RADIUS, const double Umkreisradius);
     46void GetCenterofCircumcircle(Vector & Center, const Vector &a, const Vector &b, const Vector &c);
     47double GetPathLengthonCircumCircle(const Vector &CircleCenter, const Vector &CirclePlaneNormal, const double CircleRadius, const Vector &NewSphereCenter, const Vector &OldSphereCenter, const Vector &NormalVector, const Vector &SearchDirection, const double HULLEPSILON);
    4748double CalculateVolumeofGeneralTetraeder(const Vector &a, const Vector &b, const Vector &c, const Vector &d);
    4849double CalculateAreaofGeneralTriangle(const Vector &A, const Vector &B, const Vector &C);
     
    5152bool CheckLineCriteriaForDegeneratedTriangle(const BoundaryPointSet * const nodes[3]);
    5253bool SortCandidates(const CandidateForTesselation* candidate1, const CandidateForTesselation *candidate2);
    53 TesselPoint* FindClosestTesselPoint(const Vector* Point, TesselPoint *&SecondPoint, const LinkedCell* const LC);
    54 TesselPoint* FindSecondClosestTesselPoint(const Vector*, const LinkedCell* const LC);
     54TesselPoint* FindClosestTesselPoint(const Vector & Point, TesselPoint *&SecondPoint, const LinkedCell* const LC);
     55TesselPoint* FindSecondClosestTesselPoint(const Vector &, const LinkedCell* const LC);
    5556Vector * GetClosestPointBetweenLine(const BoundaryLineSet * const Base, const BoundaryLineSet * const OtherBase);
    5657
     
    6162void CalculateConcavityPerBoundaryPoint(const Tesselation * const TesselStruct);
    6263void CalculateConstrictionPerBoundaryPoint(const Tesselation * const TesselStruct, const Tesselation * const Convex);
    63 double DistanceToTrianglePlane(const Vector *x, const BoundaryTriangleSet * const triangle);
     64double DistanceToTrianglePlane(const Vector &x, const BoundaryTriangleSet * const triangle);
    6465
    6566bool CheckListOfBaselines(const Tesselation * const TesselStruct);
  • src/triangleintersectionlist.cpp

    re588312 rb5c53d  
    1616
    1717#include "Helpers/Info.hpp"
     18#include "BoundaryMaps.hpp"
     19#include "BoundaryPointSet.hpp"
     20#include "BoundaryLineSet.hpp"
     21#include "BoundaryTriangleSet.hpp"
    1822#include "tesselation.hpp"
    1923#include "LinearAlgebra/Vector.hpp"
     
    2327 *
    2428 */
    25 TriangleIntersectionList::TriangleIntersectionList(const Vector *x, const Tesselation *surface, const LinkedCell* LC) :
     29TriangleIntersectionList::TriangleIntersectionList(const Vector &x, const Tesselation *surface, const LinkedCell* LC) :
    2630  Point(x),
    2731  Tess(surface),
     
    7074  }
    7175  // return reference, if none can be found
    72   return *Point;
     76  return Point;
    7377};
    7478
     
    99103  if (runner != IntersectionList.end()) {
    100104    // if we have found one, check Scalarproduct between the vector
    101     Vector TestVector = (*Point) - (*(*runner).second);
     105    Vector TestVector = (Point) - (*(*runner).second);
    102106    if (fabs(TestVector.NormSquared()) < MYEPSILON) //
    103107      return true;
     
    138142    // get intersection with triangle plane
    139143    Intersection = new Vector;
    140     (*TriangleRunner)->GetClosestPointInsideTriangle(Point, Intersection);
    141     //Log() << Verbose(1) << "Intersection between " << *Point << " and " << **TriangleRunner << " is at " << *Intersection << "." << endl;
     144    (*TriangleRunner)->GetClosestPointInsideTriangle(Point, *Intersection);
     145    //Log() << Verbose(1) << "Intersection between " << Point << " and " << **TriangleRunner << " is at " << *Intersection << "." << endl;
    142146    IntersectionList.insert( pair<BoundaryTriangleSet *, Vector * > (*TriangleRunner, Intersection) );
    143147  }
     
    151155  if (DistanceList.empty())
    152156    for (TriangleVectorMap::const_iterator runner = IntersectionList.begin(); runner != IntersectionList.end(); runner++)
    153       DistanceList.insert( pair<double, BoundaryTriangleSet *> (Point->distance(*(*runner).second), (*runner).first) );
     157      DistanceList.insert( pair<double, BoundaryTriangleSet *> (Point.distance(*(*runner).second), (*runner).first) );
    154158
    155159  //for (DistanceTriangleMap::const_iterator runner = DistanceList.begin(); runner != DistanceList.end(); runner++)
  • src/triangleintersectionlist.hpp

    re588312 rb5c53d  
    3939{
    4040public:
    41   TriangleIntersectionList(const Vector *x, const Tesselation *surface, const LinkedCell* LC);
     41  TriangleIntersectionList(const Vector &x, const Tesselation *surface, const LinkedCell* LC);
    4242  ~TriangleIntersectionList();
    4343
     
    5252  void FillDistanceList() const;
    5353
    54   const Vector *Point;
     54  const Vector &Point;
    5555  const Tesselation *Tess;
    5656  const LinkedCell *Vicinity;
  • src/unittests/AnalysisCorrelationToPointUnitTest.cpp

    re588312 rb5c53d  
    5353  TestMolecule = World::getInstance().createMolecule();
    5454  Walker = World::getInstance().createAtom();
    55   Walker->type = hydrogen;
    56   *Walker->node = Vector(1., 0., 1. );
     55  Walker->setType(hydrogen);
     56  Walker->setPosition(Vector(1., 0., 1. ));
    5757  TestMolecule->AddAtom(Walker);
    5858  Walker = World::getInstance().createAtom();
    59   Walker->type = hydrogen;
    60   *Walker->node = Vector(0., 1., 1. );
     59  Walker->setType(hydrogen);
     60  Walker->setPosition(Vector(0., 1., 1. ));
    6161  TestMolecule->AddAtom(Walker);
    6262  Walker = World::getInstance().createAtom();
    63   Walker->type = hydrogen;
    64   *Walker->node = Vector(1., 1., 0. );
     63  Walker->setType(hydrogen);
     64  Walker->setPosition(Vector(1., 1., 0. ));
    6565  TestMolecule->AddAtom(Walker);
    6666  Walker = World::getInstance().createAtom();
    67   Walker->type = hydrogen;
    68   *Walker->node = Vector(0., 0., 0. );
     67  Walker->setType(hydrogen);
     68  Walker->setPosition(Vector(0., 0., 0. ));
    6969  TestMolecule->AddAtom(Walker);
    7070
  • src/unittests/AnalysisCorrelationToSurfaceUnitTest.cpp

    re588312 rb5c53d  
    4444  ASSERT_DO(Assert::Throw);
    4545
     46  setVerbosity(5);
     47
    4648  atom *Walker = NULL;
    4749
     
    6264
    6365  Walker = World::getInstance().createAtom();
    64   Walker->type = hydrogen;
    65   *Walker->node = Vector(1., 0., 1. );
    66   TestSurfaceMolecule->AddAtom(Walker);
    67 
    68   Walker = World::getInstance().createAtom();
    69   Walker->type = hydrogen;
    70   *Walker->node = Vector(0., 1., 1. );
    71   TestSurfaceMolecule->AddAtom(Walker);
    72 
    73   Walker = World::getInstance().createAtom();
    74   Walker->type = hydrogen;
    75   *Walker->node = Vector(1., 1., 0. );
    76   TestSurfaceMolecule->AddAtom(Walker);
    77 
    78   Walker = World::getInstance().createAtom();
    79   Walker->type = hydrogen;
    80   *Walker->node = Vector(0., 0., 0. );
     66  Walker->setType(hydrogen);
     67  Walker->setPosition(Vector(1., 0., 1. ));
     68  TestSurfaceMolecule->AddAtom(Walker);
     69
     70  Walker = World::getInstance().createAtom();
     71  Walker->setType(hydrogen);
     72  Walker->setPosition(Vector(0., 1., 1. ));
     73  TestSurfaceMolecule->AddAtom(Walker);
     74
     75  Walker = World::getInstance().createAtom();
     76  Walker->setType(hydrogen);
     77  Walker->setPosition(Vector(1., 1., 0. ));
     78  TestSurfaceMolecule->AddAtom(Walker);
     79
     80  Walker = World::getInstance().createAtom();
     81  Walker->setType(hydrogen);
     82  Walker->setPosition(Vector(0., 0., 0. ));
    8183  TestSurfaceMolecule->AddAtom(Walker);
    8284
     
    9597  TestSurfaceMolecule = World::getInstance().createMolecule();
    9698  Walker = World::getInstance().createAtom();
    97   Walker->type = carbon;
    98   *Walker->node = Vector(4., 0., 4. );
    99   TestSurfaceMolecule->AddAtom(Walker);
    100 
    101   Walker = World::getInstance().createAtom();
    102   Walker->type = carbon;
    103   *Walker->node = Vector(0., 4., 4. );
    104   TestSurfaceMolecule->AddAtom(Walker);
    105 
    106   Walker = World::getInstance().createAtom();
    107   Walker->type = carbon;
    108   *Walker->node = Vector(4., 4., 0. );
     99  Walker->setType(carbon);
     100  Walker->setPosition(Vector(4., 0., 4. ));
     101  TestSurfaceMolecule->AddAtom(Walker);
     102
     103  Walker = World::getInstance().createAtom();
     104  Walker->setType(carbon);
     105  Walker->setPosition(Vector(0., 4., 4. ));
     106  TestSurfaceMolecule->AddAtom(Walker);
     107
     108  Walker = World::getInstance().createAtom();
     109  Walker->setType(carbon);
     110  Walker->setPosition(Vector(4., 4., 0. ));
    109111  TestSurfaceMolecule->AddAtom(Walker);
    110112
    111113  // add inner atoms
    112114  Walker = World::getInstance().createAtom();
    113   Walker->type = carbon;
    114   *Walker->node = Vector(0.5, 0.5, 0.5 );
     115  Walker->setType(carbon);
     116  Walker->setPosition(Vector(0.5, 0.5, 0.5 ));
    115117  TestSurfaceMolecule->AddAtom(Walker);
    116118
  • src/unittests/AnalysisPairCorrelationUnitTest.cpp

    re588312 rb5c53d  
    5858  TestMolecule = World::getInstance().createMolecule();
    5959  Walker = World::getInstance().createAtom();
    60   Walker->type = hydrogen;
    61   *Walker->node = Vector(1., 0., 1. );
     60  Walker->setType(hydrogen);
     61  Walker->setPosition(Vector(1., 0., 1. ));
    6262  TestMolecule->AddAtom(Walker);
    6363  Walker = World::getInstance().createAtom();
    64   Walker->type = hydrogen;
    65   *Walker->node = Vector(0., 1., 1. );
     64  Walker->setType(hydrogen);
     65  Walker->setPosition(Vector(0., 1., 1. ));
    6666  TestMolecule->AddAtom(Walker);
    6767  Walker = World::getInstance().createAtom();
    68   Walker->type = hydrogen;
    69   *Walker->node = Vector(1., 1., 0. );
     68  Walker->setType(hydrogen);
     69  Walker->setPosition(Vector(1., 1., 0. ));
    7070  TestMolecule->AddAtom(Walker);
    7171  Walker = World::getInstance().createAtom();
    72   Walker->type = hydrogen;
    73   *Walker->node = Vector(0., 0., 0. );
     72  Walker->setType(hydrogen);
     73  Walker->setPosition(Vector(0., 0., 0. ));
    7474  TestMolecule->AddAtom(Walker);
    7575
  • src/unittests/AtomDescriptorTest.hpp

    re588312 rb5c53d  
    1313#include "types.hpp"
    1414
    15 #define ATOM_COUNT (10)
     15// we prefer enum over define
     16enum { ATOM_COUNT = 10 };
    1617
    1718class atom;
  • src/unittests/CountBondsUnitTest.cpp

    re588312 rb5c53d  
    5454  Walker = World::getInstance().createAtom();
    5555  CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
    56   Walker->type = hydrogen;
    57   *Walker->node = Vector(-0.2418, 0.9350, 0. );
     56  Walker->setType(hydrogen);
     57  Walker->setPosition(Vector(-0.2418, 0.9350, 0. ));
    5858  TestMolecule1->AddAtom(Walker);
    5959  Walker = World::getInstance().createAtom();
    6060  CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
    61   Walker->type = hydrogen;
    62   *Walker->node = Vector(0.9658, 0., 0. );
     61  Walker->setType(hydrogen);
     62  Walker->setPosition(Vector(0.9658, 0., 0. ));
    6363  TestMolecule1->AddAtom(Walker);
    6464  Walker = World::getInstance().createAtom();
    6565  CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
    66   Walker->type = oxygen;
    67   *Walker->node = Vector(0., 0., 0. );
     66  Walker->setType(oxygen);
     67  Walker->setPosition(Vector(0., 0., 0. ));
    6868  TestMolecule1->AddAtom(Walker);
    6969
     
    7272  Walker = World::getInstance().createAtom();
    7373  CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
    74   Walker->type = hydrogen;
    75   *Walker->node = Vector(-0.2418, 0.9350, 0. );
     74  Walker->setType(hydrogen);
     75  Walker->setPosition(Vector(-0.2418, 0.9350, 0. ));
    7676  TestMolecule2->AddAtom(Walker);
    7777  Walker = World::getInstance().createAtom();
    7878  CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
    79   Walker->type = hydrogen;
    80   *Walker->node = Vector(0.9658, 0., 0. );
     79  Walker->setType(hydrogen);
     80  Walker->setPosition(Vector(0.9658, 0., 0. ));
    8181  TestMolecule2->AddAtom(Walker);
    8282  Walker = World::getInstance().createAtom();
    8383  CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
    84   Walker->type = oxygen;
    85   *Walker->node = Vector(0., 0., 0. );
     84  Walker->setType(oxygen);
     85  Walker->setPosition(Vector(0., 0., 0. ));
    8686  TestMolecule2->AddAtom(Walker);
    8787
  • src/unittests/LinkedCellUnitTest.cpp

    re588312 rb5c53d  
    5050        Walker = World::getInstance().createAtom();
    5151        CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
    52         Walker->type = hydrogen;
    53         *Walker->node = Vector(x, y, z );
     52        Walker->setType(hydrogen);
     53        Walker->setPosition(Vector(x, y, z ));
    5454        TestMolecule->AddAtom(Walker);
    5555      }
     
    192192  atom *newAtom = World::getInstance().createAtom();
    193193  newAtom->setName("test");
    194   newAtom->x= Vector(1,1,1);
     194  newAtom->setPosition(Vector(1,1,1));
    195195  CPPUNIT_ASSERT_EQUAL( false, LC->SetIndexToNode(newAtom) );
    196196  World::getInstance().destroyAtom(newAtom);
     
    199199  newAtom = World::getInstance().createAtom();
    200200  newAtom->setName("test");
    201   newAtom->x = Vector(0,-1,0);
     201  newAtom->setPosition(Vector(0,-1,0));
    202202  CPPUNIT_ASSERT_EQUAL( false, LC->SetIndexToNode(newAtom) );
    203203  World::getInstance().destroyAtom(newAtom);
     
    216216      for (double z=0.5;z<3;z+=1.) {
    217217        tester = Vector(x,y,z);
    218         CPPUNIT_ASSERT_EQUAL( true, LC->SetIndexToVector(&tester) );
     218        CPPUNIT_ASSERT_EQUAL( true, LC->SetIndexToVector(tester) );
    219219      }
    220220  // check corners of each cell
     
    224224        tester= Vector(x,y,z);
    225225        cout << "Tester is at " << tester << "." << endl;
    226         CPPUNIT_ASSERT_EQUAL( true, LC->SetIndexToVector(&tester) );
     226        CPPUNIT_ASSERT_EQUAL( true, LC->SetIndexToVector(tester) );
    227227      }
    228228  // check out of bounds
     
    232232        tester = Vector(x,y,z);
    233233        cout << "The following test is supposed to fail and produce an ERROR." << endl;
    234         CPPUNIT_ASSERT_EQUAL( false, LC->SetIndexToVector(&tester) );
     234        CPPUNIT_ASSERT_EQUAL( false, LC->SetIndexToVector(tester) );
    235235      }
    236236  // check nonsense vectors
    237237  tester= Vector(-423598,3245978,29349);
    238238  cout << "The following test is supposed to fail and produce an ERROR." << endl;
    239   CPPUNIT_ASSERT_EQUAL( false, LC->SetIndexToVector(&tester) );
     239  CPPUNIT_ASSERT_EQUAL( false, LC->SetIndexToVector(tester) );
    240240};
    241241
     
    249249
    250250  tester= Vector(0.5,0.5,0.5);
    251   LC->SetIndexToVector(&tester);
     251  LC->SetIndexToVector(tester);
    252252  LC->GetNeighbourBounds(lower, upper);
    253253  for (int i=0;i<NDIM;i++)
     
    268268  // get all atoms
    269269  tester= Vector(1.5,1.5,1.5);
    270   CPPUNIT_ASSERT_EQUAL ( true, LC->SetIndexToVector(&tester) );
     270  CPPUNIT_ASSERT_EQUAL ( true, LC->SetIndexToVector(tester) );
    271271  ListOfPoints = LC->GetallNeighbours();
    272272  size = ListOfPoints->size();
     
    285285  // get all atoms in one corner
    286286  tester= Vector(0.5, 0.5, 0.5);
    287   CPPUNIT_ASSERT_EQUAL ( true, LC->SetIndexToVector(&tester) );
     287  CPPUNIT_ASSERT_EQUAL ( true, LC->SetIndexToVector(tester) );
    288288  ListOfPoints = LC->GetallNeighbours();
    289289  size=ListOfPoints->size();
    290290  CPPUNIT_ASSERT_EQUAL( (size_t)8, size );
    291291  for(molecule::iterator iter = TestMolecule->begin(); iter != TestMolecule->end(); ++iter){
    292     if (((*iter)->x[0] <2) && ((*iter)->x[1] <2) && ((*iter)->x[2] <2)) {
     292    if (((*iter)->at(0) <2) && ((*iter)->at(1) <2) && ((*iter)->at(2) <2)) {
    293293      ListOfPoints->remove(*iter);
    294294      size--;
     
    303303  // get all atoms from one corner
    304304  tester = Vector(0.5, 0.5, 0.5);
    305   CPPUNIT_ASSERT_EQUAL ( true, LC->SetIndexToVector(&tester) );
     305  CPPUNIT_ASSERT_EQUAL ( true, LC->SetIndexToVector(tester) );
    306306  ListOfPoints = LC->GetallNeighbours(3);
    307307  size=ListOfPoints->size();
     
    329329  // get all points around central arom with radius 1.
    330330  tester= Vector(1.5,1.5,1.5);
    331   CPPUNIT_ASSERT_EQUAL ( true, LC->SetIndexToVector(&tester) );
     331  CPPUNIT_ASSERT_EQUAL ( true, LC->SetIndexToVector(tester) );
    332332  ListOfPoints = LC->GetPointsInsideSphere(1., &tester);
    333333  size = ListOfPoints->size();
    334334  CPPUNIT_ASSERT_EQUAL( (size_t)7, size );
    335335  for(molecule::iterator iter = TestMolecule->begin(); iter!=TestMolecule->end();++iter){
    336     if (((*iter)->x.DistanceSquared(tester) - 1.) < MYEPSILON ) {
     336    if (((*iter)->DistanceSquared(tester) - 1.) < MYEPSILON ) {
    337337      ListOfPoints->remove(*iter);
    338338      size--;
  • src/unittests/MoleculeDescriptorTest.hpp

    re588312 rb5c53d  
    1313#include "types.hpp"
    1414
    15 #define MOLECULE_COUNT (10)
     15// we prefer enum over define
     16enum { MOLECULE_COUNT = 10 };
    1617
    1718class molecule;
  • src/unittests/ParserUnitTest.cpp

    re588312 rb5c53d  
    208208  input << Tremolo_Atomdata2;
    209209  testParser->load(&input);
    210   CPPUNIT_ASSERT(World::getInstance().getAtom(AtomByType(1))->x[0] == 3.0);
     210  CPPUNIT_ASSERT(World::getInstance().getAtom(AtomByType(1))->at(0) == 3.0);
    211211  input.clear();
    212212}
     
    219219  input << Tremolo_velocity;
    220220  testParser->load(&input);
    221   CPPUNIT_ASSERT(World::getInstance().getAtom(AtomByType(1))->v[0] == 3.0);
     221  CPPUNIT_ASSERT(World::getInstance().getAtom(AtomByType(1))->AtomicVelocity[0] == 3.0);
    222222  input.clear();
    223223}
     
    271271  // with the maximum number of fields and minimal information, default values are printed
    272272  atom* newAtom = World::getInstance().createAtom();
    273   newAtom->type = World::getInstance().getPeriode()->FindElement(1);
     273  newAtom->setType(1);
    274274  testParser->setFieldsForSave("x=3 u=3 F stress Id neighbors=5 imprData GroupMeasureTypeNo Type extType name resName chainID resSeq occupancy tempFactor segID Charge charge GrpTypeNo torsion");
    275275  testParser->save(&output);
     
    304304  atom *Walker = NULL;
    305305  Walker = World::getInstance().createAtom();
    306   Walker->type = World::getInstance().getPeriode()->FindElement(8);
    307   Walker->x = Vector(0,0,0);
     306  Walker->setType(8);
     307  Walker->setPosition(Vector(0,0,0));
    308308  Walker = World::getInstance().createAtom();
    309   Walker->type = World::getInstance().getPeriode()->FindElement(1);
    310   Walker->x = Vector(0.758602,0,0.504284);
     309  Walker->setType(1);
     310  Walker->setPosition(Vector(0.758602,0,0.504284));
    311311  Walker = World::getInstance().createAtom();
    312   Walker->type = World::getInstance().getPeriode()->FindElement(1);
    313   Walker->x = Vector(0.758602,0,-0.504284);
     312  Walker->setType(1);
     313  Walker->setPosition(Vector(0.758602,0,-0.504284));
    314314  CPPUNIT_ASSERT_EQUAL(3, World::getInstance().numAtoms());
    315315
  • src/unittests/analysisbondsunittest.cpp

    re588312 rb5c53d  
    1616#include <cstring>
    1717
    18 #include "World.hpp"
    1918#include "analysis_bonds.hpp"
    2019#include "analysisbondsunittest.hpp"
     
    2524#include "molecule.hpp"
    2625#include "periodentafel.hpp"
     26#include "LinearAlgebra/Vector.hpp"
    2727#include "World.hpp"
    2828
     
    5252  Walker = World::getInstance().createAtom();
    5353  CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
    54   Walker->type = hydrogen;
    55   *Walker->node = Vector(1.5, 0., 1.5 );
     54  Walker->setType(hydrogen);
     55  Walker->setPosition(Vector(1.5, 0., 1.5 ));
    5656  TestMolecule->AddAtom(Walker);
    5757  Walker = World::getInstance().createAtom();
    5858  CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
    59   Walker->type = hydrogen;
    60   *Walker->node = Vector(0., 1.5, 1.5 );
     59  Walker->setType(hydrogen);
     60  Walker->setPosition(Vector(0., 1.5, 1.5 ));
    6161  TestMolecule->AddAtom(Walker);
    6262  Walker = World::getInstance().createAtom();
    6363  CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
    64   Walker->type = hydrogen;
    65   *Walker->node = Vector(1.5, 1.5, 0. );
     64  Walker->setType(hydrogen);
     65  Walker->setPosition(Vector(1.5, 1.5, 0. ));
    6666  TestMolecule->AddAtom(Walker);
    6767  Walker = World::getInstance().createAtom();
    6868  CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
    69   Walker->type = hydrogen;
    70   *Walker->node = Vector(0., 0., 0. );
     69  Walker->setType(hydrogen);
     70  Walker->setPosition(Vector(0., 0., 0. ));
    7171  TestMolecule->AddAtom(Walker);
    7272  Walker = World::getInstance().createAtom();
    7373  CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
    74   Walker->type = carbon;
    75   *Walker->node = Vector(0.5, 0.5, 0.5 );
     74  Walker->setType(carbon);
     75  Walker->setPosition(Vector(0.5, 0.5, 0.5 ));
    7676  TestMolecule->AddAtom(Walker);
    7777
  • src/unittests/atomsCalculationTest.hpp

    re588312 rb5c53d  
    1111#include <cppunit/extensions/HelperMacros.h>
    1212
    13 #define ATOM_COUNT (10)
     13// we prefer enum over define
     14enum { ATOM_COUNT = 10 };
    1415
    1516#include "types.hpp"
  • src/unittests/bondgraphunittest.cpp

    re588312 rb5c53d  
    5454  Walker = World::getInstance().createAtom();
    5555  CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
    56   Walker->type = carbon;
    57   *Walker->node = Vector(1., 0., 1. );
     56  Walker->setType(carbon);
     57  Walker->setPosition(Vector(1., 0., 1. ));
    5858  TestMolecule->AddAtom(Walker);
    5959
    6060  Walker = World::getInstance().createAtom();
    6161  CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
    62   Walker->type = carbon;
    63   *Walker->node = Vector(0., 1., 1. );
     62  Walker->setType(carbon);
     63  Walker->setPosition(Vector(0., 1., 1. ));
    6464  TestMolecule->AddAtom(Walker);
    6565
    6666  Walker = World::getInstance().createAtom();
    6767  CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
    68   Walker->type = carbon;
    69   *Walker->node = Vector(1., 1., 0. );
     68  Walker->setType(carbon);
     69  Walker->setPosition(Vector(1., 1., 0. ));
    7070  TestMolecule->AddAtom(Walker);
    7171
    7272  Walker = World::getInstance().createAtom();
    7373  CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
    74   Walker->type = carbon;
    75   *Walker->node = Vector(0., 0., 0. );
     74  Walker->setType(carbon);
     75  Walker->setPosition(Vector(0., 0., 0. ));
    7676  TestMolecule->AddAtom(Walker);
    7777
  • src/unittests/listofbondsunittest.cpp

    re588312 rb5c53d  
    4747  Walker = World::getInstance().createAtom();
    4848  CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
    49   Walker->type = hydrogen;
    50   *Walker->node = Vector(1., 0., 1. );
    51   TestMolecule->AddAtom(Walker);
    52   Walker = World::getInstance().createAtom();
    53   CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
    54   Walker->type = hydrogen;
    55   *Walker->node = Vector(0., 1., 1. );
    56   TestMolecule->AddAtom(Walker);
    57   Walker = World::getInstance().createAtom();
    58   CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
    59   Walker->type = hydrogen;
    60   *Walker->node = Vector(1., 1., 0. );
    61   TestMolecule->AddAtom(Walker);
    62   Walker = World::getInstance().createAtom();
    63   CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
    64   Walker->type = hydrogen;
    65   *Walker->node = Vector(0., 0., 0. );
     49  Walker->setType(hydrogen);
     50  Walker->setPosition(Vector(1., 0., 1. ));
     51  TestMolecule->AddAtom(Walker);
     52  Walker = World::getInstance().createAtom();
     53  CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
     54  Walker->setType(hydrogen);
     55  Walker->setPosition(Vector(0., 1., 1. ));
     56  TestMolecule->AddAtom(Walker);
     57  Walker = World::getInstance().createAtom();
     58  CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
     59  Walker->setType(hydrogen);
     60  Walker->setPosition(Vector(1., 1., 0. ));
     61  TestMolecule->AddAtom(Walker);
     62  Walker = World::getInstance().createAtom();
     63  CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
     64  Walker->setType(hydrogen);
     65  Walker->setPosition(Vector(0., 0., 0. ));
    6666  TestMolecule->AddAtom(Walker);
    6767
  • src/unittests/manipulateAtomsTest.hpp

    re588312 rb5c53d  
    1111#include <cppunit/extensions/HelperMacros.h>
    1212
    13 #define ATOM_COUNT (10)
     13// we prefer enum over define
     14enum { ATOM_COUNT = 10 };
    1415
    1516class atom;
  • src/unittests/tesselation_boundarytriangleunittest.cpp

    re588312 rb5c53d  
    1313
    1414#include <cstring>
     15#include <iostream>
    1516
    1617#include "defs.hpp"
    17 #include "tesselation.hpp"
     18#include "TesselPoint.hpp"
     19#include "BoundaryPointSet.hpp"
     20#include "BoundaryLineSet.hpp"
     21#include "BoundaryTriangleSet.hpp"
     22#include "CandidateForTesselation.hpp"
    1823#include "tesselation_boundarytriangleunittest.hpp"
    1924
     
    2227#endif /*HAVE_TESTRUNNER*/
    2328
    24 #define SPHERERADIUS 2.
     29const double TesselationBoundaryTriangleTest::SPHERERADIUS=2.;
    2530
    2631/********************************************** Test classes **************************************/
     
    3641  // create nodes
    3742  tesselpoints[0] = new TesselPoint;
    38   tesselpoints[0]->node = new Vector(0., 0., 0.);
     43  tesselpoints[0]->setPosition(Vector(0., 0., 0.));
    3944  tesselpoints[0]->setName("1");
    4045  tesselpoints[0]->nr = 1;
    4146  points[0] = new BoundaryPointSet(tesselpoints[0]);
    4247  tesselpoints[1] = new TesselPoint;
    43   tesselpoints[1]->node = new Vector(0., 1., 0.);
     48  tesselpoints[1]->setPosition(Vector(0., 1., 0.));
    4449  tesselpoints[1]->setName("2");
    4550  tesselpoints[1]->nr = 2;
    4651  points[1] = new BoundaryPointSet(tesselpoints[1]);
    4752  tesselpoints[2] = new TesselPoint;
    48   tesselpoints[2]->node = new Vector(1., 0., 0.);
     53  tesselpoints[2]->setPosition(Vector(1., 0., 0.));
    4954  tesselpoints[2]->setName("3");
    5055  tesselpoints[2]->nr = 3;
     
    6772  for (int i=0;i<3;++i) {
    6873    // TesselPoint does not delete its vector as it only got a reference
    69     delete tesselpoints[i]->node;
    7074    delete tesselpoints[i];
    7175  }
     
    8387  // simple test on y line
    8488  Point = Vector(-1.,0.5,0.);
    85   CPPUNIT_ASSERT_EQUAL( 1., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
     89  CPPUNIT_ASSERT_EQUAL( 1., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
    8690  Point = Vector(0.,0.5,0.);
    8791  CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
    8892  Point = Vector(-4.,0.5,0.);
    89   CPPUNIT_ASSERT_EQUAL( 16., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
     93  CPPUNIT_ASSERT_EQUAL( 16., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
    9094  Point = Vector(0.,0.5,0.);
    9195  CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
     
    9397  // simple test on x line
    9498  Point = Vector(0.5,-1.,0.);
    95   CPPUNIT_ASSERT_EQUAL( 1., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
     99  CPPUNIT_ASSERT_EQUAL( 1., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
    96100  Point = Vector(0.5,0.,0.);
    97101  CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
    98102  Point = Vector(0.5,-6.,0.);
    99   CPPUNIT_ASSERT_EQUAL( 36., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
     103  CPPUNIT_ASSERT_EQUAL( 36., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
    100104  Point = Vector(0.5,0.,0.);
    101105  CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
     
    103107  // simple test on slanted line
    104108  Point = Vector(1.,1.,0.);
    105   CPPUNIT_ASSERT_EQUAL( 0.5, triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
     109  CPPUNIT_ASSERT_EQUAL( 0.5, triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
    106110  Point = Vector(0.5,0.5,0.);
    107111  CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
    108112  Point = Vector(5.,5.,0.);
    109   CPPUNIT_ASSERT_EQUAL( 40.5, triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
     113  CPPUNIT_ASSERT_EQUAL( 40.5, triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
    110114  Point = Vector(0.5,0.5,0.);
    111115  CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
     
    113117  // simple test on first node
    114118  Point = Vector(-1.,-1.,0.);
    115   CPPUNIT_ASSERT_EQUAL( 2., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
     119  CPPUNIT_ASSERT_EQUAL( 2., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
    116120  Point = Vector(0.,0.,0.);
    117121  CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
     
    119123  // simple test on second node
    120124  Point = Vector(0.,2.,0.);
    121   CPPUNIT_ASSERT_EQUAL( 1., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
     125  CPPUNIT_ASSERT_EQUAL( 1., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
    122126  Point = Vector(0.,1.,0.);
    123127  CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
     
    125129  // simple test on third node
    126130  Point = Vector(2.,0.,0.);
    127   CPPUNIT_ASSERT_EQUAL( 1., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
     131  CPPUNIT_ASSERT_EQUAL( 1., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
    128132  Point = Vector(1.,0.,0.);
    129133  CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
     
    139143  // straight down/up
    140144  Point = Vector(1./3.,1./3.,+5.);
    141   CPPUNIT_ASSERT_EQUAL( 25. , triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
     145  CPPUNIT_ASSERT_EQUAL( 25. , triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
    142146  Point = Vector(1./3.,1./3.,0.);
    143147  CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
    144148  Point = Vector(1./3.,1./3.,-5.);
    145   CPPUNIT_ASSERT_EQUAL( 25. , triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
     149  CPPUNIT_ASSERT_EQUAL( 25. , triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
    146150  Point = Vector(1./3.,1./3.,0.);
    147151  CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
     
    149153  // simple test on y line
    150154  Point = Vector(-1.,0.5,+2.);
    151   CPPUNIT_ASSERT_EQUAL( 5., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
     155  CPPUNIT_ASSERT_EQUAL( 5., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
    152156  Point = Vector(0.,0.5,0.);
    153157  CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
    154158  Point = Vector(-1.,0.5,-3.);
    155   CPPUNIT_ASSERT_EQUAL( 10., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
     159  CPPUNIT_ASSERT_EQUAL( 10., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
    156160  Point = Vector(0.,0.5,0.);
    157161  CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
     
    159163  // simple test on x line
    160164  Point = Vector(0.5,-1.,+1.);
    161   CPPUNIT_ASSERT_EQUAL( 2., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
     165  CPPUNIT_ASSERT_EQUAL( 2., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
    162166  Point = Vector(0.5,0.,0.);
    163167  CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
    164168  Point = Vector(0.5,-1.,-2.);
    165   CPPUNIT_ASSERT_EQUAL( 5., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
     169  CPPUNIT_ASSERT_EQUAL( 5., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
    166170  Point = Vector(0.5,0.,0.);
    167171  CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
     
    169173  // simple test on slanted line
    170174  Point = Vector(1.,1.,+3.);
    171   CPPUNIT_ASSERT_EQUAL( 9.5, triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
     175  CPPUNIT_ASSERT_EQUAL( 9.5, triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
    172176  Point = Vector(0.5,0.5,0.);
    173177  CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
    174178  Point = Vector(1.,1.,-4.);
    175   CPPUNIT_ASSERT_EQUAL( 16.5, triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
     179  CPPUNIT_ASSERT_EQUAL( 16.5, triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
    176180  Point = Vector(0.5,0.5,0.);
    177181  CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
     
    179183  // simple test on first node
    180184  Point = Vector(-1.,-1.,5.);
    181   CPPUNIT_ASSERT_EQUAL( 27., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
     185  CPPUNIT_ASSERT_EQUAL( 27., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
    182186  Point = Vector(0.,0.,0.);
    183187  CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
     
    185189  // simple test on second node
    186190  Point = Vector(0.,2.,5.);
    187   CPPUNIT_ASSERT_EQUAL( 26., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
     191  CPPUNIT_ASSERT_EQUAL( 26., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
    188192  Point = Vector(0.,1.,0.);
    189193  CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
     
    191195  // simple test on third node
    192196  Point = Vector(2.,0.,5.);
    193   CPPUNIT_ASSERT_EQUAL( 26., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
     197  CPPUNIT_ASSERT_EQUAL( 26., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
    194198  Point = Vector(1.,0.,0.);
    195199  CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
  • src/unittests/tesselation_boundarytriangleunittest.hpp

    re588312 rb5c53d  
    1616#include "tesselation.hpp"
    1717
     18class TesselPoint;
     19
    1820/********************************************** Test classes **************************************/
    1921
     
    3234
    3335private:
     36      static const double SPHERERADIUS;
     37
    3438      class BoundaryTriangleSet *triangle;
    3539      class BoundaryLineSet *lines[3];
  • src/unittests/tesselation_insideoutsideunittest.cpp

    re588312 rb5c53d  
    1313
    1414#include <cstring>
     15#include <iostream>
    1516
    1617#include "defs.hpp"
    17 #include "tesselation.hpp"
     18#include "TesselPoint.hpp"
     19#include "BoundaryLineSet.hpp"
     20#include "BoundaryTriangleSet.hpp"
     21#include "CandidateForTesselation.hpp"
    1822#include "tesselation_insideoutsideunittest.hpp"
    1923#include "Helpers/Verbose.hpp"
     
    2327#endif /*HAVE_TESTRUNNER*/
    2428
    25 #define SPHERERADIUS 2.
     29const double TesselationInOutsideTest::SPHERERADIUS=2.;
    2630
    2731/********************************************** Test classes **************************************/
     
    2933// Registers the fixture into the 'registry'
    3034CPPUNIT_TEST_SUITE_REGISTRATION( TesselationInOutsideTest );
    31 
    3235
    3336void TesselationInOutsideTest::setUp()
     
    3841  class TesselPoint *Walker;
    3942  Walker = new TesselPoint;
    40   Walker->node = new Vector(0., 0., 0.);
     43  Walker->setPosition(Vector(0., 0., 0.));
    4144  Walker->setName("1");
    4245  Walker->nr = 1;
    4346  Corners.push_back(Walker);
    4447  Walker = new TesselPoint;
    45   Walker->node = new Vector(0., 1., 0.);
     48  Walker->setPosition(Vector(0., 1., 0.));
    4649  Walker->setName("2");
    4750  Walker->nr = 2;
    4851  Corners.push_back(Walker);
    4952  Walker = new TesselPoint;
    50   Walker->node = new Vector(1., 0., 0.);
     53  Walker->setPosition(Vector(1., 0., 0.));
    5154  Walker->setName("3");
    5255  Walker->nr = 3;
    5356  Corners.push_back(Walker);
    5457  Walker = new TesselPoint;
    55   Walker->node = new Vector(1., 1., 0.);
     58  Walker->setPosition(Vector(1., 1., 0.));
    5659  Walker->setName("4");
    5760  Walker->nr = 4;
    5861  Corners.push_back(Walker);
    5962  Walker = new TesselPoint;
    60   Walker->node = new Vector(0., 0., 1.);
     63  Walker->setPosition(Vector(0., 0., 1.));
    6164  Walker->setName("5");
    6265  Walker->nr = 5;
    6366  Corners.push_back(Walker);
    6467  Walker = new TesselPoint;
    65   Walker->node = new Vector(0., 1., 1.);
     68  Walker->setPosition(Vector(0., 1., 1.));
    6669  Walker->setName("6");
    6770  Walker->nr = 6;
    6871  Corners.push_back(Walker);
    6972  Walker = new TesselPoint;
    70   Walker->node = new Vector(1., 0., 1.);
     73  Walker->setPosition(Vector(1., 0., 1.));
    7174  Walker->setName("7");
    7275  Walker->nr = 7;
    7376  Corners.push_back(Walker);
    7477  Walker = new TesselPoint;
    75   Walker->node = new Vector(1., 1., 1.);
     78  Walker->setPosition(Vector(1., 1., 1.));
    7679  Walker->setName("8");
    7780  Walker->nr = 8;
     
    130133  delete(LinkedList);
    131134  delete(TesselStruct);
    132   for (LinkedCell::LinkedNodes::iterator Runner = Corners.begin(); Runner != Corners.end(); Runner++) {
    133     delete((*Runner)->node);
     135  for (LinkedCell::LinkedNodes::iterator Runner = Corners.begin(); Runner != Corners.end(); Runner++)
    134136    delete(*Runner);
    135   }
    136137  Corners.clear();
    137138  logger::purgeInstance();
  • src/unittests/tesselation_insideoutsideunittest.hpp

    re588312 rb5c53d  
    3030
    3131private:
     32      static const double SPHERERADIUS;
     33
    3234      class Tesselation *TesselStruct;
    3335      LinkedCell::LinkedNodes Corners;
  • src/unittests/tesselationunittest.cpp

    re588312 rb5c53d  
    1616
    1717#include "defs.hpp"
    18 #include "tesselation.hpp"
     18#include "TesselPoint.hpp"
     19#include "BoundaryLineSet.hpp"
     20#include "BoundaryTriangleSet.hpp"
     21#include "CandidateForTesselation.hpp"
    1922#include "tesselationunittest.hpp"
    2023
     
    2326#endif /*HAVE_TESTRUNNER*/
    2427
    25 #define SPHERERADIUS 2.
     28const double TesselationTest::SPHERERADIUS=2.;
    2629
    2730/********************************************** Test classes **************************************/
     
    3639  class TesselPoint *Walker;
    3740  Walker = new TesselPoint;
    38   Walker->node = new Vector(1., 0., -1.);
     41  Walker->setPosition(Vector(1., 0., -1.));
    3942  Walker->setName("1");
    4043  Walker->nr = 1;
    4144  Corners.push_back(Walker);
    4245  Walker = new TesselPoint;
    43   Walker->node = new Vector(-1., 1., -1.);
     46  Walker->setPosition(Vector(-1., 1., -1.));
    4447  Walker->setName("2");
    4548  Walker->nr = 2;
    4649  Corners.push_back(Walker);
    4750  Walker = new TesselPoint;
    48   Walker->node = new Vector(-1., -1., -1.);
     51  Walker->setPosition(Vector(-1., -1., -1.));
    4952  Walker->setName("3");
    5053  Walker->nr = 3;
    5154  Corners.push_back(Walker);
    5255  Walker = new TesselPoint;
    53   Walker->node = new Vector(-1., 0., 1.);
     56  Walker->setPosition(Vector(-1., 0., 1.));
    5457  Walker->setName("4");
    5558  Walker->nr = 4;
     
    101104  delete(LinkedList);
    102105  delete(TesselStruct);
    103   for (LinkedCell::LinkedNodes::iterator Runner = Corners.begin(); Runner != Corners.end(); Runner++) {
    104     delete((*Runner)->node);
     106  for (LinkedCell::LinkedNodes::iterator Runner = Corners.begin(); Runner != Corners.end(); Runner++)
    105107    delete(*Runner);
    106   }
    107108  Corners.clear();
    108109  logger::purgeInstance();
  • src/unittests/tesselationunittest.hpp

    re588312 rb5c53d  
    3333
    3434private:
     35      static const double SPHERERADIUS;
     36
    3537      class Tesselation *TesselStruct;
    3638      LinkedCell::LinkedNodes Corners;
  • src/unittests/vectorunittest.cpp

    re588312 rb5c53d  
    1616#include "Helpers/Log.hpp"
    1717#include "LinearAlgebra/Vector.hpp"
    18 #include "vector_ops.hpp"
     18#include "LinearAlgebra/vector_ops.hpp"
    1919#include "vectorunittest.hpp"
    2020#include "LinearAlgebra/Plane.hpp"
     
    5252  errorLogger::purgeInstance();
    5353};
     54
     55/** UnitTest for Constructors and Vector::IsZero() and Vector::IsOne().
     56 */
     57void VectorTest::AssignmentTest()
     58{
     59  // test with zero
     60  zero.at(0) = 0;
     61  zero.at(1) = 0;
     62  zero.at(2) = 0;
     63  double zero_array[3] = {0., 0., 0.};
     64
     65  CPPUNIT_ASSERT_EQUAL( zero, Vector(0,0,0));
     66  CPPUNIT_ASSERT_EQUAL( zero, Vector(0.,0.,0.));
     67  CPPUNIT_ASSERT_EQUAL( zero, Vector(zero_array[0], zero_array[1], zero_array[2]));
     68  CPPUNIT_ASSERT_EQUAL( zero, Vector(zero_array));
     69
     70  // test with unit
     71  unit.at(0) = 1;
     72  unit.at(1) = 0;
     73  unit.at(2) = 0;
     74  double unit_array[3] = {1., 0., 0.};
     75
     76  CPPUNIT_ASSERT_EQUAL( unit, Vector(1,0,0));
     77  CPPUNIT_ASSERT_EQUAL( unit, Vector(1.,0.,0.));
     78  CPPUNIT_ASSERT_EQUAL( unit, Vector(unit_array[0], unit_array[1], unit_array[2]));
     79  CPPUNIT_ASSERT_EQUAL( unit, Vector(unit_array));
     80
     81  // test with two
     82  two.at(0) = 2;
     83  two.at(1) = 1;
     84  two.at(2) = 0;
     85  double two_array[3] = {2., 1., 0.};
     86
     87  CPPUNIT_ASSERT_EQUAL( two, Vector(2,1,0));
     88  CPPUNIT_ASSERT_EQUAL( two, Vector(2.,1.,0.));
     89  CPPUNIT_ASSERT_EQUAL( two, Vector(two_array[0], two_array[1], two_array[2]));
     90  CPPUNIT_ASSERT_EQUAL( two, Vector(two_array));
     91
     92  // test with three
     93  three.at(0) = 1;
     94  three.at(1) = 2;
     95  three.at(2) = 3;
     96  double three_array[3] = {1., 2., 3.};
     97
     98  CPPUNIT_ASSERT_EQUAL( three, Vector(1,2,3));
     99  CPPUNIT_ASSERT_EQUAL( three, Vector(1.,2.,3.));
     100  CPPUNIT_ASSERT_EQUAL( three, Vector(three_array[0], three_array[1], three_array[2]));
     101  CPPUNIT_ASSERT_EQUAL( three, Vector(three_array));
     102}
    54103
    55104/** UnitTest for Constructors and Vector::IsZero() and Vector::IsOne().
  • src/unittests/vectorunittest.hpp

    re588312 rb5c53d  
    1818{
    1919    CPPUNIT_TEST_SUITE( VectorTest) ;
     20    CPPUNIT_TEST ( AssignmentTest );
    2021    CPPUNIT_TEST ( UnityTest );
    2122    CPPUNIT_TEST ( SimpleAlgebraTest );
     
    3334    void tearDown();
    3435
     36    void AssignmentTest();
    3537    void UnityTest();
    3638    void OperatorAlgebraTest();
  • tests/Tesselations/defs.in

    re588312 rb5c53d  
    5454        #echo "Current dir is `pwd`, calling $MOLECUILDER $mol.conf -e $exec_prefix -p ../$mol.xyz -N $RADIUS $FILENAME."
    5555        if [ -e $mol.dbond ]; then
    56                 $MOLECUILDER $mol.conf -e $exec_prefix -p ../$mol.xyz -A $mol.dbond --select-molecule-by-id 0 -N $RADIUS --nonconvex-file $FILENAME 2>stderr >stdout || exitcode=$?
     56                $MOLECUILDER -i ../$mol.xyz -A $mol.dbond --select-molecule-by-id 0 -N $RADIUS --nonconvex-file $FILENAME 2>stderr >stdout || exitcode=$?
    5757        else
    58                 $MOLECUILDER $mol.conf -e $exec_prefix -p ../$mol.xyz --select-molecule-by-id 0 -N $RADIUS --nonconvex-file $FILENAME 2>stderr >stdout || exitcode=$?
     58                $MOLECUILDER -i ../$mol.xyz --select-molecule-by-id 0 -N $RADIUS --nonconvex-file $FILENAME 2>stderr >stdout || exitcode=$?
    5959        fi
    6060        #echo "Molecuilder done with exitcode $exitcode."
  • tests/regression/Makefile.am

    re588312 rb5c53d  
    33TESTSUITE = $(srcdir)/testsuite
    44
     5max_jobs = 4
     6 
    57check-local: atconfig atlocal package.m4 $(TESTSUITE)
    6                 $(SHELL) '$(TESTSUITE)' $(TESTSUITEFLAGS)
     8        nrjobs=; \
     9        for flag in $$MAKEFLAGS; do \
     10                case $$flag in \
     11                --* | =*=) ;; \
     12                *j*) nrjobs="-j$(max_jobs)" ;; \
     13                esac; \
     14        done; \
     15        $(SHELL) '$(TESTSUITE)' $$nrjobs $(TESTSUITEFLAGS)
    716
    817installcheck-local: atconfig atlocal $(TESTSUITE)
    9                 $(SHELL) '$(TESTSUITE)' AUTOTEST_PATH='$(bindir)' \
    10                 $(TESTSUITEFLAGS)
    11      
     18        $(SHELL) '$(TESTSUITE)' AUTOTEST_PATH='$(bindir)' \
     19        $(TESTSUITEFLAGS)
     20
    1221clean-local:
    13                 test ! -f '$(TESTSUITE)' || \
    14                 $(SHELL) '$(TESTSUITE)' --clean
     22        test ! -f '$(TESTSUITE)' || \
     23        $(SHELL) '$(TESTSUITE)' --clean
    1524
    1625AUTOTEST = $(AUTOM4TE) --language=autotest
    1726$(TESTSUITE): $(srcdir)/testsuite.at $(srcdir)/testsuite-*.at
    18                 $(AUTOTEST) -I '$(srcdir)' -o $@.tmp $@.at
    19                 mv $@.tmp $@
     27        $(AUTOTEST) -I '$(srcdir)' -o $@.tmp $@.at
     28        mv $@.tmp $@
    2029
    2130# The `:;' works around a Bash 3.2 bug when the output is not writeable.
    2231$(srcdir)/package.m4: $(top_srcdir)/configure.ac
    23                         :;{ \
    24                                         echo '# Signature of the current package.' && \
    25                                         echo 'm4_define([AT_PACKAGE_NAME],      [@PACKAGE_NAME@])' && \
    26                                         echo 'm4_define([AT_PACKAGE_TARNAME],   [@PACKAGE_TARNAME@])' && \
    27                                         echo 'm4_define([AT_PACKAGE_VERSION],   [@PACKAGE_VERSION@])' && \
    28                                         echo 'm4_define([AT_PACKAGE_STRING],    [@PACKAGE_STRING@])' && \
    29                                         echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \
    30                                 } >'$(srcdir)/package.m4'
     32        :;{ \
     33                echo '# Signature of the current package.' && \
     34                echo 'm4_define([AT_PACKAGE_NAME],      [@PACKAGE_NAME@])' && \
     35                echo 'm4_define([AT_PACKAGE_TARNAME],   [@PACKAGE_TARNAME@])' && \
     36                echo 'm4_define([AT_PACKAGE_VERSION],   [@PACKAGE_VERSION@])' && \
     37                echo 'm4_define([AT_PACKAGE_STRING],    [@PACKAGE_STRING@])' && \
     38                echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \
     39        } >'$(srcdir)/package.m4'
  • tests/regression/testsuite-molecules.at

    re588312 rb5c53d  
    6161
    6262# 8. Rotate to PAS
    63 AT_SETUP([Molecules - BROKEN: Rotate to PAS])
     63AT_SETUP([Molecules - Rotate to PAS])
    6464AT_KEYWORDS([Molecules])
    65 AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/8/pre/test.* .], 0)
    66 AT_CHECK([../../molecuilder -i test.conf -e ${abs_top_srcdir}/src/ --select-molecule-by-id 0 -m 0], 0, [stdout], [stderr])
    67 #AT_CHECK([file=test.conf; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/8/post/$file], 0, [ignore], [ignore])
     65AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/8/pre/test-*.xyz .], 0)
     66AT_CHECK([../../molecuilder -i test-rotated-z90.xyz -e ${abs_top_srcdir}/src/ --select-molecule-by-id 0 -m "0,0,1"], 0, [stdout], [stderr])
     67AT_CHECK([file="test-rotated-z90.xyz"; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/8/post/$file], 0, [ignore], [ignore])
     68AT_CHECK([../../molecuilder -i test-rotated-z180.xyz -e ${abs_top_srcdir}/src/ --select-molecule-by-id 0 -m "0,0,1"], 0, [stdout], [stderr])
     69AT_CHECK([file="test-rotated-z180.xyz"; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/8/post/$file], 0, [ignore], [ignore])
     70AT_CHECK([../../molecuilder -i test-rotated-z360.xyz -e ${abs_top_srcdir}/src/ --select-molecule-by-id 0 -m "0,0,1"], 0, [stdout], [stderr])
     71AT_CHECK([file="test-rotated-z360.xyz"; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/8/post/$file], 0, [ignore], [ignore])
     72AT_CHECK([../../molecuilder -i test-rotated-xYz20.xyz -e ${abs_top_srcdir}/src/ --select-molecule-by-id 0 -m "0,0,1"], 0, [stdout], [stderr])
     73AT_CHECK([file="test-rotated-xYz20.xyz"; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/8/post/$file], 0, [ignore], [ignore])
    6874AT_CLEANUP
    6975
     76# 9. Rotate around origin
     77AT_SETUP([Molecules - Rotate around origin])
     78AT_KEYWORDS([Molecules])
     79AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/9/pre/test.xyz .], 0)
     80AT_CHECK([../../molecuilder -i test.xyz -e ${abs_top_srcdir}/src/ --select-all-molecules --rotate-origin 90. --position "0,0,1"], 0, [stdout], [stderr])
     81AT_CHECK([diff test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/9/post/test-rotated-z90.xyz], 0, [ignore], [ignore])
     82AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/9/pre/test.xyz .], 0)
     83AT_CHECK([../../molecuilder -i test.xyz -e ${abs_top_srcdir}/src/ --select-all-molecules --rotate-origin 180. --position "0,0,1"], 0, [stdout], [stderr])
     84AT_CHECK([diff test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/9/post/test-rotated-z180.xyz], 0, [ignore], [ignore])
     85AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/9/pre/test.xyz .], 0)
     86AT_CHECK([../../molecuilder -i test.xyz -e ${abs_top_srcdir}/src/ --select-all-molecules --rotate-origin 360. --position "0,0,1"], 0, [stdout], [stderr])
     87AT_CHECK([diff test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/9/post/test-rotated-z360.xyz], 0, [ignore], [ignore])
     88AT_CHECK([diff test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/9/pre/test.xyz], 0, [ignore], [ignore])
     89AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/9/pre/test.xyz .], 0)
     90AT_CHECK([../../molecuilder -i test.xyz -e ${abs_top_srcdir}/src/ --select-all-molecules --rotate-origin 20. --position "1,2,1"], 0, [stdout], [stderr])
     91AT_CHECK([diff test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/9/post/test-rotated-xYz20.xyz], 0, [ignore], [ignore])
     92AT_CLEANUP
     93
     94# 9. Rotate around self
     95AT_SETUP([Molecules - Rotate around self])
     96AT_KEYWORDS([Molecules])
     97AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/10/pre/test.xyz .], 0)
     98AT_CHECK([../../molecuilder -i test.xyz -e ${abs_top_srcdir}/src/ --select-all-molecules --rotate-self 90. --position "0,0,1"], 0, [stdout], [stderr])
     99AT_CHECK([diff test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/10/post/test-rotated-z90.xyz], 0, [ignore], [ignore])
     100AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/10/pre/test.xyz .], 0)
     101AT_CHECK([../../molecuilder -i test.xyz -e ${abs_top_srcdir}/src/ --select-all-molecules --rotate-self 180. --position "0,0,1"], 0, [stdout], [stderr])
     102AT_CHECK([diff test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/10/post/test-rotated-z180.xyz], 0, [ignore], [ignore])
     103AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/10/pre/test.xyz .], 0)
     104AT_CHECK([../../molecuilder -i test.xyz -e ${abs_top_srcdir}/src/ --select-all-molecules --rotate-self 360. --position "0,0,1"], 0, [stdout], [stderr])
     105AT_CHECK([diff test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/10/post/test-rotated-z360.xyz], 0, [ignore], [ignore])
     106AT_CHECK([diff test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/10/pre/test.xyz], 0, [ignore], [ignore])
     107AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/10/pre/test.xyz .], 0)
     108AT_CHECK([../../molecuilder -i test.xyz -e ${abs_top_srcdir}/src/ --select-all-molecules --rotate-self 20. --position "1,2,1"], 0, [stdout], [stderr])
     109AT_CHECK([diff test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/10/post/test-rotated-xYz20.xyz], 0, [ignore], [ignore])
     110AT_CLEANUP
     111
Note: See TracChangeset for help on using the changeset viewer.