Delete atoms command

ERROR: Illegal delete_atoms command (…/delete_atoms.cpp:68)
I m working on LAMMPS. I m using it first time. my task is to create a crystal with different percentage of vacancy. I have written a input script and try to run the simulation. It is showing this error. Can you help me to write the delete command to create the random vancancy in the periodic crystal which contains 10976 atoms.
#input file for 0.1% vacancy

#initialization
processors 1 1 1
units metal
dimension 3
boundary p p p
atom_style atomic

Read data file

read_data CuStructure.data

#interatomic Potential and simulation settings
timestep 0.001
pair_style eam/alloy
pair_coeff * * Cu01.eam.alloy Cu

neighbor 2.0 bin
neigh_modify every 10

Create vacancies

region Traget block INF INF INF INF INF INF units box
delete_atoms random fraction 0.001 no all target 10946

#run a simualtion
minimize 1.0e-4 1.0e-6 100 1000
velocity all create 700.0 87827 mom yes rot yes dist gaussian

fix 1 all nvt temp 700.0 700.0 0.1
dump 1 all custom 1000 Cu_0.1pct_trajectory.lammpstrj id type x y z
dump_modify 1 sort id
compute msd all msd
fix msd_out all ave/time 1000 1 1000 c_msd[4] file msd_0.1pct.txt mode vector
thermo_style custom step temp pe etotal press vol
thermo 1000
run 100000
unfix 1
undump 1
reset_timestep 0

This is the input script I have tried to write by own. can you help me to wrie the delete command properly. I want to create a vacancy of 1% of total atoms. Also point out the mistakes and guide me for my future work.
Thank You

You would do good to consult the documentation instead of waiting for someone to fix your script, which won’t happen unless it’s a fantastic learning opportunity for both parties. It’s just quicker!

Plus, you don’t need to read the ~3000 pages of the manual. Just head to the delete_atoms command, it’s all written there.
Also, please read the forum guidelines before posting, you will spare us the misery of reading badly formatted code.

Regarding your script, you defined a region Traget and referred to it as target in the following command. It’s pretty easy to make typos, but you could at least proofread your code before jumping to the forum. It’s degrading to ask other people to do it for you.

1 Like

As your guidance I have followed the lammps documentation for writing the delete atoms command.
I rewrite the delete command. As I want to create a vacancy defect in the crystal. suppose I want to create a 0.1% of vacancy and my perfect crystal model consist of 10k atoms. So for that I rewrite the delete atom command but still it is showing the error in delete command

Create vacancies

delete_atoms random 0.001 all_atoms Null 12345

But it is still showing the error. I cannot understand where I m making the mistake.

What about just fixing the typo?

region target block INF INF INF INF INF INF units box
delete_atoms random fraction 0.001 no all target 10946

Also, it seems that you didn’t read the forum rules about formatting your post, providing enough information for other users to reproduce your issue, etc.

#input file for 0.1% vacancy
#------------------------ INITIALIZATION ----------------------
processors * * *
units metal
dimension 3
boundary p p p
#----------------------- PARTICLE DEFINITION ----------------------
atom_style atomic

read_data CuStructure.data

velocity all create 900.0 87287
#remove atoms
#region 1 block EDGE EDGE EDGE EDGE EDGE EDGE side yes
variable delete atom (type==1)*(random(0,1,214365)<0.1)
group delete variable delete
delete_atoms group delete
#delete_atoms random count 110 no all NULL 87287
#----------------------- DEFINE SETTINGS -----------------------
pair_style eam/alloy
pair_coeff * * Cu01.eam.alloy Cu
neighbor 2.0 bin
neigh_modify every 10
#----------------- DEFINE THERMO ---------------------------------
#----------------- SETUP RUN ---------------------------------
timestep 0.001

minimize 1.0e-4 1.0e-6 100 1000

fix 1 all nvt temp 900.0 900.0 0.1
compute msd all msd com yes
fix savemsd all ave/time 1000 1 1000 c_msd[1] c_msd[2] c_msd[3] c_msd[4] file msd.txt mode scalar
dump 1 all custom 1000 Cu_0.1pct_trajctory.lammpstrj id type x y z
dump_modify 1 sort id
thermo_style custom step temp pe etotal press vol
thermo 1000
#----------------- PERFORM RUN ---------------------------------
run 5000000
unfix 1
undump 1
reset_timestep 0

I m posting the correct script without any error. May be helpful for the others to refer in future.
Thank you

1 Like

It’s very good to share a revised script, but you could do better than that: edit your post and enclose the code into triple backquotes. Or, just press the </> button and paste your input script in the preformatted text area.

1 Like