Need s ghosts

This commit is contained in:
Stan Gerald Moore
2022-04-04 13:05:10 -06:00
parent 776dc34411
commit 3e01bc48d4
2 changed files with 32 additions and 39 deletions

View File

@ -1376,16 +1376,15 @@ int FixACKS2ReaxFFKokkos<DeviceType>::bicgstab_solve()
template<class DeviceType>
void FixACKS2ReaxFFKokkos<DeviceType>::calculate_Q()
{
Kokkos::parallel_for(Kokkos::RangePolicy<DeviceType,TagACKS2CalculateQ>(0,nn),*this);
pack_flag = 4;
//comm->forward_comm( this ); //Dist_vector( q );
atomKK->k_q.modify<DeviceType>();
atomKK->k_q.sync<LMPHostType>();
pack_flag = 2;
//comm->forward_comm( this ); //Dist_vector( s );
k_s.modify<DeviceType>();
k_s.sync<LMPHostType>();
comm->forward_comm(this);
atomKK->k_q.modify<LMPHostType>();
atomKK->k_q.sync<DeviceType>();
k_s.modify<LMPHostType>();
k_s.sync<DeviceType>();
Kokkos::parallel_for(Kokkos::RangePolicy<DeviceType,TagACKS2CalculateQ>(0,NN),*this);
}
/* ---------------------------------------------------------------------- */
@ -1818,24 +1817,25 @@ void FixACKS2ReaxFFKokkos<DeviceType>::operator() (TagACKS2Norm3, const int &ii,
template<class DeviceType>
KOKKOS_INLINE_FUNCTION
void FixACKS2ReaxFFKokkos<DeviceType>::operator() (TagACKS2CalculateQ, const int &ii) const
void FixACKS2ReaxFFKokkos<DeviceType>::operator() (TagACKS2CalculateQ, const int &i) const
{
const int i = d_ilist[ii];
if (mask[i] & groupbit) {
q(i) = d_s(i);
/* backup s */
for (int k = nprev-1; k > 0; --k) {
d_s_hist(i,k) = d_s_hist(i,k-1);
d_s_hist_X(i,k) = d_s_hist_X(i,k-1);
if (i < nlocal) {
/* backup s */
for (int k = nprev-1; k > 0; --k) {
d_s_hist(i,k) = d_s_hist(i,k-1);
d_s_hist_X(i,k) = d_s_hist_X(i,k-1);
}
d_s_hist(i,0) = d_s[i];
d_s_hist_X(i,0) = d_s[NN+i];
}
d_s_hist(i,0) = d_s[i];
d_s_hist_X(i,0) = d_s[NN+i];
}
// last two rows
if (last_rows_flag && ii == 0) {
if (last_rows_flag && i == 0) {
for (int i = 0; i < 2; ++i) {
for (int k = nprev-1; k > 0; --k)
d_s_hist_last(i,k) = d_s_hist_last(i,k-1);

View File

@ -306,7 +306,7 @@ void FixACKS2ReaxFF::init_storage()
{
if (efield) get_chi_field();
for (int ii = 0; ii < nn; ii++) {
for (int ii = 0; ii < NN; ii++) {
int i = ilist[ii];
if (atom->mask[i] & groupbit) {
b_s[i] = -chi[atom->type[i]];
@ -673,19 +673,24 @@ void FixACKS2ReaxFF::calculate_Q()
{
int i, k;
for (int ii = 0; ii < nn; ++ii) {
i = ilist[ii];
pack_flag = 2;
comm->forward_comm(this); //Dist_vector(s);
for (int i = 0; i < NN; ++i) {
if (atom->mask[i] & groupbit) {
atom->q[i] = s[i];
/* backup s */
for (k = nprev-1; k > 0; --k) {
s_hist[i][k] = s_hist[i][k-1];
s_hist_X[i][k] = s_hist_X[i][k-1];
if (i < atom->nlocal) {
/* backup s */
for (k = nprev-1; k > 0; --k) {
s_hist[i][k] = s_hist[i][k-1];
s_hist_X[i][k] = s_hist_X[i][k-1];
}
s_hist[i][0] = s[i];
s_hist_X[i][0] = s[NN+i];
}
s_hist[i][0] = s[i];
s_hist_X[i][0] = s[NN+i];
}
}
// last two rows
@ -696,9 +701,6 @@ void FixACKS2ReaxFF::calculate_Q()
s_hist_last[i][0] = s[2*NN+i];
}
}
pack_flag = 4;
comm->forward_comm(this); //Dist_vector(q);
}
/* ---------------------------------------------------------------------- */
@ -726,11 +728,6 @@ int FixACKS2ReaxFF::pack_forward_comm(int n, int *list, double *buf,
buf[m++] = q_hat[j];
buf[m++] = q_hat[NN+j];
}
} else if (pack_flag == 4) {
for(int i = 0; i < n; i++) {
int j = list[i];
buf[m++] = atom->q[j];
}
}
return m;
}
@ -759,10 +756,6 @@ void FixACKS2ReaxFF::unpack_forward_comm(int n, int first, double *buf)
q_hat[i] = buf[m++];
q_hat[NN+i] = buf[m++];
}
} else if (pack_flag == 4) {
for(i = first; i < last; i++) {
atom->q[i] = buf[m++];
}
}
}