Quantum mechanical treatment of molecules. Part 2.—Calculation of the potential energy curves and molecular constants of the X2Σ+, A2Π and B2Σ+ ionized states of CO