Index: src/FunctionApproximation/FunctionModel.hpp
===================================================================
--- src/FunctionApproximation/FunctionModel.hpp	(revision 0dad5f9b6ef661b1712806b83f1f1f3da56f8bb3)
+++ src/FunctionApproximation/FunctionModel.hpp	(revision e36ba235524a399519656926a7dd7087945bbbd5)
@@ -47,4 +47,6 @@
   //!> typedef for a vector of particle tyoes
   typedef std::vector< double > charges_t;
+  //!> typedef for the magic triple function that gets the other two distances for a given argument
+  typedef boost::function< std::vector<arguments_t>(const argument_t &, const double)> triplefunction_t;
 
 public:
@@ -75,4 +77,13 @@
    */
   virtual size_t getParameterDimension() const=0;
+
+  /** Sets the magic triple function that we use for getting angle distances.
+   *
+   * @param _triplefunction function that returns a list of triples (i.e. the
+   *        two remaining distances) to a given pair of points (contained as
+   *        indices within the argument)
+   */
+  virtual void setTriplefunction(triplefunction_t &_triplefunction)
+  {}
 
   /** Evaluates the function with the given \a arguments and the current set of
Index: src/LevMartester.cpp
===================================================================
--- src/LevMartester.cpp	(revision 0dad5f9b6ef661b1712806b83f1f1f3da56f8bb3)
+++ src/LevMartester.cpp	(revision e36ba235524a399519656926a7dd7087945bbbd5)
@@ -287,10 +287,4 @@
 
       // now perform the function approximation by optimizing the model function
-      FunctionModel::parameters_t params(PairPotential_Morse::MAXPARAMS, 0.);
-      params[PairPotential_Morse::dissociation_energy] = 1e+0*rand()/(double)RAND_MAX;// 0.5;
-      params[PairPotential_Morse::energy_offset] =
-          MorseData.getTrainingOutputAverage()[0];// -1.;
-      params[PairPotential_Morse::spring_constant] = 1e+0*rand()/(double)RAND_MAX;// 1.;
-      params[PairPotential_Morse::equilibrium_distance] =  3e+0*rand()/(double)RAND_MAX;//2.9;
       PairPotential_Morse::ParticleTypes_t types =
             boost::assign::list_of<PairPotential_Morse::ParticleType_t>
@@ -298,11 +292,14 @@
           ;
       PairPotential_Morse morse(types);
-      LOG(0, "INFO: Initial parameters are " << params << ".");
-      morse.setParameters(params);
       FunctionModel &model = morse;
-      FunctionApproximation approximator(MorseData, model); // we only give CC distance, hence 1 input dim
+      FunctionApproximation approximator(MorseData, model);
+      FunctionModel::triplefunction_t triplefunction =
+          boost::bind(&getTripleFromArgument, boost::cref(MorseData.getTrainingInputs()), _1, _2);
       if (model.isBoxConstraint() && approximator.checkParameterDerivatives()) {
         // we set parameters here because we want to test with default ones
-        morse.setParameters(params);
+        srand((unsigned)time(0)); // seed with current time
+        model.setParametersToRandomInitialValues(MorseData);
+        model.setTriplefunction(triplefunction);
+        LOG(0, "INFO: Initial parameters are " << model.getParameters() << ".");
         approximator(FunctionApproximation::ParameterDerivative);
       } else {
@@ -344,23 +341,4 @@
       boost::function< std::vector<FunctionModel::arguments_t>(const argument_t &, const double)> triplefunction =
           boost::bind(&getTripleFromArgument, boost::cref(TersoffData.getTrainingInputs()), _1, _2);
-      srand((unsigned)time(0)); // seed with current time
-      params[SaturationPotential::all_energy_offset] =
-          TersoffData.getTrainingOutputAverage()[0]; //1e+1*rand()/(double)RAND_MAX;//3.487900e+00;
-      params[SaturationPotential::morse_spring_constant] =
-        //  morseparams[PairPotential_Morse::spring_constant]; //
-	1e+1*rand()/(double)RAND_MAX;//1.393600e+03;
-      params[SaturationPotential::morse_equilibrium_distance] =
-       //   morseparams[PairPotential_Morse::equilibrium_distance]; //
-	3e+0*rand()/(double)RAND_MAX;//3.467000e+02;
-      params[SaturationPotential::morse_dissociation_energy] =
-       //   morseparams[PairPotential_Morse::dissociation_energy]; //
-	1e+0*rand()/(double)RAND_MAX;//3.487900e+00;
-      params[SaturationPotential::angle_spring_constant] =
-       //   angleparams[PairPotential_Angle::spring_constant]; //
-	1e+1*rand()/(double)RAND_MAX;//3.487900e+00;
-      params[SaturationPotential::angle_equilibrium_distance] =
-       //   angleparams[PairPotential_Angle::equilibrium_distance]; //
-	2e+0*rand()/(double)RAND_MAX - 1.;//3.487900e+00;
-      LOG(0, "INFO: Initial parameters are " << params << ".");
       SaturationPotential::ParticleTypes_t types =
             boost::assign::list_of<SaturationPotential::ParticleType_t>
@@ -369,11 +347,11 @@
 
       SaturationPotential saturation(types);
-      // saturation has internal triplefunction now
-//      saturation.setTriplefunction(2.5, triplefunction);
       FunctionModel &model = saturation;
       FunctionApproximation approximator(TersoffData, model); // CH4 has 5 atoms, hence 5*4/2 distances
       if (model.isBoxConstraint() && approximator.checkParameterDerivatives()) {
         // we set parameters here because we want to test with default ones
-        saturation.setParameters(params);
+        srand((unsigned)time(0)); // seed with current time
+        model.setParametersToRandomInitialValues(TersoffData);
+        model.setTriplefunction(triplefunction);
         approximator(FunctionApproximation::ParameterDerivative);
       } else {
Index: src/Potentials/Specifics/ManyBodyPotential_Tersoff.hpp
===================================================================
--- src/Potentials/Specifics/ManyBodyPotential_Tersoff.hpp	(revision 0dad5f9b6ef661b1712806b83f1f1f3da56f8bb3)
+++ src/Potentials/Specifics/ManyBodyPotential_Tersoff.hpp	(revision e36ba235524a399519656926a7dd7087945bbbd5)
@@ -190,10 +190,6 @@
    *        indices within the argument)
    */
-  void setTriplefunction(
-      boost::function< std::vector<arguments_t>(const argument_t &, const double)> &_triplefunction
-      )
-  {
-    triplefunction = _triplefunction;
-  }
+  void setTriplefunction(triplefunction_t &_triplefunction)
+  { triplefunction = _triplefunction;  }
 
 private:
Index: src/Potentials/Specifics/SaturationPotential.hpp
===================================================================
--- src/Potentials/Specifics/SaturationPotential.hpp	(revision 0dad5f9b6ef661b1712806b83f1f1f3da56f8bb3)
+++ src/Potentials/Specifics/SaturationPotential.hpp	(revision e36ba235524a399519656926a7dd7087945bbbd5)
@@ -88,20 +88,4 @@
   { return MAXPARAMS; }
 
-  /** Sets the magic triple function that we use for getting angle distances.
-   *
-   * \note does nothing as we have an internal triplefunction
-   *
-   * \param _saturation_cutoff cutoff for the triplefunction
-   * @param _triplefunction function that returns a list of triples (i.e. the
-   *        two remaining distances) to a given pair of points (contained as
-   *        indices within the argument)
-   */
-  void setTriplefunction(
-      const double _saturation_cutoff,
-      boost::function< std::vector<arguments_t>(const argument_t &, const double)> &_triplefunction
-      )
-  {
-  }
-
   /** Evaluates the harmonic potential function for the given arguments.
    *
