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

This commit is contained in:
sjplimp 2015-03-31 14:53:37 +00:00
parent 3624222273
commit c7712213bc
2 changed files with 78 additions and 0 deletions

View File

@ -2297,6 +2297,16 @@ void FixRigid::grow_arrays(int nmax)
if (orientflag) memory->grow(orient,nmax,orientflag,"rigid:orient");
if (dorientflag) memory->grow(dorient,nmax,3,"rigid:dorient");
}
// check for regrow of vatom
// must be done whether per-atom virial is accumulated on this step or not
// b/c this is only time grow_array() may be called
// need to regrow b/c vatom is calculated before and after atom migration
if (nmax > maxvatom) {
maxvatom = atom->nmax;
memory->grow(vatom,maxvatom,6,"fix:vatom");
}
}
/* ----------------------------------------------------------------------
@ -2320,6 +2330,13 @@ void FixRigid::copy_arrays(int i, int j, int delflag)
dorient[j][2] = dorient[i][2];
}
}
// must also copy vatom if per-atom virial calculated on this timestep
// since vatom is calculated before and after atom migration
if (vflag_atom)
for (int k = 0; k < 6; k++)
vatom[j][k] = vatom[i][k];
}
/* ----------------------------------------------------------------------
@ -2333,6 +2350,13 @@ void FixRigid::set_arrays(int i)
displace[i][0] = 0.0;
displace[i][1] = 0.0;
displace[i][2] = 0.0;
// must also zero vatom if per-atom virial calculated on this timestep
// since vatom is calculated before and after atom migration
if (vflag_atom)
for (int k = 0; k < 6; k++)
vatom[i][k] = 0.0;
}
/* ----------------------------------------------------------------------
@ -2357,6 +2381,14 @@ int FixRigid::pack_exchange(int i, double *buf)
buf[m++] = dorient[i][1];
buf[m++] = dorient[i][2];
}
// must also pack vatom if per-atom virial calculated on this timestep
// since vatom is calculated before and after atom migration
if (vflag_atom)
for (int k = 0; k < 6; k++)
buf[m++] = vatom[i][k];
return m;
}
@ -2382,6 +2414,14 @@ int FixRigid::unpack_exchange(int nlocal, double *buf)
dorient[nlocal][1] = buf[m++];
dorient[nlocal][2] = buf[m++];
}
// must also unpack vatom if per-atom virial calculated on this timestep
// since vatom is calculated before and after atom migration
if (vflag_atom)
for (int k = 0; k < 6; k++)
vatom[nlocal][k] = buf[m++];
return m;
}

View File

@ -2540,6 +2540,16 @@ void FixRigidSmall::grow_arrays(int nmax)
if (orientflag) memory->grow(orient,nmax,orientflag,"rigid/small:orient");
if (dorientflag) memory->grow(dorient,nmax,3,"rigid/small:dorient");
}
// check for regrow of vatom
// must be done whether per-atom virial is accumulated on this step or not
// b/c this is only time grow_array() may be called
// since vatom is calculated before and after atom migration
if (nmax > maxvatom) {
maxvatom = atom->nmax;
memory->grow(vatom,maxvatom,6,"fix:vatom");
}
}
/* ----------------------------------------------------------------------
@ -2565,6 +2575,13 @@ void FixRigidSmall::copy_arrays(int i, int j, int delflag)
}
}
// must also copy vatom if per-atom virial calculated on this timestep
// since vatom is calculated before and after atom migration
if (vflag_atom)
for (int k = 0; k < 6; k++)
vatom[j][k] = vatom[i][k];
// if deleting atom J via delflag and J owns a body, then delete it
if (delflag && bodyown[j] >= 0) {
@ -2593,6 +2610,13 @@ void FixRigidSmall::set_arrays(int i)
displace[i][0] = 0.0;
displace[i][1] = 0.0;
displace[i][2] = 0.0;
// must also zero vatom if per-atom virial calculated on this timestep
// since vatom is calculated before and after atom migration
if (vflag_atom)
for (int k = 0; k < 6; k++)
vatom[i][k] = 0.0;
}
/* ----------------------------------------------------------------------
@ -2706,6 +2730,13 @@ int FixRigidSmall::pack_exchange(int i, double *buf)
if (!bodytag[i]) return m;
// must also pack vatom if per-atom virial calculated on this timestep
// since vatom is calculated before and after atom migration
if (vflag_atom)
for (int k = 0; k < 6; k++)
buf[m++] = vatom[i][k];
// atom does not own its rigid body
if (bodyown[i] < 0) {
@ -2754,6 +2785,13 @@ int FixRigidSmall::unpack_exchange(int nlocal, double *buf)
return m;
}
// must also unpack vatom if per-atom virial calculated on this timestep
// since vatom is calculated before and after atom migration
if (vflag_atom)
for (int k = 0; k < 6; k++)
vatom[nlocal][k] = buf[m++];
// atom does not own its rigid body
bodyown[nlocal] = static_cast<int> (buf[m++]);