Formation of gold nanowires with impurities: a first-principles molecular dynamics simulation.