diff --git a/src/KOKKOS/mliap_data_kokkos.cpp b/src/KOKKOS/mliap_data_kokkos.cpp index e5b34ecaa0..dc8fe7dd83 100644 --- a/src/KOKKOS/mliap_data_kokkos.cpp +++ b/src/KOKKOS/mliap_data_kokkos.cpp @@ -72,7 +72,6 @@ void MLIAPDataKokkos::generate_neighdata(class NeighList *list_in, i list = list_in; // grow nmax gradforce array if necessary - if (atom->nmax > nmax) { nmax = atom->nmax; if (gradgradflag > -1){ @@ -149,13 +148,13 @@ void MLIAPDataKokkos::generate_neighdata(class NeighList *list_in, i auto type = atomKK->k_type.view(); auto map=k_pairmliap->k_map.template view(); - Kokkos::parallel_scan(nlistatoms, KOKKOS_LAMBDA (int ii, int &update, const bool final) { + Kokkos::parallel_scan(natomneigh, KOKKOS_LAMBDA (int ii, int &update, const bool final) { if (final) d_ij(ii) = update; update += d_numneighs(ii); }); - Kokkos::parallel_for(nlistatoms, KOKKOS_LAMBDA (int ii) { + Kokkos::parallel_for(natomneigh, KOKKOS_LAMBDA (int ii) { int ij = d_ij(ii); const int i = d_ilist[ii]; const double xtmp = x(i, 0); @@ -186,10 +185,12 @@ void MLIAPDataKokkos::generate_neighdata(class NeighList *list_in, i d_iatoms[ii] = i; d_ielems[ii] = ielem; }); + Kokkos::parallel_for(nmax, KOKKOS_LAMBDA (int i) { const int itype = type(i); d_elems(i) = map(itype); }); + modified(execution_space, NUMNEIGHS_MASK | IATOMS_MASK | IELEMS_MASK | ELEMS_MASK | JATOMS_MASK | PAIR_I_MASK | JELEMS_MASK | RIJ_MASK | IJ_MASK ); eflag = eflag_in; vflag = vflag_in; @@ -203,9 +204,10 @@ void MLIAPDataKokkos::grow_neigharrays() { f = atom->f; f_device = atomKK->k_f.view().data(); // grow neighbor arrays if necessary - - if (natomneigh_max < nlistatoms) { - natomneigh_max = nlistatoms; + natomneigh = list->inum; + if (list->ghost == 1) natomneigh += list->gnum; + if (natomneigh_max < natomneigh) { + natomneigh_max = natomneigh; memoryKK->destroy_kokkos(k_iatoms,iatoms); memoryKK->create_kokkos(k_iatoms, iatoms, natomneigh_max, "mliap_data:iatoms"); @@ -227,7 +229,7 @@ void MLIAPDataKokkos::grow_neigharrays() { auto d_cutsq=k_pairmliap->k_cutsq.template view(); auto h_cutsq=k_pairmliap->k_cutsq.template view(); auto d_numneighs = k_numneighs.template view(); - Kokkos::parallel_reduce(nlistatoms, KOKKOS_LAMBDA (int ii, int &contrib) { + Kokkos::parallel_reduce(natomneigh, KOKKOS_LAMBDA (int ii, int &contrib) { const int i = d_ilist[ii]; int count=0; const double xtmp = x(i, 0);