Loading [MathJax]/extensions/TeX/AMSmath.js
ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages Concepts
buckingham.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2010-2022 The ESPResSo project
3 * Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2010
4 * Max-Planck-Institute for Polymer Research, Theory Group
5 *
6 * This file is part of ESPResSo.
7 *
8 * ESPResSo is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * ESPResSo is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21#ifndef BUCKINGHAM_H
22#define BUCKINGHAM_H
23/** \file
24 * Routines to calculate the Buckingham potential between particle pairs.
25 *
26 * Implementation in \ref buckingham.cpp.
27 */
28
29#include "config/config.hpp"
30
31#ifdef BUCKINGHAM
32
34
35#include <cmath>
36
37/**Resultant Force due to a Buckingham potential between two particles at
38 * interatomic separation r greater than or equal to discont*/
39inline double buck_force_r(double A, double B, double C, double D, double r) {
40 return (A * B * exp(-B * r) - 6.0 * C / pow(r, 7) - 4.0 * D / pow(r, 5));
41}
42
43/**Potential Energy due to a Buckingham potential between two particles at
44 * interatomic separation r greater than or equal to discont*/
45inline double buck_energy_r(double A, double B, double C, double D,
46 double shift, double r) {
47 return (A * exp(-B * r) - C / pow(r, 6) - D / pow(r, 4) + shift);
48}
49
50/** Calculate Buckingham force factor */
51inline double buck_pair_force_factor(IA_parameters const &ia_params,
52 double dist) {
53 if (dist < ia_params.buckingham.cut) {
54 /* case: resulting force/energy greater than discontinuity and
55 less than cutoff (true Buckingham region) */
56 double fac;
57 if (dist > ia_params.buckingham.discont) {
58 fac = buck_force_r(ia_params.buckingham.A, ia_params.buckingham.B,
59 ia_params.buckingham.C, ia_params.buckingham.D, dist) /
60 dist;
61 } else {
62 /* resulting force/energy in the linear region*/
63 fac = -ia_params.buckingham.F2 / dist;
64 }
65 return fac;
66 }
67 return 0.0;
68}
69
70/** Calculate Buckingham energy */
71inline double buck_pair_energy(IA_parameters const &ia_params, double dist) {
72 if (dist < ia_params.buckingham.cut) {
73 /* case: resulting force/energy greater than discont and
74 less than cutoff (true Buckingham region) */
75 if (dist > ia_params.buckingham.discont) {
76 return buck_energy_r(ia_params.buckingham.A, ia_params.buckingham.B,
77 ia_params.buckingham.C, ia_params.buckingham.D,
78 ia_params.buckingham.shift, dist);
79 }
80
81 /* resulting force/energy in the linear region*/
82 return ia_params.buckingham.F1 + ia_params.buckingham.F2 * dist;
83 }
84 return 0.0;
85}
86
87#endif // BUCKINGHAM
88#endif
double buck_pair_force_factor(IA_parameters const &ia_params, double dist)
Calculate Buckingham force factor.
double buck_pair_energy(IA_parameters const &ia_params, double dist)
Calculate Buckingham energy.
double buck_energy_r(double A, double B, double C, double D, double shift, double r)
Potential Energy due to a Buckingham potential between two particles at interatomic separation r grea...
double buck_force_r(double A, double B, double C, double D, double r)
Resultant Force due to a Buckingham potential between two particles at interatomic separation r great...
This file contains the defaults for ESPResSo.
Various procedures concerning interactions between particles.
Parameters for non-bonded interactions.
Buckingham_Parameters buckingham