An optical potential for heavy ion interactions