The shape memory effect of Ni2MnGa is closely related to the fact that the material undergoes a martensitic phase transition, which results in symmetry reductions and deformations when cooling down. However, there are still substantial uncertainties about the phase diagram in the martensitic phase. Particularly challenging is the determination of those phases, which are characterized by shuffling structures. We have applied density functional theory to this problem, which allows an accurate determination of the potential energy surface as a function of the lattice constants. Based on these results we compute ab initio phonon spectra and discuss in detail how they can be used to extract detailed information about the type of shuffling structures and to systematically and efficiently identify stable atomic configurations.