| 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 | 
 | 
|---|
| 19 | #include "FunctionApproximation/FunctionArgument.hpp"
 | 
|---|
| 20 | #include "FunctionApproximation/FunctionModel.hpp"
 | 
|---|
| 21 | #include "Potentials/BindingModel.hpp"
 | 
|---|
| 22 | #include "Potentials/SerializablePotential.hpp"
 | 
|---|
| 23 | #include "Potentials/InternalCoordinates/Coordinator.hpp"
 | 
|---|
| 24 | 
 | 
|---|
| 25 | /** An EmpiricalPotential is a function that is given a vector of objects as
 | 
|---|
| 26 |  * arguments which it uses to evaluate an internal function and returns a
 | 
|---|
| 27 |  * value representing the energy of this configuration indicated by the
 | 
|---|
| 28 |  * arguments.
 | 
|---|
| 29 |  *
 | 
|---|
| 30 |  * It is to be used inside an std::accumulate function after a vector of
 | 
|---|
| 31 |  * arguments (i.e. a vector of a vector) has been prepared initially.
 | 
|---|
| 32 |  *
 | 
|---|
| 33 |  */
 | 
|---|
| 34 | class EmpiricalPotential :
 | 
|---|
| 35 |     public FunctionModel,
 | 
|---|
| 36 |     public SerializablePotential
 | 
|---|
| 37 | {
 | 
|---|
| 38 | public:
 | 
|---|
| 39 |   //!> typedef for the argument vector as input to the function
 | 
|---|
| 40 |   typedef std::vector<argument_t> arguments_t;
 | 
|---|
| 41 |   //!> typedef for a single result degree of freedom
 | 
|---|
| 42 |   typedef double result_t;
 | 
|---|
| 43 |   //!> typedef for the result vector as returned by the function
 | 
|---|
| 44 |   typedef std::vector<result_t> results_t;
 | 
|---|
| 45 |   //!> typedef for the components of the derivative
 | 
|---|
| 46 |   typedef std::vector<result_t> derivative_components_t;
 | 
|---|
| 47 | 
 | 
|---|
| 48 |   /** Default constructor for class EmpiricalPotential.
 | 
|---|
| 49 |    *
 | 
|---|
| 50 |    */
 | 
|---|
| 51 |   EmpiricalPotential(const ParticleTypes_t &_ParticleTypes) :
 | 
|---|
| 52 |     SerializablePotential(_ParticleTypes)
 | 
|---|
| 53 |   {}
 | 
|---|
| 54 | 
 | 
|---|
| 55 |   /** Destructor for class EmpiricalPotential.
 | 
|---|
| 56 |    *
 | 
|---|
| 57 |    */
 | 
|---|
| 58 |   virtual ~EmpiricalPotential() {}
 | 
|---|
| 59 | 
 | 
|---|
| 60 |   /** Evaluates the function with the given \a arguments and the current set of
 | 
|---|
| 61 |    * parameters.
 | 
|---|
| 62 |    *
 | 
|---|
| 63 |    * \param listarguments list of sets of arguments as input variables to the function
 | 
|---|
| 64 |    * \return result of the function
 | 
|---|
| 65 |    */
 | 
|---|
| 66 |   virtual results_t operator()(const list_of_arguments_t &listarguments) const=0;
 | 
|---|
| 67 | 
 | 
|---|
| 68 |   /** Evaluates the derivative of the function with the given \a arguments
 | 
|---|
| 69 |    * for each component.
 | 
|---|
| 70 |    *
 | 
|---|
| 71 |    * \param listarguments list of sets of arguments as input variables to the function
 | 
|---|
| 72 |    * \return result vector containing the derivative with respect to each
 | 
|---|
| 73 |    *         input comonent of the function
 | 
|---|
| 74 |    */
 | 
|---|
| 75 |   virtual derivative_components_t derivative(const list_of_arguments_t &listarguments) const=0;
 | 
|---|
| 76 | 
 | 
|---|
| 77 |   /** Returns the functor that converts argument_s into the
 | 
|---|
| 78 |    * internal coordinate described by this potential function.
 | 
|---|
| 79 |    *
 | 
|---|
| 80 |    * \return coordinator functor
 | 
|---|
| 81 |    */
 | 
|---|
| 82 |   virtual Coordinator::ptr getCoordinator() const=0;
 | 
|---|
| 83 | 
 | 
|---|
| 84 |   /** Getter for the graph specifying the binding model of the potential.
 | 
|---|
| 85 |    *
 | 
|---|
| 86 |    * \return BindingModel ref of the binding model
 | 
|---|
| 87 |    */
 | 
|---|
| 88 |   virtual const BindingModel& getBindingModel() const=0;
 | 
|---|
| 89 | 
 | 
|---|
| 90 | protected:
 | 
|---|
| 91 |   /** Default constructor for class EmpiricalPotential.
 | 
|---|
| 92 |    *
 | 
|---|
| 93 |    * Callable only by derived functions.
 | 
|---|
| 94 |    *
 | 
|---|
| 95 |    */
 | 
|---|
| 96 |   EmpiricalPotential()
 | 
|---|
| 97 |   {}
 | 
|---|
| 98 | };
 | 
|---|
| 99 | 
 | 
|---|
| 100 | #endif /* EMPIRICALPOTENTIAL_HPP_ */
 | 
|---|