Index: src/Potentials/Makefile.am
===================================================================
--- src/Potentials/Makefile.am	(revision 4792ab92082785a79b5b75b4d915318cfcce1211)
+++ src/Potentials/Makefile.am	(revision 1413f4555b944ca972d0d485541e58d325f62feb)
@@ -17,4 +17,5 @@
   Potentials/Specifics/PairPotential_Angle.cpp \
   Potentials/Specifics/PairPotential_Harmonic.cpp \
+  Potentials/Specifics/PairPotential_LennardJones.cpp \
   Potentials/Specifics/PairPotential_Morse.cpp \
   Potentials/Specifics/PotentialTypes.cpp
@@ -44,4 +45,5 @@
   Potentials/Specifics/PairPotential_Angle.hpp \
   Potentials/Specifics/PairPotential_Harmonic.hpp \
+  Potentials/Specifics/PairPotential_LennardJones.hpp \
   Potentials/Specifics/PairPotential_Morse.hpp
   
Index: src/Potentials/PotentialFactory.cpp
===================================================================
--- src/Potentials/PotentialFactory.cpp	(revision 4792ab92082785a79b5b75b4d915318cfcce1211)
+++ src/Potentials/PotentialFactory.cpp	(revision 1413f4555b944ca972d0d485541e58d325f62feb)
@@ -113,4 +113,6 @@
   case harmonic_angle:
       return new PairPotential_Angle(types);
+  case lennardjones:
+      return new PairPotential_LennardJones(types);
   default:
     ASSERT(0, "PotentialFactory::createInstance() - unknown potential desired to create.");
@@ -142,4 +144,7 @@
     potential = new PairPotential_Angle();
     break;
+  case lennardjones:
+    potential = new PairPotential_LennardJones();
+    break;
   default:
     ASSERT(0, "PotentialFactory::createInstance() - unknown potential desired to create.");
Index: src/Potentials/Specifics/PairPotential_LennardJones.cpp
===================================================================
--- src/Potentials/Specifics/PairPotential_LennardJones.cpp	(revision 1413f4555b944ca972d0d485541e58d325f62feb)
+++ src/Potentials/Specifics/PairPotential_LennardJones.cpp	(revision 1413f4555b944ca972d0d485541e58d325f62feb)
@@ -0,0 +1,225 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2013 Frederik Heber. All rights reserved.
+ * Please see the COPYING file or "Copyright notice" in builder.cpp for details.
+ * 
+ *
+ *   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/>. 
+ */
+
+/*
+ * PairPotential_LennardJones.cpp
+ *
+ *  Created on: Jul 05, 2013
+ *      Author: heber
+ */
+
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "CodePatterns/MemDebug.hpp"
+
+#include "PairPotential_LennardJones.hpp"
+
+#include <boost/assign/list_of.hpp> // for 'map_list_of()'
+#include <boost/bind.hpp>
+#include <boost/lambda/lambda.hpp>
+#include <cmath>
+#include <string>
+
+#include "CodePatterns/Assert.hpp"
+
+#include "FunctionApproximation/Extractors.hpp"
+#include "FunctionApproximation/TrainingData.hpp"
+#include "Potentials/helpers.hpp"
+#include "Potentials/ParticleTypeCheckers.hpp"
+
+class Fragment;
+
+// static definitions
+const PairPotential_LennardJones::ParameterNames_t
+PairPotential_LennardJones::ParameterNames =
+      boost::assign::list_of<std::string>
+      ("epsilon")
+      ("sigma")
+    ;
+const std::string PairPotential_LennardJones::potential_token("lennardjones");
+
+void PairPotential_LennardJones::setDefaultParameters()
+{
+  params[epsilon] = 1e-5;
+  params[sigma] = 8.2;
+}
+
+PairPotential_LennardJones::PairPotential_LennardJones() :
+    EmpiricalPotential(),
+    params(parameters_t(MAXPARAMS, 0.))
+{
+  // have some decent defaults for parameter_derivative checking
+  setDefaultParameters();
+}
+
+PairPotential_LennardJones::PairPotential_LennardJones(
+    const ParticleTypes_t &_ParticleTypes
+    ) :
+  EmpiricalPotential(_ParticleTypes),
+  params(parameters_t(MAXPARAMS, 0.))
+{
+  // have some decent defaults for parameter_derivative checking
+  setDefaultParameters();
+}
+
+PairPotential_LennardJones::PairPotential_LennardJones(
+    const ParticleTypes_t &_ParticleTypes,
+    const double _epsilon,
+    const double _sigma
+    ) :
+  EmpiricalPotential(_ParticleTypes),
+  params(parameters_t(MAXPARAMS, 0.))
+{
+  params[epsilon] = _epsilon;
+  params[sigma] = _sigma;
+}
+
+void PairPotential_LennardJones::setParameters(const parameters_t &_params)
+{
+  const size_t paramsDim = _params.size();
+  ASSERT( paramsDim <= getParameterDimension(),
+      "PairPotential_LennardJones::setParameters() - we need not more than "
+      +toString(getParameterDimension())+" parameters.");
+  for(size_t i=0;i<paramsDim;++i)
+    params[i] = _params[i];
+
+#ifndef NDEBUG
+  parameters_t check_params(getParameters());
+  check_params.resize(paramsDim); // truncate to same size
+  ASSERT( check_params == _params,
+      "PairPotential_LennardJones::setParameters() - failed, mismatch in to be set "
+      +toString(_params)+" and set "+toString(check_params)+" params.");
+#endif
+}
+
+PairPotential_LennardJones::results_t
+PairPotential_LennardJones::operator()(
+    const arguments_t &arguments
+    ) const
+{
+  ASSERT( arguments.size() == 1,
+      "PairPotential_LennardJones::operator() - requires one argument.");
+  ASSERT( ParticleTypeChecker::checkArgumentsAgainstParticleTypes(
+      arguments, getParticleTypes()),
+      "PairPotential_LennardJones::operator() - types don't match with ones in arguments.");
+  const double &r = arguments[0].distance;
+  const double temp = Helpers::pow(params[sigma]/r, 6);
+  const result_t result = 4.*params[epsilon] * (temp*temp - temp);
+  return std::vector<result_t>(1, result);
+}
+
+PairPotential_LennardJones::derivative_components_t
+PairPotential_LennardJones::derivative(
+    const arguments_t &arguments
+    ) const
+{
+  ASSERT( arguments.size() == 1,
+      "PairPotential_LennardJones::operator() - requires no argument.");
+  ASSERT( ParticleTypeChecker::checkArgumentsAgainstParticleTypes(
+      arguments, getParticleTypes()),
+      "PairPotential_LennardJones::operator() - types don't match with ones in arguments.");
+  const double &r = arguments[0].distance;
+  const double sigma6 = Helpers::pow(params[sigma], 6);
+  const result_t result =
+      4.*params[epsilon] * (
+          sigma6*sigma6*(-12.) / Helpers::pow(r,13)
+          - sigma6*(-6.) /Helpers::pow(r,7)
+      );
+  derivative_components_t results(1, result);
+  return results;
+}
+
+PairPotential_LennardJones::results_t
+PairPotential_LennardJones::parameter_derivative(
+    const arguments_t &arguments,
+    const size_t index
+    ) const
+{
+  ASSERT( arguments.size() == 1,
+      "PairPotential_LennardJones::parameter_derivative() - requires no argument.");
+  ASSERT( ParticleTypeChecker::checkArgumentsAgainstParticleTypes(
+      arguments, getParticleTypes()),
+      "PairPotential_LennardJones::operator() - types don't match with ones in arguments.");
+  const double &r = arguments[0].distance;
+  switch (index) {
+    case epsilon:
+    {
+      const double temp = Helpers::pow(params[sigma]/r, 6);
+      const result_t result = 4. * (temp*temp - temp);
+      return std::vector<result_t>(1, result);
+      break;
+    }
+    case sigma:
+    {
+      const double r6 = Helpers::pow(r, 6);
+      const result_t result =
+          4.*params[epsilon] * (
+              12. * Helpers::pow(params[sigma],11)/(r6*r6)
+              - 6. * Helpers::pow(params[sigma],5)/r6
+          );
+      return std::vector<result_t>(1, result);
+      break;
+    }
+    default:
+      break;
+  }
+  return std::vector<result_t>(1, 0.);
+}
+
+FunctionModel::extractor_t
+PairPotential_LennardJones::getSpecificExtractor() const
+{
+  Fragment::charges_t charges;
+  charges.resize(getParticleTypes().size());
+  std::transform(getParticleTypes().begin(), getParticleTypes().end(),
+      charges.begin(), boost::lambda::_1);
+  FunctionModel::extractor_t returnfunction =
+      boost::bind(&Extractors::gatherDistancesFromFragment,
+          boost::bind(&Fragment::getPositions, _1),
+          boost::bind(&Fragment::getCharges, _1),
+          charges,
+          _2);
+  return returnfunction;
+}
+
+FunctionModel::filter_t PairPotential_LennardJones::getSpecificFilter() const
+{
+  FunctionModel::filter_t returnfunction =
+      boost::bind(&Extractors::filterArgumentsByParticleTypes,
+          _1,
+          getParticleTypes());
+  return returnfunction;
+}
+
+void
+PairPotential_LennardJones::setParametersToRandomInitialValues(
+    const TrainingData &data)
+{
+  params[PairPotential_LennardJones::epsilon] = 1e-2*rand()/(double)RAND_MAX;
+  params[PairPotential_LennardJones::sigma] = (3.+10.*rand()/(double)RAND_MAX);// 0.5;
+}
+
Index: src/Potentials/Specifics/PairPotential_LennardJones.hpp
===================================================================
--- src/Potentials/Specifics/PairPotential_LennardJones.hpp	(revision 1413f4555b944ca972d0d485541e58d325f62feb)
+++ src/Potentials/Specifics/PairPotential_LennardJones.hpp	(revision 1413f4555b944ca972d0d485541e58d325f62feb)
@@ -0,0 +1,204 @@
+/*
+ * PairPotential_LennardJones.hpp
+ *
+ *  Created on: Jul 05, 2013
+ *      Author: heber
+ */
+
+#ifndef PAIRPOTENTIAL_LENNARDJONES_HPP_
+#define PAIRPOTENTIAL_LENNARDJONES_HPP_
+
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <limits>
+
+#include "Potentials/EmpiricalPotential.hpp"
+
+class PotentialFactory;
+class TrainingData;
+
+/** This is the implementation of a constant potential to adapt to any offset
+ * in the potential energy.
+ *
+ * This evaluates \f$ k \f$.
+ *
+ */
+class PairPotential_LennardJones :
+  public EmpiricalPotential
+{
+  //!> grant unit test access to internal parts
+  friend class PairPotential_LennardJonesTest;
+  //!> grant PotentialFactory access to default cstor
+  friend class PotentialFactory;
+  // some repeated typedefs to avoid ambiguities
+  typedef FunctionModel::arguments_t arguments_t;
+  typedef FunctionModel::result_t result_t;
+  typedef FunctionModel::results_t results_t;
+  typedef EmpiricalPotential::derivative_components_t derivative_components_t;
+  typedef FunctionModel::parameters_t parameters_t;
+private:
+  /** Private default constructor.
+   *
+   * This prevents creation of potential without set ParticleTypes_t.
+   *
+   * \note PotentialFactory may use this default cstor
+   *
+   */
+  PairPotential_LennardJones();
+
+public:
+  PairPotential_LennardJones(const ParticleTypes_t &_ParticleTypes);
+  PairPotential_LennardJones(
+      const ParticleTypes_t &_ParticleTypes,
+      const double _epsilon,
+      const double _sigma
+      );
+  virtual ~PairPotential_LennardJones() {}
+
+  /** Setter for parameters as required by FunctionModel interface.
+   *
+   * \param _params given set of parameters
+   */
+  void setParameters(const parameters_t &_params);
+
+  /** Getter for parameters as required by FunctionModel interface.
+   *
+   * \return set of parameters
+   */
+  parameters_t getParameters() const
+  {
+    return params;
+  }
+
+  /** Sets the parameter randomly within the sensible range of each parameter.
+   *
+   * \param data container with training data for guesstimating range
+   */
+  void setParametersToRandomInitialValues(const TrainingData &data);
+
+  /** Getter for the number of parameters of this model function.
+   *
+   * \return number of parameters
+   */
+  size_t getParameterDimension() const
+  {
+    return 2;
+  }
+
+  /** Evaluates the harmonic potential function for the given arguments.
+   *
+   * @param arguments single distance
+   * @return value of the potential function
+   */
+  results_t operator()(const arguments_t &arguments) const;
+
+  /** Evaluates the derivative of the potential function.
+   *
+   * @param arguments single distance
+   * @return vector with derivative with respect to the input degrees of freedom
+   */
+  derivative_components_t derivative(const arguments_t &arguments) const;
+
+  /** Evaluates the derivative of the function with the given \a arguments
+   * with respect to a specific parameter indicated by \a index.
+   *
+   * \param arguments set of arguments as input variables to the function
+   * \param index derivative of which parameter
+   * \return result vector containing the derivative with respect to the given
+   *         input
+   */
+  results_t parameter_derivative(const arguments_t &arguments, const size_t index) const;
+
+  /** Return the token name of this specific potential.
+   *
+   * \return token name of the potential
+   */
+  const std::string& getToken() const
+  { return potential_token; }
+
+  /** Returns a vector of parameter names.
+   *
+   * This is required from the specific implementation
+   *
+   * \return vector of strings containing parameter names
+   */
+  const ParameterNames_t& getParameterNames() const
+  { return ParameterNames; }
+
+  /** States whether lower and upper boundaries should be used to constraint
+   * the parameter search for this function model.
+   *
+   * \return true - constraints should be used, false - else
+   */
+  bool isBoxConstraint() const {
+    return true;
+  }
+
+  /** Returns a vector which are the lower boundaries for each parameter_t
+   * of this FunctionModel.
+   *
+   * \return vector of parameter_t resembling lowest allowed values
+   */
+  parameters_t getLowerBoxConstraints() const {
+    parameters_t lowerbound(getParameterDimension(), 0.);
+    return lowerbound;
+  }
+
+  /** Returns a vector which are the upper boundaries for each parameter_t
+   * of this FunctionModel.
+   *
+   * \return vector of parameter_t resembling highest allowed values
+   */
+  parameters_t getUpperBoxConstraints() const {
+    return parameters_t(getParameterDimension(), std::numeric_limits<double>::max());
+  }
+
+  /** Returns a bound function to be used with TrainingData, extracting distances
+   * from a Fragment.
+   *
+   * \return bound function extracting distances from a fragment
+   */
+  FunctionModel::extractor_t getSpecificExtractor() const;
+
+  /** Returns a bound function to be used with TrainingData, extracting distances
+   * from a Fragment.
+   *
+   * \return bound function extracting distances from a fragment
+   */
+  FunctionModel::filter_t getSpecificFilter() const;
+
+  /** Returns the number of arguments the underlying function requires.
+   *
+   * \return number of arguments of the function
+   */
+  size_t getSpecificArgumentCount() const
+  { return 0; }
+
+  enum parameter_enum_t {
+    epsilon=0,
+    sigma=1,
+    MAXPARAMS
+  };
+
+private:
+  /** Sets some sensible default parameter values.
+   *
+   */
+  void setDefaultParameters();
+
+private:
+  //!> parameter vector with parameters as in enum parameter_enum_t
+  parameters_t params;
+
+  //!> static definitions of the parameter name for this potential
+  static const ParameterNames_t ParameterNames;
+
+  //!> static token of this potential type
+  static const std::string potential_token;
+};
+
+#endif /* PAIRPOTENTIAL_LENNARDJONES_HPP_ */
Index: src/Potentials/Specifics/PotentialTypes.def
===================================================================
--- src/Potentials/Specifics/PotentialTypes.def	(revision 4792ab92082785a79b5b75b4d915318cfcce1211)
+++ src/Potentials/Specifics/PotentialTypes.def	(revision 1413f4555b944ca972d0d485541e58d325f62feb)
@@ -1,4 +1,4 @@
 //!> preprocessor sequence of all known potential types. Just add new parser here
-#define POTENTIALSEQUENCE (constant)(tersoff)(morse)(harmonic)(harmonic_angle)
+#define POTENTIALSEQUENCE (constant)(tersoff)(morse)(harmonic)(harmonic_angle)(lennardjones)
 //!> Number of enumerations calculate automatically
 #define PotentialTypes_END BOOST_PP_SEQ_SIZE(POTENTIALSEQUENCE)
Index: src/Potentials/Specifics/unittests/Makefile.am
===================================================================
--- src/Potentials/Specifics/unittests/Makefile.am	(revision 4792ab92082785a79b5b75b4d915318cfcce1211)
+++ src/Potentials/Specifics/unittests/Makefile.am	(revision 1413f4555b944ca972d0d485541e58d325f62feb)
@@ -7,4 +7,5 @@
 	../Potentials/Specifics/unittests/PairPotential_AngleUnitTest.cpp \
 	../Potentials/Specifics/unittests/PairPotential_HarmonicUnitTest.cpp \
+	../Potentials/Specifics/unittests/PairPotential_LennardJonesUnitTest.cpp \
 	../Potentials/Specifics/unittests/PairPotential_MorseUnitTest.cpp
 
@@ -14,4 +15,5 @@
 	../Potentials/Specifics/unittests/PairPotential_AngleUnitTest.hpp \
 	../Potentials/Specifics/unittests/PairPotential_HarmonicUnitTest.hpp \
+	../Potentials/Specifics/unittests/PairPotential_LennardJonesUnitTest.hpp \
 	../Potentials/Specifics/unittests/PairPotential_MorseUnitTest.hpp
 
@@ -21,4 +23,5 @@
 	PairPotential_AngleUnitTest \
 	PairPotential_HarmonicUnitTest \
+	PairPotential_LennardJonesUnitTest \
 	PairPotential_MorseUnitTest
 
@@ -57,4 +60,9 @@
 PairPotential_HarmonicUnitTest_LDADD = ${POTENTIALSSPECIFICSLIBS}
 
+PairPotential_LennardJonesUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
+	../Potentials/Specifics/unittests/PairPotential_LennardJonesUnitTest.cpp \
+	../Potentials/Specifics/unittests/PairPotential_LennardJonesUnitTest.hpp
+PairPotential_LennardJonesUnitTest_LDADD = ${POTENTIALSSPECIFICSLIBS}
+
 PairPotential_MorseUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
 	../Potentials/Specifics/unittests/PairPotential_MorseUnitTest.cpp \
Index: src/Potentials/Specifics/unittests/PairPotential_LennardJonesUnitTest.cpp
===================================================================
--- src/Potentials/Specifics/unittests/PairPotential_LennardJonesUnitTest.cpp	(revision 1413f4555b944ca972d0d485541e58d325f62feb)
+++ src/Potentials/Specifics/unittests/PairPotential_LennardJonesUnitTest.cpp	(revision 1413f4555b944ca972d0d485541e58d325f62feb)
@@ -0,0 +1,180 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2013 Frederik Heber. 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/>.
+ */
+
+/*
+ * PairPotential_LennardJonesUnitTest.cpp
+ *
+ *  Created on: Jul 05, 2013
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+using namespace std;
+
+#include <cppunit/CompilerOutputter.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+#include <cppunit/ui/text/TestRunner.h>
+
+#include "PairPotential_LennardJonesUnitTest.hpp"
+
+#include <boost/assign.hpp>
+
+#include "CodePatterns/Assert.hpp"
+
+#include "FunctionApproximation/FunctionArgument.hpp"
+#include "Potentials/Specifics/PairPotential_LennardJones.hpp"
+#include "Potentials/helpers.hpp"
+
+using namespace boost::assign;
+
+#ifdef HAVE_TESTRUNNER
+#include "UnitTestMain.hpp"
+#endif /*HAVE_TESTRUNNER*/
+
+/********************************************** Test classes **************************************/
+
+// Registers the fixture into the 'registry'
+CPPUNIT_TEST_SUITE_REGISTRATION( PairPotential_LennardJonesTest );
+
+
+void PairPotential_LennardJonesTest::setUp()
+{
+  // failing asserts should be thrown
+  ASSERT_DO(Assert::Throw);
+
+  // data is taken from gnuplot via
+  // g(x)=4*epsilon*((sigma/x)**12 - (sigma/x)**6)
+  // set table "lj.dat"
+  // set samples 10
+  // plot [1.89012:4.46595] g(x)
+  epsilon = 0.897888;
+  sigma = 1.92953;
+  input +=
+    1.89012,
+    2.17632,
+    2.46253,
+    2.74873,
+    3.03493,
+    3.32114,
+    3.60734,
+    3.89354,
+    4.17975,
+    4.46595;
+  output +=
+    0.535795,
+    -0.897154,
+    -0.638834,
+    -0.378315,
+    -0.221526,
+    -0.132813,
+    -0.0821442,
+    -0.0524131,
+    -0.0344245,
+    -0.0232099;
+
+  CPPUNIT_ASSERT_EQUAL( input.size(), output.size() );
+}
+
+
+void PairPotential_LennardJonesTest::tearDown()
+{
+}
+
+/** UnitTest for operator()
+ */
+void PairPotential_LennardJonesTest::operatorTest()
+{
+  PairPotential_LennardJones::ParticleTypes_t types =
+      boost::assign::list_of<PairPotential_LennardJones::ParticleType_t>
+        (0)(1)
+      ;
+  PairPotential_LennardJones lj(types, epsilon, sigma);
+  for (size_t index = 0; index < input.size(); ++index) {
+    argument_t arg(argument_t::indices_t(0,1), argument_t::types_t(0,1), input[index]);
+    CPPUNIT_ASSERT(
+        Helpers::isEqual(
+            output[index],
+            lj( FunctionModel::arguments_t(1,arg) )[0],
+            1.e-4/std::numeric_limits<double>::epsilon() // only compare four digits
+        )
+    );
+  }
+}
+
+/** UnitTest for derivative()
+ */
+void PairPotential_LennardJonesTest::derivativeTest()
+{
+  PairPotential_LennardJones::ParticleTypes_t types =
+      boost::assign::list_of<PairPotential_LennardJones::ParticleType_t>
+        (0)(1)
+      ;
+  PairPotential_LennardJones lj(types, epsilon, sigma);
+  argument_t arg(argument_t::indices_t(0,1), argument_t::types_t(0,1), pow(2,1./6.)*sigma);
+  // check for zero derivative at minimum
+  CPPUNIT_ASSERT(
+      Helpers::isEqual(
+          0.,
+          lj.derivative(
+              FunctionModel::arguments_t(1,arg)
+          )[0],
+          1.e+6
+      )
+  );
+}
+
+
+/** UnitTest for parameter_derivative()
+ */
+void PairPotential_LennardJonesTest::parameter_derivativeTest()
+{
+  PairPotential_LennardJones::ParticleTypes_t types =
+      boost::assign::list_of<PairPotential_LennardJones::ParticleType_t>
+        (0)(1)
+      ;
+  PairPotential_LennardJones lj(types, epsilon, sigma);
+  argument_t arg(argument_t::indices_t(0,1), argument_t::types_t(0,1), pow(2,1./6.)*sigma);
+  CPPUNIT_ASSERT(
+      Helpers::isEqual(
+          -1.,
+          lj.parameter_derivative(
+              FunctionModel::arguments_t(1,arg),
+              0
+          )[0],
+          1.e+6
+      )
+  );
+  CPPUNIT_ASSERT(
+      Helpers::isEqual(
+          0.,
+          lj.parameter_derivative(
+              FunctionModel::arguments_t(1,arg),
+              1
+          )[0],
+          1.e+6
+      )
+  );
+}
Index: src/Potentials/Specifics/unittests/PairPotential_LennardJonesUnitTest.hpp
===================================================================
--- src/Potentials/Specifics/unittests/PairPotential_LennardJonesUnitTest.hpp	(revision 1413f4555b944ca972d0d485541e58d325f62feb)
+++ src/Potentials/Specifics/unittests/PairPotential_LennardJonesUnitTest.hpp	(revision 1413f4555b944ca972d0d485541e58d325f62feb)
@@ -0,0 +1,45 @@
+/*
+ * PairPotential_LennardJonesUnitTest.hpp
+ *
+ *  Created on: Jul 05, 2013
+ *      Author: heber
+ */
+
+#ifndef PAIRPOTENTIAL_LENNARDJONESUNITTEST_HPP_
+#define PAIRPOTENTIAL_LENNARDJONESUNITTEST_HPP_
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <vector>
+
+#include <cppunit/extensions/HelperMacros.h>
+
+/********************************************** Test classes **************************************/
+
+class PairPotential_LennardJonesTest : public CppUnit::TestFixture
+{
+    CPPUNIT_TEST_SUITE( PairPotential_LennardJonesTest) ;
+    CPPUNIT_TEST ( operatorTest );
+    CPPUNIT_TEST ( derivativeTest );
+    CPPUNIT_TEST ( parameter_derivativeTest );
+    CPPUNIT_TEST_SUITE_END();
+
+public:
+      void setUp();
+      void tearDown();
+      void operatorTest();
+      void derivativeTest();
+      void parameter_derivativeTest();
+
+
+private:
+      typedef std::vector<double> data_t;
+      data_t input;
+      data_t output;
+      double epsilon, sigma;
+};
+
+#endif /* PAIRPOTENTIAL_LENNARDJONESUNITTEST_HPP_ */
Index: tests/regression/Fragmentation/FitPotential/pre/lj_homology.dat
===================================================================
--- tests/regression/Fragmentation/FitPotential/pre/lj_homology.dat	(revision 1413f4555b944ca972d0d485541e58d325f62feb)
+++ tests/regression/Fragmentation/FitPotential/pre/lj_homology.dat	(revision 1413f4555b944ca972d0d485541e58d325f62feb)
@@ -0,0 +1,272 @@
+22 serialization::archive 9 1 0
+0 0 0 90 0 0 0 1 0
+1 0 0 1 0 0 0 1 0
+2 18 0 1 0 0 0 0 0 1 1 0
+3 0 0 1 0 0 0 3 0 0 0 0 18 -526.80098113869781 0
+4 1 0
+5 18 0 1 0 0
+6 1 0 3 0 7.7478765531735849 0 0 18 -526.80098113869781 0
+7 1 0
+8 18 0 1 0 0
+9 1 0 3 0 0 0 0 18 -526.80098113869781 0
+10 1 0
+11 18 0 1 0 0
+12 1 0 3 0 7.9629084734139814 0 0 18 -526.8009811386994 0
+13 1 0
+14 18 0 1 0 0
+15 1 0 3 0 0 0 0 18 -526.80098113869781 0
+16 1 0
+17 18 0 1 0 0
+18 1 0 3 0 8.1779592909142629 0 0 18 -526.80098113869781 0
+19 1 0
+20 18 0 1 0 0
+21 1 0 3 0 0 0 0 18 -526.80098113869781 0
+22 1 0
+23 18 0 1 0 0
+24 1 0 3 0 8.3929912111546567 0 0 18 -526.80098113869974 0
+25 1 0
+26 18 0 1 0 0
+27 1 0 3 0 0 0 0 18 -526.80098113869781 0
+28 1 0
+29 18 0 1 0 0
+30 1 0 3 0 8.6080231313950542 0 0 18 -526.80098113869792 0
+31 1 0
+32 18 0 1 0 0
+33 1 0 3 0 0 0 0 18 -526.80098113869781 0
+34 1 0
+35 18 0 1 0 0
+36 1 0 3 0 8.8230739488953347 0 0 18 -526.80098113869667 0
+37 1 0
+38 18 0 1 0 0
+39 1 0 3 0 0 0 0 18 -526.80098113869781 0
+40 1 0
+41 18 0 1 0 0
+42 1 0 3 0 9.0381058691357303 0 0 18 -526.8009811386986 0
+43 1 0
+44 18 0 1 0 0
+45 1 0 3 0 0 0 0 18 -526.80098113869781 0
+46 1 0
+47 18 0 1 0 0
+48 1 0 3 0 9.2531377893761277 0 0 18 -526.80098113869985 0
+49 1 0
+50 18 0 1 0 0
+51 1 0 3 0 0 0 0 18 -526.80098113869781 0
+52 1 0
+53 18 0 1 0 0
+54 1 0 3 0 9.4681697096165234 0 0 18 -526.80098113869906 0
+55 1 0
+56 18 0 1 0 0
+57 1 0 3 0 0 0 0 18 -526.80098113869781 0
+58 1 0
+59 18 0 1 0 0
+60 1 0 3 0 9.6832205271168039 0 0 18 -526.80098113869826 0
+61 1 0
+62 18 0 1 0 0
+63 1 0 3 0 0 0 0 18 -526.80098113869781 0
+64 1 0
+65 18 0 1 0 0
+66 1 0 3 0 9.8982524473571996 0 0 18 -526.80098113869883 0
+67 1 0
+68 18 0 1 0 0
+69 1 0 3 0 0 0 0 18 -526.80098113869781 0
+70 1 0
+71 18 0 1 0 0
+72 1 0 3 0 10.113284367597595 0 0 18 -526.80098113869735 0
+73 1 0
+74 18 0 1 0 0
+75 1 0 3 0 0 0 0 18 -526.80098113869781 0
+76 1 0
+77 18 0 1 0 0
+78 1 0 3 0 10.328335185097876 0 0 18 -526.8009811386986 0
+79 1 0
+80 18 0 1 0 0
+81 1 0 3 0 0 0 0 18 -526.80098113869781 0
+82 1 0
+83 18 0 1 0 0
+84 1 0 3 0 10.543367105338273 0 0 18 -526.80098113869906 0
+85 1 0
+86 18 0 1 0 0
+87 1 0 3 0 0 0 0 18 -526.80098113869781 0
+88 1 0
+89 18 0 1 0 0
+90 1 0 3 0 10.758399025578669 0 0 18 -526.80098113869656 0
+91 1 0
+92 18 0 1 0 0
+93 1 0 3 0 0 0 0 18 -526.80098113869781 0
+94 1 0
+95 18 0 1 0 0
+96 1 0 3 0 10.973449843078949 0 0 18 -526.80098113869838 0
+97 1 0
+98 18 0 1 0 0
+99 1 0 3 0 0 0 0 18 -526.80098113869781 0
+100 1 0
+101 18 0 1 0 0
+102 1 0 3 0 11.188481763319345 0 0 18 -526.80098113869838 0
+103 1 0
+104 18 0 1 0 0
+105 1 0 3 0 0 0 0 18 -526.80098113869781 0
+106 1 0
+107 18 0 1 0 0
+108 1 0 3 0 11.403513683559741 0 0 18 -526.80098113869826 0
+109 1 0
+110 18 0 1 0 0
+111 1 0 3 0 0 0 0 18 -526.80098113869781 0
+112 1 0
+113 18 0 1 0 0
+114 1 0 3 0 11.618564501060021 0 0 18 -526.80098113869769 0
+115 1 0
+116 18 0 1 0 0
+117 1 0 3 0 0 0 0 18 -526.80098113869781 0
+118 1 0
+119 18 0 1 0 0
+120 1 0 3 0 11.833596421300417 0 0 18 -526.80098113869724 0
+121 1 0
+122 18 0 1 0 0
+123 1 0 3 0 0 0 0 18 -526.80098113869781 0
+124 1 0
+125 18 0 1 0 0
+126 1 0 3 0 12.048628341540814 0 0 18 -526.80098113869815 0
+127 1 0
+128 18 0 1 0 0
+129 1 0 3 0 0 0 0 18 -526.80098113869781 0
+130 1 0
+131 18 0 1 0 0
+132 1 0 3 0 12.263679159041095 0 0 18 -526.80098113869838 0
+133 1 0
+134 18 0 1 0 0
+135 1 0 3 0 0 0 0 18 -526.80098113869781 0
+136 1 0
+137 18 0 1 0 0
+138 1 0 3 0 12.47871107928149 0 0 18 -526.80098113869906 0
+139 1 0
+140 18 0 1 0 0
+141 1 0 3 0 0 0 0 18 -526.80098113869781 0
+142 1 0
+143 18 0 1 0 0
+144 1 0 3 0 12.693742999521888 0 0 18 -526.80098113869781 0
+145 1 0
+146 18 0 1 0 0
+147 1 0 3 0 0 0 0 18 -526.80098113869781 0
+148 1 0
+149 18 0 1 0 0
+150 1 0 3 0 12.908774919762282 0 0 18 -526.80098113869792 0
+151 1 0
+152 18 0 1 0 0
+153 1 0 3 0 0 0 0 18 -526.80098113869781 0
+154 1 0
+155 18 0 1 0 0
+156 1 0 3 0 13.123825737262562 0 0 18 -526.80098113869792 0
+157 1 0
+158 18 0 1 0 0
+159 1 0 3 0 0 0 0 18 -526.80098113869781 0
+160 1 0
+161 18 0 1 0 0
+162 1 0 3 0 13.33885765750296 0 0 18 -526.80098113869781 0
+163 1 0
+164 18 0 1 0 0
+165 1 0 3 0 0 0 0 18 -526.80098113869781 0
+166 1 0
+167 18 0 1 0 0
+168 1 0 3 0 13.553889577743355 0 0 18 -526.80098113869849 0
+169 1 0
+170 18 0 1 0 0
+171 1 0 3 0 0 0 0 18 -526.80098113869781 0
+172 1 0
+173 18 0 1 0 0
+174 1 0 3 0 13.768940395243636 0 0 18 -526.80098113869872 0
+175 1 0
+176 18 0 1 0 0
+177 1 0 3 0 0 0 0 18 -526.80098113869781 0
+178 1 0
+179 18 0 1 0 0
+180 1 0 3 0 13.983972315484033 0 0 18 -526.80098113869849 0
+181 1 0
+182 18 0 2 0 0
+183 2 0 3 0 0 0 0 18 3 0 7.7478765531735849 0 0 18 6.6946925244337763e-05 0
+184 1 0
+185 18 0 2 0 0
+186 2 0 3 0 0 0 0 18 3 0 7.9629084734139814 0 0 18 3.1313933277488104e-05 0
+187 1 0
+188 18 0 2 0 0
+189 2 0 3 0 0 0 0 18 3 0 8.1779592909142629 0 0 18 1.00932477380411e-05 0
+190 1 0
+191 18 0 2 0 0
+192 2 0 3 0 0 0 0 18 3 0 8.3929912111546567 0 0 18 -2.003853637688735e-06 0
+193 1 0
+194 18 0 2 0 0
+195 2 0 3 0 0 0 0 18 3 0 8.6080231313950542 0 0 18 -8.5344285025712452e-06 0
+196 1 0
+197 18 0 2 0 0
+198 2 0 3 0 0 0 0 18 3 0 8.8230739488953347 0 0 18 -1.1774555332522141e-05 0
+199 1 0
+200 18 0 2 0 0
+201 2 0 3 0 0 0 0 18 3 0 9.0381058691357303 0 0 18 -1.3102843809065234e-05 0
+202 1 0
+203 18 0 2 0 0
+204 2 0 3 0 0 0 0 18 3 0 9.2531377893761277 0 0 18 -1.3313790759639232e-05 0
+205 1 0
+206 18 0 2 0 0
+207 2 0 3 0 0 0 0 18 3 0 9.4681697096165234 0 0 18 -1.2852214581471344e-05 0
+208 1 0
+209 18 0 2 0 0
+210 2 0 3 0 0 0 0 18 3 0 9.6832205271168039 0 0 18 -1.1973692835454131e-05 0
+211 1 0
+212 18 0 2 0 0
+213 2 0 3 0 0 0 0 18 3 0 9.8982524473571996 0 0 18 -1.0840870231731969e-05 0
+214 1 0
+215 18 0 2 0 0
+216 2 0 3 0 0 0 0 18 3 0 10.113284367597595 0 0 18 -9.5718712600501021e-06 0
+217 1 0
+218 18 0 2 0 0
+219 2 0 3 0 0 0 0 18 3 0 10.328335185097876 0 0 18 -8.2603543205550523e-06 0
+220 1 0
+221 18 0 2 0 0
+222 2 0 3 0 0 0 0 18 3 0 10.543367105338273 0 0 18 -6.9811050025236909e-06 0
+223 1 0
+224 18 0 2 0 0
+225 2 0 3 0 0 0 0 18 3 0 10.758399025578669 0 0 18 -5.7894145584214129e-06 0
+226 1 0
+227 18 0 2 0 0
+228 2 0 3 0 0 0 0 18 3 0 10.973449843078949 0 0 18 -4.7213208063112688e-06 0
+229 1 0
+230 18 0 2 0 0
+231 2 0 3 0 0 0 0 18 3 0 11.188481763319345 0 0 18 -3.7954163190079271e-06 0
+232 1 0
+233 18 0 2 0 0
+234 2 0 3 0 0 0 0 18 3 0 11.403513683559741 0 0 18 -3.0152962153806584e-06 0
+235 1 0
+236 18 0 2 0 0
+237 2 0 3 0 0 0 0 18 3 0 11.618564501060021 0 0 18 -2.3738474510537344e-06 0
+238 1 0
+239 18 0 2 0 0
+240 2 0 3 0 0 0 0 18 3 0 11.833596421300417 0 0 18 -1.8572890212453785e-06 0
+241 1 0
+242 18 0 2 0 0
+243 2 0 3 0 0 0 0 18 3 0 12.048628341540814 0 0 18 -1.4482508277069428e-06 0
+244 1 0
+245 18 0 2 0 0
+246 2 0 3 0 0 0 0 18 3 0 12.263679159041095 0 0 18 -1.1285741265965044e-06 0
+247 1 0
+248 18 0 2 0 0
+249 2 0 3 0 0 0 0 18 3 0 12.47871107928149 0 0 18 -8.8109061380237108e-07 0
+250 1 0
+251 18 0 2 0 0
+252 2 0 3 0 0 0 0 18 3 0 12.693742999521888 0 0 18 -6.9050815909577068e-07 0
+253 1 0
+254 18 0 2 0 0
+255 2 0 3 0 0 0 0 18 3 0 12.908774919762282 0 0 18 -5.4393251502915518e-07 0
+256 1 0
+257 18 0 2 0 0
+258 2 0 3 0 0 0 0 18 3 0 13.123825737262562 0 0 18 -4.3090642520837719e-07 0
+259 1 0
+260 18 0 2 0 0
+261 2 0 3 0 0 0 0 18 3 0 13.33885765750296 0 0 18 -3.4324193620705046e-07 0
+262 1 0
+263 18 0 2 0 0
+264 2 0 3 0 0 0 0 18 3 0 13.553889577743355 0 0 18 -2.7465625862532761e-07 0
+265 1 0
+266 18 0 2 0 0
+267 2 0 3 0 0 0 0 18 3 0 13.768940395243636 0 0 18 -2.2044491743145045e-07 0
+268 1 0
+269 18 0 2 0 0
+270 2 0 3 0 0 0 0 18 3 0 13.983972315484033 0 0 18 -1.7716956790536642e-07 0
Index: tests/regression/Fragmentation/FitPotential/testsuite-fragmentation-fit-potential.at
===================================================================
--- tests/regression/Fragmentation/FitPotential/testsuite-fragmentation-fit-potential.at	(revision 4792ab92082785a79b5b75b4d915318cfcce1211)
+++ tests/regression/Fragmentation/FitPotential/testsuite-fragmentation-fit-potential.at	(revision 1413f4555b944ca972d0d485541e58d325f62feb)
@@ -48,2 +48,17 @@
 
 AT_CLEANUP
+
+AT_SETUP([Fragmentation - Fit LJ potential to argon])
+AT_KEYWORDS([fragmentation parse-homologies fit-potential lennardjones])
+AT_SKIP_IF([../../molecuilder --help --actionname fit-potential; if test $? -eq 5; then /bin/true; else /bin/false; fi])
+
+file=lj_homology.dat
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/tests/regression/Fragmentation/FitPotential/pre/$file $file], 0)
+AT_CHECK([chmod u+w $file], 0, [ignore], [ignore])
+AT_CHECK([../../molecuilder --parse-homologies $file --fit-potential --potential-type "lennardjones" --potential-charges 18 18 --fragment-charges 18 18 --set-threshold 7e-11], 0, [stdout], [ignore])
+# check that L_2 error is below 7e-11
+AT_CHECK([grep "Best parameters with L2 error" stdout | awk '{if ($8 > 7e-11) exit 1}'], 0, [ignore], [ignore])
+# check parameters to printed precision
+AT_CHECK([grep "lennardjones:.*particle_type1=18,.*particle_type2=18,.*epsilon=1.*e-05,.*sigma=8.2.*;" stdout], 0, [ignore], [ignore])
+
+AT_CLEANUP
