bug fixes from Doug Spearot

This commit is contained in:
Steve Plimpton
2021-11-30 08:22:38 -07:00
parent 4d19895a88
commit 4a05628938
2 changed files with 20 additions and 19 deletions

View File

@ -81,9 +81,9 @@ be deleted when running on different numbers of processors.
For style *porosity* a specified *fraction* of atoms are deleted which For style *porosity* a specified *fraction* of atoms are deleted which
are both in the specified group and within the specified region. The are both in the specified group and within the specified region. The
region-ID can be specified as NULL to only impose the group region-ID can be specified as NULL to only impose the group criterion.
criterion. Likewise, specifying the group-ID as *all* will only impose Likewise, specifying the group-ID as *all* will only impose the region
the region criterion. criterion.
For example, if fraction is 0.1, then 10% of the eligible atoms will For example, if fraction is 0.1, then 10% of the eligible atoms will
be deleted. The atoms to delete are chosen randomly. There is no be deleted. The atoms to delete are chosen randomly. There is no
@ -97,8 +97,8 @@ number of atoms in the system. Note that this is not done for
molecular systems (see the :doc:`atom_style <atom_style>` command), molecular systems (see the :doc:`atom_style <atom_style>` command),
regardless of the *compress* setting, since it would foul up the bond regardless of the *compress* setting, since it would foul up the bond
connectivity that has already been assigned. However, the connectivity that has already been assigned. However, the
:doc:`reset_atom_ids <reset_atom_ids>` command can be used after this command to :doc:`reset_atom_ids <reset_atom_ids>` command can be used after this
accomplish the same thing. command to accomplish the same thing.
Note that the re-assignment of IDs is not really a compression, where Note that the re-assignment of IDs is not really a compression, where
gaps in atom IDs are removed by decrementing atom IDs that are larger. gaps in atom IDs are removed by decrementing atom IDs that are larger.
@ -108,15 +108,15 @@ the :doc:`create_atoms <create_atoms>` command explains.
A molecular system with fixed bonds, angles, dihedrals, or improper A molecular system with fixed bonds, angles, dihedrals, or improper
interactions, is one where the topology of the interactions is interactions, is one where the topology of the interactions is
typically defined in the data file read by the typically defined in the data file read by the :doc:`read_data
:doc:`read_data <read_data>` command, and where the interactions <read_data>` command, and where the interactions themselves are
themselves are defined with the :doc:`bond_style <bond_style>`, defined with the :doc:`bond_style <bond_style>`, :doc:`angle_style
:doc:`angle_style <angle_style>`, etc commands. If you delete atoms <angle_style>`, etc commands. If you delete atoms from such a system,
from such a system, you must be careful not to end up with bonded you must be careful not to end up with bonded interactions that are
interactions that are stored by remaining atoms but which include stored by remaining atoms but which include deleted atoms. This will
deleted atoms. This will cause LAMMPS to generate a "missing atoms" cause LAMMPS to generate a "missing atoms" error when the bonded
error when the bonded interaction is computed. The *bond* and *mol* interaction is computed. The *bond* and *mol* keywords offer two ways
keywords offer two ways to do that. to do that.
It the *bond* keyword is set to *yes* then any bond or angle or It the *bond* keyword is set to *yes* then any bond or angle or
dihedral or improper interaction that includes a deleted atom is also dihedral or improper interaction that includes a deleted atom is also

View File

@ -431,7 +431,7 @@ void DeleteAtoms::delete_porosity(int narg, char **arg)
if (strcmp(arg[2],"NULL") == 0) regionflag = 0; if (strcmp(arg[2],"NULL") == 0) regionflag = 0;
else { else {
regionflag = 1; regionflag = 1;
int iregion = domain->find_region(arg[2]); iregion = domain->find_region(arg[2]);
if (iregion == -1) error->all(FLERR,"Could not find delete_atoms region ID"); if (iregion == -1) error->all(FLERR,"Could not find delete_atoms region ID");
domain->regions[iregion]->prematch(); domain->regions[iregion]->prematch();
} }
@ -448,17 +448,18 @@ void DeleteAtoms::delete_porosity(int narg, char **arg)
memory->create(dlist,nlocal,"delete_atoms:dlist"); memory->create(dlist,nlocal,"delete_atoms:dlist");
for (int i = 0; i < nlocal; i++) dlist[i] = 0; for (int i = 0; i < nlocal; i++) dlist[i] = 0;
// delete fraction of atoms in both group and region // delete fraction of atoms which are in both group and region
double **x = atom->x; double **x = atom->x;
int *mask = atom->mask; int *mask = atom->mask;
int groupbit = group->bitmask[igroup]; int groupbit = group->bitmask[igroup];
for (int i = 0; i < nlocal; i++) { for (int i = 0; i < nlocal; i++) {
if (!(mask[i] & groupbit)) continue; if (!(mask[i] & groupbit)) continue;
if (regionflag && domain->regions[iregion]->match(x[i][0],x[i][1],x[i][2])) if (regionflag &&
if (random->uniform() <= porosity_fraction) dlist[i] = 1; !domain->regions[iregion]->match(x[i][0],x[i][1],x[i][2])) continue;
if (random->uniform() <= porosity_fraction) dlist[i] = 1;
} }
delete random; delete random;