Index: src/Fragmentation/Automation/MPQCFragmentController.cpp
===================================================================
--- src/Fragmentation/Automation/MPQCFragmentController.cpp	(revision e089fbaabf7b14c1e7537a12eb9d4165c7c20822)
+++ src/Fragmentation/Automation/MPQCFragmentController.cpp	(revision 3d9a8d42283c7e552de1b62b094fae5646d71ce4)
@@ -96,7 +96,8 @@
   M *= 1./AtomicLengthToAngstroem;  // scale to atomic length units
   const double size = M.at(0,0);
+  double end[NDIM] = { size, size, size };
   ASSERT( M.determinant() == size*size*size,
       "parsejob() - current domain matrix "+toString(M)+" is not cubic.");
-  FragmentJob::ptr testJob( new MPQCJob(nextid, output, begin, size, level) );
+  FragmentJob::ptr testJob( new MPQCJob(nextid, output, begin, end, level) );
   jobs.push_back(testJob);
   file.close();
Index: src/Jobs/Grid/SamplingGrid.cpp
===================================================================
--- src/Jobs/Grid/SamplingGrid.cpp	(revision e089fbaabf7b14c1e7537a12eb9d4165c7c20822)
+++ src/Jobs/Grid/SamplingGrid.cpp	(revision 3d9a8d42283c7e552de1b62b094fae5646d71ce4)
@@ -46,8 +46,8 @@
 
 SamplingGrid::SamplingGrid(const double _begin[3],
-    const double _size,
+    const double _end[3],
     const int _level,
     const sampledvalues_t &_sampled_grid) :
-  SamplingGridProperties(_begin, _size, _level),
+  SamplingGridProperties(_begin, _end, _level),
   sampled_grid(_sampled_grid)
 {}
@@ -110,8 +110,16 @@
 }
 
+double SamplingGrid::getVolume() const
+{
+  double volume = 1.;
+  for (size_t i=0;i<3;++i)
+    volume *= end[i]-begin[i];
+  return volume;
+}
+
 double SamplingGrid::integral() const
 {
   const size_t gridpoints = pow(2, level);
-  const double volume_element = pow(size/(double)gridpoints, 3);
+  const double volume_element = getVolume()/pow((double)gridpoints, 3);
   double int_value = 0.;
   for (sampledvalues_t::const_iterator iter = sampled_grid.begin();
@@ -128,5 +136,5 @@
   if (isCompatible(weight)) {
     const size_t gridpoints = pow(2, level);
-    const double volume_element = pow(size/(double)gridpoints, 3);
+    const double volume_element = getVolume()/pow((double)gridpoints, 3);
     double int_value = 0.;
     sampledvalues_t::const_iterator iter = sampled_grid.begin();
@@ -144,5 +152,5 @@
 {
   ost << "SamplingGrid starting at " << other.begin[0] << "," << other.begin[1] << "," << other.begin[2];
-  ost << ", size of " << other.size;
+  ost << ", ending at " << other.end[0] << "," << other.end[1] << "," << other.end[2];
   ost << ", level of " << other.level;
   ost << " and integrated value of " << other.integral();
Index: src/Jobs/Grid/SamplingGrid.hpp
===================================================================
--- src/Jobs/Grid/SamplingGrid.hpp	(revision e089fbaabf7b14c1e7537a12eb9d4165c7c20822)
+++ src/Jobs/Grid/SamplingGrid.hpp	(revision 3d9a8d42283c7e552de1b62b094fae5646d71ce4)
@@ -27,4 +27,6 @@
 /** This class stores a sample function on a three-dimensional grid.
  *
+ *  \note We do not use boost::multi_array because it is not trivial to serialize.
+ *
  */
 class SamplingGrid : public SamplingGridProperties
@@ -40,11 +42,11 @@
   /** Constructor for class SamplingGrid.
    *
-   * \param _begin offset for grid
-   * \param _size edge length of grid
-   * \param _level number of grid points in \f$2^{\text{level}}\f$
+   * \param _begin offset for grid per axis
+   * \param _end edge length of grid per axis
+   * \param _level number of grid points in \f$2^{\mathrm{level}}\f$
    * \param _sampled_grid sample points
    */
   SamplingGrid(const double _begin[3],
-      const double _size,
+      const double _end[3],
       const int _level,
       const sampledvalues_t &_sampled_grid);
@@ -127,4 +129,10 @@
 
 private:
+  /** Returns the volume of the domain for this sampled function.
+   *
+   * @return volume
+   */
+  double getVolume() const;
+
   /** Helper function that contains all the logic of how to superpose two
    * grids.
Index: src/Jobs/Grid/SamplingGridProperties.cpp
===================================================================
--- src/Jobs/Grid/SamplingGridProperties.cpp	(revision e089fbaabf7b14c1e7537a12eb9d4165c7c20822)
+++ src/Jobs/Grid/SamplingGridProperties.cpp	(revision 3d9a8d42283c7e552de1b62b094fae5646d71ce4)
@@ -44,27 +44,30 @@
 SamplingGridProperties::SamplingGridProperties(
     const double _begin[3],
-    const double _size,
+    const double _end[3],
     const int _level) :
-  size(_size),
   level(_level)
 {
-  for(size_t i=0; i<3; ++i)
+  for(size_t i=0; i<3; ++i) {
     begin[i] = _begin[i];
+    end[i] = _end[i];
+  }
 }
 
 SamplingGridProperties::SamplingGridProperties(const SamplingGridProperties &_props) :
-  size(_props.size),
   level(_props.level)
 {
-  for(size_t i=0; i<3; ++i)
+  for(size_t i=0; i<3; ++i) {
     begin[i] = _props.begin[i];
+    end[i] = _props.end[i];
+  }
 }
 
 SamplingGridProperties::SamplingGridProperties() :
-  size(0.),
   level(0)
 {
-  for(size_t i=0; i<3; ++i)
+  for(size_t i=0; i<3; ++i) {
     begin[i] = 0.;
+    end[i] = 0.;
+  }
 }
 
@@ -72,10 +75,24 @@
 {}
 
+SamplingGridProperties& SamplingGridProperties::operator=(const SamplingGridProperties& other)
+{
+  // check for self-assignment
+  if (this != &other) {
+    for(size_t index=0; index<3; ++index) {
+      begin[index] = other.begin[index];
+      end[index] = other.end[index];
+    }
+    level = other.level;
+  }
+  return *this;
+}
+
 bool SamplingGridProperties::operator==(const SamplingGridProperties &_props) const
 {
   bool status = true;
-  for (size_t i=0; i<3; ++i)
+  for (size_t i=0; i<3; ++i) {
     status &= begin[i] == _props.begin[i];
-  status &= size == _props.size;
+    status &= end[i] == _props.end[i];
+  }
   status &= level == _props.level;
   return status;
Index: src/Jobs/Grid/SamplingGridProperties.hpp
===================================================================
--- src/Jobs/Grid/SamplingGridProperties.hpp	(revision e089fbaabf7b14c1e7537a12eb9d4165c7c20822)
+++ src/Jobs/Grid/SamplingGridProperties.hpp	(revision 3d9a8d42283c7e552de1b62b094fae5646d71ce4)
@@ -25,10 +25,10 @@
    *
    * \param _begin offset of grid
-   * \param _size edge length of cubic(!) domain
-   * \param _level number of gridpoints as \f$2^{\text{level}}\f$
+   * \param _end edge length per axis
+   * \param _level number of gridpoints as \f$2^{\mathrm{level}}\f$ per unit(!) length
    */
   SamplingGridProperties(
       const double _begin[3],
-      const double _size,
+      const double _end[3],
       const int _level);
 
@@ -55,4 +55,10 @@
   }
 
+  /** Assignment operator.
+   *
+   * \param other other instance to assign ourselves to
+   */
+  SamplingGridProperties& operator=(const SamplingGridProperties& other);
+
   /** Equality operator for class SamplingGridProperties.
    *
@@ -73,7 +79,7 @@
   //!> offset of grid
   double begin[3];
-  //!> size of grid, i.e. edge length of cubic(!) domain
-  double size;
-  //!> level, i.e. \f$2^{\text{level}}\f$ grid points per axis
+  //!> size of grid, i.e. edge length per axis of domain
+  double end[3];
+  //!> level, i.e. \f$2^{\mathrm{level}}\f$ grid points per axis per unit(!) length
   int level;
 
@@ -88,5 +94,6 @@
     for (i=0; i<3; ++i)
       ar & begin[i];
-    ar & size;
+    for (i=0; i<3; ++i)
+      ar & end[i];
     ar & level;
   }
Index: src/Jobs/Grid/unittests/Makefile.am
===================================================================
--- src/Jobs/Grid/unittests/Makefile.am	(revision e089fbaabf7b14c1e7537a12eb9d4165c7c20822)
+++ src/Jobs/Grid/unittests/Makefile.am	(revision 3d9a8d42283c7e552de1b62b094fae5646d71ce4)
@@ -25,12 +25,20 @@
 SamplingGridPropertiesUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
 	../Jobs/Grid/unittests/SamplingGridPropertiesUnitTest.cpp \
-	../Jobs/Grid/unittests/SamplingGridPropertiesUnitTest.hpp
+	../Jobs/Grid/unittests/SamplingGridPropertiesUnitTest.hpp \
+	../Jobs/Grid/SamplingGridProperties.cpp \
+	../Jobs/Grid/SamplingGriPropertiesd.hpp
 SamplingGridPropertiesUnitTest_LDADD = ${JOBSGRIDLIBS}
 
 SamplingGridUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
 	../Jobs/Grid/unittests/SamplingGridUnitTest.cpp \
-	../Jobs/Grid/unittests/SamplingGridUnitTest.hpp
+	../Jobs/Grid/unittests/SamplingGridUnitTest.hpp \
+	../Jobs/Grid/SamplingGridProperties.cpp \
+	../Jobs/Grid/SamplingGriPropertiesd.hpp \
+	../Jobs/Grid/SamplingGrid.cpp \
+	../Jobs/Grid/SamplingGrid.hpp
+SamplingGridUnitTest_LDADD = \
+	${CodePatterns_LIBS} \
+	$(BOOST_LIB)
 
-SamplingGridUnitTest_LDADD = ${JOBSGRIDLIBS}
 
 #AUTOMAKE_OPTIONS = parallel-tests
Index: src/Jobs/Grid/unittests/SamplingGridPropertiesUnitTest.cpp
===================================================================
--- src/Jobs/Grid/unittests/SamplingGridPropertiesUnitTest.cpp	(revision e089fbaabf7b14c1e7537a12eb9d4165c7c20822)
+++ src/Jobs/Grid/unittests/SamplingGridPropertiesUnitTest.cpp	(revision 3d9a8d42283c7e552de1b62b094fae5646d71ce4)
@@ -60,5 +60,6 @@
   // create the grid
   const double begin[3] = { 0., 0., 0. };
-  props = new SamplingGridProperties(begin, 1., 2);
+  const double end[3] = { 1., 1., 1. };
+  props = new SamplingGridProperties(begin, end, 2);
 }
 
@@ -75,10 +76,12 @@
   const double begin[3] = { 0., 0., 0. };
   const double otherbegin[3] = { 1., 0.1, -0.5 };
+  const double end[3] = { 1., 1., 1. };
+  const double otherend[3] = { 2., 2., 2. };
 
   // create other props
-  SamplingGridProperties sameprops(begin, 1., 2);
-  SamplingGridProperties otherprops(otherbegin, 1., 2);
-  SamplingGridProperties anotherprops(begin, 2., 2);
-  SamplingGridProperties moreotherprops(begin, 1., 4);
+  SamplingGridProperties sameprops(begin, end, 2);
+  SamplingGridProperties otherprops(otherbegin, end, 2);
+  SamplingGridProperties anotherprops(begin, otherend, 2);
+  SamplingGridProperties moreotherprops(begin, end, 4);
 
   CPPUNIT_ASSERT( props->isCompatible(*props) );
@@ -99,10 +102,12 @@
   const double begin[3] = { 0., 0., 0. };
   const double otherbegin[3] = { 1., 0.1, -0.5 };
+  const double end[3] = { 1., 1., 1. };
+  const double otherend[3] = { 2., 2., 2. };
 
   // create other props
-  SamplingGridProperties sameprops(begin, 1., 2);
-  SamplingGridProperties otherprops(otherbegin, 1., 2);
-  SamplingGridProperties anotherprops(begin, 2., 2);
-  SamplingGridProperties moreotherprops(begin, 1., 4);
+  SamplingGridProperties sameprops(begin, end, 2);
+  SamplingGridProperties otherprops(otherbegin, end, 2);
+  SamplingGridProperties anotherprops(begin, otherend, 2);
+  SamplingGridProperties moreotherprops(begin, end, 4);
 
   CPPUNIT_ASSERT( *props == *props );
Index: src/Jobs/Grid/unittests/SamplingGridUnitTest.cpp
===================================================================
--- src/Jobs/Grid/unittests/SamplingGridUnitTest.cpp	(revision e089fbaabf7b14c1e7537a12eb9d4165c7c20822)
+++ src/Jobs/Grid/unittests/SamplingGridUnitTest.cpp	(revision 3d9a8d42283c7e552de1b62b094fae5646d71ce4)
@@ -56,4 +56,6 @@
 const double grid_value=1.;
 
+#define NUMBEROFSAMPLES(n) (size_t)(pow(pow(2,n),3))
+
 // Registers the fixture into the 'registry'
 CPPUNIT_TEST_SUITE_REGISTRATION( SamplingGridTest );
@@ -67,7 +69,8 @@
   // create the grid
   const double begin[3] = { 0., 0., 0. };
-  for (size_t i=0; i< pow(pow(2,2),3); ++i)
+  const double end[3] = { 1., 1., 1. };
+  for (size_t i=0; i< pow(1,3)*NUMBEROFSAMPLES(2); ++i)
     values += grid_value;
-  grid = new SamplingGrid(begin, 1., 2, values);
+  grid = new SamplingGrid(begin, end, 2, values);
   CPPUNIT_ASSERT_EQUAL( grid_value, *(grid->sampled_grid.begin()) );
 }
@@ -87,5 +90,6 @@
   // check illegal grid
   const double begin[3] = { 0., 0., 0. };
-  SamplingGridProperties illegal_props(begin, 2., 1);
+  const double end[3] = { 2., 2., 2. };
+  SamplingGridProperties illegal_props(begin, end, 1);
   CPPUNIT_ASSERT( !grid->isCompatible(illegal_props) );
   SamplingGrid::sampledvalues_t illegal_values;
@@ -94,4 +98,5 @@
   SamplingGrid illegal_grid(illegal_props, illegal_values);
 #ifndef NDEBUG
+  std::cout << "The following assertion is intended and does not indicate a failure of the test." << std::endl;
   CPPUNIT_ASSERT_THROW( *grid += illegal_grid, Assert::AssertionFailure );
 #else
@@ -105,4 +110,11 @@
 }
 
+/** UnitTest for getVolume_Test
+ */
+void SamplingGridTest::getVolume_Test()
+{
+  CPPUNIT_ASSERT_EQUAL( 1., grid->getVolume() );
+}
+
 /** UnitTest for operator+=()
  */
@@ -111,9 +123,10 @@
   // create other grid
   const double begin[3] = { 0., 0., 0. };
+  const double end[3] = { 1., 1., 1. };
   SamplingGrid::sampledvalues_t othervalues;
   const double othergrid_value = 1.5;
   for (size_t i=0; i< NUMBEROFSAMPLES(2); ++i)
     othervalues += othergrid_value;
-  SamplingGrid othergrid(begin, 1., 2, othervalues);
+  SamplingGrid othergrid(begin, end, 2, othervalues);
   CPPUNIT_ASSERT_EQUAL( othergrid_value, *(othergrid.sampled_grid.begin()) );
 
@@ -134,9 +147,10 @@
   // create other grid
   const double begin[3] = { 0., 0., 0. };
+  const double end[3] = { 1., 1., 1. };
   SamplingGrid::sampledvalues_t othervalues;
   const double othergrid_value = 1.5;
   for (size_t i=0; i< NUMBEROFSAMPLES(2); ++i)
     othervalues += othergrid_value;
-  SamplingGrid othergrid(begin, 1., 2, othervalues);
+  SamplingGrid othergrid(begin, end, 2, othervalues);
   CPPUNIT_ASSERT_EQUAL( othergrid_value, *(othergrid.sampled_grid.begin()) );
 
Index: src/Jobs/Grid/unittests/SamplingGridUnitTest.hpp
===================================================================
--- src/Jobs/Grid/unittests/SamplingGridUnitTest.hpp	(revision e089fbaabf7b14c1e7537a12eb9d4165c7c20822)
+++ src/Jobs/Grid/unittests/SamplingGridUnitTest.hpp	(revision 3d9a8d42283c7e552de1b62b094fae5646d71ce4)
@@ -27,4 +27,5 @@
     CPPUNIT_TEST ( operatorPlusEqual_Test );
     CPPUNIT_TEST ( operatorMinusEqual_Test );
+    CPPUNIT_TEST ( getVolume_Test );
     CPPUNIT_TEST_SUITE_END();
 
@@ -33,4 +34,5 @@
       void tearDown();
       void superposeOtherGrid_Test();
+      void getVolume_Test();
       void operatorPlusEqual_Test();
       void operatorMinusEqual_Test();
Index: src/Jobs/MPQCJob.cpp
===================================================================
--- src/Jobs/MPQCJob.cpp	(revision e089fbaabf7b14c1e7537a12eb9d4165c7c20822)
+++ src/Jobs/MPQCJob.cpp	(revision 3d9a8d42283c7e552de1b62b094fae5646d71ce4)
@@ -42,7 +42,10 @@
 
 #include "MPQCJob.hpp"
+
+#include <sstream>
+
+#include "CodePatterns/Assert.hpp"
 #include "Jobs/MPQCData.hpp"
 
-#include <sstream>
 
 MPQCJob::MPQCJob(
@@ -50,10 +53,13 @@
     const std::string &_inputfile,
     const double _begin[3],
-    const double _size,
+    const double _end[3],
     const int _level) :
   FragmentJob(_JobId),
   inputfile(_inputfile),
-  grid(_begin, _size, _level)
-{}
+  grid(_begin, _end, _level)
+{
+  ASSERT( (_end[0] == _end[1]) && (_end[0] == _end[2]),
+      "MPQCJob::MPQCJob() - box needs to be cubic.");
+}
 
 MPQCJob::MPQCJob() :
Index: src/Jobs/MPQCJob.hpp
===================================================================
--- src/Jobs/MPQCJob.hpp	(revision e089fbaabf7b14c1e7537a12eb9d4165c7c20822)
+++ src/Jobs/MPQCJob.hpp	(revision 3d9a8d42283c7e552de1b62b094fae5646d71ce4)
@@ -33,5 +33,5 @@
       const std::string &_inputfile,
       const double _begin[3],
-      const double _size,
+      const double _end[3],
       const int _level);
   virtual ~MPQCJob();
Index: src/Jobs/MPQCJob_binding.hpp
===================================================================
--- src/Jobs/MPQCJob_binding.hpp	(revision e089fbaabf7b14c1e7537a12eb9d4165c7c20822)
+++ src/Jobs/MPQCJob_binding.hpp	(revision 3d9a8d42283c7e552de1b62b094fae5646d71ce4)
@@ -24,5 +24,6 @@
   {
     const double begin[3] = { 0., 0., 0. };
-    MPQCJob job(1, "test.in", begin, 1., 2);
+    const double end[3] = { 1., 1., 1. };
+    MPQCJob job(1, "test.in", begin, end, 2);
   }
 }
Index: src/Jobs/VMGDebugGridJob.cpp
===================================================================
--- src/Jobs/VMGDebugGridJob.cpp	(revision e089fbaabf7b14c1e7537a12eb9d4165c7c20822)
+++ src/Jobs/VMGDebugGridJob.cpp	(revision 3d9a8d42283c7e552de1b62b094fae5646d71ce4)
@@ -138,5 +138,5 @@
       density_grid.level,
       Vector(density_grid.begin),
-      density_grid.size,
+      density_grid.end[0]-density_grid.begin[0],
       5);
   new LevelOperatorCS(Stencils::RestrictionFullWeight, Stencils::InterpolationTrilinear);
Index: src/Jobs/VMGJob.cpp
===================================================================
--- src/Jobs/VMGJob.cpp	(revision e089fbaabf7b14c1e7537a12eb9d4165c7c20822)
+++ src/Jobs/VMGJob.cpp	(revision 3d9a8d42283c7e552de1b62b094fae5646d71ce4)
@@ -215,5 +215,5 @@
       density_grid.level,
       Vector(density_grid.begin),
-      density_grid.size,
+      density_grid.end[0]-density_grid.begin[0],
       near_field_cells);
   new LevelOperatorCS(Stencils::RestrictionFullWeight, Stencils::InterpolationTrilinear);
