Calculates cold D-alpha emission
subroutine cold_spec
!+ Calculates cold D-alpha emission
integer :: ic, i, j, k, it, ncell
real(Float64), dimension(3) :: ri, vhalo, random3
integer,dimension(3) :: ind
!! Determination of the CX probability
type(LocalProfiles) :: plasma
real(Float64) :: cold_photons
integer :: n = 10000
!$OMP PARALLEL DO schedule(dynamic,1) private(i,j,k,ic,ind, &
!$OMP& cold_photons, ri, vhalo, random3, plasma)
loop_over_cells: do ic = istart, spec_chords%ncell, istep
call ind2sub(beam_grid%dims,spec_chords%cell(ic),ind)
i = ind(1) ; j = ind(2) ; k = ind(3)
ri = [beam_grid%xc(i), beam_grid%yc(j), beam_grid%zc(k)]
call get_plasma(plasma, pos=ri)
cold_photons = plasma%denn(3)*tables%einstein(2,3)
if(cold_photons.le.0.0) cycle loop_over_cells
do it=1, n
!! Cold Spectra
call randn(random3)
vhalo = plasma%vrot + sqrt(plasma%ti*0.5/(v2_to_E_per_amu*inputs%ai))*random3
call store_photons(ri, vhalo, cold_photons/n, spec%cold)
enddo
enddo loop_over_cells
!$OMP END PARALLEL DO
#ifdef _MPI
!! Combine Spectra
call parallel_sum(spec%cold)
#endif
end subroutine cold_spec