Changeset f904d5 for src/Potentials/Specifics/ManyBodyPotential_Tersoff.cpp
- Timestamp:
- Dec 19, 2012, 3:25:54 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:
- ca8d82
- Parents:
- 752dc7
- git-author:
- Frederik Heber <heber@…> (10/05/12 20:28:13)
- git-committer:
- Frederik Heber <heber@…> (12/19/12 15:25:54)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Potentials/Specifics/ManyBodyPotential_Tersoff.cpp
r752dc7 rf904d5 44 44 #include "CodePatterns/Assert.hpp" 45 45 //#include "CodePatterns/Info.hpp" 46 #include "CodePatterns/Log.hpp" 46 47 47 48 #include "Potentials/helpers.hpp" … … 201 202 const double result = (cutoff == 0.) ? 202 203 0. : 203 -r_ij.distance * cutoff * params[mu] *(204 -r_ij.distance * cutoff *( 204 205 function_prefactor( 205 206 params[beta], … … 259 260 params[mu], 260 261 r_ij.distance) 261 * (-.5) * params[beta] * (temp/params[beta]) 262 * (-.5) 263 * function_prefactor( 264 params[beta], 265 function_zeta(r_ij)) 266 * (temp/params[beta]) 262 267 / (1. + temp) 263 268 ; … … 271 276 const double cutoff = function_cutoff(r_ij.distance); 272 277 const double result = (cutoff == 0.) ? 273 0. : cutoff *278 0. : .5 * cutoff * 274 279 function_smoother( 275 280 -params[B], 276 281 params[mu], 277 282 r_ij.distance) 278 * params[B] 283 * function_prefactor( 284 params[beta], 285 function_zeta(r_ij)) 279 286 * ( log(1.+temp)/(params[n]*params[n]) - temp 280 287 * (log(function_zeta(r_ij)) + log(params[beta])) … … 286 293 case c: 287 294 { 288 const double result = 0.; 289 return results_t(1, result); 295 const double zeta = function_zeta(r_ij); 296 const double temp = 297 pow(params[beta]*zeta, params[n]); 298 const double cutoff = function_cutoff(r_ij.distance); 299 const double result = (cutoff == 0.) ? 300 0. : - cutoff * 301 function_smoother( 302 -params[B], 303 params[mu], 304 r_ij.distance) 305 * function_prefactor( 306 params[beta], 307 zeta) 308 * (temp/zeta)/(1+(temp/zeta)); 309 double factor = 0.; 310 std::vector<arguments_t> triples = triplefunction(r_ij, S); 311 for (std::vector<arguments_t>::const_iterator iter = triples.begin(); 312 iter != triples.end(); ++iter) { 313 ASSERT( iter->size() == 2, 314 "ManyBodyPotential_Tersoff::function_zeta() - the triples result must contain exactly two distances."); 315 const argument_t &r_ik = (*iter)[0]; 316 const argument_t &r_jk = (*iter)[1]; 317 factor += 318 function_cutoff(r_ik.distance) 319 * (params[c]/Helpers::pow(params[c],2)) 320 * (1. - 1./(1.+(params[h]-function_theta(r_ij.distance, r_ik.distance, r_jk.distance))/Helpers::pow(params[c],2))); 321 } 322 return results_t(1, result*factor); 290 323 break; 291 324 } 292 325 case d: 293 326 { 294 const double result = 0.; 295 return results_t(1, result); 327 const double zeta = function_zeta(r_ij); 328 const double temp = 329 pow(params[beta]*zeta, params[n]); 330 const double cutoff = function_cutoff(r_ij.distance); 331 const double result = (cutoff == 0.) ? 332 0. : - cutoff * 333 function_smoother( 334 -params[B], 335 params[mu], 336 r_ij.distance) 337 * function_prefactor( 338 params[beta], 339 zeta) 340 * (temp/zeta)/(1+(temp/zeta)); 341 double factor = 0.; 342 std::vector<arguments_t> triples = triplefunction(r_ij, S); 343 for (std::vector<arguments_t>::const_iterator iter = triples.begin(); 344 iter != triples.end(); ++iter) { 345 ASSERT( iter->size() == 2, 346 "ManyBodyPotential_Tersoff::function_zeta() - the triples result must contain exactly two distances."); 347 const argument_t &r_ik = (*iter)[0]; 348 const argument_t &r_jk = (*iter)[1]; 349 factor += 350 function_cutoff(r_ik.distance) 351 * (-Helpers::pow(params[c],2)/Helpers::pow(params[d],3) 352 - Helpers::pow(params[c],2) * params[d] 353 / Helpers::pow(Helpers::pow(params[d],2) + Helpers::pow(params[h] - function_theta(r_ij.distance, r_ik.distance, r_jk.distance),2),2) 354 ); 355 } 356 return results_t(1, result*factor); 296 357 break; 297 358 } 298 359 case h: 299 360 { 300 const double result = 0.; 301 return results_t(1, result); 361 const double zeta = function_zeta(r_ij); 362 const double temp = 363 pow(params[beta]*zeta, params[n]); 364 const double cutoff = function_cutoff(r_ij.distance); 365 const double result = (cutoff == 0.) ? 366 0. : - cutoff * 367 function_smoother( 368 -params[B], 369 params[mu], 370 r_ij.distance) 371 * function_prefactor( 372 params[beta], 373 zeta) 374 * (temp/zeta)/(1+(temp/zeta)); 375 double factor = 0.; 376 std::vector<arguments_t> triples = triplefunction(r_ij, S); 377 for (std::vector<arguments_t>::const_iterator iter = triples.begin(); 378 iter != triples.end(); ++iter) { 379 ASSERT( iter->size() == 2, 380 "ManyBodyPotential_Tersoff::function_zeta() - the triples result must contain exactly two distances."); 381 const argument_t &r_ik = (*iter)[0]; 382 const argument_t &r_jk = (*iter)[1]; 383 const double tempangle = params[h] - function_theta(r_ij.distance, r_ik.distance, r_jk.distance); 384 factor += 385 function_cutoff(r_ik.distance) 386 * (-1.*Helpers::pow(params[c],2)*tempangle) 387 / Helpers::pow(Helpers::pow(params[d],2)+Helpers::pow(tempangle,2),2) 388 ; 389 } 390 return results_t(1, result*factor); 302 391 break; 303 392 } … … 404 493 405 494 ManyBodyPotential_Tersoff::result_t 495 ManyBodyPotential_Tersoff::function_theta( 496 const double &r_ij, 497 const double &r_ik, 498 const double &r_jk 499 ) const 500 { 501 const double angle = Helpers::pow(r_ij,2) + Helpers::pow(r_ik,2) - Helpers::pow(r_jk,2); 502 const double divisor = 2.* r_ij * r_ik; 503 if (divisor != 0.) { 504 LOG(2, "DEBUG: cos(theta)= " << angle/divisor); 505 return angle/divisor; 506 } else 507 return 0.; 508 } 509 510 ManyBodyPotential_Tersoff::result_t 406 511 ManyBodyPotential_Tersoff::function_angle( 407 512 const double &r_ij, … … 411 516 { 412 517 // Info info(__func__); 413 const double angle = Helpers::pow(r_ij,2) + Helpers::pow(r_ik,2) - Helpers::pow(r_jk,2); 414 const double divisor = 2.* r_ij * r_ik; 518 const double angle = function_theta(r_ij, r_ik, r_jk); 415 519 // LOG(2, "DEBUG: cos(theta)= " << angle/divisor); 416 if (divisor != 0.) { 417 const double result = 418 1. 419 + (Helpers::pow(params[c]/params[d], 2)) 420 - Helpers::pow(params[c], 2)/(Helpers::pow(params[d], 2) + 421 Helpers::pow(params[h] - angle/divisor,2)); 520 const double result = 521 1. 522 + (Helpers::pow(params[c]/params[d], 2)) 523 - Helpers::pow(params[c], 2)/(Helpers::pow(params[d], 2) + 524 Helpers::pow(params[h] - angle,2)); 422 525 423 526 // LOG(2, "DEBUG: function_angle(" << r_ij << "," << r_ik << "," << r_jk << ") = " << result); 424 return result; 425 } else 426 return 0.; 427 } 428 527 return result; 528 } 529
Note:
See TracChangeset
for help on using the changeset viewer.