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
+      )
+  );
+}
