procedure to calculate neighbors in an outer layer