Skip to end of metadata
Go to start of metadata



pyRate is a Python program that reads in a set of chemical reactions and integrates those equations to solve the time evolution of chemical abundances. The rates can be given in the UMIST99 or in the new UMIST06 format. As the original UMIST programs, pyRate writes a separate routine for the calculation of the time derivatives of the abundances. By default this is a normal python subroutine. However, if one has installed gcc compiler and pyrex packages, pyRate will write a c-subroutine that will be compiled and called via a pyrex wrapper. The resulting program will be much faster than the pure python one. The set of equations is solved using the ODE solver included in the scipy package. Apart from scipy, pyRate requires the numpy and, for plotting, the matplotlib libraries. These are all included in the repositories of major Linux distributions.


The program is a single Python script and requires no special installation. All necessary file (apart from the rate-file) should be contained in the following zip-package. Note: the program included in the zip is quite old. For any serious use, please contact the author for a more up to date version.

One can instruct the program to write and use c-subroutine (see above) by setting USE_PYREX = True at the beginning of the script Hopefully, with the help of the makefile and and the header file c_ydot.h, all included in the zip, the program is able to compile the rate equations into a shared library. This has been tested only on Linux and only with the gcc compiler. If pyRate creates a library but does not appear to be able to use it, you may have to add the current working directory to the search path for libraries (e.g., "setenv LD_LIBRARY_PATH ./").


The simplest usage is 'python rates.dat', where rates.dat is a file containing reactions and their rate coefficients in the UMIST format. Usually one would rather use an ini-file that specifies the rate file together with the values of some other parameters. Here is an example of the contents of a possible ini-file:

 crp          1.0                   # scaling of default cosmic ray flux
 Av           10.0                  # shielding as visual extinction
 T            10.0                  # kinetic temperature
 Omega        0.6                   # grain albedo
 GR           2.0e-17               # dust grain number density
 DN           1.0e6                 # total density
 rates        input.rates.W         # the rate file
 blacklist    blacklist.dat         # file listing equation numbers for equations to be dropped
 species      selected_species.dat  # file listing included species (default = all)
 abundances   default.abundances    # file specifying initial abundances
 plot         oH2 pH2 H H+          # species to plot
 time         100.0e6 50            # end of integration [years] and number of time steps
 trange       5.0 210.0             # drop equations for which the valid temperature range
                                    # does not intersect with this range (UMIST-06 format rate-files only)

The keywords are not case sensitive but they should be written out as shown, without abbreviating. All keywords apart from rates are optional and have some default value. It is preferable to prepare a rate file that includes only the reactions one wants to use and only the species one needs. However, using blacklist one can drop selected equations. The file (in the example blacklist.dat) lists numbers of unwanted equations (as given in the first column of the rate file), one number per line. With species one can specify a set of species that are to be included in the calculation. All other species and all reactions involving other species are dropped. With abundances one specifies initial abundances. The associated file contains lines with the name of a species followed by the initial relative abundance. For all species not included in the file, the abundance is set to zero. If the keyword abundances is not used, default abundances are set for elements (see code, looking for variable EL_ABU). They should be equal to what would be set with default.abundances containing the following data.

 H     1.0
 He    0.14
 C     7.3e-5
 N     2.14e-5
 O     1.76e-4
 F     2.0e-8
 Na    2.0e-9
 Mg    3.0e-9
 Si    3.0e-9
 P     3.0e-9
 S     2.0e-8
 Cl    4.0e-9
 Fe    3.0e-9

Finally, a valuable quote from the program source

There is not guarantee, apart from the testing you make yourself, that the program does what you think it should do.


  • No labels