diff --git a/src/force_types/force_lj_neigh.h b/src/force_types/force_lj_neigh.h index 5737421..f144bf8 100644 --- a/src/force_types/force_lj_neigh.h +++ b/src/force_types/force_lj_neigh.h @@ -69,6 +69,7 @@ class ForceLJNeigh: public Force { t_x_const_rnd x; t_f f; t_f_atomic f_a; + t_f_duplicated f_r; t_id id; t_type_const_rnd type; Binning::t_bincount bin_count; diff --git a/src/force_types/force_lj_neigh_impl.h b/src/force_types/force_lj_neigh_impl.h index e6789c2..af2b060 100644 --- a/src/force_types/force_lj_neigh_impl.h +++ b/src/force_types/force_lj_neigh_impl.h @@ -106,7 +106,8 @@ void ForceLJNeigh::compute(System* system, Binning* binning, Neig N_local = system->N_local; x = system->x; f = system->f; - f_a = system->f; + //f_a = system->f; + f_r = Kokkos::Experimental::create_scatter_view<>(system->f); type = system->type; id = system->id; if (use_stackparams) { @@ -122,6 +123,11 @@ void ForceLJNeigh::compute(System* system, Binning* binning, Neig } Kokkos::fence(); + if(half_neigh) { + Kokkos::Experimental::contribute(system->f, f_r); + f_r = decltype(f_r)(); + } + step++; } @@ -133,8 +139,6 @@ T_V_FLOAT ForceLJNeigh::compute_energy(System* system, Binning* b N_local = system->N_local; x = system->x; - f = system->f; - f_a = system->f; type = system->type; id = system->id; T_V_FLOAT energy; @@ -209,6 +213,8 @@ template template KOKKOS_INLINE_FUNCTION void ForceLJNeigh::operator() (TagHalfNeigh, const T_INT& i) const { + auto f_a = f_r.access(); + const T_F_FLOAT x_i = x(i,0); const T_F_FLOAT y_i = x(i,1); const T_F_FLOAT z_i = x(i,2); diff --git a/src/types.h b/src/types.h index 1583e18..f6262fc 100644 --- a/src/types.h +++ b/src/types.h @@ -39,6 +39,7 @@ #ifndef TYPES_H #define TYPES_H #include +#include // Module Types etc // Units to be used @@ -98,6 +99,7 @@ typedef Kokkos::View> #endif t_f_atomic; // Force +typedef Kokkos::Experimental::ScatterView t_f_duplicated; // Force typedef Kokkos::View t_f_const; // Force typedef Kokkos::View t_type; // Type (int is enough as type)