Index: src/Potentials/Specifics/unittests/ManyBodyPotential_TersoffUnitTest.cpp
===================================================================
--- src/Potentials/Specifics/unittests/ManyBodyPotential_TersoffUnitTest.cpp	(revision 752dc7655143ca8a6de30ce81c8c379cca0d84c7)
+++ src/Potentials/Specifics/unittests/ManyBodyPotential_TersoffUnitTest.cpp	(revision eb1efe719c9062ecc3dbe78c9ad1eefbf84a5023)
@@ -65,5 +65,4 @@
 
 ManyBodyPotential_TersoffTest::configurations_t ManyBodyPotential_TersoffTest::configurations;
-ManyBodyPotential_TersoffTest::configuration_t *ManyBodyPotential_TersoffTest::CurrentConfiguration = NULL;
 
 /** This function looks up all distances ik and jk to a given ij and
@@ -73,15 +72,17 @@
 triplefunction(const argument_t &arguments, const double cutoff)
 {
+  const ManyBodyPotential_TersoffTest::configuration_t &CurrentConfiguration =
+      ManyBodyPotential_TersoffTest::configurations[arguments.globalid];
   std::vector<FunctionModel::arguments_t> result;
   // go through current configuration and gather all other distances
   ManyBodyPotential_TersoffTest::configuration_t::const_iterator firstiter =
-      ManyBodyPotential_TersoffTest::CurrentConfiguration->begin();
+      CurrentConfiguration.begin();
   std::advance(firstiter, arguments.indices.first);
   ManyBodyPotential_TersoffTest::configuration_t::const_iterator seconditer =
-      ManyBodyPotential_TersoffTest::CurrentConfiguration->begin();
+      CurrentConfiguration.begin();
   std::advance(seconditer, arguments.indices.second);
   for (ManyBodyPotential_TersoffTest::configuration_t::const_iterator iter =
-      ManyBodyPotential_TersoffTest::CurrentConfiguration->begin();
-      iter != ManyBodyPotential_TersoffTest::CurrentConfiguration->end();
+      CurrentConfiguration.begin();
+      iter != CurrentConfiguration.end();
       ++iter) {
     // skip k==i and k==j
@@ -92,25 +93,15 @@
     args[0].distance = firstiter->distance(*iter);
     args[0].indices = std::make_pair(
-        std::distance( // enforce const_iterator return from begin()
-            const_cast<const ManyBodyPotential_TersoffTest::configuration_t *>(
-                ManyBodyPotential_TersoffTest::CurrentConfiguration
-                )->begin(), firstiter),
-        std::distance( // enforce const_iterator return from begin()
-            const_cast<const ManyBodyPotential_TersoffTest::configuration_t *>(
-                ManyBodyPotential_TersoffTest::CurrentConfiguration
-                )->begin(), iter)
+        std::distance(CurrentConfiguration.begin(), firstiter),
+        std::distance(CurrentConfiguration.begin(), iter)
     );
+    args[0].globalid = arguments.globalid;
     // jk
     args[1].distance = seconditer->distance(*iter);
     args[1].indices = std::make_pair(
-        std::distance( // enforce const_iterator return from begin()
-            const_cast<const ManyBodyPotential_TersoffTest::configuration_t *>(
-                ManyBodyPotential_TersoffTest::CurrentConfiguration
-                )->begin(), seconditer),
-        std::distance( // enforce const_iterator return from begin()
-            const_cast<const ManyBodyPotential_TersoffTest::configuration_t *>(
-                ManyBodyPotential_TersoffTest::CurrentConfiguration
-                )->begin(), iter)
+        std::distance(CurrentConfiguration.begin(), seconditer),
+        std::distance(CurrentConfiguration.begin(), iter)
     );
+    args[1].globalid = arguments.globalid;
     result.push_back(args);
   }
@@ -276,5 +267,4 @@
 {
   configurations.clear();
-  CurrentConfiguration = NULL;
 }
 
@@ -292,13 +282,14 @@
   const_cast<double &>(tersoff.S) = 2.1;
   for (size_t index = 0; index < configurations.size(); ++index) {
-    CurrentConfiguration = &(configurations[index]);
+    const configuration_t &CurrentConfiguration = configurations[index];
     double temp = 0.;
-    for (size_t i=0; i < CurrentConfiguration->size(); ++i)
-      for (size_t j=0; j < CurrentConfiguration->size(); ++j) {
+    for (size_t i=0; i < CurrentConfiguration.size(); ++i)
+      for (size_t j=0; j < CurrentConfiguration.size(); ++j) {
         if (i == j)
           continue;
         argument_t arg;
         arg.indices = std::make_pair(i,j);
-        arg.distance = (*CurrentConfiguration)[i].distance((*CurrentConfiguration)[j]);
+        arg.distance = CurrentConfiguration[i].distance(CurrentConfiguration[j]);
+        arg.globalid = index; // this is needed for the triplefunction to the configuration
         FunctionModel::arguments_t args(1,arg);
         const ManyBodyPotential_Tersoff::results_t res = tersoff(args);
Index: src/Potentials/Specifics/unittests/ManyBodyPotential_TersoffUnitTest.hpp
===================================================================
--- src/Potentials/Specifics/unittests/ManyBodyPotential_TersoffUnitTest.hpp	(revision 752dc7655143ca8a6de30ce81c8c379cca0d84c7)
+++ src/Potentials/Specifics/unittests/ManyBodyPotential_TersoffUnitTest.hpp	(revision eb1efe719c9062ecc3dbe78c9ad1eefbf84a5023)
@@ -45,5 +45,4 @@
       typedef std::vector<configuration_t> configurations_t;
       static configurations_t configurations;
-      static configuration_t *CurrentConfiguration;
 private:
       FunctionModel::parameters_t params;
