Formation of metastable hydrogen atoms by charge transfer