Density functional study of the metallization of a linear carbon chain inside single wall carbon nanotubes