source: src/Potentials/Specifics/ManyBodyPotential_Tersoff.hpp@ 6efcae

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 Candidate_v1.7.0 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 6efcae was 6efcae, checked in by Frederik Heber <heber@…>, 13 years ago

SerializablePotential is new type to be stored in PotentialRegistry.

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