Index: src/Fragmentation/Exporters/unittests/Makefile.am
===================================================================
--- src/Fragmentation/Exporters/unittests/Makefile.am	(revision 98a293b9263c73baadd2152296722d9dd0d401e9)
+++ src/Fragmentation/Exporters/unittests/Makefile.am	(revision a1d1dd8b043f6987e14d6d37973e71bd8ccad587)
@@ -4,13 +4,16 @@
 FRAGMENTATIONEXPORTERSSOURCES = \
 	../Fragmentation/Exporters/unittests/HydrogenPoolUnitTest.cpp \
-	../Fragmentation/Exporters/unittests/SaturatedFragmentUnitTest.cpp
+	../Fragmentation/Exporters/unittests/SaturatedFragmentUnitTest.cpp \
+	../Fragmentation/Exporters/unittests/SaturationDistanceMaximizerUnitTest.cpp
 
 FRAGMENTATIONEXPORTERSTESTSHEADERS = \
 	../Fragmentation/Exporters/unittests/HydrogenPoolUnitTest.hpp \
-	../Fragmentation/Exporters/unittests/SaturatedFragmentUnitTest.hpp
+	../Fragmentation/Exporters/unittests/SaturatedFragmentUnitTest.hpp \
+	../Fragmentation/Exporters/unittests/SaturationDistanceMaximizerUnitTest.hpp
 
 FRAGMENTATIONEXPORTERSTESTS = \
 	HydrogenPoolUnitTest \
-	SaturatedFragmentUnitTest
+	SaturatedFragmentUnitTest \
+	SaturationDistanceMaximizerUnitTest
 
 TESTS += $(FRAGMENTATIONEXPORTERSTESTS)
@@ -37,4 +40,13 @@
 	$(top_builddir)/LinearAlgebra/src/LinearAlgebra/libLinearAlgebra.la \
 	${FRAGMENTATIONEXPORTERSLIBS}
+
+SaturationDistanceMaximizerUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
+	../Fragmentation/Exporters/unittests/SaturationDistanceMaximizerUnitTest.cpp \
+	../Fragmentation/Exporters/unittests/SaturationDistanceMaximizerUnitTest.hpp \
+	../Fragmentation/Exporters/unittests/stubs/SaturatedBondStub.cpp
+SaturationDistanceMaximizerUnitTest_LDADD = \
+	../libMolecuilderUI.la  \
+	$(top_builddir)/LinearAlgebra/src/LinearAlgebra/libLinearAlgebra.la \
+	${FRAGMENTATIONEXPORTERSLIBS}
 	
 
Index: src/Fragmentation/Exporters/unittests/SaturationDistanceMaximizerUnitTest.cpp
===================================================================
--- src/Fragmentation/Exporters/unittests/SaturationDistanceMaximizerUnitTest.cpp	(revision a1d1dd8b043f6987e14d6d37973e71bd8ccad587)
+++ src/Fragmentation/Exporters/unittests/SaturationDistanceMaximizerUnitTest.cpp	(revision a1d1dd8b043f6987e14d6d37973e71bd8ccad587)
@@ -0,0 +1,137 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2014 Frederik Heber. All rights reserved.
+ * 
+ *
+ *   This file is part of MoleCuilder.
+ *
+ *    MoleCuilder is free software: you can redistribute it and/or modify
+ *    it under the terms of the GNU General Public License as published by
+ *    the Free Software Foundation, either version 2 of the License, or
+ *    (at your option) any later version.
+ *
+ *    MoleCuilder is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *    GNU General Public License for more details.
+ *
+ *    You should have received a copy of the GNU General Public License
+ *    along with MoleCuilder.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * SaturationDistanceMaximizerUnitTest.cpp
+ *
+ *  Created on: Aug 09, 2012
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+using namespace std;
+
+#include <cppunit/CompilerOutputter.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+#include <cppunit/ui/text/TestRunner.h>
+
+// include headers that implement a archive in simple text format
+#include <boost/archive/text_oarchive.hpp>
+#include <boost/archive/text_iarchive.hpp>
+
+#include "SaturationDistanceMaximizerUnitTest.hpp"
+
+#include <algorithm>
+#include <gsl/gsl_vector.h>
+
+#include "CodePatterns/Assert.hpp"
+
+#include "Atom/atom.hpp"
+#include "Atom/AtomObserver.hpp"
+#include "Bond/bond.hpp"
+#include "Fragmentation/Exporters/SaturatedBond.hpp"
+#include "World.hpp"
+
+#ifdef HAVE_TESTRUNNER
+#include "UnitTestMain.hpp"
+#endif /*HAVE_TESTRUNNER*/
+
+/********************************************** Test classes **************************************/
+
+// Registers the fixture into the 'registry'
+CPPUNIT_TEST_SUITE_REGISTRATION( SaturationDistanceMaximizerTest );
+
+
+void SaturationDistanceMaximizerTest::setUp()
+{
+  // failing asserts should be thrown
+  ASSERT_DO(Assert::Throw);
+}
+
+
+void SaturationDistanceMaximizerTest::tearDown()
+{
+  World::purgeInstance();
+  AtomObserver::purgeInstance();
+}
+
+size_t SaturationDistanceMaximizerTest::MaxAtoms = 5;
+
+/** UnitTest for operator() when there is nothing to do
+ */
+void SaturationDistanceMaximizerTest::identityTest()
+{
+  // prepare SaturatedBonds each with degree one
+  atomVector.resize((size_t)MaxAtoms);
+  std::generate_n(atomVector.begin(), MaxAtoms,
+      boost::bind(&World::createAtom, boost::ref(World::getInstance())));
+  std::list<bond*> bondVector;
+  SaturationDistanceMaximizer::PositionContainers_t PositionContainers;
+  for (unsigned int i=1;i<MaxAtoms;++i) {
+    bondVector.push_back( new bond(atomVector.front(), atomVector[i], 1));
+    PositionContainers.push_back( boost::shared_ptr<SaturatedBond>(
+        new SaturatedBond(*bondVector.back(), *atomVector.front()))
+        );
+  }
+
+  {
+    SaturationDistanceMaximizer maximizer(PositionContainers);
+    gsl_vector *zero = gsl_vector_calloc(PositionContainers.size());
+    maximizer.setAlphas(zero);
+    gsl_vector_free(zero);
+
+    // and check that all alphas are the zero
+    {
+      std::vector<double> alphas = maximizer.getAlphas();
+      const double result = std::accumulate(alphas.begin(), alphas.end(), 0.);
+      CPPUNIT_ASSERT_EQUAL( 0., result );
+    }
+
+    // then maximize: does nothing as bond degrees are all 1
+    maximizer();
+
+    // and check that all alphas are the zero
+    {
+      std::vector<double> alphas = maximizer.getAlphas();
+      const double result = std::accumulate(alphas.begin(), alphas.end(), 0.);
+      CPPUNIT_ASSERT_EQUAL( 0., result );
+    }
+  }
+
+  // free all memory
+  PositionContainers.clear();
+  for (std::list<bond*>::iterator iter = bondVector.begin(); iter != bondVector.end();
+      ++iter) {
+    (*iter)->leftatom = NULL;
+    (*iter)->rightatom = NULL;
+    delete *iter;
+  }
+  bondVector.clear();
+  for (std::vector<atom *>::iterator iter = atomVector.begin(); iter != atomVector.end();
+      ++iter)
+    World::getInstance().destroyAtom(*iter);
+  atomVector.clear();
+}
Index: src/Fragmentation/Exporters/unittests/SaturationDistanceMaximizerUnitTest.hpp
===================================================================
--- src/Fragmentation/Exporters/unittests/SaturationDistanceMaximizerUnitTest.hpp	(revision a1d1dd8b043f6987e14d6d37973e71bd8ccad587)
+++ src/Fragmentation/Exporters/unittests/SaturationDistanceMaximizerUnitTest.hpp	(revision a1d1dd8b043f6987e14d6d37973e71bd8ccad587)
@@ -0,0 +1,43 @@
+/*
+ * SaturationDistanceMaximizerUnitTest.hpp
+ *
+ *  Created on: Jul 28, 2014
+ *      Author: heber
+ */
+
+#ifndef SATURATIONDISTANCEMAXIMIZERUNITTEST_HPP_
+#define SATURATIONDISTANCEMAXIMIZERUNITTEST_HPP_
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+
+#include <cppunit/extensions/HelperMacros.h>
+
+#include "Fragmentation/Exporters/SaturationDistanceMaximizer.hpp"
+
+#include <vector>
+
+class atom;
+
+/********************************************** Test classes **************************************/
+
+class SaturationDistanceMaximizerTest : public CppUnit::TestFixture
+{
+    CPPUNIT_TEST_SUITE( SaturationDistanceMaximizerTest) ;
+    CPPUNIT_TEST ( identityTest );
+    CPPUNIT_TEST_SUITE_END();
+
+public:
+      void setUp();
+      void tearDown();
+      void identityTest();
+
+private:
+      std::vector<atom *> atomVector;
+      static size_t MaxAtoms;
+};
+
+#endif /* SATURATIONDISTANCEMAXIMIZERUNITTEST_HPP_ */
Index: src/Fragmentation/Exporters/unittests/stubs/SaturatedBondStub.cpp
===================================================================
--- src/Fragmentation/Exporters/unittests/stubs/SaturatedBondStub.cpp	(revision a1d1dd8b043f6987e14d6d37973e71bd8ccad587)
+++ src/Fragmentation/Exporters/unittests/stubs/SaturatedBondStub.cpp	(revision a1d1dd8b043f6987e14d6d37973e71bd8ccad587)
@@ -0,0 +1,73 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2014 Frederik Heber. All rights reserved.
+ *
+ *
+ *   This file is part of MoleCuilder.
+ *
+ *    MoleCuilder is free software: you can redistribute it and/or modify
+ *    it under the terms of the GNU General Public License as published by
+ *    the Free Software Foundation, either version 2 of the License, or
+ *    (at your option) any later version.
+ *
+ *    MoleCuilder is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *    GNU General Public License for more details.
+ *
+ *    You should have received a copy of the GNU General Public License
+ *    along with MoleCuilder.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * SaturatedBondStub.cpp
+ *
+ *  Created on: Jul 28, 2014
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "CodePatterns/MemDebug.hpp"
+
+#include "Fragmentation/Exporters/SaturatedBond.hpp"
+
+#include "Atom/atom.hpp"
+
+SaturatedBond::SaturatedBond(
+    const bond &_bond,
+    const atom& _remaining) :
+    saturated_bond(_bond),
+    saturated_atom(_remaining)
+{
+  switch (_remaining.getId()) {
+  case 0:
+     BondVector = Vector(0.,0.,0.);
+     break;
+  case 1:
+     BondVector = Vector(1.,0.,0.);
+     break;
+  case 2:
+     BondVector = Vector(-1.,0.,0.);
+     break;
+  case 3:
+     BondVector = Vector(0.,1.,0.);
+     break;
+  case 4:
+     BondVector = Vector(0.,-1.,0.);
+     break;
+  }
+  vector_a.Zero();
+  vector_b.Zero();
+}
+
+std::vector<Vector> SaturatedBond::getPositions() const
+{
+  std::vector<Vector> positions;
+  positions.push_back(BondVector);
+  return positions;
+}
