12 template <
typename ParticleContainer,
typename ScalarAttribute,
typename VectorAttribute>
13 KOKKOS_INLINE_FUNCTION
constexpr
25 return forceConstant * qm * (dist / r)
26 * (2.0 * alpha * Kokkos::exp(-alpha * alpha * r2)
27 / (Kokkos::sqrt(Kokkos::numbers::pi) * r)
28 + (1.0 - Kokkos::erf(alpha * r)) / r2);
31 template <
typename ParticleContainer,
typename ScalarAttribute,
typename VectorAttribute>
40 const auto& QM =
QM_m;
47 const auto& particleLayout = this->
pc_m.getLayout();
49 particleLayout.template forEachPair<execution_space>(
50 KOKKOS_LAMBDA(
const size_t& i,
const size_t& j) {
51 const Vector_t dist_ij = R(i) - R(j);
52 const Scalar_t rsq_ij = dist_ij.dot(dist_ij);
54 if (rsq_ij >= rcut2) {
58 const auto F_ij =
fieldFromPair(dist_ij, rsq_ij, alpha, forceConstant, QM(j));
62 Kokkos::atomic_sub(&
Field(i), F_ij);
ippl::Vector< T, Dim > Vector_t
ippl::Field< T, Dim, Mesh_t< Dim >, Centering_t< Dim >, ViewArgs... > Field
KOKKOS_INLINE_FUNCTION auto & get(Tuple< Ts... > &t)
Accessor function to get an element mutable reference at a specific index from a Tuple.
const ParticleContainer & pc_m
VectorAttribute & Field_m
! The electric or gravitational field
const ScalarAttribute & QM_m
! Charge or Mass of the particles
typename ScalarAttribute::value_type Scalar_t
const VectorAttribute & R_m
! Positions of the particles
static KOKKOS_INLINE_FUNCTION constexpr Vector_t fieldFromPair(const Vector_t &dist, Scalar_t r2, Scalar_t alpha, Scalar_t forceConstant, Scalar_t qm)
typename VectorAttribute::value_type Vector_t
Timing::TimerRef TimerRef
static TimerRef getTimer(const char *nm)
static void stopTimer(TimerRef t)
static void startTimer(TimerRef t)