Simulating the diffraction line profile from nanocrystalline powders using a spherical harmonics expansion