Microscopic derivation of a complex heavy ion potential