Index: src/Actions/AnalysisAction/PairCorrelationAction.cpp
===================================================================
--- src/Actions/AnalysisAction/PairCorrelationAction.cpp	(revision 97ebf8b2670d891c06f34ede7594c6708e07d886)
+++ src/Actions/AnalysisAction/PairCorrelationAction.cpp	(revision 31b09efe60555434eafcd99fb4bf0adf4626b407)
@@ -9,7 +9,11 @@
 #include "CommandLineParser.hpp"
 #include "analysis_correlation.hpp"
+#include "boundary.hpp"
+#include "linkedcell.hpp"
 #include "log.hpp"
 #include "element.hpp"
+#include "molecule.hpp"
 #include "periodentafel.hpp"
+#include "vector.hpp"
 #include "World.hpp"
 
@@ -35,6 +39,8 @@
   Dialog *dialog = UIFactory::getInstance().makeDialog();
   int ranges[3] = {1, 1, 1};
+  double BinEnd = 0.;
   double BinStart = 0.;
-  double BinEnd = 0.;
+  double BinWidth = 0.;
+  molecule *Boundary = NULL;
   string outputname;
   string binoutputname;
@@ -42,10 +48,28 @@
   ofstream output;
   ofstream binoutput;
-  const element *elemental1;
-  const element *elemental2;
+  std::vector< element *> elements;
+  string type;
+  Vector Point;
+  BinPairMap *binmap = NULL;
+  MoleculeListClass *molecules = World::getInstance().getMolecules();
 
-  dialog->queryElement("elements", &elemental1, MapOfActions::getInstance().getDescription("elements"));
-  dialog->queryElement("elements", &elemental2, MapOfActions::getInstance().getDescription("elements"));
+  // first dialog: Obtain which type of correlation
+  dialog->queryString(NAME, &type, MapOfActions::getInstance().getDescription(NAME));
+  if(dialog->display()) {
+    delete dialog;
+  } else {
+    delete dialog;
+    return Action::failure;
+  }
+
+  // second dialog: Obtain parameters specific to this type
+  dialog = UIFactory::getInstance().makeDialog();
+  if (type == "P")
+    dialog->queryVector("position", &Point, World::getInstance().getDomain(), false, MapOfActions::getInstance().getDescription("position"));
+  if (type == "S")
+    dialog->queryMolecule("molecule-by-id", &Boundary, MapOfActions::getInstance().getDescription("molecule-by-id"));
+  dialog->queryElement("elements", &elements, MapOfActions::getInstance().getDescription("elements"));
   dialog->queryDouble("bin-start", &BinStart, MapOfActions::getInstance().getDescription("bin-start"));
+  dialog->queryDouble("bin-width", &BinWidth, MapOfActions::getInstance().getDescription("bin-width"));
   dialog->queryDouble("bin-end", &BinEnd, MapOfActions::getInstance().getDescription("bin-end"));
   dialog->queryString("output-file", &outputname, MapOfActions::getInstance().getDescription("output-file"));
@@ -57,10 +81,61 @@
     binoutput.open(binoutputname.c_str());
     PairCorrelationMap *correlationmap = NULL;
-    if (periodic)
-      correlationmap = PeriodicPairCorrelation(World::getInstance().getMolecules(), elemental1, elemental2, ranges);
-    else
-      correlationmap = PairCorrelation(World::getInstance().getMolecules(), elemental1, elemental2);
-    //OutputCorrelationToSurface(&output, correlationmap);
-    BinPairMap *binmap = BinData( correlationmap, 0.5, BinStart, BinEnd );
+    if (type == "E") {
+      PairCorrelationMap *correlationmap = NULL;
+      if (periodic)
+        correlationmap = PeriodicPairCorrelation(World::getInstance().getMolecules(), elements, ranges);
+      else
+        correlationmap = PairCorrelation(World::getInstance().getMolecules(), elements);
+      //OutputCorrelationToSurface(&output, correlationmap);
+      binmap = BinData( correlationmap, BinWidth, BinStart, BinEnd );
+    } else if (type == "P")  {
+      cout << "Point to correlate to is  " << Point << endl;
+      CorrelationToPointMap *correlationmap = NULL;
+      if (periodic)
+        correlationmap  = PeriodicCorrelationToPoint(molecules, elements, &Point, ranges);
+      else
+        correlationmap = CorrelationToPoint(molecules, elements, &Point);
+      //OutputCorrelationToSurface(&output, correlationmap);
+      binmap = BinData( correlationmap, BinWidth, BinStart, BinEnd );
+    } else if (type == "S") {
+      ASSERT(Boundary != NULL, "No molecule specified for SurfaceCorrelation.");
+      const double radius = 4.;
+      double LCWidth = 20.;
+      if (BinEnd > 0) {
+        if (BinEnd > 2.*radius)
+            LCWidth = BinEnd;
+        else
+          LCWidth = 2.*radius;
+      }
+
+      // get the boundary
+      class Tesselation *TesselStruct = NULL;
+      const LinkedCell *LCList = NULL;
+      // find biggest molecule
+      int counter  = molecules->ListOfMolecules.size();
+      bool *Actives = new bool[counter];
+      counter = 0;
+      for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) {
+        Actives[counter++] = (*BigFinder)->ActiveFlag;
+        (*BigFinder)->ActiveFlag = (*BigFinder == Boundary) ? false : true;
+      }
+      LCList = new LinkedCell(Boundary, LCWidth);
+      FindNonConvexBorder(Boundary, TesselStruct, LCList, radius, NULL);
+      CorrelationToSurfaceMap *surfacemap = NULL;
+      if (periodic)
+        surfacemap = PeriodicCorrelationToSurface( molecules, elements, TesselStruct, LCList, ranges);
+      else
+        surfacemap = CorrelationToSurface( molecules, elements, TesselStruct, LCList);
+      OutputCorrelationToSurface(&output, surfacemap);
+      // check whether radius was appropriate
+      {
+        double start; double end;
+        GetMinMax( surfacemap, start, end);
+        if (LCWidth < end)
+          DoeLog(1) && (eLog()<< Verbose(1) << "Linked Cell width is smaller than the found range of values! Bins can only be correct up to: " << radius << "." << endl);
+      }
+      binmap = BinData( surfacemap, BinWidth, BinStart, BinEnd );
+    } else
+      return Action::failure;
     OutputCorrelation ( &binoutput, binmap );
     output.close();
Index: src/Actions/AnalysisAction/PairCorrelationToPointAction.cpp
===================================================================
--- src/Actions/AnalysisAction/PairCorrelationToPointAction.cpp	(revision 97ebf8b2670d891c06f34ede7594c6708e07d886)
+++ 	(revision )
@@ -1,103 +1,0 @@
-/*
- * PairCorrelationToPointAction.cpp
- *
- *  Created on: May 9, 2010
- *      Author: heber
- */
-
-#include "Actions/AnalysisAction/PairCorrelationToPointAction.hpp"
-#include "CommandLineParser.hpp"
-#include "analysis_correlation.hpp"
-#include "log.hpp"
-#include "element.hpp"
-#include "periodentafel.hpp"
-#include "World.hpp"
-
-#include <iostream>
-#include <string>
-
-using namespace std;
-
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/MapOfActions.hpp"
-
-const char AnalysisPairCorrelationToPointAction::NAME[] = "pair-correlation-point";
-
-AnalysisPairCorrelationToPointAction::AnalysisPairCorrelationToPointAction() :
-  Action(NAME)
-{}
-
-AnalysisPairCorrelationToPointAction::~AnalysisPairCorrelationToPointAction()
-{}
-
-Action::state_ptr AnalysisPairCorrelationToPointAction::performCall() {
-  Dialog *dialog = UIFactory::getInstance().makeDialog();
-  int ranges[3] = {1, 1, 1};
-  Vector position;
-  double BinStart = 0.;
-  double BinEnd = 0.;
-  string outputname;
-  string binoutputname;
-  bool periodic;
-  ofstream output;
-  ofstream binoutput;
-  const element *elemental;
-
-  dialog->queryElement("elements", &elemental, MapOfActions::getInstance().getDescription("element"));
-  dialog->queryVector("position", &position, World::getInstance().getDomain(), true, MapOfActions::getInstance().getDescription("position"));
-  dialog->queryDouble("bin-start", &BinStart, MapOfActions::getInstance().getDescription("bin-start"));
-  dialog->queryDouble("bin-end", &BinEnd, MapOfActions::getInstance().getDescription("bin-end"));
-  dialog->queryString("output-file", &outputname, MapOfActions::getInstance().getDescription("output-file"));
-  dialog->queryString("bin-output-file", &binoutputname, MapOfActions::getInstance().getDescription("bin-output-file"));
-  dialog->queryBoolean("periodic", &periodic, MapOfActions::getInstance().getDescription("periodic"));
-
-  if(dialog->display()) {
-    output.open(outputname.c_str());
-    binoutput.open(binoutputname.c_str());
-    const Vector Point = position;
-    CorrelationToPointMap *correlationmap = NULL;
-    if (periodic)
-      correlationmap  = PeriodicCorrelationToPoint(World::getInstance().getMolecules(), elemental, &Point, ranges);
-    else
-      correlationmap = CorrelationToPoint(World::getInstance().getMolecules(), elemental, &Point);
-    //OutputCorrelationToSurface(&output, correlationmap);
-    BinPairMap *binmap = BinData( correlationmap, 0.5, BinStart, BinEnd );
-    OutputCorrelation ( &binoutput, binmap );
-    output.close();
-    binoutput.close();
-    delete(binmap);
-    delete(correlationmap);
-    delete dialog;
-    return Action::success;
-  } else {
-    delete dialog;
-    return Action::failure;
-  }
-}
-
-Action::state_ptr AnalysisPairCorrelationToPointAction::performUndo(Action::state_ptr _state) {
-//  ParserLoadXyzState *state = assert_cast<ParserLoadXyzState*>(_state.get());
-
-  return Action::failure;
-//  string newName = state->mol->getName();
-//  state->mol->setName(state->lastName);
-//
-//  return Action::state_ptr(new ParserLoadXyzState(state->mol,newName));
-}
-
-Action::state_ptr AnalysisPairCorrelationToPointAction::performRedo(Action::state_ptr _state){
-  return Action::failure;
-}
-
-bool AnalysisPairCorrelationToPointAction::canUndo() {
-  return false;
-}
-
-bool AnalysisPairCorrelationToPointAction::shouldUndo() {
-  return false;
-}
-
-const string AnalysisPairCorrelationToPointAction::getName() {
-  return NAME;
-}
Index: src/Actions/AnalysisAction/PairCorrelationToPointAction.hpp
===================================================================
--- src/Actions/AnalysisAction/PairCorrelationToPointAction.hpp	(revision 97ebf8b2670d891c06f34ede7594c6708e07d886)
+++ 	(revision )
@@ -1,30 +1,0 @@
-/*
- * PairCorrelationToPointAction.hpp
- *
- *  Created on: May 9, 2010
- *      Author: heber
- */
-
-#ifndef PAIRCORRELATIONTOPOINTACTION_HPP_
-#define PAIRCORRELATIONTOPOINTACTION_HPP_
-
-#include "Actions/Action.hpp"
-
-class AnalysisPairCorrelationToPointAction : public Action {
-public:
-  AnalysisPairCorrelationToPointAction();
-  virtual ~AnalysisPairCorrelationToPointAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
-
-#endif /* PAIRCORRELATIONTOPOINTACTION_HPP_ */
Index: src/Actions/AnalysisAction/PairCorrelationToSurfaceAction.cpp
===================================================================
--- src/Actions/AnalysisAction/PairCorrelationToSurfaceAction.cpp	(revision 97ebf8b2670d891c06f34ede7594c6708e07d886)
+++ 	(revision )
@@ -1,128 +1,0 @@
-/*
- * PairCorrelationToSurfaceAction.cpp
- *
- *  Created on: May 9, 2010
- *      Author: heber
- */
-
-#include "Actions/AnalysisAction/PairCorrelationToSurfaceAction.hpp"
-#include "CommandLineParser.hpp"
-#include "analysis_correlation.hpp"
-#include "boundary.hpp"
-#include "element.hpp"
-#include "linkedcell.hpp"
-#include "log.hpp"
-#include "molecule.hpp"
-#include "verbose.hpp"
-#include "World.hpp"
-
-#include <iostream>
-#include <string>
-
-using namespace std;
-
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/MapOfActions.hpp"
-
-const char AnalysisPairCorrelationToSurfaceAction::NAME[] = "pair-correlation-surface";
-
-AnalysisPairCorrelationToSurfaceAction::AnalysisPairCorrelationToSurfaceAction() :
-  Action(NAME)
-{}
-
-AnalysisPairCorrelationToSurfaceAction::~AnalysisPairCorrelationToSurfaceAction()
-{}
-
-Action::state_ptr AnalysisPairCorrelationToSurfaceAction::performCall() {
-  Dialog *dialog = UIFactory::getInstance().makeDialog();
-  double BinStart = 0.;
-  double BinWidth = 0.;
-  double BinEnd = 0.;
-  string outputname;
-  string binoutputname;
-  bool periodic;
-  ofstream output;
-  ofstream binoutput;
-  int ranges[3] = {1, 1, 1};
-  const element *elemental = NULL;
-  molecule *Boundary = NULL;
-
-  dialog->queryElement("elements", &elemental, MapOfActions::getInstance().getDescription("element"));
-  dialog->queryMolecule("molecule-by-id", &Boundary, MapOfActions::getInstance().getDescription("molecule-by-id"));
-  dialog->queryDouble("bin-start", &BinStart, MapOfActions::getInstance().getDescription("bin-start"));
-  dialog->queryDouble("bin-end", &BinEnd, MapOfActions::getInstance().getDescription("bin-end"));
-  dialog->queryString("output-file", &outputname, MapOfActions::getInstance().getDescription("output-file"));
-  dialog->queryString("bin-output-file", &binoutputname, MapOfActions::getInstance().getDescription("bin-output-file"));
-  dialog->queryBoolean("periodic", &periodic, MapOfActions::getInstance().getDescription("periodic"));
-
-  if(dialog->display()) {
-    output.open(outputname.c_str());
-    binoutput.open(binoutputname.c_str());
-    const double radius = 4.;
-    double LCWidth = 20.;
-    if (BinEnd > 0) {
-      if (BinEnd > 2.*radius)
-          LCWidth = BinEnd;
-      else
-        LCWidth = 2.*radius;
-    }
-    class MoleculeListClass *molecules = World::getInstance().getMolecules();
-    class Tesselation *TesselStruct = NULL;
-    const LinkedCell *LCList = NULL;
-    LCList = new LinkedCell(Boundary, LCWidth);
-    FindNonConvexBorder(Boundary, TesselStruct, LCList, radius, NULL);
-    CorrelationToSurfaceMap *surfacemap = NULL;
-    if (periodic)
-      surfacemap = PeriodicCorrelationToSurface( molecules, elemental, TesselStruct, LCList, ranges);
-    else
-      surfacemap = CorrelationToSurface( molecules, elemental, TesselStruct, LCList);
-    OutputCorrelationToSurface(&output, surfacemap);
-    // check whether radius was appropriate
-    {
-      double start; double end;
-      GetMinMax( surfacemap, start, end);
-      if (LCWidth < end)
-        DoeLog(1) && (eLog()<< Verbose(1) << "Linked Cell width is smaller than the found range of values! Bins can only be correct up to: " << radius << "." << endl);
-    }
-    BinPairMap *binmap = BinData( surfacemap, BinWidth, BinStart, BinEnd );
-    OutputCorrelation ( &binoutput, binmap );
-    output.close();
-    binoutput.close();
-    delete(LCList);
-    delete(TesselStruct);
-    delete(binmap);
-    delete(surfacemap);
-    delete dialog;
-    return Action::success;
-  } else {
-    delete dialog;
-    return Action::failure;
-  }
-}
-
-Action::state_ptr AnalysisPairCorrelationToSurfaceAction::performUndo(Action::state_ptr _state) {
-//  ParserLoadXyzState *state = assert_cast<ParserLoadXyzState*>(_state.get());
-
-  return Action::failure;
-//  string newName = state->mol->getName();
-//  state->mol->setName(state->lastName);
-//
-//  return Action::state_ptr(new ParserLoadXyzState(state->mol,newName));
-}
-
-Action::state_ptr AnalysisPairCorrelationToSurfaceAction::performRedo(Action::state_ptr _state){
-  return Action::failure;
-}
-
-bool AnalysisPairCorrelationToSurfaceAction::canUndo() {
-  return false;
-}
-
-bool AnalysisPairCorrelationToSurfaceAction::shouldUndo() {
-  return false;
-}
-
-const string AnalysisPairCorrelationToSurfaceAction::getName() {
-  return NAME;
-}
Index: src/Actions/AnalysisAction/PairCorrelationToSurfaceAction.hpp
===================================================================
--- src/Actions/AnalysisAction/PairCorrelationToSurfaceAction.hpp	(revision 97ebf8b2670d891c06f34ede7594c6708e07d886)
+++ 	(revision )
@@ -1,30 +1,0 @@
-/*
- * PairCorrelationToSurfaceAction.hpp
- *
- *  Created on: May 9, 2010
- *      Author: heber
- */
-
-#ifndef PAIRCORRELATIONTOSURFACEACTION_HPP_
-#define PAIRCORRELATIONTOSURFACEACTION_HPP_
-
-#include "Actions/Action.hpp"
-
-class AnalysisPairCorrelationToSurfaceAction : public Action {
-public:
-  AnalysisPairCorrelationToSurfaceAction();
-  virtual ~AnalysisPairCorrelationToSurfaceAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
-
-#endif /* PAIRCORRELATIONTOSURFACEACTION_HPP_ */
