diff --git a/src/KOKKOS/fix_reaxc_species_kokkos.cpp b/src/KOKKOS/fix_reaxc_species_kokkos.cpp index ce84de30cb2eaf83cf8230e916f82ef19754de33..8b778ecf650e582b53dd757e460e0e937e115f34 100644 --- a/src/KOKKOS/fix_reaxc_species_kokkos.cpp +++ b/src/KOKKOS/fix_reaxc_species_kokkos.cpp @@ -48,7 +48,7 @@ FixReaxCSpeciesKokkos::FixReaxCSpeciesKokkos(LAMMPS *lmp, int narg, char **arg) { kokkosable = 1; atomKK = (AtomKokkos *) atom; - + // NOTE: Could improve performance if a Kokkos version of ComputeSpecAtom is added datamask_read = X_MASK | V_MASK | Q_MASK | MASK_MASK; @@ -116,35 +116,30 @@ void FixReaxCSpeciesKokkos::FindMolecule() done = 1; for (ii = 0; ii < inum; ii++) { - i = ilist[ii]; - if (!(mask[i] & groupbit)) continue; + i = ilist[ii]; + if (!(mask[i] & groupbit)) continue; - itype = atom->type[i]; + itype = atom->type[i]; for (jj = 0; jj < MAXSPECBOND; jj++) { - j = reaxc->tmpid[i][jj]; + j = reaxc->tmpid[i][jj]; - if (j < i) continue; - if (!(mask[j] & groupbit)) continue; + if ((j == 0) && (j < i)) continue; + if (!(mask[j] & groupbit)) continue; - if (clusterID[i] == clusterID[j] && PBCconnected[i] == PBCconnected[j] - && x0[i].x == x0[j].x && x0[i].y == x0[j].y && x0[i].z == x0[j].z) continue; + if (clusterID[i] == clusterID[j] + && x0[i].x == x0[j].x && x0[i].y == x0[j].y && x0[i].z == x0[j].z) continue; jtype = atom->type[j]; - bo_cut = BOCut[itype][jtype]; - bo_tmp = spec_atom[i][jj+7]; + bo_cut = BOCut[itype][jtype]; + bo_tmp = spec_atom[i][jj+7]; - if (bo_tmp > bo_cut) { + if (bo_tmp > bo_cut) { clusterID[i] = clusterID[j] = MIN(clusterID[i], clusterID[j]); - PBCconnected[i] = PBCconnected[j] = MAX(PBCconnected[i], PBCconnected[j]); x0[i] = x0[j] = chAnchor(x0[i], x0[j]); - if ((fabs(spec_atom[i][1] - spec_atom[j][1]) > reaxc->control->bond_cut) - || (fabs(spec_atom[i][2] - spec_atom[j][2]) > reaxc->control->bond_cut) - || (fabs(spec_atom[i][3] - spec_atom[j][3]) > reaxc->control->bond_cut)) - PBCconnected[i] = PBCconnected[j] = 1; - done = 0; - } - } + done = 0; + } + } } if (!done) change = 1; if (done) break; diff --git a/src/USER-REAXC/fix_reaxc_species.cpp b/src/USER-REAXC/fix_reaxc_species.cpp index 23a37455e82ae5587ad6da4f43476a84aaf14b84..df28a34fe884bbe28a02f5c6058cccf53e521fbf 100644 --- a/src/USER-REAXC/fix_reaxc_species.cpp +++ b/src/USER-REAXC/fix_reaxc_species.cpp @@ -68,7 +68,7 @@ FixReaxCSpecies::FixReaxCSpecies(LAMMPS *lmp, int narg, char **arg) : nrepeat = atoi(arg[4]); global_freq = nfreq = atoi(arg[5]); - comm_forward = 5; + comm_forward = 4; if (nevery <= 0 || nrepeat <= 0 || nfreq <= 0) error->all(FLERR,"Illegal fix reax/c/species command"); @@ -133,12 +133,10 @@ FixReaxCSpecies::FixReaxCSpecies(LAMMPS *lmp, int narg, char **arg) : } x0 = NULL; - PBCconnected = NULL; clusterID = NULL; int ntmp = 1; memory->create(x0,ntmp,"reax/c/species:x0"); - memory->create(PBCconnected,ntmp,"reax/c/species:PBCconnected"); memory->create(clusterID,ntmp,"reax/c/species:clusterID"); vector_atom = clusterID; @@ -251,7 +249,6 @@ FixReaxCSpecies::~FixReaxCSpecies() memory->destroy(ele); memory->destroy(BOCut); memory->destroy(clusterID); - memory->destroy(PBCconnected); memory->destroy(x0); memory->destroy(nd); @@ -458,16 +455,13 @@ void FixReaxCSpecies::Output_ReaxC_Bonds(bigint ntimestep, FILE *fp) if (atom->nmax > nmax) { nmax = atom->nmax; memory->destroy(x0); - memory->destroy(PBCconnected); memory->destroy(clusterID); memory->create(x0,nmax,"reax/c/species:x0"); - memory->create(PBCconnected,nmax,"reax/c/species:PBCconnected"); memory->create(clusterID,nmax,"reax/c/species:clusterID"); vector_atom = clusterID; } for (int i = 0; i < nmax; i++) { - PBCconnected[i] = 0; x0[i].x = x0[i].y = x0[i].z = 0.0; } @@ -559,7 +553,6 @@ void FixReaxCSpecies::FindMolecule () if (!(mask[j] & groupbit)) continue; if (clusterID[i] == clusterID[j] - && PBCconnected[i] == PBCconnected[j] && x0[i].x == x0[j].x && x0[i].y == x0[j].y && x0[i].z == x0[j].z) continue; @@ -570,21 +563,7 @@ void FixReaxCSpecies::FindMolecule () if (bo_tmp > bo_cut) { clusterID[i] = clusterID[j] = MIN(clusterID[i], clusterID[j]); - PBCconnected[i] = PBCconnected[j] = MAX(PBCconnected[i], PBCconnected[j]); x0[i] = x0[j] = chAnchor(x0[i], x0[j]); - // spec_atom[][] contains filtered coordinates only for local atoms, - // so we have to use unfiltered ones for ghost atoms. - if (j < nlocal) { - if ((fabs(spec_atom[i][1] - spec_atom[j][1]) > reaxc->control->bond_cut) - || (fabs(spec_atom[i][2] - spec_atom[j][2]) > reaxc->control->bond_cut) - || (fabs(spec_atom[i][3] - spec_atom[j][3]) > reaxc->control->bond_cut)) - PBCconnected[i] = PBCconnected[j] = 1; - } else { - if ((fabs(spec_atom[i][1] - x[j][1]) > reaxc->control->bond_cut) - || (fabs(spec_atom[i][2] - x[j][2]) > reaxc->control->bond_cut) - || (fabs(spec_atom[i][3] - x[j][3]) > reaxc->control->bond_cut)) - PBCconnected[i] = PBCconnected[j] = 1; - } done = 0; } } @@ -878,20 +857,18 @@ void FixReaxCSpecies::WritePos(int Nmole, int Nspec) Name[itype] ++; count ++; avq += spec_atom[i][0]; - if (PBCconnected[i]) { - if ((x0[i].x - spec_atom[i][1]) > halfbox[0]) - spec_atom[i][1] += box[0]; - if ((spec_atom[i][1] - x0[i].x) > halfbox[0]) - spec_atom[i][1] -= box[0]; - if ((x0[i].y - spec_atom[i][2]) > halfbox[1]) - spec_atom[i][2] += box[1]; - if ((spec_atom[i][2] - x0[i].y) > halfbox[1]) - spec_atom[i][2] -= box[1]; - if ((x0[i].z - spec_atom[i][3]) > halfbox[2]) - spec_atom[i][3] += box[2]; - if ((spec_atom[i][3] - x0[i].z) > halfbox[2]) - spec_atom[i][3] -= box[2]; - } + if ((x0[i].x - spec_atom[i][1]) > halfbox[0]) + spec_atom[i][1] += box[0]; + if ((spec_atom[i][1] - x0[i].x) > halfbox[0]) + spec_atom[i][1] -= box[0]; + if ((x0[i].y - spec_atom[i][2]) > halfbox[1]) + spec_atom[i][2] += box[1]; + if ((spec_atom[i][2] - x0[i].y) > halfbox[1]) + spec_atom[i][2] -= box[1]; + if ((x0[i].z - spec_atom[i][3]) > halfbox[2]) + spec_atom[i][3] += box[2]; + if ((spec_atom[i][3] - x0[i].z) > halfbox[2]) + spec_atom[i][3] -= box[2]; for (n = 0; n < 3; n++) avx[n] += spec_atom[i][n+1]; } @@ -977,11 +954,10 @@ int FixReaxCSpecies::pack_forward_comm(int n, int *list, double *buf, for (i = 0; i < n; i++) { j = list[i]; buf[m] = clusterID[j]; - buf[m+1] = (double)PBCconnected[j]; - buf[m+2] = x0[j].x; - buf[m+3] = x0[j].y; - buf[m+4] = x0[j].z; - m += 5; + buf[m+1] = x0[j].x; + buf[m+2] = x0[j].y; + buf[m+3] = x0[j].z; + m += 4; } return m; } @@ -996,11 +972,10 @@ void FixReaxCSpecies::unpack_forward_comm(int n, int first, double *buf) last = first + n; for (i = first; i < last; i++) { clusterID[i] = buf[m]; - PBCconnected[i] = (int)buf[m+1]; - x0[i].x = buf[m+2]; - x0[i].y = buf[m+3]; - x0[i].z = buf[m+4]; - m += 5; + x0[i].x = buf[m+1]; + x0[i].y = buf[m+2]; + x0[i].z = buf[m+3]; + m += 4; } } @@ -1010,7 +985,7 @@ double FixReaxCSpecies::memory_usage() { double bytes; - bytes = 5*nmax*sizeof(double); // clusterID + PBCconnected + x0 + bytes = 4*nmax*sizeof(double); // clusterID + x0 return bytes; } diff --git a/src/USER-REAXC/fix_reaxc_species.h b/src/USER-REAXC/fix_reaxc_species.h index 563a10f39db3913a49abbf97cb28b63975b64d51..23a470fd0ac63a37862bd032d51e953c261db3f9 100644 --- a/src/USER-REAXC/fix_reaxc_species.h +++ b/src/USER-REAXC/fix_reaxc_species.h @@ -52,7 +52,6 @@ class FixReaxCSpecies : public Fix { int Nmoltype, vector_nmole, vector_nspec; int *Name, *MolName, *NMol, *nd, *MolType, *molmap; double *clusterID; - int *PBCconnected; AtomCoord *x0; double bg_cut;