ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
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
22#pragma once
23
24/** \file
25 * Routines to calculate the Buckingham potential between particle pairs.
26 *
27 * Implementation in \ref buckingham.cpp.
28 */
29
30#include "config/config.hpp"
31
32#ifdef ESPRESSO_BUCKINGHAM
33
35
36#include <cmath>
37
38/**Resultant Force due to a Buckingham potential between two particles at
39 * interatomic separation r greater than or equal to discont*/
40inline double buck_force_r(double A, double B, double C, double D, double r) {
41 return (A * B * exp(-B * r) - 6.0 * C / pow(r, 7) - 4.0 * D / pow(r, 5));
42}
43
44/**Potential Energy due to a Buckingham potential between two particles at
45 * interatomic separation r greater than or equal to discont*/
46inline double buck_energy_r(double A, double B, double C, double D,
47 double shift, double r) {
48 return (A * exp(-B * r) - C / pow(r, 6) - D / pow(r, 4) + shift);
49}
50
51/** Calculate Buckingham force factor */
52inline double buck_pair_force_factor(IA_parameters const &ia_params,
53 double dist) {
54 if (dist < ia_params.buckingham.cut) {
55 /* case: resulting force/energy greater than discontinuity and
56 less than cutoff (true Buckingham region) */
57 double fac;
58 if (dist > ia_params.buckingham.discont) {
59 fac = buck_force_r(ia_params.buckingham.A, ia_params.buckingham.B,
60 ia_params.buckingham.C, ia_params.buckingham.D, dist) /
61 dist;
62 } else {
63 /* resulting force/energy in the linear region*/
64 fac = -ia_params.buckingham.F2 / dist;
65 }
66 return fac;
67 }
68 return 0.0;
69}
70
71/** Calculate Buckingham energy */
72inline double buck_pair_energy(IA_parameters const &ia_params, double dist) {
73 if (dist < ia_params.buckingham.cut) {
74 /* case: resulting force/energy greater than discont and
75 less than cutoff (true Buckingham region) */
76 if (dist > ia_params.buckingham.discont) {
77 return buck_energy_r(ia_params.buckingham.A, ia_params.buckingham.B,
78 ia_params.buckingham.C, ia_params.buckingham.D,
79 ia_params.buckingham.shift, dist);
80 }
81
82 /* resulting force/energy in the linear region*/
83 return ia_params.buckingham.F1 + ia_params.buckingham.F2 * dist;
84 }
85 return 0.0;
86}
87
88#endif // ESPRESSO_BUCKINGHAM
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...
Various procedures concerning interactions between particles.
Parameters for non-bonded interactions.
Buckingham_Parameters buckingham