30#include <Cabana_Core.hpp>
88 Kokkos::View<double **, Kokkos::LayoutRight, memory_space>
local_energy;
91 Kokkos::View<int *, Kokkos::LayoutRight, memory_space>
mol_id_view;
102 Kokkos::View<double **, Kokkos::LayoutRight, memory_space>
const
114 std::size_t
j)
const {
118 auto const dist_sq = d.norm2();
128#if defined(ESPRESSO_EXCLUSIONS) or defined(ESPRESSO_THOLE)
130#ifdef ESPRESSO_EXCLUSIONS
150#ifdef ESPRESSO_EXCLUSIONS
167#ifdef ESPRESSO_GAY_BERNE
183#ifdef ESPRESSO_ELECTROSTATICS
189 double const e_c = (*coulomb_u_kernel)(pos1, pos2,
q1 *
q2, d,
dist);
195#ifdef ESPRESSO_DIPOLES
200 double const e_d = (*dipoles_u_kernel)(
210 Kokkos::View<double **, Kokkos::LayoutRight, Kokkos::HostSpace>
const
214 auto const nthreads = local_energy.extent(0);
216 Kokkos::create_mirror_view_and_copy(Kokkos::HostSpace{}, local_energy);
220 for (std::size_t t = 0; t <
nthreads; ++t)
228 for (
int t1 = 0;
t1 < n_types; ++
t1)
230 obs.non_bonded_inter_contribution(
t1,
t2)[0] +=
233 for (
int t1 = 0;
t1 < n_types; ++
t1)
235 obs.non_bonded_intra_contribution(
t1,
t2)[0] +=
Vector implementation and trait types for boost qvm interoperability.
#define ESPRESSO_ATTR_ALWAYS_INLINE
container for bonded interactions.
ESPRESSO_ATTR_ALWAYS_INLINE Utils::Vector3< T > get_mi_vector(Utils::Vector3< T > const &a, Utils::Vector3< T > const &b) const
Get the minimum-image vector between two coordinates.
auto & get_ia_param(int i, int j)
Get interaction parameters between particle types i and j.
Observable for the pressure and energy.
cudaStream_t stream[1]
CUDA streams for parallel computing on CPU and GPU.
static void reduce_cabana_energy(Kokkos::View< double **, Kokkos::LayoutRight, Kokkos::HostSpace > const &local_energy, EnergyBinLayout const &layout, Observable_stat &obs, BondedInteractionsMap const &bonded_ias, int n_types)
double calc_central_radial_energy(IA_parameters const &ia_params, double const dist)
bool do_nonbonded(Particle const &p1, Particle const &p2)
Determine if the non-bonded interactions between p1 and p2 should be calculated.
double gb_pair_energy(Utils::Vector3d const &ui, Utils::Vector3d const &uj, IA_parameters const &ia_params, Utils::Vector3d const &d, double dist)
Calculate Gay-Berne energy.
DEVICE_QUALIFIER T lower_triangular(T i, T j)
Linear index into a lower triangular matrix.
ESPRESSO_ATTR_ALWAYS_INLINE KOKKOS_INLINE_FUNCTION bool gay_berne_active(double dist, IA_parameters const &ia_params)
KOKKOS_INLINE_FUNCTION bool thole_active(IA_parameters const &ia_params, bool has_coulomb_kernel)
DEVICE_QUALIFIER bool has_exclusion(std::size_t i) const
PositionViewType position
DEVICE_QUALIFIER Utils::Vector< T, N > get_vector_at(Kokkos::View< T *[N], array_layout, Kokkos::HostSpace > const &view, std::size_t i) const
DirectorViewType director
Solver::ShortRangeEnergyKernel kernel_type
Solver::ShortRangeEnergyKernel kernel_type
ESPRESSO_ATTR_ALWAYS_INLINE KOKKOS_INLINE_FUNCTION std::size_t nb_intra_idx(int t1, int t2) const
EnergyBinLayout(std::size_t n_bonded_, std::size_t n_types_)
KOKKOS_INLINE_FUNCTION std::size_t dipolar_idx() const
KOKKOS_INLINE_FUNCTION std::size_t bonded_idx(int b) const
KOKKOS_INLINE_FUNCTION std::size_t coulomb_idx() const
ESPRESSO_ATTR_ALWAYS_INLINE KOKKOS_INLINE_FUNCTION std::size_t nb_inter_idx(int t1, int t2) const
CellStructure::AoSoA_pack const & aosoa
std::vector< Particle * > const & unique_particles
BondedInteractionsMap const & bonded_ias
Kokkos::View< double **, Kokkos::LayoutRight, memory_space > local_energy
InteractionsNonBonded const & nonbonded_ias
ESPRESSO_ATTR_ALWAYS_INLINE void operator()(std::size_t i, std::size_t j) const
Coulomb::Solver const & coulomb
Dipoles::ShortRangeEnergyKernel::kernel_type const * dipoles_u_kernel
Kokkos::View< int *, Kokkos::LayoutRight, memory_space > mol_id_view
BoxGeometry const & box_geo
Coulomb::ShortRangeEnergyKernel::kernel_type const * coulomb_u_kernel
double system_max_cutoff_sq
EnergyKernel(BondedInteractionsMap const &bonded_ias_, InteractionsNonBonded const &nonbonded_ias_, Coulomb::Solver const &coulomb_, Coulomb::ShortRangeEnergyKernel::kernel_type const *coulomb_u_kernel_, Dipoles::ShortRangeEnergyKernel::kernel_type const *dipoles_u_kernel_, BoxGeometry const &box_geo_, std::vector< Particle * > const &unique_particles_, Kokkos::View< double **, Kokkos::LayoutRight, memory_space > const &local_energy_, EnergyBinLayout layout_, CellStructure::AoSoA_pack const &aosoa_, Kokkos::View< int *, memory_space > mol_id_view_, double system_max_cutoff_)
Kokkos::HostSpace memory_space
Struct holding all information for one particle.
double thole_pair_energy(Particle const &p1, Particle const &p2, IA_parameters const &ia_params, Utils::Vector3d const &d, double dist, BondedInteractionsMap const &bonded_ias, Coulomb::Solver const &coulomb, Coulomb::ShortRangeEnergyKernel::kernel_type const *kernel)
Calculate Thole energy.