[6bb72a] | 1 | /*
|
---|
| 2 | * PairPotential_Harmonic.hpp
|
---|
| 3 | *
|
---|
| 4 | * Created on: Sep 26, 2012
|
---|
| 5 | * Author: heber
|
---|
| 6 | */
|
---|
| 7 |
|
---|
| 8 | #ifndef PAIRPOTENTIAL_HARMONIC_HPP_
|
---|
| 9 | #define PAIRPOTENTIAL_HARMONIC_HPP_
|
---|
| 10 |
|
---|
| 11 |
|
---|
| 12 | // include config.h
|
---|
| 13 | #ifdef HAVE_CONFIG_H
|
---|
| 14 | #include <config.h>
|
---|
| 15 | #endif
|
---|
| 16 |
|
---|
| 17 |
|
---|
| 18 | #include "Potentials/EmpiricalPotential.hpp"
|
---|
[4f82f8] | 19 | #include "FunctionApproximation/FunctionModel.hpp"
|
---|
[6bb72a] | 20 |
|
---|
| 21 | /** This is the implementation of a harmonic pair potential.
|
---|
| 22 | *
|
---|
| 23 | * This evaluates \f$ k \cdot (r -r_0)^2 \f$.
|
---|
| 24 | *
|
---|
| 25 | */
|
---|
[4f82f8] | 26 | class PairPotential_Harmonic : public EmpiricalPotential, public FunctionModel
|
---|
[6bb72a] | 27 | {
|
---|
| 28 | public:
|
---|
[4f82f8] | 29 | PairPotential_Harmonic();
|
---|
[6bb72a] | 30 | PairPotential_Harmonic(
|
---|
| 31 | const double _spring_constant,
|
---|
| 32 | const double _equilibrium_distance) :
|
---|
| 33 | spring_constant(_spring_constant),
|
---|
| 34 | equilibrium_distance(_equilibrium_distance)
|
---|
| 35 | {}
|
---|
| 36 | virtual ~PairPotential_Harmonic() {}
|
---|
| 37 |
|
---|
[4f82f8] | 38 | /** Setter for parameters as required by FunctionModel interface.
|
---|
| 39 | *
|
---|
| 40 | * \param _params given set of parameters
|
---|
| 41 | */
|
---|
| 42 | void setParameters(const parameters_t &_params);
|
---|
| 43 |
|
---|
| 44 | /** Getter for parameters as required by FunctionModel interface.
|
---|
| 45 | *
|
---|
| 46 | * \return set of parameters
|
---|
| 47 | */
|
---|
| 48 | parameters_t getParameters() const;
|
---|
| 49 |
|
---|
| 50 | /** Getter for the number of parameters of this model function.
|
---|
| 51 | *
|
---|
| 52 | * \return number of parameters
|
---|
| 53 | */
|
---|
| 54 | size_t getParameterDimension() const
|
---|
| 55 | {
|
---|
| 56 | return 2;
|
---|
| 57 | }
|
---|
| 58 |
|
---|
[6bb72a] | 59 | /** Evaluates the harmonic potential function for the given arguments.
|
---|
| 60 | *
|
---|
| 61 | * @param arguments single distance
|
---|
| 62 | * @return value of the potential function
|
---|
| 63 | */
|
---|
[4f82f8] | 64 | results_t operator()(const arguments_t &arguments) const;
|
---|
[6bb72a] | 65 |
|
---|
| 66 | /** Evaluates the derivative of the potential function.
|
---|
| 67 | *
|
---|
| 68 | * @param arguments single distance
|
---|
| 69 | * @return vector with derivative with respect to the input degrees of freedom
|
---|
| 70 | */
|
---|
| 71 | derivative_components_t derivative(const arguments_t &arguments) const;
|
---|
| 72 |
|
---|
| 73 | private:
|
---|
| 74 | //!> the spring constant for the harmonic potential
|
---|
[4f82f8] | 75 | double spring_constant;
|
---|
[6bb72a] | 76 | //!> the equilibrium distance indicating the potential minimum
|
---|
[4f82f8] | 77 | double equilibrium_distance;
|
---|
[6bb72a] | 78 | };
|
---|
| 79 |
|
---|
| 80 | #endif /* PAIRPOTENTIAL_HARMONIC_HPP_ */
|
---|