Technique for the sp2/sp3 characterization of carbon materials: Ab initio calculation of near-edge structure in electron-energy-loss spectra