Steve,
I want to know how the command "delete_atoms porosity " remove atoms from the
specified region as a funtion of random seed. For example, if i use the following:
"delete_atoms porosity 5 0.02 86754321"
It deletes 2% of atoms in region 5. I would like to know how the LAMMPS decide which atoms to delete. I guess it calculates the indexes of atoms as per random seed. I want to know the exact process.
Below is the source code. It's simple.
Each proc has its own random number generator.
It loops over the atoms it owns. If the atom is in
the region it deletes the atom with probability
p, specified by you in the command.
int iregion = domain->find_region(arg[1]);
if (iregion == -1) error->all("Could not find delete_atoms region ID");
double porosity_fraction = atof(arg[2]);
int seed = atoi(arg[3]);
options(narg-4,&arg[4]);
RanMars *random = new RanMars(lmp,seed + comm->me);
// allocate and initialize deletion list
int nlocal = atom->nlocal;
dlist = (int *) memory->smalloc(nlocal*sizeof(int),"delete_atoms:dlist");
for (int i = 0; i < nlocal; i++) dlist[i] = 0;
double **x = atom->x;
for (int i = 0; i < nlocal; i++)
if (domain->regions[iregion]->match(x[i][0],x[i][1],x[i][2]))
if (random->uniform() <= porosity_fraction) dlist[i] = 1;
}