# ADAS Subroutine Library adaslib

- Subroutine argam: Calculates arggamma(l+1+i*a) where l is an integer not less than zero
- Subroutine bf: Evaluates the hydrogenic <nl|r|kl> bound-free radial integral
- Subroutine ceigrp: Returns Eissner code for an orbital
- Subroutine ceprep: Prepares a string for passsing to xxdtes. Takes c*18 and returns c*19; add a space to start if not d10 or f10-f14. in this case a space is added at the end.
- Subroutine check_pipe: Diagnostic check on the state of the fortran-IDL pipe
- Subroutine continuo: For an given wavelength generate radiative reconbination and bremsstrahlung emissivity.
- Subroutine cstgrp: Returns term of orbital given in the Eissner single hexadecimal character form
- Subroutine ee2: Evaluates exp(x)e2(x) where e2 is the 2nd exponential integral
- Subroutine ee3: Evaluates exp(x)e3(x) where e3 is the 1st exponential integral
- Subroutine eei: Evaluates exp(x)e1(x) where e1 is the 1st exponential integral
- Subroutine i4eiss: Returns decimal index of an orbital given in the Eissner hexadecimal character form.
- Subroutine i4eiz0: To return the nuclear charge for the element symbol esym (integer*4 function version of `xxeiz0')
- Subroutine i4fctn: To convert an integer number stored in a string into a integer*4 variable
- Subroutine i4idfl: Returns a unique index number based on the value of the n and l quantum numbers passed to it. The index is used to reference arrays containing data dependent on the n and l quantum numbers.
- Subroutine i4idfm: Returns a unique index number based on the value of the n, l and m quantum numbers passed to it. The index is used to reference arrays containing data dependent on the n, l and m quantum numbers.
- Subroutine i4idli: Returns the index number of the predicted spetrum line tables given the orbital quantum number of the intial state and the principal and orbital quantum numbers of the final state.
- Subroutine i4indf: Finds the index in array corresponding to the closest match to value.
- Subroutine i4indfi4: Finds the index in the integer array corresponding to the exact match to value. If the entry is outside the range of array then -1 is returned.
- Subroutine i4indfvs: Finds the index in array corresponding to the closest match to value.
- Subroutine i4jgam: Uses index to reference `jgam' table generated by subroutine `xxgama'.
- Subroutine i4jgrp: Returns decimal form of Eissner single hex character orbital given in the Eissner single hexadecimal character form
- Subroutine i4lgrp: Returns angular momentum quantun number of orbital given in the Eissner single hexadecimal character form
- Subroutine i4ndec: Returns n quantum number of an orbital given in the decimal form
- Subroutine i4ngrp: Returns n quantum number given in the Eissner single hexadecimal character form
- Subroutine i4pgrp: Returns parity of orbital given the Eissner single hexadecimal character form
- Subroutine i4schr: Convert from character representation of number of equivalent electrons to decimal form
- Subroutine i4unit: To reset or return a stored integer*4 value greater than or equal to zero. This is used within ADAS to store the stream/unit number for the output of error messages (to the screen).
- Subroutine ingama: Evaluates incomplete gamma function, p(a,x)
- Subroutine ingamq: Evaluates incomplete gamma function, 1-p(a,x)
- Subroutine lenstr: Returns the effective length of a given string (ignoring trailing blanks)
- Subroutine linfit: Subroutine to perform linear interpolation
- Subroutine lngama: Returns the natural logarithm of the gamma function of x
- Subroutine matin1: Matrix inversion
- Subroutine matinv: Matrix inversion with accompanying solution of linear equations
- Subroutine nsort: Subroutine to sort an array so that xa is increasing order
- Subroutine r8ah: Calculates a-values for hydrogen.
- Subroutine r8atab: Calculates hydronic l resolved a-values.
- Subroutine r8bcon: To convert a beam energy into specified units (double precision function version of `xxbcon')
- Subroutine r8const: Returns the fundamental constant corresponding to `key'.
- Subroutine r8dcon: To convert a density into specified units
- Subroutine r8ecip: Caluclates the shell contribution to the ionisation rate coefficient in the ecip approximation of Burgess.
- Subroutine r8econ: To convert a velocity/energy into a specified form
- Subroutine r8erfc: Calculates the error function erfc(x)
- Subroutine r8expe: To produce a number from value and exponent parts protected against underflow and overflow. (number=value*exp(expon))
- Subroutine r8f21: Evaluates series expansion of hypergeometric function f(a,b;c;d).
- Subroutine r8fbch: Evaluates a shell contribution to the ionisation rate coeff- icient in the Burgess-Chidichimo approximation.
- Subroutine r8fctn: To convert a floating point number stored in a string into a real*8 variable.
- Subroutine r8fdip: Calculates the dipole integral i(kappa1,l1,kappa2,l2,1)
- Subroutine r8fdip0: Calculates the function i0(k1,l1,k2,l2,1) defined in phil. Trans. roy. soc. a266,255,1970, where e1=k1*k1, e2=k2*k2, and the relative accuracy is approximately eps.
- Subroutine r8fdip1: Calculates the dipole integral i(kappa1,l1,kappa2,l2,1) for where min(e1,e2)/emax(e1,e2) < 0.03
- Subroutine r8fdip2: Calculates the dipole integral i(kappa1,l1,kappa2,l2,1) for where min(e1,e2)/emax(e1,e2) > 0.03
- Subroutine r8feei: Evaluates exp(x)e1(x) where e1 is the 1st exponential integral
- Subroutine r8fmon1: Calculates the monopole integral |<e1,l|1/r>|e2,l>|
^{2} - Subroutine r8form: Calculates charge exchange l-resolved cross-section as a fraction of the corresponding n-resolved cross-section.
- Subroutine r8fun1: Returns argument
- Subroutine r8fun2: Return 1 / ( z+1 )
- Subroutine r8gam: Uses index to reference `gam' table generated by subroutine `xxgama'.
- Subroutine r8gav: Calculates total Gaunt factor for free-free and quasi-continuous free-bound transitions
- Subroutine r8gbf: Calculates bound-free Gaunt factors
- Subroutine r8giiav: Calculate averaged free-bound Gaunt factor for summed contributions of the high lying states - Summers and Hooper equ. 19
- Subroutine r8giih: Calculates bound-free g-factors for angularly resolved levels uses hydrogenic matrix elements.
- Subroutine r8giii: Calculates giii given in equations (11) and (15) of A. Burgess, J. Phys. B7, l364, 1974.
- Subroutine r8giiiav: Calculates Maxwellian averaged free-free Gaunt factors
- Subroutine r8p: Expectation value <1/r
^{4}> in hydrogen approximation for use in dipole polarisability energy shift evaluation - Subroutine r8prov: Approximation to hydrogenic overlap integral for classical binary encounter spin change cross-sections for max0(n,n1) large.
- Subroutine r8qp: Expectation value <1/r
^{6}> in hydrogen approximation for use in quadrupole polarisability energy shift evaluation - Subroutine r8rd2b: Claculates hydrogenic bound-bound radial integrals using recurrence relations.
- Subroutine r8rd2f: Claculates hydrogenic bound-free radial integrals using recurrence relations.
- Subroutine r8scon: To convert an array of cross-sections into a specified form. (double precision function version of `xxscon')
- Subroutine r8tcon: To convert a temperature into specified units (double prescision function version of `xxtcon')
- Subroutine r8xip: Evaluates impact parameter cross-section first bessel integral x [Burgess and Summers: MNRAS (1976) 172,345 - eqn c12]
- Subroutine r8yip: Evaluates impact parameter cross-section second bessel integral y [Burgess and Summers: MNRAS (1976) 172,345 - eqn c14]
- Subroutine r8zeta: Hydrogenic spin-orbit interaction energy zeta
- Subroutine xfelem: To return the name of the element with nuclear charge iz0 (character*12 function version of `xxelem')
- Subroutine xfesym: To return the symbol for the element with nuclear charge iz0 (character*2 function version of `xxesym')
- Subroutine xx0000: ADAS configuration file for setting machine dependant variables etc.
- Subroutine xxadas: ADAS routine - gets an 80 byte character string header containing the ADAS release & version, the executing program name & version, and the current date & time from IDL via the pipe.
- Subroutine xxbasa: To add two numbers, given in the form a*base
^{ia}and b*base^{ib}, where the base must be the same. - Subroutine xxbase: To produce a number from representation as a*base
^{ia}protected against underflow and overflow. - Subroutine xxbasr: To rebase a number, given in the form a*base_a
^{ia}to the form b*base_b^{ib}. - Subroutine xxbass: To scale a number, given in the form a*base
^{ia}such that base <= a < 1/base. - Subroutine xxbcon: To convert an array of beam energies into specified units
- Subroutine xxcase: Change a string of arbitrary size into all upper case or all lower case
- Subroutine xxceia: Converts ionisation potentials from wave numbers to rydbergs and fills in any missing values up to an ion charge of 50.
- Subroutine xxcftr: Converts a configuration character string, such as occurs in a specific ion file level list, between Eissner and standard forms
- Subroutine xxcheb: Carry out chebyschev polynomial fit algorithm (direct replacement for nag minimax polynimial coeft. Routine e02acf - has same argument list).
- Subroutine xxchss: Sorts a character array xa and its index array. This is a bubble sort designed for small arrays.
- Subroutine xxcmps: Compares two nineteen character configuration strings in standard form and detects if they are equivalent independent of the orbitals being in upper or lower case.
- Subroutine xxcomm: Read the comments from an ADAS adf dataset.
- Subroutine xxdams: ADAS routine - sets up and interrogates a value for the donor mass.
- Subroutine xxdata_00: To fetch data from an adf00 data set and detect its main characteristics.
- Subroutine xxdata_01: To fetch data from input data set of type adf01.
- Subroutine xxdata_02: To fetch data from input ion/atom cross-section files of type adf02.
- Subroutine xxdata_03: To fetch data from input atompars data set of type adf03.
- Subroutine xxdata_04: To fetch data from an adf04 data set and detect its main characteristics. This is a fully inclusive version, based on badata.for, detecting the following:
- Subroutine xxdata_07: To fetch data from input electron impact ionization rate coefft files (adf07)
- Subroutine xxdata_08: To fetch data from input adf08 data set.
- Subroutine xxdata_09: To fetch data from input adf09 data set.
- Subroutine xxdata_11: To read a complete adf11 file, check its class and determine its standard, resolved and partition organisation.
- Subroutine xxdata_12: To fetch data from input dataset of type adf12.
- Subroutine xxdata_13: To fetch data from input ionisations/photon file for a given emitting ion (element and charge).
- Subroutine xxdata_15: To fetch data from an input photon emissivity file for a given emitting element superstage .
- Subroutine xxdata_16: To fetch data from input contribution functions of an element and its ions. (member stored in ionelec.data - member prefix `gcf\#').
- Subroutine xxdata_19: To fetch data from input radiated power coefficients of an element and its ions. (member stored in ionelec.data - member prefix `pzd\#').
- Subroutine xxdata_20: To fetch data from input gft data set of type adf20.
- Subroutine xxdata_21: To read data from an effective beam stopping data set. (ADAS format adf21).
- Subroutine xxdata_23: To fetch data from an adf23 data set.
- Subroutine xxdata_24: To fetch data from input charge exchange cross-section data for given donor and receiver ions.
- Subroutine xxdata_25: To fetch data from an adf25 driver dataset.
- Subroutine xxdata_35: To fetch data from an adf35 data set.
- Subroutine xxdata_37: To fetch data from an adf37 data set and detect its main characteristics.
- Subroutine xxdata_40: To fetch data from an input feature photon emissivity file for a given emitting element superstage .
- Subroutine xxdata_42: To fetch data from an ADAS810 driver set (adf42).
- Subroutine xxdate: Gathers current date as a 8 byte string from IDL via pipe
- Subroutine xxdcon: To convert an array of densities into specified units
- Subroutine xxdeci: To decide the number of decimals which can be printed after the decimal point in a fixed format with a specified field length.
- Subroutine xxder1: Minimize the sum of the squares of m nonlinear functions in n variables by a modification of the Levenberg-Marquardt algorithm.
- Subroutine xxdsn2: To check if a fully qualified mvs sequential or partitioned data set exists and returns the data set name in a form for dynamic allocation.
- Subroutine xxdtes: Detects if the configuration string from a specific ion level list line is of Eissner form , standard form or neither.
- Subroutine xxecon: To convert an array of velocities/energies into a specified form.
- Subroutine xxeiam: Routine to return the atomic mass number for a given element symbol esym.
- Subroutine xxeign: Finds the eigenvalues and eigenvectors of a general real matrix.
- Subroutine xxeiz0: To return the nuclear charge iz0 for the element symbol esym
- Subroutine xxelem: To return the name of the element with nuclear charge iz0
- Subroutine xxelz0: To return the nuclear charge iz0 for the element nane
- Subroutine xxeryd: To calculate the energy levels in rydbergs ( from wave num- bers) relative to level 1, and the energies (also in ryd.) relative to the ionisation potential.
- Subroutine xxfchr: To identify the first and last occurrence of sstrng in cstrng, the values of which are ifirst , ilast.
- Subroutine xxfcse: Read in a file, convert it all to upper or lower case and then write it to another file.
- Subroutine xxflnm: To prepare a unix dataset name from a string which may include an ADAS environment leader and comments. The ADAS environment variable must be first and in double quotes. the comments must either follow or precede a colon.
- Subroutine xxflsh: Routine for setting call to "flush" command depending on
- Subroutine xxfrmt_t: To determine the format and file length required for the transition strings of an ion
- Subroutine xxfrmt_trm: To determine the format and string length required for the term strings of an ion
- Subroutine xxgama: Setup lookup tables for routines i4jgam and r8gam
- Subroutine xxgtsl: Given a general tridiagonal matrix and a right hand side will find the solution of the associated system of linear equations.
- Subroutine xxguid: To fetch user identifier from unix
- Subroutine xxhkey: To extract from a line of text `ctext' a response to a key in ther form of '<ckey> = <cans>'.
- Subroutine xxhunt: Given an array xx(1:n), and given a value x, returns a value jlo such that x is between xx(jlo) and xx(jlo+1).
- Subroutine xxi4ss: Sorts an integer array xa and its index array. This is a bubble sort designed for small arrays.
- Subroutine xxidtl: Inverse of function i4idfl. Returns the unique n and l quantum numbers which generate the given index when passed to i4idfl.
- Subroutine xxidtm: Inverse of function i4idfm. Returns the unique n, l and m quantum numbers which generate the given index when passed to i4idfm.
- Subroutine xxin17: To open and acquire data from master condensed collisional-dielectronic files:
- Subroutine xxin80: To open and acquire data from master condensed collisional-dielectronic files:
- Subroutine xxindx: Indexes an array `arr' of length `n'. it outputs the array `indx()' such that `arr(indx(j))' is in ascending order for j=1,2,...,n. the input quantities `n' and `arr' are not changed.
- Subroutine xxinst: To fetch data from standard master condensed collisional-dielectronic files.
- Subroutine xxisrt: Sorts an array `arr' of length `n' according to the index `indx()' such that `arr(indx(j))' goes to `arr(j)' for j=1,2,...,n. the input quantities `n' and `indx' are not changed.
- Subroutine xxlast: Returns the index of the last occurence of a character in a string
- Subroutine xxlim4: Finds maxima and minima of a list of x values and returns the scale range for plotting on a log to the base 10 grid. I.e. log10 range to nearest appropriate integers.
- Subroutine xxlim8: Finds maxima and minima of a list of x values and returns the scale range for plotting on a log to the base 10 grid. I.e. log10 range to nearest appropriate integers.
- Subroutine xxlm28: Finds maxima and minima of a 2-dimensional array of y-values and returns the scale range for plotting on a log to the base 10 grid.
- Subroutine xxmadd: Adds two matrices with multiplier for each.
- Subroutine xxmcpy: Copies one matrix to another.
- Subroutine xxmerg: Merges two grids and eliminates any duplicate entries.
- Subroutine xxmino: Inverts a matrix.
- Subroutine xxminv: Matrix inversion with accompanying solution of linear equations if requested.
- Subroutine xxmkrc: To create the root connection vector for an element
- Subroutine xxmkrp: To create a root partition and return the partition block.
- Subroutine xxmmul: Multiplies two matrices.
- Subroutine xxmnmx: To evaluate the taylor coefficients of the minimax polynomial.
- Subroutine xxname: To determine the real name of the user by examining the system /etc/passwd file. A c program reads the file.
- Subroutine xxnbaf: Determines a least-square cubic spline approximation s(x) to the set of data points (x_r, y_r) with weights w_r,
- Subroutine xxnbbf: Evaluates a cubic spline from its b-spline representation
- Subroutine xxopcs: Open a file on a given unit but when a read is done from that unit, only give the contents back in a given case.
- Subroutine xxopen: To inquire & open input data file & allocate to unit `iunit' (read only) - if it does not exists a message is sent to the screen and lexist is returned as false.
- Subroutine xxordr: Sorts a real*8 array xa. This is a bubble sort designed for small arrays.
- Subroutine xxpars: To analyse the tail character string of the first line of a specific ion file into binding wave numbers for different parents and statistical weights for the parents.
- Subroutine xxpint: Order ndim polynominal interpolation.
- Subroutine xxpixv: Distribute Doppler broadened line emission into pixel range
- Subroutine xxprs1: To analyse the tail character string of an level data line of an adf04 specific ion file into wave-number and sets of (parent identifier, effective zeta for the parent) pairs.
- Subroutine xxprs3: To analyse a configuration character string in standard form into a integer array of occupation numbers in the normal collating order.
- Subroutine xxr8sort: Sorts a real*8 array xa and its index array. This is a bubble sort designed for small arrays.
- Subroutine xxr8ss: Sorts an integer array xa and its index array. This is a bubble sort designed for small arrays.
- Subroutine xxrams: ADAS routine - sets up and interrogates a value for the receiver mass.
- Subroutine xxrate: To calculate the excitation and de-excitation rate coeffici- ents for a set of input temperatures(rydberg) & transitions. Values returned assuming unit gamma values (i.e. gamma = 1)
- Subroutine xxreia: To read in ionisation potentials from an input master condensed file allocated to unit `iunit' without knowing how many are present.
- Subroutine xxrepl: To replace all occurrences of a substring in a string with an alternative substring
- Subroutine xxrmve: To remove all occurrences of a selected character from a string and concatenate. output string tail is blank filled
- Subroutine xxrmws: Removes all blanks in input string
- Subroutine xxrptn: To read and analyse a partition block in a datafile header
- Subroutine xxsim: Solves the system of simultaneous equations ax=b using the with its dependencies. This routine replaces nag library routine f04atf. however, the lu decomposition is not output.
- Subroutine xxsion: Returns ion element symbol and ion charge as a string constructed as follows <symbol><charge>. it also returns the length of the string.
- Subroutine xxslen: To identify the first and last non-blank character in a string. (if input string is blank ifirst=ilast=0)
- Subroutine xxsort: Sorts array `arr' into ascending numerical order, with corresponding rearrangement of `brr'. uses shell's method.
- Subroutine xxspec: ADAS routine - sets up the default usegrp, usrtyp and usrext which identify the filename and extension to be read in subroutine spec. it works in the same manner as xxuid which which allows the default user space to be set
- Subroutine xxsple: To interpolate/extrapolate using cubic splines
- Subroutine xxsplf: To interpolate/extrapolate using cubic splines
- Subroutine xxspln: To interpolate/extrapolate using cubic splines
- Subroutine xxspzd: ADAS routine - sets up the default usegrp, usrtyp and usrext which identify the filename and extension to be read in subroutine spzd. it works in the same manner as xxuid which which allows the default user space to be set
- Subroutine xxssxb: ADAS routine - sets up the default usrgrp, usrtyp and usrext which identify the filename and extension to be read in subroutine ssxb. it works in the same manner as xxuid which which allows the default user space to be set
- Subroutine xxsszd: ADAS routine - sets up the default usegrp, usrtyp and usrext which identify the filename and extension to be read in subroutine sszd. it works in the same manner as xxuid which which allows the default user space to be set
- Subroutine xxstnp: Check whether output block will fit on current page. If not a new page is initiated, and line count reset accordingly.
- Subroutine xxstuc: Ensures all letters in input string are upper case.
- Subroutine xxtcon: To convert an array of temperatures into specified units
- Subroutine xxterm: Terminates program with message.
- Subroutine xxtoday: To return today's date.
- Subroutine xxuid: ADAS routine - sets up the default userid which stores the data to be read using standard ADAS data reading routines.
- Subroutine xxwcmt_15: To write the comment section of an adf15 file .
- Subroutine xxwcmt_40: To write the comment section of an adf40 file .
- Subroutine xxwlgc: Sends a 1 for true or a 0 for false to IDL
- Subroutine xxword: To extract the nfirst to (nfirst+iwords-1) words from an input string. Outputs the first and last byte indexes of each word as well as the total number of words found.
- Subroutine xxwstr: Writes a string with format (a) to iunit with no trailing blanks.
- Subroutine xxycf2: Calculates an estimate of the elements of the variance-covariance matrix of the estimated regression coefficients for a non-linear least-squares problem.