changing the atom type of those atoms that meet a certain condition during a run

Hello soheil. I see two possible ways.

  1. Writing your own compute.

  2. Another way is to break the simulation into series of short runs and use if command (as you figured out already) to identify the contacting items.

I can elaborate on the second method if you would like.

Hope this helps.
Others might have better ideas.

Good luck
Arun

Hello soheil. I see two possible ways.

1. Writing your own compute.

​compute won't do. a compute is an entity triggered by a "consumer".
for something to be done periodically, you need to use a fix.​