Index: src/Potentials/Specifics/PairPotential_Morse.cpp
===================================================================
--- src/Potentials/Specifics/PairPotential_Morse.cpp	(revision 155cc2b018aff9ee38cdc162034777bae6e9c894)
+++ src/Potentials/Specifics/PairPotential_Morse.cpp	(revision 155cc2b018aff9ee38cdc162034777bae6e9c894)
@@ -0,0 +1,148 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2012 University of Bonn. 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_Morse.cpp
+ *
+ *  Created on: Oct 03, 2012
+ *      Author: heber
+ */
+
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "CodePatterns/MemDebug.hpp"
+
+#include "PairPotential_Morse.hpp"
+
+#include <cmath>
+
+#include "CodePatterns/Assert.hpp"
+
+#include "Potentials/helpers.hpp"
+
+PairPotential_Morse::PairPotential_Morse() :
+  params(parameters_t(MAXPARAMS, 0.))
+{}
+
+PairPotential_Morse::PairPotential_Morse(
+    const double _spring_constant,
+    const double _equilibrium_distance,
+    const double _dissociation_energy,
+    const double _energy_offset) :
+      params(parameters_t(MAXPARAMS, 0.))
+{
+  params[spring_constant] = _spring_constant;
+  params[equilibrium_distance] = _equilibrium_distance;
+  params[dissociation_energy] = _dissociation_energy;
+  params[energy_offset] = _energy_offset;
+}
+
+PairPotential_Morse::results_t
+PairPotential_Morse::operator()(
+    const arguments_t &arguments
+    ) const
+{
+  ASSERT( arguments.size() == 1,
+      "PairPotential_Morse::operator() - requires exactly one argument.");
+  const argument_t &r_ij = arguments[0];
+  const result_t result =
+      params[dissociation_energy] * Helpers::pow( 1.
+          - exp( - params[spring_constant] * ( r_ij.distance - params[equilibrium_distance])),2)
+            + params[energy_offset];
+  return std::vector<result_t>(1, result);
+}
+
+PairPotential_Morse::derivative_components_t
+PairPotential_Morse::derivative(
+    const arguments_t &arguments
+    ) const
+{
+  ASSERT( arguments.size() == 1,
+      "PairPotential_Morse::operator() - requires exactly one argument.");
+  derivative_components_t result;
+  const argument_t &r_ij = arguments[0];
+  result.push_back(
+      2. * params[dissociation_energy]
+      * ( 1. - exp( - params[spring_constant] * ( r_ij.distance - params[equilibrium_distance])))
+      * -1. * exp( - params[spring_constant] * ( r_ij.distance - params[equilibrium_distance]))
+      * (- params[spring_constant])
+  );
+  ASSERT( result.size() == 1,
+      "PairPotential_Morse::operator() - we did not create exactly one component.");
+  return result;
+}
+
+PairPotential_Morse::results_t
+PairPotential_Morse::parameter_derivative(
+    const arguments_t &arguments,
+    const size_t index
+    ) const
+{
+  ASSERT( arguments.size() == 1,
+      "PairPotential_Morse::parameter_derivative() - requires exactly one argument.");
+  const argument_t &r_ij = arguments[0];
+  switch (index) {
+    case spring_constant:
+    {
+      const result_t result =
+          2. * params[dissociation_energy]
+          * ( 1. - exp( - params[spring_constant] * ( r_ij.distance - params[equilibrium_distance])))
+          * -1. * exp( - params[spring_constant] * ( r_ij.distance - params[equilibrium_distance]))
+          * (- ( r_ij.distance - params[equilibrium_distance]))
+          ;
+      return std::vector<result_t>(1, result);
+      break;
+    }
+    case equilibrium_distance:
+    {
+      const result_t result =
+          2. * params[dissociation_energy]
+          * ( 1. - exp( - params[spring_constant] * ( r_ij.distance - params[equilibrium_distance])))
+          * -1. * exp( - params[spring_constant] * ( r_ij.distance - params[equilibrium_distance]))
+          * params[spring_constant]
+          ;
+      return std::vector<result_t>(1, result);
+      break;
+    }
+    case dissociation_energy:
+    {
+      const result_t result =
+          Helpers::pow(1.
+              - exp( - params[spring_constant] * ( r_ij.distance - params[equilibrium_distance])),2);
+      return std::vector<result_t>(1, result);
+      break;
+    }
+    case energy_offset:
+    {
+      const result_t result = +1.;
+      return std::vector<result_t>(1, result);
+      break;
+    }
+    default:
+      break;
+  }
+}
Index: src/Potentials/Specifics/PairPotential_Morse.hpp
===================================================================
--- src/Potentials/Specifics/PairPotential_Morse.hpp	(revision 155cc2b018aff9ee38cdc162034777bae6e9c894)
+++ src/Potentials/Specifics/PairPotential_Morse.hpp	(revision 155cc2b018aff9ee38cdc162034777bae6e9c894)
@@ -0,0 +1,111 @@
+/*
+ * PairPotential_Morse.hpp
+ *
+ *  Created on: Oct 03, 2012
+ *      Author: heber
+ */
+
+#ifndef PAIRPOTENTIAL_MORSE_HPP_
+#define PAIRPOTENTIAL_MORSE_HPP_
+
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "CodePatterns/Assert.hpp"
+
+#include "Potentials/EmpiricalPotential.hpp"
+#include "FunctionApproximation/FunctionModel.hpp"
+
+/** This is the implementation of a harmonic pair potential.
+ *
+ * This evaluates \f$ k \cdot (r -r_0)^2 \f$.
+ *
+ */
+class PairPotential_Morse : virtual public EmpiricalPotential, virtual public FunctionModel
+{
+  // 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;
+public:
+  PairPotential_Morse();
+  PairPotential_Morse(
+      const double _spring_constant,
+      const double _equilibrium_distance,
+      const double _dissociation_energy,
+      const double _energy_offset);
+  virtual ~PairPotential_Morse() {}
+
+  /** Setter for parameters as required by FunctionModel interface.
+   *
+   * \param _params given set of parameters
+   */
+  void setParameters(const parameters_t &_params)
+  {
+    ASSERT( _params.size() <= getParameterDimension(),
+        "PairPotential_Morse::setParameters() - we need not more than "
+        +toString(getParameterDimension())+" parameters.");
+    for(size_t i=0;i<_params.size();++i)
+      params[i] = _params[i];
+  }
+
+  /** Getter for parameters as required by FunctionModel interface.
+   *
+   * \return set of parameters
+   */
+  parameters_t getParameters() const
+  {
+    return params;
+  }
+
+  /** Getter for the number of parameters of this model function.
+   *
+   * \return number of parameters
+   */
+  size_t getParameterDimension() const
+  {
+    return 4;
+  }
+
+  /** 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;
+
+private:
+  enum parameter_enum_t {
+    spring_constant=0,
+    equilibrium_distance=1,
+    dissociation_energy=2,
+    energy_offset=3,
+    MAXPARAMS
+  };
+  //!> parameter vector with parameters as in enum parameter_enum_t
+  parameters_t params;
+};
+
+#endif /* PAIRPOTENTIAL_MORSE_HPP_ */
