| [6bb72a] | 1 | /*
 | 
|---|
 | 2 |  * EmpiricalPotential.hpp
 | 
|---|
 | 3 |  *
 | 
|---|
 | 4 |  *  Created on: Sep 26, 2012
 | 
|---|
 | 5 |  *      Author: heber
 | 
|---|
 | 6 |  */
 | 
|---|
 | 7 | 
 | 
|---|
 | 8 | #ifndef EMPIRICALPOTENTIAL_HPP_
 | 
|---|
 | 9 | #define EMPIRICALPOTENTIAL_HPP_
 | 
|---|
 | 10 | 
 | 
|---|
 | 11 | 
 | 
|---|
 | 12 | // include config.h
 | 
|---|
 | 13 | #ifdef HAVE_CONFIG_H
 | 
|---|
 | 14 | #include <config.h>
 | 
|---|
 | 15 | #endif
 | 
|---|
 | 16 | 
 | 
|---|
 | 17 | #include <vector>
 | 
|---|
 | 18 | 
 | 
|---|
| [4f82f8] | 19 | #include "FunctionApproximation/FunctionArgument.hpp"
 | 
|---|
| [fdd23a] | 20 | #include "FunctionApproximation/FunctionModel.hpp"
 | 
|---|
 | 21 | #include "Potentials/SerializablePotential.hpp"
 | 
|---|
| [94453f1] | 22 | #include "Potentials/InternalCoordinates/Coordinator.hpp"
 | 
|---|
| [4f82f8] | 23 | 
 | 
|---|
| [6bb72a] | 24 | /** An EmpiricalPotential is a function that is given a vector of objects as
 | 
|---|
 | 25 |  * arguments which it uses to evaluate an internal function and returns a
 | 
|---|
 | 26 |  * value representing the energy of this configuration indicated by the
 | 
|---|
 | 27 |  * arguments.
 | 
|---|
 | 28 |  *
 | 
|---|
 | 29 |  * It is to be used inside an std::accumulate function after a vector of
 | 
|---|
 | 30 |  * arguments (i.e. a vector of a vector) has been prepared initially.
 | 
|---|
 | 31 |  *
 | 
|---|
 | 32 |  */
 | 
|---|
| [fdd23a] | 33 | class EmpiricalPotential :
 | 
|---|
 | 34 |     public FunctionModel,
 | 
|---|
 | 35 |     public SerializablePotential
 | 
|---|
| [6bb72a] | 36 | {
 | 
|---|
 | 37 | public:
 | 
|---|
| [3ccea3] | 38 |   //!> typedef for the argument vector as input to the function
 | 
|---|
 | 39 |   typedef std::vector<argument_t> arguments_t;
 | 
|---|
 | 40 |   //!> typedef for a single result degree of freedom
 | 
|---|
 | 41 |   typedef double result_t;
 | 
|---|
 | 42 |   //!> typedef for the result vector as returned by the function
 | 
|---|
 | 43 |   typedef std::vector<result_t> results_t;
 | 
|---|
 | 44 |   //!> typedef for the components of the derivative
 | 
|---|
 | 45 |   typedef std::vector<result_t> derivative_components_t;
 | 
|---|
 | 46 | 
 | 
|---|
| [6bb72a] | 47 |   /** Default constructor for class EmpiricalPotential.
 | 
|---|
 | 48 |    *
 | 
|---|
 | 49 |    */
 | 
|---|
| [fdd23a] | 50 |   EmpiricalPotential(const ParticleTypes_t &_ParticleTypes) :
 | 
|---|
 | 51 |     SerializablePotential(_ParticleTypes)
 | 
|---|
 | 52 |   {}
 | 
|---|
| [6bb72a] | 53 | 
 | 
|---|
 | 54 |   /** Destructor for class EmpiricalPotential.
 | 
|---|
 | 55 |    *
 | 
|---|
 | 56 |    */
 | 
|---|
 | 57 |   virtual ~EmpiricalPotential() {}
 | 
|---|
| [3ccea3] | 58 | 
 | 
|---|
 | 59 |   /** Evaluates the function with the given \a arguments and the current set of
 | 
|---|
 | 60 |    * parameters.
 | 
|---|
 | 61 |    *
 | 
|---|
 | 62 |    * \param arguments set of arguments as input variables to the function
 | 
|---|
 | 63 |    * \return result of the function
 | 
|---|
 | 64 |    */
 | 
|---|
 | 65 |   virtual results_t operator()(const arguments_t &arguments) const=0;
 | 
|---|
 | 66 | 
 | 
|---|
 | 67 |   /** Evaluates the derivative of the function with the given \a arguments
 | 
|---|
 | 68 |    * for each component.
 | 
|---|
 | 69 |    *
 | 
|---|
 | 70 |    * \param arguments set of arguments as input variables to the function
 | 
|---|
 | 71 |    * \return result vector containing the derivative with respect to each
 | 
|---|
 | 72 |    *         input comonent of the function
 | 
|---|
 | 73 |    */
 | 
|---|
 | 74 |   virtual derivative_components_t derivative(const arguments_t &arguments) const=0;
 | 
|---|
| [713888] | 75 | 
 | 
|---|
| [94453f1] | 76 |   /** Returns the functor that converts argument_s into the
 | 
|---|
 | 77 |    * internal coordinate described by this potential function.
 | 
|---|
 | 78 |    *
 | 
|---|
 | 79 |    * \return coordinator functor
 | 
|---|
 | 80 |    */
 | 
|---|
 | 81 |   virtual Coordinator::ptr getCoordinator() const=0;
 | 
|---|
 | 82 | 
 | 
|---|
| [713888] | 83 | protected:
 | 
|---|
 | 84 |   /** Default constructor for class EmpiricalPotential.
 | 
|---|
 | 85 |    *
 | 
|---|
 | 86 |    * Callable only by derived functions.
 | 
|---|
 | 87 |    *
 | 
|---|
 | 88 |    */
 | 
|---|
 | 89 |   EmpiricalPotential()
 | 
|---|
 | 90 |   {}
 | 
|---|
| [6bb72a] | 91 | };
 | 
|---|
 | 92 | 
 | 
|---|
 | 93 | #endif /* EMPIRICALPOTENTIAL_HPP_ */
 | 
|---|