RADEX


Radex is a computer program to calculate the strengths of atomic and molecular lines from interstellar clouds which are assumed to be homogeneous. Everyone is free to use the program, provided that publications make a reference to our paper: Van der Tak, F.F.S., Black, J.H., Schöier, F.L., Jansen, D.J., van Dishoeck, E.F., 2007, A&A 468, 627-635. This web page describes the off-line version of RADEX; click here to go to the on-line version.

Jump to: introduction    installation   running Radex  molecular data input   output files   scripting Radex  revision history
 

Installation

These instructions apply to the Unix / Linux C-shell. Installation from other Unix shells (bourne, bash) and Mac OSX (Darwin) should be similar, except for the syntax of the set path command. The MS Windows system is not supported at this point, but compiling and running the Fortran code under Windows is possible.

  1. Download the distribution file by following this link.

  2. Unzip and untar the distribution file:

    > gunzip radex_public.tar.gz
    > tar xf radex_public.tar
    This creates a directory Radex with subdirectories src, bin, and data.

  3. Customize your setup:

    -- go to the src subdirectory
    -- edit the file Makefile to select a Fortran compiler (g77 / gfortran / ifort / ...)
    -- edit the file radex.inc to locate the molecular data area, to customize the name of the log file, and to select a geometry for the escape probability

  4. Create the executable from the source code:

    > cd Radex/src
    > make
    > cd

  5. Include the directory Radex/bin to your path by adding the following line to your .cshrc (or equivalent) file:

    > set path = ( $path $HOME/Radex/bin )
    (To proceed within the same shell, follow this command by "rehash".)

  6. Verify that the program runs and produces correct output:

    > cd ..
    > radex < example.inp

    > diff example.out standard.out
    The only difference between the two files should be the Radex version.

  7. Try it yourself:

    > cd ..
    > radex

Jump to: introduction    installation   running Radex  molecular data input   output files   scripting Radex  revision history
 

Running Radex

Radex can be run in three ways: (1) from the command line; (2) through an input file; (3) using a script. In the first case, simply type "radex" and answer the questions. The third case, using scripts, is described below. To run Radex from a file, type "radex < radex.inp", where the file radex.inp looks like this.

hco+.dat

file containing molecular data (see here)

hco+.rdx

file to write output to (will overwrite)

50 500

output frequency range (GHz; 0 0 means unlimited)

20

kinetic temperature (K)

2

number of collision partners (see under Details)

H2

first collision partner

10000

density of first collision partner (cm-3)

e

second collision partner

1

density of second collision partner (cm-3)

2.73

temperature of background radiation (K; see under Details)

1e12

molecular column density (cm-2)

2.0

line width (km/s)

1 (or 0)

run another calculation (or not)

Details:

Background temperature: A positive value means a blackbody spectrum at that temperature (such as the CMB); zero means the average interstellar radiation field taken from Black (1994); a negative value means a user-supplied list of observed flux densities (see below). For more advanced background fields, write your own subroutine and compile it into the code.

Collision partners: A maximum of seven collision partners may be defined: H2, p-H2, o-H2, electrons, H (atoms), He, and H+. Make sure that the data file contains collisional rate coefficients for all partners for which densities are given here. In most cases, using H2 as only partner is a good default. When H2 is given as collision partner for CO, a thermal average of ortho and para H2 is taken.

Jump to: introduction    installation   running Radex  molecular data input   output files   scripting Radex  revision history


Self-made background radiation field:

The format of the input file is: a descriptive one-liner on line 1, the number of points (N) on line 2, and on the next N lines the wavenumber (cm-1), the intensity (Jy/nsr) and the dilution factor (0 < W < 1) of the background radiation field, as in the example below. Proper sampling of realistic radiation fields typically requires 100 – 300 points. The points must be in increasing wavenumber order, and the radiative intensity must be >0 at any wavenumber.



# Example radiation field



6



0.3

4e-2

0.5

1

0.26

0.5

3

2.0

0.5

10

13.0

0.5

30

14.3

0.5

100

2e-2

0.5



Molecular data

Files with molecular data (term energies, statistical weights, Einstein coefficients, and rate coefficients for collisional deexcitation) must be placed in the subdirectory Radex/data. For many molecules of astrophysical interest, the LAMDA database provides data files in the required format. For molecules for which no collisional data exist, users need to make their own files. The databases at NASA-JPL and in Cologne provide spectroscopic data for many molecules. For collisional rate coefficients, consult NASA-GISS for the calculations of Sheldon Green, or the literature in the BASECOL and CASSIS databases for other work. Unfortunately, collisional data do not exist for all molecules of (potential) astrophysical interest. If you know about calculations that are not in the LAMDA database, please let us know!

The public distribution of Radex contains one example file (hco+.dat) in the data directory. If you need to make your own file, here is a detailed description of the required file format. Note that the same files are used by the Monte Carlo radiative transfer program Ratran. The format can be used for all molecules, whether linear (HCO+) or not (H2O). The lines that start with an exclamation mark (!) are not read by the program.


% Lines 1 - 2: molecule name
% Lines 3 - 4: molecular weight (a.m.u.)
% Lines 5 - 6: number of energy levels (NLEV)
% Lines 7 - (7+NLEV): level number, level energy (cm-1), statistical weight. These numbers may be followed by additional info such as the quantum numbers, which are however not used by the program. The levels must be listed in order of increasing energy.
% Lines (8+NLEV) - (9+NLEV): number of radiative transitions (NLIN)
% Lines (10+NLEV - (10+NLEV+NLIN): transition number, upper level, lower level, spontaneous decay rate (s-1). These numbers may be followed by additional info such as the line frequency and upper state energy, which is however not used by the program.
% Lines (11+NLEV+NLIN) - (12+NLEV+NLIN): number of collision partners
% Lines (13+NLEV+NLIN) - (14+NLEV+NLIN): collision partner ID and reference. Valid identifications are: 1=H2, 2=para-H2, 3=ortho-H2, 4=electrons, 5=H, 6=He, 7=H+.
% Lines (15+NLEV+NLIN) - (16+NLEV+NLIN): number of transitions for which collisional data exist (NCOL)
% Lines (17+NLEV+NLIN) - (18+NLEV+NLIN): number of temperatures for which collisional data exist
% Lines (19+NLEV+NLIN) - (20+NLEV+NLIN): values of temperatures for which collisional data exist
% Lines (21+NLEV+NLIN) - (21+NLEV+NLIN+NCOL): transition number, upper level, lower level; rate coefficients (cm3s-1) at each temperature. RADEX interpolates between rate coefficients in the specified temperature range. Outside this range, it assumes the collisional de-excitation rate coefficients are constant with T, i.e., it uses rate coefficients specified at the highest T (400 K in this case) also for higher temperatures, and similarly at temperatures below the lowest value (10 K in this case) for which rate coefficients were specified.

Example molecular data file: HCO+

!MOLECULE

HCO+

!MOLECULAR WEIGHT

29.0

!NUMBER OF ENERGY LEVELS

21

!LEVEL + ENERGIES(cm^-1) + WEIGHT + J

1 0.000000000 1.0 0

2 2.975008479 3.0 1

(etc)

21 624.269300464 41.0 20

!NUMBER OF RADIATIVE TRANSITIONS

20

!TRANS + UP + LOW + EINSTEINA(s^-1) + FREQ(GHz)

1 2 1 4.251e-05 89.18839570

2 3 2 4.081e-04 178.37481404

(etc)

20 21 20 4.955e-01 1781.13802857

!NUMBER OF COLL PARTNERS

1

!COLLISIONS BETWEEN

1 H2-HCO+ from Flower (1999)

!NUMBER OF COLL TRANS

210

!NUMBER OF COLL TEMPS

12

!COLL TEMPS

10.0 20.0 30.0 50.0 70.0 100.0 150.0 200.0 250.0 300.0 350.0 400.0

!TRANS + UP + LOW + COLLRATES(cm^3 s^-1)

1 2 1 2.6e-10 2.3e-10 2.1e-10 2.0e-10 1.9e-10 1.8e-10 2.0e-10 2.2e-10 2.3e-10 2.5e-10 2.7e-10 2.8e-10

2 3 1 1.4e-10 1.2e-10 1.1e-10 1.0e-10 9.2e-11 8.8e-11 8.4e-11 8.2e-11 8.1e-11 8.3e-11 8.1e-11 8.5e-11

(etc)

210 21 20 3.7e-10 3.6e-10 3.6e-10 3.5e-10 3.5e-10 3.5e-10 3.8e-10 4.0e-10 4.4e-10 4.7e-10 5.0e-10 5.2e-10

Jump to: introduction    installation   running Radex  molecular data input   output files   scripting Radex  revision history
 

Radex output

The output files from Radex start with a summary of the input parameters, followed by a line-by-line listing of upper state energy (K), frequency (GHz), wavelength (micron), excitation temperature (K), optical depth, peak intensity (K), and line flux (both in K km/s and in erg/s/cm2 units). Note that the two columns with “flux” do not quite give the same quantity: the flux in K*km/s is an integrated surface brightness, while the value in erg/s/cm2 is an isotopic flux emitted in all directions. To compare the latter with observed brightness, multiply by (beam area / 4pi) if the source is unresolved, or by (pixel area / 4pi) if it is resolved. The areas should be in steradian units.

Here is an example for HCO+ between 50 and 300 GHz:

* Radex version:

26jun06

* Geometry:

Uniform sphere

* Molecular data file:

HCO+

* T(kin) [K]:

20.000

* Total density [cm-3]:

1.000E+04

* T(background) [K]:

2.730

* Column density [cm-2]:

1.000E+13

* Line width [km/s]:

1.000

LINE

E_UP

FREQ

WAVEL

T_EX

TAU

TR

FLUX

FLUX


(K)

(GHz)

(um)

(K)


(K)

(K*km/s)

(erg/cm2/s)

1 -- 0

4.3

89.1884

3361.3393

4.505

4.686E+00

1.557E+00

1.657E+00

1.514E-08

2 -- 1

12.8

178.3748

1680.6883

3.769

5.300E+00

5.927E-01

6.309E-01

4.612E-08

3 -- 2

25.7

267.5573

1120.4795

3.724

8.856E-01

1.789E-01

1.905E-01

4.698E-08

Jump to: introduction    installation   running Radex  molecular data input   output files   scripting Radex  revision history
 

Scripting Radex

To use Radex to fit model parameters to observational data, or explore parameter space, the best strategy is probably to write a script that makes repeated calls to Radex. The directory Radex/bin contains two examples, written in the Python scripting language:

  1. radex_column.py models the observed strength of a molecular line, The input parameters (temperature, density, and observed line strength and width) are specified at the top of the file. The program returns the best-fit value of the column density to the screen.

  2. radex_grid.py calculates the ratio of (sets of) two molecular lines as a function of temperature and density. The column density and background temperature are kept constant. The result is written to file and may be plotted using any standard plotting program.

Jump to: introduction    installation   running Radex  molecular data input   output files   scripting Radex  revision history
 

Revision history

29 aug 2007

Initial public offering

23 apr 2008

Added populations and number of iterations to output file; re-formatted log file

13 aug 2008

Made radex_grid script compatible with 23apr08 changes
and fit for molecules with separate ortho/para-H2 collision rates

06 oct 2008

Increased maximum number of collision temperatures to 25;
built in checks that such array sizes are not exceeded;
defined a maximum number of iterations in radex_column.py script.

20 nov 2008

User can now customize the name of the log file
(important to get on-line version running)

18 dec 2008

Changed default line width in radex_column script from 2.73 to 1.0 km/s (a typo).
Thanks Matthijs van der Wiel.

22 jan 2009

increased array sizes to accommodate H2O rovib rates

27 apr 2009

added checks for illegal level / line / collision numbers & for negative line frequencies to readdata.f

24 aug 2011

solved bug in background radiation field: set totalb equal to backi in options 2 and 3 of subroutine backrad. Thanks Simon Bruderer.

30 nov 2011

1. split off local contribution to radiation field (speeds up convergence)

2. implemented underrelaxation (else convergence overshoots)

3. use eps (not zero) as a floor to background radiation field (improves stability)

Thanks Simon Bruderer.