Index: src/FunctionApproximation/FunctionApproximation.cpp
===================================================================
--- src/FunctionApproximation/FunctionApproximation.cpp	(revision 08111add4e3854b9642bec0ae60b58fb491ec273)
+++ src/FunctionApproximation/FunctionApproximation.cpp	(revision b8f2eaf14d7c6a6b31dcd5b85abd1ba743a81e94)
@@ -56,7 +56,9 @@
 FunctionApproximation::FunctionApproximation(
     const TrainingData &_data,
-    FunctionModel &_model) :
+    FunctionModel &_model,
+    const double _precision) :
     input_dimension(_data.getTrainingInputs().size()),
     output_dimension(_data.getTrainingOutputs().size()),
+    precision(_precision),
     input_data(_data.getTrainingInputs()),
     output_data(_data.getTrainingOutputs()),
@@ -162,5 +164,7 @@
   double opts[LM_OPTS_SZ], info[LM_INFO_SZ];
 
-  opts[0]=LM_INIT_MU; opts[1]=1E-15; opts[2]=1E-15; opts[3]=1E-20;
+  // minim. options [\tau, \epsilon1, \epsilon2, \epsilon3]. Respectively the scale factor for initial \mu,
+  // * stopping thresholds for ||J^T e||_inf, ||Dp||_2 and ||e||_2.
+  opts[0]=LM_INIT_MU; opts[1]=1e-15; opts[2]=1e-15; opts[3]=precision;
   opts[4]= LM_DIFF_DELTA; // relevant only if the Jacobian is approximated using finite differences; specifies forward differencing
   //opts[4]=-LM_DIFF_DELTA; // specifies central differencing to approximate Jacobian; more accurate but more expensive to compute!
Index: src/FunctionApproximation/FunctionApproximation.hpp
===================================================================
--- src/FunctionApproximation/FunctionApproximation.hpp	(revision 08111add4e3854b9642bec0ae60b58fb491ec273)
+++ src/FunctionApproximation/FunctionApproximation.hpp	(revision b8f2eaf14d7c6a6b31dcd5b85abd1ba743a81e94)
@@ -80,8 +80,10 @@
    * \param _data container with tuple of (input, output) values
    * \param _model FunctionModel to use in approximation
+   * \param _precision desired precision of fit
    */
   FunctionApproximation(
       const TrainingData &_data,
-      FunctionModel &_model);
+      FunctionModel &_model,
+      const double _precision);
 
   /** Constructor of the class FunctionApproximation.
@@ -94,8 +96,10 @@
       const size_t &_input_dimension,
       const size_t &_output_dimension,
-      FunctionModel &_model) :
+      FunctionModel &_model,
+      const double _precision) :
     input_dimension(_input_dimension),
     output_dimension(_output_dimension),
-    model(_model)
+    model(_model),
+    precision(_precision)
   {}
   /** Destructor for class FunctionApproximation.
@@ -191,4 +195,6 @@
   //!> output dimension (is fixed from construction)
   const size_t output_dimension;
+  //!> desired precision given to LevMar
+  const double precision;
 
   //!> current input set of training data
Index: src/Potentials/PotentialTrainer.cpp
===================================================================
--- src/Potentials/PotentialTrainer.cpp	(revision 08111add4e3854b9642bec0ae60b58fb491ec273)
+++ src/Potentials/PotentialTrainer.cpp	(revision b8f2eaf14d7c6a6b31dcd5b85abd1ba743a81e94)
@@ -120,5 +120,5 @@
       ELOG(2, "threshold parameter always overrules max_runs, both are specified.");
     // now perform the function approximation by optimizing the model function
-    FunctionApproximation approximator(data, *model);
+    FunctionApproximation approximator(data, *model, _threshold);
     if (model->isBoxConstraint() && approximator.checkParameterDerivatives()) {
       double l2error = std::numeric_limits<double>::max();
Index: tests/regression/Potential/FitPotential/testsuite-potential-fit-potential.at
===================================================================
--- tests/regression/Potential/FitPotential/testsuite-potential-fit-potential.at	(revision 08111add4e3854b9642bec0ae60b58fb491ec273)
+++ tests/regression/Potential/FitPotential/testsuite-potential-fit-potential.at	(revision b8f2eaf14d7c6a6b31dcd5b85abd1ba743a81e94)
@@ -36,10 +36,10 @@
 		--potential-charges 8 1 \
 		--fragment-charges 1 8 1 \
-		--set-threshold 1e-6 \
+		--set-threshold 5e-6 \
 	--save-potentials length.potentials], 0, [stdout], [ignore])
 # check that L_2 error is below 1e-6
-AT_CHECK([grep "Best parameters with L2 error" stdout | awk '{if ($8 > 1e-6) exit 1}'], 0, [ignore], [ignore])
+AT_CHECK([grep "Best parameters with L2 error" stdout | awk '{if ($8 > 5e-6) exit 1}'], 0, [ignore], [ignore])
 # check parameters to printed precision
-AT_CHECK([grep "morse:.*particle_type1=8,.*particle_type2=1,.*spring_constant=1.27.*,.*equilibrium_distance=1.78.*,.*dissociation_energy=0.19.*;" length.potentials], 0, [ignore], [ignore])
+AT_CHECK([grep "morse:.*particle_type1=8,.*particle_type2=1,.*spring_constant=1.2.*,.*equilibrium_distance=1.7.*,.*dissociation_energy=0.19.*;" length.potentials], 0, [ignore], [ignore])
 
 AT_CLEANUP
@@ -62,8 +62,8 @@
 		--potential-charges 8 1 \
 		--fragment-charges 1 8 1 \
-		--set-threshold 1e-6 \
+		--set-threshold 5e-6 \
 	--save-potentials harmonic.potentials], 0, [stdout], [ignore])
-# check that L_2 error is below 1e-6
-AT_CHECK([grep "Best parameters with L2 error" stdout | awk '{if ($8 > 1e-6) exit 1}'], 0, [ignore], [ignore])
+# check that L_2 error is below 5e-6
+AT_CHECK([grep "Best parameters with L2 error" stdout | awk '{if ($8 > 5e-6) exit 1}'], 0, [ignore], [ignore])
 # check parameters to printed precision
 AT_CHECK([grep "harmonic_bond:.*particle_type1=8,.*particle_type2=1,.*spring_constant=0.29.*,.*equilibrium_distance=1.8.*;" harmonic.potentials], 0, [ignore], [ignore])
@@ -114,8 +114,8 @@
 		--potential-charges 6 6 6 6 \
 		--fragment-charges 6 6 6 6 1 1 1 1 1 1 1 1 1 1 \
-		--set-threshold 2e-10 \
+		--set-threshold 1e-9 \
 	--save-potentials torsion.potentials], 0, [stdout], [ignore])
 # check that L_2 error is below 9e-12 ... just 2e-10 otherwise test takes tooo long
-AT_CHECK([grep "Best parameters with L2 error" stdout | awk '{if ($8 > 2e-10) exit 1}'], 0, [ignore], [ignore])
+AT_CHECK([grep "Best parameters with L2 error" stdout | awk '{if ($8 > 1e-9) exit 1}'], 0, [ignore], [ignore])
 AT_CHECK([grep "torsion:.*particle_type1=6,.*particle_type2=6,.*particle_type3=6,.*particle_type4=6,.*spring_constant=.*,.*equilibrium_distance=.*;" torsion.potentials], 0, [ignore], [ignore])
 #AT_CHECK([grep "torsion:.*particle_type1=6,.*particle_type2=6,.*particle_type3=6,.*particle_type4=6,.*spring_constant=0.001.*,.*equilibrium_distance=0.99.*;" torsion.potentials], 0, [ignore], [ignore])
@@ -167,8 +167,8 @@
 		--potential-charges 18 18 \
 		--fragment-charges 18 18 \
-		--set-threshold 7e-9 \
+		--set-threshold 7e-8 \
 	--save-potentials lj.potentials], 0, [stdout], [ignore])
-# check that L_2 error is below 7e-11 ... just 7e-9 otherwise test takes too long
-AT_CHECK([grep "Best parameters with L2 error" stdout | awk '{if ($8 > 7e-9) exit 1}'], 0, [ignore], [ignore])
+# check that L_2 error is below 7e-11 ... just 7e-8 otherwise test takes too long
+AT_CHECK([grep "Best parameters with L2 error" stdout | awk '{if ($8 > 7e-8) exit 1}'], 0, [ignore], [ignore])
 # check parameters to printed precision
 AT_CHECK([grep "lennardjones:.*particle_type1=18,.*particle_type2=18,.*epsilon=.*,.*sigma=.*;" lj.potentials], 0, [ignore], [ignore])
