| [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 | 
 | 
|---|
| [d5ca1a] | 19 | #include "Fragmentation/Homology/HomologyGraph.hpp"
 | 
|---|
| [4f82f8] | 20 | #include "FunctionApproximation/FunctionArgument.hpp"
 | 
|---|
| [fdd23a] | 21 | #include "FunctionApproximation/FunctionModel.hpp"
 | 
|---|
 | 22 | #include "Potentials/SerializablePotential.hpp"
 | 
|---|
| [94453f1] | 23 | #include "Potentials/InternalCoordinates/Coordinator.hpp"
 | 
|---|
| [4f82f8] | 24 | 
 | 
|---|
| [6bb72a] | 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 |  */
 | 
|---|
| [fdd23a] | 34 | class EmpiricalPotential :
 | 
|---|
 | 35 |     public FunctionModel,
 | 
|---|
 | 36 |     public SerializablePotential
 | 
|---|
| [6bb72a] | 37 | {
 | 
|---|
 | 38 | public:
 | 
|---|
| [3ccea3] | 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 | 
 | 
|---|
| [6bb72a] | 48 |   /** Default constructor for class EmpiricalPotential.
 | 
|---|
 | 49 |    *
 | 
|---|
 | 50 |    */
 | 
|---|
| [fdd23a] | 51 |   EmpiricalPotential(const ParticleTypes_t &_ParticleTypes) :
 | 
|---|
 | 52 |     SerializablePotential(_ParticleTypes)
 | 
|---|
 | 53 |   {}
 | 
|---|
| [6bb72a] | 54 | 
 | 
|---|
 | 55 |   /** Destructor for class EmpiricalPotential.
 | 
|---|
 | 56 |    *
 | 
|---|
 | 57 |    */
 | 
|---|
 | 58 |   virtual ~EmpiricalPotential() {}
 | 
|---|
| [3ccea3] | 59 | 
 | 
|---|
 | 60 |   /** Evaluates the function with the given \a arguments and the current set of
 | 
|---|
 | 61 |    * parameters.
 | 
|---|
 | 62 |    *
 | 
|---|
| [e1fe7e] | 63 |    * \param listarguments list of sets of arguments as input variables to the function
 | 
|---|
| [3ccea3] | 64 |    * \return result of the function
 | 
|---|
 | 65 |    */
 | 
|---|
| [e1fe7e] | 66 |   virtual results_t operator()(const list_of_arguments_t &listarguments) const=0;
 | 
|---|
| [3ccea3] | 67 | 
 | 
|---|
 | 68 |   /** Evaluates the derivative of the function with the given \a arguments
 | 
|---|
 | 69 |    * for each component.
 | 
|---|
 | 70 |    *
 | 
|---|
| [e1fe7e] | 71 |    * \param listarguments list of sets of arguments as input variables to the function
 | 
|---|
| [3ccea3] | 72 |    * \return result vector containing the derivative with respect to each
 | 
|---|
 | 73 |    *         input comonent of the function
 | 
|---|
 | 74 |    */
 | 
|---|
| [e1fe7e] | 75 |   virtual derivative_components_t derivative(const list_of_arguments_t &listarguments) const=0;
 | 
|---|
| [713888] | 76 | 
 | 
|---|
| [94453f1] | 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 | 
 | 
|---|
| [d5ca1a] | 84 |   /** Getter for the graph specifying the binding model of the potential.
 | 
|---|
 | 85 |    *
 | 
|---|
 | 86 |    * \return HomologyGraph of the binding model
 | 
|---|
 | 87 |    */
 | 
|---|
 | 88 |   virtual const HomologyGraph& getBindingModel() const=0;
 | 
|---|
 | 89 | 
 | 
|---|
| [713888] | 90 | protected:
 | 
|---|
 | 91 |   /** Default constructor for class EmpiricalPotential.
 | 
|---|
 | 92 |    *
 | 
|---|
 | 93 |    * Callable only by derived functions.
 | 
|---|
 | 94 |    *
 | 
|---|
 | 95 |    */
 | 
|---|
 | 96 |   EmpiricalPotential()
 | 
|---|
 | 97 |   {}
 | 
|---|
| [6bb72a] | 98 | };
 | 
|---|
 | 99 | 
 | 
|---|
 | 100 | #endif /* EMPIRICALPOTENTIAL_HPP_ */
 | 
|---|