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

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

Changed ManyBodyPotential_Tersoff to also have parameters_t instead of single member variable definitions.

  • added enum to give each entry in params a meaning.
  • modified setter and getter for parameters accordingly.
  • default constructor is now private, as we always need the triplefunction.
  • changed other constructors accordingly.
  • Property mode set to 100644
File size: 6.3 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 "Potentials/EmpiricalPotential.hpp"
20#include "FunctionApproximation/FunctionModel.hpp"
21
22#include "CodePatterns/Assert.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 // some repeated typedefs to avoid ambiguities
34 typedef FunctionModel::arguments_t arguments_t;
35 typedef FunctionModel::result_t result_t;
36 typedef FunctionModel::results_t results_t;
37 typedef EmpiricalPotential::derivative_components_t derivative_components_t;
38 typedef FunctionModel::parameters_t parameters_t;
39public:
40 /** Constructor for class ManyBodyPotential_Tersoff.
41 *
42 * @param _triplefunction function that returns a list of triples (i.e. the
43 * two remaining distances) to a given pair of points (contained as
44 * indices within the argument)
45 */
46 ManyBodyPotential_Tersoff(
47 boost::function< std::vector<arguments_t>(const argument_t &, const double)> &_triplefunction
48 );
49
50 /** Constructor for class ManyBodyPotential_Tersoff.
51 *
52 * @param _cutoff_offset offset for cutoff
53 * @param _cutoff_halfwidth halfwidth for cutoff relative to \a _cutoff_offset
54 * @param A
55 * @param B
56 * @param lambda1
57 * @param lambda2
58 * @param lambda3
59 * @param alpha
60 * @param beta
61 * @param n
62 * @param c
63 * @param d
64 * @param h
65 * @param _triplefunction function that returns a list of triples (i.e. the
66 * two remaining distances) to a given pair of points (contained as
67 * indices within the argument)
68 */
69 ManyBodyPotential_Tersoff(
70 const double &_cutoff_offset,
71 const double &_cutoff_halfwidth,
72 const double &A,
73 const double &B,
74 const double &lambda1,
75 const double &lambda2,
76 const double &lambda3,
77 const double &alpha,
78 const double &beta,
79 const double &n,
80 const double &c,
81 const double &d,
82 const double &h,
83 boost::function< std::vector<arguments_t>(const argument_t &, const double)> &_triplefunction);
84
85 /** Destructor of class ManyBodyPotential_Tersoff.
86 *
87 */
88 virtual ~ManyBodyPotential_Tersoff() {}
89
90 /** Evaluates the Tersoff potential for the given arguments.
91 *
92 * @param arguments single distance
93 * @return value of the potential function
94 */
95 results_t operator()(const arguments_t &arguments) const;
96
97 /** Evaluates the derivative of the Tersoff potential with respect to the
98 * input variables.
99 *
100 * @param arguments single distance
101 * @return vector with components of the derivative
102 */
103 derivative_components_t derivative(const arguments_t &arguments) const;
104
105 /** Evaluates the derivative of the function with the given \a arguments
106 * with respect to a specific parameter indicated by \a index.
107 *
108 * \param arguments set of arguments as input variables to the function
109 * \param index derivative of which parameter
110 * \return result vector containing the derivative with respect to the given
111 * input
112 */
113 results_t parameter_derivative(const arguments_t &arguments, const size_t index) const;
114
115private:
116 /** Prohibit private default constructor.
117 *
118 * We essentially need the triplefunction, hence without this function cannot
119 * be.
120 */
121 ManyBodyPotential_Tersoff();
122
123private:
124 /** This function represents the cutoff \f$ f_C \f$.
125 *
126 * @param distance variable of the function
127 * @return a value in [0,1].
128 */
129 result_t function_cutoff(
130 const double &distance
131 ) const;
132 /** This function has the exponential feature from the Morse potential.
133 *
134 * @param distance variable of the function
135 * @param prefactor prefactor parameter to exp function
136 * @param lambda scale parameter of exp function's argument
137 * @return
138 */
139 result_t function_smoother(
140 const double &distance,
141 const double &prefactor,
142 const double &lambda
143 ) const
144 {
145 return prefactor * exp(-lambda * distance);
146 }
147
148 /** This function represents \f$ (1 + \alpha^n \eta^n)^{-1/2n} \f$.
149 *
150 * @param alpha prefactor to eta function
151 * @param r_ij distance argument
152 * @param etafunction eta or zeta
153 * @return \f$ (1 + \alpha^n \eta^n)^{-1/2n} \f$
154 */
155 result_t function_prefactor(
156 const double &alpha,
157 boost::function<result_t()> etafunction
158 ) const;
159
160 result_t
161 function_eta(
162 const argument_t &r_ij
163 ) const;
164
165 result_t
166 function_zeta(
167 const argument_t &r_ij
168 ) const;
169
170 result_t
171 function_angle(
172 const double &r_ij,
173 const double &r_ik,
174 const double &r_jk
175 ) const;
176
177private:
178 enum parameter_enum_t {
179 cutoff_offset=0,
180 equilibrium_distance=1,
181 cutoff_halfwidth=2,
182 A=3,
183 B=4,
184 lambda1=5,
185 lambda2=6,
186 lambda3=7,
187 alpha=8,
188 beta=9,
189 n=10,
190 c=11,
191 d=12,
192 h=13,
193 MAXPARAMS
194 };
195 //!> parameter vector with parameters as in enum parameter_enum_t
196 parameters_t params;
197
198public:
199 /** Setter for parameters as required by FunctionModel interface.
200 *
201 * \param _params given set of parameters
202 */
203 void setParameters(const parameters_t &_params)
204 {
205 ASSERT( _params.size() == getParameterDimension(),
206 "ManyBodyPotential_Tersoff::setParameters() - we need exactly "
207 +toString(getParameterDimension())+" parameters.");
208 params = _params;
209 }
210
211 /** Getter for parameters as required by FunctionModel interface.
212 *
213 * \return set of parameters
214 */
215 parameters_t getParameters() const
216 {
217 return params;
218 }
219
220 /** Getter for the number of parameters of this model function.
221 *
222 * \return number of parameters
223 */
224 size_t getParameterDimension() const
225 {
226 return MAXPARAMS;
227 }
228
229private:
230 //!> bound function that obtains the triples for the internal coordinationb summation.
231 const boost::function< std::vector< arguments_t >(const argument_t &, const double)> &triplefunction;
232};
233
234
235#endif /* MANYBODYPOTENTIAL_TERSOFF_HPP_ */
Note: See TracBrowser for help on using the repository browser.