/* * EmpiricalPotential.hpp * * Created on: Sep 26, 2012 * Author: heber */ #ifndef EMPIRICALPOTENTIAL_HPP_ #define EMPIRICALPOTENTIAL_HPP_ // include config.h #ifdef HAVE_CONFIG_H #include #endif #include /** An EmpiricalPotential is a function that is given a vector of objects as * arguments which it uses to evaluate an internal function and returns a * value representing the energy of this configuration indicated by the * arguments. * * It is to be used inside an std::accumulate function after a vector of * arguments (i.e. a vector of a vector) has been prepared initially. * */ class EmpiricalPotential { public: /** This class encapsulates all information with respect to a single argument * for a empirical potential function. */ struct argument_t { //!> indices between which the distance is given std::pair indices; //!> distance double distance; }; //!> typedef on the result value of operator() typedef double result_t; //!> typedef on the result value of derivative() typedef std::vector derivative_components_t; //!> typedef for the list of argument_t to be given to operator(). typedef std::vector arguments_t; public: /** Default constructor for class EmpiricalPotential. * */ EmpiricalPotential(); /** Destructor for class EmpiricalPotential. * */ virtual ~EmpiricalPotential() {} /** This evaluates the internal function with the given list of \a arguments. * * @param arguments arguments for the internal function * @return result of the function evaluation */ result_t operator()(const arguments_t &arguments) const; /** This evaluates the first derivative of the internal function with the * given list of \a arguments. * * @param arguments arguments for the internal function * @return result vector with same number of components as \a arguments */ derivative_components_t derivative(const arguments_t &arguments) const; }; #endif /* EMPIRICALPOTENTIAL_HPP_ */