code for CMC spectra; note: not optimised, need to sort out normalisation with lam