Delete a certain group of molecules within a specific region

Dear lammps users,

I am currently having a binary mixture in a box and would like to delete only 1 group of molecules in a certain region of the box. I found the delete_atoms random command can do this but it requires an update of the lammps to the newer version. Is there an alternative way to delete a certain group of molecules within a region without using random?
Thank you for your time.

There are many ways to construct subsets for delete_atoms by using a group, since you can build complex selections of atoms through intersections of groups (e.g. through intersecting a region and a range of molecule IDs) and even more complex ones by defining a group through an atom style variable (atoms are selected by zero/non-zero).

Thank you for the reply. I just checked the group definition and find the dynamic group to be very useful.
I assume you mean a command like: group mobile dynamic type1 region half_box?

No

What you can do is:

  • create region 1
  • create group 1 with all the atoms contained within region 1
  • create group 2 with all the type of atoms you want to delete
  • create group 3 as the intersection between group 2 and group 1
  • delete group 3 using the keyword “mol yes” to avoid cutting your molecules in half

Best,
Simon

Thank you for the detailed instruction. I see your point. I can delete atoms before the simulation start to run now but it seems to only work once. My follow-up question is can delete_atoms work during the entire simulation? For example, I want to always keep the middle region of the box as void by deleting any molecule later floating into this region. I am currently thinking about running the delete command every certain period.

Yes, sure, you can create a loop and periodically delete the molecules inside a certain region, or even better you can use the fix evaporate.

Got it.

The fix evaporate command works nice with deleting atoms but I noticed that the manual says ‘compute_modify dynamic yes’ should be used when monitoring the temperature. To test the compute_modify command, I built a NPT box filled with CO2 molecules.

assign temperature to co2

fix co2NPT co2 npt temp 373 373 $(150*dt) iso 345 345 1000.0

basic statistics to monitor

compute T_co2_modi co2 temp
compute_modify T_co2_modi dynamic/dof yes
? fix_modify co2NPT temp T_co2_modi
fix avg_T_co2_modi co2 ave/time 1 20000 20000 c_T_co2_modi

region bath block INF INF INF INF INF INF side in
fix delete_co2 c_co2 evaporate 1100000 1200 bath 55555 molecule yes

thermo 20000
thermo_style custom step temp f_avg_T_co2_modi vol atoms
run_style verlet
timestep 1

As output, ‘f_avg_T_co2_modi’ gives right temperature (373K) after the deletion while ‘temp’ gives a much smaller temperature (~260).

To get the temperature right, should I apply fix_modify about temperature to fix npt? If not, what treatment could make the temperature calculation right when using fix evaporate?