In most astrophysical environments, common atoms or ions are found primarily in their ground states, with only a negligible fraction in excited levels. However, if some excitation mechanism is present, then a small or even significant fraction of atoms/ions will be found in their excited states. If the excitation mechanism is not so intense to keep the atoms/ions in LTE conditions, then the amount of atoms/ions found in excited states may be used to infer the physical conditions in their environments.
The fraction of excited atoms/ions may be infered from the observed spectrum properties. For example, the ratios of excited level populations may be deduced from the column density ratios of fine structure absorption lines seen in absorption clouds towards QSOs or in diffuse clouds towards brigth stars in the Galaxy . They may also be infered from intensity ratios of collisionally excited emission lines (such as coronal emission lines).
However, in order to trace the diagnosis curve giving the fraction of excited atoms/ions as a function of the physical conditions in the medium, one must usually account for several excitation mechanisms . Moreover, some atoms/ions may have a complex enough electronic structure to require the inclusion of several levels in the calculation, such as iron.
This paper describes a code to calculate the population ratios of excited levels of a given atom or ion accounting for an arbitrary number of levels and excitation mechanisms.
Our code may find a wide range of applicability in astronomical problems, such as infering the physical conditions from fine-structure absorption line and collisionally excited emission line diagnosis. Another possible use is in the calculation of cooling rates due to collisional excitation. We provide several examples in the testcases described bellow.