calculate spring force by sorting particles.