1 | /*
|
---|
2 | * ManyBodyPotential_Tersoff.hpp
|
---|
3 | *
|
---|
4 | * Created on: Sep 26, 2012
|
---|
5 | * Author: heber
|
---|
6 | */
|
---|
7 |
|
---|
8 | #ifndef MANYBODYPOTENTIAL_TERSOFF_HPP_
|
---|
9 | #define MANYBODYPOTENTIAL_TERSOFF_HPP_
|
---|
10 |
|
---|
11 | // include config.h
|
---|
12 | #ifdef HAVE_CONFIG_H
|
---|
13 | #include <config.h>
|
---|
14 | #endif
|
---|
15 |
|
---|
16 | #include <boost/function.hpp>
|
---|
17 | #include <cmath>
|
---|
18 |
|
---|
19 | #include "Potentials/EmpiricalPotential.hpp"
|
---|
20 | #include "FunctionApproximation/FunctionModel.hpp"
|
---|
21 |
|
---|
22 | /** This class is the implementation of the Tersoff potential function.
|
---|
23 | *
|
---|
24 | * \note The arguments_t argument list is here in the following order:
|
---|
25 | * -# first \f$ r_{ij}$ \f$,
|
---|
26 | * -# then all \f$ r_{ik}$ \f$ that are within the cutoff, i.e. \f$ r_{ik}$ < R + D\f$
|
---|
27 | *
|
---|
28 | */
|
---|
29 | class ManyBodyPotential_Tersoff : virtual public EmpiricalPotential, virtual public FunctionModel
|
---|
30 | {
|
---|
31 | // some repeated typedefs to avoid ambiguities
|
---|
32 | typedef FunctionModel::arguments_t arguments_t;
|
---|
33 | typedef FunctionModel::result_t result_t;
|
---|
34 | typedef FunctionModel::results_t results_t;
|
---|
35 | typedef EmpiricalPotential::derivative_components_t derivative_components_t;
|
---|
36 | private:
|
---|
37 | //!> cutoff_offset offset for cutoff parameter
|
---|
38 | const double cutoff_offset;
|
---|
39 | //!> cutoff_halfwidth half-width for cutoff parameter
|
---|
40 | const double cutoff_halfwidth;
|
---|
41 | //!> many body prefactor parameter for attractive part
|
---|
42 | const double manybodyparameter_A;
|
---|
43 | //!> many body prefactor parameter for attractive part
|
---|
44 | const double manybodyparameter_B;
|
---|
45 | //!> many body scale parameter for attractive part
|
---|
46 | const double manybodyparameter_lambda1;
|
---|
47 | //!> many body scale parameter for attractive part
|
---|
48 | const double manybodyparameter_lambda2;
|
---|
49 | //!> length scale for coordination influence
|
---|
50 | const double manybodyparameter_lambda3;
|
---|
51 | //!> many body parameter for attractive part
|
---|
52 | const double manybodyparameter_alpha;
|
---|
53 | //!> many body parameter for repulsive part
|
---|
54 | const double manybodyparameter_beta;
|
---|
55 | //!> many body type-dependent parameter giving the power
|
---|
56 | const double manybodyparameter_n;
|
---|
57 | //!> many-body type-dependent parameter in angular dependence
|
---|
58 | const double manybodyparameter_c;
|
---|
59 | //!> many-body type-dependent parameter in angular dependence
|
---|
60 | const double manybodyparameter_d;
|
---|
61 | //!> many-body type-dependent parameter in angular dependence
|
---|
62 | const double manybodyparameter_h;
|
---|
63 | public:
|
---|
64 | /** Constructor for class ManyBodyPotential_Tersoff.
|
---|
65 | *
|
---|
66 | * @param _triplefunction function that returns a list of triples (i.e. the
|
---|
67 | * two remaining distances) to a given pair of points (contained as
|
---|
68 | * indices within the argument)
|
---|
69 | */
|
---|
70 | ManyBodyPotential_Tersoff(
|
---|
71 | const double _cutoff_offset,
|
---|
72 | const double _cutoff_halfwidth,
|
---|
73 | const double A,
|
---|
74 | const double B,
|
---|
75 | const double lambda1,
|
---|
76 | const double lambda2,
|
---|
77 | const double lambda3,
|
---|
78 | const double alpha,
|
---|
79 | const double beta,
|
---|
80 | const double n,
|
---|
81 | const double c,
|
---|
82 | const double d,
|
---|
83 | const double h,
|
---|
84 | boost::function< std::vector<arguments_t>(const argument_t &, const double)> &_triplefunction) :
|
---|
85 | cutoff_offset(_cutoff_offset),
|
---|
86 | cutoff_halfwidth(_cutoff_offset),
|
---|
87 | manybodyparameter_A(A),
|
---|
88 | manybodyparameter_B(B),
|
---|
89 | manybodyparameter_lambda1(lambda1),
|
---|
90 | manybodyparameter_lambda2(lambda2),
|
---|
91 | manybodyparameter_lambda3(lambda3),
|
---|
92 | manybodyparameter_alpha(alpha),
|
---|
93 | manybodyparameter_beta(beta),
|
---|
94 | manybodyparameter_n(n),
|
---|
95 | manybodyparameter_c(d),
|
---|
96 | manybodyparameter_d(d),
|
---|
97 | manybodyparameter_h(h),
|
---|
98 | triplefunction(_triplefunction)
|
---|
99 | {}
|
---|
100 | /** Destructor of class ManyBodyPotential_Tersoff.
|
---|
101 | *
|
---|
102 | */
|
---|
103 | virtual ~ManyBodyPotential_Tersoff() {}
|
---|
104 |
|
---|
105 | /** Evaluates the Tersoff potential for the given arguments.
|
---|
106 | *
|
---|
107 | * @param arguments single distance
|
---|
108 | * @return value of the potential function
|
---|
109 | */
|
---|
110 | results_t operator()(const arguments_t &arguments) const;
|
---|
111 |
|
---|
112 | /** Evaluates the derivative of the Tersoff potential with respect to the
|
---|
113 | * input variables.
|
---|
114 | *
|
---|
115 | * @param arguments single distance
|
---|
116 | * @return vector with components of the derivative
|
---|
117 | */
|
---|
118 | derivative_components_t derivative(const arguments_t &arguments) const;
|
---|
119 |
|
---|
120 | /** Evaluates the derivative of the function with the given \a arguments
|
---|
121 | * with respect to a specific parameter indicated by \a index.
|
---|
122 | *
|
---|
123 | * \param arguments set of arguments as input variables to the function
|
---|
124 | * \param index derivative of which parameter
|
---|
125 | * \return result vector containing the derivative with respect to the given
|
---|
126 | * input
|
---|
127 | */
|
---|
128 | virtual results_t paramter_derivative(const arguments_t &arguments, const size_t index) const=0;
|
---|
129 |
|
---|
130 | private:
|
---|
131 | /** This function represents the cutoff \f$ f_C \f$.
|
---|
132 | *
|
---|
133 | * @param distance variable of the function
|
---|
134 | * @return a value in [0,1].
|
---|
135 | */
|
---|
136 | result_t function_cutoff(
|
---|
137 | const double &distance
|
---|
138 | ) const;
|
---|
139 | /** This function has the exponential feature from the Morse potential.
|
---|
140 | *
|
---|
141 | * @param distance variable of the function
|
---|
142 | * @param prefactor prefactor parameter to exp function
|
---|
143 | * @param lambda scale parameter of exp function's argument
|
---|
144 | * @return
|
---|
145 | */
|
---|
146 | result_t function_smoother(
|
---|
147 | const double &distance,
|
---|
148 | const double &prefactor,
|
---|
149 | const double &lambda
|
---|
150 | ) const
|
---|
151 | {
|
---|
152 | return prefactor * exp(-lambda * distance);
|
---|
153 | }
|
---|
154 |
|
---|
155 | /** This function represents \f$ (1 + \alpha^n \eta^n)^{-1/2n} \f$.
|
---|
156 | *
|
---|
157 | * @param alpha prefactor to eta function
|
---|
158 | * @param r_ij distance argument
|
---|
159 | * @param etafunction eta or zeta
|
---|
160 | * @return \f$ (1 + \alpha^n \eta^n)^{-1/2n} \f$
|
---|
161 | */
|
---|
162 | result_t function_prefactor(
|
---|
163 | const double &alpha,
|
---|
164 | boost::function<result_t()> etafunction
|
---|
165 | ) const;
|
---|
166 |
|
---|
167 | result_t
|
---|
168 | function_eta(
|
---|
169 | const argument_t &r_ij
|
---|
170 | ) const;
|
---|
171 |
|
---|
172 | result_t
|
---|
173 | function_zeta(
|
---|
174 | const argument_t &r_ij
|
---|
175 | ) const;
|
---|
176 |
|
---|
177 | result_t
|
---|
178 | function_angle(
|
---|
179 | const double &r_ij,
|
---|
180 | const double &r_ik,
|
---|
181 | const double &r_jk
|
---|
182 | ) const;
|
---|
183 |
|
---|
184 | private:
|
---|
185 | //!> bound function that obtains the triples for the internal coordinationb summation.
|
---|
186 | const boost::function< std::vector< arguments_t >(const argument_t &, const double)> &triplefunction;
|
---|
187 | };
|
---|
188 |
|
---|
189 |
|
---|
190 | #endif /* MANYBODYPOTENTIAL_TERSOFF_HPP_ */
|
---|