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

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

Removed parameter charges from getFragmentSpecificExtractor().

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