Simon Jeffery's Software Store

Library Documentation

TAP: Theoretical Astrophysics Library.

The Theoretcial Astrophysics subroutine library provides constants and functions commonly used in astrophysical modelling. It began in 1992 as a joint project between CCP7 and Starlink, initiated by Simon Jeffery and Paul Rees. The coding, documentation and testing standards were intended to be rigorous, which meant that there has been very little growth of the library since the initial definitions.

The modules have been grouped into a number of chapters. Fundamental constants are obtained by either am INCLUDE or USE statement pointing to the relvant module. See the on-line documentation for a complete list of the constants provided. Chemical symbol names and atomic numbers can be translated, cosmic abundances of elements and nuclides are also provided. Basic physics functiosn provide ionisation potentials, partitiion function and solutions of Saha's equation. Finally, a collection of mathematical functions provide some useful additional quantities used in radiative transfer calculations.

Full documentation is provided in the source code for each subroutine, and is also available online by following the links below.

Suggestions for extending the functionality of the library, and bug reports are welcome at any time and may be addressed to Simon Jeffery,

Caution: By convention (nearly) all units are SI.

Starlink Fortran 77 released.
Fortran 90 in preparation.

TAP: Quick Reference

TAP Global constants

MODULE TAP_PAR TAP public global constants.
MODULE TAPM_PAR TAP public mathematical constants.
MODULE TAPP_PAR TAP public physical constants.
MODULE TAPA_PAR TAP public astronomical constants.
MODULE TAPC_PAR TAP public chemical constants.
MODULE MCH_PAR Machine-dependent constants.

Elementary chemical functions

SUBROUTINE TAP_ESYMB ( IZ, SYMBOL, STATUS ) Return the element symbol.
SUBROUTINE TAP_ENAME ( IZ, NAME, STATUS ) Return the element name.
FUNCTION TAP_EMASS ( IZ ) Return the mean atomic weight of an element.
FUNCTION TAP_ZELEM ( NAME ) Return the atomic number of an element.
FUNCTION TAP_AELEM ( NAME ) Return the mean atomic weight of an element.

Cosmic abundances

SUBROUTINE TAP_ABINI ( TAP_ABUND, STATUS ) Initialise the elemental abundances.
FUNCTION TAP_ABMET ( ZELEM ) Return the relative meteoritic abundance for a given element.
FUNCTION TAP_ABSOL ( ZELEM ) Return the relative solar photospheric abundance for a given element.
FUNCTION TAP_ABCOS ( ZELEM ) Return the relative cosmic abundance for a given element.
FUNCTION TAP_ABNUC ( ZELEM, AELEM ) Return the solar system abundance for a given nuclide.

Equation of state

SUBROUTINE TAP_SAHA ( ZELEM, TEMP, NEL, ION_MIN, ION_MAX, U, CHI, IONFRN, STATUS ) Calculate relative abundances of ions of species K.
FUNCTION TAP_PARFN ( ZELEM, ZION, TEMP, PEL ) Calculate the partition function for a given ion, at a given temperature and electron pressure.
FUNCTION TAP_IONPT ( ZELEM, ZION ) Provides ionisation potential for a given ion.

Mathematical functions

FUNCTION TAP_GAMMA ( X, STATUS ) Evaluate the gamma function Gamma (x) for a real argument.
FUNCTION TAP_GAMMLN ( X, STATUS ) Evaluate the gamma function ln Gamma (x) for a positive real argument.
FUNCTION TAP_FACTRL ( N , STATUS ) Return the value of factorial N, i.e. N! as a floating point number


SUBROUTINE TAP_ERMES ( TEXT, TEXLEN, STATUS ) Return an error message associated with a TAP status value.
SUBROUTINE TAP_ERREP ( TAP_ROUTN, STATUS ) Report an error message associated with a TAP status value.
SUBROUTINE TAP_REP ( NAME, TEXT, STATUS ) Report an error message from TAP.

This page is maintained by:
Simon Jeffery (
Last modified: 09/01/2002

Simon's home page