First-principles calculations have been employed to examine the possible use of electron energy loss spectroscopy (EELS) as a tool for determining the presence of OH groups and hence hydrogen content in compounds. Our density functional theory (DFT) based calculations describe accurately the experimental EELS results for forsterite (Mg 2 SiO 4 ), hambergite (Be 2 BO 3 (OH)), brucite (Mg(OH) 2 ) and diaspore (α-AlOOH). DFT calculations were complemented by an experimental time resolved study of the oxygen K-edge in diaspore. The results show unambiguously that there is no connection between a pre-edge feature in the oxygen K-edge spectrum of diaspore and the presence of OH groups in the structure. Instead, the experimental study shows that the pre-edge feature in diaspore is transient. It can be explained by the presence of molecular O 2 , which is produced as a result of the electron irradiation.