diff -Naur lammps-17Oct08/doc/neighbor.html lammps-21Oct08/doc/neighbor.html --- lammps-17Oct08/doc/neighbor.html 2008-08-21 08:03:21.000000000 -0600 +++ lammps-21Oct08/doc/neighbor.html 2008-10-20 09:42:13.000000000 -0600 @@ -36,7 +36,7 @@

The skin distance is also used to determine how often atoms migrate to new processors if the check option of the -neigh_modify command is set to yes. Atoms are +neigh_modify command is set to yes. Atoms are migrated (communicated) to new processors on the same timestep that neighbor lists are re-built.

diff -Naur lammps-17Oct08/doc/neighbor.txt lammps-21Oct08/doc/neighbor.txt --- lammps-17Oct08/doc/neighbor.txt 2008-08-21 08:03:21.000000000 -0600 +++ lammps-21Oct08/doc/neighbor.txt 2008-10-20 09:42:13.000000000 -0600 @@ -33,7 +33,7 @@ The {skin} distance is also used to determine how often atoms migrate to new processors if the {check} option of the -"neigh_modify"_neigh_modify command is set to {yes}. Atoms are +"neigh_modify"_neigh_modify.html command is set to {yes}. Atoms are migrated (communicated) to new processors on the same timestep that neighbor lists are re-built. diff -Naur lammps-17Oct08/src/atom.cpp lammps-21Oct08/src/atom.cpp --- lammps-17Oct08/src/atom.cpp 2008-07-25 08:41:48.000000000 -0600 +++ lammps-21Oct08/src/atom.cpp 2008-10-22 09:52:29.000000000 -0600 @@ -1036,6 +1036,8 @@ mass[itype] = mass_one; mass_setflag[itype] = 1; + + if (mass[itype] <= 0.0) error->all("Invalid mass value"); } /* ---------------------------------------------------------------------- @@ -1050,6 +1052,8 @@ mass[itype] = value; mass_setflag[itype] = 1; + + if (mass[itype] <= 0.0) error->all("Invalid mass value"); } /* ---------------------------------------------------------------------- @@ -1068,6 +1072,8 @@ for (int itype = lo; itype <= hi; itype++) { mass[itype] = atof(arg[1]); mass_setflag[itype] = 1; + + if (mass[itype] <= 0.0) error->all("Invalid mass value"); } } @@ -1116,6 +1122,9 @@ shape[itype][1] = 0.5*b; shape[itype][2] = 0.5*c; shape_setflag[itype] = 1; + + if (shape[itype][0] < 0.0 || shape[itype][1] < 0.0 || shape[itype][2] < 0.0) + error->all("Invalid shape value"); } /* ---------------------------------------------------------------------- @@ -1139,6 +1148,10 @@ shape[itype][1] = 0.5*atof(arg[2]); shape[itype][2] = 0.5*atof(arg[3]); shape_setflag[itype] = 1; + + if (shape[itype][0] < 0.0 || shape[itype][1] < 0.0 || + shape[itype][2] < 0.0) + error->all("Invalid shape value"); } } @@ -1176,13 +1189,15 @@ { if (dipole == NULL) error->all("Cannot set dipole for this atom style"); - int i; + int itype; double dipole_one; - int n = sscanf(str,"%d %lg",&i,&dipole_one); - if (n != 2) error->all("Invalid shape line in data file"); + int n = sscanf(str,"%d %lg",&itype,&dipole_one); + if (n != 2) error->all("Invalid dipole line in data file"); - dipole[i] = dipole_one; - dipole_setflag[i] = 1; + dipole[itype] = dipole_one; + dipole_setflag[itype] = 1; + + if (dipole[itype] < 0.0) error->all("Invalid dipole value"); } /* ---------------------------------------------------------------------- @@ -1201,6 +1216,8 @@ for (int itype = lo; itype <= hi; itype++) { dipole[itype] = atof(arg[1]); dipole_setflag[itype] = 1; + + if (dipole[itype] < 0.0) error->all("Invalid dipole value"); } } diff -Naur lammps-17Oct08/src/compute_erotate_sphere.cpp lammps-21Oct08/src/compute_erotate_sphere.cpp --- lammps-17Oct08/src/compute_erotate_sphere.cpp 2008-03-18 15:28:18.000000000 -0600 +++ lammps-21Oct08/src/compute_erotate_sphere.cpp 2008-10-22 09:52:29.000000000 -0600 @@ -66,7 +66,7 @@ for (int i = 1; i <= atom->ntypes; i++) { if (shape[i][0] != shape[i][1] || shape[i][0] != shape[i][2]) error->all("Compute erotate/sphere requires spherical particle shapes"); - inertia[i] = 0.25*shape[i][0]*shape[i][0] * mass[i]; + inertia[i] = shape[i][0]*shape[i][0] * mass[i]; } } } diff -Naur lammps-17Oct08/src/compute_temp_sphere.cpp lammps-21Oct08/src/compute_temp_sphere.cpp --- lammps-17Oct08/src/compute_temp_sphere.cpp 2008-07-08 13:45:01.000000000 -0600 +++ lammps-21Oct08/src/compute_temp_sphere.cpp 2008-10-22 09:52:29.000000000 -0600 @@ -98,7 +98,7 @@ for (int i = 1; i <= atom->ntypes; i++) { if (shape[i][0] != shape[i][1] || shape[i][0] != shape[i][2]) error->all("Compute temp/sphere requires spherical particle shapes"); - inertia[i] = INERTIA * 0.25*shape[i][0]*shape[i][0] * mass[i]; + inertia[i] = INERTIA * shape[i][0]*shape[i][0] * mass[i]; } } } diff -Naur lammps-17Oct08/src/fix_npt_sphere.cpp lammps-21Oct08/src/fix_npt_sphere.cpp --- lammps-17Oct08/src/fix_npt_sphere.cpp 2008-04-08 16:55:40.000000000 -0600 +++ lammps-21Oct08/src/fix_npt_sphere.cpp 2008-10-22 09:52:45.000000000 -0600 @@ -157,7 +157,7 @@ int ntypes = atom->ntypes; double **shape = atom->shape; for (int i = 1; i <= ntypes; i++) - dttype[i] = dtfrotate / (0.25*shape[i][0]*shape[i][0]*mass[i]); + dttype[i] = dtfrotate / (shape[i][0]*shape[i][0]*mass[i]); // update angular momentum by 1/2 step // update quaternion a full step via Richardson iteration @@ -206,7 +206,7 @@ int ntypes = atom->ntypes; double **shape = atom->shape; for (int i = 1; i <= ntypes; i++) - dttype[i] = dtfrotate / (0.25*shape[i][0]*shape[i][0]*mass[i]); + dttype[i] = dtfrotate / (shape[i][0]*shape[i][0]*mass[i]); if (which == NOBIAS) { for (i = 0; i < nlocal; i++) { diff -Naur lammps-17Oct08/src/fix_nve_sphere.cpp lammps-21Oct08/src/fix_nve_sphere.cpp --- lammps-17Oct08/src/fix_nve_sphere.cpp 2008-04-08 16:55:40.000000000 -0600 +++ lammps-21Oct08/src/fix_nve_sphere.cpp 2008-10-22 09:52:45.000000000 -0600 @@ -131,7 +131,7 @@ double **shape = atom->shape; int ntypes = atom->ntypes; for (int i = 1; i <= ntypes; i++) - dttype[i] = dtfrotate / (0.25*shape[i][0]*shape[i][0]*mass[i]); + dttype[i] = dtfrotate / (shape[i][0]*shape[i][0]*mass[i]); } // update v,x,omega for all particles @@ -225,7 +225,7 @@ double **shape = atom->shape; int ntypes = atom->ntypes; for (int i = 1; i <= ntypes; i++) - dttype[i] = dtfrotate / (0.25*shape[i][0]*shape[i][0]*mass[i]); + dttype[i] = dtfrotate / (shape[i][0]*shape[i][0]*mass[i]); } if (mass) { diff -Naur lammps-17Oct08/src/fix_nvt_sphere.cpp lammps-21Oct08/src/fix_nvt_sphere.cpp --- lammps-17Oct08/src/fix_nvt_sphere.cpp 2008-05-15 16:42:47.000000000 -0600 +++ lammps-21Oct08/src/fix_nvt_sphere.cpp 2008-10-22 09:52:45.000000000 -0600 @@ -102,7 +102,7 @@ int ntypes = atom->ntypes; double **shape = atom->shape; for (int i = 1; i <= ntypes; i++) - dttype[i] = dtfrotate / (0.25*shape[i][0]*shape[i][0]*mass[i]); + dttype[i] = dtfrotate / (shape[i][0]*shape[i][0]*mass[i]); if (which == NOBIAS) { for (int i = 0; i < nlocal; i++) { @@ -173,7 +173,7 @@ int ntypes = atom->ntypes; double **shape = atom->shape; for (int i = 1; i <= ntypes; i++) - dttype[i] = dtfrotate / (0.25*shape[i][0]*shape[i][0]*mass[i]); + dttype[i] = dtfrotate / (shape[i][0]*shape[i][0]*mass[i]); if (which == NOBIAS) { for (int i = 0; i < nlocal; i++) { diff -Naur lammps-17Oct08/src/neigh_full.cpp lammps-21Oct08/src/neigh_full.cpp --- lammps-17Oct08/src/neigh_full.cpp 2008-02-15 12:06:53.000000000 -0700 +++ lammps-21Oct08/src/neigh_full.cpp 2008-10-22 09:51:31.000000000 -0600 @@ -37,9 +37,9 @@ int nlocal = atom->nlocal; int nall = nlocal + atom->nghost; int molecular = atom->molecular; - if (include_group) { + if (includegroup) { nlocal = atom->nfirst; - bitmask = group->bitmask[include_group]; + bitmask = group->bitmask[includegroup]; } int *ilist = list->ilist; @@ -71,7 +71,7 @@ // skip i = j for (j = 0; j < nall; j++) { - if (include_group && !(mask[j] & bitmask)) continue; + if (includegroup && !(mask[j] & bitmask)) continue; if (i == j) continue; jtype = type[j]; if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue; @@ -123,7 +123,7 @@ int nlocal = atom->nlocal; int nall = nlocal + atom->nghost; int molecular = atom->molecular; - if (include_group) nlocal = atom->nfirst; + if (includegroup) nlocal = atom->nfirst; int *ilist = list->ilist; int *numneigh = list->numneigh; @@ -215,7 +215,7 @@ int nlocal = atom->nlocal; int nall = nlocal + atom->nghost; int molecular = atom->molecular; - if (include_group) nlocal = atom->nfirst; + if (includegroup) nlocal = atom->nfirst; int *ilist = list->ilist; int *numneigh = list->numneigh; diff -Naur lammps-17Oct08/src/neigh_gran.cpp lammps-21Oct08/src/neigh_gran.cpp --- lammps-17Oct08/src/neigh_gran.cpp 2008-02-15 12:06:53.000000000 -0700 +++ lammps-21Oct08/src/neigh_gran.cpp 2008-10-22 09:51:31.000000000 -0600 @@ -52,9 +52,9 @@ int *molecule = atom->molecule; int nlocal = atom->nlocal; int nall = nlocal + atom->nghost; - if (include_group) { + if (includegroup) { nlocal = atom->nfirst; - bitmask = group->bitmask[include_group]; + bitmask = group->bitmask[includegroup]; } int *ilist = list->ilist; @@ -108,7 +108,7 @@ // loop over remaining atoms, owned and ghost for (j = i+1; j < nall; j++) { - if (include_group && !(mask[j] & bitmask)) continue; + if (includegroup && !(mask[j] & bitmask)) continue; if (exclude && exclusion(i,j,type[i],type[j],mask,molecule)) continue; delx = xtmp - x[j][0]; @@ -187,9 +187,9 @@ int *molecule = atom->molecule; int nlocal = atom->nlocal; int nall = nlocal + atom->nghost; - if (include_group) { + if (includegroup) { nlocal = atom->nfirst; - bitmask = group->bitmask[include_group]; + bitmask = group->bitmask[includegroup]; } int *ilist = list->ilist; @@ -221,7 +221,7 @@ // loop over remaining atoms, owned and ghost for (j = i+1; j < nall; j++) { - if (include_group && !(mask[j] & bitmask)) continue; + if (includegroup && !(mask[j] & bitmask)) continue; if (j >= nlocal) { jtag = tag[j]; @@ -298,7 +298,7 @@ int *mask = atom->mask; int *molecule = atom->molecule; int nlocal = atom->nlocal; - if (include_group) nlocal = atom->nfirst; + if (includegroup) nlocal = atom->nfirst; int *ilist = list->ilist; int *numneigh = list->numneigh; @@ -441,7 +441,7 @@ int *mask = atom->mask; int *molecule = atom->molecule; int nlocal = atom->nlocal; - if (include_group) nlocal = atom->nfirst; + if (includegroup) nlocal = atom->nfirst; int *ilist = list->ilist; int *numneigh = list->numneigh; @@ -548,7 +548,7 @@ int *mask = atom->mask; int *molecule = atom->molecule; int nlocal = atom->nlocal; - if (include_group) nlocal = atom->nfirst; + if (includegroup) nlocal = atom->nfirst; int *ilist = list->ilist; int *numneigh = list->numneigh; diff -Naur lammps-17Oct08/src/neigh_half_bin.cpp lammps-21Oct08/src/neigh_half_bin.cpp --- lammps-17Oct08/src/neigh_half_bin.cpp 2008-02-15 12:06:53.000000000 -0700 +++ lammps-21Oct08/src/neigh_half_bin.cpp 2008-10-22 09:51:31.000000000 -0600 @@ -43,7 +43,7 @@ int *molecule = atom->molecule; int nlocal = atom->nlocal; int nall = nlocal + atom->nghost; - if (include_group) nlocal = atom->nfirst; + if (includegroup) nlocal = atom->nfirst; int molecular = atom->molecular; int *ilist = list->ilist; @@ -137,7 +137,7 @@ int nlocal = atom->nlocal; int nall = nlocal + atom->nghost; int molecular = atom->molecular; - if (include_group) nlocal = atom->nfirst; + if (includegroup) nlocal = atom->nfirst; int *ilist = list->ilist; int *numneigh = list->numneigh; @@ -251,7 +251,7 @@ int nlocal = atom->nlocal; int nall = nlocal + atom->nghost; int molecular = atom->molecular; - if (include_group) nlocal = atom->nfirst; + if (includegroup) nlocal = atom->nfirst; int *ilist = list->ilist; int *numneigh = list->numneigh; diff -Naur lammps-17Oct08/src/neigh_half_multi.cpp lammps-21Oct08/src/neigh_half_multi.cpp --- lammps-17Oct08/src/neigh_half_multi.cpp 2008-02-15 12:06:53.000000000 -0700 +++ lammps-21Oct08/src/neigh_half_multi.cpp 2008-10-22 09:51:31.000000000 -0600 @@ -46,7 +46,7 @@ int nlocal = atom->nlocal; int nall = nlocal + atom->nghost; int molecular = atom->molecular; - if (include_group) nlocal = atom->nfirst; + if (includegroup) nlocal = atom->nfirst; int *ilist = list->ilist; int *numneigh = list->numneigh; @@ -147,7 +147,7 @@ int nlocal = atom->nlocal; int nall = nlocal + atom->nghost; int molecular = atom->molecular; - if (include_group) nlocal = atom->nfirst; + if (includegroup) nlocal = atom->nfirst; int *ilist = list->ilist; int *numneigh = list->numneigh; @@ -271,7 +271,7 @@ int nlocal = atom->nlocal; int nall = nlocal + atom->nghost; int molecular = atom->molecular; - if (include_group) nlocal = atom->nfirst; + if (includegroup) nlocal = atom->nfirst; int *ilist = list->ilist; int *numneigh = list->numneigh; diff -Naur lammps-17Oct08/src/neigh_half_nsq.cpp lammps-21Oct08/src/neigh_half_nsq.cpp --- lammps-17Oct08/src/neigh_half_nsq.cpp 2008-02-15 12:06:53.000000000 -0700 +++ lammps-21Oct08/src/neigh_half_nsq.cpp 2008-10-22 09:51:31.000000000 -0600 @@ -38,9 +38,9 @@ int nlocal = atom->nlocal; int nall = nlocal + atom->nghost; int molecular = atom->molecular; - if (include_group) { + if (includegroup) { nlocal = atom->nfirst; - bitmask = group->bitmask[include_group]; + bitmask = group->bitmask[includegroup]; } int *ilist = list->ilist; @@ -71,7 +71,7 @@ // loop over remaining atoms, owned and ghost for (j = i+1; j < nall; j++) { - if (include_group && !(mask[j] & bitmask)) continue; + if (includegroup && !(mask[j] & bitmask)) continue; jtype = type[j]; if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue; @@ -119,9 +119,9 @@ int nlocal = atom->nlocal; int nall = nlocal + atom->nghost; int molecular = atom->molecular; - if (include_group) { + if (includegroup) { nlocal = atom->nfirst; - bitmask = group->bitmask[include_group]; + bitmask = group->bitmask[includegroup]; } int *ilist = list->ilist; @@ -154,7 +154,7 @@ // itag = jtag is possible for long cutoffs that include images of self for (j = i+1; j < nall; j++) { - if (include_group && !(mask[j] & bitmask)) continue; + if (includegroup && !(mask[j] & bitmask)) continue; if (j >= nlocal) { jtag = tag[j]; diff -Naur lammps-17Oct08/src/neigh_respa.cpp lammps-21Oct08/src/neigh_respa.cpp --- lammps-17Oct08/src/neigh_respa.cpp 2008-02-15 12:06:53.000000000 -0700 +++ lammps-21Oct08/src/neigh_respa.cpp 2008-10-22 09:51:31.000000000 -0600 @@ -39,9 +39,9 @@ int nlocal = atom->nlocal; int nall = nlocal + atom->nghost; int molecular = atom->molecular; - if (include_group) { + if (includegroup) { nlocal = atom->nfirst; - bitmask = group->bitmask[include_group]; + bitmask = group->bitmask[includegroup]; } int *ilist = list->ilist; @@ -110,7 +110,7 @@ // loop over remaining atoms, owned and ghost for (j = i+1; j < nall; j++) { - if (include_group && !(mask[j] & bitmask)) continue; + if (includegroup && !(mask[j] & bitmask)) continue; jtype = type[j]; if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue; @@ -184,9 +184,9 @@ int nlocal = atom->nlocal; int nall = nlocal + atom->nghost; int molecular = atom->molecular; - if (include_group) { + if (includegroup) { nlocal = atom->nfirst; - bitmask = group->bitmask[include_group]; + bitmask = group->bitmask[includegroup]; } int *ilist = list->ilist; @@ -256,7 +256,7 @@ // loop over remaining atoms, owned and ghost for (j = i+1; j < nall; j++) { - if (include_group && !(mask[j] & bitmask)) continue; + if (includegroup && !(mask[j] & bitmask)) continue; if (j >= nlocal) { jtag = tag[j]; @@ -351,7 +351,7 @@ int nlocal = atom->nlocal; int nall = nlocal + atom->nghost; int molecular = atom->molecular; - if (include_group) nlocal = atom->nfirst; + if (includegroup) nlocal = atom->nfirst; int *ilist = list->ilist; int *numneigh = list->numneigh; @@ -507,7 +507,7 @@ int nlocal = atom->nlocal; int nall = nlocal + atom->nghost; int molecular = atom->molecular; - if (include_group) nlocal = atom->nfirst; + if (includegroup) nlocal = atom->nfirst; int *ilist = list->ilist; int *numneigh = list->numneigh; @@ -696,7 +696,7 @@ int nlocal = atom->nlocal; int nall = nlocal + atom->nghost; int molecular = atom->molecular; - if (include_group) nlocal = atom->nfirst; + if (includegroup) nlocal = atom->nfirst; int *ilist = list->ilist; int *numneigh = list->numneigh; diff -Naur lammps-17Oct08/src/neighbor.cpp lammps-21Oct08/src/neighbor.cpp --- lammps-17Oct08/src/neighbor.cpp 2008-08-21 07:53:19.000000000 -0600 +++ lammps-21Oct08/src/neighbor.cpp 2008-10-22 09:51:31.000000000 -0600 @@ -90,7 +90,7 @@ // pair exclusion list info - include_group = 0; + includegroup = 0; nex_type = maxex_type = 0; ex1_type = ex2_type = NULL; @@ -918,7 +918,7 @@ double **x = atom->x; int nlocal = atom->nlocal; - if (include_group) nlocal = atom->nfirst; + if (includegroup) nlocal = atom->nfirst; int flag = 0; for (int i = 0; i < nlocal; i++) { @@ -1289,10 +1289,10 @@ iarg += 2; } else if (strcmp(arg[iarg],"include") == 0) { if (iarg+2 > narg) error->all("Illegal neigh_modify command"); - include_group = group->find(arg[iarg+1]); - if (include_group < 0) + includegroup = group->find(arg[iarg+1]); + if (includegroup < 0) error->all("Invalid group ID in neigh_modify command"); - if (include_group && (atom->firstgroupname == NULL || + if (includegroup && (atom->firstgroupname == NULL || strcmp(arg[iarg+1],atom->firstgroupname) != 0)) error->all("Neigh_modify include group != atom_modify first group"); iarg += 2; @@ -1414,8 +1414,8 @@ int nlocal = atom->nlocal; int nall = nlocal + atom->nghost; - if (include_group) { - int bitmask = group->bitmask[include_group]; + if (includegroup) { + int bitmask = group->bitmask[includegroup]; for (i = nall-1; i >= nlocal; i--) { if (mask[i] & bitmask) { ibin = coord2bin(x[i]); diff -Naur lammps-17Oct08/src/neighbor.h lammps-21Oct08/src/neighbor.h --- lammps-17Oct08/src/neighbor.h 2008-08-21 07:53:19.000000000 -0600 +++ lammps-21Oct08/src/neighbor.h 2008-10-22 09:51:31.000000000 -0600 @@ -27,6 +27,7 @@ int ago; // how many steps ago neighboring occurred int pgsize; // size of neighbor page int oneatom; // max # of neighbors for one atom + int includegroup; // only build pairwise lists for this group double skin; // skin distance double cutneighmin; // min neighbor cutoff for all type pairs @@ -122,8 +123,6 @@ int special_flag[4]; // flags for 1-2, 1-3, 1-4 neighbors - int include_group; // only build pairwise lists for this group - int exclude; // 0 if no type/group exclusions, 1 if yes int nex_type; // # of entries in type exclusion list diff -Naur lammps-17Oct08/src/pair.cpp lammps-21Oct08/src/pair.cpp --- lammps-17Oct08/src/pair.cpp 2008-08-13 08:39:45.000000000 -0600 +++ lammps-21Oct08/src/pair.cpp 2008-10-22 09:52:45.000000000 -0600 @@ -699,17 +699,43 @@ { double **x = atom->x; double **f = atom->f; - int nall = atom->nlocal + atom->nghost; - // sum over own & ghost atoms + // sum over force on all particles including ghosts - for (int i = 0; i < nall; i++) { - virial[0] += f[i][0]*x[i][0]; - virial[1] += f[i][1]*x[i][1]; - virial[2] += f[i][2]*x[i][2]; - virial[3] += f[i][1]*x[i][0]; - virial[4] += f[i][2]*x[i][0]; - virial[5] += f[i][2]*x[i][1]; + if (neighbor->includegroup == 0) { + int nall = atom->nlocal + atom->nghost; + for (int i = 0; i < nall; i++) { + virial[0] += f[i][0]*x[i][0]; + virial[1] += f[i][1]*x[i][1]; + virial[2] += f[i][2]*x[i][2]; + virial[3] += f[i][1]*x[i][0]; + virial[4] += f[i][2]*x[i][0]; + virial[5] += f[i][2]*x[i][1]; + } + + // neighbor includegroup flag is set + // sum over force on initial nfirst particles and ghosts + + } else { + int nall = atom->nfirst; + for (int i = 0; i < nall; i++) { + virial[0] += f[i][0]*x[i][0]; + virial[1] += f[i][1]*x[i][1]; + virial[2] += f[i][2]*x[i][2]; + virial[3] += f[i][1]*x[i][0]; + virial[4] += f[i][2]*x[i][0]; + virial[5] += f[i][2]*x[i][1]; + } + + nall = atom->nlocal + atom->nghost; + for (int i = atom->nlocal; i < nall; i++) { + virial[0] += f[i][0]*x[i][0]; + virial[1] += f[i][1]*x[i][1]; + virial[2] += f[i][2]*x[i][2]; + virial[3] += f[i][1]*x[i][0]; + virial[4] += f[i][2]*x[i][0]; + virial[5] += f[i][2]*x[i][1]; + } } } diff -Naur lammps-17Oct08/src/verlet.cpp lammps-21Oct08/src/verlet.cpp --- lammps-17Oct08/src/verlet.cpp 2008-01-18 10:18:46.000000000 -0700 +++ lammps-21Oct08/src/verlet.cpp 2008-10-22 09:52:29.000000000 -0600 @@ -221,26 +221,70 @@ { int i; - // clear global force array - // nall includes ghosts only if either newton flag is set + // clear force on all particles + // if either newton flag is set, also include ghosts - int nall; - if (force->newton) nall = atom->nlocal + atom->nghost; - else nall = atom->nlocal; - - double **f = atom->f; - for (i = 0; i < nall; i++) { - f[i][0] = 0.0; - f[i][1] = 0.0; - f[i][2] = 0.0; - } + if (neighbor->includegroup == 0) { + int nall; + if (force->newton) nall = atom->nlocal + atom->nghost; + else nall = atom->nlocal; - if (torqueflag) { - double **torque = atom->torque; + double **f = atom->f; for (i = 0; i < nall; i++) { - torque[i][0] = 0.0; - torque[i][1] = 0.0; - torque[i][2] = 0.0; + f[i][0] = 0.0; + f[i][1] = 0.0; + f[i][2] = 0.0; + } + + if (torqueflag) { + double **torque = atom->torque; + for (i = 0; i < nall; i++) { + torque[i][0] = 0.0; + torque[i][1] = 0.0; + torque[i][2] = 0.0; + } + } + + // neighbor includegroup flag is set + // clear force only on initial nfirst particles + // if either newton flag is set, also include ghosts + + } else { + int nall = atom->nfirst; + + double **f = atom->f; + for (i = 0; i < nall; i++) { + f[i][0] = 0.0; + f[i][1] = 0.0; + f[i][2] = 0.0; + } + + if (torqueflag) { + double **torque = atom->torque; + for (i = 0; i < nall; i++) { + torque[i][0] = 0.0; + torque[i][1] = 0.0; + torque[i][2] = 0.0; + } + } + + if (force->newton) { + nall = atom->nlocal + atom->nghost; + + for (i = atom->nlocal; i < nall; i++) { + f[i][0] = 0.0; + f[i][1] = 0.0; + f[i][2] = 0.0; + } + + if (torqueflag) { + double **torque = atom->torque; + for (i = atom->nlocal; i < nall; i++) { + torque[i][0] = 0.0; + torque[i][1] = 0.0; + torque[i][2] = 0.0; + } + } } } }