ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
short_range_loop.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2010-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
20#pragma once
21
22#include "config/config.hpp"
23
25
26#ifdef CALIPER
27#include <caliper/cali.h>
28#endif
29
30#include <cassert>
31
32namespace detail {
33/**
34 * @brief Functor that returns true for
35 * any arguments.
36 */
37struct True {
38 template <class... T> bool operator()(T &...) const { return true; }
39};
40} // namespace detail
41
42template <class BondKernel, class PairKernel,
43 class VerletCriterion = detail::True>
44void short_range_loop(BondKernel bond_kernel, PairKernel pair_kernel,
45 CellStructure &cell_structure, double pair_cutoff,
46 double bond_cutoff,
47 VerletCriterion const &verlet_criterion = {}) {
48#ifdef CALIPER
49 CALI_CXX_MARK_FUNCTION;
50#endif
51
52 assert(cell_structure.get_resort_particles() == Cells::RESORT_NONE);
53
54 if (bond_cutoff >= 0.) {
55 cell_structure.bond_loop(bond_kernel);
56 }
57
58 if (pair_cutoff > 0.) {
59 cell_structure.non_bonded_loop(pair_kernel, verlet_criterion);
60 }
61}
Returns true if the particles are to be considered for short range interactions.
This file contains the defaults for ESPResSo.
void short_range_loop(BondKernel bond_kernel, PairKernel pair_kernel, CellStructure &cell_structure, double pair_cutoff, double bond_cutoff, VerletCriterion const &verlet_criterion={})
Describes a cell structure / cell system.
unsigned get_resort_particles() const
Get the currently scheduled resort level.
void non_bonded_loop(PairKernel pair_kernel)
Non-bonded pair loop.
void bond_loop(BondKernel const &bond_kernel)
Bonded pair loop.