Optically excited structural transition in atomic wires on surfaces at the quantum limit