Diffusion induced stress and the distribution of dislocations in a nanostructured thin film electrode during lithiation