An IDL interface for the Mishchenko and Travis T-Matrix Code
The routines offered here provide a simple, platform independent way to call the T-matrix fortran code from IDL.
In this approach, the IDL interface writes an acsii file of input parameters for the T-matrix fortran, then runs the T-matrix fortran (using "spawn"). The fortran reads this file, performs the calculations, then writes another ascii file. The IDL interfaces reads this file and returns the parameters to the calling routine.
The code here is hard-wired for calculations of single randomly oriented spheroid particles. Changing this would be easy after some investigation of the code. The original T-matrix fortran is available from NASA GISS.
The alternative to the above approach is to create an IDL DLM, which can be very challenging.
Instalation and use:
1) Create a single directory where the code, executable, and interface files can reside.
2) Download the 5 routines beow (right click save as):
3) Change the path for the input and output files in
"tmatrix_idl.f" (lines 29-30) and in "tmatrix_idl_call2.pro" (line 27, this also gets the fortran executable path), to the chosen directory, ensuring they are consistent in both routines.
4) Make the fortran executable: gfortran -o tmatrix_idl tmatrix_idl.f tmd.lp_sub.f lpd.f (or try an executable (right click "save as") compiled on a Mac Core 2 Duo)
Note: running more than one instance of the IDL interface will cause major problems, as they will overwrite the interface files!
wave = 3.0 ; wavelength in microns index = complex(1.2,0.1) ; refractive index rad = 20e-3 ; particle radius in microns ar = 2. ; axial ratio of a spheroid
print, ex,sc,ab ; these are the extinction, scattering, and absorption cross sections (microns^2)