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

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 f48ad3 was f48ad3, checked in by Frederik Heber <heber@…>, 12 years ago

LevMartester now uses FunctionModel::setParameter() to set initial parameters.

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