ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
nonbonded_tab.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 CORE_TABULATED_HPP
22#define CORE_TABULATED_HPP
23
24/** \file
25 * Routines to calculate the energy and/or force for particle pairs via
26 * interpolation of lookup tables.
27 *
28 * Needs feature TABULATED compiled in (see \ref config.hpp).
29 */
30
31#include "config/config.hpp"
32
33#ifdef TABULATED
34
37
38#include <utils/Vector.hpp>
39
40#include <vector>
41
42/** Calculate a non-bonded pair force factor by linear interpolation from a
43 * table.
44 */
45inline double tabulated_pair_force_factor(IA_parameters const &ia_params,
46 double dist) {
47 if (dist < ia_params.tab.cutoff()) {
48 return ia_params.tab.force(dist) / dist;
49 }
50 return 0.0;
51}
52
53/** Calculate a non-bonded pair energy by linear interpolation from a table. */
54inline double tabulated_pair_energy(IA_parameters const &ia_params,
55 double dist) {
56 if (dist < ia_params.tab.cutoff()) {
57 return ia_params.tab.energy(dist);
58 }
59 return 0.0;
60}
61
62#endif // TABULATED
63#endif
Vector implementation and trait types for boost qvm interoperability.
This file contains the defaults for ESPResSo.
Various procedures concerning interactions between particles.
double tabulated_pair_force_factor(IA_parameters const &ia_params, double dist)
Calculate a non-bonded pair force factor by linear interpolation from a table.
double tabulated_pair_energy(IA_parameters const &ia_params, double dist)
Calculate a non-bonded pair energy by linear interpolation from a table.
Parameters for non-bonded interactions.
double force(double x) const
Evaluate the force at position x.
double energy(double x) const
Evaluate the energy at position x.