A spectral analysis method of obtaining molecular spectra from classical trajectories