Thermodynamics of rare earths in steelmaking