A martensitic phase transition exhibiting shape memory, transformation-induced plasticity, or superelasticity typically involves a transformation between a high temperature, high symmetry phase and a low temperature, low symmetry phase. There have been numerous attempts using molecular dynamics to simulate the shape memory behavior, where the memory is stored in a twinned martensite and deformation occurs by motion of twin boundaries. However, the 3D case has always proved elusive, because suitable interatomic potentials to produce a unique low temperature phase are difficult to obtain. Here we present a study in which the binary Morse potential is tuned specifically to maximize the difference between L1 0 and B19 (Strukturbericht notation, spacegroups P4/mmm and Pmma) structures. The twinned structure of martensite has been induced by gradually cooling the sample below the transition temperature. A bar-shaped sample was plastically deformed in the martensite phase, and on reheating above the transition temperature the initial shape was recovered. The effect of the shear-induced phase transition on the nanostructure of resulting martensite has also been investigated. An unusual discovery is that of a hierarchy of twins: nanotwins accommodate the mismatch between austenite and martensite at the habit plane, while dynamically created macrotwins are responsible for the deformation behavior and shape memory.