The ground state of the antiferromagnetic semiconductor YBa2Cu3O6: electronic structure calculations and analysis of X-ray spectra