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

This commit is contained in:
sjplimp
2013-07-25 17:47:47 +00:00
parent f25feed9ff
commit 856f78e50a
25 changed files with 431 additions and 14 deletions

View File

@ -381,6 +381,11 @@ int AtomVecDipole::pack_border(int n, int *list, double *buf,
buf[m++] = mu[j][3]; buf[m++] = mu[j][3];
} }
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->pack_border(n,list,&buf[m]);
return m; return m;
} }
@ -468,6 +473,11 @@ int AtomVecDipole::pack_border_vel(int n, int *list, double *buf,
} }
} }
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->pack_border(n,list,&buf[m]);
return m; return m;
} }
@ -511,6 +521,11 @@ void AtomVecDipole::unpack_border(int n, int first, double *buf)
mu[i][2] = buf[m++]; mu[i][2] = buf[m++];
mu[i][3] = buf[m++]; mu[i][3] = buf[m++];
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->
unpack_border(n,first,&buf[m]);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -538,6 +553,11 @@ void AtomVecDipole::unpack_border_vel(int n, int first, double *buf)
v[i][1] = buf[m++]; v[i][1] = buf[m++];
v[i][2] = buf[m++]; v[i][2] = buf[m++];
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->
unpack_border(n,first,&buf[m]);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -360,6 +360,11 @@ int AtomVecAngle::pack_border(int n, int *list, double *buf,
buf[m++] = molecule[j]; buf[m++] = molecule[j];
} }
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->pack_border(n,list,&buf[m]);
return m; return m;
} }
@ -435,6 +440,11 @@ int AtomVecAngle::pack_border_vel(int n, int *list, double *buf,
} }
} }
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->pack_border(n,list,&buf[m]);
return m; return m;
} }
@ -470,6 +480,11 @@ void AtomVecAngle::unpack_border(int n, int first, double *buf)
mask[i] = static_cast<int> (buf[m++]); mask[i] = static_cast<int> (buf[m++]);
molecule[i] = static_cast<int> (buf[m++]); molecule[i] = static_cast<int> (buf[m++]);
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->
unpack_border(n,first,&buf[m]);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -493,6 +508,11 @@ void AtomVecAngle::unpack_border_vel(int n, int first, double *buf)
v[i][1] = buf[m++]; v[i][1] = buf[m++];
v[i][2] = buf[m++]; v[i][2] = buf[m++];
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->
unpack_border(n,first,&buf[m]);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -339,6 +339,11 @@ int AtomVecBond::pack_border(int n, int *list, double *buf,
buf[m++] = molecule[j]; buf[m++] = molecule[j];
} }
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->pack_border(n,list,&buf[m]);
return m; return m;
} }
@ -414,6 +419,11 @@ int AtomVecBond::pack_border_vel(int n, int *list, double *buf,
} }
} }
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->pack_border(n,list,&buf[m]);
return m; return m;
} }
@ -449,6 +459,11 @@ void AtomVecBond::unpack_border(int n, int first, double *buf)
mask[i] = static_cast<int> (buf[m++]); mask[i] = static_cast<int> (buf[m++]);
molecule[i] = static_cast<int> (buf[m++]); molecule[i] = static_cast<int> (buf[m++]);
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->
unpack_border(n,first,&buf[m]);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -472,6 +487,11 @@ void AtomVecBond::unpack_border_vel(int n, int first, double *buf)
v[i][1] = buf[m++]; v[i][1] = buf[m++];
v[i][2] = buf[m++]; v[i][2] = buf[m++];
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->
unpack_border(n,first,&buf[m]);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -421,6 +421,11 @@ int AtomVecFull::pack_border(int n, int *list, double *buf,
buf[m++] = molecule[j]; buf[m++] = molecule[j];
} }
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->pack_border(n,list,&buf[m]);
return m; return m;
} }
@ -499,6 +504,11 @@ int AtomVecFull::pack_border_vel(int n, int *list, double *buf,
} }
} }
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->pack_border(n,list,&buf[m]);
return m; return m;
} }
@ -536,6 +546,11 @@ void AtomVecFull::unpack_border(int n, int first, double *buf)
q[i] = buf[m++]; q[i] = buf[m++];
molecule[i] = static_cast<int> (buf[m++]); molecule[i] = static_cast<int> (buf[m++]);
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->
unpack_border(n,first,&buf[m]);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -560,6 +575,11 @@ void AtomVecFull::unpack_border_vel(int n, int first, double *buf)
v[i][1] = buf[m++]; v[i][1] = buf[m++];
v[i][2] = buf[m++]; v[i][2] = buf[m++];
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->
unpack_border(n,first,&buf[m]);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -417,6 +417,11 @@ int AtomVecMolecular::pack_border(int n, int *list, double *buf,
buf[m++] = molecule[j]; buf[m++] = molecule[j];
} }
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->pack_border(n,list,&buf[m]);
return m; return m;
} }
@ -492,6 +497,11 @@ int AtomVecMolecular::pack_border_vel(int n, int *list, double *buf,
} }
} }
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->pack_border(n,list,&buf[m]);
return m; return m;
} }
@ -527,6 +537,11 @@ void AtomVecMolecular::unpack_border(int n, int first, double *buf)
mask[i] = static_cast<int> (buf[m++]); mask[i] = static_cast<int> (buf[m++]);
molecule[i] = static_cast<int> (buf[m++]); molecule[i] = static_cast<int> (buf[m++]);
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->
unpack_border(n,first,&buf[m]);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -550,6 +565,11 @@ void AtomVecMolecular::unpack_border_vel(int n, int first, double *buf)
v[i][1] = buf[m++]; v[i][1] = buf[m++];
v[i][2] = buf[m++]; v[i][2] = buf[m++];
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->
unpack_border(n,first,&buf[m]);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -372,6 +372,11 @@ int AtomVecPeri::pack_border(int n, int *list, double *buf,
buf[m++] = x0[j][2]; buf[m++] = x0[j][2];
} }
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->pack_border(n,list,&buf[m]);
return m; return m;
} }
@ -459,6 +464,11 @@ int AtomVecPeri::pack_border_vel(int n, int *list, double *buf,
} }
} }
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->pack_border(n,list,&buf[m]);
return m; return m;
} }
@ -502,6 +512,11 @@ void AtomVecPeri::unpack_border(int n, int first, double *buf)
x0[i][1] = buf[m++]; x0[i][1] = buf[m++];
x0[i][2] = buf[m++]; x0[i][2] = buf[m++];
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->
unpack_border(n,first,&buf[m]);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -529,6 +544,11 @@ void AtomVecPeri::unpack_border_vel(int n, int first, double *buf)
v[i][1] = buf[m++]; v[i][1] = buf[m++];
v[i][2] = buf[m++]; v[i][2] = buf[m++];
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->
unpack_border(n,first,&buf[m]);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -125,6 +125,8 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) :
if (atom->molecule_flag == 0) if (atom->molecule_flag == 0)
error->all(FLERR,"Fix rigid/small requires atom attribute molecule"); error->all(FLERR,"Fix rigid/small requires atom attribute molecule");
if (atom->map_style == 0)
error->all(FLERR,"Fix rigid/small requires an atom map, see atom_modify");
create_bodies(); create_bodies();

View File

@ -472,6 +472,11 @@ int AtomVecWavepacket::pack_border(int n, int *list, double *buf,
buf[m++] = etag[j]; buf[m++] = etag[j];
} }
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->pack_border(n,list,&buf[m]);
return m; return m;
} }
@ -573,6 +578,11 @@ int AtomVecWavepacket::pack_border_vel(int n, int *list, double *buf,
} }
} }
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->pack_border(n,list,&buf[m]);
return m; return m;
} }
@ -618,6 +628,11 @@ void AtomVecWavepacket::unpack_border(int n, int first, double *buf)
eradius[i] = buf[m++]; eradius[i] = buf[m++];
etag[i] = (int)buf[m++]; etag[i] = (int)buf[m++];
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->
unpack_border(n,first,&buf[m]);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -640,16 +655,18 @@ void AtomVecWavepacket::unpack_border_vel(int n, int first, double *buf)
spin[i] = static_cast<int> (buf[m++]); spin[i] = static_cast<int> (buf[m++]);
eradius[i] = buf[m++]; eradius[i] = buf[m++];
etag[i] = (int)buf[m++]; etag[i] = (int)buf[m++];
v[i][0] = buf[m++]; v[i][0] = buf[m++];
v[i][1] = buf[m++]; v[i][1] = buf[m++];
v[i][2] = buf[m++]; v[i][2] = buf[m++];
ervel[i] = buf[m++]; ervel[i] = buf[m++];
cs[2*i] = buf[m++]; cs[2*i] = buf[m++];
cs[2*i+1] = buf[m++]; cs[2*i+1] = buf[m++];
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->
unpack_border(n,first,&buf[m]);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -397,6 +397,11 @@ int AtomVecElectron::pack_border(int n, int *list, double *buf,
buf[m++] = eradius[j]; buf[m++] = eradius[j];
} }
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->pack_border(n,list,&buf[m]);
return m; return m;
} }
@ -478,6 +483,11 @@ int AtomVecElectron::pack_border_vel(int n, int *list, double *buf,
} }
} }
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->pack_border(n,list,&buf[m]);
return m; return m;
} }
@ -517,6 +527,11 @@ void AtomVecElectron::unpack_border(int n, int first, double *buf)
spin[i] = static_cast<int> (buf[m++]); spin[i] = static_cast<int> (buf[m++]);
eradius[i] = buf[m++]; eradius[i] = buf[m++];
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->
unpack_border(n,first,&buf[m]);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -542,6 +557,11 @@ void AtomVecElectron::unpack_border_vel(int n, int first, double *buf)
v[i][1] = buf[m++]; v[i][1] = buf[m++];
v[i][2] = buf[m++]; v[i][2] = buf[m++];
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->
unpack_border(n,first,&buf[m]);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -461,6 +461,11 @@ int AtomVecMeso::pack_border(int n, int *list, double *buf, int pbc_flag,
buf[m++] = vest[j][2]; buf[m++] = vest[j][2];
} }
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->pack_border(n,list,&buf[m]);
return m; return m;
} }
@ -521,6 +526,11 @@ int AtomVecMeso::pack_border_vel(int n, int *list, double *buf, int pbc_flag,
buf[m++] = vest[j][2]; buf[m++] = vest[j][2];
} }
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->pack_border(n,list,&buf[m]);
return m; return m;
} }
@ -548,6 +558,11 @@ void AtomVecMeso::unpack_border(int n, int first, double *buf) {
vest[i][1] = buf[m++]; vest[i][1] = buf[m++];
vest[i][2] = buf[m++]; vest[i][2] = buf[m++];
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->
unpack_border(n,first,&buf[m]);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -577,6 +592,11 @@ void AtomVecMeso::unpack_border_vel(int n, int first, double *buf) {
vest[i][1] = buf[m++]; vest[i][1] = buf[m++];
vest[i][2] = buf[m++]; vest[i][2] = buf[m++];
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->
unpack_border(n,first,&buf[m]);
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------

View File

@ -126,9 +126,9 @@ Atom::Atom(LAMMPS *lmp) : Pointers(lmp)
// callback lists & extra restart info // callback lists & extra restart info
nextra_grow = nextra_restart = 0; nextra_grow = nextra_restart = nextra_border = 0;
extra_grow = extra_restart = NULL; extra_grow = extra_restart = extra_border = NULL;
nextra_grow_max = nextra_restart_max = 0; nextra_grow_max = nextra_restart_max = nextra_border_max = 0;
nextra_store = 0; nextra_store = 0;
extra = NULL; extra = NULL;
@ -232,6 +232,7 @@ Atom::~Atom()
memory->destroy(extra_grow); memory->destroy(extra_grow);
memory->destroy(extra_restart); memory->destroy(extra_restart);
memory->destroy(extra_border);
memory->destroy(extra); memory->destroy(extra);
// delete mapping data structures // delete mapping data structures
@ -1340,7 +1341,7 @@ void Atom::setup_sort_bins()
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
register a callback to a fix so it can manage atom-based arrays register a callback to a fix so it can manage atom-based arrays
happens when fix is created happens when fix is created
flag = 0 for grow, 1 for restart flag = 0 for grow, 1 for restart, 2 for border comm
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void Atom::add_callback(int flag) void Atom::add_callback(int flag)
@ -1373,6 +1374,13 @@ void Atom::add_callback(int flag)
} }
extra_restart[nextra_restart] = ifix; extra_restart[nextra_restart] = ifix;
nextra_restart++; nextra_restart++;
} else if (flag == 2) {
if (nextra_border == nextra_border_max) {
nextra_border_max += DELTA;
memory->grow(extra_border,nextra_border_max,"atom:extra_border");
}
extra_border[nextra_border] = ifix;
nextra_border++;
} }
} }
@ -1400,11 +1408,19 @@ void Atom::delete_callback(const char *id, int flag)
} else if (flag == 1) { } else if (flag == 1) {
int match; int match;
for (match = 0; match < nextra_grow; match++) for (match = 0; match < nextra_restart; match++)
if (extra_restart[match] == ifix) break; if (extra_restart[match] == ifix) break;
for (int i = ifix; i < nextra_restart-1; i++) for (int i = ifix; i < nextra_restart-1; i++)
extra_restart[i] = extra_restart[i+1]; extra_restart[i] = extra_restart[i+1];
nextra_restart--; nextra_restart--;
} else if (flag == 2) {
int match;
for (match = 0; match < nextra_border; match++)
if (extra_border[match] == ifix) break;
for (int i = ifix; i < nextra_border-1; i++)
extra_border[i] = extra_border[i+1];
nextra_border--;
} }
} }
@ -1419,6 +1435,8 @@ void Atom::update_callback(int ifix)
if (extra_grow[i] > ifix) extra_grow[i]--; if (extra_grow[i] > ifix) extra_grow[i]--;
for (int i = 0; i < nextra_restart; i++) for (int i = 0; i < nextra_restart; i++)
if (extra_restart[i] > ifix) extra_restart[i]--; if (extra_restart[i] > ifix) extra_restart[i]--;
for (int i = 0; i < nextra_border; i++)
if (extra_border[i] > ifix) extra_border[i]--;
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------

View File

@ -111,9 +111,10 @@ class Atom : protected Pointers {
// callback ptrs for atom arrays managed by fix classes // callback ptrs for atom arrays managed by fix classes
int nextra_grow,nextra_restart; // # of callbacks of each type int nextra_grow,nextra_restart,nextra_border; // # of callbacks of each type
int *extra_grow,*extra_restart; // index of fix to callback to int *extra_grow,*extra_restart,*extra_border; // index of fix to callback to
int nextra_grow_max,nextra_restart_max; // size of callback lists int nextra_grow_max,nextra_restart_max; // size of callback lists
int nextra_border_max;
int nextra_store; int nextra_store;
int map_style; // default or user-specified style of map int map_style; // default or user-specified style of map

View File

@ -304,6 +304,11 @@ int AtomVecAtomic::pack_border(int n, int *list, double *buf,
buf[m++] = mask[j]; buf[m++] = mask[j];
} }
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->pack_border(n,list,&buf[m]);
return m; return m;
} }
@ -376,6 +381,11 @@ int AtomVecAtomic::pack_border_vel(int n, int *list, double *buf,
} }
} }
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->pack_border(n,list,&buf[m]);
return m; return m;
} }
@ -396,6 +406,11 @@ void AtomVecAtomic::unpack_border(int n, int first, double *buf)
type[i] = static_cast<int> (buf[m++]); type[i] = static_cast<int> (buf[m++]);
mask[i] = static_cast<int> (buf[m++]); mask[i] = static_cast<int> (buf[m++]);
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->
unpack_border(n,first,&buf[m]);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -418,6 +433,11 @@ void AtomVecAtomic::unpack_border_vel(int n, int first, double *buf)
v[i][1] = buf[m++]; v[i][1] = buf[m++];
v[i][2] = buf[m++]; v[i][2] = buf[m++];
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->
unpack_border(n,first,&buf[m]);
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------

View File

@ -647,6 +647,11 @@ int AtomVecBody::pack_border(int n, int *list, double *buf,
} }
} }
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->pack_border(n,list,&buf[m]);
return m; return m;
} }
@ -777,6 +782,11 @@ int AtomVecBody::pack_border_vel(int n, int *list, double *buf,
} }
} }
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->pack_border(n,list,&buf[m]);
return m; return m;
} }
@ -851,6 +861,11 @@ void AtomVecBody::unpack_border(int n, int first, double *buf)
nghost_bonus++; nghost_bonus++;
} }
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->
unpack_border(n,first,&buf[m]);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -900,6 +915,11 @@ void AtomVecBody::unpack_border_vel(int n, int first, double *buf)
angmom[i][1] = buf[m++]; angmom[i][1] = buf[m++];
angmom[i][2] = buf[m++]; angmom[i][2] = buf[m++];
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->
unpack_border(n,first,&buf[m]);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -313,6 +313,11 @@ int AtomVecCharge::pack_border(int n, int *list, double *buf,
buf[m++] = q[j]; buf[m++] = q[j];
} }
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->pack_border(n,list,&buf[m]);
return m; return m;
} }
@ -388,6 +393,11 @@ int AtomVecCharge::pack_border_vel(int n, int *list, double *buf,
} }
} }
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->pack_border(n,list,&buf[m]);
return m; return m;
} }
@ -423,6 +433,11 @@ void AtomVecCharge::unpack_border(int n, int first, double *buf)
mask[i] = static_cast<int> (buf[m++]); mask[i] = static_cast<int> (buf[m++]);
q[i] = buf[m++]; q[i] = buf[m++];
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->
unpack_border(n,first,&buf[m]);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -446,6 +461,11 @@ void AtomVecCharge::unpack_border_vel(int n, int first, double *buf)
v[i][1] = buf[m++]; v[i][1] = buf[m++];
v[i][2] = buf[m++]; v[i][2] = buf[m++];
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->
unpack_border(n,first,&buf[m]);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -593,6 +593,11 @@ int AtomVecEllipsoid::pack_border(int n, int *list, double *buf,
} }
} }
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->pack_border(n,list,&buf[m]);
return m; return m;
} }
@ -714,6 +719,11 @@ int AtomVecEllipsoid::pack_border_vel(int n, int *list, double *buf,
} }
} }
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->pack_border(n,list,&buf[m]);
return m; return m;
} }
@ -780,6 +790,11 @@ void AtomVecEllipsoid::unpack_border(int n, int first, double *buf)
nghost_bonus++; nghost_bonus++;
} }
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->
unpack_border(n,first,&buf[m]);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -824,6 +839,11 @@ void AtomVecEllipsoid::unpack_border_vel(int n, int first, double *buf)
angmom[i][1] = buf[m++]; angmom[i][1] = buf[m++];
angmom[i][2] = buf[m++]; angmom[i][2] = buf[m++];
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->
unpack_border(n,first,&buf[m]);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -482,6 +482,10 @@ int AtomVecHybrid::pack_border(int n, int *list, double *buf,
for (k = 0; k < nstyles; k++) for (k = 0; k < nstyles; k++)
m += styles[k]->pack_border_hybrid(n,list,&buf[m]); m += styles[k]->pack_border_hybrid(n,list,&buf[m]);
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->pack_border(n,list,&buf[m]);
return m; return m;
} }
@ -592,6 +596,10 @@ int AtomVecHybrid::pack_border_vel(int n, int *list, double *buf,
for (k = 0; k < nstyles; k++) for (k = 0; k < nstyles; k++)
m += styles[k]->pack_border_hybrid(n,list,&buf[m]); m += styles[k]->pack_border_hybrid(n,list,&buf[m]);
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->pack_border(n,list,&buf[m]);
return m; return m;
} }
@ -617,6 +625,11 @@ void AtomVecHybrid::unpack_border(int n, int first, double *buf)
for (k = 0; k < nstyles; k++) for (k = 0; k < nstyles; k++)
m += styles[k]->unpack_border_hybrid(n,first,&buf[m]); m += styles[k]->unpack_border_hybrid(n,first,&buf[m]);
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->
unpack_border(n,first,&buf[m]);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -656,6 +669,11 @@ void AtomVecHybrid::unpack_border_vel(int n, int first, double *buf)
for (k = 0; k < nstyles; k++) for (k = 0; k < nstyles; k++)
m += styles[k]->unpack_border_hybrid(n,first,&buf[m]); m += styles[k]->unpack_border_hybrid(n,first,&buf[m]);
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->
unpack_border(n,first,&buf[m]);
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------

View File

@ -518,6 +518,11 @@ int AtomVecLine::pack_border(int n, int *list, double *buf,
} }
} }
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->pack_border(n,list,&buf[m]);
return m; return m;
} }
@ -620,6 +625,11 @@ int AtomVecLine::pack_border_vel(int n, int *list, double *buf,
} }
} }
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->pack_border(n,list,&buf[m]);
return m; return m;
} }
@ -672,6 +682,11 @@ void AtomVecLine::unpack_border(int n, int first, double *buf)
nghost_bonus++; nghost_bonus++;
} }
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->
unpack_border(n,first,&buf[m]);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -709,6 +724,11 @@ void AtomVecLine::unpack_border_vel(int n, int first, double *buf)
omega[i][1] = buf[m++]; omega[i][1] = buf[m++];
omega[i][2] = buf[m++]; omega[i][2] = buf[m++];
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->
unpack_border(n,first,&buf[m]);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -574,6 +574,11 @@ int AtomVecSphere::pack_border(int n, int *list, double *buf,
buf[m++] = rmass[j]; buf[m++] = rmass[j];
} }
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->pack_border(n,list,&buf[m]);
return m; return m;
} }
@ -661,6 +666,11 @@ int AtomVecSphere::pack_border_vel(int n, int *list, double *buf,
} }
} }
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->pack_border(n,list,&buf[m]);
return m; return m;
} }
@ -698,6 +708,11 @@ void AtomVecSphere::unpack_border(int n, int first, double *buf)
radius[i] = buf[m++]; radius[i] = buf[m++];
rmass[i] = buf[m++]; rmass[i] = buf[m++];
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->
unpack_border(n,first,&buf[m]);
} }
@ -726,6 +741,11 @@ void AtomVecSphere::unpack_border_vel(int n, int first, double *buf)
omega[i][1] = buf[m++]; omega[i][1] = buf[m++];
omega[i][2] = buf[m++]; omega[i][2] = buf[m++];
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->
unpack_border(n,first,&buf[m]);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -655,6 +655,11 @@ int AtomVecTri::pack_border(int n, int *list, double *buf,
} }
} }
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->pack_border(n,list,&buf[m]);
return m; return m;
} }
@ -815,6 +820,11 @@ int AtomVecTri::pack_border_vel(int n, int *list, double *buf,
} }
} }
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->pack_border(n,list,&buf[m]);
return m; return m;
} }
@ -907,6 +917,11 @@ void AtomVecTri::unpack_border(int n, int first, double *buf)
nghost_bonus++; nghost_bonus++;
} }
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->
unpack_border(n,first,&buf[m]);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -964,6 +979,11 @@ void AtomVecTri::unpack_border_vel(int n, int first, double *buf)
angmom[i][1] = buf[m++]; angmom[i][1] = buf[m++];
angmom[i][2] = buf[m++]; angmom[i][2] = buf[m++];
} }
if (atom->nextra_border)
for (int iextra = 0; iextra < atom->nextra_border; iextra++)
m += modify->fix[atom->extra_border[iextra]]->
unpack_border(n,first,&buf[m]);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -323,7 +323,7 @@ void Comm::init()
if (ghost_velocity) comm_x_only = 0; if (ghost_velocity) comm_x_only = 0;
// set per-atom sizes for forward/reverse/border comm // set per-atom sizes for forward/reverse/border comm
// augment by velocity quantities if needed // augment by velocity and fix quantities if needed
size_forward = atom->avec->size_forward; size_forward = atom->avec->size_forward;
size_reverse = atom->avec->size_reverse; size_reverse = atom->avec->size_reverse;
@ -332,6 +332,9 @@ void Comm::init()
if (ghost_velocity) size_forward += atom->avec->size_velocity; if (ghost_velocity) size_forward += atom->avec->size_velocity;
if (ghost_velocity) size_border += atom->avec->size_velocity; if (ghost_velocity) size_border += atom->avec->size_velocity;
for (int i = 0; i < modify->nfix; i++)
size_border += modify->fix[i]->comm_border;
// maxforward = # of datums in largest forward communication // maxforward = # of datums in largest forward communication
// maxreverse = # of datums in largest reverse communication // maxreverse = # of datums in largest reverse communication
// query pair,fix,compute,dump for their requirements // query pair,fix,compute,dump for their requirements

View File

@ -63,7 +63,7 @@ Fix::Fix(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
scalar_flag = vector_flag = array_flag = 0; scalar_flag = vector_flag = array_flag = 0;
peratom_flag = local_flag = 0; peratom_flag = local_flag = 0;
comm_forward = comm_reverse = 0; comm_forward = comm_reverse = comm_border = 0;
restart_reset = 0; restart_reset = 0;
maxvatom = 0; maxvatom = 0;

View File

@ -74,6 +74,7 @@ class Fix : protected Pointers {
int comm_forward; // size of forward communication (0 if none) int comm_forward; // size of forward communication (0 if none)
int comm_reverse; // size of reverse communication (0 if none) int comm_reverse; // size of reverse communication (0 if none)
int comm_border; // size of border communication (0 if none)
double virial[6]; // accumlated virial double virial[6]; // accumlated virial
double **vatom; // accumulated per-atom virial double **vatom; // accumulated per-atom virial
@ -111,6 +112,8 @@ class Fix : protected Pointers {
virtual void copy_arrays(int, int, int) {} virtual void copy_arrays(int, int, int) {}
virtual void set_arrays(int) {} virtual void set_arrays(int) {}
virtual void update_arrays(int, int) {} virtual void update_arrays(int, int) {}
virtual int pack_border(int, int *, double *) {return 0;}
virtual int unpack_border(int, int, double *) {return 0;}
virtual int pack_exchange(int, double *) {return 0;} virtual int pack_exchange(int, double *) {return 0;}
virtual int unpack_exchange(int, double *) {return 0;} virtual int unpack_exchange(int, double *) {return 0;}
virtual int pack_restart(int, double *) {return 0;} virtual int pack_restart(int, double *) {return 0;}

View File

@ -18,6 +18,8 @@
#include "memory.h" #include "memory.h"
#include "error.h" #include "error.h"
#include "update.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace FixConst; using namespace FixConst;
@ -69,14 +71,17 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) :
border = 0; border = 0;
while (iarg < narg) { while (iarg < narg) {
if (strcmp(arg[iarg],"border") == 0) { if (strcmp(arg[iarg],"ghost") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix property/atom command"); if (iarg+2 > narg) error->all(FLERR,"Illegal fix property/atom command");
if (strcmp(arg[iarg+1],"no") == 0) border = 0; if (strcmp(arg[iarg+1],"no") == 0) border = 0;
else if (strcmp(arg[iarg+1],"yes") == 0) border = 1; else if (strcmp(arg[iarg+1],"yes") == 0) border = 1;
else error->all(FLERR,"Illegal fix property/atom command"); else error->all(FLERR,"Illegal fix property/atom command");
iarg += 2;
} else error->all(FLERR,"Illegal fix property/atom command"); } else error->all(FLERR,"Illegal fix property/atom command");
} }
if (border) comm_border = nvalue;
// perform initial allocation of atom-based array // perform initial allocation of atom-based array
// register with Atom class // register with Atom class
@ -259,6 +264,54 @@ void FixPropertyAtom::copy_arrays(int i, int j, int delflag)
} }
} }
/* ----------------------------------------------------------------------
pack values for border communication at re-neighboring
------------------------------------------------------------------------- */
int FixPropertyAtom::pack_border(int n, int *list, double *buf)
{
int i,j,k;
int m = 0;
for (k = 0; k < nvalue; k++) {
if (style[k] == MOLECULE) {
int *molecule = atom->molecule;
for (i = 0; i < n; i++) {
j = list[i];
buf[m++] = molecule[j];
}
} else if (style[j] == INTEGER) {
} else if (style[j] == DOUBLE) {
}
}
printf("PBORDER %ld %d\n",update->ntimestep,m);
return m;
}
/* ----------------------------------------------------------------------
unpack values for border communication at re-neighboring
------------------------------------------------------------------------- */
int FixPropertyAtom::unpack_border(int n, int first, double *buf)
{
int i,k,last;
int m = 0;
for (k = 0; k < nvalue; k++) {
if (style[k] == MOLECULE) {
int *molecule = atom->molecule;
last = first + n;
for (i = first; i < last; i++)
molecule[i] = static_cast<int> (buf[m++]);
} else if (style[k] == INTEGER) {
} else if (style[k] == DOUBLE) {
}
}
return m;
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
pack values in local atom-based array for exchange with another proc pack values in local atom-based array for exchange with another proc
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */

View File

@ -36,6 +36,8 @@ class FixPropertyAtom : public Fix {
void grow_arrays(int); void grow_arrays(int);
void copy_arrays(int, int, int); void copy_arrays(int, int, int);
int pack_border(int, int *, double *);
int unpack_border(int, int, double *);
int pack_exchange(int, double *); int pack_exchange(int, double *);
int unpack_exchange(int, double *); int unpack_exchange(int, double *);
int pack_restart(int, double *); int pack_restart(int, double *);