properly handle the case of neighbor lists never been computed before
(cherry picked from commit fcba14a0aa976af3a7a177115f4e506df3d37b53)