The potential energy curves of B2 and B19′ phase for NiTi alloys were investigated with the norm-conserving and plane-wave ultrasoft pseudopotential in the local density approximation. Our results reveals that the B19′ phase is more stable than the B2 phase at absolute zero temperature due to lower potential energy of the former. In the B2 phase, the alloying atoms Au and Fe (at Ni site) occupy the equilibrium positions, whereas Ti, Zr and Al (at Ti site) and Ni atoms are displaced from their equilibrium positions. In the B19′ phase, all the above atoms are exactly located at the equilibrium positions. The martensitic transformation may mostly be ascribed to the non-global minimum positions that the Ni and Ti atoms occupy.