Index: src/Fragmentation/Automation/Makefile.am
===================================================================
--- src/Fragmentation/Automation/Makefile.am	(revision 447481c9093e8228d3068ae67d0b5e676c825ae1)
+++ src/Fragmentation/Automation/Makefile.am	(revision a3112d40f12175114c1cbb5f5fd931fa82579847)
@@ -3,4 +3,5 @@
 
 FRAGMENTATIONAUTOMATIONSOURCE = \
+	Fragmentation/Automation/createMatrixNrLookup.cpp \
 	Fragmentation/Automation/MPQCFragmentController.cpp \
 	Fragmentation/Automation/SpecificFragmentController.cpp
@@ -13,4 +14,5 @@
 
 FRAGMENTATIONAUTOMATIONHEADER = \
+	Fragmentation/Automation/createMatrixNrLookup.hpp \
 	Fragmentation/Automation/extractJobIds.hpp \
 	Fragmentation/Automation/MPQCFragmentController.hpp \
Index: src/Fragmentation/Automation/createMatrixNrLookup.cpp
===================================================================
--- src/Fragmentation/Automation/createMatrixNrLookup.cpp	(revision a3112d40f12175114c1cbb5f5fd931fa82579847)
+++ src/Fragmentation/Automation/createMatrixNrLookup.cpp	(revision a3112d40f12175114c1cbb5f5fd931fa82579847)
@@ -0,0 +1,64 @@
+/*
+ * 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/>.
+ */
+
+/*
+ * createMatrixNrLookup.cpp
+ *
+ *  Created on: Aug 31, 2012
+ *      Author: heber
+ */
+
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "CodePatterns/MemDebug.hpp"
+
+#include "createMatrixNrLookup.hpp"
+
+#include "CodePatterns/Assert.hpp"
+#include "CodePatterns/Log.hpp"
+
+
+std::map< JobId_t, size_t > createMatrixNrLookup(
+    const std::vector<JobId_t> &jobids,
+    size_t &FragmentCounter)
+{
+  // align fragments
+  std::map< JobId_t, size_t > MatrixNrLookup;
+  FragmentCounter = 0;
+  for (std::vector<JobId_t>::const_iterator iter = jobids.begin();
+      iter != jobids.end(); ++iter) {
+    LOG(3, "DEBUG: Inserting (" << *iter << "," << FragmentCounter << ").");
+#ifndef NDEBUG
+    std::pair< std::map< JobId_t, size_t >::iterator, bool> inserter =
+#endif
+        MatrixNrLookup.insert( std::make_pair(*iter, FragmentCounter++) );
+    ASSERT( inserter.second,
+        "createMatrixNrLookup() - two results have same id "
+        +toString(*iter)+".");
+  }
+  LOG(1, "INFO: There are " << FragmentCounter << " fragments.");
+  return MatrixNrLookup;
+}
Index: src/Fragmentation/Automation/createMatrixNrLookup.hpp
===================================================================
--- src/Fragmentation/Automation/createMatrixNrLookup.hpp	(revision a3112d40f12175114c1cbb5f5fd931fa82579847)
+++ src/Fragmentation/Automation/createMatrixNrLookup.hpp	(revision a3112d40f12175114c1cbb5f5fd931fa82579847)
@@ -0,0 +1,32 @@
+/*
+ * createMatrixNrLookup.hpp
+ *
+ *  Created on: Aug 31, 2012
+ *      Author: heber
+ */
+
+#ifndef CREATEMATRIXNRLOOKUP_HPP_
+#define CREATEMATRIXNRLOOKUP_HPP_
+
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <map>
+#include <vector>
+
+#include "JobMarket/types.hpp"
+
+/** Creates a lookup from FragmentJob::id to the true fragment  number.
+ *
+ * @param jobids vector with job ids
+ * @param FragmentCounter total number of fragments on return
+ * @return Lookup up-map
+ */
+std::map< JobId_t, size_t > createMatrixNrLookup(
+    const std::vector<JobId_t> &jobids,
+    size_t &FragmentCounter);
+
+#endif /* CREATEMATRIXNRLOOKUP_HPP_ */
