Cosine law at the atomic scale: toward realistic simulations of Knudsen diffusion.