Ab initio model potentials and their application to the thermal stability of metal clusters