How to delete atoms which across the periodic boundaries for every 1000 runs?

Hello everyone,

I am trying to simulate ion bombardment of 2D materials. The boundary condition applied in my simulation is ppm, thus atoms are free in z direction. After the collision caused by the projectile, some atoms may be sputtered. In my subsequent annealing runs under certain temperature with fix nvt command, some sputtered atoms would across the periodic boundaries in the x or y directions, such behavior would cause the other atoms drift along the xy plane and finally got bad termination, although fix recenter is already used. So, I think I need to delete the sputtered atoms which across the periodic boundaries in the x or y direction periodically, like for every 1000 runs. I think one possible strategy may be to assign a flag to these atoms and use the flag to identify them, but I do not figure out how to do that. Could you please give me some suggestions?

Any help would be much appreciated!

Regards,

Liu

Hello everyone,
I am trying to simulate ion bombardment of 2D materials. The boundary
condition applied in my simulation is ppm, thus atoms are free in z
direction. After the collision caused by the projectile, some atoms may
be sputtered. In my subsequent annealing runs

These are annealing simulations?

under certain temperature
with fix nvt command, some sputtered atoms would across the periodic
boundaries in the x or y directions, such behavior would cause the other
atoms drift along the xy plane and finally got bad termination, although
fix recenter is already used.

atoms drifting accross periodic boundary conditions do not normally
cause bad termination. Are you using periodic boundaries in your
simulation? (Are you using "boundary p p p"?) What was the error
message you are getting?

So, I think I need to delete the sputtered
atoms which across the periodic boundaries in the x or y direction
periodically, like for every 1000 runs.

1000 runs?
or 1000 timesteps?

I think one possible strategy
may be to assign a flag to these atoms and use the flag to identify
them, but I do not figure out how to do that. Could you please give me
some suggestions?

Nor do I. I think the first question which needs to be answered is:

1) Can you clarify more why you think that deleting atoms which cross
the periodic boundaries will prevent your simulation from crashing?
(See my questions above.)

2) What do you mean by "every 1000 runs". I ask this because it's
important to figure out if you need to interrupt an existing
simulation periodically during the run, OR if you can wait until a
simulation is finished, write a data file, and post-process the
resulting data file, deleting atoms with non-zero image flags.

Hi Andrew,

Thanks very very much for your detailed reply! I am sorry my English is not very well, some of my previous sentences may confuse you. I will try my best to describe it as clear as possible.

I have run a bit more simulations today. I noticed that the bad dynamics happened at the beginning of the subsequent runs under fix nvt. Before the start of the fix nvt runs, the sputtered atoms with high kinetic energy which crossed the periodic boundaries many times were deleted and the other atoms moved along the xy planes with a distance about half of the box size or up to many times of the box size.Sometimes the simulation did not terminate badly but got bad dynamics as the shape of the sheet became weird.I not sure whether the drift of the other atoms lead to the problem. But I think the bad result is related to the sputtered atoms and I want to delete the atoms which cross the periodic boundary for every 1000 timesteps (not runs, thanks for your correction), which means I need to delete them periodically during a single run.

Does a flag exist for reflecting the status whether an atoms have crossed the periodic boundaries? I think maybe it is the key to solve my problem. But I did not find a way to define a variable that is related to the flag. Do you have further suggestions?

Thanks in advance!

Regards,

Liu

Hi Andrew,

I found that maybe I should delete the sputtered atoms when the system is under NVE ensemble. If I delete them when fix nvt is applied, after the deletion, at the beginning of a new fix nvt run, the simulation always got bad dynamics or bad termination. If the result is reasonable, I think my problem should be solved.

Regards,

Liu

I confess that I'm not sure I have the stamina to understand the
details of your simulation.

You want to delete the atoms which leave the simulation boundary. I
am guessing that the reason that you want to do this is because these
are also the same atoms which are probably moving the most rapidly and
are most likely to cause LAMMPS to crash.

Reducing the timestep would be the most accurate way to solve your
problem. But clearly, it will make your simulations slow.

Question:
If you want to use a large timestep (1fs), and you are not interested
in simulating the behavior of these fast moving atoms accurately
(since you plan to discard them), why not reduce their speed? In the
rest of this email, I propose several methods to do this:

Have you looked at fix nve/limit? It is very useful:

https://lammps.sandia.gov/doc/fix_nve_limit.html

This will only reduce the speed of atoms which move faster than a
(user-specified) velocity. (The motion of these atoms will not be
realistic, but I guess this does not matter to you because you were
planning to discard them.)

There are also many fixes which can reduce the speed of atoms over
time such as "fix viscous". You can apply this fix to all of the
atoms in your system, or only group of atoms in the target surface (I
don't know if those are the atoms which move too quickly.) But this
will probably effect the entire system which could effect your
results, so I would try fix nve/limit first.

If all your atoms are inside the periodic box at time = 0, then
their ix,iy,iz flags will all be 0. Thereafter if any of
those flags is 1 or -1, then the atom crossed a periodic
boundary. Those flags can be accessed by the
compute property/atom command and thus by an atom-style
variable that accesses the compute.

You could define a dynamic group using a variable
that accesses ix,iy,iz and use delete_atoms on that group.

Steve

Hi Andrew,

Thanks very very much for your detailed reply! That is very informative. I am not very familiar with these fix types, so I am starting to read the related docs and trying to find the possible method.

Thanks very much for your help!

Regards,

Liu

Hi Steve,

Many many thanks! That is very helpful. That is exactly what I want. I will try that.

Regards,

Liu