Exploration of the potential acting on an electron within diatomic molecules