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.