Index: src/FunctionApproximation/Extractors.cpp
===================================================================
--- src/FunctionApproximation/Extractors.cpp	(revision dd8094e48dc5886d8540a479da473cbe753318d8)
+++ src/FunctionApproximation/Extractors.cpp	(revision 1f3b2a12aaf71d34f942bd688ca79685d455ef54)
@@ -52,5 +52,6 @@
 FunctionModel::arguments_t
 Extractors::gatherAllDistanceArguments(
-    const Fragment::positions_t &positions,
+    const Fragment::positions_t& positions,
+    const Fragment::charges_t& charges,
     const size_t globalid)
 {
@@ -68,4 +69,8 @@
       const Vector secondtemp((*secondpositer)[0],(*secondpositer)[1],(*secondpositer)[2]);
       arg.distance = firsttemp.distance(secondtemp);
+      arg.types = std::make_pair(
+          charges[ std::distance(positions.begin(), firstpositer) ],
+          charges[ std::distance(positions.begin(), secondpositer) ]
+          );
       arg.indices = std::make_pair(
           std::distance(
@@ -84,5 +89,6 @@
 FunctionModel::arguments_t
 Extractors::gatherAllSymmetricDistanceArguments(
-    const Fragment::positions_t &positions,
+    const Fragment::positions_t& positions,
+    const Fragment::charges_t& charges,
     const size_t globalid)
 {
@@ -100,4 +106,8 @@
       const Vector secondtemp((*secondpositer)[0],(*secondpositer)[1],(*secondpositer)[2]);
       arg.distance = firsttemp.distance(secondtemp);
+      arg.types = std::make_pair(
+          charges[ std::distance(positions.begin(), firstpositer) ],
+          charges[ std::distance(positions.begin(), secondpositer) ]
+          );
       arg.indices = std::make_pair(
           std::distance(
@@ -114,8 +124,8 @@
 }
 
-Fragment::positions_t Extractors::_detail::gatherPositionsFromCharges(
-    const Fragment::positions_t &positions,
-    const Fragment::charges_t &charges,
-    const chargeiters_t targets
+Fragment::positions_t Extractors::_detail::gatherPositionsFromTargets(
+    const Fragment::positions_t& positions,
+    const Fragment::charges_t& charges,
+    const chargeiters_t &targets
     )
 {
@@ -129,4 +139,27 @@
   }
   return filtered_positions;
+}
+
+FunctionModel::arguments_t Extractors::_detail::gatherDistancesFromTargets(
+    const Fragment::positions_t& positions,
+    const Fragment::charges_t& charges,
+    const chargeiters_t &targets,
+    const size_t globalid
+    )
+{
+  Fragment::positions_t filtered_positions;
+  Fragment::charges_t filtered_charges;
+  for (chargeiters_t::const_iterator firstpairiter = targets.begin();
+      firstpairiter != targets.end(); ++firstpairiter) {
+    Fragment::positions_t::const_iterator positer = positions.begin();
+    const size_t steps = std::distance(charges.begin(), *firstpairiter);
+    std::advance(positer, steps);
+    filtered_positions.push_back(*positer);
+    filtered_charges.push_back(**firstpairiter);
+  }
+  return Extractors::gatherAllSymmetricDistanceArguments(
+      filtered_positions,
+      filtered_charges,
+      globalid);
 }
 
@@ -218,10 +251,10 @@
 }
 
-Fragment::positions_t
-Extractors::gatherPositionOfTuples(
-    const Fragment& fragment,
+Extractors::chargeiters_t
+Extractors::_detail::gatherTargetsFromFragment(
+    const Fragment::charges_t& charges,
     const Fragment::charges_t elements
-    ) {
-  const Fragment::charges_t charges = fragment.getCharges();
+    )
+{
   /// The main problem here is that we have to know how many same
   /// elements (but different atoms!) we are required to find. Hence,
@@ -248,11 +281,44 @@
       ++chargeiter)
     ASSERT( *chargeiter != charges.end(),
-        "Extractors::gatherDistanceOfTuples() - we have not found enough targets?!");
+        "Extractors::gatherTargetsFromFragment() - we have not found enough targets?!");
 #endif
+
+  return targets;
+}
+
+Fragment::positions_t
+Extractors::gatherPositionsFromFragment(
+    const Fragment::positions_t positions,
+    const Fragment::charges_t charges,
+    const Fragment::charges_t& elements
+    )
+{
+  // 1.-3. gather correct charge positions
+  chargeiters_t targets =
+      Extractors::_detail::gatherTargetsFromFragment(charges, elements);
   // 4. convert position_t to Vector
-  return Extractors::_detail::gatherPositionsFromCharges(
-          fragment.getPositions(),
+  return Extractors::_detail::gatherPositionsFromTargets(
+          positions,
           charges,
           targets);
+}
+
+FunctionModel::arguments_t
+Extractors::gatherDistancesFromFragment(
+    const Fragment::positions_t positions,
+    const Fragment::charges_t charges,
+    const Fragment::charges_t& elements,
+    const size_t globalid
+    )
+{
+  // 1.-3. gather correct charge positions
+  chargeiters_t targets =
+      Extractors::_detail::gatherTargetsFromFragment(charges, elements);
+  // 4. convert position_t to Vector
+  return Extractors::_detail::gatherDistancesFromTargets(
+          positions,
+          charges,
+          targets,
+          globalid);
 }
 
Index: src/FunctionApproximation/Extractors.hpp
===================================================================
--- src/FunctionApproximation/Extractors.hpp	(revision dd8094e48dc5886d8540a479da473cbe753318d8)
+++ src/FunctionApproximation/Extractors.hpp	(revision 1f3b2a12aaf71d34f942bd688ca79685d455ef54)
@@ -35,18 +35,35 @@
    */
   namespace _detail {
-    /** Gather all positions from the same aligned vector of charges.
+    /** Gather all distance arguments from the same aligned vector of charges.
      *
      * Basically, we filter the positions indicated by the targets but
      * from a different vector that has the same layout.
      *
-     * \param positions positions to search
-     * \param charges charges to match with \targets
+     * \param positions all nuclei positions
+     * \param charges all nuclei charges
+     * \param targets iterators on charges
+     * \return filtered distance arguments
+     */
+    FunctionModel::arguments_t gatherDistancesFromTargets(
+        const Fragment::positions_t& positions,
+        const Fragment::charges_t& charges,
+        const chargeiters_t &targets,
+        const size_t globalid
+        );
+
+    /** Gather all positions from the same aligned vector of charges.
+     *
+     * Basically, we filter the positions indicated by the targets but
+     * from a different vector that has the same layout.
+     *
+     * \param positions all nuclei positions
+     * \param charges all nuclei charges
      * \param targets iterators on charges
      * \return filtered positions
      */
-    Fragment::positions_t gatherPositionsFromCharges(
-        const Fragment::positions_t &positions,
-        const Fragment::charges_t &charges,
-        const chargeiters_t targets
+    Fragment::positions_t gatherPositionsFromTargets(
+        const Fragment::positions_t& positions,
+        const Fragment::charges_t& charges,
+        const chargeiters_t& targets
         );
 
@@ -86,9 +103,25 @@
         const elementcounts_t &elementcounts
         );
+
+    /** Searches for desired elements in charges in a unique manner.
+     *
+     * The idea is to have e.g. a fragment with charges 8,1,1,2 and
+     * elements as 1,8,1 (e.g. for an angle HOH) and we get the
+     * chargeiters in the desired manner on indices: 1,0,3.
+     *
+     * \param charges charges to look through
+     * \param elements vector of elements to find
+     */
+    chargeiters_t
+    gatherTargetsFromFragment(
+        const Fragment::charges_t& charges,
+        const Fragment::charges_t elements
+        );
   }
 
   /** Gather all distances from a given set of positions.
    *
-   * \param positions vector of positions
+   * \param positions all nuclei positions
+   * \param charges all nuclei charges
    * \param globalid index to associated in argument_t with
    * \return vector of argument_ , each with a distance
@@ -96,5 +129,6 @@
   FunctionModel::arguments_t
   gatherAllDistanceArguments(
-      const Fragment::positions_t &positions,
+      const Fragment::positions_t& positions,
+      const Fragment::charges_t& charges,
       const size_t globalid);
 
@@ -103,5 +137,6 @@
    *  Here, we only return one of the two equal distances.
    *
-   * \param positions vector of positions
+   * \param positions all nuclei positions
+   * \param charges all nuclei charges
    * \param globalid index to associated in argument_t with
    * \return vector of argument_ , each with a distance
@@ -109,30 +144,66 @@
   FunctionModel::arguments_t
   gatherAllSymmetricDistanceArguments(
-      const Fragment::positions_t &positions,
+      const Fragment::positions_t& positions,
+      const Fragment::charges_t& charges,
       const size_t globalid);
 
   /** Simple extractor of all unique pair distances of a given \a fragment.
    *
-   * \param fragment fragment with all nuclei positions
+   * \param positions all nuclei positions
+   * \param charges all nuclei charges
    * \param index index refers to the index within the global set of configurations
    * \return vector of of argument_t containing all found distances
    */
   inline FunctionModel::arguments_t gatherAllDistances(
-      const Fragment& fragment,
+      const Fragment::positions_t& positions,
+      const Fragment::charges_t& charges,
       const size_t index
       ) {
     // get distance out of Fragment
-    return gatherAllDistanceArguments(fragment.getPositions(), index);
+    return gatherAllDistanceArguments(positions, charges, index);
   }
 
-  /** Gather all positions associated to the matching \a elements.
-   *
-   * \param fragment fragment with all nuclei positions
+  /** Simple extractor of all unique pair distances of a given \a fragment, where
+   * the first index is less than the second one.
+   *
+   * \param positions all nuclei positions
+   * \param charges all nuclei charges
+   * \param index index refers to the index within the global set of configurations
+   * \return vector of of argument_t containing all found distances
+   */
+  inline FunctionModel::arguments_t gatherAllSymmetricDistances(
+      const Fragment::positions_t& positions,
+      const Fragment::charges_t& charges,
+      const size_t index
+      ) {
+    // get distance out of Fragment
+    return gatherAllSymmetricDistanceArguments(positions, charges, index);
+  }
+
+  /** Filters only those positions out of given \a fragment that match \a elements.
+   *
+   * \param positions all nuclei positions
+   * \param charges all nuclei charges
    * \param elements tuple of desired elements
    * \return vector of positions_t containing
    */
-  Fragment::positions_t gatherPositionOfTuples(
-      const Fragment& fragment,
-      const Fragment::charges_t elements
+  Fragment::positions_t gatherPositionsFromFragment(
+      const Fragment::positions_t positions,
+      const Fragment::charges_t charges,
+      const Fragment::charges_t& elements
+      );
+
+  /** Filters only those distances out of given \a fragment that match \a elements.
+   *
+   * \param positions all nuclei positions
+   * \param charges all nuclei charges
+   * \param elements tuple of desired elements
+   * \return vector of arguments_t containing those matched with elements
+   */
+  FunctionModel::arguments_t gatherDistancesFromFragment(
+      const Fragment::positions_t positions,
+      const Fragment::charges_t charges,
+      const Fragment::charges_t& elements,
+      const size_t globalid
       );
 
Index: src/FunctionApproximation/FunctionArgument.cpp
===================================================================
--- src/FunctionApproximation/FunctionArgument.cpp	(revision dd8094e48dc5886d8540a479da473cbe753318d8)
+++ src/FunctionApproximation/FunctionArgument.cpp	(revision 1f3b2a12aaf71d34f942bd688ca79685d455ef54)
@@ -44,4 +44,5 @@
 {
   ost << "[(" << arg.indices.first << "," << arg.indices.second
+      << "), q(   " << arg.types.first << "," << arg.types.second << "),"
       << "r=" << arg.distance;
   return ost;
Index: src/FunctionApproximation/FunctionArgument.hpp
===================================================================
--- src/FunctionApproximation/FunctionArgument.hpp	(revision dd8094e48dc5886d8540a479da473cbe753318d8)
+++ src/FunctionApproximation/FunctionArgument.hpp	(revision 1f3b2a12aaf71d34f942bd688ca79685d455ef54)
@@ -32,4 +32,8 @@
   //!> typedef for the two indices of the argument
   typedef std::pair<size_t, size_t> indices_t;
+  //!> typedef for the underlying type of the particle
+  typedef int ParticleType_t;
+  //!> typedef for the two particle types of the argument
+  typedef std::pair<ParticleType_t, ParticleType_t> types_t;
 
   /** Default constructor for class argument_t.
@@ -38,4 +42,5 @@
   argument_t() :
     indices( std::make_pair(0,1) ),
+    types( std::make_pair(0,0) ),
     distance(0.),
     globalid(-1)
@@ -50,4 +55,5 @@
   argument_t(const double &_distance) :
     indices( std::make_pair(0,1) ),
+    types( std::make_pair(0,0) ),
     distance(_distance),
     globalid(-1)
@@ -61,4 +67,18 @@
   argument_t(const indices_t &_indices, const double &_distance) :
     indices( _indices ),
+    types( std::make_pair(0,0) ),
+    distance(_distance),
+    globalid(-1)
+  {}
+
+  /** Constructor for class argument_t.
+   *
+   * \param _indices pair of indices associated with the \a _distance
+   * \param _types pair of particle type
+   * \param _distance distance argument
+   */
+  argument_t(const indices_t &_indices, const types_t &_types, const double &_distance) :
+    indices( _indices ),
+    types( _types ),
     distance(_distance),
     globalid(-1)
@@ -98,4 +118,6 @@
   //!> indices between which the distance is given
   indices_t indices;
+  //!> indices between which the distance is given
+  types_t types;
   //!> distance
   double distance;
Index: src/FunctionApproximation/unittests/ExtractorsUnitTest.cpp
===================================================================
--- src/FunctionApproximation/unittests/ExtractorsUnitTest.cpp	(revision dd8094e48dc5886d8540a479da473cbe753318d8)
+++ src/FunctionApproximation/unittests/ExtractorsUnitTest.cpp	(revision 1f3b2a12aaf71d34f942bd688ca79685d455ef54)
@@ -84,7 +84,11 @@
   }
 
+  // create charges
+  Fragment::charges_t charges;
+  charges += 6., 6., 1., 1., 1.;
+
   // create distances
   FunctionModel::arguments_t args =
-      Extractors::gatherAllDistanceArguments(positions, 0);
+      Extractors::gatherAllDistanceArguments(positions, charges, 0);
   CPPUNIT_ASSERT_EQUAL( (size_t)(5*4), args.size() );
 
@@ -94,7 +98,7 @@
 }
 
-/** UnitTest for gatherPositionOfTuples()
+/** UnitTest for gatherPositionsFromFragment()
  */
-void ExtractorsTest::gatherPositionOfTuplesTest()
+void ExtractorsTest::gatherPositionsFromFragmentTest()
 {
   // create positions
@@ -110,6 +114,38 @@
   charges += 6., 6., 1., 1., 1.;
 
-  // create Fragment
-  Fragment fragment(positions, charges);
+  {
+    // extract carbon pairs
+    Fragment::charges_t carbonpair;
+    carbonpair += 6.,6.;
+    Fragment::positions_t filtered_positions =
+        Extractors::gatherPositionsFromFragment(positions, charges, carbonpair);
+    CPPUNIT_ASSERT_EQUAL( (size_t)2, filtered_positions.size() );
+  }
+
+  {
+    // extract hydrogen triple
+    Fragment::charges_t hydrogentriple;
+    hydrogentriple += 1.,1.,1.;
+    Fragment::positions_t filtered_positions =
+        Extractors::gatherPositionsFromFragment(positions, charges, hydrogentriple);
+    CPPUNIT_ASSERT_EQUAL( (size_t)3, filtered_positions.size() );
+  }
+}
+
+/** UnitTest for gatherDistancesFromFragment()
+ */
+void ExtractorsTest::gatherDistancesFromFragmentTest()
+{
+  // create positions
+  Fragment::positions_t positions;
+  Fragment::position_t pos(3, 0.);
+  for (double i = 0; i < 5; i+=1.) {
+    pos[0] = i;
+    positions.push_back(pos);
+  }
+
+  // create charges
+  Fragment::charges_t charges;
+  charges += 6., 6., 1., 1., 1.;
 
   {
@@ -118,10 +154,6 @@
     carbonpair += 6.,6.;
     FunctionModel::arguments_t args =
-        Extractors::gatherAllSymmetricDistanceArguments(
-            Extractors::gatherPositionOfTuples(fragment, carbonpair),
-            0
-        );
+        Extractors::gatherDistancesFromFragment(positions, charges, carbonpair, 0);
     CPPUNIT_ASSERT_EQUAL( (size_t)1, args.size() );
-    CPPUNIT_ASSERT_EQUAL( 1., args[0].distance );
   }
 
@@ -131,14 +163,6 @@
     hydrogentriple += 1.,1.,1.;
     FunctionModel::arguments_t args =
-        Extractors::reorderArgumentsByIncreasingDistance(
-            Extractors::gatherAllSymmetricDistanceArguments(
-                Extractors::gatherPositionOfTuples(fragment, hydrogentriple),
-                0
-            )
-        );
+        Extractors::gatherDistancesFromFragment(positions, charges, hydrogentriple, 0);
     CPPUNIT_ASSERT_EQUAL( (size_t)3, args.size() );
-    CPPUNIT_ASSERT_EQUAL( 1., args[0].distance );
-    CPPUNIT_ASSERT_EQUAL( 1., args[1].distance );
-    CPPUNIT_ASSERT_EQUAL( 2., args[2].distance );
   }
 }
Index: src/FunctionApproximation/unittests/ExtractorsUnitTest.hpp
===================================================================
--- src/FunctionApproximation/unittests/ExtractorsUnitTest.hpp	(revision dd8094e48dc5886d8540a479da473cbe753318d8)
+++ src/FunctionApproximation/unittests/ExtractorsUnitTest.hpp	(revision 1f3b2a12aaf71d34f942bd688ca79685d455ef54)
@@ -24,5 +24,6 @@
     CPPUNIT_TEST ( gatherAllDistanceArgumentsTest );
     CPPUNIT_TEST ( reorderArgumentsByIncreasingDistanceTest );
-    CPPUNIT_TEST ( gatherPositionOfTuplesTest );
+    CPPUNIT_TEST ( gatherPositionsFromFragmentTest );
+    CPPUNIT_TEST ( gatherDistancesFromFragmentTest );
     CPPUNIT_TEST_SUITE_END();
 
@@ -32,5 +33,6 @@
       void gatherAllDistanceArgumentsTest();
       void reorderArgumentsByIncreasingDistanceTest();
-      void gatherPositionOfTuplesTest();
+      void gatherPositionsFromFragmentTest();
+      void gatherDistancesFromFragmentTest();
 
 private:
