New method for searching for neighbors in molecular dynamics computations