Semi-microscopic approach to the imaginary part of the heavy ion optical potential