Deleting Atoms

Dear Lammps Users,

I have two different atoms (red and blue) with a defined potential between them. Trying to delete one of types (red in this case) when they get within a certain distance of approaching. I use the “delete atoms” command with overlap but unfortunately, the command does nothing. Copy of script below. Can someone please clue me in on what can be wrong with the script? Greatly appreciate it. Thanks.

------------------------ INITIALIZATION ----------------------

units lj

dimension 3
boundary f f f
comm_modify vel yes

----------------------- PARTICLE DEFINITION ----------------------

atom_style sphere

region whole block 0.0 100.0 0.0 50.0 0.0 50.0
create_box 2 whole

create_atoms 1 single 40 25 25
create_atoms 1 single 40 10 10
create_atoms 2 single 50 25 25
create_atoms 2 single 50 10 10

set atom 1 diameter 1
set atom 1 mass 1

set atom 2 diameter 1
set atom 2 mass 1

group red type 1
group blue type 2

#velocity all set 10 0 0
velocity red set 10 0 0
velocity blue set -10 0 0

----------------------- DEFINE SETTINGS -----------------------

pair_style dpd 0.0 6.0 1234
pair_coeff 1 2 -50 10
pair_coeff 1 1 40 0
pair_coeff 2 2 40 0

dump 1 all custom 100 dump.comp.* id type x y z

----------------- DEFINE THERMO ---------------------------------

thermo 10
thermo_style custom step temp pe ke

----------------- SETUP RUN ---------------------------------

reset_timestep 0
timestep 0.0005

#delete_atoms group red
delete_atoms overlap 3.0 red blue

fix wall all wall/reflect xlo EDGE xhi EDGE ylo EDGE yhi EDGE zlo EDGE zhi EDGE
fix 1 all nve/sphere

variable natoms equal “count(all)”
variable natoms_red equal “count(red)”
variable natoms_blue equal “count(blue)”

----------------- PERFORM RUN ---------------------------------

run 5000

#neigh_modify every 1 check yes

print “Number of atoms = {natoms}" print "Number of red atoms = {natoms_red}”
print “Number of blue atoms = ${natoms_blue}”

print “All done”

Why should this command do anything? Which two atoms are less than 3 sigma apart?

What is the point of using atom style sphere if you are using pair style dpd which simulates point particles?

So I have four atoms in groups of two (two groups total). In each group I have two atoms (red and blue) moving toward each other at constant velocity in a head on collision. When the two atoms are within 3 sigma apart, I require one of them to be deleted. Hence I thought the “delete atoms” command would be the one to use to satisfy this requirement.

Will “delete atoms” command work for this kind of dynamics?

For atom style, I don’t really need sphere and can change to default.

That is not how most commands in LAMMPS work. They operate on the system immediately.
Commands that take action during a run are fix commands. A fix is a command that is executed regularly during a run. Internally, the fix command itself instantiates a C++ class that is added to a list of classes to be executed at particular stages of an MD time step. Details about this are in the LAMMPS manual.

Not sure if there is any existing command that can achieve this. You may want to look over the list of available fixes. Perhaps fix bond/react could be applied.

Another possible strategy would be to use fix halt in combination with compute reduce instance looking for the maximum value from a compute coord/atom compute that determines the number of neighbors of a specific type within a given cutoff. This would be triggered if your condition is met, the run would stop, you can issue the delete_atoms command, unfix the fix halt instance and continue your simulation.

Got it. Thanks.