The thermoelastic-plastic transition in metals