Create random voids

Hi all, I’m wondering if there is way to create random voids in Lammps input script

Most certainly yes. The delete_atoms command can operate on regions and groups. You can define (and then delete) regions at random locations with random parameters using variables (with ${name} type of variable expansion). Also you could define a more complex algorithm with an atom style variable that evaluates to zero or non-zero and then use that to define a group based on that. You can do this multiple times and - if needed - in a loop.

thank you for your reply, below is what I did to delete 100 voids but when I use OVITO to visualize it doesn’t show random distribution.

label vid
variable j loop 100

variable atomx equal ($j+0.5)
variable atomy equal ($j+0.5)
variable atomz equal ($j+5)
variable atomrad equal 20

region void_j sphere {atomx} {atomy} {atomz} ${atomrad}
delete_atoms region void_$j

next j
jump in.ctc vid

There is no randomness used anywhere, so why should there be a random distribution?

Please where should I specify the randomness ?

In the variable expressions, of course. $j+0.5 is deterministic. Programs do exactly what you program, not what you intend. Software cannot read minds. :wink: