ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
nonbonded_interaction_data.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 * Implementation of nonbonded_interaction_data.hpp
23 */
25
27#include "system/System.hpp"
28
29#include <algorithm>
30#include <cassert>
31#include <cstddef>
32#include <memory>
33#include <utility>
34#include <vector>
35
36static double recalc_maximal_cutoff(IA_parameters const &data) {
37 auto max_cut_current = INACTIVE_CUTOFF;
38
39#ifdef LENNARD_JONES
40 max_cut_current = std::max(max_cut_current, data.lj.max_cutoff());
41#endif
42
43#ifdef WCA
44 max_cut_current = std::max(max_cut_current, data.wca.max_cutoff());
45#endif
46
47#ifdef DPD
48 max_cut_current = std::max(max_cut_current, data.dpd.max_cutoff());
49#endif
50
51#ifdef LENNARD_JONES_GENERIC
52 max_cut_current = std::max(max_cut_current, data.ljgen.max_cutoff());
53#endif
54
55#ifdef SMOOTH_STEP
56 max_cut_current = std::max(max_cut_current, data.smooth_step.max_cutoff());
57#endif
58
59#ifdef HERTZIAN
60 max_cut_current = std::max(max_cut_current, data.hertzian.max_cutoff());
61#endif
62
63#ifdef GAUSSIAN
64 max_cut_current = std::max(max_cut_current, data.gaussian.max_cutoff());
65#endif
66
67#ifdef BMHTF_NACL
68 max_cut_current = std::max(max_cut_current, data.bmhtf.max_cutoff());
69#endif
70
71#ifdef MORSE
72 max_cut_current = std::max(max_cut_current, data.morse.max_cutoff());
73#endif
74
75#ifdef BUCKINGHAM
76 max_cut_current = std::max(max_cut_current, data.buckingham.max_cutoff());
77#endif
78
79#ifdef SOFT_SPHERE
80 max_cut_current = std::max(max_cut_current, data.soft_sphere.max_cutoff());
81#endif
82
83#ifdef HAT
84 max_cut_current = std::max(max_cut_current, data.hat.max_cutoff());
85#endif
86
87#ifdef LJCOS
88 max_cut_current = std::max(max_cut_current, data.ljcos.max_cutoff());
89#endif
90
91#ifdef LJCOS2
92 max_cut_current = std::max(max_cut_current, data.ljcos2.max_cutoff());
93#endif
94
95#ifdef GAY_BERNE
96 max_cut_current = std::max(max_cut_current, data.gay_berne.max_cutoff());
97#endif
98
99#ifdef TABULATED
100 max_cut_current = std::max(max_cut_current, data.tab.cutoff());
101#endif
102
103#ifdef THOLE
104 // If THOLE is active, use p3m cutoff
105 if (data.thole.scaling_coeff != 0.)
106 max_cut_current =
107 std::max(max_cut_current, Coulomb::get_coulomb().cutoff());
108#endif
109
110 return max_cut_current;
111}
112
114 for (auto &data : m_nonbonded_ia_params) {
115 data->max_cut = recalc_maximal_cutoff(*data);
116 }
117}
118
120 auto max_cut_nonbonded = INACTIVE_CUTOFF;
121 for (auto &data : m_nonbonded_ia_params) {
122 max_cut_nonbonded = std::max(max_cut_nonbonded, data->max_cut);
123 }
124 return max_cut_nonbonded;
125}
126
128 get_system().on_non_bonded_ia_change();
129}
void recalc_maximal_cutoffs()
Recalculate cutoff of each interaction struct.
void on_non_bonded_ia_change() const
Notify system that non-bonded interactions changed.
double maximal_cutoff() const
Get maximal cutoff.
Solver const & get_coulomb()
Definition coulomb.cpp:66
static double recalc_maximal_cutoff(IA_parameters const &data)
Various procedures concerning interactions between particles.
constexpr double INACTIVE_CUTOFF
Cutoff for deactivated interactions.
Parameters for non-bonded interactions.
Gaussian_Parameters gaussian
GayBerne_Parameters gay_berne
SoftSphere_Parameters soft_sphere
SmoothStep_Parameters smooth_step
Hertzian_Parameters hertzian
Buckingham_Parameters buckingham