Example :

https://docs.lammps.org/Python_neighbor.html