An ab initio study of the Bain strain and orthorhombic distortions in
the TiM compounds (M = Ni, Cu, Rh, Pd, and Ag) shows that the B2 struc
ture of the shape memory alloy TiNi, unlike that of the other TiM comp
ounds, is stable against these distortions, and that TiNi has some fla
t total energy minima. A thermodynamic model, built on these findings,
displays some features of the shape memory effect. An electronic stru
cture analysis reveals the importance of the Ni metallic bonding to th
e B2 phase stability and to the detwinning mechanism.