The electronic structure and spectra of the X1S+g and A 1S+u states of Li2