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

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

Renamed getFragmentSpecificExtractor() -> getSpecificExtractor().

  • Property mode set to 100644
File size: 9.1 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#include <limits>
19
20#include "Potentials/EmpiricalPotential.hpp"
21
22class PotentialFactory;
23class TrainingData;
24
25/** This class is the implementation of the Tersoff potential function.
26 *
27 * \note The arguments_t argument list is here in the following order:
28 * -# first \f$ r_{ij} \f$,
29 * -# then all \f$ r_{ik} \f$ that are within the cutoff, i.e. \f$ r_{ik} < R + D\f$
30 *
31 */
32class ManyBodyPotential_Tersoff :
33 public EmpiricalPotential
34{
35 //!> grant unit test access to internal parts
36 friend class ManyBodyPotential_TersoffTest;
37 //!> grant PotentialFactory access to default cstor
38 friend class PotentialFactory;
39 // some repeated typedefs to avoid ambiguities
40 typedef FunctionModel::arguments_t arguments_t;
41 typedef FunctionModel::result_t result_t;
42 typedef FunctionModel::results_t results_t;
43 typedef EmpiricalPotential::derivative_components_t derivative_components_t;
44 typedef FunctionModel::parameters_t parameters_t;
45private:
46 /** Private default constructor.
47 *
48 * This prevents creation of potential without set ParticleTypes_t.
49 *
50 */
51 ManyBodyPotential_Tersoff();
52
53public:
54 /** Constructor for class ManyBodyPotential_Tersoff.
55 *
56 * \param _ParticleTypes particle types for this potential
57 */
58 ManyBodyPotential_Tersoff(
59 const ParticleTypes_t &_ParticleTypes
60 );
61
62 /** Constructor for class ManyBodyPotential_Tersoff.
63 *
64 * @param _R offset for cutoff
65 * @param _S halfwidth for cutoff relative to \a _R
66 * @param A
67 * @param B
68 * @param lambda
69 * @param mu
70 * @param lambda3
71 * @param alpha
72 * @param beta
73 * @param chi
74 * @param omega
75 * @param n
76 * @param c
77 * @param d
78 * @param h
79 * @param _triplefunction function that returns a list of triples (i.e. the
80 * two remaining distances) to a given pair of points (contained as
81 * indices within the argument)
82 */
83 ManyBodyPotential_Tersoff(
84 const ParticleTypes_t &_ParticleTypes,
85 const double &_R,
86 const double &_S,
87 const double &_A,
88 const double &_B,
89 const double &_lambda,
90 const double &_mu,
91 const double &_lambda3,
92 const double &_alpha,
93 const double &_beta,
94 const double &_chi,
95 const double &_omega,
96 const double &_n,
97 const double &_c,
98 const double &_d,
99 const double &_h);
100
101 /** Destructor of class ManyBodyPotential_Tersoff.
102 *
103 */
104 virtual ~ManyBodyPotential_Tersoff() {}
105
106 /** Evaluates the Tersoff potential for the given arguments.
107 *
108 * @param arguments single distance
109 * @return value of the potential function
110 */
111 results_t operator()(const arguments_t &arguments) const;
112
113 /** Evaluates the derivative of the Tersoff potential with respect to the
114 * input variables.
115 *
116 * @param arguments single distance
117 * @return vector with components of the derivative
118 */
119 derivative_components_t derivative(const arguments_t &arguments) const;
120
121 /** Evaluates the derivative of the function with the given \a arguments
122 * with respect to a specific parameter indicated by \a index.
123 *
124 * \param arguments set of arguments as input variables to the function
125 * \param index derivative of which parameter
126 * \return result vector containing the derivative with respect to the given
127 * input
128 */
129 results_t parameter_derivative(const arguments_t &arguments, const size_t index) const;
130
131 /** Return the token name of this specific potential.
132 *
133 * \return token name of the potential
134 */
135 const std::string& getToken() const
136 { return potential_token; }
137
138 /** Returns a vector of parameter names.
139 *
140 * This is required from the specific implementation
141 *
142 * \return vector of strings containing parameter names
143 */
144 const ParameterNames_t& getParameterNames() const
145 { return ParameterNames; }
146
147 /** States whether lower and upper boundaries should be used to constraint
148 * the parameter search for this function model.
149 *
150 * \return true - constraints should be used, false - else
151 */
152 bool isBoxConstraint() const {
153 return true;
154 }
155
156 /** Returns a vector which are the lower boundaries for each parameter_t
157 * of this FunctionModel.
158 *
159 * \return vector of parameter_t resembling lowest allowed values
160 */
161 parameters_t getLowerBoxConstraints() const {
162 parameters_t lowerbound(getParameterDimension(), -std::numeric_limits<double>::max());
163// lowerbound[R] = 0.;
164// lowerbound[S] = 0.;
165// lowerbound[lambda3] = 0.;
166// lowerbound[alpha] = 0.;
167 lowerbound[beta] = std::numeric_limits<double>::min();
168 lowerbound[n] = std::numeric_limits<double>::min();
169 lowerbound[c] = std::numeric_limits<double>::min();
170 lowerbound[d] = std::numeric_limits<double>::min();
171 return lowerbound;
172 }
173
174 /** Returns a vector which are the upper boundaries for each parameter_t
175 * of this FunctionModel.
176 *
177 * \return vector of parameter_t resembling highest allowed values
178 */
179 parameters_t getUpperBoxConstraints() const {
180 return parameters_t(getParameterDimension(), std::numeric_limits<double>::max());
181 }
182
183 /** Returns a bound function to be used with TrainingData, extracting distances
184 * from a Fragment.
185 *
186 * \return bound function extracting distances from a fragment
187 */
188 FunctionModel::extractor_t getSpecificExtractor() const;
189
190 /** Sets the magic triple function that we use for getting angle distances.
191 *
192 * @param _triplefunction function that returns a list of triples (i.e. the
193 * two remaining distances) to a given pair of points (contained as
194 * indices within the argument)
195 */
196 void setTriplefunction(triplefunction_t &_triplefunction)
197 { triplefunction = _triplefunction; }
198
199private:
200 /** This function represents the cutoff \f$ f_C \f$.
201 *
202 * @param distance variable of the function
203 * @return a value in [0,1].
204 */
205 result_t function_cutoff(
206 const double &distance
207 ) const;
208 /** This function has the exponential feature from the Morse potential.
209 *
210 * @param prefactor prefactor parameter to exp function
211 * @param lambda scale parameter of exp function's argument
212 * @param distance variable of the function
213 * @return
214 */
215 result_t function_smoother(
216 const double &prefactor,
217 const double &lambda,
218 const double &distance
219 ) const;
220
221 /** This function represents \f$ (1 + \alpha^n \eta^n)^{-1/2n} \f$.
222 *
223 * @param alpha prefactor to eta function
224 * @param r_ij distance argument
225 * @param eta result value of eta or zeta
226 * @return \f$ (1 + \alpha^n \eta^n)^{-1/2n} \f$
227 */
228 result_t function_prefactor(
229 const double &alpha,
230 const double &eta
231 ) const;
232
233 result_t
234 function_eta(
235 const argument_t &r_ij
236 ) const;
237
238 result_t
239 function_zeta(
240 const argument_t &r_ij
241 ) const;
242
243 result_t
244 function_theta(
245 const double &r_ij,
246 const double &r_ik,
247 const double &r_jk
248 ) const;
249
250 result_t
251 function_angle(
252 const double &r_ij,
253 const double &r_ik,
254 const double &r_jk
255 ) const;
256
257private:
258 result_t
259 function_derivative_c(
260 const argument_t &r_ij
261 ) const;
262
263 result_t
264 function_derivative_d(
265 const argument_t &r_ij
266 ) const;
267
268 result_t
269 function_derivative_h(
270 const argument_t &r_ij
271 ) const;
272
273public:
274 enum parameter_enum_t {
275 A,
276 B,
277 lambda,
278 mu,
279 beta,
280 n,
281 c,
282 d,
283 h,
284// R,
285// S,
286// lambda3,
287// alpha,
288// chi,
289// omega,
290 MAXPARAMS
291 };
292
293private:
294 //!> parameter vector with parameters as in enum parameter_enum_t
295 parameters_t params;
296
297public:
298 // some internal parameters which are fixed
299 const double R;
300 const double S;
301 const double lambda3;
302 const double alpha;
303 const double chi;
304 const double omega;
305
306public:
307 /** Setter for parameters as required by FunctionModel interface.
308 *
309 * \param _params given set of parameters
310 */
311 void setParameters(const parameters_t &_params);
312
313 /** Getter for parameters as required by FunctionModel interface.
314 *
315 * \return set of parameters
316 */
317 parameters_t getParameters() const
318 {
319 return params;
320 }
321
322 /** Sets the parameter randomly within the sensible range of each parameter.
323 *
324 * \param data container with training data for guesstimating range
325 */
326 void setParametersToRandomInitialValues(const TrainingData &data);
327
328 /** Getter for the number of parameters of this model function.
329 *
330 * \return number of parameters
331 */
332 size_t getParameterDimension() const
333 {
334 return MAXPARAMS;
335 }
336
337private:
338 //!> bound function that obtains the triples for the internal coordinationb summation.
339 boost::function< std::vector< arguments_t >(const argument_t &, const double)> triplefunction;
340
341 //!> static definitions of the parameter name for this potential
342 static const ParameterNames_t ParameterNames;
343
344 //!> static token of this potential type
345 static const std::string potential_token;
346};
347
348
349#endif /* MANYBODYPOTENTIAL_TERSOFF_HPP_ */
Note: See TracBrowser for help on using the repository browser.