ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
dipolar_direct_sum.hpp
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#pragma once
23
24#include <config/config.hpp>
25
26#ifdef ESPRESSO_DIPOLES
27
29
30#include <utils/Vector.hpp>
31
32/**
33 * @brief Dipolar all with all and no replica.
34 * Handling of a system of dipoles where no replicas exist.
35 * Assumes minimum image convention for those axis in which the
36 * system is periodic.
37 */
38struct DipolarDirectSum : public Dipoles::Actor<DipolarDirectSum> {
41 DipolarDirectSum(double prefactor, int n_replicas, bool gpu);
42
43 bool is_gpu() const { return m_is_gpu; }
44 void on_activation() const {
45#ifdef ESPRESSO_CUDA
46 if (m_is_gpu) {
48 }
49#endif
50 }
51#ifdef ESPRESSO_CUDA
52 void on_activation_gpu() const;
53#endif
54 void on_boxl_change() const {}
55 void on_node_grid_change() const {}
56 void on_periodicity_change() const {}
58 void init() const {}
59 void sanity_checks() const {}
60
61 /**
62 * @brief Calculate long-range dipolar energy.
63 * The GPU implementation stores the energy on a GPU accumulator
64 * and zero is returned from this method.
65 */
66 double long_range_energy() const {
67#ifdef ESPRESSO_CUDA
68 if (m_is_gpu) {
70 return 0.;
71 }
72#endif
73 return long_range_energy_cpu();
74 }
75 void add_long_range_forces() const {
76#ifdef ESPRESSO_CUDA
77 if (m_is_gpu) {
79 }
80#endif
82 }
83 double long_range_energy_cpu() const;
84 void add_long_range_forces_cpu() const;
85#ifdef ESPRESSO_CUDA
86 void long_range_energy_gpu() const;
87 void add_long_range_forces_gpu() const;
88#endif
89
90 /**
91 * @brief Calculate the dipolar pressure tensor.
92 * Not implemented for the GPU variant: emits a runtime warning
93 * and returns a zero tensor in that case.
94 */
96#ifdef ESPRESSO_DIPOLE_FIELD_TRACKING
97 void dipole_field_at_part_cpu() const;
98#endif
99};
100
101#endif // ESPRESSO_DIPOLES
Vector implementation and trait types for boost qvm interoperability.
double prefactor
Magnetostatics prefactor.
Dipolar all with all and no replica.
void on_cell_structure_change() const
void on_boxl_change() const
void on_node_grid_change() const
double long_range_energy_cpu() const
Calculate the interaction potential.
void dipole_field_at_part_cpu() const
Calculate total dipole field of each particle.
void add_long_range_forces() const
void add_long_range_forces_gpu() const
Utils::Vector9d long_range_pressure() const
Calculate the dipolar pressure tensor.
void on_periodicity_change() const
double long_range_energy() const
Calculate long-range dipolar energy.
void add_long_range_forces_cpu() const
Calculate and add the interaction forces/torques to the particles.