Atom search in neighbor list

Hi everyone,
I want to go through all the atoms in the simulation and change the atom type of those close to a certain type of atom. I want to know if there is a method to just go through the atoms in the neighbor list of the atom I choose instead of going through all atoms.
I would be really thankful if you could guide me with this issue.

From C++ or in input file?

Input file.

Not possible, and even if possible, not recommended. All operations in the input file are global, i.e. the whole procedure would be serialized and executing script lines is slow. The best solution is to write a custom fix style or compute style. E.e. compute coord/atom loops over neighbors, but you would need to modify it to change the atom type of the neighboring atoms, since it currently just counts the neighbors within a cutoff and then assigns the value to the central atom.

EDIT: Depending on your atom style, you may need to use pair style hybrid/overlay with pair style zero full, so you get access to a full neighbor list. With the half neighbor list, things get complicated since you need to do a forward communication.

The closest to writing this as input file would be to use a python function and then load the python module. But that would probably be more programming than modifying compute coord/atom.

What about:

compute 1 coord/atom mutable cutoff 3.0 5
# particles in group "mutable" within distance 3.0 
# of particle type 5 will have c_1 >= 1.
# You are responsible to make sure you exclude type 5 particles
# from the initial group "mutate" so you don't mutate those.
run 0 # initialize compute
variable mutateflag atom c_1
group mutate variable mutateflag
set group mutate type 4

Thank you so much for your advice. I will try implementing this via python. If I can get any results, I will share with everyone.

Nice idea. Thanks a lot. But the total number of groups is limited. This will cause problem if I choose a lot of atoms. Maybe python is the only way to implement this.