GADGET-2: A Code for Cosmological Simulations of Structure Formation