Index: src/VectorSet.cpp
===================================================================
--- src/VectorSet.cpp	(revision 9f3b85ca21f1768f8726e03a5aba27f042618333)
+++ src/VectorSet.cpp	(revision 9f3b85ca21f1768f8726e03a5aba27f042618333)
@@ -0,0 +1,19 @@
+/*
+ * VectorSet.cpp
+ *
+ *  Created on: Jun 2, 2010
+ *      Author: crueger
+ */
+
+#include "VectorSet.hpp"
+
+VectorSet::VectorSet()
+{
+  // TODO Auto-generated constructor stub
+
+}
+
+VectorSet::~VectorSet()
+{
+  // TODO Auto-generated destructor stub
+}
Index: src/VectorSet.hpp
===================================================================
--- src/VectorSet.hpp	(revision 9f3b85ca21f1768f8726e03a5aba27f042618333)
+++ src/VectorSet.hpp	(revision 9f3b85ca21f1768f8726e03a5aba27f042618333)
@@ -0,0 +1,54 @@
+/*
+ * VectorSet.hpp
+ *
+ *  Created on: Jun 2, 2010
+ *      Author: crueger
+ */
+
+#ifndef VECTORSET_HPP_
+#define VECTORSET_HPP_
+
+
+#include <functional>
+#include <algorithm>
+
+/**
+ * A simple mixin to give any STL conforming structure fast Vector abilities
+ *
+ * TODO: make this work for maps
+ */
+
+class Vector;
+
+// this tests, whether we actually have a Vector
+template <class V>
+struct is_vector{};
+
+template <>
+struct is_vector<Vector>{
+  typedef void wrong_type;
+};
+
+template <class Set>
+class VectorSet : public Set
+{
+  // when our set carries something besides a vector this will produce an error
+  typedef typename is_vector<typename Set::value_type>::wrong_type check_for_vector;
+public:
+  // typedefs for STL conforming structure
+  typedef typename Set::iterator iterator;
+  typedef typename Set::const_iterator const_iterator;
+
+  VectorSet(){}
+  virtual ~VectorSet(){}
+
+  /**
+   * translate all Vectors within this set by a specified amount
+   */
+  void translate(const Vector &translater){
+    // this is needed to allow template lookup
+    transform(this->begin(),this->end(),this->begin(),bind1st(plus<Vector>(),translater));
+  }
+};
+
+#endif /* VECTORSET_HPP_ */
Index: src/atom_trajectoryparticleinfo.hpp
===================================================================
--- src/atom_trajectoryparticleinfo.hpp	(revision b47bfce85c995a562a7a73f752c8e74cc40cc9de)
+++ src/atom_trajectoryparticleinfo.hpp	(revision 9f3b85ca21f1768f8726e03a5aba27f042618333)
@@ -21,4 +21,5 @@
 
 #include "vector.hpp"
+#include "VectorSet.hpp"
 
 /********************************************** declarations *******************************/
@@ -28,7 +29,7 @@
   struct
   {
-    vector<Vector> R;  //!< position vector
-    vector<Vector> U;  //!< velocity vector
-    vector<Vector> F;  //!< last force vector
+    VectorSet<vector<Vector> > R;  //!< position vector
+    VectorSet<vector<Vector> > U;  //!< velocity vector
+    VectorSet<vector<Vector> > F;  //!< last force vector
   } Trajectory;
   int FixedIon;   //!< config variable that states whether forces act on the ion or not
Index: src/gslvector.cpp
===================================================================
--- src/gslvector.cpp	(revision b47bfce85c995a562a7a73f752c8e74cc40cc9de)
+++ src/gslvector.cpp	(revision 9f3b85ca21f1768f8726e03a5aba27f042618333)
@@ -13,4 +13,5 @@
 #include "gslvector.hpp"
 #include "defs.hpp"
+#include "vector.hpp"
 
 /** Constructor of class GSLVector.
@@ -61,4 +62,13 @@
   gsl_vector_memcpy (vector, &m.vector);
 };
+
+/**
+ * This function sets the GSLvector from an ordinary vector.
+ *
+ * Takes access to the internal gsl_vector and copies it
+ */
+void GSLVector::SetFromVector(Vector &v){
+  gsl_vector_memcpy (vector, v.get());
+}
 
 /** This function returns the i-th element of a vector.
Index: src/gslvector.hpp
===================================================================
--- src/gslvector.hpp	(revision b47bfce85c995a562a7a73f752c8e74cc40cc9de)
+++ src/gslvector.hpp	(revision 9f3b85ca21f1768f8726e03a5aba27f042618333)
@@ -24,4 +24,5 @@
 
 class GSLVector;
+class Vector;
 
 /********************************************** declarations *******************************/
@@ -38,4 +39,5 @@
   // Accessing
   void SetFromDoubleArray(double *x);
+  void SetFromVector(Vector &v);
   double Get(size_t m) const;
   void Set(size_t m, double x);
Index: src/linearsystemofequations.cpp
===================================================================
--- src/linearsystemofequations.cpp	(revision b47bfce85c995a562a7a73f752c8e74cc40cc9de)
+++ src/linearsystemofequations.cpp	(revision 9f3b85ca21f1768f8726e03a5aba27f042618333)
@@ -56,5 +56,5 @@
 {
   assert ( columns == NDIM && "Vector class is always three-dimensional, unlike this LEqS!");
-  b->SetFromDoubleArray(x->get());
+  b->SetFromVector(*x);
 };
 
Index: src/vector.cpp
===================================================================
--- src/vector.cpp	(revision b47bfce85c995a562a7a73f752c8e74cc40cc9de)
+++ src/vector.cpp	(revision 9f3b85ca21f1768f8726e03a5aba27f042618333)
@@ -24,5 +24,5 @@
 Vector::Vector()
 {
-  x[0] = x[1] = x[2] = 0.;
+  content = gsl_vector_calloc (NDIM);
 };
 
@@ -33,7 +33,8 @@
 Vector::Vector(const Vector& src)
 {
-  x[0] = src[0];
-  x[1] = src[1];
-  x[2] = src[2];
+  content = gsl_vector_alloc(NDIM);
+  gsl_vector_set(content,0,src[0]);
+  gsl_vector_set(content,1,src[1]);
+  gsl_vector_set(content,2,src[2]);
 }
 
@@ -42,7 +43,8 @@
 Vector::Vector(const double x1, const double x2, const double x3)
 {
-  x[0] = x1;
-  x[1] = x2;
-  x[2] = x3;
+  content = gsl_vector_alloc(NDIM);
+  gsl_vector_set(content,0,x1);
+  gsl_vector_set(content,1,x2);
+  gsl_vector_set(content,2,x3);
 };
 
@@ -53,7 +55,7 @@
   // check for self assignment
   if(&src!=this){
-    x[0] = src[0];
-    x[1] = src[1];
-    x[2] = src[2];
+    gsl_vector_set(content,0,src[0]);
+    gsl_vector_set(content,1,src[1]);
+    gsl_vector_set(content,2,src[2]);
   }
   return *this;
@@ -62,5 +64,7 @@
 /** Desctructor of class vector.
  */
-Vector::~Vector() {};
+Vector::~Vector() {
+  gsl_vector_free(content);
+};
 
 /** Calculates square of distance between this and another vector.
@@ -72,5 +76,5 @@
   double res = 0.;
   for (int i=NDIM;i--;)
-    res += (x[i]-y[i])*(x[i]-y[i]);
+    res += (at(i)-y[i])*(at(i)-y[i]);
   return (res);
 };
@@ -200,5 +204,5 @@
   double res = 0.;
   for (int i=NDIM;i--;)
-    res += x[i]*y[i];
+    res += at(i)*y[i];
   return (res);
 };
@@ -214,7 +218,6 @@
 {
   Vector tmp;
-  tmp[0] = x[1]* y[2] - x[2]* y[1];
-  tmp[1] = x[2]* y[0] - x[0]* y[2];
-  tmp[2] = x[0]* y[1] - x[1]* y[0];
+  for(int i=NDIM;i--;)
+    tmp[i] = at((i+1)%NDIM)*y[(i+2)%NDIM] - at((i+2)%NDIM)*y[(i+1)%NDIM];
   (*this) = tmp;
 };
@@ -309,5 +312,5 @@
 bool Vector::IsZero() const
 {
-  return (fabs(x[0])+fabs(x[1])+fabs(x[2]) < MYEPSILON);
+  return (fabs(at(0))+fabs(at(1))+fabs(at(2)) < MYEPSILON);
 };
 
@@ -338,5 +341,5 @@
   bool status = true;
   for (int i=0;i<NDIM;i++) {
-    if (fabs(x[i] - a[i]) > MYEPSILON)
+    if (fabs(at(i) - a[i]) > MYEPSILON)
       status = false;
   }
@@ -366,10 +369,10 @@
 double& Vector::operator[](size_t i){
   ASSERT(i<=NDIM && i>=0,"Vector Index out of Range");
-  return x[i];
+  return *gsl_vector_ptr (content, i);
 }
 
 const double& Vector::operator[](size_t i) const{
   ASSERT(i<=NDIM && i>=0,"Vector Index out of Range");
-  return x[i];
+  return *gsl_vector_ptr (content, i);
 }
 
@@ -382,6 +385,6 @@
 }
 
-double* Vector::get(){
-  return x;
+gsl_vector* Vector::get(){
+  return content;
 }
 
@@ -498,5 +501,5 @@
 {
   for (int i=NDIM;i--;)
-    x[i] *= factor[i];
+    at(i) *= factor[i];
 };
 
@@ -506,5 +509,5 @@
 {
   for (int i=NDIM;i--;)
-    x[i] *= factor;
+    at(i) *= factor;
 };
 
@@ -518,9 +521,9 @@
   // truncate to [0,1] for each axis
   for (int i=0;i<NDIM;i++) {
-    //x[i] += 0.5;  // set to center of box
-    while (x[i] >= 1.)
-      x[i] -= 1.;
-    while (x[i] < 0.)
-      x[i] += 1.;
+    //at(i) += 0.5;  // set to center of box
+    while (at(i) >= 1.)
+      at(i) -= 1.;
+    while (at(i) < 0.)
+      at(i) += 1.;
   }
   MatrixMultiplication(M);
@@ -549,8 +552,10 @@
 void Vector::MatrixMultiplication(const double * const M)
 {
+  Vector tmp;
   // do the matrix multiplication
-  at(0) = M[0]*x[0]+M[3]*x[1]+M[6]*x[2];
-  at(1) = M[1]*x[0]+M[4]*x[1]+M[7]*x[2];
-  at(2) = M[2]*x[0]+M[5]*x[1]+M[8]*x[2];
+  for(int i=NDIM;i--;)
+    tmp[i] = M[i]*at(0)+M[i+3]*at(1)+M[i+6]*at(2);
+
+  (*this) = tmp;
 };
 
@@ -577,8 +582,5 @@
     B[8] =  detAReci*RDET2(A[0],A[1],A[3],A[4]);    // A_33
 
-    // do the matrix multiplication
-    at(0) = B[0]*x[0]+B[3]*x[1]+B[6]*x[2];
-    at(1) = B[1]*x[0]+B[4]*x[1]+B[7]*x[2];
-    at(2) = B[2]*x[0]+B[5]*x[1]+B[8]*x[2];
+    MatrixMultiplication(B);
 
     return true;
@@ -616,5 +618,5 @@
   SubtractVector(x1);
   for (int i=NDIM;i--;)
-    result = result || (fabs(x[i]) > MYEPSILON);
+    result = result || (fabs(at(i)) > MYEPSILON);
 
   return result;
@@ -678,5 +680,5 @@
 {
   for(int i=NDIM;i--;)
-    x[i] += y[i];
+    at(i) += y[i];
 }
 
@@ -687,5 +689,5 @@
 {
   for(int i=NDIM;i--;)
-    x[i] -= y[i];
+    at(i) -= y[i];
 }
 
Index: src/vector.hpp
===================================================================
--- src/vector.hpp	(revision b47bfce85c995a562a7a73f752c8e74cc40cc9de)
+++ src/vector.hpp	(revision 9f3b85ca21f1768f8726e03a5aba27f042618333)
@@ -31,7 +31,4 @@
  */
 class Vector : public Space{
-protected:
-  // this struct is used to indicate calls to the Baseconstructor from inside vectors.
-  struct Baseconstructor{};
 public:
 
@@ -82,5 +79,5 @@
 
   // Access to internal structure
-  double* get();
+  gsl_vector* get();
 
   // Methods that are derived directly from other methods
@@ -107,5 +104,5 @@
 
 private:
-  double x[NDIM];
+  gsl_vector *content;
 
 };
