The program consists of several subroutines and functions, and use a combination of global and local variables. The global variables are declared in a separate module (see Section A.3) which is accessed in each routine/function where needed through the USE statement. (Note that all intrinsic statements are given in uppercase letters, while all user defined variables, routines, functions, etc. are given as lowercase letters.) Also given through the USE statement are: a module that contains functions which are being used at several occasions, a module given in Press90 that contains declaration of some global parameters (nrtype.f90), and a module containing the interface blocks (see Section A.3). The access by each routine to the different functions/interface blocks are limited by using the only statement, making it easier to discover errors in the program structure at compilation.
The code given is presented as follows. The main routine, PROGRAM avp, is given first, and the subroutines/functions follow in an alphabetical order. As mentioned in the ingress to this Appendix, the routines taken from Press90 are not included. It is noted where such a routine is being used. The blank lines/comments are started by using an exclamation mark ``!'', and indenting is used to enhance the readability of the code. The code is as follows: