First principles study of work functions of single wall carbon nanotubes.