Spin decoherence of magnetic atoms on surfaces