This page contains a copy of the beta-test code of a new and improved version of the X-ray absorption model tbabs (Wilms et al., 2000). This code is a full rewrite in C that works under Linux and MacOSX.

For fits where the redshift of the absorber is known, the code is 20-30 percent faster than the earlier Fortran version of this updated model, and a factor of about 25(!) faster than XSPEC's built in absorption models phabs or tbabs.

Further updates include an improvement of the cross sections used in the code, allowing the model to be used for spectroscopy with modern X-ray gratings such as Chandra's LETGS or the XMM-Newton RGS in the vicinity of the astrophysically relevant K-edges of oxygen and neon, as well as in the vicinity of the Fe L-edge.

The following three figures illustrate the improvements, the blue line is tbabs, the red lines is the new implementation:

Ne K-edge Fe L-edge O K-edge

(click on the pictures to download a higher resolution version of the figure).


To use the code, download the code tarball and unpack it into a directory of your choice. To compile the model for XSPEC, cd into that directory, enter XSPEC and compile the model:

computer:~/> mkdir absmodel
computer:~/> cd absmodel
computer:~/> tar xzvf tbnew_2.3.2.tar.gz
computer:~/> xspec
XSPEC> initpackage absmodel lmodel_tbnew.dat .
XSPEC> quit
To make the model functions available for fitting in XSPEC, load the model using

XSPEC> lmod absmodel /path/to/the/directory
Here absmodel is the package name. After successful compilation you will find a shared or dynamic library named (on Linux) or libabsmodel.dylib (on Mac). You can choose any name you want here, however, XSPEC requires that the name must not be the same as that of an existing model. In other words: do not use tbnew...

For XSPEC version 12 and under LHEASOFT 6 you can also try to use the script provided with the tarball to install and compile the model.

Contrary to earlier distributions of the model, it now ignores the setting of the XSPEC xsect command as different cross sections need to be patched together smoothly. The model model always uses the cross sections by Verner et al. Note that for best results, you should also switch the abundance setting to the proper ISM abundances, i.e., in XSPEC abund wilm [yes, without an s]).

The following models are provided by the distribution:


This is the standard absorption interface where all parameters are accessible. It is a drop in replacement for the old tbgrain model.

  • nH: The first parameter is the hydrogen equivalent column density in units of 1022 cm-2. For historical values this parameter is called nH, but note that since this is a column and not a number density, the n really should be capitalized, i.e., typeset this as NH (in TeX: $N_\mathrm{H}$).
  • He,..,Ni: For positive values of these parameters, their value describes the abundance of the respective element relative to the current XSPEC abundance set. For negative values of these parameters, the absolute value of the parameter is the total column of that element. Use this feature with caution, since columns will typically be on the order of 1016cm-2 and higher. Parameters with such large values can destabilize the minimization algorithms in typical data analysis programs. Experience shows that in general the feature works well, though.
  • H2: Fraction of hydrogen present in molecular form as H2.
  • rho,amin,amax,PL: The density, minimum, and maximum radius of the power law dust distribution. PL describes the power law index of the distribution.
  • H_dep,...,Ni_dep: A number describing the depletion of the element. For historic reasons the parameter name is somewhat misleading, the number is the depletion factor, which is the fraction by number of the atoms of the given element which are in the gas phase.
  • redshift: The redshift of the absorber. In order to profit from the speed improvements of the model, you should freeze this parameter. Leave only open if you really, really need to fit the redshift.


Drop-in replacement for tbabs, phabs, and wabs, and much faster than these models. This model switches off the shielding of the grains, i.e., the assumption is that all material along the line of sight is in neutral gas.


A partial covering model implementation of tbnew. All parameters (dust, gas) are on their default values per the Wilms et al. paper. The parameter pcf is the partial covering fraction, which is between 0 (no covering) and 1 full covering.


This is a simplified interface in which only the absorption column and the columns for O and Fe, and the redshift are free parameters. The dust parameters are on their default values.


This model has the full interface, but the interpretation of the abundances is different in that this model also allows ``negative'' NH. Use this, e.g., if you want to measure changes in column relative to an average column. For example, you can fit a model such as tbrel*tbabs*continuum, where all values of tbabs are frozen at the average column of the source. If the fit results in a negative column for NH during that observation, then the total column of the source is less than the average.


Please note the following caveats:
  • Due to the possibility of bug fixes / updates, please do not circulate the code but point interested people to this web page. If using the code in your publications, please provide a pointer to this URL.
  • Please notify Jörn Wilms if you want to be informed of updates to this code.
  • The new edge structures are used for bound and free atoms. This is not entirely correct. At the highest resolution the shape of the edges produced in solids depends on X-ray fine structure effects that are strongly dependent on the elemental composition of dust. In addition X-ray extinction effects are also not yet included. See Corrales et al. (2016), Hoffman and Draine (2016), Smith et al. (2016), and Lee et al., 2009 for more information. A unification of these models is work in progress.
  • The models do not include the effects of ionization in the ISM. This should be ok for moderate resolution spectra and for the continuum modeling of gratings spectra. For the highest precision modeling of gratings spectra, there are more advanced models available that take care of this (Gatuzz et al., 2015, 2016). The continuum absorption is less affected, since it is dominated by photoabsorption in the K-shell, which has a bound-free cross section that for higher Z elements only mildly depends on ionization state.

This code has been developed over the years in collaboration with Richard McCray (CU Boulder / UC Berkeley), Adrienne U. Allen (CU Boulder), Adrienne M. Juett (GSFC), Norbert S. Schulz (MIT), Michael A. Nowak (MIT), Julia C. Lee (Harvard), and Lia Corrales (MIT).

Input and bug fixes came from a large number of colleagues, including Keith Arnaud, Tobias Beuchert, Thomas Dauser, Javier Garcia, Manfred Hanke, Felicia Krauss, Jon Miller, Jukka Nevalainen, Delphine Porquet, Katja Pottschmidt, and John Tomsick.


  • 2016 April 27: Version 2.3.2: fixed a memory leak. Thanks to Carlo Ferrigno for finding this.
  • 2016 April 26: Version 2.3.1: fixed issue affecting some users using redhat (calls to fgabnd cause errors; problems fixed by calling the C-version of that function directly rather than going via the Fortran interface). Thanks to Anne Lohfink and Roderick Johnstone for useful input here.
  • 2016 April 13: Version 2.3: rewrite in C. Further improvement of speed by 30 percent. Fixed some obscure errors.
  • 2014 June 14 - Version 2.2: added tbnew_pcf model.
  • 2012 June 08: fixed an error in tbnew_feo that caused slightly wrong absorption (effectively all elements were depleted into 1mum radius dust grains with a density of 1g/cc). now tbnew_feo (correctly) uses the default dust parameters from Wilms et al.
  • 2011 September 08: added a new model, called tbnew_feo which has only the nH, Fe, O and redshift parameters to make life easier for people who do not like XSPEC's show free command.
  • 2009 April 09: The H2 fraction and the depletions are now fixed between 0 and 1 (they were fixed through hard bounds in the lmodel.dat but this could be overridden, resulting in meaningless results). Thanks to Jukka Nevalainen for pointing out this issue.
  • 2009 February 05: When setting nH and the He through Ni parameters to NEGATIVE values, the parameters are now considered to be the column in that element. Note that to make this to work you will have to set the minimum and maximum fitting ranges to a negative range. This option makes the fitting of edges in gratings spectra in order to determine the column much more convenient.
  • 2009 January 22: The code now compiles also when the pedantic-flag of g77 is set.