Spatial coding and attractor dynamics of grid cells in the