24#ifdef ESPRESSO_SHARED_MEMORY_PARALLELISM
31#include <Cabana_Core.hpp>
41#if defined(__GNUG__) or defined(__clang__)
42#define ESPRESSO_ATTR_ALWAYS_INLINE [[gnu::always_inline]]
44#define ESPRESSO_ATTR_ALWAYS_INLINE
58#ifdef ESPRESSO_ROTATION
79 std::vector<Particle *>
const &unique_particles_,
81#ifdef ESPRESSO_ROTATION
94#ifdef ESPRESSO_ROTATION
103 if (
auto &solver = coulomb_.
impl->solver; solver.has_value()) {
104 if (std::holds_alternative<std::shared_ptr<CoulombP3M>>(*solver)) {
105 p3m = std::get<std::shared_ptr<CoulombP3M>>(*solver).get();
114#ifdef ESPRESSO_GAY_BERNE
135#ifdef ESPRESSO_DIPOLES
145 auto const &ia_params =
154 auto const dist = d.norm();
157#if defined(ESPRESSO_DIPOLES) or defined(ESPRESSO_GAY_BERNE)
158 bool const need_directors =
161#if defined(ESPRESSO_EXCLUSIONS) or defined(ESPRESSO_THOLE)
167 if (need_particle_pointers) {
174#if defined(ESPRESSO_GAY_BERNE) or defined(ESPRESSO_DIPOLES)
176 if (need_directors) {
186 if (dist < ia_params.max_cut) {
187#ifdef ESPRESSO_EXCLUSIONS
188 bool skip_non_bonded =
false;
193 constexpr bool skip_non_bonded =
false;
195 if (not skip_non_bonded) {
206#ifdef ESPRESSO_GAY_BERNE
222 virial = hadamard_product(pf.f, d);
233 auto const dist2 = dist * dist;
243#ifdef ESPRESSO_ELECTROSTATICS
251 if (
p3m) [[likely]] {
256 pf.f += (*coulomb_kernel)(q1q2, d, dist);
259 (*elc_kernel)(pos1, pos2, f1_asym, f2_asym, q1q2);
263 virial[0] += (*coulomb_u_kernel)(pos1, pos2, q1q2, d, dist);
271#ifdef ESPRESSO_DIPOLES
275 pf += (*dipoles_kernel)(d1d2,
aosoa.
dipm(i) * dir1,
276 aosoa.
dipm(j) * dir2, d, dist, dist * dist);
282#ifdef ESPRESSO_ELECTROSTATICS
287 auto const thread_id = omp_get_thread_num();
292#ifdef ESPRESSO_ROTATION
301#ifdef ESPRESSO_ROTATION
Vector implementation and trait types for boost qvm interoperability.
container for bonded interactions.
ESPRESSO_ATTR_ALWAYS_INLINE Utils::Vector< T, 3 > get_mi_vector(const Utils::Vector< T, 3 > &a, const Utils::Vector< T, 3 > &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.
std::shared_ptr< DPDThermostat > dpd
int thermo_switch
Bitmask of currently active thermostats.
Utils::Vector3d dpd_pair_force(Utils::Vector3d const &p1_position, Utils::Vector3d const &p1_velocity, int const &p1_id, Utils::Vector3d const &p2_position, Utils::Vector3d const &p2_velocity, int const &p2_id, DPDThermostat const &dpd, BoxGeometry const &box_geo, IA_parameters const &ia_params, Utils::Vector3d const &d, double dist, double dist2)
bool do_nonbonded(Particle const &p1, Particle const &p2)
Determine if the non-bonded interactions between p1 and p2 should be calculated.
#define ESPRESSO_ATTR_ALWAYS_INLINE
ParticleForce calc_opposing_force(ParticleForce const &pf, Utils::Vector3d const &d)
ESPRESSO_ATTR_ALWAYS_INLINE Utils::Vector3d calc_central_radial_force(IA_parameters const &ia_params, Utils::Vector3d const &d, double const dist)
ParticleForce gb_pair_force(Utils::Vector3d const &ui, Utils::Vector3d const &uj, IA_parameters const &ia_params, Utils::Vector3d const &d, double dist)
Calculate Gay-Berne force and torques.
Utils::Vector3d get_vector_at(Kokkos::View< double *[3], array_layout, Kokkos::HostSpace > const &view, std::size_t i) const
bool has_exclusion(std::size_t i) const
PositionViewType position
DirectorViewType director
VelocityViewType velocity
Utils::Vector3d pair_force(double q1q2, Utils::Vector3d const &d, double dist) const
Calculate real-space contribution of p3m Coulomb pair forces.
Solver::ShortRangeEnergyKernel kernel_type
Solver::ShortRangeForceCorrectionsKernel kernel_type
Solver::ShortRangeForceKernel kernel_type
std::unique_ptr< Implementation > impl
Pointer-to-implementation.
Solver::ShortRangeForceKernel kernel_type
ESPRESSO_ATTR_ALWAYS_INLINE KOKKOS_INLINE_FUNCTION bool thole_active(IA_parameters const &ia_params) const
std::vector< Particle * > const & unique_particles
ESPRESSO_ATTR_ALWAYS_INLINE KOKKOS_INLINE_FUNCTION bool gay_berne_active(double dist, IA_parameters const &ia_params) const
Coulomb::ShortRangeEnergyKernel::kernel_type const *const coulomb_u_kernel
Coulomb::ShortRangeForceCorrectionsKernel::kernel_type const * elc_kernel
ESPRESSO_ATTR_ALWAYS_INLINE KOKKOS_INLINE_FUNCTION bool npt_active() const
BoxGeometry const & box_geo
CellStructure::VirialType const & local_virial
ESPRESSO_ATTR_ALWAYS_INLINE KOKKOS_INLINE_FUNCTION bool dipoles_active() const
Dipoles::ShortRangeForceKernel::kernel_type const *const dipoles_kernel
CellStructure::AoSoA_pack const & aosoa
CellStructure::ForceType const & local_torque
ForcesKernel(BondedInteractionsMap const &bonded_ias_, InteractionsNonBonded const &nonbonded_ias_, Coulomb::ShortRangeForceKernel::kernel_type const *coulomb_kernel_, Dipoles::ShortRangeForceKernel::kernel_type const *dipoles_kernel_, Coulomb::ShortRangeForceCorrectionsKernel::kernel_type const *elc_kernel_, Coulomb::ShortRangeEnergyKernel::kernel_type const *coulomb_u_kernel_, Coulomb::Solver const &coulomb_, Thermostat::Thermostat const &thermostat_, BoxGeometry const &box_geo_, std::vector< Particle * > const &unique_particles_, CellStructure::ForceType const &local_force_, CellStructure::ForceType const &local_torque_, Utils::Vector3d *const global_virial_, CellStructure::VirialType const &local_virial_, CellStructure::AoSoA_pack const &aosoa_)
InteractionsNonBonded const & nonbonded_ias
Utils::Vector3d *const global_virial
ESPRESSO_ATTR_ALWAYS_INLINE KOKKOS_INLINE_FUNCTION void operator()(std::size_t i, std::size_t j) const
BondedInteractionsMap const & bonded_ias
CellStructure::ForceType const & local_force
Coulomb::ShortRangeForceKernel::kernel_type const *const coulomb_kernel
Thermostat::Thermostat const & thermostat
Parameters for non-bonded interactions.
GayBerne_Parameters gay_berne
Force information on a particle.
Struct holding all information for one particle.
Utils::Vector3d thole_pair_force(Particle const &p1, Particle const &p2, IA_parameters const &ia_params, Utils::Vector3d const &d, double dist, BondedInteractionsMap const &bonded_ias, Coulomb::ShortRangeForceKernel::kernel_type const *kernel)
Calculate Thole force.