Hysteresis in metal–hydrogen systems