ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
p3m_heffte.cpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2010-2026 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
22#include <config/config.hpp>
23
24#ifdef ESPRESSO_P3M
25
27
28#include <memory>
29#include <utility>
30
31template <typename FloatType, Arch Architecture>
32std::shared_ptr<CoulombP3M>
34 double prefactor) {
35 auto constexpr r_space_order = Utils::MemoryOrder::ROW_MAJOR;
36 auto constexpr k_space_order = Utils::MemoryOrder::ROW_MAJOR;
38 auto state_ptr =
39 std::make_unique<CoulombP3MState<FloatType, Architecture, FFTConfig>>(
40 std::move(p3m));
41 auto obj =
42 std::make_shared<CoulombP3MHeffte<FloatType, Architecture, FFTConfig>>(
43 std::move(state_ptr), tuning_params, prefactor);
44 return obj;
45}
46
47std::shared_ptr<CoulombP3M>
49 TuningParameters const &tuning_params, double prefactor,
52 if (single_precision) {
53 if (arch == Arch::CPU) {
55 } else {
57 }
58 } else {
59 if (arch == Arch::CPU) {
61 } else {
62 throw std::invalid_argument(
63 "P3M GPU only implemented in single-precision mode");
64 }
65 }
66 return fptr(std::move(p3m_params), tuning_params, prefactor);
67}
68#endif // ESPRESSO_P3M
cudaStream_t stream[1]
CUDA streams for parallel computing on CPU and GPU.
Arch
P3M kernel architecture.
std::shared_ptr< CoulombP3M > new_coulomb_p3m_impl(P3MParameters &&p3m, TuningParameters const &tuning_params, double prefactor)
std::shared_ptr< CoulombP3M > new_coulomb_p3m_heffte(P3MParameters &&p3m_params, TuningParameters const &tuning_params, double prefactor, bool single_precision, Arch arch)
Structure to hold P3M parameters and some dependent variables.