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

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

Added getCoordinator() to EmpiricalPotential interface.

  • implemented with all specific potentials.
  • Property mode set to 100644
File size: 9.8 KB
RevLine 
[610c11]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>
[d03292]18#include <limits>
[610c11]19
[4f82f8]20#include "Potentials/EmpiricalPotential.hpp"
21
[713888]22class PotentialFactory;
[d52819]23class TrainingData;
24
[610c11]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:
[dd966f]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$
[610c11]30 *
31 */
[ed2551]32class ManyBodyPotential_Tersoff :
[fdd23a]33 public EmpiricalPotential
[610c11]34{
[ffc368]35 //!> grant unit test access to internal parts
36 friend class ManyBodyPotential_TersoffTest;
[713888]37 //!> grant PotentialFactory access to default cstor
38 friend class PotentialFactory;
[3ccea3]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;
[e7579e]44 typedef FunctionModel::parameters_t parameters_t;
[713888]45private:
46 /** Private default constructor.
47 *
48 * This prevents creation of potential without set ParticleTypes_t.
49 *
50 */
51 ManyBodyPotential_Tersoff();
52
[610c11]53public:
54 /** Constructor for class ManyBodyPotential_Tersoff.
55 *
[775dd1a]56 * \param _ParticleTypes particle types for this potential
[610c11]57 */
58 ManyBodyPotential_Tersoff(
[775dd1a]59 const ParticleTypes_t &_ParticleTypes
[e7579e]60 );
61
62 /** Constructor for class ManyBodyPotential_Tersoff.
63 *
[ffc368]64 * @param _R offset for cutoff
65 * @param _S halfwidth for cutoff relative to \a _R
[e7579e]66 * @param A
67 * @param B
[ffc368]68 * @param lambda
69 * @param mu
[e7579e]70 * @param lambda3
71 * @param alpha
72 * @param beta
[ffc368]73 * @param chi
74 * @param omega
[e7579e]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(
[ed2551]84 const ParticleTypes_t &_ParticleTypes,
[ffc368]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,
[b15ae7]99 const double &_h);
[e7579e]100
[610c11]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 */
[4f82f8]111 results_t operator()(const arguments_t &arguments) const;
[610c11]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
[3ccea3]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 */
[e7579e]129 results_t parameter_derivative(const arguments_t &arguments, const size_t index) const;
130
[94453f1]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
[6efcae]139 /** Return the token name of this specific potential.
[67cd3a]140 *
[6efcae]141 * \return token name of the potential
[67cd3a]142 */
[ed2551]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; }
[67cd3a]154
[d03292]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
[7b019a]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 */
[f0025d]196 FunctionModel::extractor_t getSpecificExtractor() const;
[7b019a]197
[0f5d38]198 /** Returns a bound function to be used with TrainingData, extracting distances
199 * from a Fragment.
200 *
201 * \return bound function extracting distances from a fragment
202 */
203 FunctionModel::filter_t getSpecificFilter() const;
204
205 /** Returns the number of arguments the underlying function requires.
206 *
207 * \return number of arguments of the function
208 */
209 size_t getSpecificArgumentCount() const
210 { return 1; }
211
[775dd1a]212 /** Sets the magic triple function that we use for getting angle distances.
213 *
214 * @param _triplefunction function that returns a list of triples (i.e. the
215 * two remaining distances) to a given pair of points (contained as
216 * indices within the argument)
217 */
[e36ba2]218 void setTriplefunction(triplefunction_t &_triplefunction)
219 { triplefunction = _triplefunction; }
[775dd1a]220
[610c11]221private:
222 /** This function represents the cutoff \f$ f_C \f$.
223 *
224 * @param distance variable of the function
225 * @return a value in [0,1].
226 */
227 result_t function_cutoff(
228 const double &distance
229 ) const;
230 /** This function has the exponential feature from the Morse potential.
231 *
232 * @param prefactor prefactor parameter to exp function
233 * @param lambda scale parameter of exp function's argument
[ffc368]234 * @param distance variable of the function
[610c11]235 * @return
236 */
237 result_t function_smoother(
238 const double &prefactor,
[ffc368]239 const double &lambda,
240 const double &distance
241 ) const;
[610c11]242
243 /** This function represents \f$ (1 + \alpha^n \eta^n)^{-1/2n} \f$.
244 *
245 * @param alpha prefactor to eta function
246 * @param r_ij distance argument
[ffc368]247 * @param eta result value of eta or zeta
[610c11]248 * @return \f$ (1 + \alpha^n \eta^n)^{-1/2n} \f$
249 */
250 result_t function_prefactor(
251 const double &alpha,
[ffc368]252 const double &eta
[610c11]253 ) const;
254
255 result_t
256 function_eta(
257 const argument_t &r_ij
258 ) const;
259
260 result_t
261 function_zeta(
262 const argument_t &r_ij
263 ) const;
264
[f904d5]265 result_t
266 function_theta(
267 const double &r_ij,
268 const double &r_ik,
269 const double &r_jk
270 ) const;
271
[610c11]272 result_t
273 function_angle(
274 const double &r_ij,
275 const double &r_ik,
276 const double &r_jk
277 ) const;
278
[e7579e]279private:
[ca8d82]280 result_t
281 function_derivative_c(
282 const argument_t &r_ij
283 ) const;
284
285 result_t
286 function_derivative_d(
287 const argument_t &r_ij
288 ) const;
289
290 result_t
291 function_derivative_h(
292 const argument_t &r_ij
293 ) const;
294
295public:
[e7579e]296 enum parameter_enum_t {
[752dc7]297 A,
298 B,
299 lambda,
300 mu,
301 beta,
302 n,
303 c,
304 d,
305 h,
306// R,
307// S,
308// lambda3,
309// alpha,
310// chi,
311// omega,
[e7579e]312 MAXPARAMS
313 };
[f48ad3]314
315private:
[e7579e]316 //!> parameter vector with parameters as in enum parameter_enum_t
317 parameters_t params;
318
[752dc7]319public:
[990a62]320 // some internal parameters which are fixed
[752dc7]321 const double R;
322 const double S;
[990a62]323 const double lambda3;
324 const double alpha;
325 const double chi;
326 const double omega;
327
[e7579e]328public:
329 /** Setter for parameters as required by FunctionModel interface.
330 *
331 * \param _params given set of parameters
332 */
[086070]333 void setParameters(const parameters_t &_params);
[e7579e]334
335 /** Getter for parameters as required by FunctionModel interface.
336 *
337 * \return set of parameters
338 */
339 parameters_t getParameters() const
340 {
341 return params;
342 }
343
[d52819]344 /** Sets the parameter randomly within the sensible range of each parameter.
345 *
346 * \param data container with training data for guesstimating range
347 */
348 void setParametersToRandomInitialValues(const TrainingData &data);
349
[e7579e]350 /** Getter for the number of parameters of this model function.
351 *
352 * \return number of parameters
353 */
354 size_t getParameterDimension() const
355 {
356 return MAXPARAMS;
357 }
358
[610c11]359private:
360 //!> bound function that obtains the triples for the internal coordinationb summation.
[775dd1a]361 boost::function< std::vector< arguments_t >(const argument_t &, const double)> triplefunction;
[ed2551]362
363 //!> static definitions of the parameter name for this potential
364 static const ParameterNames_t ParameterNames;
365
366 //!> static token of this potential type
367 static const std::string potential_token;
[94453f1]368
369 //!> internal coordinator object for converting arguments_t
370 static Coordinator::ptr coordinator;
[610c11]371};
372
373
374#endif /* MANYBODYPOTENTIAL_TERSOFF_HPP_ */
Note: See TracBrowser for help on using the repository browser.