git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@9380 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp
2013-02-01 16:52:14 +00:00
parent 9b7bd3e892
commit 69a209f09d
5 changed files with 72 additions and 12 deletions

View File

@ -219,8 +219,9 @@ void AtomVecBody::copy(int i, int j, int delflag)
}
// if atom I has bonus data, reset I's bonus.ilocal to loc J
// do NOT do this if self-copy (I=J) since I's bonus data is already deleted
if (body[i] >= 0) bonus[body[i]].ilocal = j;
if (body[i] >= 0 && i != j) bonus[body[i]].ilocal = j;
body[j] = body[i];
if (atom->nextra_grow)
@ -230,13 +231,13 @@ void AtomVecBody::copy(int i, int j, int delflag)
/* ----------------------------------------------------------------------
copy bonus data from I to J, effectively deleting the J entry
insure index pointers between per-atom and bonus data are updated
also reset body that points to I to now point to J
------------------------------------------------------------------------- */
void AtomVecBody::copy_bonus(int i, int j)
{
body[bonus[i].ilocal] = j;
memcpy(&bonus[j],&bonus[i],sizeof(Bonus));
body[bonus[j].ilocal] = j;
}
/* ----------------------------------------------------------------------
@ -1407,3 +1408,52 @@ bigint AtomVecBody::memory_usage()
return bytes;
}
/* ----------------------------------------------------------------------
debug method for sanity checking of own/bonus data pointers
------------------------------------------------------------------------- */
/*
void AtomVecBody::check(int flag)
{
for (int i = 0; i < atom->nlocal; i++) {
if (atom->body[i] >= 0 && atom->body[i] >= nlocal_bonus) {
printf("Proc %d, step %ld, flag %d\n",comm->me,update->ntimestep,flag);
error->one(FLERR,"BAD AAA");
}
}
for (int i = atom->nlocal; i < atom->nlocal+atom->nghost; i++) {
if (atom->body[i] >= 0 &&
(atom->body[i] < nlocal_bonus ||
atom->body[i] >= nlocal_bonus+nghost_bonus)) {
printf("Proc %d, step %ld, flag %d\n",comm->me,update->ntimestep,flag);
error->one(FLERR,"BAD BBB");
}
}
for (int i = 0; i < nlocal_bonus; i++) {
if (bonus[i].ilocal < 0 || bonus[i].ilocal >= atom->nlocal) {
printf("Proc %d, step %ld, flag %d\n",comm->me,update->ntimestep,flag);
error->one(FLERR,"BAD CCC");
}
}
for (int i = 0; i < nlocal_bonus; i++) {
if (atom->body[bonus[i].ilocal] != i) {
printf("Proc %d, step %ld, flag %d\n",comm->me,update->ntimestep,flag);
error->one(FLERR,"BAD DDD");
}
}
for (int i = nlocal_bonus; i < nlocal_bonus+nghost_bonus; i++) {
if (bonus[i].ilocal < atom->nlocal ||
bonus[i].ilocal >= atom->nlocal+atom->nghost) {
printf("Proc %d, step %ld, flag %d\n",comm->me,update->ntimestep,flag);
error->one(FLERR,"BAD EEE");
}
}
for (int i = nlocal_bonus; i < nlocal_bonus+nghost_bonus; i++) {
if (atom->body[bonus[i].ilocal] != i) {
printf("Proc %d, step %ld, flag %d\n",comm->me,update->ntimestep,flag);
error->one(FLERR,"BAD FFF");
}
}
}
*/