ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
buckingham.cpp
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/** \file
22 *
23 * Implementation of \ref buckingham.hpp
24 */
25#include "buckingham.hpp"
26
27#ifdef BUCKINGHAM
29
30#include <stdexcept>
31
33 double d, double cutoff,
34 double discont, double shift)
35 : A{a}, B{b}, C{c}, D{d}, cut{cutoff}, discont{discont}, shift{shift} {
36 if (a < 0.) {
37 throw std::domain_error("Buckingham parameter 'a' has to be >= 0");
38 }
39 if (b < 0.) {
40 throw std::domain_error("Buckingham parameter 'b' has to be >= 0");
41 }
42 if (c < 0.) {
43 throw std::domain_error("Buckingham parameter 'c' has to be >= 0");
44 }
45 if (d < 0.) {
46 throw std::domain_error("Buckingham parameter 'd' has to be >= 0");
47 }
48 if (cutoff < 0.) {
49 throw std::domain_error("Buckingham parameter 'cutoff' has to be >= 0");
50 }
51
52 /* Replace the Buckingham potential for interatomic distance less
53 than or equal to discontinuity by a straight line (F1+F2*r) */
54 auto const F = buck_force_r(A, B, C, D, discont);
55 F1 = buck_energy_r(A, B, C, D, shift, discont) + discont * F;
56 F2 = -F;
57}
58
59#endif // BUCKINGHAM
Routines to calculate the Buckingham potential between particle pairs.
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.
Buckingham_Parameters()=default