diff --git a/src/KOKKOS/fix_viscous_kokkos.cpp b/src/KOKKOS/fix_viscous_kokkos.cpp index 7d3d5f042a..6fb2bd9d6a 100644 --- a/src/KOKKOS/fix_viscous_kokkos.cpp +++ b/src/KOKKOS/fix_viscous_kokkos.cpp @@ -61,8 +61,12 @@ void FixViscousKokkos::init() k_gamma = Kokkos::DualView("FixViscousKokkos:gamma",atom->ntypes+1); + gamma2 = k_gamma.template view(); + for (int i = 1; i <= atom->ntypes; i++) k_gamma.h_view(i) = gamma[i]; + k_gamma.template sync(); + if (utils::strmatch(update->integrate_style,"^respa")) error->all(FLERR,"Cannot (yet) use respa with Kokkos"); } @@ -93,7 +97,7 @@ template KOKKOS_INLINE_FUNCTION void FixViscousKokkos::operator()(TagFixViscous, const int &i) const { if (mask[i] & groupbit) { - double drag = k_gamma.h_view(type[i]); + double drag = gamma2(type[i]); f(i,0) -= drag*v(i,0); f(i,1) -= drag*v(i,1); f(i,2) -= drag*v(i,2); diff --git a/src/KOKKOS/fix_viscous_kokkos.h b/src/KOKKOS/fix_viscous_kokkos.h index 904e3bd6c4..0498b3ab77 100644 --- a/src/KOKKOS/fix_viscous_kokkos.h +++ b/src/KOKKOS/fix_viscous_kokkos.h @@ -54,6 +54,7 @@ class FixViscousKokkos : public FixViscous { typename AT::t_int_1d_randomread type; Kokkos::DualView k_gamma; + typename Kokkos::DualView::t_dev_const_um gamma2; }; }