Real and imaginary part of the heavy ion optical potential from a realistic nucleon-nucleon interaction