Magnetic and electronic properties of a single iron atomic chain encapsulated in carbon nanotubes: A first-principles study