Index: src/Fragmentation/Summation/Makefile.am
===================================================================
--- src/Fragmentation/Summation/Makefile.am	(revision 30abdc71b9be0d957e3a2cbc4ed79217640753bb)
+++ src/Fragmentation/Summation/Makefile.am	(revision c508fea16569df9af0aa7ba2b7489419e3bb3698)
@@ -18,4 +18,5 @@
 	IndexSetContainer.hpp \
 	SetValue.hpp \
+	SetValueMap.hpp \
 	SortedVector.hpp \
 	SubsetMap.hpp
Index: src/Fragmentation/Summation/SetValueMap.hpp
===================================================================
--- src/Fragmentation/Summation/SetValueMap.hpp	(revision c508fea16569df9af0aa7ba2b7489419e3bb3698)
+++ src/Fragmentation/Summation/SetValueMap.hpp	(revision c508fea16569df9af0aa7ba2b7489419e3bb3698)
@@ -0,0 +1,95 @@
+/*
+ * SetValueMap.hpp
+ *
+ *  Created on: Jul 4, 2012
+ *      Author: heber
+ */
+
+#ifndef SETVALUEMAP_HPP_
+#define SETVALUEMAP_HPP_
+
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <map>
+
+#include "IndexSet.hpp"
+#include "SetValue.hpp"
+
+#include "CodePatterns/Assert.hpp"
+
+class SetValueMapTest;
+
+/** This class represents a map from IndexSet to SetValue<T>.
+ *
+ * Each SetValue knows its IndexSet but we also need the inverse
+ * association from IndexSet to SetValue.
+ *
+ */
+template <typename T>
+class SetValueMap
+{
+  //!> grant unit access
+  friend class SetValueMapTest;
+public:
+  /** Either adds a new SetValue<T> to the map or changes the value the present
+   * instance.
+   *
+   * @param ptr associated IndexSet
+   * @param _value new value of the SetValue
+   */
+  void addValue(const IndexSet::ptr& ptr, const T &_value) {
+    typename Lookup_t::iterator iter = Lookup.find(ptr);
+    if (iter != Lookup.end()) {
+      iter->second->setValue(_value);
+    } else {
+      Lookup.insert( std::make_pair( ptr, typename SetValue<T>::ptr(new SetValue<T>(ptr, _value)) ) );
+    }
+  }
+
+  /** Getter for the SetValue to a specific IndexSet.
+   *
+   * @param ptr IndexSet
+   * @return SetValue associated with this IndexSet
+   */
+  typename SetValue<T>::ptr & getValue(const IndexSet::ptr &ptr) {
+    ASSERT( isIndexSetPresent(ptr),
+        "SetValueMap<T>::getValue() - IndexSet "+toString(*ptr)+" is unknown.");
+    typename Lookup_t::iterator iter = Lookup.find(ptr);
+    ASSERT( *iter->second->getIndexSet() == *ptr,
+        "SetValueMap<T>::getValue() - returned SetValue associated to set "+
+        toString(*iter->second->getIndexSet())+"does not match with desired set "
+        +toString(*ptr)+".");
+    return iter->second;
+  }
+
+  bool removeValue(const IndexSet::ptr &ptr) {
+    if (isIndexSetPresent(ptr)) {
+      Lookup.erase(ptr);
+      return true;
+    } else {
+      return false;
+    }
+  }
+
+  /** Checks whether a given IndexSet \a ptr is known.
+   *
+   * @param ptr IndexSet to check
+   * @return true - set present, false - else
+   */
+  bool isIndexSetPresent(const IndexSet::ptr& ptr) const {
+    typename Lookup_t::const_iterator iter = Lookup.find(ptr);
+    return (iter != Lookup.end());
+  }
+
+private:
+  //!> typedef for the internal lookup
+  typedef std::map< IndexSet::ptr, typename SetValue<T>::ptr > Lookup_t;
+  //!> internal map to provide the lookup
+  Lookup_t Lookup;
+};
+
+#endif /* SETVALUEMAP_HPP_ */
Index: src/Fragmentation/Summation/unittests/Makefile.am
===================================================================
--- src/Fragmentation/Summation/unittests/Makefile.am	(revision 30abdc71b9be0d957e3a2cbc4ed79217640753bb)
+++ src/Fragmentation/Summation/unittests/Makefile.am	(revision c508fea16569df9af0aa7ba2b7489419e3bb3698)
@@ -11,4 +11,5 @@
 	../Fragmentation/unittests/IndexSetContainerUnitTest.cpp \
 	../Fragmentation/unittests/SetValueUnitTest.cpp \
+	../Fragmentation/unittests/SetValueMapUnitTest.cpp \
 	../Fragmentation/unittests/SubsetMapUnitTest.cpp
 
@@ -17,4 +18,5 @@
 	../Fragmentation/unittests/IndexSetContainerUnitTest.cpp \
 	../Fragmentation/unittests/SetValueUnitTest.hpp \
+	../Fragmentation/unittests/SetValueMapUnitTest.hpp \
 	../Fragmentation/unittests/SubsetMapUnitTest.hpp
 
@@ -23,4 +25,5 @@
   IndexSetContainerUnitTest \
   SetValueUnitTest \
+  SetValueMapUnitTest \
   SubsetMapUnitTest
 
@@ -60,4 +63,13 @@
 SetValueUnitTest_LDADD = ${FRAGMENTATIONSUMMATIONLIBS}
 
+SetValueMapUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
+	unittests/SetValueMapUnitTest.cpp \
+	unittests/SetValueMapUnitTest.hpp \
+	IndexSet.cpp \
+	IndexSet.hpp \
+	SetValue.hpp \
+	SetValueMap.hpp
+SetValueMapUnitTest_LDADD = ${FRAGMENTATIONSUMMATIONLIBS}
+
 SubsetMapUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
 	unittests/SubsetMapUnitTest.cpp \
Index: src/Fragmentation/Summation/unittests/SetValueMapUnitTest.cpp
===================================================================
--- src/Fragmentation/Summation/unittests/SetValueMapUnitTest.cpp	(revision c508fea16569df9af0aa7ba2b7489419e3bb3698)
+++ src/Fragmentation/Summation/unittests/SetValueMapUnitTest.cpp	(revision c508fea16569df9af0aa7ba2b7489419e3bb3698)
@@ -0,0 +1,116 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2012 University of Bonn. 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/>.
+ */
+
+/*
+ * SetValueMapUnitTest.cpp
+ *
+ *  Created on: Jul 4, 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 "Fragmentation/Summation/IndexSet.hpp"
+#include "Fragmentation/Summation/IndexSetContainer.hpp"
+#include "Fragmentation/Summation/SetValueMap.hpp"
+
+#include "SetValueMapUnitTest.hpp"
+
+#include <boost/assign.hpp>
+
+#ifdef HAVE_TESTRUNNER
+#include "UnitTestMain.hpp"
+#endif /*HAVE_TESTRUNNER*/
+
+using namespace boost::assign;
+
+/********************************************** Test classes **************************************/
+
+// Registers the fixture into the 'registry'
+CPPUNIT_TEST_SUITE_REGISTRATION( SetValueMapTest );
+
+
+void SetValueMapTest::setUp()
+{
+}
+
+
+void SetValueMapTest::tearDown()
+{
+}
+
+/** UnitTest for addValue()
+ */
+void SetValueMapTest::addValueTest()
+{
+  IndexSet::ptr set(new IndexSet);
+  *set += 1,2,3,4;
+  CPPUNIT_ASSERT_EQUAL( (size_t)0, setmap.Lookup.size() );
+  // adding once increases number of elements
+  setmap.addValue(set, 4);
+  CPPUNIT_ASSERT_EQUAL( (size_t)1, setmap.Lookup.size() );
+  // adding set again does not introduce new element
+  setmap.addValue(set, 5);
+  CPPUNIT_ASSERT_EQUAL( (size_t)1, setmap.Lookup.size() );
+}
+
+/** UnitTest for getValue()
+ */
+void SetValueMapTest::getValueTest()
+{
+  IndexSet::ptr set(new IndexSet);
+  *set += 1,2,3,4;
+  setmap.addValue(set, 4);
+  CPPUNIT_ASSERT_EQUAL( 4, setmap.getValue(set)->getValue() );
+  setmap.addValue(set, 5);
+  CPPUNIT_ASSERT_EQUAL( 5, setmap.getValue(set)->getValue() );
+}
+
+/** UnitTest for getValue()
+ */
+void SetValueMapTest::removeValueTest()
+{
+  IndexSet::ptr set(new IndexSet);
+  *set += 1,2,3,4;
+  IndexSet::ptr otherset(new IndexSet);
+  *set += 1,2,3;
+  setmap.addValue(set, 4);
+  CPPUNIT_ASSERT_EQUAL( (size_t)1, setmap.Lookup.size() );
+  // remove non-present set
+  CPPUNIT_ASSERT( !setmap.removeValue(otherset) );
+  CPPUNIT_ASSERT_EQUAL( (size_t)1, setmap.Lookup.size() );
+  // remove present value
+  CPPUNIT_ASSERT( setmap.removeValue(set) );
+  CPPUNIT_ASSERT_EQUAL( (size_t)0, setmap.Lookup.size() );
+  // re-add
+  setmap.addValue(set, 4);
+  CPPUNIT_ASSERT_EQUAL( (size_t)1, setmap.Lookup.size() );
+}
Index: src/Fragmentation/Summation/unittests/SetValueMapUnitTest.hpp
===================================================================
--- src/Fragmentation/Summation/unittests/SetValueMapUnitTest.hpp	(revision c508fea16569df9af0aa7ba2b7489419e3bb3698)
+++ src/Fragmentation/Summation/unittests/SetValueMapUnitTest.hpp	(revision c508fea16569df9af0aa7ba2b7489419e3bb3698)
@@ -0,0 +1,43 @@
+/*
+ * SetValueMapUnitTest.hpp
+ *
+ *  Created on: Jun 27, 2012
+ *      Author: heber
+ */
+
+#ifndef SETVALUEMAPUNITTEST_HPP_
+#define SETVALUEMAPUNITTEST_HPP_
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+
+#include <cppunit/extensions/HelperMacros.h>
+
+#include "Fragmentation/Summation/SetValueMap.hpp"
+
+/********************************************** Test classes **************************************/
+
+class SetValueMapTest : public CppUnit::TestFixture
+{
+    CPPUNIT_TEST_SUITE( SetValueMapTest) ;
+    CPPUNIT_TEST ( addValueTest );
+    CPPUNIT_TEST ( getValueTest );
+    CPPUNIT_TEST ( removeValueTest );
+    CPPUNIT_TEST_SUITE_END();
+
+public:
+      void setUp();
+      void tearDown();
+      void addValueTest();
+      void getValueTest();
+      void removeValueTest();
+
+private:
+      SetValueMap<int> setmap;
+
+};
+
+#endif /* SETVALUEMAPUNITTEST_HPP_ */
