Electronic structure calculations of metal-nanotube contacts with or without oxygen adsorption