source: src/Potentials/EmpiricalPotential.hpp@ 6d08032

Fix_FitPotential_needs_atomicnumbers
Last change on this file since 6d08032 was 0b7036, checked in by Frederik Heber <heber@…>, 9 years ago

Added getSubgraph() to all EmpiricalPotentials.

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