
; At the QUB APA webpage the collision strengths for the ground
; configuration transitions are presented in individual files
; which I've downloaded into files of the form hudson_1_2.txt,
; hudson_1_3.txt, etc.
;
; The routine below reads these files and writes them out to CHIANTI
; format.
;
; Since Hudson provided only LS energies, I've had to
; artificially split these using the observed energy splittings. 

openw,lout,'ca_6.upsdat_hudson',/get_lun

n=21

;
; theoretical energy levels.
;
en=[0.,0.2622-0.00375,0.2622,0.4309-0.00507,0.4309]

printf,lout,format='(i3)',n

data=fltarr(2,21)

FOR i=1,4 DO BEGIN
  FOR j=i+1,5 DO BEGIN
    fname='hudson_'+trim(i)+'_'+trim(j)+'.txt'
    openr,lin,fname,/get_lun
    readf,lin,data
   ;
    printf,lout,format='(2i5,f10.6,21e10.3)',i,j,en[j-1]-en[i-1],10.^data[0,*]
    printf,lout,format='(2i5,e10.3,21e10.3)',i,j,0.,data[1,*]
   ;
    free_lun,lin
  ENDFOR
ENDFOR

printf,lout,'-1'
printf,lout,'%file:  ca_6.upsdat'
printf,lout,'%Compiled for the CHIANTI database by Peter Young, 22-Jul-2009'
printf,lout,'%Theoretical energy levels:'
printf,lout,'     Hudson, CE, 2009, Phys. Scripta, 79, 035301'
printf,lout,'%Upsilons:'
printf,lout,'     Hudson, CE, 2009, Phys. Scripta, 79, 035301'
printf,lout,'%Comment:'
printf,lout,'  Hudson only gave LS energies (which I have taken from her 1863 configuration'
printf,lout,'  calculation in Table 3), and I have used the observed energy splittings from '
printf,lout,'  the .elvlc file to split the 2D and 2P terms. The observed energy splitting has'
printf,lout,'  been subtracted from the LS energy to derive the energy of the low-J component'
printf,lout,'  of the term.'
printf,lout,'-1'

free_lun,lout

END
