Optimal Representation of the Nuclear Ensemble: Application to Electronic Spectroscopy.