Molecular dynamics simulation and crystal-field theory : predicting the optical spectra and structure of rare-earth doped inorganic glasses