Procedure  Location  Procedure Type  Description 

alps_error  alps_io  Subroutine  Error catching subroutine. 
alps_error_init  alps_io  Subroutine  Open a file for the error log. 
besselI  alps_nhds  Function  Calculates the modified Bessel function of argument x and order n. 
BESSI  alps_nhds  Function  Function to calculate the first kind modified Bessel function of integer order N for any real X. 
BESSI0  ../../generate_distribution.f90  Function  This function calculates the modified Bessel function of the first kind of order zero for any positive real argument x. 
BESSI0  alps_nhds  Function  Auxiliary Bessel functions for N=0, N=1 
BESSI1  ../../generate_distribution.f90  Function  This function calculates the modified Bessel function of the first kind of order one for any positive real argument x. 
BESSI1  alps_nhds  Function  Modified Bessel function of order 1. 
BESSJ  alps_fns_rel  Function  This function calculates the first kind Bessel function of integer order N, for any REAL X. We use here the classical recursion formula, when X > N. For X < N, Miller's algorithm is used to avoid overflows. Reference: C.W.Clenshaw, Chebyshev Series for Mathematical Functions, Mathematical Tables, Vol. 5, 1962. 
BESSJ0  alps_fns_rel  Function  This function calculates the first kind Bessel function of order 0, for any REAL X. The polynomial approximation by series of Chebyshev polynomials is used for 0<X<8 and 0<8/X<1. References: M.Abramowitz, I.A.Stegun, Handbook of Mathematical Functions, 1965. C.W.Clenshaw, Chebyshev Series for Mathematical Functions, Mathematical Tables, Vol. 5, 1962. 
BESSJ1  alps_fns_rel  Function  This subroutine calculates the First Kind Bessel Function of order 1, for any real number X. The polynomial approximation by series of Chebyshev polynomials is used for 0<X<8 and 0<8/X<1. References: M.Abramowitz, I.A.Stegun, Handbook of Mathematical Functions, 1965. C.W.Clenshaw, Chebyshev Series for Mathematical Functions, Mathematical Tables, Vol. 5, 1962. 
BESSK  ../../generate_distribution.f90  Function  This function calculates the modified Bessel function of the third kind of integer order N, for any REAL X. The classical recursion formula is used. Reference: C.W.Clenshaw, Chebyshev Series for Mathematical Functions, Mathematical Tables, Vol. 5, 1962. 
BESSK0  ../../generate_distribution.f90  Function  This function calculates the modified Bessel function of the third kind of order zero for any positive real argument x. 
BESSK1  ../../generate_distribution.f90  Function  This function calculates the modified Bessel function of the third kind of order zero for any positive real argument x. 
bM_read  alps_io  Subroutine  Reads in biMaxwellian/coldplasma parameters. 
calc_chi  alps_nhds  Subroutine  Subroutine that calculates the susceptibility of species j based on NHDS. 
calc_chi_cold  alps_nhds  Subroutine  Subroutine that calculates the susceptibility of species j based on the coldplasma dispersion relation based on the paper Verscharen & Chandran, ApJ 764, 88, 2013. 
calc_eigen  alps_fns  Subroutine  This subroutine calculates the relative electric and magnetic field amplitudes, the relative fluctuations in the density and velocity of all species, and the heating rates of the given solution. It is based on the calc_eigen routine by Greg Howes and Kris Klein. 
calc_ypsilon  alps_nhds  Subroutine  Calculates the Ytensor according to Stix for a biMaxwelling, using the NHDS calculation. 
CBESSJ  alps_fns_rel  Subroutine  This subroutine calculates the complex Bessel function. It is based on the CBESSJ function release 1.1 by JP Moreau, Paris (www.jpmoreau.fr). 
derivative_f0  alps_fns  Subroutine  This subroutine calculates the perpendicular and parallel derivatives of the background velocity distribution function f0. 
derivative_f0_rel  alps_fns_rel  Subroutine  This subroutine calculates the derivatives of the background velocity distribution function f0 for the relativistic calculation. 
determine_bessel_array  alps_fns  Subroutine  This subroutine determines the array of Bessel functions that is used in the Ttensor of Eq. (2.10) of the code paper. 
determine_GLLS  alps_analyt  Subroutine  This subroutine evaluates the General Linear Least Squares fit to the distribution function for component 'is' using the selected polynomial basis functions. 
determine_JT  alps_analyt  Subroutine  This subroutine calculates the transposed Jacobian matrix of the fit function with respect to the fit parameter array. 
determine_nmax  alps_fns  Subroutine  This subroutine determines the maximum required order of the Bessel functions in Eq. (2.9) of the code paper. 
determine_param_fit  alps_analyt  Subroutine  This is the fitting routine for the hybrid analytic continuation. It determines the full field param_fit. 
determine_resonances  alps_fns  Subroutine  This subroutine determines whether any kinetic resonances are located in the integration domain. 
determine_sproc_rel  alps_fns_rel  Subroutine  This subroutine determines sproc_rel for the given process. 
disp  alps_fns  Function  This function returns the determinant of the dispersion tensor for a given frequency om. 
dispfunct  alps_nhds  Function  Calculates the dispersion function based on the complex error function. 
display_credits  alps_io  Subroutine  Writes the opening credits. 
distribution_analyt  alps_distribution_analyt  Function  This function returns the predefined function as f0. 
eval_fit  alps_analyt  Function  This function evaluates the fit to f0 at and the complex parallel momentum ppar_valC. It requires the fit parameters that will be determined by the subroutine determine_param_fit. 
Fact  alps_fns_rel  Function  This function returns the factorial k! of its argument k. 
factorial  alps_analyt  Function  
find_minima  alps_fns  Subroutine  This subroutine identifies the minima of the coarse map grid. It is called by map_search. The code is based on a routine by Greg Howes, 2006. 
fit_function  alps_analyt  Function  This function evaluates the fit to f0 at real pperp_val and complex ppar_val, provided that the onedimensional fitparameter array params is fed into the function. This is only used during the fitting. For the evaluation in ALPS, use eval_fit. 
fit_function_poly  alps_analyt  Function  This function evaluates the orthogonal polynomical fit to f0 at real pperp_val and complex ppar_val, with the onedimensional polynomical coefficient array fit_coeffs is fed into the function. For the evaluation in ALPS, use eval_fit. kgk: should this be .gt. or .ge. ? 
fit_read  alps_io  Subroutine  Reads in fit parameters for component is. 
full_integrate  alps_fns  Function  This function returns the full integral expression according to Eq. (2.9) in the code paper. 
funct_g  alps_fns  Function  This function returns the function from Eq. (3.2) of the code paper. 
funct_g_rel  alps_fns_rel  Function  This function returns the function from Eq. (3.2) of the code paper for a relativistic calculation. 
Gamma  alps_fns_rel  Function  This function returns the Gammafunction. 
get_indexed_double_namelist_unit  alps_io  Subroutine  A version of get_indexed_namelist_unit, extended to allow for double indexing in order to read in multiple fits for a single species. 
get_indexed_namelist_unit  generate_distribution  Subroutine  Determines unused I/O unit. 
get_indexed_namelist_unit  alps_io  Subroutine  Determines unused I/O unit. 
get_runname  generate_distribution  Subroutine  Get runname for output files from input argument. 
get_runname  interpolate  Subroutine  Get runname for output files from input argument. 
get_runname  alps_io  Subroutine  Get runname for output files from input argument. 
get_unused_unit  generate_distribution  Subroutine  Determine unused number for I/O index. 
get_unused_unit  interpolate  Subroutine  This subroutine returns an available unit number. It is taken from the AstroGK code. 
get_unused_unit  alps_io  Subroutine  Determine unused number for I/O index. 
init_param  alps_io  Subroutine  Read in system parameters from *.in file. Only processor 0 calls this routine: 
input_unit  generate_distribution  Function  Assigns input unit for namelist opening. 
input_unit  interpolate  Function  This function returns a unit number for a namelist. It is taken from the AstroGK code. 
input_unit  alps_io  Function  Assigns input unit for namelist opening. 
input_unit_exist  generate_distribution  Function  Determine if a particular namelist already opened. 
input_unit_exist  interpolate  Function  This function checks whether a unit number exists. It is taken from the AstroGK code. 
input_unit_exist  alps_io  Function  Determine if a particular namelist already opened. 
int_ee  alps_fns  Function  This function returns the ee term in Eq. (2.9). 
int_ee_rel  alps_fns_rel  Function  This function returns the ee term in Eq. (2.9) for the relativistic calculation. 
int_T  alps_fns  Function  This function returns the Ttensor according to Eq. (2.10) of the code paper. 
int_T_rel  alps_fns_rel  Function  This function returns the Ttensor according to Eq. (2.10) of the code paper for the relativistic calculation. 
int_T_res  alps_fns  Function  This function returns the Ttensor according to Eq. (2.10) of the code paper for the case in which it is evaluated at the complex resonance momentum. 
int_T_res_rel  alps_fns_rel  Function  This function returns the Ttensor according to Eq. (2.10) of the code paper for the case in which it is evaluated at the complex resonance momentum for the relativistic calculation. 
integrate  alps_fns  Function  This function performs the integral in Eq. (2.9) of the code paper, but without accounting for the Landau contour integral. It is called by full_integrate. 
integrate_res  alps_fns  Function  This function performs the integration near resonances as described in Section 3.1 of the code paper. It is only called if resonances are present in or near the integration domain. 
integrate_res_rel  alps_fns_rel  Function  This function performs the integration near resonances as described in Section 3.1 of the code paper for a relativistic calculation. It is only called if resonances are present in or near the integration domain. 
integrate_resU_rel  alps_fns_rel  Function  This function evaluates the integral with the integrand proportional to in Eq. (2.9) of the code paper for a relativistic calculation. 
isnancheck  alps_io  Function  Checks if double precision number input is NaN. 
landau_integrate  alps_fns  Function  This function evaluates the Landau contour according to Eqs. (3.8) and (3.9) of the code paper. 
landau_integrate_rel  alps_fns_rel  Function  This function evaluates the Landau contour according to Eqs. (3.8) and (3.9) of the code paper for a relativistic calculation. 
least_squares_fit  alps_analyt  Subroutine  Solves General Linear Least Squares Normal Equation 
LM_nonlinear_fit  alps_analyt  Subroutine  This subroutine processes the nonlinear LevenbergMarquart algorithm and returns the onedimensional array params at a given iperp. The variable quality is the sum of the squares of all residuals. 
map_read  alps_io  Subroutine  Reads in complex frequency map parameters. 
map_search  alps_fns  Subroutine  This subroutine calculates the map of the determinant of the dispersion tensor in complex frequency space. check 
normalize  ../../interpolation.f90  Subroutine  This subroutine normalises the fine interpolation grid. 
om_double_scan  alps_fns  Subroutine  This subroutine scans along a prescribed plane in wavevector space to map out in this space. It is required that n_scan=2. KGK: This line causes the solution to (occasionally) smoothly transition to unphysical values. Suppressing until we understand the error. 
om_scan  alps_fns  Subroutine  This subroutine scans solutions along a single prescribed path in wavevector space. KGK: This line causes the solution to (occasionally) smoothly transition to unphysical values. Suppressing until we understand the error. 
output_fit  alps_analyt  Subroutine  This subroutine outputs the fit parameters for iperp=0 to stdout to monitor the fit. 
output_time  alps_io  Subroutine  Outputs the date and time in a given format using intrinsic FORTRAN function. 
pass_distribution  alps_com  Subroutine  Passes distribution functions and associated parameters. 
pass_instructions  alps_com  Subroutine  Passes information between processes. 
poly_read  alps_io  Subroutine  Reads in Polynomial Basis Function Parameters 
polyharmonic_spline  ../../interpolation.f90  Subroutine  This soubroutine interpolates the grid with a polyharmonic thinplate spline. This subroutine needs the LUPACK and BLAS libraries to evoke the dgesv subroutine. The method uses the Thin Plate Spline. We use these resources: http://cseweb.ucsd.edu/~sjb/eccv_tps.pdf http://www.univie.ac.at/nuhagphp/bibtex/open_files/po94_M%20J%20D%20Powell%2003%2093.pdf http://vision.ucsd.edu/sites/default/files/fulltext(4).pdf 
polyharmonic_spline  alps_fns_rel  Subroutine  This soubroutine interpolates the grid with a polyharmonic thinplate spline. This subroutine needs the LUPACK and BLAS libraries to evoke the dgesv subroutine. The method uses the Thin Plate Spline. We use these resources: http://cseweb.ucsd.edu/~sjb/eccv_tps.pdf http://www.univie.ac.at/nuhagphp/bibtex/open_files/po94_M%20J%20D%20Powell%2003%2093.pdf http://vision.ucsd.edu/sites/default/files/fulltext(4).pdf 
principal_integral_rel  alps_fns_rel  Function  This function performs the integration near resonances as described in Section 3.1 of the code paper for a relativistic calculation. It is only called if resonances are present in or near the integration domain. 
read_f0  alps_io  Subroutine  Subroutine for reading in background distribution function 
read_in_params  generate_distribution  Subroutine  This subroutine reads in the parameters for the generation of distribution functions for ALPS. 
read_in_params  interpolate  Subroutine  This subroutine reads in system parameters input file (namelist) as argument after executable:

refine_guess  alps_fns  Subroutine  This subroutine refines the guess at the starting point of the search for solutions to the dispersion relation when scanning. It is also used by map_search to identify the roots on the map. 
resU  alps_fns  Function  This function evaluates the term proportional to in Eq. (2.9) of the code paper. 
resU_rel  alps_fns_rel  Function  This function evaluates the term proportional to in Eq. (2.9) of the code paper for the relativistic calculation. 
scan_read  alps_io  Subroutine  The most important subroutine. Reads in wavevector scan parameters. Defines scanner, which controls the behavior of the wavevector scan. 
secant  alps_fns  Subroutine  This subroutine applies the secant method to find the roots of the dispersion tensor. 
set_polynomial_basis  alps_analyt  Subroutine  This subroutine evaluates the General Linear Least Squares fit to the distribution function for component 'is' using the selected polynomial basis functions. 
solution_read  alps_io  Subroutine  Reads in initial guesses for dispersion solutions. 
spec_read  generate_distribution  Subroutine  Subroutine for reading in species parameters. 
spec_read  alps_io  Subroutine  Subroutine for reading in species parameters 
split_processes  alps_fns  Subroutine  This subroutine defines the tasks for the individual processes. It uses the number of species and the required orders of the Bessel functions to define the splitting across the MPI processes. 
WOFZ  alps_nhds  Subroutine  Given a complex number Z = (XI,YI), this subroutine computes the value of the Faddeeva function W(Z) = exp(Z2)erfc(IZ), where erfc is the complex complementary error function and I is the imaginary unit. 