source: src/Potentials/Specifics/ManyBodyPotential_Tersoff.hpp@ 16227a

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

Removed FunctionModel::getSpecificExtractor() that is not needed anymore.

  • it was only used in FitPotentialAction generating WorstFragmentMap.
  • strangely required to change the order of some libraries (libMolecuilderFragmentation_Summation needed further down).
  • Property mode set to 100644
File size: 9.6 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 /** Returns the functor that converts argument_s into the
132 * internal coordinate described by this potential function.
133 *
134 * \return coordinator functor
135 */
136 Coordinator::ptr getCoordinator() const
137 { return coordinator; }
138
139 /** Return the token name of this specific potential.
140 *
141 * \return token name of the potential
142 */
143 const std::string& getToken() const
144 { return potential_token; }
145
146 /** Returns a vector of parameter names.
147 *
148 * This is required from the specific implementation
149 *
150 * \return vector of strings containing parameter names
151 */
152 const ParameterNames_t& getParameterNames() const
153 { return ParameterNames; }
154
155 /** States whether lower and upper boundaries should be used to constraint
156 * the parameter search for this function model.
157 *
158 * \return true - constraints should be used, false - else
159 */
160 bool isBoxConstraint() const {
161 return true;
162 }
163
164 /** Returns a vector which are the lower boundaries for each parameter_t
165 * of this FunctionModel.
166 *
167 * \return vector of parameter_t resembling lowest allowed values
168 */
169 parameters_t getLowerBoxConstraints() const {
170 parameters_t lowerbound(getParameterDimension(), -std::numeric_limits<double>::max());
171// lowerbound[R] = 0.;
172// lowerbound[S] = 0.;
173// lowerbound[lambda3] = 0.;
174// lowerbound[alpha] = 0.;
175 lowerbound[beta] = std::numeric_limits<double>::min();
176 lowerbound[n] = std::numeric_limits<double>::min();
177 lowerbound[c] = std::numeric_limits<double>::min();
178 lowerbound[d] = std::numeric_limits<double>::min();
179 return lowerbound;
180 }
181
182 /** Returns a vector which are the upper boundaries for each parameter_t
183 * of this FunctionModel.
184 *
185 * \return vector of parameter_t resembling highest allowed values
186 */
187 parameters_t getUpperBoxConstraints() const {
188 return parameters_t(getParameterDimension(), std::numeric_limits<double>::max());
189 }
190
191 /** Returns a bound function to be used with TrainingData, extracting distances
192 * from a Fragment.
193 *
194 * \return bound function extracting distances from a fragment
195 */
196 FunctionModel::filter_t getSpecificFilter() const;
197
198 /** Returns the number of arguments the underlying function requires.
199 *
200 * \return number of arguments of the function
201 */
202 size_t getSpecificArgumentCount() const
203 { return 1; }
204
205 /** Sets the magic triple function that we use for getting angle distances.
206 *
207 * @param _triplefunction function that returns a list of triples (i.e. the
208 * two remaining distances) to a given pair of points (contained as
209 * indices within the argument)
210 */
211 void setTriplefunction(triplefunction_t &_triplefunction)
212 { triplefunction = _triplefunction; }
213
214private:
215 /** This function represents the cutoff \f$ f_C \f$.
216 *
217 * @param distance variable of the function
218 * @return a value in [0,1].
219 */
220 result_t function_cutoff(
221 const double &distance
222 ) const;
223 /** This function has the exponential feature from the Morse potential.
224 *
225 * @param prefactor prefactor parameter to exp function
226 * @param lambda scale parameter of exp function's argument
227 * @param distance variable of the function
228 * @return
229 */
230 result_t function_smoother(
231 const double &prefactor,
232 const double &lambda,
233 const double &distance
234 ) const;
235
236 /** This function represents \f$ (1 + \alpha^n \eta^n)^{-1/2n} \f$.
237 *
238 * @param alpha prefactor to eta function
239 * @param r_ij distance argument
240 * @param eta result value of eta or zeta
241 * @return \f$ (1 + \alpha^n \eta^n)^{-1/2n} \f$
242 */
243 result_t function_prefactor(
244 const double &alpha,
245 const double &eta
246 ) const;
247
248 result_t
249 function_eta(
250 const argument_t &r_ij
251 ) const;
252
253 result_t
254 function_zeta(
255 const argument_t &r_ij
256 ) const;
257
258 result_t
259 function_theta(
260 const double &r_ij,
261 const double &r_ik,
262 const double &r_jk
263 ) const;
264
265 result_t
266 function_angle(
267 const double &r_ij,
268 const double &r_ik,
269 const double &r_jk
270 ) const;
271
272private:
273 result_t
274 function_derivative_c(
275 const argument_t &r_ij
276 ) const;
277
278 result_t
279 function_derivative_d(
280 const argument_t &r_ij
281 ) const;
282
283 result_t
284 function_derivative_h(
285 const argument_t &r_ij
286 ) const;
287
288public:
289 enum parameter_enum_t {
290 A,
291 B,
292 lambda,
293 mu,
294 beta,
295 n,
296 c,
297 d,
298 h,
299// R,
300// S,
301// lambda3,
302// alpha,
303// chi,
304// omega,
305 MAXPARAMS
306 };
307
308private:
309 //!> parameter vector with parameters as in enum parameter_enum_t
310 parameters_t params;
311
312public:
313 // some internal parameters which are fixed
314 const double R;
315 const double S;
316 const double lambda3;
317 const double alpha;
318 const double chi;
319 const double omega;
320
321public:
322 /** Setter for parameters as required by FunctionModel interface.
323 *
324 * \param _params given set of parameters
325 */
326 void setParameters(const parameters_t &_params);
327
328 /** Getter for parameters as required by FunctionModel interface.
329 *
330 * \return set of parameters
331 */
332 parameters_t getParameters() const
333 {
334 return params;
335 }
336
337 /** Sets the parameter randomly within the sensible range of each parameter.
338 *
339 * \param data container with training data for guesstimating range
340 */
341 void setParametersToRandomInitialValues(const TrainingData &data);
342
343 /** Getter for the number of parameters of this model function.
344 *
345 * \return number of parameters
346 */
347 size_t getParameterDimension() const
348 {
349 return MAXPARAMS;
350 }
351
352private:
353 //!> bound function that obtains the triples for the internal coordinationb summation.
354 boost::function< std::vector< arguments_t >(const argument_t &, const double)> triplefunction;
355
356 //!> static definitions of the parameter name for this potential
357 static const ParameterNames_t ParameterNames;
358
359 //!> static token of this potential type
360 static const std::string potential_token;
361
362 //!> internal coordinator object for converting arguments_t
363 static Coordinator::ptr coordinator;
364};
365
366
367#endif /* MANYBODYPOTENTIAL_TERSOFF_HPP_ */
Note: See TracBrowser for help on using the repository browser.