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
wca.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2018-2022 The ESPResSo project
3 *
4 * This file is part of ESPResSo.
5 *
6 * ESPResSo is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * ESPResSo is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19#ifndef WCA_HPP
20#define WCA_HPP
21/** \file
22 * Routines to calculate the Weeks-Chandler-Andersen potential between
23 * particle pairs.
24 *
25 * Implementation in \ref wca.cpp.
26 */
27
28#include "config/config.hpp"
29
30#ifdef WCA
31
33
34#include <utils/Vector.hpp>
36#include <utils/math/sqr.hpp>
37
38/** Calculate WCA force factor */
39inline double wca_pair_force_factor(IA_parameters const &ia_params,
40 double dist) {
41 if (dist < ia_params.wca.cut) {
42 auto const frac6 = Utils::int_pow<6>(ia_params.wca.sig / dist);
43 return 48.0 * ia_params.wca.eps * frac6 * (frac6 - 0.5) / (dist * dist);
44 }
45 return 0.0;
46}
47
48/** Calculate WCA energy */
49inline double wca_pair_energy(IA_parameters const &ia_params, double dist) {
50 if (dist < ia_params.wca.cut) {
51 auto const frac6 = Utils::int_pow<6>(ia_params.wca.sig / dist);
52 return 4.0 * ia_params.wca.eps * (Utils::sqr(frac6) - frac6 + .25);
53 }
54 return 0.0;
55}
56
57#endif /* ifdef WCA */
58#endif
Vector implementation and trait types for boost qvm interoperability.
This file contains the defaults for ESPResSo.
DEVICE_QUALIFIER constexpr T sqr(T x)
Calculates the SQuaRe of x.
Definition sqr.hpp:28
Various procedures concerning interactions between particles.
Parameters for non-bonded interactions.
double wca_pair_energy(IA_parameters const &ia_params, double dist)
Calculate WCA energy.
Definition wca.hpp:49
double wca_pair_force_factor(IA_parameters const &ia_params, double dist)
Calculate WCA force factor.
Definition wca.hpp:39