start of diffusion calc function