Fixed compile error for fix_momentum_kokkos.

This commit is contained in:
Stefan Paquay 2018-10-22 11:24:11 -04:00 committed by Pierre de Buyl
parent 7af38e0862
commit 5139f3af33
1 changed files with 14 additions and 10 deletions

View File

@ -121,12 +121,13 @@ void FixMomentumKokkos<DeviceType>::end_of_step()
auto xflag2 = xflag;
auto yflag2 = yflag;
auto zflag2 = zflag;
const Few<double,3> &vcm_ref = vcm;
Kokkos::parallel_for(nlocal, LAMMPS_LAMBDA(int i) {
if (mask(i) & groupbit2) {
if (xflag2) v(i,0) -= vcm[0];
if (yflag2) v(i,1) -= vcm[1];
if (zflag2) v(i,2) -= vcm[2];
if (xflag2) v(i,0) -= vcm_ref[0];
if (yflag2) v(i,1) -= vcm_ref[1];
if (zflag2) v(i,2) -= vcm_ref[2];
}
});
atomKK->modified(execution_space, V_MASK);
@ -160,6 +161,10 @@ void FixMomentumKokkos<DeviceType>::end_of_step()
auto prd = Few<double,3>(domain->prd);
auto h = Few<double,6>(domain->h);
auto triclinic = domain->triclinic;
const Few<double,3> &xcm_ref = xcm;
const Few<double,3> &omega_ref = omega;
Kokkos::parallel_for(nlocal, LAMMPS_LAMBDA(int i) {
if (mask[i] & groupbit2) {
Few<double,3> x_i;
@ -167,12 +172,12 @@ void FixMomentumKokkos<DeviceType>::end_of_step()
x_i[1] = x(i,1);
x_i[2] = x(i,2);
auto unwrap = DomainKokkos::unmap(prd,h,triclinic,x_i,image(i));
auto dx = unwrap[0] - xcm[0];
auto dy = unwrap[1] - xcm[1];
auto dz = unwrap[2] - xcm[2];
v(i,0) -= omega[1]*dz - omega[2]*dy;
v(i,1) -= omega[2]*dx - omega[0]*dz;
v(i,2) -= omega[0]*dy - omega[1]*dx;
auto dx = unwrap[0] - xcm_ref[0];
auto dy = unwrap[1] - xcm_ref[1];
auto dz = unwrap[2] - xcm_ref[2];
v(i,0) -= omega_ref[1]*dz - omega_ref[2]*dy;
v(i,1) -= omega_ref[2]*dx - omega_ref[0]*dz;
v(i,2) -= omega_ref[0]*dy - omega_ref[1]*dx;
}
});
atomKK->modified(execution_space, V_MASK);
@ -203,4 +208,3 @@ template class FixMomentumKokkos<LMPDeviceType>;
template class FixMomentumKokkos<LMPHostType>;
#endif
}