Next Contents Previous

3.3.3. Writing the main program

A minimal main program should include an open statement specifying the atomic data input file, a call InitPopRatio statement loading in a model for the atom/ion being considered and a call FinishPopRatio statement to deallocate the dynamical variables, freeing up RAM memory.

Typically between the calls to INITPOPRATIO and FINISHPOPRATIO we will have several calls to POPULATIONRATIO under different physical conditions. After each call to POPULATIONRATIO the rates for all the processes involved and the population ratios will be acessible via the global variables given in table 1.

The calculation will proceed faster in case the physical conditions are not very different from the physical conditions in last call to POPULATIONRATIO. If the same value for the kinetic temperature T is passed in two successive calls to POPULATIONRATIO, then the collision rates CD(i)%q(i,j) will not need to be re-computed. Similarly, if we have the same values for Z, BETA and F parameters, the radiation field energy densities U(i,j) and the indirect excitation rates GAM(i,j) will remain unchanged.

Finally, a note of caution: if the user is interested in the collision rate qij by a given collisional partner, then he/she should not call POPULATIONRATIO with its density set to zero, since the collision rates will not be calculated in this case.

In the next section we give some examples of main programs to tackle common applications.