pro tmatrix_idl_call2,wave,index,rad,ar, ex,sc,ab ;---------------------------------------------------------------------------------- ; Feed data into the fortran tmatrix routine ; ; Input (all scalars): ; wave......wavelength (microns) ; index.....complex refractive index ; rad.......particle radius (microns) ; ar........axial ratio (>1 = oblate) ; ; Output: ; ex.......extinction cross section (microns^2) ; sc.......scattering cross section (microns^2) ; ab.......absorption cross section (microns^2) ; ; Source: Mark Hervig ;---------------------------------------------------------------------------------- ex = 0.0 sc = 0.0 ab = 0.0 if ( float(index) gt 0.0) then begin pat = '/users/mhervig/fortlib/t-matrix/' filei = pat + 'tmatrix_idl_in.txt' fileo = pat + 'tmatrix_idl_out.txt' ;- Write the input parameters to a file as input for "tmatrix_idl.f" openw,lu,filei,/get_lun printf,lu,format='(5e15.6)', wave,float(index),imaginary(index),rad,ar close,lu free_lun,lu ;- Run the Tmatrix fortran spawn,pat + 'tmatrix_idl' ;- Read the file written by the Tmatrix fortran openr,lu,fileo,/get_lun readf,lu,ex,sc close,lu free_lun,lu ab = ex - sc endif ;- done end