Dear LAMMPS Users and Developers,
I have a data file with 2 slabs and would like to delete randomly atoms from the top&bottom surfaces.
If I use delete_atoms command with region, then I should determine the coordinates of the surface (for that I would define the volume of atoms).
# Define a region corresponding to a slab in the Z direction
region my_slab1_single block -20 -8 -20 -8 7.5 8
region my_slab2_single block -20 -8 -20 -8 -5.404 -3.596
# Delete atoms randomly from this slab
delete_atoms region my_slab1 random 50 12345
delete_atoms region my_slab2 random 50 12345
Is it possible to determine somehow the coordinates of the top layer of the slab?
Or is there any workaround for the process?
Thank you for your help,
Patrik
I really don’t see why you would have to define the volume of an atom for that. By playing with regions and atom types you should be able to isolate the top and bottom slabs (note that LAMMPS allows unions and intersects from atom groups).
Thank you for your help!
The data file contains only one atom types.
If the slabs are built up by same atoms then how could I use atoms types?
My goal is to remove atoms from the top layer and the bottom layer of slabs (=create vacancies on the top and the bottom).
Sorry, do you have example/example files for that?
I struggle to understand how I could select the top layer of a slab using regions and atom types.
A similar strategy is used in the “Nanosheared electrolyte” tutorial from lammpstutorials. However, I don’t recommend copy-pasting it blindly, as it’s a good exercise to play with the group command of LAMMPS and get to select whatever subgroup of atoms you want.
That is a fundamental problem and something you need to work on to improve your problem solving skills. You cannot expect to find a canned solution for “everything” explained and spelled out to the last detail in documentations and tutorials. You have to realize that there may be solutions to problems that are a bit more indirect and done with multiple steps. In this specific case, there is the option to first define a group with multiple conditions (which can be arbitrarily complex since you can do unions of multiple groups) and then apply changes.
But there are other straightforward ways. You can just use a different atom type for the atoms in either slab in the original data file and then just use the atom type as identifier (or form groups based on that). This can be a powerful approach to simplify analysis. Yet another option would be to switch to an atom style that supports molecule IDs and then group atoms with different molecule ID assignments.
This kind of “creative thinking” is a crucial aspect of solving problems (not only in research). If you struggle with applying this on a complex simulation, you need to practice with simpler ones. It will pay off in the long run.
1 Like