| [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" | 
|---|
| [9c793c] | 21 | #include "Potentials/BindingModel.hpp" | 
|---|
| [fdd23a] | 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 | * | 
|---|
| [9c793c] | 86 | * \return BindingModel ref of the binding model | 
|---|
| [d5ca1a] | 87 | */ | 
|---|
| [9c793c] | 88 | virtual const BindingModel& getBindingModel() const=0; | 
|---|
| [d5ca1a] | 89 |  | 
|---|
| [3f8238] | 90 | /** | 
|---|
|  | 91 | * Returns the number of particle types associated with the potential. | 
|---|
|  | 92 | * | 
|---|
|  | 93 | * \return number of particle types | 
|---|
|  | 94 | */ | 
|---|
|  | 95 | virtual unsigned int getParticleTypeNumber() const=0; | 
|---|
|  | 96 |  | 
|---|
| [e83114] | 97 | /** Sets the parameters from a given vector. | 
|---|
|  | 98 | * | 
|---|
|  | 99 | * \param params vector of parameters, specific to a specialized potential | 
|---|
|  | 100 | */ | 
|---|
|  | 101 | virtual void setParameters(const parameters_t ¶ms)=0; | 
|---|
|  | 102 |  | 
|---|
|  | 103 | /** Getter for the parameter set for this specialized potential. | 
|---|
|  | 104 | * | 
|---|
|  | 105 | * \return vector of parameters | 
|---|
|  | 106 | */ | 
|---|
|  | 107 | virtual parameters_t getParameters() const=0; | 
|---|
|  | 108 |  | 
|---|
| [713888] | 109 | protected: | 
|---|
|  | 110 | /** Default constructor for class EmpiricalPotential. | 
|---|
|  | 111 | * | 
|---|
|  | 112 | * Callable only by derived functions. | 
|---|
|  | 113 | * | 
|---|
|  | 114 | */ | 
|---|
|  | 115 | EmpiricalPotential() | 
|---|
|  | 116 | {} | 
|---|
| [6bb72a] | 117 | }; | 
|---|
|  | 118 |  | 
|---|
|  | 119 | #endif /* EMPIRICALPOTENTIAL_HPP_ */ | 
|---|