removed unnecessary loop for calculation of the 'neighbour' variable. This variable may be unnecessary itself, but I need to rewrite the code first and make it shorter in order to understand it.

introduced parameters 'r' and 'delta'