Changeset e7579e
- Timestamp:
- Dec 19, 2012, 3:25:53 PM (12 years ago)
- Branches:
- 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
- Children:
- ffc368
- Parents:
- 76cbd0
- git-author:
- Frederik Heber <heber@…> (10/04/12 11:34:36)
- git-committer:
- Frederik Heber <heber@…> (12/19/12 15:25:53)
- Location:
- src/Potentials/Specifics
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Potentials/Specifics/ManyBodyPotential_Tersoff.cpp
r76cbd0 re7579e 46 46 #include "Potentials/helpers.hpp" 47 47 48 ManyBodyPotential_Tersoff::ManyBodyPotential_Tersoff( 49 boost::function< std::vector<arguments_t>(const argument_t &, const double)> &_triplefunction 50 ) : 51 params(parameters_t(MAXPARAMS, 0.)), 52 triplefunction(_triplefunction) 53 {} 54 55 ManyBodyPotential_Tersoff::ManyBodyPotential_Tersoff( 56 const double &_cutoff_offset, 57 const double &_cutoff_halfwidth, 58 const double &_A, 59 const double &_B, 60 const double &_lambda1, 61 const double &_lambda2, 62 const double &_lambda3, 63 const double &_alpha, 64 const double &_beta, 65 const double &_n, 66 const double &_c, 67 const double &_d, 68 const double &_h, 69 boost::function< std::vector<arguments_t>(const argument_t &, const double)> &_triplefunction) : 70 params(parameters_t(MAXPARAMS, 0.)), 71 triplefunction(_triplefunction) 72 { 73 params[cutoff_offset] = _cutoff_offset; 74 params[cutoff_halfwidth] = _cutoff_halfwidth; 75 params[A] = _A; 76 params[B] = _B; 77 params[lambda1] = _lambda1; 78 params[lambda2] = _lambda2; 79 params[lambda3] = _lambda3; 80 params[alpha] = _alpha; 81 params[beta] = _beta; 82 params[n] = _n; 83 params[c] = _c; 84 params[d] = _d; 85 params[h] = _h; 86 } 87 48 88 ManyBodyPotential_Tersoff::results_t 49 89 ManyBodyPotential_Tersoff::operator()( … … 55 95 const double result = (cutoff == 0.) ? 0. : cutoff * ( 56 96 function_prefactor( 57 manybodyparameter_alpha,97 alpha, 58 98 boost::bind(&ManyBodyPotential_Tersoff::function_eta, 59 99 boost::cref(*this), … … 61 101 * function_smoother( 62 102 distance, 63 manybodyparameter_A,64 manybodyparameter_lambda1)103 A, 104 lambda1) 65 105 + 66 106 function_prefactor( 67 manybodyparameter_beta,107 beta, 68 108 boost::bind(&ManyBodyPotential_Tersoff::function_zeta, 69 109 boost::cref(*this), … … 71 111 * function_smoother( 72 112 distance, 73 - manybodyparameter_B,74 manybodyparameter_lambda2)113 -B, 114 lambda2) 75 115 ); 76 116 return std::vector<result_t>(1, result); … … 99 139 { 100 140 return pow( 101 (1. + Helpers::pow(alpha * etafunction(), manybodyparameter_n)),102 -1./(2.* manybodyparameter_n));141 (1. + Helpers::pow(alpha * etafunction(), n)), 142 -1./(2.*n)); 103 143 } 104 144 … … 118 158 const argument_t &r_ik = (*iter)[0]; 119 159 result += function_cutoff(r_ik.distance) 120 * exp( Helpers::pow( manybodyparameter_lambda3 * (r_ij.distance - r_ik.distance) ,3));160 * exp( Helpers::pow(lambda3 * (r_ij.distance - r_ik.distance) ,3)); 121 161 } 122 162 … … 142 182 function_cutoff(r_ik.distance) 143 183 * function_angle(r_ij.distance, r_ik.distance, r_jk.distance) 144 * exp( Helpers::pow( manybodyparameter_lambda3 * (r_ij.distance - r_ik.distance) ,3));184 * exp( Helpers::pow(lambda3 * (r_ij.distance - r_ik.distance) ,3)); 145 185 } 146 186 … … 159 199 const double result = 160 200 1. 161 + (Helpers::pow( manybodyparameter_c, 2)/Helpers::pow(manybodyparameter_d, 2))162 - Helpers::pow( manybodyparameter_c, 2)/(Helpers::pow(manybodyparameter_d, 2) +163 Helpers::pow( manybodyparameter_h - cos(angle/divisor),2));201 + (Helpers::pow(c, 2)/Helpers::pow(d, 2)) 202 - Helpers::pow(c, 2)/(Helpers::pow(d, 2) + 203 Helpers::pow(h - cos(angle/divisor),2)); 164 204 return result; 165 205 } -
src/Potentials/Specifics/ManyBodyPotential_Tersoff.hpp
r76cbd0 re7579e 19 19 #include "Potentials/EmpiricalPotential.hpp" 20 20 #include "FunctionApproximation/FunctionModel.hpp" 21 22 #include "CodePatterns/Assert.hpp" 21 23 22 24 /** This class is the implementation of the Tersoff potential function. … … 34 36 typedef FunctionModel::results_t results_t; 35 37 typedef EmpiricalPotential::derivative_components_t derivative_components_t; 36 private: 37 //!> cutoff_offset offset for cutoff parameter 38 const double cutoff_offset; 39 //!> cutoff_halfwidth half-width for cutoff parameter 40 const double cutoff_halfwidth; 41 //!> many body prefactor parameter for attractive part 42 const double manybodyparameter_A; 43 //!> many body prefactor parameter for attractive part 44 const double manybodyparameter_B; 45 //!> many body scale parameter for attractive part 46 const double manybodyparameter_lambda1; 47 //!> many body scale parameter for attractive part 48 const double manybodyparameter_lambda2; 49 //!> length scale for coordination influence 50 const double manybodyparameter_lambda3; 51 //!> many body parameter for attractive part 52 const double manybodyparameter_alpha; 53 //!> many body parameter for repulsive part 54 const double manybodyparameter_beta; 55 //!> many body type-dependent parameter giving the power 56 const double manybodyparameter_n; 57 //!> many-body type-dependent parameter in angular dependence 58 const double manybodyparameter_c; 59 //!> many-body type-dependent parameter in angular dependence 60 const double manybodyparameter_d; 61 //!> many-body type-dependent parameter in angular dependence 62 const double manybodyparameter_h; 38 typedef FunctionModel::parameters_t parameters_t; 63 39 public: 64 40 /** Constructor for class ManyBodyPotential_Tersoff. … … 69 45 */ 70 46 ManyBodyPotential_Tersoff( 71 const double _cutoff_offset, 72 const double _cutoff_halfwidth, 73 const double A, 74 const double B, 75 const double lambda1, 76 const double lambda2, 77 const double lambda3, 78 const double alpha, 79 const double beta, 80 const double n, 81 const double c, 82 const double d, 83 const double h, 84 boost::function< std::vector<arguments_t>(const argument_t &, const double)> &_triplefunction) : 85 cutoff_offset(_cutoff_offset), 86 cutoff_halfwidth(_cutoff_offset), 87 manybodyparameter_A(A), 88 manybodyparameter_B(B), 89 manybodyparameter_lambda1(lambda1), 90 manybodyparameter_lambda2(lambda2), 91 manybodyparameter_lambda3(lambda3), 92 manybodyparameter_alpha(alpha), 93 manybodyparameter_beta(beta), 94 manybodyparameter_n(n), 95 manybodyparameter_c(d), 96 manybodyparameter_d(d), 97 manybodyparameter_h(h), 98 triplefunction(_triplefunction) 99 {} 47 boost::function< std::vector<arguments_t>(const argument_t &, const double)> &_triplefunction 48 ); 49 50 /** Constructor for class ManyBodyPotential_Tersoff. 51 * 52 * @param _cutoff_offset offset for cutoff 53 * @param _cutoff_halfwidth halfwidth for cutoff relative to \a _cutoff_offset 54 * @param A 55 * @param B 56 * @param lambda1 57 * @param lambda2 58 * @param lambda3 59 * @param alpha 60 * @param beta 61 * @param n 62 * @param c 63 * @param d 64 * @param h 65 * @param _triplefunction function that returns a list of triples (i.e. the 66 * two remaining distances) to a given pair of points (contained as 67 * indices within the argument) 68 */ 69 ManyBodyPotential_Tersoff( 70 const double &_cutoff_offset, 71 const double &_cutoff_halfwidth, 72 const double &A, 73 const double &B, 74 const double &lambda1, 75 const double &lambda2, 76 const double &lambda3, 77 const double &alpha, 78 const double &beta, 79 const double &n, 80 const double &c, 81 const double &d, 82 const double &h, 83 boost::function< std::vector<arguments_t>(const argument_t &, const double)> &_triplefunction); 84 100 85 /** Destructor of class ManyBodyPotential_Tersoff. 101 86 * … … 126 111 * input 127 112 */ 128 virtual results_t paramter_derivative(const arguments_t &arguments, const size_t index) const=0; 113 results_t parameter_derivative(const arguments_t &arguments, const size_t index) const; 114 115 private: 116 /** Prohibit private default constructor. 117 * 118 * We essentially need the triplefunction, hence without this function cannot 119 * be. 120 */ 121 ManyBodyPotential_Tersoff(); 129 122 130 123 private: … … 183 176 184 177 private: 178 enum parameter_enum_t { 179 cutoff_offset=0, 180 equilibrium_distance=1, 181 cutoff_halfwidth=2, 182 A=3, 183 B=4, 184 lambda1=5, 185 lambda2=6, 186 lambda3=7, 187 alpha=8, 188 beta=9, 189 n=10, 190 c=11, 191 d=12, 192 h=13, 193 MAXPARAMS 194 }; 195 //!> parameter vector with parameters as in enum parameter_enum_t 196 parameters_t params; 197 198 public: 199 /** Setter for parameters as required by FunctionModel interface. 200 * 201 * \param _params given set of parameters 202 */ 203 void setParameters(const parameters_t &_params) 204 { 205 ASSERT( _params.size() == getParameterDimension(), 206 "ManyBodyPotential_Tersoff::setParameters() - we need exactly " 207 +toString(getParameterDimension())+" parameters."); 208 params = _params; 209 } 210 211 /** Getter for parameters as required by FunctionModel interface. 212 * 213 * \return set of parameters 214 */ 215 parameters_t getParameters() const 216 { 217 return params; 218 } 219 220 /** Getter for the number of parameters of this model function. 221 * 222 * \return number of parameters 223 */ 224 size_t getParameterDimension() const 225 { 226 return MAXPARAMS; 227 } 228 229 private: 185 230 //!> bound function that obtains the triples for the internal coordinationb summation. 186 231 const boost::function< std::vector< arguments_t >(const argument_t &, const double)> &triplefunction;
Note:
See TracChangeset
for help on using the changeset viewer.