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-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
22#pragma once
23
24#include <config/config.hpp>
25
26#ifdef ESPRESSO_DIPOLES
27
29
30/**
31 * @brief Dipolar all with all and no replica.
32 * Handling of a system of dipoles where no replicas exist.
33 * Assumes minimum image convention for those axis in which the
34 * system is periodic.
35 */
36struct DipolarDirectSum : public Dipoles::Actor<DipolarDirectSum> {
39 DipolarDirectSum(double prefactor, int n_replicas, bool gpu);
40
41 bool is_gpu() const { return m_is_gpu; }
42 void on_activation() const {
43#ifdef ESPRESSO_CUDA
44 if (m_is_gpu) {
46 }
47#endif
48 }
49#ifdef ESPRESSO_CUDA
50 void on_activation_gpu() const;
51#endif
52 void on_boxl_change() const {}
53 void on_node_grid_change() const {}
54 void on_periodicity_change() const {}
56 void init() const {}
57 void sanity_checks() const {}
58
59 /**
60 * @brief Calculate long-range dipolar energy.
61 * The GPU implementation stores the energy on a GPU accumulator
62 * and zero is returned from this method.
63 */
64 double long_range_energy() const {
65#ifdef ESPRESSO_CUDA
66 if (m_is_gpu) {
68 return 0.;
69 }
70#endif
71 return long_range_energy_cpu();
72 }
73 void add_long_range_forces() const {
74#ifdef ESPRESSO_CUDA
75 if (m_is_gpu) {
77 }
78#endif
80 }
81 double long_range_energy_cpu() const;
82 void add_long_range_forces_cpu() const;
83#ifdef ESPRESSO_CUDA
84 void long_range_energy_gpu() const;
85 void add_long_range_forces_gpu() const;
86#endif
87#ifdef ESPRESSO_DIPOLE_FIELD_TRACKING
88 void dipole_field_at_part_cpu() const;
89#endif
90};
91
92#endif // ESPRESSO_DIPOLES
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
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.