optimized code using grid but still have to apply optimization described on Intel's website so that each particle is visited only once