source: src/Potentials/Specifics/ManyBodyPotential_Tersoff.hpp@ ca8d82

Action_Thermostats Add_AtomRandomPerturbation Add_FitFragmentPartialChargesAction Add_RotateAroundBondAction Add_SelectAtomByNameAction Added_ParseSaveFragmentResults AddingActions_SaveParseParticleParameters Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_ParticleName_to_Atom Adding_StructOpt_integration_tests AtomFragments Automaking_mpqc_open AutomationFragmentation_failures Candidate_v1.5.4 Candidate_v1.6.0 Candidate_v1.6.1 ChangeBugEmailaddress ChangingTestPorts ChemicalSpaceEvaluator CombiningParticlePotentialParsing Combining_Subpackages Debian_Package_split Debian_package_split_molecuildergui_only Disabling_MemDebug Docu_Python_wait EmpiricalPotential_contain_HomologyGraph EmpiricalPotential_contain_HomologyGraph_documentation Enable_parallel_make_install Enhance_userguide Enhanced_StructuralOptimization Enhanced_StructuralOptimization_continued Example_ManyWaysToTranslateAtom Exclude_Hydrogens_annealWithBondGraph FitPartialCharges_GlobalError Fix_BoundInBox_CenterInBox_MoleculeActions Fix_ChargeSampling_PBC Fix_ChronosMutex Fix_FitPartialCharges Fix_FitPotential_needs_atomicnumbers Fix_ForceAnnealing Fix_IndependentFragmentGrids Fix_ParseParticles Fix_ParseParticles_split_forward_backward_Actions Fix_PopActions Fix_QtFragmentList_sorted_selection Fix_Restrictedkeyset_FragmentMolecule Fix_StatusMsg Fix_StepWorldTime_single_argument Fix_Verbose_Codepatterns Fix_fitting_potentials Fixes ForceAnnealing_goodresults ForceAnnealing_oldresults ForceAnnealing_tocheck ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion FragmentAction_writes_AtomFragments FragmentMolecule_checks_bonddegrees GeometryObjects Gui_Fixes Gui_displays_atomic_force_velocity ImplicitCharges IndependentFragmentGrids IndependentFragmentGrids_IndividualZeroInstances IndependentFragmentGrids_IntegrationTest IndependentFragmentGrids_Sole_NN_Calculation JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool JobMarket_unresolvable_hostname_fix MoreRobust_FragmentAutomation ODR_violation_mpqc_open PartialCharges_OrthogonalSummation PdbParser_setsAtomName PythonUI_with_named_parameters QtGui_reactivate_TimeChanged_changes Recreated_GuiChecks Rewrite_FitPartialCharges RotateToPrincipalAxisSystem_UndoRedo SaturateAtoms_findBestMatching SaturateAtoms_singleDegree StoppableMakroAction Subpackage_CodePatterns Subpackage_JobMarket Subpackage_LinearAlgebra Subpackage_levmar Subpackage_mpqc_open Subpackage_vmg Switchable_LogView ThirdParty_MPQC_rebuilt_buildsystem TrajectoryDependenant_MaxOrder TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps TremoloParser_setsAtomName Ubuntu_1604_changes stable
Last change on this file since ca8d82 was ca8d82, checked in by Frederik Heber <heber@…>, 12 years ago

FIX: Corrected parameter derivatives of ManyBodyPotential_Tersoff.

  • setParameters also allows setting of less parameters than required.
  • Property mode set to 100644
File size: 6.9 KB
Line 
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 "CodePatterns/Assert.hpp"
20
21#include "Potentials/EmpiricalPotential.hpp"
22#include "FunctionApproximation/FunctionModel.hpp"
23
24/** This class is the implementation of the Tersoff potential function.
25 *
26 * \note The arguments_t argument list is here in the following order:
27 * -# first \f$ r_{ij}$ \f$,
28 * -# then all \f$ r_{ik}$ \f$ that are within the cutoff, i.e. \f$ r_{ik}$ < R + D\f$
29 *
30 */
31class ManyBodyPotential_Tersoff : virtual public EmpiricalPotential, virtual public FunctionModel
32{
33 //!> grant unit test access to internal parts
34 friend class ManyBodyPotential_TersoffTest;
35 // some repeated typedefs to avoid ambiguities
36 typedef FunctionModel::arguments_t arguments_t;
37 typedef FunctionModel::result_t result_t;
38 typedef FunctionModel::results_t results_t;
39 typedef EmpiricalPotential::derivative_components_t derivative_components_t;
40 typedef FunctionModel::parameters_t parameters_t;
41public:
42 /** Constructor for class ManyBodyPotential_Tersoff.
43 *
44 * @param _triplefunction function that returns a list of triples (i.e. the
45 * two remaining distances) to a given pair of points (contained as
46 * indices within the argument)
47 */
48 ManyBodyPotential_Tersoff(
49 boost::function< std::vector<arguments_t>(const argument_t &, const double)> &_triplefunction
50 );
51
52 /** Constructor for class ManyBodyPotential_Tersoff.
53 *
54 * @param _R offset for cutoff
55 * @param _S halfwidth for cutoff relative to \a _R
56 * @param A
57 * @param B
58 * @param lambda
59 * @param mu
60 * @param lambda3
61 * @param alpha
62 * @param beta
63 * @param chi
64 * @param omega
65 * @param n
66 * @param c
67 * @param d
68 * @param h
69 * @param _triplefunction function that returns a list of triples (i.e. the
70 * two remaining distances) to a given pair of points (contained as
71 * indices within the argument)
72 */
73 ManyBodyPotential_Tersoff(
74 const double &_R,
75 const double &_S,
76 const double &_A,
77 const double &_B,
78 const double &_lambda,
79 const double &_mu,
80 const double &_lambda3,
81 const double &_alpha,
82 const double &_beta,
83 const double &_chi,
84 const double &_omega,
85 const double &_n,
86 const double &_c,
87 const double &_d,
88 const double &_h,
89 boost::function< std::vector<arguments_t>(const argument_t &, const double)> &_triplefunction);
90
91 /** Destructor of class ManyBodyPotential_Tersoff.
92 *
93 */
94 virtual ~ManyBodyPotential_Tersoff() {}
95
96 /** Evaluates the Tersoff potential for the given arguments.
97 *
98 * @param arguments single distance
99 * @return value of the potential function
100 */
101 results_t operator()(const arguments_t &arguments) const;
102
103 /** Evaluates the derivative of the Tersoff potential with respect to the
104 * input variables.
105 *
106 * @param arguments single distance
107 * @return vector with components of the derivative
108 */
109 derivative_components_t derivative(const arguments_t &arguments) const;
110
111 /** Evaluates the derivative of the function with the given \a arguments
112 * with respect to a specific parameter indicated by \a index.
113 *
114 * \param arguments set of arguments as input variables to the function
115 * \param index derivative of which parameter
116 * \return result vector containing the derivative with respect to the given
117 * input
118 */
119 results_t parameter_derivative(const arguments_t &arguments, const size_t index) const;
120
121private:
122 /** Prohibit private default constructor.
123 *
124 * We essentially need the triplefunction, hence without this function cannot
125 * be.
126 */
127 ManyBodyPotential_Tersoff();
128
129private:
130 /** This function represents the cutoff \f$ f_C \f$.
131 *
132 * @param distance variable of the function
133 * @return a value in [0,1].
134 */
135 result_t function_cutoff(
136 const double &distance
137 ) const;
138 /** This function has the exponential feature from the Morse potential.
139 *
140 * @param prefactor prefactor parameter to exp function
141 * @param lambda scale parameter of exp function's argument
142 * @param distance variable of the function
143 * @return
144 */
145 result_t function_smoother(
146 const double &prefactor,
147 const double &lambda,
148 const double &distance
149 ) const;
150
151 /** This function represents \f$ (1 + \alpha^n \eta^n)^{-1/2n} \f$.
152 *
153 * @param alpha prefactor to eta function
154 * @param r_ij distance argument
155 * @param eta result value of eta or zeta
156 * @return \f$ (1 + \alpha^n \eta^n)^{-1/2n} \f$
157 */
158 result_t function_prefactor(
159 const double &alpha,
160 const double &eta
161 ) const;
162
163 result_t
164 function_eta(
165 const argument_t &r_ij
166 ) const;
167
168 result_t
169 function_zeta(
170 const argument_t &r_ij
171 ) const;
172
173 result_t
174 function_theta(
175 const double &r_ij,
176 const double &r_ik,
177 const double &r_jk
178 ) const;
179
180 result_t
181 function_angle(
182 const double &r_ij,
183 const double &r_ik,
184 const double &r_jk
185 ) const;
186
187private:
188 result_t
189 function_derivative_c(
190 const argument_t &r_ij
191 ) const;
192
193 result_t
194 function_derivative_d(
195 const argument_t &r_ij
196 ) const;
197
198 result_t
199 function_derivative_h(
200 const argument_t &r_ij
201 ) const;
202
203public:
204 enum parameter_enum_t {
205 A,
206 B,
207 lambda,
208 mu,
209 beta,
210 n,
211 c,
212 d,
213 h,
214// R,
215// S,
216// lambda3,
217// alpha,
218// chi,
219// omega,
220 MAXPARAMS
221 };
222 //!> parameter vector with parameters as in enum parameter_enum_t
223 parameters_t params;
224
225public:
226 // some internal parameters which are fixed
227 const double R;
228 const double S;
229 const double lambda3;
230 const double alpha;
231 const double chi;
232 const double omega;
233
234public:
235 /** Setter for parameters as required by FunctionModel interface.
236 *
237 * \param _params given set of parameters
238 */
239 void setParameters(const parameters_t &_params)
240 {
241 ASSERT( _params.size() <= getParameterDimension(),
242 "ManyBodyPotential_Tersoff::setParameters() - we need not more than "
243 +toString(getParameterDimension())+" parameters.");
244 for (size_t i=0; i< _params.size(); ++i)
245 params[i] = _params[i];
246 }
247
248 /** Getter for parameters as required by FunctionModel interface.
249 *
250 * \return set of parameters
251 */
252 parameters_t getParameters() const
253 {
254 return params;
255 }
256
257 /** Getter for the number of parameters of this model function.
258 *
259 * \return number of parameters
260 */
261 size_t getParameterDimension() const
262 {
263 return MAXPARAMS;
264 }
265
266private:
267 //!> bound function that obtains the triples for the internal coordinationb summation.
268 const boost::function< std::vector< arguments_t >(const argument_t &, const double)> &triplefunction;
269};
270
271
272#endif /* MANYBODYPOTENTIAL_TERSOFF_HPP_ */
Note: See TracBrowser for help on using the repository browser.