diff --git a/src/KOKKOS/fix_nh_kokkos.cpp b/src/KOKKOS/fix_nh_kokkos.cpp index ba6e8919ea..fae9ef8f30 100644 --- a/src/KOKKOS/fix_nh_kokkos.cpp +++ b/src/KOKKOS/fix_nh_kokkos.cpp @@ -106,8 +106,8 @@ void FixNHKokkos::setup(int vflag) if (t0 == 0.0) { atomKK->sync(temperature->execution_space,temperature->datamask_read); - atomKK->modified(temperature->execution_space,temperature->datamask_modify); t0 = temperature->compute_scalar(); + atomKK->modified(temperature->execution_space,temperature->datamask_modify); if (t0 == 0.0) { if (strcmp(update->unit_style,"lj") == 0) t0 = 1.0; else t0 = 300.0; @@ -119,8 +119,8 @@ void FixNHKokkos::setup(int vflag) if (pstat_flag) compute_press_target(); atomKK->sync(temperature->execution_space,temperature->datamask_read); - atomKK->modified(temperature->execution_space,temperature->datamask_modify); t_current = temperature->compute_scalar(); + atomKK->modified(temperature->execution_space,temperature->datamask_modify); tdof = temperature->dof; if (pstat_flag) { @@ -250,10 +250,11 @@ void FixNHKokkos::final_integrate() // per-atom values are invalid if reneigh/comm occurred // since temp->compute() in initial_integrate() - if (which == BIAS && neighbor->ago == 0) + if (which == BIAS && neighbor->ago == 0) { atomKK->sync(temperature->execution_space,temperature->datamask_read); - atomKK->modified(temperature->execution_space,temperature->datamask_modify); t_current = temperature->compute_scalar(); + atomKK->modified(temperature->execution_space,temperature->datamask_modify); + } if (pstat_flag) nh_v_press(); @@ -261,8 +262,8 @@ void FixNHKokkos::final_integrate() // compute appropriately coupled elements of mvv_current atomKK->sync(temperature->execution_space,temperature->datamask_read); - atomKK->modified(temperature->execution_space,temperature->datamask_modify); t_current = temperature->compute_scalar(); + atomKK->modified(temperature->execution_space,temperature->datamask_modify); tdof = temperature->dof; if (pstat_flag) { @@ -476,8 +477,6 @@ void FixNHKokkos::remap() template void FixNHKokkos::nh_v_press() { - atomKK->sync(execution_space,V_MASK | MASK_MASK); - v = atomKK->k_v.view(); mask = atomKK->k_mask.view(); int nlocal = atomKK->nlocal; @@ -493,6 +492,8 @@ void FixNHKokkos::nh_v_press() atomKK->modified(temperature->execution_space,temperature->datamask_modify); } + atomKK->sync(execution_space,V_MASK | MASK_MASK); + copymode = 1; if (pstyle == TRICLINIC) Kokkos::parallel_for(Kokkos::RangePolicy >(0,nlocal),*this); @@ -536,7 +537,6 @@ template void FixNHKokkos::nve_v() { atomKK->sync(execution_space,X_MASK | V_MASK | F_MASK | MASK_MASK | RMASS_MASK | TYPE_MASK); - atomKK->modified(execution_space,V_MASK); v = atomKK->k_v.view(); f = atomKK->k_f.view(); @@ -553,6 +553,8 @@ void FixNHKokkos::nve_v() else Kokkos::parallel_for(Kokkos::RangePolicy >(0,nlocal),*this); copymode = 0; + + atomKK->modified(execution_space,V_MASK); } template @@ -616,8 +618,6 @@ void FixNHKokkos::operator()(TagFixNH_nve_x, const int &i) const { template void FixNHKokkos::nh_v_temp() { - atomKK->sync(execution_space,V_MASK | MASK_MASK); - v = atomKK->k_v.view(); mask = atomKK->k_mask.view(); int nlocal = atomKK->nlocal; @@ -629,6 +629,8 @@ void FixNHKokkos::nh_v_temp() atomKK->modified(temperature->execution_space,temperature->datamask_modify); } + atomKK->sync(execution_space,V_MASK | MASK_MASK); + copymode = 1; Kokkos::parallel_for(Kokkos::RangePolicy(0,nlocal),*this); copymode = 0;