source: src/Potentials/Specifics/ManyBodyPotential_Tersoff.cpp@ 3c1465

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 3c1465 was 4f82f8, checked in by Frederik Heber <heber@…>, 12 years ago

Rewrote EmpiricalPotentials and the specific implementations such that they are usable as FunctionModel's.

  • Property mode set to 100644
File size: 5.0 KB
Line 
1/*
2 * Project: MoleCuilder
3 * Description: creates and alters molecular systems
4 * Copyright (C) 2012 University of Bonn. All rights reserved.
5 * Please see the COPYING file or "Copyright notice" in builder.cpp for details.
6 *
7 *
8 * This file is part of MoleCuilder.
9 *
10 * MoleCuilder is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * MoleCuilder is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with MoleCuilder. If not, see <http://www.gnu.org/licenses/>.
22 */
23
24/*
25 * ManyBodyPotential_Tersoff.cpp
26 *
27 * Created on: Sep 26, 2012
28 * Author: heber
29 */
30
31
32// include config.h
33#ifdef HAVE_CONFIG_H
34#include <config.h>
35#endif
36
37#include "CodePatterns/MemDebug.hpp"
38
39#include "ManyBodyPotential_Tersoff.hpp"
40
41#include <boost/bind.hpp>
42#include <cmath>
43
44#include "CodePatterns/Assert.hpp"
45
46#include "Potentials/helpers.hpp"
47
48ManyBodyPotential_Tersoff::results_t
49ManyBodyPotential_Tersoff::operator()(
50 const arguments_t &arguments
51 ) const
52{
53 const double &distance = arguments[0].distance;
54 const double cutoff = function_cutoff(distance);
55 const double result = (cutoff == 0.) ? 0. : cutoff * (
56 function_prefactor(
57 manybodyparameter_alpha,
58 boost::bind(&ManyBodyPotential_Tersoff::function_eta,
59 boost::cref(*this),
60 boost::cref(arguments[0])))
61 * function_smoother(
62 distance,
63 manybodyparameter_A,
64 manybodyparameter_lambda1)
65 +
66 function_prefactor(
67 manybodyparameter_beta,
68 boost::bind(&ManyBodyPotential_Tersoff::function_zeta,
69 boost::cref(*this),
70 boost::cref(arguments[0])))
71 * function_smoother(
72 distance,
73 -manybodyparameter_B,
74 manybodyparameter_lambda2)
75 );
76 return std::vector<result_t>(1, result);
77}
78
79ManyBodyPotential_Tersoff::result_t
80ManyBodyPotential_Tersoff::function_cutoff(
81 const double &distance
82 ) const
83{
84 const double offset = (distance - cutoff_offset);
85 if (offset < - cutoff_halfwidth)
86 return 1.;
87 else if (offset > cutoff_halfwidth)
88 return 0.;
89 else {
90 return (0.5 - 0.5 * sin( .5 * M_PI * offset/cutoff_halfwidth));
91 }
92}
93
94ManyBodyPotential_Tersoff::result_t
95ManyBodyPotential_Tersoff::function_prefactor(
96 const double &alpha,
97 boost::function<result_t()> etafunction
98 ) const
99{
100 return pow(
101 (1. + Helpers::pow(alpha * etafunction(), manybodyparameter_n)),
102 -1./(2.*manybodyparameter_n));
103}
104
105ManyBodyPotential_Tersoff::result_t
106ManyBodyPotential_Tersoff::function_eta(
107 const argument_t &r_ij
108 ) const
109{
110 result_t result = 0.;
111
112 // get all triples within the cutoff
113 std::vector<arguments_t> triples = triplefunction(r_ij, cutoff_offset+cutoff_halfwidth);
114 for (std::vector<arguments_t>::const_iterator iter = triples.begin();
115 iter != triples.end(); ++iter) {
116 ASSERT( iter->size() == 2,
117 "ManyBodyPotential_Tersoff::function_zeta() - the triples result must contain of exactly two distances.");
118 const argument_t &r_ik = (*iter)[0];
119 result += function_cutoff(r_ik.distance)
120 * exp( Helpers::pow(manybodyparameter_lambda3 * (r_ij.distance - r_ik.distance) ,3));
121 }
122
123 return result;
124}
125
126ManyBodyPotential_Tersoff::result_t
127ManyBodyPotential_Tersoff::function_zeta(
128 const argument_t &r_ij
129 ) const
130{
131 result_t result = 0.;
132
133 // get all triples within the cutoff
134 std::vector<arguments_t> triples = triplefunction(r_ij, cutoff_offset+cutoff_halfwidth);
135 for (std::vector<arguments_t>::const_iterator iter = triples.begin();
136 iter != triples.end(); ++iter) {
137 ASSERT( iter->size() == 2,
138 "ManyBodyPotential_Tersoff::function_zeta() - the triples result must contain exactly two distances.");
139 const argument_t &r_ik = (*iter)[0];
140 const argument_t &r_jk = (*iter)[1];
141 result +=
142 function_cutoff(r_ik.distance)
143 * function_angle(r_ij.distance, r_ik.distance, r_jk.distance)
144 * exp( Helpers::pow(manybodyparameter_lambda3 * (r_ij.distance - r_ik.distance) ,3));
145 }
146
147 return result;
148}
149
150ManyBodyPotential_Tersoff::result_t
151ManyBodyPotential_Tersoff::function_angle(
152 const double &r_ij,
153 const double &r_ik,
154 const double &r_jk
155 ) const
156{
157 const double angle = Helpers::pow(r_ij,2) + Helpers::pow(r_ik,2) - Helpers::pow(r_jk,2);
158 const double divisor = r_ij * r_ik;
159 const double result =
160 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));
164 return result;
165}
Note: See TracBrowser for help on using the repository browser.