[lammps-users] Replacing lost atoms during simulation

Hi,

I would like to replace atoms when they are lost during a simulation. Is there a LAMMPS command that returns the current total number atoms of a certain type to a variable? I would like to use this variable (let's call it x_now) in an "if" statement as shown below.

thermo_modify lost ignore
variable x_lost equal x_init - x_now
if ${ x_lost} > 0 then create_atoms 2 single x y z

Thanks,

Nicholas J. Lee

The count(group) command in a variable will count the number of
atoms in a group.

Steve