A U T O S T R U C T U R E 
                                 Update Log
                                                       Maintained by N R Badnell


N.B.
v31.x is the current development version.
v30.19 is the final version v30.
v30.19.x is the post-v30 bug-fix version.
v29.21 is the final version v29.
v29.21.8 is the post-v29 bug-fix version.
v28.46 is the final version v28.
v28.46.10 is the post-v28 bug-fix version.
v27.133 is the final version v27.
v27.133.7 is the post-v27 bug-fix version.
v26.23 is the final version v26.
v26.23.9 is the final post-v26 bug-fix version.
v25.47 is the final version v25.
v25.47.9 is the final post-v25 bug-fix version.
v24.24 is the final version v24.
v24.24.5 is the final post-v24 bug-fix version.
v23.27 is the archived CPC version - AEIV_v1_0 - see Badnell CPC 182, 1528-35 (2011).  
v23.27.4 is the final post-CPC bug-fix version.




23/03/24 asdeck31.4
Minor.
Tweak incorrect warning about an STO potential that does not apply to relaxed case.
Add error abort if more than 1 Rydberg or 1 continuum is included in a relaxed orbital
configuration - the memory storage assumes at most 1.
Add a warning if the above occurs in the non-relaxed case.

29/02/24 asdeck30.19.8
If KCUT used during bound-free operation then got attempt to access non-allocated array
error (or segmentation, depending on compiler flags) because KCUT is applaied to target
still, but this is now a parent of the target-plus-Ryd/cont. (Did not affect RUN='DE'.)

23/01/24 asdeck30.19.7
v29.21.2 introduced longer I9 read of radwin header instead of 4X,I5.
But external Hartree-Fock code that wrote historic radwin filled the 4X with the
last radial mesh point. So, subsequent versions fall-over (likely end-of-file) as
mis-read number of radial points. Now pre-read the line as character string and examine
it to see if safe to read I9.

19/12/23 asdeck30.19.6
Fixed a bug when optimizing non-orthogonal orbitals. The resultant scaling parameters appear
to be unchanged, but the energies produced at the end of the procedure differ. They were correct
(for the given scaling parameters) when subsequently evaluated in non-optimzed operation.

12/12/23 asdeck30.19.5
BASIS='SRLX' with non-unique closed-shell orbitals (KCOR1=-1, so not the default) did not
correctly algebraically map valence-closed-shells integrals to the correct closed-shell group.
So, although all closed-shell groups of orbitals were correctly computed, those from group 1
were used here. Closed-shell - closed-shell were correctly differentiated.

24/11/23 asdeck30.19.5 (see below, as to why .5)
FAC='NO' still switched any Thomas-Fermi potential to STO.


17/11/23 asdeck30.19
************** Public release of v30.19 as the default AS distribution ****************
(This is actually my 30.19.4, so post bug-fixes will start at 30.19.5)

The main feature of v30 is an option to mimic the Flexible Atomic Code (FAC) structure.
See the RECENT_HIGHLIGHTS file for details, and more.

See the RELEASE30 file for details of changes to the default operation of AS with v30.

A complete history of the v30 development programme over the past year can
be found in the UPDATES file, which maybe somewhat opaque at times... 

Please report any problems you encounter with this release by sending me the first line
of the asdeck30.f95 source code - this contains the version number and a date code -
the input (das) file which generates the problem and the corresponding output (olg)
file, along with a general description of the problem. (I am not a mind reader.)

***************************************************************************************


17/11/23 asdeck30.19
S.S. input does not use MXCONF (but it is initialized to zero still).
This tries to use adf00 data, which is not possible for S.S. input.
Use of adf00 now checks for A.S. input format.

08/11/23 asdeck30.19
Re-spagged.

07/11/23 asdeck30.19
Accumulation of obscure bug-fixes.

20/10/23 asdeck30.18
SR.RADWAV failed to find a solution for a case of 5f orbital collapse.
A similar situation arose in the past with the 4f, but the fix implemented then
needed tweaking to handle the 5f case.

17/10/23 adaspe 2.12
Extended element list to Z=103 and allow for total spin .gt. 9 by switching to alphanumeric, as L.

13/10/23 asdeck30.18
The ADAS adf00 files (of ground configurations) for all the lanthanides (except La)
were out-of-date, i.e. wrong, for many stages from III and upwards.
Also out-of-date/wrong were: YIII, AgI, HfII, OsXV and Re XII, XIV, XVII.
The adf00 files have been updated from NIST along with the corresponding ADF00 module.

06/10/23 asdeck30.18
Write a warning if MXCONF.lt.0 generates a "new" incorrect ground config.

29/09/23 asdeck30.18
Added checksum to SR.ALGX that all CA interacting electron pairs are valid for the configuration pair.

28/09/23 asdeck30.18
Inner-shell EIE (CA): when there was common outer orbital spectator then the correct
initial active electron pair orbital flag could subsequently be overwritten by the spectator's.
It is just possible that in LS/IC two configs maybe flagged falsely as not interacting,
but one would have thought that the output collision strength would be missing substantial
transition data, but if you know better...

22/09/23 asdeck30.18
Local pointer to last RUN='DE' EIE Slater integral calculated for a given continuum L was not
initialized to zero. "Only" likely to affect parallel code where a particular L does not
contribute to the scattering Jp in a non-obvious way (L=0 being the classic problem).

22/09/23 asdeck30.18
Should have checked for existence of dipole transition before evaluating binomials (for CA EIE)
- see 02/09/23 asdeck30.16

21/09/23 asdeck30.17
MXCONF.lt.0 (plus NELEC set) takes the adf00 ground config and applies some simple
promotion rules to generate a potentially large set of configs (so should only be used
in configuration average, CUP='CAR'). The energy ordered CONFIG.DAT_EO file written 
(this is not new) is now restricted to the -MXCONF lowest energy configs and/or those that
lie within EXCITE Ryd of the ground (this is new). Furthermore, since the orbital list
implied by the adf00 look-up table is standard ordered, the orbital list (and associated
configs) written to CONFIG.DAT_EO *only* is re-ordered to 1/ move any common closed shells
not in the standard order closed-shell list (which cannot contain gaps) to an energy-ordered
orbital closed-shell list 2/ eliminate orbitals that are not in use. 1/ is for Blume & Watson,
2/ is more aesthetic, although reduces memory. An intermediate coupling run, CUP='ICR', can
then be made with this much reduced set via cp CONFIG.DAT_EO CONFIG.DAT and setting ICFG=-1
in SALEGB. (The CONFIG.DAT can be edited manually to add/subtract configs if necessary,
but idealy not for production runs involving many elements/ionizaation stages.)
Thus, the standard user input file (das) never need contain an explicit set of configurations,
which is ideal for script work.

20/09/23 asdeck30.17
Added using NLAM negative to switch from nl-dependent Thomas-Fermi potential (default)
to historic SS l-dependent, as opposed to ORTHOG='L'. If historic negative operation
of MEXTRE required (it shouldn't be) then specify MEXTRE negative directly. NLAM is just
a user friendly map to MEXTRE.

19/09/23 asdeck30.17
Added a look-up table of the ground configuration orbital occupation numbers for every
ionization stage of every element up to Z=103. This is scraped from the ADAS adf00 files
which in turn were scraped from the NIST database. If the user sets MXCONF=0 and a new
variable NELEC (the number of electrons) in SALGEB, then AS uses this table (for the
appropriate nuclear charge NZION) to run the ground configuration structure. This is
itself is not exciting. But, potentially very useful for lanthanides/actinides if an
algorithm to generate a "compact" set of "low-lying" configs can be implemented.
Calculations of energies & radiative data for kilonova opacities can then be made highly
automated. An improved "default" potential(s)/orbital set is also highly desirable...

18/09/23 asdeck30.17
Write/read closed-shell orbital nl-values to/from CONFIG.DAT if user has defined them as
non-standard order (KCOR2.lt.0).

11/09/23 asdeck30.16
Added simple PPOT='FAC' which maps to FAC='YES'.
If FAC.eq.'YES' then switch-on PPOT='SCCA'.
Added PPOT='RATS' which maps to FAC='YES' with Lindgren & Rosen alpha & no Latter smoothing,
which is best guess as to Los Alamos Dirac-Hartree/Fock-Slater operation.

02/09/23 asdeck30.16
Historically, configuration average omegas were "normalized" s.t. to convert to
cross sections they are divided by stat.weight of the active electron pair of
the initial config of the transition - because CA does not depend on
spectators. But, this is non-obvious to users (adas) of adf04.
Now, omegas are normalized s.t. to convert to cross sections they
are simply to be divided by the total stat. weight of the initial config
as is written in the adf04 config/energy list at the top of adf04.
A side benefit is that these omegas match ls/ic omegas summed-over
all initial & final terms/levels (configuration and spin-orbit mixing
excepted, of course). If cross sections are output (see bcrossx hard coded flag in
SR.CADWX) then nothing has changed, since internally consistent.

01/09/23 asdeck30.16
CA array-out-of-bounds if user set NMETA.gt.number of configs.
CA commented-out conversion of omega to cross section used final stat.weight instead of initial.
CA/LS/IC previously commented-out code to write cross sections to adf04 is now
uncommented and access controlled by logical variable bcrossx. However, currently, this
is not present in a namelist, just set at the top of the relevant dw subroutines, to prevent
abuse/confusion.

23/08/23 asdeck30.15
Bug-fix for gfortran - if MAXE entered as REAL in SMINIM.

15/07/23 adaspe.f 2.11
Write PEC/DRS rate coefficients to adf38r alongside existing data, when JTEMP.gt.0.

06/07/23 asdeck30.15
Switch-off velocity gauge calculation and storage when not "used": unformatted output and no
photoionization, since bound-bound radiative data in velocity gauge is for info only on UNIT6.
Not an issue normally, but see large RLX issue below.

05/07/23 asdeck30.15
If user does not set a valid continuum interpolation energy range then AS attempts
to do so, based on target energies in TERMS/LEVELS. This is normally a single range
of energies but for well-spaced energies in TERMS/LEVELS corresponding to dn=0 and dn=1
it can set two separate ranges. This is important for K-shell Augers. But if user set
EMIN.eq.0 but EMAX.lt.0 only a single range was used still. (EMIN=0 is a common setting.)
Now fixed. But it is still the case that if the user sets EMIN.gt.0 (EMAX.lt.0) only
a single range is used, similarly if EMAX.gt.0 and EMIN.lt.0. Any user set non-negative 
EMIN or EMAX is potentially too difficult to second guess. 

05/07/23 asdeck30.15
Re-organized storage of one-body radial integrals. Historically, they were simply stored in
a 2D-array (MXORB,MXORB). (Leave aside the fact that only (MXORB*(MXORB+1))/2 are needed for
a given interaction.) This is o.k. for a unique set of orbitals, or even  BASIS='SRLX'
if the no. of groups is small, as it would normally be. But the memory required for BASIS='RLX'
explodes if one promotes a single electron up to high-n. E.g. to n=10 all l leads to 55 unique
orbitals. This in turn can lead to a few thousand configurations. Current RLX coding allows a
configuration to contain any or *all* of these 55 orbitals. This leads to MXCONF*MXORB(unique)
orbitals e.g. 10^5, and 10 billion elements in the relaxed (MXORB,MXORB) arrays.

The "flaw" in the RLX coding is that it envisages a small number of low-lying orbitals being in
use and that a configuration might use most of them. Clearly, a configuration cannot use more
orbitals than there are electrons. More precisely, we should only "count" the max number of
occupied nl-sub-shells. Also, RLX uses a common set of core orbitals, so they only need to be
counted once, for energy interactions, and not at all for radiative data, e.g. the r^k array.

All this "re-shaping" of (MXORB,MXORB) is more easily, simply and incrementally (developmentally)
handled if we simply store all such as vectors, e.g. of length (MXORB*(MXORB+1))/2 or MXORB*MXORB,
as necessary. Unused locations can also more easily be removed (length reduced).
*This has now been implemented.*
It "just" remains to implement the RLX use of MXCONF*No.occupied sub-shells.
This will reduce the size of the original problem to <10^4 relaxed orbitals and <10^8 elements
use of a few Gb memory opposed to a few 100 Gb.

Note, no such issues arise with two-body integrals because they have always only been calculated
and stored as required by the angular algebra, which requires simple explicit pointer arrays 
(or rather involved implicit pointers) to locate a given integral. In the one-body case,
such "pointing" was handled simply by the use of a 2D-array, the orbital nos trivially located
any integral. Now, with a vector, we just need to know how a vector is "packed" and how any element
can easily be recovered from it, again just using the pair of orbital nos.


26/06/23 asdeck30.14
IFACY=2020 only partially reproduces FAC2020 exchange "bump" in Z_eff(r) - in dialogue with Ming.
IFACY=2023 is identical to FAC2023, within numerics, for potentials created with s-orbitals.

21/06/23 asdeck30.14
Added IFACY variable (to SMINIM) to specify the FAC year to match potential to.
Currently, only 2020 is an alternative to 2023 (the default).

19/06/23 asdeck30.14
In order to avoid making the RESTART file backwards incompatible at this point,
write/read a packed IEQ(0) to/from RESTART for MXBORB,MXVORB,MXFORB,NGRP.
This is the only place where it is packed/unpacked and so can easily be adjusted
if necessary until it is convenient to "define" a new RESTART.

16/06/23 asdeck30.14
Fixes/improvements for DR/RR N-loop (non-default) user specification of n-mesh.
The user must always specify the range of sequential n-values NMIN thru MNAX.
The n-mesh must start at NMAX+1. If the user does not specify an n-mesh then one
is added automatically, up to n=999.
1/Added NMESH as an alternative specification to JND for the number of user-set n-mesh values.
2/If NMAX.gt.25 then draw attention to user that an n-mesh is being added by default
and user needs to set JND/NMESH=0 if they do not require extra n-values, e.g. because
comparing with experiment, where sequential up to the experimental cut-off is the usual
choice. This is in contrast with total rate coefficients where all-n are required.
AS setting the n-mesh by default was 1/to ensure all-n were present 2/to avoid the
weird and varied user-chosen n-meshes.
3/If user-set n-mesh did not start at NMAX+1, up to v27.x inclusive, AS added a mesh point
at NMAX+1. The switch to an allocated n-mesh array from v28.x gave out-of-bounds then.
4/ The above was only correct if the user n-mesh started at n.gt.NMAX+1.
If the user n-mesh started at n.lt.NMAX+1 then n-values were double-counted without warning.
Now, if the user-set n-mesh did not start at NMAX+1 then the user is warned and AS corrects
as above. But in the case of 3/ a large gap is possible, depending on the user n-mesh.
The user n-mesh could be anything of course, and un-related to total rate coefficients.
This is why AS changed to setting the n-mesh itself.

15/06/23 asdeck30.14
Due to its COMMON origins, MXBORB,MXVORB,MXFORB,NGRP were temporarily packed into IEQ(0) & IRLX until
the relevant COMMON was converted into a module, so as to avoid re-organization of COMMON when MODULE
was on the horizon. Although AS has no COMMON now, the original pack/unpack remained. This limited,
in particular, the continuum partial wave expansion for BASIS='SRLX'. These variables have been put into
MODULE COMMON_NRBORB and IEQ(0) and IRLX are no longer packed. They just contain simple flags for internal
operation of the different orbital bases which the user flags via BASIS.
Viz.
Default, unique basis (BASIS='  ')
IEQ(0)=0
IRLX=0
Fully-relaxed basis (BASIS='RLX'='RLX1',or 'RLX2')
IEQ(0)=-1
IRLX=1 or 2
Simplified relaxed orbital basis (BASIS='SRLX')
IEQ(0)=1
IRLX=0 for a unique core (default) or -1 for non-unique core (KCOR1.lt.0).

13/06/23 asdeck30.13
A logical variable associated with determining the Born array ixd34 size was not initialized, to .false.
The usual compiler issues applied: high-levels of optimization could "initialize" it to .true.
This caused the array allocation to be too small and caused AS to abort. (Re-allocation makes no sense
here because we know the size needed.) This is a v30.x issue only. V29.x did not attempt to determine
the exact usage, it just set a maximal value which was usually much too large than needed in practice.

27/04/23 asdeck30.13
Added NOCCX by which a user can specify which NOCC occupation number is increased by 1 in the
DW EIE branch so as to generate a continuum orbital potential with the correct asymptotic form.
(Can have NOCCX.gt.NOCC, but the orbital must exist in the original user specified MXVORB list.)
Similarly, NOCCX.lt.0 can be used to flag the use of a *different* FAC potential for the continuum,
using the original sum NOCC = N occupation numbers, but *without* any screening now. This is only
available when using the expert FAC switch to override safety protocols which align AS operation with FAC.
Both sets of continuum orbitals are no longer othogonal to the bound of course, but the "usual"
exchange overlap integrals take account of this. Such overlaps are *not* present in FAC.

25/04/23 asdeck30.13
Pass FAC potential directly through to DW EIE branch.
Similarly, pass through unique non-FAC potential (with user specified screening, via sum NOCC = N-1).
Both have the incorrect (large-r) asymptotic potential form: N-1 instead of N, of course.

25/04/23 asdeck30.12
Fixes to enable MEXPOT.eq.4 (Hartree-Slater) with non-FAC operation and MEXPOT.ne.4 with FAC operation,
more for consistency than anything else.

24/04/23 asdeck30.12
ISTATIC=4 is now the default. See below.

21/04/23 asdeck30.12
Added ISTATIC variable to SMINIM0. For MEXPOT.ge.ISTATIC only the direct monopole potential is used.
This only applies to SCCA operation (FAC and non-FAC) since the STO potential itself is static.
Note, in such an instance, the max exchange multipole is limited to be zero as well.
The main reason for this is for FAC operation, since the higher direct multipoles are of no
great issue for non-FAC SCCA operation - mostly harmless.
In the case of FAC using a local Hartree-Slater exchange (actually, any local exchange, in principle)
it is only the equivalent electron (direct) higher multipoles that necessitates forming the
probability density weighted average. Formally, Hartree-Slater only uses the direct static term.
It appears that FAC uses the formal Hartree-Slater potential.
ISTATIC.eq.5, historic default. Only Furness & McCarty is static.
ISTATIC.eq.4, means FAC Hartree-Slater potential does not need to be averaged. This will be the default.
ISTATIC.le.3, such MEXPOT are normally used only by non-FAC operation.

21/04/23 asdeck30.11
Write some info on convergence, or rather lack-of, of SCCA.

20/04/23 asdeck30.11
In SR.RADCON, restore the change potential norm back to that of SR.RADIAL before returning there.
The continuum norm is different (SR.RADCON subtracts the point and multiplies by 2).
The input potential maybe used, rather than overwritten by a newly generated one.
Either way, its norm should eb consistent with SR.RADIAL.
***TBD: check that the FAC potential is passed correctly through to the EIE branch.

20/04/23 asdeck30.11
Catch some extreme occupation number bugs and restrict user from going there as well.

18/04/23 asdeck30.11
Reversed change of 14/04/23 asdeck30.10.
POTIN='AS' now checks the first line of the 'potin' file to detect which input format.

17/04/23 asdeck30.11
If no promotion rules in use, then did not check for illegal config occupation numbers!

17/04/23 asdeck30.11
When FAC='FAX' expert switch in use, now default to Hartree-Slater (MEXPOT=44).
Can still override and use OLD non-local exchange potential (MEXPOT=00), of course.

14/04/23 asdeck30.11
Re-SPAGged.

14/04/23 asdeck30.10
POTIN='AS' now reads impact/radial format only if NZION.lt.0 and instead reads
simple X, V(X)*X input if NZION.GT.0 - see SR.POTIN for exact form.

14/04/23 asdeck30.10
POTOUT='YES' now writes to file 'potout' rather than 'radout' - only the potential
header was written to radout previously. Currently, it is not possible to write
radout and potout at the same time (they still use the same UNIT). Thus, RADOUT='YES'
will override, since it contains the orbitals as well.

13/04/23 asdeck30.10
The FAC Hartree-Slater iteration now starts-off with an equivalent STO potential,
albeit the tail potential is corrected non-smoothly. 

12/04/23 asdeck30.10
FAC actually smooths and corrects the Hartree-Slater tail potential directly,
rather than matching/switching-to the analytic form.
The hartree-slater charge Z_HS, which is Z-N asymptotically, is corrected
for x.gt.x2 by adding 1+a*exp[(x2-x)*b] where x2 is defined by Z_HS(x2)=Z-N+1+a
The fac default is a=0.55 and -a*b is the derivative of Z_HS(x=x2), which defines b.
Set fac_csi in &SMINIM to override ("csi" is the FAC named variable.)
This has now been implemented in AS. The fit no longer plays any direct role here. 
The lambda which defines the fit, and the matching charge, is printed to olg for info.

06/04/23 FAC releases
FAC does not readily change version numbers, e.g. v1.1.5 has been the development version for
the last 7 years. The latest official relase v1.1.4 is dated 09.11.2016.
The GitHub archive contains all developments.
The original non-local exchange potential appears to have been dropped in the early 2000s.
Gu (2003) makes reference to Dirac-Hartree-Slater, despite Gu (2008) describing
the original non-local form.
More recently, there are changes, relevant to this work, in the exact form of Hartree-Slater
potential (probably the tail) between FAC2020 and FAC2023.
AS is being synch'ed with FAC 23.03.2023. Earlier versions of FAC (e.g. 20.04.2020) are not
recommended for exact correspondence. If you have not downloaded FAC this year, do so.

31/03/23 asdeck30.9
Implemented a "smoothing" and "tail correction":
for z(x) = (z-n+1)+(n-1)exp(-lam*x)
match to numerical hartree-slater at user/default charge z(xi), which defines xi
then lam=-log{[z(xi)-(z-n+1)]/(n-1)}/xi
n.b. at the mid-point z(xi)=(z+z-n+1)/2,  lam=log(2)/xi
This AS-FAC potential agrees with column 6 of the FAC GetPotential() output file up to the matching point.
Thereafter, the analytic form replaces the numerical and so it now agrees with column 5 of said file.
*** FAC='YES' now maps to 'NEW', given the closeness of the potentials.

30/03/23 asdeck30.8
Added FAC look-up table for automatic determination of "faca". This is a C-to-Fortran conversion.
FAC actually has a number of variables which can be set to vary the default viz. HXS, AHX, IHX, HX0, HX1.
(RHX, DHX, BHX, CHX are also associated with this potential, but their role is not yet known - radial mesh?)
They (the first 5) are all available in &SMINIM prepended by "FAC_". The user will not normally set them.
One does not need the eXpert FAC flag to change these since they are FAC options.
The eXpert switch just allows user-override of AS options which should be set to mirror FAC,
and which FAC='YES' forces.
To switch easily between "old" (non-local) and "new" (local) FAC exchange potentials, rather than
needing to know the MEXPOT value, the non-eXpert flags  FAC='OLD' and FAC='NEW' are available.
Currently, FAC='YES' maps to 'OLD'. It will be changed to 'NEW' once smoothing is implemented.

29/03/23 asdeck30.7
FAC Hartree-Slater exchange *also* changes the direct potential, it removes the self-screening
correction and so follows the original Hartree-Slater prescription. This gives a better
description at small radii but gives an incorrect asymptotic charge, viz Z-N instead od Z-N+1.
For this reason, local exchange potentials were developed by Cowan and Lindren & Rosen etc.
which started from the correct direct screening and instead modified the exchange term.
This correspondingly makes the exchange term smaller, e.g. it is zero within nl^2 and very small
between nl^2 and n'l'^2. The "advantage" of the original Hartree-Slater exchange potential is
that it is non-negligible even in such cases and so provides a suitable form to be optimized/varied.
Recall, the coefficient is a variation of the standard (3/4pi*pi)**1/3 (a.u.)
determined by optimizing the ground configuration. A look-up table in FAC spans "all"
sequences and charge states - it is slowly varying, typically 20% larger than the 0.4235 above.
The issue of the incorrect charge is handled by first the expedient use of max(Z(r)_HXS,Z-N+1), as
commented-on by Cowan, and a subsequent smoothing around the switch-over point.
See Cowan's book, Ch.7-11 thru 7-13, for a thorough discourse.
AS now mirrors FAC operation of the direct self-screening and applies the correct asymptotic charge,
but non-smoothly.
TBD.
Add the FAC look-up table to determine the default exchange coefficient (FAC's AHX) automatically.
Apply the FAC smoothing approach, once it is known.

22/03/23 asdeck30.7
Read the a-coefficient (AHX) of the FAC Hartree-Slater exchange potential via "faca" in NAMELISYT &SMINIM.

17/03/33 adasdr 3.19
Minor. Error message about missing rate file (o1,o1u etc) had gotten out-of-sync with an
error message about missing n-mesh file - confusing for new users.

17/03/23 asdeck30.7
Furness & McCarthy local exchange 1/4pi was not missing, it "cancels" with an 8pi factor
in the original formulation.

16/03/23 asdeck30.7
The v30.7 development introduced two bugs for SCCA non-FAC operation:
1/ If no small component was used (IREL=1, default) then the probability density
was P, not P**2, when evaluating a local exchange potential, which caused a floating
point exception. Note, a continuum orbital always uses local exchange.
2/ The continuum MEXPOT is zero, and this was no longer coded-for (for bound orbitals 0 means non-local.)
It is now mapped to Furness & McCarthy again. N.B. Previous implementation of Furness & McCarthy appears
to omit a factor 1/4pi - no, see 17/03/23. TBD, allow use of alternative local exchange potentials,
probably via MEXPOT0 which flags the initial STO exchange potential - see below.

16/03/23 asdeck30.7
FAC='YES' did not set KUTOO=1.

15/03/23 asdeck30.7
POTIN='FAC' now aligns &SMINIM switches with FAC operation, in the same manner as FAC='YES'.
And, both will re-set KUTOO=1 back in SR.ALGEB0 where &SMINIM is now pre-read.
(POTIN='FAX' will allow eXpert override of FAC default KUTOO if you think you know better...)

14/03/23 asdeck30.7
Historic read of unique external potential compared its asymptotic charge with that expected by AS
and corrected the normalization if necessary (incase user got it wrong by a factor +/-/2). However, 
cannot predict the FAC potential's asymptotic charge - recombining or recombined ion, for example.
So, switch-off the normalization check in this case, since we know the format of the FAC GetPotential() file.

10/03/23 asdeck30.7
Prior to the updating of local exchange potential options/usage 07/03/23 none of the options available
to start-off the iteration (based ON STO potentials) were available for subsequent iterations, and
vice versa. (When iterating, the only non-local was Furness & McCarthy, which was/is not an STO option.)
So, all MEXPOT.gt.0 used Furness & McCarthy subsequent to the STO choice specified by MEXPOT.
Now, one may want to choose different non-locals in the two stages, e.g. to test sensitivity to
the starting potential, or to switch on/off an STO local exchange independently of subsequent usage.
Thus, MEXPOT now supports two digits in such instances.
The first digit is the value for STO local exchange and the second digit that for subsequent iterations.
Not all combinations are valid/desirable, but all possible are allowed.
The default is unchanged, MEXPOT=00 uses non-exchange STO potential and non-local for subsequent iterations.

C
C IF NOT ITERATING THEN (ALL STATIC +/- LOCAL EXCHANGE)
C   MEXPOT .LE. 0 HARTREE STO POTENTIAL (I.E. NON-EXCHANGE)
C   MEXPOT .EQ. 1 HARTREE-EXCHANGE LINDGREN & ROSEN (ALPHA=4/9 RYD)
C   MEXPOT .EQ. 2 HARTREE-EXCHANGE LINDGREN & ROSEN (ALPHA=2/3 RYD)
C   MEXPOT .EQ. 3 HARTREE-EXCHANGE COWAN (K_X=2/3 RYD)
C   MEXPOT .EQ. 4 HARTREE-SLATER (RESERVED FOR "NEW" FAC)
C   MEXPOT .GE. 5 AS .EQ. 0

C IF ITERATING THEN THE FIRST ITERATION USES AS ABOVE, AND SUBSEQUENT ITERATIONS
C   MEXPOT .LT. 0 HARTREE MULTIPOLE POTENTIAL (I.E. NON-EXCHANGE)
C   MEXPOT .EQ. 0 PLUS *NON-LOCAL* EXCHANGE (CONFIGURATION-AVERAGE)
C   MEXPOT .EQ. 1 PLUS LOCAL EXCHANGE LINDGREN & ROSEN (ALPHA=4/9 RYD)
C   MEXPOT .EQ. 2 PLUS LOCAL EXCHANGE LINDGREN & ROSEN (ALPHA=2/3 RYD)
C   MEXPOT .EQ. 3 *** COWAN NOT-CODED ***
C   MEXPOT .EQ. 4 PLUS LOCAL EXCHANGE HARTREE-SLATER (RESERVED FOR FAC)
C   MEXPOT .EQ. 5 STATIC PLUS FURNESS & MCCARTHY LOCAL EXCHANGE.
C
C TO USE A DIFFERENT MEXPOT>0 FOR THE FIRST (STO) ITERATION, SPECIFY
C   MEXPOT .GE. 10 THEN THE FIRST DIGIT IS USED FOR THE FIRST ITERATION
C  (MEXPOT0) AND THE SECOND DIGIT IS THE MEXPOT FOR THE SUBSEQUENT ONES
C   E.G. MEXPOT=10 USES THE LINDREN & ROSEN ALPHA=4/9 RYD LOCAL STO
C        EXCHANGE AND THE NON-LOCAL EXCHANGE FOR SUBSEQUENT ITERATIONS.
C   MEXPOT .EQ. 00 IS THE DEFAULT
C   MEXPOT .EQ.  n IS EQUIVALENT TO 0n, I.E. NON-EXCHANGE STO STARTS.
C   MEXPOT .EQ. n0 (n>0) MIGHT BE APPROPRIATE IN SOME CASES,
C                  E.G. TO TEST SENSITIVITY TO THE STARTING POTENTIAL.
C               nn MIGHT BE PREFERABLE TO 0n, BUT NEEDS TO BE USER SET.
C               mn (m>0.ne.n>0 is possible but likely not of interest.)

08/03/23 asdeck30.7
FAC potential is an iterated unique weighted average. But the iteration started-off with the
usual non-unique STO model potentials. Now form the same weighted average of STO potentials.
Less susceptible to the final converged answer being dependent on the initial starting potential.

07/03/23 asdeck30.7
Mirrored the different (local) exchange STO potentials (found in SR.ZEFX) in self-consistent operation (SR.VPNL),
except for the Cowan potential (MEXPOT=3).
Also, added, in both, the simple Hartree-Slater potential (MEXPOT=4).
Lindgren & Rosen (MEXPOT=1&2) forms are preferred, normally.
But, the "new" FAC potential uses such a (scaled) Hartree-Slater, its *exact* form is not yet known - see
29/03/23 for details.
Default (MEXPOT=0) is still Hartree non-exchange for STO potential followed by non-local exchange when
self-consistent.

01/03/23 asdeck30.6
Relaxed tolerance in test to switch between STO and Clementi norm when reading-in external orbitals via SRADWIN.
For cases where overlaps with internal overlaps are large. The "problem" being that it checks the norm *after*
Schmidt orthogonalization. The same problem could arise still if the overlaps are larger than the original example
that fell-over. The user then needs to overide and flag the correct norm for that orbital. This can be done by
entering a second integer on line 1 of each orbital input, >0 if the input orbital has STO norm and <0 if it has
Clementi norm. If the user does not know the status of each orbital's norm then run with ORTHOG='NO' and the norm
of each orbital is printed under the column FNORM. It will either be 1 (STO) or distinctly smaller (Clementi).
Note that line 1 of each orbital input is fixed format 2I5 (actually, a more general header, so don't stray beyond
col.10) so the second integer must be after col.5. The first integer should not be after col.5 either.

15/02/23 asdeck30.6
Enable expert override to use Furness & McCarthy local exchange potential option with FAC potential.

08/02/23 asdeck30.6
Historic KUTSS=0 is re-set to 1, 2-body fine-structure on for dfirst (assumed ground) config.
This can give unexpected results when looking at bound-free problems since the first
config can change (e.g. if it was "assumed" to be N+1). Now, KUTSS=0 is re-set to -1, i.e. OFF
and a warning written to user to set KUTSS=1 if that is the real intention.

03/02/23 asdeck30.6
Update READ of FAC potential by SR.POTIN (case &SMINIM POTIN='FAC') to align with current contents
of FAC potential file.
Attempt to subtract any numerical FAC finite nuclear potential and then 
"add" it back analytically (via INUKE user setting) since AS requires such.
Added POTIN='AS' as equivalent to historic 'HFFC' which is impact/radial format.
POTIN='YES' is *no longer* a valid input flag. The user needs to think about the format of their
potential file and whether/how to align it with what SR.POTIN supports.
Fixed possible overwrite of this potential array when calculating QEDINT - need to hold unique read.

01/02/23 asdeck30.6

*** &SMINIM INUKE=1, IREL=2, QED=1 are now FIXED when FAC='YES' ***

Minor synching with FAC:
1/The PPOT='SCCA' default is not to iterate closed-shell orbitals (set by user in &SMINIM).
This was still the default for FAC='YES'. Now FAC='YES' iterates closed-shell orbitals by default.
Any/all orbitals can be flagged to be iterated on, or not e.g. if they are problematic, using the IFIX flag.
For IFIX orbitals, read-in +1 to not iterate (i.e. fix), -1 to iterate and 0 to use the default.
These are read-in after the NOCC occupation numbers. This is not a new option, but it was not well documented.
(Actually, only the sign currently matters and trailing zeroes need not be read.)
2/FAC (appears to) default to using a non-uniform (Fermi?) finite nucleus, as opposed to the uniform
one described in Gu (2008). AS defaults to (Bogdanovich & Rancova fit to Fermi) non-uniform finite nucleus
for Z>30, but a point nucleus elsewise. It can be switched on via INUKE=1.
3/FAC defaults to including the small component. Since AS is kappa-averaged, the default is always to omit it.
Nevertheless, more precise agreement with FAC can be achieved by switching it on via IREL=2.
4/The PPOT='SCCA' default is to scale exchange by a factor 0.8, a la Cowan. Now off for FAC.
5/FAC defaults(?) to including QED. AS always omits it by default. It can be switched-on via QED=1.
6/Finally, if FAC includes the Breit interaction then switching-on the orbit-orbit interaction via KUTOO=1
back in &SALGEB can give improved agreement. Changing the fine-structure defaults does not, in general,
and the two-body fine-structure angular algebra can be time consuming.
(FAC='FAX' will allow eXpert override of FAC default INUKE,IREL,QED if you think you know better...)
In contrast, the SALGEB KUTOO algebra flag will always need to be switched-on by the user.
(SALGEB KUTSO, KUTSS can also changed from their default by the user, if they know better...)

25/01/23 asdeck30.5
If the number of unique bound orbitals exceeded half the number that can be labelled using Eissner notation,
then relaxed orbital cases limited the nl-values written to o/ca/ls/ic(u) to that half value (currently 31)
due to them being written via a single vector of length twice the number of orbitals (holding n & l)
rather than writing the separate nl vector pairs in the unrelaxed case.
Post-processors complain about needing a bound orbital not defined in the o/ca/ls/ic(u) header.

20/01/23 asdeck30.5
If the number of relaxed orbitals exceeded 100000 then a flag checking alignment of bound and
continuum orbitals was incorrectly triggered.

19/01/23 asdeck30.5
Born integral memory requirement is now determined by a fast double pass through the Born loops,
without any calculation of integrals. This eliminates the large (overestimate of) memory requirement
for RLX, in particular.

19/01/23 asdeck30.5
Born data with SRLX non-unique core (KCOR1=-1, not default) gave dimension exceeded due to incorrect
specification of Born memory allocation, which is why we don't delete the historic dimension tests.
In the unique case it is simple to determine the maximal usage and it is not too large an overestimate.
But the more relaxed the case the greater the maximal usage overestimates, especially RLX.

13/01/23 asdeck30.4
User specified occupation numbers (via NOCC) when FAC='NO' are meant to be fixed, leading
to a unique potential again. This means there can be no "dynamic" application of self-screening.
The usual choice of occupation numbers then is for the N-1 electron ion when describing an
N-electron ion. This is in contrast to FAC='YES' where self-screening can be taken account of
(and so the occupation numbers are for the ion being described) because an average is taken
over "all" potentials, resulting in the "correct" asymptotic charge.
This worked as it should (for NOCC.gt.0 FAC='NO') when no iteration was flagged (PPOT='', default)
i.e. one was solely using/optimizing the STO model potential.
But when PPOT='SCCA' (and NOCC.gt.0 FAC='NO') it picked-up the FAC='YES' self-screening flag still
on the second and subsequent iterations. It now works as intended, i.e. as in the non-iterative case.
Note: if one wants to allow for self-screening, and hence non-unique potentials, then 
one should use the historic flagging of a configurations to supply the occupation numbers.
This "forces" that a potential for a given orbital must contain the orbital.
Otherwise, without averaging, this can give orbitals seeing different asymptotic charges
within a given charge-state. For bound-free problems, it is possible to specify a combination
of recombining and recombined configs, but one should be consistent about how it is done,
although AS does not "check" for such, only that an orbital exists in the configuration
being flagged to be used to define its potential occupation numbers. See the discussion in
AS working Notes No.3 for further details.

11/01/23 asdeck30.4
Added some test-code to form FAC potential weighted by occupation numbers only,
i.e. no probability density...

23/12/22 asdeck30.4
If number of (RLX) relaxed orbitals (MXORB) exceeded 65535 then MXORB*(MXORB+1)/2 exceeds 2^31-1
and so default standard integer (SP) needs to be re-set to long integer (EP) in module PRECSN,
else similar cryptic failure as 22/12/22.

22/12/22 asdeck30.4
If number of (RLX) relaxed orbitals exceeded 32768 (=no. unique orbs x no. of configs) then short
integer (QP) needs to be reset to default (SP) in module PRECSN, but there was no check and code gave
nonsense due to integer overflow (if error bounds enabled then would stop with negative array index set.)
Unlikely to want to use in practice (prohibitive timewise) but not difficult to set-up
a problem with a 1000 configs with electron promotions to n=8 (the two are connected).
Of course, should really use BASIS='SRLX' since configs are of the form core+nl and so
all nl should move in the same small number of core potentials.

20/12/22 asdeck30.4
The "bug-fix" that lost the capability to drop Rydberg configs was actually due to the enabling
of Rydberg loop with non-continuum, i,e, a pure structure run. It was flagged by the presence
of a Rydberg in a structure run. Now, set RUN='RYD' to carry-out a structure run with Rydberg
orbitals, e.g. for l-changing PWB collisions strengths (the original motivation).
If RUN='  ' then Rydberg orbital configs are dropped still. So, both features are now operable.

19/12/22 asdeck30.4
DR with core-rearrangement Augers requires AS to drop N-electron configs containing the Rydberg orbital
from the structure run with scripts (manually, the user just restricts MXCONF to the non-Ryd target configs.)
But this capability (for script work) was lost with v27.133.1 "bug-fix" of 26/10/20. Now re-instated.

08/12/22 adasexj 3.21
Internal convolution mesh for DW failed if user set the AS EMAX << max T.
Now works as expected. There was always a warning written to adasexj.out if the largest T
(default or user) was too large for the largest (default or user) AS scattering energy.

30/11/22 adasdr 3.19
Tweaked TYPE 5 binning range for dn=0 DR.
If observed energies are in use then the highest maybe larger than the highest calculated target.
Don't want EMAX to truncate.
Also, if NECOR is zero for dn=0, the EMIN was re-set small but non-zero, since any near
threshold resonance is highly uncertain in its position. This was to use less log energies.
But we don't want to omit it since it won't be omitted by TYPE 3. A warning was written but the
run_PP script only picks-up errors. So this has been commented-out.

25/11/22 adasdr 3.19
Test code which reads a file of matched AS energies and better/best/observed energies (e.g. RMBPT)
for the (N+1)-electron recombining ion - bound and autoionizing levels. The AS resonance energies
are thus adjusted. This is for n-mixing cases where the use of the Rydberg formula may not be accurate.
N-electron energies are adjusted as usual. But the user must now align the ground-state of the N-electron
system embedded in the (N+1), i.e. the ionization limit should match observed, or at least be
consistent with the "RMBPT" energies. This alignment is not necessary in general when usuing the
Rydberg formula.

24/11/22 asdeck30.3
Bound-continuum processes with BASIS='RLX': if the user specified the configuration to be used for the
occupation numbers for the common closed-shell core orbital potentials then the occupation numbers
for the potentials for the Rydberg/continuum orbitals reverted to being some average of the Ryd/
continuum configuration ones (the precise average depended on the AS version). It has not worked for
many years, if ever. The default operation was fine: occupation numbers for closed-shell orbital
potentials are an average over all configs and so are some average of the two charge states.
The only reason for the user to specify is to fix to the electron-target so that its LEVELS file
exactly matches the channel energies.

22/11/22 asdeck30.3
Change of 16/09/22 (to asdeck30.1):
------------------
 Tweak AS determination of min autoionization interpolation energy (when not user defined)
 for case of including multiple different autoionizing n-values. Normal 1->n,n say was fine,
 but 1-2,n-2,3,4,5... was a little too large (for n=2) at low-Z. So, was extrapolated a little.
------------------
did not check higher n still for normal case. This is an issue if the lower one is clearly bound!
The higher n determines the lowest energy. Affects 1->3,3 say, as misses 3->2, but 1->2,2 fine.

21/11/22 adasdr 3.18 adasrr 3.12
See also 16/08/22
ITYPE=-5 now gives both TYPE-3 and TYPE-5 adfxx files.
This is mainly for DR since in this instance the TYPE-3 are determined from the binned cross sections
and so comparison with the default ITYPE=3 gives an indication of the accuracy of the binning since
the latter uses exact resonance energies, not binned, and so is "exact" at low-T.
TYPE-3 data should always be calculated this way (ITYPE=3), which is the default if ITYPE is not user set.

17/11/22 asdeck30.3
Fix possible floating point exception in SR.WHITEX due to plasma potential neutralization.
Exacerbated by relativistic correction to asymptotic charge not being neutralized for WHITEX by SR.RADWAV.

15/11/22 asdeck30.3
Added non-uniform ion-sphere potential of Li, Rosmej, Lisitsa & Astapenko Phys.Plasmas 26, 033301 (2019).
This is an analytic "fit" to the results of self-consistent (Kohn-Sham) calculations and avoids the need
for such self-consistent calculations. It is characterized by a parameter "b" in the paper, which we label
XBEE for (optional) user input. b=0 corresponds to the uniform (free-electron charge distribution)
ion-sphere case while b=2 models a Maxwell-Boltzman free electron distribution within the ion sphere.
Larger values (e.g. b=4) appear to model the Fermi-Dirac lattice structure that forms at high density.
If the user does not set XBEE explicitly then PPOT='ISMB' and 'ISFD' selects these two cases, while 'IS'
returns the original uniform case. The non-uniform case requires a meaningful temperature to be set.
In the uniform case any temperature set just gives some plasma related info, e.g. Debye radius.

09/11/22 asdeck30.2
Read of external orbitals in SR.RADIAL by SR.RADWIN with PPOT='SCCA' skipped calculation of any continuum.
This could crash due to array out-of-bounds due to incorrect indexing of the Hamiltonian due to bypassing
SR.RADCON. At best, nonsense is returned
In this case, the external orbitals are read before any internal are calculated and then the usual call
to SR.RADWIN afterwards is skipped, but it also skipped the call to SR.RADCON.

08/11/22 asdeck30.2
MVD change of 19/10/22 accidentally turned-on MVD in pure LS when CUP='IC'.

04/11/22 asdeck30.2
There has long been the option to generate a FAC-like potential within AS, but nl-configuration-resolved
as opposed to nlj-subconfiguration-resolved, via NAMELIST SRADCON PPOT='SCCA' FAC='YES', and NZION.lt.0.
However, it was only implemented for a pure structure problem since it was not clear to me what FAC used
for the continuum. (If a continuum were present then AS would only run with the FAC potential for the
electron target and the continuum used the usual STO orbital-generated potential and occupation numbers.)
Following discussion with Chunyu, it is clear that FAC always uses a unique potential and the bound and
continuum orbitals use the same potential. In a bound-free process, the recommended practice (by Ming Feng Gu)
is to use a potential that describes the recombined ion, although it is easy to switch to one that describes
the electron target. The unique set of occupation numbers is best set by the user reading in the number
of them (only the valence should be specified) via NAMELIST &SMINIM NOCC=3, say, and specifying the
three occupation numbers (here) directly afterwards (no other data is likely read before them - see the end
of Section 4d of the WRITEUP.
Extensive checks have been added to try and stop the user from doing anything unphysical/not recommended.
The FAC potential has *not* been implemented for electron-impact excitation in AS since it appears to require
a "dummy" n~10 orbital added to the target so as to give the best compromise for screening for bound and
continuum orbitals using a unique potential. 
The FAC potential within AS is just for testing/comparison purposes when comparing AS standard non-unique
potential/orbital results with those from FAC calculations.

21/10/22 adaspe 2.10
If there is no continuum present (NTAR=0 then) and the user has not set TEAPOT to the total
ground state energy, then use the energy on any target terminator present in adasin.

19/10/22 asdeck30.2
Added an MVD variable to SALGEB to give more control over the perturbative (one-body) Mass-Velocity
and Darwin operators, this should not be needed normally.
MVD='   ' does nothing MVD operations controlled by CUP still.
   ='YES' is an alternative to appending M to the coupling scheme.
   ='NO'  enables MVD to be switched-off during IC, if they get too large.
The "correct" AS solution is to solve the kappa-averaged Direc Eq.
But if non-relativistic orbitals are needed (e.g. ICFT).
Of course, the  energies are "poor" then.

14/10/22 asdeck30.2
Minor: if user set LMAX.ge.NMAX and JND=0 then got data for N=LMAX+1 (and warning about radial
array too short). This may not be desirable.

13/10/22 asdeck30.2
Various fixes/warnings for STO potential generation, for bound-free problems, when the user
did not specify occupation numbers via configurations (MCFMX.gt.0).
E.G. averaging over configurations (MCFMX.le.0) likely gives rise to unphysical asymptotic potentials.
Use of user supplied occupation numbers (via NOCC.gt.0) gave incorrect asymptotic potential for
continuum orbitals.

06/10/22 adasdr 3.18
Non-Rydberg runs (AS RUN='  ') which used energy corrections but did not create an adf09 file
(NBIN.gt.0) did not determine the autoionizing parents. As such, the last parent correction 
was used for all.

05/10/22 asdeck30.2
Removed anachronistic KUTSS=-9 to flag all possible 2-body fine-structure interactions.
It has long been covered by KUTSS=-MAXCF where MAXCF is the total number of configs,
or any |number| greater than MAXCF. KUTSS=-9 is legacy of I2 fixed-format input.
Thus, it is now possible to set all 2fs between the first 9 configs, however unlikely
an event that may be. In this instance, we write a warning if the user sets KUTSS=-9.
The main point is to focus on the general properties of KUTSS, not recalling obscure
values such as -9, which mean nothing to new users.
We do still allow historic KUTSS=0 as switching-on for the first/ground config only.
KUTSS=-1 has long been advertised as default, with *all* 2fs being omitted.
This change is *NOT* ported back into v29.x, but the v29.x WRITEUP has been modified
to make no reference to KUTSS=-9 and to direct the user to use -MAXCF instead.

04/10/22 adasdr 3.17
Obscure bug-fixes for case of large set of n-mixing configs and use of NECOR.

04/10/22 asdeck30.1
If the user specified a plasma potential but did not read (via NDEN) any density/temperature then
AS aborted trying to access an unallocated (density/temperature) array. Previously (v27 COMMON)
NDEN=0 used a zero density/temperature pair to test the plasma loop with no plasma to check agreement
with the explicit case of no plasma. Can still be accessed by setting NDEN=1 now and reading 0.0/0.0.
(Note: historically v26, NDEN=0 was re-set to 1.)

04/10/22 asdeck30.1
By default, switch-off orthogonalization if (radwin) external orbitals are in use, unless user explicitly asks
for such via ORTHOG='YES' or any of the alternatives which explicitly specify orthhogonalization.
This is the opposite of historic default, for safety.
It remains the case that the user can decide whether to supply orthogonal or non-orthogonal orbitals,
and choose whether to orthogonalize or not internally. There has never been, nor is there currently,
any option to treat internal and external orbitals separately within AS. The whole set is orthogonalized,
or not by AS.

30/09/22 asdeck30.1
Re-instated "option" to use a finite nucleus with otherwise non-relativistic orbitals,
which was lost when its memory moved from COMMON to ALLOCATE (it was only ALLOCATEd when
kappa-averaged orbitals were in use.)

28/09/22 asdeck30.1
If external bound orbitals read but continuum internal still, then no Auger rates were calculated
if user did not set the range of allowable energy extrapolation (ACE) because the usual default
of zero was not re-set to very large in SR.RADWIN. Historically, this did not matter since 
SR.RADCON is called after SR.RADWIN and ACE was re-read/re-set there. But now, with ALLOCATBLE versions,
the SR.RADCON NAMELIST is pre-read (via SR.RADCN0) in SR.MNINIM before the call to SR.RADWIN
and then skipped in the subsequent call via SR.RADCON after the call to SR.RADWIN.

27/09/22 asdeck30.1
The "radout" file written by v29.x at some point during its development changed the format of the
orbital header line slightly. This deviated it from the expected read format by R-matrix etc.
It might have been read o.k. still by some compilers, but certainly not all. The effect should
be obvious/fatal.

27/09/22 asdeck30.1
Using NXTRA,LXTRA in combination with flag of reading external orbitals from file radwin failed
because the extended list was taken to be external as well, if the last read had n=70.
Even if the last read was internal, it still failed on checking the external n being larger than internal.
Now, set-up/testing uses mod(n,70).
TBD: Extending the list when an explicit Rydberg orbital (for core re-arrangement) in MXVORB is present
will still fail.

27/09/22 asdeck30.1
Any QED requested was ignored (for all orbitals) if external orbitals read (from file radwin).
Now, SR.RADWIN calculates it, as necessary. This also showed-up a SR.RADWIN error in the screening
parameter determination from Z, N and the e-energy. It was only used for info in the past.
Now it is used in determining the self-energy when SR.RADWIN is called.
SR.RADIAL determined it correctly.

26/09/22 asdeck30.1
If 2-body fine-structure switched-on during a Rydberg l-loop run then could abort
by incorrectly claiming dimension exceeded. All historic dimension tests remain, as
a safety check. But the number of 2fs integrals is not monotonicly increasing with l.
It increases initially and then decreases. The number found during the calculation is checked
against the number allocated, but the test was on the max global found, not the current l.
The smaller allocation was correct, the incorrect check tripped-up the code.
When the memory was in COMMON it would have been the global usage that mattered.
Allocation is done afresh for each new Rydberg l, and so only the current actual is needed.
All earlier allocatable versions are affected (27-29). Only the current public version (29.21.2)
has been corrected since clearly it is a little used option.

22/09/22 asdeck30.1
Tweak radial mesh near nucleus for low nuclear charge when relativistic orbitals in use still.

16/09/22 asdeck30.1
Tweak AS determination of min autoionization interpolation energy (when not user defined)
for case of including multiple different autoionizing n-values. Normal 1->n,n say was fine,
but 1-2,n-2,3,4,5... was a little too large (for n=2) at low-Z. So, was extrapolated a little.

14/09/22 asdeck30.1
v28.x and v29.x aborted if radial mesh is too coarse for finite nucleus (INUKE=1).
Need to re-run with step halved or more. Prior to then, the code simply halved and
re-ran. Again, this is an allocation issue to recover from. Since this only happens
with small nuclei (Z<18) we simply re-set to a point nucleus (INUKE=-1) if Z<30 and
warn user. If Z>30 we abort - should not happen.

12/09/22 asdeck30.1
v28.x and v29.x segmented if user specified finite nucleus with non-relativistic orbitals
as its potential arrays are only allocated if relativistic orbitals are in use.
Prior to then, they were in COMMON and so it was possible, if of little physical import.
Now, if user requests finite nucleus, switch to point (and warn) if non-relativistic
orbitals in use. If a user really wants a finite nucleus for use with (sic) non-relativistic
orbitals then it could be re-implemented...
Note, it is still possible to specify a point nucleus for use with relativistic orbitals,
but a warning is now written if Z>30.

01/09/22 asdeck29.21
************** Public release of v29.21 as the default AS distribution **************

The Intel ifort compiler, along with associated Math Kernel Library (MKL),
is now the recommended compiler. Note that gfortran can link also to the
Intel MKL. This (MKL) is the recommended way to use the BLAS/LAPACK version
of AS (e.g asdeck29_lap.f95). See the updated INSTALL file for more details.

It is important that you read the AS v29.21 release notes in the RELEASE29 file,
before querying me about differences between the results obtained from v29 vs v28.
Expect to be re-directed there otherwise.

The present developments have been more focused than in recent releases
and so the number of bugs fixed should exceed those introduced.
A number of the bugs fixed relate to using a combination of two little used
options, each of which worked fine on their own.
A complete history of the v29 development programme over the past year can
be found in the UPDATES file, which maybe somewhat opaque at times... 

It has been extensively tested on the latest version of all major compilers
(the MS Windows environment of the Intel ifort excepted.)
Nevertheless, please report any problems you encounter and send me details
of the compiler and its version number, the input (das) file which generates
the problem and the corresponding output (olg) file, along with a general
description of the problem. Many of you seem to think that I am a mind reader.

*************************************************************************************


25/08/22 asdeck29.21
Change default for RUN='PI' or 'RR' to *not* calculate autoionization rates, unless the user
specifically requests them via AUGER='YES', so as to save on time/memory and because
1/one rarely requires both at the same time and, more importantly,
2/the default photoionization energy mesh is not suited to autoionization, it being
  coarse (spanning a wide energy range.)
Similarly, if RAD='  ', then do not calculate radiative rates when RUN='PI' or 'RR', which
is consistent with needing to switch them on otherwise. Historically, radiative rates got
switched-on because photoionization requires the radiative angular algebra and there was no
differentiation. Unlike Augers, the user has long been able to switch-off radiative rates when
photoionization is being calculated by setting RAD='PI' or 'RR' as well. But this is not obvious.
If radiative rates are required at the same time as photoionization cross sections then simply
set RAD='YES'. Of course, if non-standard photoionization is being computed which requires a
specific RAD setting, such as 'E2', then radiative rates are computed again.
The main non-E1 operation is for high-energy photoionization. But this is usually set via KPOLE,
the max electric multipole, since it is large and cannot be set via RAD anyway.
N.B. KPOLE=2 is the same as RAD='E2'.
Note, the usual oca/ols/oic files are still written, but the rate sections are empty, as their
energies etc. are still needed for PI/RR post-processing by adaspi/rr.

18/08/22 adaspe.f 2.10
DRS did not work in CA.

16/08/22 adasrr.f 3.12 adasdr 3.17
Added explicit ITYPE variable to NAMELIST &TWO for script work.
ITYPE=5 gives a TYPE-5 (only) while ITYPE=3 gives a TYPE-3 (only).
It overrides any user/default JTHETA (if necessary) and redefines it appropriately.
Recall, low-level code uses JTHETA=0 for TYPE-5 only, .GT. 0 for TYPE-3 only and .LT. 0 
for both TYPE-3 and TYPE-5.(all at |JTHETA| temps). JTHETA=999 is default, i.e. TYPE-3 at all temps.
Any binning is forced to be internal for safety since it is for script/production work (adasdr only)
ITYPE equals neither of the above then ignored and JTHETA (& NBIN) prevail, which is the default (ITYPE=0).

15/08/22 asdeck29.21
Re-spagged.

12/08/22 asdeck29.20
Similar BASIS='SRLX' issues for PPOT='SCCA' as SR.VPNL mimics SR.STOPOT and needed its updates.

10/08/22 asdeck29.20
BASIS='SRLX': user (MCFMX) specification of the configurations to be used for STO potential
occupation numbers did not use "expected" (i.e. c.f. unique basis) defaults for orbitals not
explicitly specified via MCFMX. This was especially true if a group was not specified at all.
Now works "as expected", i.e. averages over the configs which contain said orbital.

05/08/22 asdeck29.20
BASIS='RLX' read of scaling parameters and variational parameters via NLAM and NVAR was broken -
a safety test introduced to ignore incorrectly specified user data was only valid for BASIS='SRLX'.

03/08/22 asdeck29.20
Use of S.S. non-namelisted configuration input with Rydberg loop could incorrectly increase
the user's specified starting n (NMIN) because check on whether it had been set too small
is carried-out before the configs are generated. It should only be applied to A.S., as they
are known at the point of the check. A warning message was written both to screen and olg
that the user NMIN was too small, but... Since the configs are undefined, whether or not NMIN
is changed is compiler/optimization dependent and what the test finds in these memory locations.
The check was first introduced in v25.x.
A.S. has been the recommended input form for some time.

03/08/22 asdeck29.20
c.f. TECs, TCC generation did not work with KUTLS - again due to memory re-partitioning.

02/08/22 adasrr 3.11
Re-instate historic 2005 RR database n-mesh for bare ions.
The automatic one generated by AS when not specified by the user (default) is commented-out.
It can be re-instated if needed to sync. n-mesh with that used for new(er) sequences and/or DR.

NRLSOL not initialized to zero in case of bare ions - if not done so by compiler then likely error.

Removed Arithmetic IF statements.

02/08/22 adaspi.f 2.16
Removed Arithmetic IF statements.

02/08/22 adasdr.f 3.16
Removed Arithmetic IF statements.

29/07/22 asdeck29.20
TECs could only be used if no continuum present, since v20.x, due to storage of partitioned
e-vectors only (i.e. the non-zero cpts) - the TEC usage had not been re-indexed and so DIAGFS 
switched it off. Now re-instated. TECs were used to generate low-charge L-shell RR in the 2005 database.
It can now be reproduced using the archived input datasets.
A similar issue arises with KUTLS.lt.0 (mixing within a config). This has never worked with TECs,
even for bound only (since by definition it is partitioned, but KUTLS.gt.0 o.k.), for the same reason,
and it was not checked-for so code would exit non-gracefully.

25/07/22 asdeck29.20
SR.DIAGON,DIAGFS tidy-up local DE/ALLOCATEs.

13/07/22 asdeck29.20
Large H diagonalization produced message about workspace for LAPACK routines being smaller than
optimal. This was due to the max block size being hardwired in SR.HDIAG. It now to
determine such and the appropriate optimal length is determined. See comments in SR.HDIAG.
N.B. what the Lapack (code) documentation says is needed and what the actual libraries report at 
execution time are not necessarily the same... the latter being larger, usually only for small cases.

08/07/22 asdeck29.20
When MINIM KUTDSK operation uses ACCESS='DIRECT' now write large e-vectors over multiple records.
Since we are block diagonal within a symmetry when computing photoionization, not all are of
the same length.
More elegantly, have implemented the F2003 ACCESS='STREAM'. This combines the best of both worlds.
BSEQ and BSTRM in SR.DISKTF control (hardwired) choice. BSTRM is ignored if BSEQ.EQ..T.
The current "default" is BSEQ.EQ..F. and BSTRM.EQ..T. since it seems to be widely implemented.

06/07/22 asdeck29.20
Suppress ifort remark about E/D specifying being shorter than recommended - since the number is
positive it is safe. Cannot change format length because it is a long-standing passing file default.
Instead, "hide" the format statement in a character variable.

10/06/22 asdeck29.20
Implemented use of KUTDSK in LS (i.e. SR.DIAGON).
Here, only KUTDSK.lt.0 flags I/O of (LS) e-vectors to scratch disk.
The main reason is to simply enable the code to re-set KUTDSK non-negative if TECs or TCCs
are required since this means that SR.DIAGFS needs access to the LS e-vectors and they
must be in memory. The user can of course set KUTDSK.gt.0 to I/O IC e-vectors only, but
it is likely to be a modest improvement overall in this case.

02/06/22 asdeck29.20
"Repurposed" KUTDSK (.ne.0) in the MINIM branch to flag I/O of e-vectors to scratch disk
(c.f. VCCs in ALGEB.) This reduces dimension/memory requirement from (sum n, where n is the
rank of Hamiltonian matrices being diagonalized) 3n^2/2 to n^2/2 (*8 bytes),
i.e. by a factor 3 in large cases, when radiative data (rates and PI) is being computed.
The e-vector dimension/memory requirement being (sum) n^2 (*8 bytes) to compute radiative data.
It is ignored if only energies/auger rates required since these are computed on a per symmetry
basis and Hamiltonian diagonalization requires "only" m*n^2 memory, where m=1 for non-LAPACK (not 
recommended), m=2 for LAPACK DSYEVR (recommended for large cases, but non-Intel MKL needs workaround)
and m=3 for LAPACK DSYEVD (default).
Currently, only implemented for CUP='IC' (i.e. in SR.DIAGFS.) which is where it is "needed" most.
MAXJU is the dimension (*8 bytes = memory) required to store e-vectors for the specified run. 
It is written by an algebra run before it is ALLOCATEd by the MINIM branch. If you use the RESTART
facility (as you should for large cases) then you can decide then whether to I/O the e-vectors
from/to disk, or not.
Aside: the remaining (sum) n^2/2 (*8 bytes) arises from an (INTEGER*8) array holding pointers to
where the interaction elements are stored. 
Storing the e-vectors in memory still, but using (n^2) REAL*4, the memory requirement would be
(in large cases) sum n^2 (*8 bytes), but is messy to implement with TYPE specific LAPACK routine names.
Diagonalization of each H(Jp) should still be carried-out using REAL*8, which adds to the mess.

24/05/22 asdeck29.19
Re-spagged.

24/05/22 asdeck29.18
Reworked DIAG and its interaction with HDIAG.

20/05/22 asdeck29.18
Reworked HDIAG and its interaction with DIAGON/DIAGFS.

04/05/22 asdeck29.18
BP corrections to M1 radiative rates could give false "dimension exceeded" due to the variable
being tested not being initialized if there was only only level in the first Jp group(!)
Only seen with ifort, but could in principle affect any compiler.
(The test not even strictly needed anymore...)

29/04/22 asdeck29.18
Explicit calls to the F95 cpu_time subroutine have been moved to a module utility_time,
which in turn contains a subroutine nrb_time which calls cpu_time and, when LAPACK is
enabled, the OpenMP function omp_get_wtime. The latter is necessary for some compilers
(e.g. Intel) to ensure that the wallclock time is used by AS instead of a thread-summed
value returned by cpu_time.
Note, the user controlled variables which set the activation, or not, of fine-grained
timing (via btime/x) and where it is written (iw/p) remain in module common_misc, for now.

26/04/22 adaspe 2.10 adaspi 1.25
Replaced historic bubble sort, of adaspe level list to energy order for adf38l, by heapsort(!)
Former was very slow for complex cases.
Also mirrored for adaspi adf39l but this has not been an "issue", to-date.

21/04/22 adaspe 2.10
DR satellite operation did not write "correct" Auger & radiative widths to adf38r, but the total
width (Auger+radiative) was correct. adf38r is not written by default during DR satellite operation.

If not opacity option (RAD='OP') then it assumed PE for PI and radiative width to autoionizing lower
levels is included in the total Auger width since to a good approx such radiation leads to
ionization still. The total width is unaffected, of course, only the Auger yield. This is operation
now "off" when DR/S is in operation (RAD='DRS','DR' or an electron temperature is specified.)
In the case of DR/S the XDRSTOT file is unchanged. But if adf38r is written (NBIN.lt.0) the
Auger and radiative widths are "correctly" partitioned.
If PE for PI (and NBIN.lt.0) then adf38 reflects the XPEPAR/TOT and repartitions the widths,
as above. However, if NBIN.eq.0 then adf38r also does not repartition the Auger/radiative widths.
All OP files are not affected by the above. Also, the adf38r PE files archived on the web were
generated before the repartitioning of the width, which is equivalent to the present NBIN=0 case.

08/04/22 asdeck29.17
Re-worked SR.HDIAG so that all Lapack diagonalizers coded are available and selectable at runtime.
Previously, each one had a separate flag and any combination of them could be activated in the
source code thru simple edit commands. But only that predetermined choice was user accessible.
Because of differing memory requirements, only DSYEVD (all e-pairs) and DSYEVX (subset of e-pairs)
were active by default. This was due to historical fixed dimensioning. With allocatable memory
this is no longer necessary, all can be made "available", and it is no longer desirable.

DSYEVR is the main reason. Its use can be problematic since it needs to conform to the IEEE standard
wrt error trapping (specifically, NaNs and infinities). The user likely needs to set a compiler flag
to switch-off any and all such trapping because compilers tend to abort when such a floating point
exception is encountered (only underflows are "allowed"). This issue is even more problematic with
pre-compiled Proprietary optimized libraries, which generally trap. However, it is possible to
"override" this by compiling ilaenv.f/ieeeck.f and (possibly) dsyevr.f from source with trapping off,
and retaining the rest of the performance library. DSYEVR only uses N*N workspace memory, in the form
of a 2x2 matrix. DSYEVD uses 2*N*N in the form of a vector. Currently, no workaround has been found
to use DSYEVD for N.gt.32766 with pre-compiled Proprietary optimized libraries from Oracle & Nvidia/PGI.
At this point the vector length exceeds 2^31 and 32-bit (integer) interfaces to the underlying 64-bit 
libraries are the apparent cause of DSYEVD aborting. One can compile the DSYEVD library "-i8" for
yourself. But this is a very slow way to execute (by an order of magnitude) due to optimized libraries
also containing OpenMP directives to allow multi-threading via setenv OMP_NUM_THREADS 12, say.

The user can now select the Lapack diagonalization routine at runtime  via a new(!) variable in &SMINIM,
viz. DDIAG='DSYEVD' is the default, unless only a subset of e-pairs is requested in which case DSYEVX
is used. The user can now specify DDIAG='DSYEVR' (usable for either case) but should watch-out for
AS warning that the code has not been compiled successfully to avoid trapping, in which case DSYEVR
(user or optimized library) will use a much slower algorithm (slower than DSYEVD as it only has N*N
workspace.)

***UPDATE: Do set OMP_NUM_THREADS. Oracle defaults to 1 if not set but Nvidia/PGI & Intel grab all.
***UPDATE: Intel (for ifort) MKL DSYEVR works straight out-of-the-box and tested to N=50000.
***UPDATE: Intel (for ifort) MKL DSYEVD works straight out-of-the-box for N.gt.32766 provided it is
           linked -i8. AS should not be compiled with -i8, rather use SP=8 in MODUCLE PRECSN, only linked.


25/03/22 asdeck29.16
When calculating photoionization cross sections (via RUN='PI' or 'RR') one is not normally interested
in any/all radiative and Auger rates being calculated at the same time. The PI continuum energy mesh
may not be suitable/accurate for Augers and the default PI partial wave expansion is smaller since
it is a dipole transition only. But, both sets of rates are on by default when photoionization
cross sections are being calculated - this is historical, they existed before photoionization and
were switched-on and off by MPRINT and the presence or not of continuum orbitals. For large OP
calculations it maybe be desirable to switch-off these rates, particularly Augers, especially
since one cannot bundle Augers but leave PI fully-resolved, as it must be (for OP).
Thus, the user can now explicitly switch-off radiative rates when photoionization cross sections
are being calculated by setting RAD='PI' or 'RR'.
Also, a new variable AUGER='NO' (in SALGEB, default 'YES') explicitly switches-off Auger rates.
(If MXCCF.ne.0 and RUN='  ' all you get is energies, and maybe radiative rates, which might be useful.)

For OP work this suggest the following possible strategies:

1/ Carry-out an AS PI run with no radiative or Auger rates. Then carry-out an AS PE run with energy mesh
and partial wave expansion "optimized" for Augers.

2/ If Augers are of no interest, then carry-out an AS PI run only, including radiative rates and
process the "oic" file through adaspe to get adf38 files (and "opic" through adaspi as usual to get adf39.)
The radiative data in adf38 will be the same as from a PE run, if the same (N+1)-electron photon target
configuration expansion is used. (This is not always the case.)

3/ A "Goldilocks" solution might be to carry-out a PI run only but with radiative & Augers switched-on,
if resources allow, but using the normal PI energy mesh still. Might extend the partial wave expansion
a little. The point is to only make one AS run per ion, if possible, but still have some measure of the
Auger broadening.


22/03/22 asdeck29.16
If user selects configs by parity (via IPAR) and MXCCF.ne.0 then only apply it to the MXCCF configs,
since in general both MAXCF parities can contribute, albeit with different partial waves attached.
It is beyond the capability of AS to select further (or know the mind of the user).

22/03/22 adaspe 2.9
Added option to print adf38 as unformatted files via PRINT='UNFORM'. Default is PRINT='FORM'.

18/02/22 asdeck29.16
The default value for KORT is now +1, no orthogonalization of Rydberg+continuum to target orbitals
and no correction (of autoionization), since photoionization and.or Rydberg-core radiative rates
are not "corrected". See also 08/02/22 asdeck29.15.

17/02/22 asdeck29.15
KORT=-1 segmented when used in conjunction with BASIS='RLX2' - a very unlikely combo.

16/02/22 adaspe 2.8
Tweak default DR satellite operation.

15/02/22 adasdr 3.15
NR1 was not re-set when starting a new unit. Not an issue for normal operation (e.g. 2-3,3 plus 2-3,n)
since it is unchanged. But if first file has more than one equivalent n-value (e.g. 2-3,n all n=3-5)
and the next file has single n-loop then NR1=6 from first file (i.e. off) needs re-setting to NR1=4,
as in adaspe.

14/02/22 adaspe 2.8
Tweak for DR satellite operation, flagged by JTEMP (user temps) or JTHETA (ADAS temps) .gt.0.
Binned PECs now written to XDRSTOT (rather than XPEPAR) with temperature (rather than photon target energy)
headers. Electron target energy (ground and any metastables) written as before.
Change some defaults to align adaspe operation with adasdr's and flag any (user) disagreements with it to
try and save them from themselves.

14/02/22 asdeck29.15
BASIS='RLX2' did not work - some overlaps were skipped so taken to be zero and thus segmentation.
Last working version was 27.131...

10/02/22 asdeck29.15
"Obscure" fixes:
1/If LXTRA was used for bound-free problems, the default continuum expansion was too small - the set-up
did not look at LXTRA. Of course, the knowledgeable user could simply set LCON sufficiently large.
2/If NXTRA,LXTRA are used to generate a large fully-relaxed orbitals basis then the initial allocation
for MAXGR (total no of orbitals = unrelaxed no. times no. of configs) can be too small. It is quietly
re-allocated but the configuration array NEL was only re-initialized for the new memory locations
allocated. However, only the old actual used memory was copied. So locations between the old used
and old allocated were uninitialized following re-allocation. If not zero, then obscure SR.VCU error
message in SR.ALGEB results. (A configuration would have too many electrons, or worse.)

08/02/22 asdeck29.15
Historic treatment of orthogonalization of Rydberg/Continuum orbitals for bound-free problems
has been to follow the treatment used for the "core" atomic orbitals (save that they are never
orthogonalized to each other) e.g. they are Schmidt orthogonalized to the core orbitals by default
for Thomas-Fermi potentials while there is no orthogonalization to them by default for STO potentials.
(Kappa-averaged orbitals are not Schmidt orthogonalized by default either, for any potential.)
Schmidt orthogonalization of the core orbitals (to themselves) can be justified on the grounds that
it is being done during the optimization procedure to minimize the energy functional by varying the
potential scaling parameters. There is no justification for such in the case of Rydberg/Continuum
since there is no optimization. Indeed, in general scattering codes, if such orthogonalization is
carried-out then N+1 bound-bound configurations are added to H to compensate. An alternative procedure
is used by AS for (direct) electron-impact excitation (RUN='DE') viz. the exchange overlap integrals
between the Continuum of the target orbitals are evaluated. The same procedure has now been implemented
for Rydberg/Continuum orbital overlaps with core orbitals for autoionization. (A Rydberg just plays
the role of the second continuum orbital in EIE.) Any associated photoionization cross sections 
or Rydberg-core radiative rates are determined using these non-orthogonal orbitals. The former could
be run independently restoring historic Schmidt orthogonalization, the latter not. Experience indicates
that the non-orthogonal approach is to be preferred, in general.

The new &SMINIM variable KORT controls the Rydberg/Continuum orthogonalization, as follows:
KORT.eq.0 follows the historic tied operation of Schmidt orthogonalization of Rydberg/Continuum orbitals
          to the core orbitals if default/user operation does so for the core orbitals.
KORT.lt.0 determines the exchange overlap contribution to the monopole Slater integrals.
          It only applies to explicit Rydberg states as flagged so by RUN='DR'.
KORT.gt.0 does not apply any orthogonalizaton procedure.
In particular, KORT.ne.0 overrides any implicit (default) or explicit (user) orthogoalization flag by
the ORTHOG variable (which in turn depends on the TF, STO, Kappa-average status), which applies only
to the core orbitals then. Thus, orthogonalization of continuum/Rydberg can be decoupled from that
of the core orbitals.
(The default value for KORT is.0, so no change in historic operation, but perhaps not optimal.)

31/01/22 asdeck29.14
Tweak radial mesh so min MSTEP=11 when (idw=0) continuum present with K-shell hole.

14/01/22 asdeck29.14
Attempt to access unallocated array error during unformatted IC DR run. Should not be accessing it.
Caused by 28/09/21 asdeck29.6 reworking of SR.DIAGFS - variable not initialized in such an instance.

12/01/22 asdeck29.14
Changed real precision of SR.FILON & SR.FILONW from WP to XP so as to enable test of cancellation error
in Born integrals (SR.FILON) and relativistic PI integrals (SR.FILONW - is for test only).
By default, XP=WP, of course.

21/12/21 asdeck29.14
Tweaked SR.BORN settings for SR.ROMB integration, e.g. allow more iterations for infinite energy.
Catch an overflow in SR.ROMB if user asks for too large a multipole - this can happen before
SR.BORN detects convergence failure.

16/12/21 asdeck29.14
Re-spagged.

15/12/21 asdeck29.13
v29.12 changed initial normalization of SR.RADWAV function (previously, power series expansion
was "unnormed" with A(1)=1.) However, P(x=0)/x^l+1=DP0 (&DQ0) did not explicitly include the A(1)
factor and so was not normed correctly. The perturbative Darwin integral was completely wrong then.

14/12/21 asdeck29.13
Re-sync. & tidy-up SR.RADWAV, FN.WHITEX (SR.MESH) operation.

13/12/21 asdeck29.13
Switch-off Born integral evaluation explicitly in SR.RKINT when both orbitals are continuum.
Previously depended on a high-level switch (RUN) turning-off Born completely.
But if RUN is not used, and so lower level switches define the problem, then could get
meaningless Born integrals in case e.g. both orbitals approximated by a zero energy continuum.
The algorithm expects the integrand to be exponentially decaying at large r.

10/12/21 asdeck29.13
Limit max Slater integral multipole, to 20.

10/12/21 asdeck29.13
Fixed SR.RADWAV bug for very high-l: if function zeroed-out into the last interval, then incorrect
number of points for outward integration set, leading to integration beyond the matching point and
false node if blows-up crossing zero.

09/12/21 asdeck29.13
Added SR.WIG9J to library.

08/12/21 asdeck29.13
Added SR.WIG3JRJ (and SR.WIG3JRM for testing) to be called by FN.VCC when ang.mom. are too large for
the "3j" factorial formula, as per 6j below.

06/12/21 asdeck29.13
Added SR.WIG6JR to be called by FN.SJS when ang.mom. are too large for the 6j factorial formula
to be used. Note, this is not an issue of the factorials being too large per se, rather it
is cancellation error in the series sum of terms of alternating sign. Using higher precision
(XP=16) just delays the inevitable in the case of l-changing collisions where we want to go
to very large l e.g. 500. XP=16 gets you to about l=150, which would likely suffice for EIE
in the case of user pushing to higher energies and requesting a larger MAXLT. XP=8 is sufficient
for EIE default energy/MAXLT.

02/12/21 asdeck29.13
Historic SR.WHITEX has two errors in the loop summing the expansion terms.
1/The the loop index is misaligned by 1: the new coefficient is being evaluated at the end
of the loop using the old index.
2/For n.gt.5 the coefficients do not decrease monotonically before starting to increase at the
"termination" point i=n-l. Rather, the first "few" increase before decreasing monotonically towards
the "termination" point. The index value beyond which it is safe to test for increase is n-l. 
Both these errors at worst slow down normal operation a little: the SR.RADWAV search for the e-value 
does not converge as quickly as it could because FN.WHITEX is initially evaluated at the
outer turning point. On refinement, the inward integration is all Numerov with just the
two starting points from FN.WHITEX. This just affects the normalization, But the function
is normalized by quadrature in any case.
However, for very high-n it could cause failure to converge as the e-value was driven from the
correct one due to inaccurate derivative. See also 30/11/21.

30/11/21 asdeck29.13
Added SR.WIG6JR to calculate 6j-coefficient when arguments too large for factorial approach.
FN.SJS6 automatically calls it instead in such instances.

30/11/21 asdeck29.12
Historically, the SR.RADWAV e-value search started with the Whittaker function
being evaluated at the outer turning point, for speed. As the e-value is refined,
the switch is made to evaluating it at the starting point for inward Numerov, which
obtains the whole function. Speed is not an issue here nowadays and for increasingly
high Rydberg states (where we have a good initial estimate of the e-value) cancellation
error is increasingly large leading to an inaccurate derivative which causes failure 
to converge - the switch over is not enough to save you.
For backwards reproducibility, we keep the historic approach for
low-n (for now) but switch it off for Rydberg states, .ge.10.

29/11/21 asdeck29.12
Suppressed old SR.RADWAV check for FN.WHITEX underflow (sigh) since Log Gamma avoids this as well.
This stopped SR.RADWAV finding a solution for large n (low l).

25/11/21 asdeck29.12
Added a log Gamma function FN.GAMLN so as to avoid under/overflow in FN.WHITEX.
Can also use F2008 LOG_GAMMA intrinsic if compiler supports it.
Added variable B_F2008 in module PARAM to flag support/use of F2008 features, c.f. B_F2003.
Set B_F2008=.TRUE.to use (still need to uncomment relevant code in FN.WHITEX, unless/until
add a dummy c.f. FN.MOV_ALLOC.)

24/11/21 asdeck29.12
SR.RADWAV initially determines an unnormalized radial function. Actually, it assumes an r^l+1
normalization at the origin, i.e. the first coefficient of the power series expansion is A(1)=1.
The power series is evaluated at the first two mesh points only. In theory, one could go out to
the inner turning point, but only a few coefficients of the (potential) expansion are known in general.
For large l, the first two function points are zero (due to underflow) and hence Numerov gives a
null function. One cannot simply use a larger A(1) since we are already close to overflow at r>1.
Rather, we use a *smaller* A(1), the approx actual hydrogenic value, and start the power series
expansion at a larger value of r where it is small but representable. We zero-out the function at 
smaller r (actually, set it equal to the first non-zero point else problems with kappa-averaged.)
The use of an approx correct normalization is key to large-l solutions for high-n.

18/11/21 asdeck29.11
Added optional use of F2008 GAMMA to FN.WHITEX and SR.BDCF3 - commented-out for portability for now.

16/11/21 asdeck29.11
RADOUT='YES' array-out-of-bounds if there are less than 5 orbitals since historic radout file
contains the first 5 scaling parameters, but array now allocated to mxorb. If not compiled with
array-bound-checking then likely fine, although the "extra" lambdas maybe garbage. 

16/11/21 asdeck29.11
Tweaked true bound orbital operation for high-n, in particular, use of infinite energy Born to describe 
non-dipole l-changing transitions (needs the proton/electron mass ratio to be applied if proton collisions).
Standard order allows true bound up to n=69 only. Higher-n requires use of Rydberg loop. Need to set
RUN.eq.'' and supply dummy-n (80-89) explicitly as orbital redefinition to get BORN or multiple Rydbergs.
BORN is switched-off if RUN.ne.'' since it assumes a continuum will be added and BORN has not be
tested with a continuum - it uses a different approach to the quadratures.

Multiple Rydbergs: RUN.ne.'' again assumes Rydberg/cont to be added still and can only do so for one Ryd.
(One can get multiple Rydbergs if continuum are specified on orbital redefinition line as well since AS
assumes we have defined an N+1 problem then. But if there are no continuum it does not know if the 
Rydberg is in the N-electron target to represent core re-arrangement, with continuum to be added, or
whether nothing is to be added and it is N+1. One could set LCON=0=LCON0 to explicitly say none, but...
Also, in v28. one oculd specify a dummy continuum, but not use it, but v29 eliminates unsed orbitals.)

Note, RUN.eq.'' does NOT approx a Rydberg by a zero energy continuum by default, unlike RUN.ne.''.
It can be switched-on via NAMELIST DRR as usual (NSW=xxx).
Even with all this, n-n' interactions are still not possible for both n.ne.n'.ge.70.
Any n->n'.lt.70 is fine. All bound-free problems can be described by one of the usual RUN settings.

Problems that will occur if you push to too high a true bound n-value (default RUN.eq.''):
SR.RADWAV will be unable to find a solution, and exit.
SR.RADWAV will be unable to find a solution, and NOT exit (infinite loop...)
SR.BDCF3 (Coulomb functions from series - lambdas=-1) will fail to converge - should exit gracefully...
SR.BDCF3 will become increasingly inaccurate before failing.

By using extended precision (XP=16) and uncommenting usage of the F2008 GAMMA intrinsic in SR.BDCF3,
it has been possible to verify the accuracy of the (much faster) numerical results up to n=70, all l,
for Z=1 hydrogen. The small-l are the most problematic. Both start to breakdown for the lowest l around
n=75, higher-l are good to progressively higher-n before breakdown. Note, this is likely due to
cancellation error in the case of BDCF3, it does not trigger the convergence failure. But the Born
integrals are clearly garbage. 
RADWAV gives garbage as well around here??? Need to check r^k integrals against analytic.
Both methods work to the highest l still up to around n=100 but the VCC factorial array being too short
is the current limit, not BDCF3/RADWAV per se. (The VCC factorial array was/is set with RUN='DE' in mind
where a max L ~100 is a good margin.) So, currently, true bound are limited to NBOUND=100, which can be
overridden in DRR at your own risk.

Note, while it is possible to switch-on approximation of the bound orbital by a zero energy continuum
(using the usual DRR switch) the Born integrals are meaningless (Alan's routines need investigating here)
while the radiative data should be no different from what can be obtained from RUN='DR' (or 'RR') so
there is no obvious reason to do so.

11/11/21 asdeck29.11
Suppressed use of flagging orbitals by n=60-69 to neglect mixing between configs containing them
(thence n=mod(n,60)) since little used and likely covered by KUTLS and MIXBV now.
This frees-up n=60-69 for LS/IC usage as normal bound orbitals(!) in line with CA, which never
used the feature since it has no mixing in the first place. So, only n=70-99 reserved now.

02.11/21 asdeck29.10
If scaling parameters are applied to individual STO potential subshells (BALAN=.TRUE. - non-default)
then check that the occupation number is non-zero if they are being varied. Otherwise, all parameters are
at best "unstable", at worst... Note, if user fixes a scaling parameter to one associated with a non-zero
occupation but itself has zero occupation then it will be flagged as an error since the check does not
cross reference. Solution is to unfix the parameter. One does not normally fix valence scaling parameters,
only closed shell and they have non-zero occupation nos by definition.

01/11/21 asdeck29.10
To try and avoid user mis-comparison between CA and LS/IC optimization when IWGHT.lt.0 and INCLUD.gt.0,
CA now recognizes IWGHT.lt.0 with INCLUD.gt.0 and includes the first INCLUD algebraic configs in the
energy functional, the same IWGHT.lt.0 operation as in LS/IC. (Recall, IWGHT=1 is the unchanged AS default.)
The &SMINIM KCUT is thus now no longer required in any coupling scheme to restrict which configs are INCLUDed.
As such, it should only be used for its original purpose - the flagging of configs as correlation, which in
general means that no rates are written for them. In CA, one is better off simply setting MAXCF=KCUT initially.

29/10/21 asdeck29.10
When optimizing in LS/IC with IWGHT.LT.0, i.e. the arithmetic mean of configuration weighted mean energies,
INCLUD is now interpreted as applying to config labels and *all* terms (fs wghtd IC) of an included config
are included in the energy functional since including only a partial set of term energies in the energy
functional is of little use. Indeed, if the user specified INCLUD.lt.0 then IWGHT was reset .GT. 0.
This is not now done and CF nos and weights are expected. This use is similar to CUP='CA' operation,
But, INCLUD.gt.0 includes all terms of the first INCLUD *algebraic* config nos, unlike historic CUP=CA'
which includes the first energy-ordered configs, since we don't have a "configuration energy" at that
point and using the lowest term to flag it is not really helpful. 
***** CA use of INCLUD.gt.0 has now (1/11/21) been synched with LS/IC when IWGHT.lt.0 - see above.*****
Below is still true if the user sets IWGHT.gt.0 in CA (& .lt.0 in LS/IC!) If comparing CA and LS/IC 
optimization directly, it is safer to use INCLUD.lt.0 since its operation is identical. INCLUD.gt.0 
(and IWGHT..gt.0) in CA can change which config energies are included in the functional if their
order changes, c.f. terms swapping order in LS/IC when IWGHT.gt.0 (algebraic term labels are no basis
for inclusion).  *****  End Aside *****
The new LS/IC IWGHT.lt.0 option with INCLUD.gt.0 is very similar to the previous (iwght.lt.0) or present
(iwght.gt.0) operation with KCUT and INCLUD.ge.all energies, except that nothing is flagged or treated
as correlation. One can combine it with KCUT.
More importantly, now (IWGHT.lt.0) INCLUD.lt.0 means that one is no longer restricted to including configs 
sequentially when using KCUT or having to re-run the algebra again with a new set/order of MXCONF configs.
(It may still be advantageous to do so if diagonalization is slow for the full problem.)
Note, INCLUD.lt.0 has always, and still does, ignore KCUT or any (energy) correlation flag since it
assumes you know what you are doing when you specifically include a term/config.

29/10/21 asdeck29.10
Check consistency between NVAR and NFIX, and abort if there is a conflict.
E.G. 1/ if you set NVAR to vary lambdas 6 and 7 (independently) and then FIX 6 to 7 things will not
end well - trying to vary two lambdas which are being re-set as one. Minimization may "converge",
but it is unstable - different compilers/machines will give different results.
Or the code will segment (somewhere in VA04A).
E.G. 2/ if you set NVAR to vary lambda 8 and then FIX it to lambda 9 which is not being varied
according to NVAR then again things will not end well - abort or segment.
1/ is either down to user confusion over how NVAR & NFIX interplay or, more likely, mis-aligning
the input when NVAR is large. 
2/ here one might think such would still work as, unlike 1/, there is one lambda to vary but in fact
8 will be flagged as non-varying. Since one tends to vary the valence lambdas and the user inputs such
first, the tendency is then to fix the non-varying core lambdas (correctly) to the NVAR ones, rather
than the other way around. But, it is now caught by the test for 1/.

26/10/21 asdeck29.10
As from gfortran v11.x, can no longer hide KIND/TYPE mismatch between dummy "intrinsic" l/ubound3
and reallocate module, so compilation fails. This dummy was to support non-F2003 compilers which 
do not recognize the optional third argument of the l/ubound intrinsic function and so compilation fails
when present. Instead of a simple global edit l/ubound3 -> l/ubound to enable for F2003, have commented-out
references to l/ubound<-l/ubound3 for non-F2003 compliance, then these need to be uncommented again
to make use of with F2003 compliant compilers, along with setting B_F2003=.TRUE. in MODULE PARAM.
These (along with the F2003 move_alloc intrinsic) are not mission critical, they just provide for
safer/faster operation and so a non-F2003 F95 compiler is still the default minimum required for AS.
This also affects v28.46.4 to v28.46.7 only. Earlier versions of v28, and all v27.x and earlier,
are unaffected as they did not make use of the F2003 l/ubound 3rd argument.

25/10/21 asdeck29.9
Modify output targets of 07/10/21 viz. now only written when IWGHT.lt.0 but still for any INCLUD
(recall default IWGHT=1, so not written by default now.) Also, never written to TERMS/LEVELS since 
this conflicts with current script expectations. But, is now written to olg when PRINT='UNFORM' as well.
So, information is still available when needed, but in a different location (always olg) and needs to
be switched-on (IWGHT.lt.0). SR.DIAGON and SR.DIAGFS are coded to output to a separate file/UNIT if
such is set-up - it could be re-set to the existing TERMS/LEVELS...

25/10/21 asdeck29.9
badas=.true. did not port .false. use of alphanumeric writes to adf04 for integers .gt. 9.

22/10/21 asdeck29.9
Added switches to select separately the direct and exchange contributions to 2fs (SR.RES1 & SR.RESX1)
analogous to electrostatic (SR.FLGL1 & SR.FLGLX1).

18/10/21 asdeck29.9
BP DW bug fixes for 2-body fs, i.e. non-default operation.
1/ Some collisional 2-body fine-structure radial integrals could be evaluated with a continuum orbital
one unit of ang. mom. smaller than should have been for case of half-integer target j.
2/ Array out of bound possible if user restricted LCONDWJ (NOT recommended.)

14/10/21 asdeck29.9
BP DW bug fixes.
1/Array out-of-bounds if a target Jp generated no levels for given target SLp after all non-zero Jp groups
had been counted.
2/If a given scattering SLp symmetry did not contribute to Jp, the number of channels was not explicitly
set to zero, which could cause problems if allocation initialized array with random non-zero value.
Minor: LS DW could index channel interacting pairs with no actual interactions in the user restricted
LCONDW, basically cosmetic.

07/10/21 asdeck29.8
Form statistical-weighted mean of term and level configuration energies. Written to olg
(when PRINT='FORM') and appended to TERMS/LEVELS files, i.e.,  after the usual term/level terminator.
This (formal) statistical weighting is independent of any default/user weighting used for the energy
functional.

05/10/21 asdeck29.7
Array out-of-bounds if number of *occupied* valence sub-shells in any given config. exceeded historic
hard-wired dimension of 10, which was carried-over into allocate. The post-processors read a legacy fixed
length config. string of 10 "occupied" nl-subshells per config, the end of which may be empty. Now allocate
and write the max of 10 and the number occupied. The post-processors currently cannot read/use .gt.10.
Such is unphysical for DR and RR. K-shell PI of a heavy system could, if sub-shells not re-ordered to
start with closed (as all would be open then). General Auger problems, for which there is no specific PP,
would generate such if one wanted to allow for arbitrary holes, i.e. treat all sub-shells as open.
Note, the use of relaxed orbitals is not an issue since the arrays affected are also indexed 
by config and so are not the global MXORB (~KMAX*MXVORB, say), but basically are approx the original
user input MXVORB.

04/10/21 asdeck29.6
If user read an old NFIX group with INCLUD=0 then it would take precedence over whatever the user
had set the lambdas to be. So, if old NFIX said make 4s lambda the same as the 4p then it would ignore
any different 4s lambda the user may have set/read. Easy to overlook the actual lambda used in olg and,
of course, impossible if PRINT='UNFORM'. Now, ignore any user NFIX values if not optimizing.
If you want two or more lambdas to be the same then set them explicitly so.

01/10/21 asdeck29.6
Stop juggling and simplify confusing &SMINIM variable usage that was only present because of historic
iso-electronic loop, which has long been disabled/removed.

28/09/21 asdeck29.6
Added to SR.DIAGFS historic SS energy functional corresponding to a summed difference between calculated
and observed term energies, relative to ground in /cm, as indexed by input user weight indexes.lt.0. 

24/09/21 asdeck29.6
Correlation terms are never included the energy functional. But if there were K correlation terms
that lay within the lowest INCLUD then only INCLUD-K were actually included in the energy functional.
Likely didn't help convergence if correlation terms moved in-and-out of the INCLUD during the
variations. Now, the lowest INCLUD spectroscopic are always included.

23/09/21 asdeck29.6
Newly expanded IWGHT options.
C IWGHT CONTROLS THE WEIGHTING OF THE ENERGY FUNCTIONAL:
C       .EQ. 1  FOR AS UNIT WEIGHTED (ARITHMETIC) MEAN (DEFAULT)
C       .EQ. 2  FOR ORIGINAL (SS) STATISTICAL WEIGHTED MEAN.
C       .LT. 0  AND FORMS ARITHMETIC MEAN OF THE CONFIGURATION WEIGHTED-MEANS.
Undocumented (save for in code) &SMINIM variable IWGHT flags the weighting of the (INCLUD.gt.0) energies
included in the energy functional during minimization. The default IWGHT=1 is to equally weight terms 
in LS (averaged over fs in IC) and configs in CA, i.e. the functional is the arithmetic mean. 
Alternatively, IWGHT=2 weights them statistically by term in LS (fs-av.IC) and config. in CA 
(actually, this option was not active in CA).
Now, allow IWGHT=-1,-2 to form the arithmetic mean of the configuration weighted-means,
analogous to CA IWGHT=1. In principal, it assumes that the config. label is a good quantum number,
in practice, this is unlikely to be an issue for optimization purposes. To be meaningful, it
requires that INCLUD should include all terms of a config. There is no adjustment of the
total conf. average weight if not. The point of IWGHT.LT.0 is for complex heavy species configs
in which the number of terms may differ by a factor of 100 between configs, the smaller config
then contributes ~1% to the mean-energy functional (IWGHT.GT.0). Of course, if the larger config. is
100 times more important then stick with IWGHT.GT.0 - the choice is yours.
Notes:
IWGHT=0 is now re-set to 1 (the unchanged default.)
Historic SS corresponds to IWGHT=2.
Previously, the actual tests in AS were on IWGHT.EQ.1 and .NE.1.
The sign is ignored in CA since -2 is meaningless and -1 redundant.

22/09/21 asdeck29.5
Clarify distinction between VA04A failure due to minimization convergence and underlying AS
failure (in RADIAL, DIAGON etc.) Tidy-up related ERROR messages.

16/09/21 asdeck29.4
Write (formatted) CAVES/TERMS/LEVELS file even when PRINT='UNFORM', for large structure cases.
It is still not written if Rydberg looping or during optimization.
This has been a long-standing request...

16/09/21 asdeck29.4
MSTART.GT.1 (reading RESTART) did not call all DIMUSE cases. This is purely for info in the
SUMMARY OF STORAGE USED, but it does allow one to deduce original buffer usage, if set here.

15/09/21 asdeck29.3
If SR.TFDAPO/STOPOT returned with initial step length doubled, then crashed due to not deallocating
the old mesh before allocating a new one. But this is not the real issue. They return when the
radial mesh is apparently too short. Compiled with a fixed dimension, doubling the initial step
enabled the calculation to continue and hopefully finish. Now that the array is allocated one could
simply increase the number of points. But the initial allocation is based on the user specified
orbitals. If too short then an orbital is highly unphysical - diffuse. Either the user has set an
unphysically small scaling parameter or optimization is spinning out-of-control. Either way, arguably
the calculation should abort now. So, it does now after one attempt at doubling the initial step.
(There is no re-allocation of the radial arrays here, for the reason just given.)

08/09/21 asdeck29.3
BALAN=.TRUE. (local scaling of STO potential sub-shells) did not update all orbitals during optimization,
only the ones that would have been updated when BALAN=.FALSE. (global subshell scaling per orbital.)
In general, changing the scaling of one sub-shell changes the potential of all orbitals.
Lost in the mists of time whether this (optimization) ever worked since BALAN=.TRUE. has probably
never been used since its original implementation >30 years ago. 
BALAN=.TRUE. naturally pairs with NOCC user supplied occupation numbers for unique STO potential.
In principle, this mirrors HULLAC and (to a lesser extent) FAC operation.

07/09/21 asdeck29.3
Extend NFIX (for unique core orbitals only) to BASIS='S/RLX'.

06/09/21 asdeck29.3
Not all NAMELIST &SMINIM correlation flags worked in CA viz. KCUT, ESKPL, ESKPH.
Recall, SALGEB KCUT is ignored in CA since there is no mixing - so if you don't want the configs
then change MXCONF->MXCONF=KCUT (!) But in &SMINIM you might want them, but not to include them in
minimization functional. INCLUD=-(MXCONF-KCUT) achieves the same effect, if a little more tediously.
But in LS/IC &SMINIM KCUT is much more powerful than INCLUD.lt.0, so for consistency enable it in CA.

03/09/21 asdeck29.3
INCLUD.LT.0 did not work in CA. (Of course, could just eliminate unwanted CFs.)
CA energy ordered-list could be inverted in case of (very) poor structure.
Statement out-of-order when BALAN=.true. (v.rarely used).

02/09/21 asdeck29.2
Re-spagged.

31/08/21 asdeck29.1
Re-worked SR.MINIM0 so that the reads of user-supplied data following their NAMELIST &SMINIM settings
was everything that the user requested be read and that any arrays were allocated for such. 
Previously, the read could be truncated when more data was spec. than could exist for the given problem,
which might cause issues if omitted data was on another line. Worse, some reads were not protected
against array-out-of-bounds (again, only if told to read more data than could exist.)
E.g. if user defined a target with 3 orbitals and then told the code to read 4 lambdas.
(This was safe, but the same principle applies to orbitals to vary, STO spec. and more.)

27/08/21 asdeck29.1
Simplified setup/transfer of RUN='DE' continuum potential spec. In addition to historic spec. of
(unique) continuum lambda and (optional) STO config. as the next location after the last
atomic orbital spec., now allow DLAMX and MCFSTOX to be specified directly in NAMELIST SRADCON.
Indeed, if relaxed orbitals are in use, this latter direct spec. is the only way to do so.

26/08/21 asdeck29.1 (Development)
If user set-up more orbitals than used in configs, then reduce to (max) used, i.e. we
do not remove unused orbitals which lie amidst the used, just truncate the max number.
Such input can cause unexpected problems (e.g. 24/08/21) as well as being a waste of memory.
 
24/08/21 asdeck28.46.4
If user set-up more orbitals than used in configs in sr.algeb and then read associated 
scaling parameters then array out-of-bounds resulted on transfer to actual "needed" array.
Simply reading more scaling parameters than orbitals defined was not an issue, provided the
last orbital defined was actually used in a config.

24/08/21 asdeck28.46.4
Change of 16/08/21 did not need to re-allocate (i.e. preserve original contents of tmp array)
just de-allocate and allocate.

23/08/21 asdeck28.46.4
Fortran UBOUND/LBOUND return the bounds as an INTEGER of default KIND.
If the bound is .gt. 2**31-1 then get failure in SR.REALLOCATE on checking if safe to
preserve "user" requested array slice. (The reallocate package can be used outside of AS.)
F2003 enables one to specify the KIND of the integer returned viz. UBOUND(A,1,SP).
This F2003 requirement is analogous to use of the MOVE_ALLOC intrinsic.
So, have renamed the B_MOVE_ALLOC flag as the more general B_F2003, still set in PARAM.
Unlike MOVE_ALLOC, one cannot have an "F95" dummy of the same name since there is only an
additional argument in F2003 but (non-F2003) F95 returns a compiler error with a 3rd argument.
A dummy UBOUND3/LBOUND3 has been added to illustrate F2003 usage in SR.REALLOCATE.
The default is still B_F2003=.FALSE., for old compilers. The UBOUND/LBOUND check is thus
bypassed when SP=8. To enable B_F2003=.TRUE., see the Comments in the dummy FN.UBOUND3/LBOUND3,
as well as SR.MOVE_ALLOC. The F95 standard is still the default/minimum required by AS since
no current F2003 usage is mission critical.

20/08/21 asdeck28.46.3
When precision QP=2.lt.SP=4, say, Q_QP=I_SP generates low-level warnings in Coverity due
to integer truncation. Use of Q_QP=INT(I_SP,QP) is preferable/quieter. Ditto EP to SP<EP.

19/08/21 asdeck28.46.2
When precision SP=8=EP, I_SP=INT(J_EP) loses KIND=8 precision because INT defaults to 
KIND=4 (usually). The DC array index thus causes segmentation error (since it goes negative
when it exceeds 2**31-1. Correct statement is, of course, I_SP=INT(J_EP,SP). This truncates
RHS precision to LHS when SP=4 and maintains it when SP=8=EP. 
Other instances of possible loss of precision of the same form have been corrected. 

16/08/21 asdeck28.46.1
SR.ALGEB4 BP corrections to M1 uses a temporary local array which was allocated
an initial buffer length based on past experience. But there was no re-allocation
if the initial buffer was infact too small, mainly because in principle the max
requirement should be determinable for the initial alloc. For now, if the initial
alloc. is too small then the arrays are automatically re-allocated as usual.

30/07/21 asdeck28.46
************** Public release of v28.46 as the default AS distribution **************
N.B. It contains no features declared obsolescent by the Fortran standards up to
and including Fortran 2018, as verified by gfortran -pedantic -std=X where
X=f95,f2003,f2008,f2018 (thanks to Erdi for this).
Big thanks to Dragan for carrying-out both static analysis with Coverity and dynamic
analysis with Valgrind. 
*************************************************************************************

16/07/21 asdeck28.46
Plusfort "beautification" now the default (this does NOT restructure code) viz.
Format labels have been renumbered and statements collected together at the
end of the subprogram, but otherwise have not been re-ordered.
Non-Format statement labels have been re-indexed, so you have a good idea
where to look for statement XX referenced by GO TO XX.
Redundant DO labels have been removed (there weren't many left and all DO loops
were already terminated by their own ENDDO.)
Indenting has been made consistent through-out (my default 2 cols.)
The distinction between upper and lower-case code has been maintained as far
as possible, but plusfort wants to make operators all the same case (there is
no "leave as is" option) and so required some persuasive "post-processing".

16/07/21 asdeck28.45
EIE of neutrals: do loop over interpolation energies to test for zero used
wrong upper limit, but since any should be in position 1...

14/07/21 asdeck28.45
Initialized a couple more (unused) variables write/read to EIE passing file.
And a DEALLOCATE tested the wrong variable (the previous DEALLOCATE) and
so did not DEALLOCATE some small arrays - a heap allocate leak flagged by
valgrind.

12/07/21 asdeck28.45
Adjust definition of MAXLL s.t. it defines the max(L) *plus* 1 of the VCC
internal table storage (higher-L done on-the-fly). Previously, MAXLL=max(L)
and so -1 meant all calculated on-the-fly but this conflicts with present
default of -1 (for all dimensions) to flag code to choose a suitable value
for any/all dimensions. There are cases (e.g. f^13) where non-trivial time
is spent re-calculating the same VCCs again and again. 
Note, MAXLL was unusual from a historical perspective. By the nature of
Fortran IV, indexing started at 1 and so dimensions etc associated with
orbital ang. mom. were normally based on L+1. Since the user no longer
specifies any dimensions, There is no cause for confusion. Just the max
value used (and written to olg) is one greater than v27.x and earlier.
v28.x to-date "used" -1 and all was done on-the-fly.

09/07/21 asdeck28.44
Arrays write/read to EIE passing file (and likely RESTART) that are not
initialized because not used are flagged by valgrind as a context/error.
Not an issue for AS, but valgrind does not always show all possible contexts.
When you fix one, it may reveal another, which might be an issue to AS.

08/07/21 asdeck28.43
Initialized some variables being used before set, as found by Dragan's valgrind
dynamic analysis of the AS test-suite.
Either their value did not matter until they were (originally) set, as
they were in an IF statement in combination with tests on other variables,
or non-zero would have been immediately obvious.

07/07/21 asdeck28.43
BASIS='SRLX' array-out-of-bounds if user tried to read Ryd/Cont scaling
parameters for N+1 bound configs, i.e. where none can exist.

05/07/21 asdeck28.43 (Development)
Missed converting two statement functions to contained functions.
DATA statement out-of-order.
Added SAVE to MODULEs to suppress Coverity medium events.
Fortran 2008 standard makes this the default attribute for data objects.
Suppressed possible non-initialized events.
Removed some unused Format statements.
Various minor alignments to Fortran standards.

28/06/21 autos/misc 
Removed tabs from codes in support directory.
(There were no tabs in AS itself.)

24/06/21 asdeck28.43
RUN='DE' CUP='IC': if user did not specify NMETAJ then defaulted to all possible initial
levels, not just of the ground term as it should have.

24/06/21 asdeck28.43/asdeck27.133.7
RUN='DE' CUP='IC' KUTDSK=-1 crashed as file storing target VCCs was accidentally closed.
Unlikely to need KUTDSK for RUN='DE' since only the N-electron stored in memory,
the N+1 are calculated on-the-fly as needed, unlike the Auger case.

21/06/21 asdeck27.133.7
Bug-fixes for little-used options (not covered by the test-suite).

21/06/21 asdeck28.42
Bug-fixes uncovered by Dragan's Coverity static analysis.
A few ported back to v27.x

18/06/21 asdeck28.42
Added MODULE UTILITY_STRING to convert case of user input to UPPER, if necessary.
Original MODULE UTILTY renamed UTILTY_UNIT (as it defines UNIT nos.)
MODULE UTILITY now uses these two modules c.f CONSTANTS.

16/06/21 asdeck28.41
WRITE(0,*) now WRITE(MW0,*) so could redefine MW0.ne.0 to route screen output elsewhere.
Sh/would go to fort.MW0 (for MW0.gt.34) unless a new file is OPENed.
Various (cosmetic) tidy-ups.

10/06/21 asdeck28.41
Changed SR.VACPOL statement functions to contained functions.
Formatting fixes.

10/06/21 asdeck28.40
Replace Column 6 continuation marker (x or X) with &.

09/06/21 asdeck28.39
Minor fixes+cosmetics.

08/06/21 adaspe 2.7
Made large memory array(s) allocatable and attempt to allocate to size of problem.
Not exact and user may need to re-set NDIM30,NDIM32 (which are now initially small)
to force the required dimension. The point is to try and accommodate large OP processing
which can require several Gb of memory as well as (much) smaller (test) cases on small
memory machines. The initial alloc may improve with experience.
There is no re-allocation as the code fails quickly if dimensions are too small.

03/06/21 asdeck28.38 (Development)
Closed-shell specification was based-in MODULE BASIC in the SR.ALGEB0 branch before being
"transferred" to MODULE NRBAL1 at the end for use by SR.ALGEBn, n=1-4. Now, MODULE BASIC
is no longer used. After reading user specified closed-shell range at the start of SR.ALGEB0,
it is stored in MODULE NRBAL1 directly.
This should mark the end of the v28 maintenance development, "started-off" by v27.
What follows now should be bug-fixes (v28) and "new" non-maintenance features (v29+).

03/06/21 asdeck28.37 (Development)
MODULE COMMON_UTILITY re-organized:
Only historic COMMON /NRBUNI/ retained, and module renamed UTILITY.
Historic COMMON /NRBDIM/ moved to MODULE PARAM.
Remainder for new MODULE COMMON_MISC.

02/06/21 asdeck28.36 (Development)
STDIN and STDOUT (5 & 6) are now MR5 and MW6. So, easy for ADAS to switch to 39 & 40.

02/06/21 asdeck28.35 (Development)
All UNIT numbers, except 5 and 6, are defined as MRn,MWn,MRWn - see MODULE COMMON_UTILITY.
Previously, some were explicit and some were opaque variables, which were
not necessarily particularly consistent/helpful.
The user can redefine any unit number, as long as there is no clash (not tested-for!)
All used are noted in the MODULE COMMON_UTILITY. 

27/05/21 asdeck28.34 (Development)
Scattering symmetry arrays LSPI/JPI were not allocated for parallel operation.

26/05/21 asdeck28.34 (Development)
RUN='DE' EIE continuum DW STO potential was wrong by 1 electron since the continuum orbital is not 
one of the atomic occupied orbitals (it is for bound-free problems and SR.STOPOT assumes so).
This was flagged in olg as the STO potential not having reached its correct asymptotic form.
Whether anyone took any notice of this, or whether anyone has used STO here...
(It has never worked.)

26/05/21 adaspi 1.24
Write info on actual dimension usage c.f. adaspe.
Replaced an arithmetic if.

19/05/21 adaspe 2.6
Expanded adf38l field to handle I7 for level index.

21/05/21 asdeck27.133.6
Initialization fixes for gfortran compiler, in particular, BP-DW.

21/05/21 asdeck28.34 (Development)
Multiple bugfixes, initializations/allocates etc. A few ported back to v27.x

19/05/21 adaspe 2.6
Introduced PRINT='FORM' or 'UNFORM" in NAMESLIST ONE. adf38 files can then be made unformatted. 
The large rate file and execution time are about 20% smaller/faster.
Default is formatted files still.

18/05/21 adasdr 3.14
Fix for use of AS bundled data, need to skip reference unresolved states in reverse index level loop.

17/05/21 adasdr 3.14
Fixed bug introduced with v3.13 of 21/01/21.

17/05/21 adasdr 3.12
Array out of bounds if generating binned cross sections from hybrid AS data.

14/05/21 asdeck28.33 (Development)
**********************************************
*** ALL COMMON BLOCKS HAVE BEEN ELIMINATED ***
**********************************************
as COMMON/BASIC/ now MODULE COMMON_BASIC.

13/05/21 asdeck28.32 (Development)
Reworked COMMON/BASIC/ to eliminate all array usage.

12/05/21 asdeck28.31 (Development)
Only the historic legacy (SS blank COMMON) COMMON /BASIC/ remains, as

MODULE COMMON_ALGEB replacement for
COMMON /OUTP1/
COMMON /SSWRK/
COMMON /NRBDSK/
COMMON /NRBDUM/
COMMON /NRBFAN/
COMMON /NRBFOT/

MODULE COMMON_UTILITY replacement for
/NRBDIM/
/NRBDIJ/
/NRBNAM/
/NRBUNI/
/hps/
/nrbone/
/nrbtim/

COMMON /CMDVC/ -> MODULE COMMON_NRBDW3
common /nrbpar/ -> module common_nrbpar

10/05/21 asdeck28.30 (Development)
MODULE COMMON_MINIM replacement for
COMMON /OUTP2/
COMMON /NRBCOR/
COMMON /NRBMIX/
COMMON /NRBTCC/
COMMON /NRBWGT/

07/05/21 adaspe 2.5
Array out of bounds (NDIM7) not caught when using new loop to reduce NDIM7 usage!

06/05/21 asdeck28.29 (Development)
MODULE COMMON_CMESH replacement for COMMON /CMESH/,/NRBBOX/,/NRBHF/
COMMON /NXRLP/,/NSSADR/,/NXRLS/,/NXRNL/,/NXRL/,/NXRLP/,/NXRLS/ added to existing related MODULEs.
COMMON /NRBPOL/, /PARPOT/ added to MODULE COMMON_NRBPOT.

04/05/21 asdeck28.28 (Development)
Start to group remaining COMMONs into MODULEs (nothing left to allocate) for more flexibility,
and future-proof against COMMON being deprecated.
So, MODULE COMMON_NRBDR replacement for COMMON /NRBDR/,/NRBLOO/,/NRBNV/
Spun-out SR.MINIM_ALLOC, SR.MINIM_DEALLOC, SR.DWX_DEALLOC.

03/05/21 asdeck28.27 (Development)
Added SR.CALGX0 to recover SR.CALGEB scratch dump (c.f. SR.ALGX0 for SR.ALGEB) to make
ALLOC/DE-ALLOC a cleaner break between SR.TARGET and SR.DEIE - potentially for a RESTARTX.
For both, now dump/recover SR.RADIAL data: (again for cleaner ALLOC/DE-ALLOC)
      READ(MRP)((DUY(J,K),J=1,MXORB),K=1,MXORB),(DEY(K),K=1,MXORB)
      READ(MRP)(DHNS(J),J=1,MJH),(MNH(J),J=1,MJH)
      READ(MRP)(DX(M),M=1,MAXRS),(DORIG(K),K=1,MXORB)
      READ(MRP)((DPNL(M,K),M=1,MAXRS),K=1,MXORB)
      READ(MRP)((DQNL(M,K),M=1,MAXRS),K=1,MXORB)
      READ(MRP)(DADJUS(I),I=1,IXVAR0)     !ONLY NEED LAST LOC (POSSIBLY)
C      READ(MRP)(JEND(I),I=1,IXORB1)                    !NOTHING TO PASS
      IF(BSTO)THEN
        READ(MRP)MCFMX,MEXPOT,NOCC,NLSTOE
        READ(MRP)(ALF(I),I=1,IXORB1),(TEL(I),I=1,IXORB1)
     X          ,(MC(I),I=1,IXORB1),(MCFSTO(I),I=1,IXORB1)
     X          ,(BFIX(I),I=1,IXORB1)     !ONLY NEED LAST LOC (POSSIBLY)
      ENDIF

30/04/21 asdeck28.26 (Development)
********************************************************
*** ALL PRIMARY DIMENSIONS ARE NOW FULLY ALLOCATABLE ***
********************************************************
now that all MAXB1 arrays allocatable.
COMMON /NRBDEN/+/NRBPLS/, /NRBREL/+/NRBNUK/+/COM7/ to MODULES COMMON_NRBDEN & COMMON_NRBREL
COMMON /NRBHAM/ -> MODULE COMMON_NRBPOT.

24/04/21 asdeck28.25 (Development)
COMMON /COM1/DPOT(MAXB1),TOL,MEND
COMMON /NRBFOT/DERV(MAXB1),BFOT   (EX-BFOT)
COMMON /NRBHAM/POTHAM(MAXB1),MPSEUD
now allocatable and moved to MODULE COMMON_NRBPOT
/COM1,4,6/ were "working" arrays for use through-out code. Now made local, & allocatable as needed.
/NRBFR/, /NRBSPL/ were a mix of working and data storage. 
DERV1(MAXB1),DERV2(MAXB1) (/NRBSPL/) moved to MODULE_NRBPOT and work usage local/allocatable.

22/04/21 asdeck28.24 (Development)
Only MAXB1 remains as a non-fully allocatable primary dimension, as:
MAXDF arrays allocatable.
MAXLL was allocated but now internally set a default when PARAM defaults to -1, i.e. a user
setting unnecessary. There is little difference timewise between storing/re-using and 
re-calculating on the fly. However, with memory ~MAXLL^5, user could have inflated.

21/04/21 asdeck28.23 (Development)
Scattered (ALGEBn etc) repeated factorial evaluation now done once by SR.DFACT at start of
a calculation by PR.MAIN to as large as allowed (fast) by REAL(WP) PRECSN, i.e. to where
cancellation error sets-in for this algorithm. WP=8 suffices for all physical needs.

16/04/21 asdeck28.22 (Development)
MODULE COMMON_TRANLS -> MODULES COMMON_TFU & COMMON_INTS
MODULE COMMON_NRBPOT replacement for /NRBPOT/ & /NRBPOT/ - more will added.
SR.MINIM0 hard READ buffers made allocatable for large user inputs.
RE_ALLOC & RE_ALLOC2 extended to (XP=16) - not normally used & legacy OS do not support.

13/04/21 asdeck28.21 (Development)
CONSTANTS MODULES added.
MODULES COMMON_GENINF,COMMON_NRBQED,COMMON_NRBSHF,COMMON_NRBSTO,COMMON_NRBVAL common_nrbtmp allocatable.
COMMON /CRAD/->/CMESH/ minus JEND.

09/04/21 asdeck28.20 (Development)
MODULES for COMMON/NRBDW6 allocatable.
MAXGR now done - see 30/03/21 asdeck28.16
COMMON /CHARY/DEY(MAXGR) allocatable (under DBD2)
Plus QCGS(MXEL0) from /NRBVCX/
Plus QCP(MAXCF) from /QTG/

08/04/21 asdeck28.19 (Development)
MODULES for COMMON/NRBALn=0,4 & NRBORB, NRBLIM allocatable.
MAXCF arrays allocatable.

31/03/21 asdeck28.18 (Development)
MAXTM arrays allocatable.

31/03/21 asdeck28.17 (Development)
MAXLV arrays allocatable.

30/03/21 asdeck28.16 (Development)
MODULES for COMMON/NRBDWn=4,9 allocatable.
Note: n=6 uses MAXGR - TBD...

30/03/21 asdeck28.15 (Development)
MODULES for COMMON/NRBDWn=5,7,8 allocatable
So MXENG arrays now allocatable for DW runs all as well.

29/03/21 adaspi 1.24
Introduced PRINT='FORM' or 'UNFORM" in NAMESLIST ONE. adf39 files can then be made unformatted. 
The large px & tot files are a factor 2 smaller, while execution time is a factor 2 quicker.
Default is formatted files still.

26/03/21 asdeck28.14 (Development)
COMMON/NRBDWn=1,2,4,5,6,7,8,9 all MODULES (there was no n=3 anymore.)
Not yet allocatable. (n=1,2 have no arrays.)

25/03/21 asdeck28.13 (Development)
MXENG arrays allocatable for non-DW runs.

24/03/21 asdeck28.12 (Development)
MXLL COMMON arrays now allocatable MODULEs.

04/03/21-18/03/21 asdeck28.1-28.11 (Development)
"Re-introduced" historic separation of MAXCT and MAXTM: the no. of algebraic terms
vs the number of Hamiltonian terms. MAXCT includes buffer space to hold the terms of
two sub-shells and their resultant coupling. The additional buffer space is only needed
one configuration at a time. Once the terms are complete for a configuration then only the
final number, together with the accumulation of those of previous configurations, is held. 
MAXTM is the final term total, without any buffer.
MAXTM is easily calculated from the Slater states, before any explicit calculation of the
terms. Thus, the required MAXCT to generate them is known, provided one has a safe value
for the buffer. We take it to be the largest number of terms any single configuration has (+1).
The maximum total  number of terms for the two parent sub-shells cannot exceed the final
total (-1). This occurs when one sub-shell consist of a single ^1S term, then the other
sub-shell already has the final total. Any other scenario leads to less parent terms, for
a fixed final total.
Turned numerous COMMON blocks into ALLOCATEable MODULES such that MAXSL, MAXJG, MXCHG, MXSYJ
are fully-determined - i.e. now flagged as "-1" because any user input is always ignored.
MAXCT is fully-determined (albeit with the max possible buffer.)

03/03/21 asdeck27.133.5
Historic dimension check mode could fail due to non-initialized array (was fine if init zero).

02/03/21 asdeck27.133.5
Attempt to access non-allocated array when using 2-body fine-structure for autoionization.
(Array did not need to be accessed in this (2fs) case.) Bug introduced in v27.125.
Misc tidy-ups regarding continuum orbital generation.

25/02/21 adaspi 1.23
nl-loop multiply counted electron targets in adf39l. adf39px fine.
All previous PI work was multiple files or "all-in-one"!

25/02/21 asdeck27.133.4
Minor fixes for PI at v. high energy (inc. saving users from themselves.)

23/02/21 adaspi 1.23
Tweaked read of NTAR stat. weight info so that the first line is not treated as a terminator.
Otherwise NTAR=-1 is reduced to zero and no electron target configs/energies are written to
adf39l - which we still need for OP, but not the stat. weight labels. Lazy workaround was a 
dummy set of values for the ground state - not ideal as could be mis-interpreted by the 
structurally challenged. 

03/02/21 asdeck27.133.3
Historic operation, up to and including all v24.x, was to enable use of a finite nucleus *only*
when kappa-averaged orbitals were in use - and, by default, it was switched-on for Z.gt.30. 
The user could choose to switch it on/off at lower/higher charge.
It could not be switched-on by the user when non-relativistic orbitals were in use.
At some point in the v25.x development, calculation of the finite nucleus was spun-off into
a separate subroutine from sr.radial and there was no longer any restriction on accessing it,
with non-relativistic orbitals. But the default initialization was not changed. Consequently,
it was always switched-on for Z.gt.30, which is arguably not a consistent default if the user
has "decided" to continue with non-relativistic orbitals for Z.gt.30. 
Z=30 is where we would normally switch to using kappa-averaged orbitals.
Now, partially "return" to previous default - it is only switched-on for Z.gt.30 if the user
has chosen kappa-averaged orbitals. It can still be switched-on by the user for use with
non-relativistic orbitals (at any charge) and, of course, can still be switched-on/off at
lower/higher charge by the user with kappa-averaged orbitals. (Very low charge can be problematic
because the radius gets smaller than any reasonable initial radial mesh step.)
The effect is small and likely of little consequence at moderate Z, while use of non-relativistic
orbitals at high-Z is highly not recommended. 
But, it means that while v27.133.3 onwards is now consistent with v24.24.5 (and earlier) for 
CUP='IC' & NZION.ge.30, v25.x and v26.x will show small differences in such default operation.

03/02/21 asdeck27.133.3
Bugfix for obscure user input combination.

21/01/21 adasdr 3.13
Added some safety checks against eccentric/extreme user input.
Tried to improve handling for large user NLMAX e.g. all AS configs to large n, would
miss explicit Ryd-Ryd nl for n .gt.NRSLMX.
But this introduced a bug for bundled AS data - summed non-sequential n as sequential!!!
Fixed with v3.14 17/05/21.

19/01/21 adasrr 3.9
(Hydrogenic) top-up for NMAX.lt.N.le.NRSLMX did not include L=0-LMAX, where NMAX is the max N from AS.

19/01/21 adasrr 3.8
(Hydrogenic) top-up in N did not include L=0-LMAX, where LMAX is that used for the AS calculated N.
Since hydrogenic is not good (for any N) save bare ion, normal practice is to calculate L=0-LMAX
(where LMAX=2 or 3) on the full N-mesh (same as for DR) with AS.

14/01/21 adasrr 3.7
Re-sync bare ion standalone n-mesh with AS-DW.
Minor re-sync. with adasdr 3.12.

13/01/21 adasdr 3.12
JTHETA=0 now writes a type-5 only to adf09, as per adasrr. It is not necessary for the user
to explicitly set NBIN (the default NBIN=0 is reset to -1 when JTHETA.EQ.0.)
JTHETA.LT.0 now combines JTHETA.EQ.0 and JTHETA.GT.0 operation viz. writes a type-5
file to adf09_5 and a type-3 file to adf09_3.  The no. of ADAS/ADF37 temps can be
restricted by |JTHETA|, i.e. set JTHETA=-999, say, for both files at all temps (adf09_3). 
Default, JTHETA=999, so a single type-3 file written to historic adf09 at all possible temps.

08/01/21 adasrr 3.7
JTHETA.LT.0 now combines JTHETA.EQ.0 and JTHETA.GT.0 operation viz. writes a type-5
file to adf48_5 and a type-3 file to adf48_3.  The no. of ADAS/ADF37 temps can be
restricted by |JTHETA|, i.e. set JTHETA=-999, say, for both files at all temps (adf48_3). 
Default, JTHETA=999, so a single type-3 file written to historic adf48 at all possible temps.
JTHETA=0 still writes a type-5 only to adf48. One could also write a single file (JTHETA.GE.0)
to the relevant extension, but that is not backwards compatible. adf48 is been standard.
Straightforward to modify script to look for historic or for both when archiving production runs.

06/01/21 asdeck27.133.3
Case BASIS='SRLX' with photoionization ('PI' or 'RR') did not pack orbital info
correctly for determining radiative data. Could give correct answers, or garbage.

18/12/20 adasexj 3.19
Ported use of numerical distribution (adf37 file) from adasdr/rr.

18/12/20 adasrr 3.6
RR onto a bare ion got broken by the recent (and not so recent) changes.

18/12/20 adasdr 3.11
JTHETA.gt.0 can be used with NBIN.lt.0 to easily switch-on convolution of adf09 binned-partials.
(By default, adasdr expects the convolution to be defined when using binned cross sections.
This is a legacy of NBIN.gt.0 which can use cooler, Gaussian etc distributions as well.)
adf09 binned partials can only be convoluted with Maxwellian, kappa, Druyvesteyn & numerical
distributions. It does not read a binned adf09, it just writes convoluted on the ADAS/user
specified temperature grid instead. Note, the JTHETA.lt.0 (default) does not (of course)
switch-on convolution. This is in contrast with adasrr. But convolution was/is always ON by default
for adasrr while it was/is OFF (NBIN.ne.0) or ON (NBIN.eq.0) in adasdr.
Note: JTHETA=0 is the same for both but rather redundant for adasdr.

14/12/20 adasrr 3.5, adasdr 3.11
Tidying-up and synching.

11/12/20 adasdr 3.11
Added use of numerical distribution (adf37 file).
Comments below for 10/12/20 adasrr 3.5 also apply here.

10/12/20 adasrr 3.5
Added use of numerical distribution (adf37 file). User flagged explicitly by ICON=3.
Quadrature may need to be re-optimized for some highly non-Maxwellian cases.
Currently, there is no extrapolation of the distribution outside of the tabulated
energy range since non appears to have been implemented in adf37, although placeholder flags
exist. When/if such appear SR.ADF37 should be modified accordingly. High-T high-l partials
are sensitive to the contribution from the *low* energy tail of the distribution.
If the adf37 Maxwellian test case is used, a suitable tail can be found (commented-out) in FN.FBAR.
Also, the distribution F(E) / sqrt(E) is interpolated in energy, as necessary (for quadrature).
The tabulation must be sufficiently dense in energy to support this at *all* energies.
The adf37 SOL test case is *not* suitable, but if F(E) is interpolated (and then divided by sqrt(E))
then reasonable results can be obtained. This necessitates uncommenting lines as indicated in FN.FBAR.

07/12/20 adasrr 3.4
If the number of ADAS default temperatures is restricted (by JTHETA) to zero, then write 
(E*) RR cross section to adf48 instead of (convoluting to form) the rate coefficient..
JTHETA.lt.0 (default) gives all possible (still.)

04/12/20 adasrr 3.3
Maxwellian case topped-up high-n (>20) at high-T by taking sigma_RR_*E^m a constant and using
exponential integral to complete the convolution over all energies analytically. This is
normally just for bundled-n since bundle-nl defaults to n <=10 and totals dominated by low-n.
For non-Maxwellian case, fit ratio of distribution to Maxwellian as a*E^2+b*E+c and apply
exponential integrals again. The "fit" is just 3-point Lagrange interpolation with the usual
weights re-arranged to isolate E^2 etc.

02/12/20 adasrr 3.2
Added kappa/Druyvesteyn distribution options (and numerical placeholder) as per adasdr/adasexj.
Note: the quadrature is optimized for Maxwellians. It's accuracy should be investigated for
strongly non-Maxwellians.
Analytic exponential (Maxwellian) top-up of bundled-n at high-E/T needs changing for non-Maxwell (TBD).

26/11/20 adasdr 3.10
Sync. Maxwellian convolution with kappa/Druyvesteyn wrt treatment of distribution over bin width
(trapezoidal quadrature vs exact integration).

25/11/20 adasrr 3.1
Removed commented-out f77 code option. Tidied-up, re-synch'ed with adasdr.

25/11/20 adasrr 2.10
Fixed bug introduced 09/07/19 which limited adf48 bundled-NL  to L=1.

25/11/20 adasdr 3.10
NBIN.lt.0 binned partial DR cross sections are now convoluted if the usual EWIDTH convolution flag is set.
Thus, rate coefficients are written again to adf09 for comparison with the exact NBIN=0 rate coefficients.
Currently, the binned cross sections are NOT rounded to 3 s.f., as written to adf09, before convoluting.
Also, the rounded bin energies are used for the classic (total) binned cross sections when NBIN.lt.0.
Unrounded are still used for NBIN.gt.0...
Finally, if EWIDTH.ge.0 (which flags a cooler or Gaussian distribution) only the classic total binned
cross sections are convoluted such. Currently, any adf09 file will still use a (non-)Maxwellian distribution.
adf09 could contain cooler or Gaussian distribution convolutions, if there were any need for such...

19/11/20 adasdr 3.9
Ported kappa, Druyvesteyn (and numerical placeholder) distributions from adasexj.
Use as per adasexj - set KAPPA.gt.3/2 or XDRY.ne.1

13/11/20 adasdr 3.8
Historic Maxwell convolution of (total) binned cross sections used a constant value for the distribution across
the bin (based-on the upper bin energy). This was rarely used/needed since adf09 does the job (and more) exactly.
But with the binned cross sections form of adf09, this is needed as a cross check. So, trapezoidal is used now,
c.f. adasexj. Analytic is trivial (Maxwellian) but gains little. Note, Gaussian and Cooler have always used the
analytic integral of the distribution.

11/11/20 adasdr 3.7
Implemented cascade through the lowest ICASC autoionizing states, for *total* DR cross sections/rate coeffs only!
Any adf09 partial data is unchanged. This is more general than mdrcs13, which only allows a one-step cascade,
allowing for the complete chain of cascades through successive autoionizing levels. However, like mdrcs13,
post-processed Rydberg-Rydberg radiation is NOT cascaded. (This would best/need hydrogenic CA dipole Auger rates.)

04/11/20 adaspe 2.4
Reduce memory requirement and write info on some dimension usage esp. NDIM30,NDIM6,NDIM19
which should be as small as possible. (Could code re-allocation - but fast dim fail.)

03/11/20 asdeck27.133.2
Try and catch numerical failures for extreme (bound) cases - very high-l/multipoles.
And catch some of sillier user inputs.

28/10/20 adaspi 1.22
Revert to non-log interp of partial PI to form totals - log interp is very slow.
For large PI/OP problems this is time consuming overall. Currently, no user switch.
BLOG=.TRUE. or .FALSE. has to be set manually in FN.XINTP & FN.XINTT.

29/10/20 adaspe 2.3
NDIM17 dimension test (no. lower-state-resolved radiative transitions) effectively got bypassed.
o.k. if IRSLMX was specified (max lower-state-resolved wanted). But when IRSLMX was not specified
it was set to max allowed by dimension (NDIM17) but when more (than NDIM17) possible they were
ignored by IRSLMX operation.

26/10/20 asdeck27.133.1
Read of RESTART could abort (gracefully) if compiler did not initialize an undefined integer to zero.
(Oracle fine, all opt levels. PGI fine low-level opt, but not -O3.)

23/10/20 asdeck27.133.1
Structure run with .ge.1000 configs tripped a DR flag which reduced the number to ~mod(mxconf,1000).

12/03/20-22/10/20 adasdr 3.1-3.6
Implemented a type-5 adf09 file of partial final-state resolved energy-averaged DR cross sections, c.f. adf04.
This is flagged by NBIN.lt.0 (NBIN.gt.0 gives the classic total binned DR cross sections, and no adf09.)
Since the number of bin energies |NBIN| needs to be kept as small as possible, it is best if the
user allows adasdr to set them (NBIN.gt.-10, = -1 say). NBIN.le.-10 will set-up the -NBIN bins in the
usual fashion if EMIN.gt.0, but forces a log mesh starting at an energy consistent with the adas adf09
type-3 temperature mesh if EMIN=0. However, since the adf09 T(1)=10*z^2 K is very low (R-matrix adf04 starts 
at 20*10*z^2 K) the current bin set-up only aims to accurately reproduce (Maxwell) rate coeffs down to
this adf04 starting T. This can be done with a few hundred bins. Going down to the the adf09 first T
requires a a few thousand bins, which is impractical generally. This bin set-up may change in the future,
with more experience. TBD: add some non-Maxwellian distribution convolutions c.f. adasexj.)

02/10/20 asdeck27.133.1
COMMON /NRBJ/ was not of equal length through-out.

15/09/20 asdeck27.133
************** Public release of v27.133 as the default AS distribution **************

25/03/20 asdeck27.133
Minor bugfixes.

08/01/20 adasexj 3.18
Sync btop usage with asdeck27, but default=.false. for backwards compatibility.

08/01/20 asdeck27.133
Only apply test for breakdown of Born allowed top-up in the high-E near/degenerate limit
at threshold parameter (X=E/dE) values .gt. XBTEST=5 so as to ensure in asymptotic regime.
Default btop=.true. still.

22/11/19 asdeck27.132
Minor.

20/11/19 asdeck27.132
RUN='DE' dipole top-up in neutral atoms could fail at an isolated energy due to false 
convergence in FDIP0. This could lead to a large spike/dip in the collision strength.

13/11/19 asdeck27.131
Tweak/correct defaults following test-suite run.

08/11/19 asdeck27.131
KUTLS: KUTLS.lt.0 restricts CI-mixing to within a configuration, repartitioning the
Hamiltonian correspondingly, reducing memory and speeding up e-vector multiplication.
KUTLS.gt.0 is the default full mixing case. More generally, one would like to specify
mixing between a low-lying set of configs and none involving high-lying configs, for
which mixing is unconverged/inaccurate, but one would like single config data at least.
Ideally, this would use the efficient coding for KUTLS.lt.0  for these unmixed configs.
However, a combined rather than binary choice requires some work.
For now, we implement this combined case using the KUTLS.eq.0 "approach" which
simply neglects the interaction between (all) configs and does not repartition H.
So, now KUTLS.gt.0 allows for full mixing between between the first KUTLS configs 
(defined by CF number as with the KCUT correlation switch) and mixing within a config only
for those with CF.gt.KUTLS. So, KUTLS=1 (and 0 still) give the same answer as KUTLS.lt.0
but without the efficiency of repartitioning H. The default KUTLS is the total no. of configs.
 
08/11/19 asdeck27.130
Reduce Born memory if less multipoles used than initially allocated.

04/11/19 asdeck27.130
Changed CADW defaults (LCONDW, MAXLX, MAXLX, NMULTE) to be more aggressive.

02/11/19 asdeck27.130
Fixed bug in CADW: for small scattering l, some channel l were missing.
Does not seem a big effect.

01/11/19 asdeck27.130
Introduced ability to restrict the number of multipoles (NMULTE) retained for two-body interactions.
Mainly for high-l DW work where restricting by the max value of lambda is not useful.

31/10/19 asdeck27.129
Test for breakdown of Born allowed top-up in the high-E near/degenerate limit.
Attempt to replace high-E DW omegas by Born limit in such cases.
Controlled by btop (.t. or .f.) in NAMELIST &ALGEB. Default=.true. (subject to change).
TBD: calculate Born partial collision strengths and subtract sum from total finite-energy Born,
to provide an improved top-up for non-dipole allowed transitions.

31/10/19 adasexj 3.18
Test for breakdown of Born allowed top-up in the high-E near/degenerate limit.
Attempt to replace high-E DW omegas by Born limit in such cases.
Controlled by btop (.t. or .f.) in NAMELIST &ADASXEJ. Default=.f. (subject to change).

25/10/19 asdeck27.129
Catch numerical failure of very large Born multipoles.

24/10/19 asdeck27.129
Modify test for the dropping of small E_k algebraic coefficients so as not to miss high-lambda Born limits,
case LS(IC). CA was fine.

23/10/19 asdeck27.128
Extend config. labelling in adf04 for high-l states.

22/10/19 adasexj 3.18
Historic default is to fit high-E behaviour of Born allowed transitions to allow for deviation from
asymptotic due to R-matrix coupling. For DW, there are often insufficient points to do this,
as opposed to R-matrix where there should be. So just assume asymptotic form, case DW, but stop 
still for R-matrix, as before, if insufficient points to determine high-E behaviour.
N.B. IRMPS=-1 could always override the STOP and enforce asymptotic form, even for R-matrix.
But for DW, it is the only "option", so make it so.

21/10/19 asdeck27.128
RUN='DE': if running more than one total L per processor then low-L values calculated unneeded Slater integrals,
for that L. Only noticeable for large numbers of target orbitals e.g. extending beyond n~10, all-l.
N.B. in principle, user specification via INAST should order low- to high-L for efficiency.

16/10/19 mdrcs13.6
Made compatible with use of hybrid (bundled) input rate files (ohic/u, ohls/u).

10/10/19 asdeck27.128
Drastically reduced number of Born integrals computed when KUTLS.le.0, i.e. mixing within a configuration only.
When there is no CI (CUP='CA') then all Born integrals are squares since there are no cross terms and the number
of them is proportional to MXVORB^2.  In the full-CI case, the cross terms lead to the number being proportional
to MXVORB^4, with a commensurate increase in CPU memory and time.
When KUTLS.le.0, the actual Born integral usage is much closer to the no-mix CA case than the full-CI case,
but the full-CI case was still being computed-for.

08/10/19 asdeck27.127
Allow CADW to proceed when exchange 6j-symbol equal to zero due to cancellation error - should be v.small.

08/10/19 asdeck27.127
Warn when bundled rates in use .and. user raises/lowers the continuum.
Abort if lowering results in Augers to own continuum (HRS) - post-processing can't drop them from a total bundled-loss.

05/10/19 asdeck27.127
Break-up an IF statement, in CARATE/DIAGFS/DIAGON, into two parts for sane array-bound checking.

16/09/19 adasdr 2.30
If more observed energies were requested to be read than existed in adasin then no (theoretical or)
observed energies were written to adasout. But the reduced observed set was used correctly.

11/09/19 asdeck27.127
Rydberg run with no continuum orbitals (LCON=0) segmented  due to an incorrect attempt to
access a correctly unallocated continuum array.

10/09/19 asdeck27.127
Tweak SR.CONFIG default to use (for ICFG.ne.0) NXCITE(CF) for MXAL(I,CF) for all orbitals-I generated
by NXTRA, LXTRA. Previously, set =1, which does not make much sense for NXCITE.gt.1.
Note, user can still specify the value (IFILL) in NAMELIST SALGEB.

28/08/19 asdeck27.127
Radial mesh, or rather radial integral range, could get truncated during optimization
causing convergence to wrong lambdas or not changing lambdas from unity.
(Didn't show-up in test_suite example 3. Last O.K. version was 27.57...)

This seems to have solved the problem of BASIS='SRLX' simultaneous optimization of orbitals from two groups 
frequently failing to converge.
Note, BASIS='SRLX'  orthogonalization default follows the unique case. But if optimizing groups simultaneously,
and INCLUDing terms from both groups, then ORTHOG='NO' seems to be more accurate, even for Thomas-Fermi.
In contrast, optimizing a unique set of Thomas-Fermi orbitals, for the same complete config set (i.e. including
both "groups") is more accurate with ORTHOG='YES'. At least based on a study of KLL config low-charge ions.
This seems to be due to the K-shell hole 1s being very hydrogenic when only describing K-shell hole configs.
Indeed, optimizing K-hole configs in isolation can fail to converge with ORTHOG='YES (this is with BASIS='',
i.e. a single set of K-shell hole configs.) When mixed with K-shell closed configs, 'SRLX' does manage to
converge but still suffers the same inherent inaccuracy of too hydrogenic a 1s-hole.
Playing with INCLUD might help...

14/08/19 asdeck27.127
CODE=S.S. and BASIS.ne.'  ' (i.e. a relaxed orbital option in use) aborted if the 
NEL ALLOCATION did not zeroise. Code only explicitly zeroised the unrelaxed locations.
CODE=A.S. was fully-zeroised, although any RE-ALLOCATION could give the same problem.
The initial ALLOCATION is very large, so unlikely. In any case, the abort was fast,
albeit the error message opaque (DISK=-4...)

07/08/19 asdeck27.127
M_k>1 radiative data not computed if corresponding E_k+1 did not exist because of 
selection rules: e.g. a target consisting of only s- and p-orbitals cannot give E3,
and so M2 was not computed even if RAD='M2'. This was a consequence of the max allowable
E_k multipole being determined internally since v27.126, rather than being set at 6. 
This enables all necessary Born multipoles to be computed as required. 
The knock-on was that "small" cases (as e.g.) did not allow a larger M_k. 
Now, RAD='M2' works as expected (again).
Note, it is best to specify 'M2' rather than 'E3', even though they come as a pair,
because BORN='INF' will restrict E_k to E2 etc still "as necessary", but RAD='M2' etc.
will override and deliver the requested M_k. 

01/08/19 asdeck27.127
BASIS='RLX2' did not work (in general) for RUN.NE.'  '.

31/07/19 asdeck27.127
Changed PPOT='DH' to correspond to 'DH2' so as to include the (perturbative) 2-body term.
Previously, it corresponded to 'DH1' which only includes the effective 1-body term.
The 2-body term is important. The default is still to include the effective 1-body term 
in the solution of the radial equation. 'PDH' treats it as a perturbation c.f. 'PDH1',
(or 'PDH2'.)

31/07/19 WRITEUP
Added a detailed Example 19 to WRITEUP so as to illustrate the BASIS='SRLX' operation.

30/07/19 asdeck27.127
BASIS='SRLX' with STOs did not match correctly the flagged config for non-unique core
orbitals (KCOR1.lt.0). Tweaked default Thomas-Fermi N vs N+1 choice for such 
core orbitals.

26/07/19 asdeck27.127
BASIS='SRLX' and 'RLX': only a unique Rydberg orbital was calculated.
Not an issue for Thomas-Fermi since normally use unit lambda.
But STO Rydberg attached to different core complexes should have been re-calculated.
(Continuum was done so.) This has been wrong at least as far back as v18.x.
Earlier becomes more tedious and pointless to check.

25/07/19 asdeck27.127
BASIS='SRLX': fixes for case of user specifying Rydberg/continuum orbitals explicitly
on the orbital (re-)definition line.

09/07/19 asdeck27.126
Fix of 04/07/19 was wrong, likely gives array out-of-bounds in DIAGON.

09/07/19 adasdr 2.30 adasrr 2.10
Allow user to specify the max l of nl-resolved (via LLMAX, c.f NLMAX).
Was hardwired to 9, although could be overridden in adasrr, if you knew how...
***Dimension test introduced because of this limited rep NL to L=1 (sigh). Fixed 25/11/20.

04/07/19 asdeck27.126
Use of a large number of orbitals (>60 say) and multipoles (e.g. BORN='INF') could give rise
to an integer plant overflow. This results in the DIAGON: BORN M1 M2 NOT FOUND error message.

03/07/19 asdeck27.126
Changed maximum default Born multipole from 6 to all allowed by angular momentum.
The historic default was motivated by fixed dimensions and transitions up to n=5.
If high-l states are populated then the Born values were incomplete or even missing.
Now they are correct. If only low-nl is considered then the allocated memory adjusts accordingly.
Note, the user can always restrict the maximum multipole by setting KPOLE, =6 in SALGEB, say... 

27/06/19 asdeck27.125
Do not merge degenerate TERMS or LEVELS when AS is being run as a support code, e.g. for R-matrix.
Specifically, if a radout file is being written. (Does not merge also when calculating EIE.)

27/06/19 asdeck27.125
Fixed mis-aligned COMMON block /NRBDSK/ in SR.VCU.

02/06/19 asdeck27.125
Historically, correlation states can be flagged by energy (in NAMELIST &SMINIM) as those lying above ECORR
(and/or between ESKPL and ESKPH) for positive Rydberg energies, i.e. they are relative to the ground.
Now, a negative value for ECORR is taken to be *absolute* and used to flag a range of e-states as 
correlation, and for which no e-vectors (or e-energies) are computed - see previous discussion.
The association (for DSYEVX) is VL=-1.d30 and VU=ECORR. (Negative ESKPL and ESKPH are ignored because 
DSYEVX only supports a single range.) Also, since DSYEVX supports either (VL,VU) *or* (IL,IU), 
the former overrides the latter, if the user attempts to specify both, since the latter is likely 
meaningless for channel energies.

31/05/19 asdeck27.125
The e-vectors (and e-energies) associated with correlation states are not actually required.
(The energies happen to be printed, but the e-vectors are not used since no rates are computed.)
But, to-date, they have always been (all) computed, partly because the default Hamiltonian
diagonalizer delivers them. For large correlation structure calculations, the "diagonalization"
can be speeded-up if not all e-vectors/energies are determined.
The LAPACK routine DSYEVX has the option to specify an energy range for which e-energies/vectors 
are computed. The energy range is either explicit (VL through VU) or implicit (IL through IU) - see
LAPACK documentation. Thus, the flagging of correlation configs by KCUT is not helpful.
So, have introduced NEIGEN/J in the &SMINIM NAMELIST so that the lowest NEIGEN/J e-states are solved-for
(via IL=1 and IU=NEIGEN/J) per symmetry. 
For control by symmetry, NAST/J in NAMELIST SALGEB now support an option to read-in the symmetry-specific
number of e-states to be found on the line following the symmetry specification. As with R-matrix STG2,
the flag of reading an additional data line is a negative spin-multiplicity or 2J-value. 
(The J=0 case is again circumvented by flagging the parity negative, using -2 for even and -1 for odd.)
Note, states for which no e-vectors are computed are flagged as correlation by AS, irrespective of KCUT.
This implicit selection of the lowest lying states is only useful for non-continuum problems.
The presence of degenerate channel energies means that an energy specific range is necessary. 
Not yet implemented.

21/05/19 asdeck27.124
Modified default flag to switch minimal KUTDSK memory buffer to maximal from 1000 to 10000 
so can set KUTDSK.ge.1000 (but .lt. 10000) with minimal buffer memory still.
Maximal memory buffer stores all configs for two SLp groups in memory to reduce I/O for E_k algebra.
See original implementation, 30/06/11 asdeck24.7, for more details.

20/05/19 asdeck27.124
Parallel unitarized DW EIE aborted for targets with odd number of electrons.

18/05/19 asdeck27.124
Fixes for configs with no terms. Structure run is required work for such cases so as 
to avoid having to delete configs from a large CONFIG.DAT file when restricting symmetries.
Currently, DW EIE requires all configs to contribute a term. Not such an issue then.

16/05/19 asdeck27.124
KCUT flags correlation configurations (CF.gt.KCUT). Only terms that occur in spectroscopic
configurations are retained (CF.le.KCUT). This historic option has little use nowadays.
Typical large-scale calculations have most term symmetries in the spectroscopic set.
Now, KCUT.gt.0 also neglects interactions between distinct configurations.
Large-scale correlation expansions can now be used in principle, which retain
mixing with the spectroscopic set still. While, the ALGEB problem is solved,
DIAGON/FS still diagonalize the entire Hamiltonian. Need to implement DSYEVX/DSYEVR
to determine only the spectroscopic (or subset thereof) e-energies and e-vectors.
Note: rates involving correlation states are not calculated by default, already.
Note: since v25.x, the sign of KCUT does not matter (since KCUT=ABS(KCUT) was implemented).
Now, a user set KCUT.lt.0 flags use of the historic treatment of correlation.

14/05/19 asdeck27.123
Re-instate magnetic quantum numbers stored in I*2 arrays.

09/05/19 asdeck27.122
Iterated TEC's failed with continuum present.

19/04/19 asdeck27.122
As of v27.106 the magnetic quantum numbers were stored in I*2 arrays.
However, the first location was used for the *total* number of Slater-states, in a config.
This cannot be held as I*2 in large cases. For now, have switched back to I*4.

18/04/19 asdeck27.122
VCU alone is used in dimension check mode to determine allocation sizes for Slater states and terms.
In this use, it generates the Slater-states for the entire configuration. 
This is normally fast since no VCCs are generated and the L^2 and S^2 matrices are not diagonalized.
A large configuration, with many open shells, generates a large Slater-state array and the
scanning of it was inefficient, running over all M_L values when only M_S for a given M_L needed
to be searched-for. As such it could take as long as ALGEB1 (VCG) in non-dimension check mode.
The scan is now suitably restricted. This only affects v27.x since earlier versions used user PARAM.

04/04/19 adaspe 2.2
Did not terminate gracefully if radiative data from the highest level was not wanted.
Could occur for Rydberg runs with low-charge complex ions.
This arose with the 1.19 development to reduce memory requirement for storing radiative data.

26/03/19 adaspi 1.21
Changed default interpolation of partial and total cross sections for XDIPAR, XDPITOT & adf39tx
to use the log of the cross section. adf39px is unchanged, of course.
This is very slow!

12/02/19 adasexj 3.17/8
Case of input X-mesh (PWB or historic interval-averaged R-matrix), the internal final energy
mesh only skipped unwanted external energies one at a time. I.e. assumed the internal
mesh was finer and (first non-zero point) started at lower energy than the external one. 
For near-degenerate transitions, the X-mesh gives many low energy points between 
the internal mesh points, especially between zero and the first non-zero final one.
They did need to be *very* near degenerate to cause large errors, e.g ~1.d-6 z-scaled Rydbergs.

23/01/19 adaspe 2.1
Made Auger arrays allocatable. Then, only allocated if Auger data present.
Still requires "hard-wired" dimension then, since currently no re-allocation,
as is the case for all post-processors which allocate, to a degree.

23/01/19 adaspe 1.21
adf38r did not contain the correct n-value for the upper states when n.lt.NV.
This only occurs when configs from different n (i.e. lt. NV) are included for
an "all-in-one" calculation to allow for (N+1)-electron CI. Historic (OP 2004)
was correct. Note, now when LV=-1, the historic adf38r has the "correct" l-value
for the outermost electron. Of course, this has little significance (2s2p vs 2p2s).
The upper state n-value is the issue, for extrapolation.

16/01/19 asdeck27.121
Parallel fix for MSTART=n+6, RESTARTxx not opened (needed a mod(mstart,6) test).
Note, can only run one l-per-processor here otherwise next partial restart write for l would 
overwrite the previous yet-to-be-read restart info for l+1, as file is sequential..
Same is true for serial.

15/01/19 asdeck27.121
RESTART operation one "stage" at a time did not work if KUTDSK was in use.
Although the VCCs were "saved" in file DISKDC, record info was not; now done so to IDISKDC.
N.B. MSTART=n+6 exists after execution of only ALGEBn. Must be done in sequence MSTART=7,8,9,10
at which point the usual RESTART is present and so MSTART=5 or 11 runs the MINIM branch.

22/12/18 asdeck27.120
Minor: reduce size of IPLANT, was unnecessarily large for BASIS='SRLX' KCOR1=-1.

21/12/18 asdeck27.120
Initial BASIS='SRLX' used a common set of core orbitals still, as BASIS='RLX'.
Unless a few electron system, where one could set all as valence, it is thus not possible to
generate multiple group energies exactly as what was calculated by one group at a time.
It is of particular interest to be able to do so for bound-free processes, where non-Rydberg
runs will default to N- and N+1 Thomas-Fermi potentials for the core electrons for the
two ionization stages when treated separately, but a unique choice was required when run together.
Now, if the user sets KCOR1=-1, then BASIS='SRLX' treats the core orbitals separately, on the
same footing as the valence orbitals. Thus, one can recover the exact energies for the
two ionization stages. One can also do so for two groups of opposite parities.
Once there are two groups of the same (or mixed) parity then there is additional mixing between
the groups of course and so the energies are perturbed. The price to pay for this option is
more orbitals, especially for heavy systems, but since the number of groups should be small,
2 or 3, it should not be a high one.
In this instance (KCOR1=-1) NLAM & NVAR still specify the number of groups to read data for,
but the lambdas  now start at 1s and the orbital-varying numbers are absolute (as in unrelaxed case).
Recall, in the relaxed case with a common core, the lambdas are valence only per group and the
orbital varying numbers start at 1. Group zero flagging the core is no longer allowed/needed,

Outstanding issue: simultaneous optimization of orbitals from two groups frequently fails
to converge. The reason for this is not fully understood.
***This seems to have been due to a bug introduced into optimization with 27.58. See fix of 28/08/19.
Failures now seem to occur also when the groups are treated uniquely, i.e. not inherent to 'SRLX'.
Note, orthogonalization default follows the unique case. But if optimizing groups simultaneously,
and INCLUDing terms from both groups, then ORTHOG='NO' seems to be more accurate, even for Thomas-Fermi.
In contrast, optimizing a unique set of Thomas-Fermi orbitals, for the same complete config set (i.e. including
both "groups") is more accurate with ORTHOG='YES'. At least based on a study of KLL config low-charge ions.

12/12/18 asdeck27.119
Tweaked ALGEB4 MXSOC & MXSOI and MXRSS & MAXMI reduction for null contributions.
Tweaked ALGEB4 use of restart for null contributions.

11/12/18 asdeck27.119
The allocatable dimensions MXSOC & MXSOI and MXRSS & MAXMI are now reduced from their initial default 
for small problems, as well being increased for large problems.

10/12/18 asdeck27.119
CADW did not update usage of MAXAD, MAXRK, MAXRL i.e. usage for target was shown, not collision problem.
This is purely for info.

10/12/18 asdeck27.119
The allocatable dimensions MAXRK & MAXRL are now reduced from their initial default for small problems, 
as well being increased for large problems.

07/12/18 asdeck27.118
Replace IABS with generic ABS, for gfortran non-I*4.

06/12/18 asdeck27.117
DW: (near) threshold near-degenerate dipole top-up could breakdown (should be zero of course) and give
a jump in the cross section there. Only seen with CA and PGI compiler, so far. Fix attempted.

05/12/18 asdeck27.117
Minor correction to evaluation of continuum orbitals for plasma screening.

03/12/18 asdeck27.117
One-component non-orthogonal kappa-averaged orbital evaluation of bound-continuum one-body kinetic+nuclear 
integral did not apply the Cowan approximation of taking overlaps to be zero (or unity) - the orbital energy
was multiplied by the b-c overlap. Only affects autoionization rates (indirectly). The effect is smaller/comparable
than the difference between the two approximations for the small component - neglect and renorm of the
large cpt or use of a kappa ind. small cpt. If the latter is deemed more accurate, as for example PI
indicates, then the Cowan approx was applied correctly then. But, the latter is default only for PI.
Autoionization retains the historic former of neglect of small cpt and renorm of large cpt.
The omission has been present for a long time, ever since v20.x.

29/11/18 asdeck27.117
Fix of 19/10/18 asdeck27.114 (for IREL=2) worked for PI but if no PI then skipped E2,E4 if RAD='E3' or 'E4'...

27/11/18 asdeck27.116
If orthogonalizing one-component kappa-average orbitals (default is not to) then
include epsilon in non-rel. one-body DQNL orthog (historically omitted as can be large and 
historic default orthogonalized). This enables low-Z limit to go over to non-rel. operation more closely.

26/11/18 asdeck27.116
Write adasex/j.in.form if user flags badas=.true. in &SMINIM or if ../adas803.pl exists.
This is for R-matrix Script runs with no Born limits, those just generating input files.

25/11/18 asdeck27.116
Test evaluation of DQNL for plasma pots.

29/10/18 asdeck27.115
Plasma potential loop did not re-initialize continuum energies to Ryd (they are converted to a.u. in SR.SRADCON,
not SR.RADCN0 unfortunately). But, the orbitals were not being updated anyway until this version dated 22/10/18!

29/10/18 asdeck27.115
Fixes to SR.SLATRI for 2-body Debye-Huckel (missed lambda=-1 1-body correction at  interp. energies)
and DENE=0.0.

24/10/18 asdeck27.115
Extended 2-body Debye-Huckel to use by non-relativistic wavefunctions. Previously required
kappa-averaged to access the retarded (Moller) integrals which are re-purposed for this.

22/10/18 asdeck27.115
BASIS='SRLX' orbital re-mapping could overwrite initial orbital set-up before remapping was complete,
i.e. a later re-mapping of an orbital was picking-up an earlier re-mapping instead of original initial.
Only happens for "small" cases: no. bound orbitals times number of groups less than the number of original 
orbitals (bound+cont), only really possible if 2 groups, and then only if LCON.gt.no. bound orbitals.

22/10/18 asdeck27.115
Continuum orbitals not reflagged as such during plasma potential loop over multiple T_e/N_e pairs., i.e.
they were not updated.

19/10/18 asdeck27.114
Relativistic M1 radial integral was not calculated at energy NREL. (case CUP='ICR', IREL=2).
Also, it was uninitialized as well, which crashed code if ALLOCATE populated it with a NaN.

11/10/18 asdeck27.113
Did not stop if external (radwin) orbitals flagged, but no radwin file present.

08/10/18 asdeck27.113
Tweaks to plasma potential operation.

28/09/18 asdeck27.113
Tweaks to Debye-Huckel operation.

22/09/18 asdeck27.112
Fix for floating point exception for kappa-average continuum in plasma potential - potential
is interpolated out much further - to end of mesh, and went one point further which gave
x=0 and failure of PMVDAR.

22/09/18 adaspi 1.20
Revert to global TOLB by default (see 22/09/17 adaspi 1.19 for local TOLB based on TERMS/LEVELS)
since local TOLB requires user to have generated TERMS/LEVELS that matches PI run closely,
i.e. needs MRED=-1 for TF TERMS/LEVELS to match PI if unique orbital used. Use of STOs or SRLX
should match "automatically". Now, assuming a close match in energies, can use local TOLB
by setting TOLB=0.0 in NAMELIST TWO. 

19/09/18 asdeck27.112
IXD24 dimension exceeded due to "incorrect" definition of memory required.
COMMON was MXBLM*MAXGR but this compensated between the two dimensions.
So, actual IXBLM*MXORB is not sufficient. Needs IXBLM*(MXORB-MB-LCON)*LCON.

12/09/18 asdeck27.112
If LUPMX or JUPMX specified to restrict maximum upper state radiative rates, in
combination with BORN='INF' or 'YES", then SR.DIAGON/DIAGFS stop with "ENERGY MISMATCH"
error message. Data was fine, but a checksum did not take account of the restriction.

29/08/18 asdeck27.111
Adapt READ/WRITE of CONFIG.DAT to handle groups of configs.

26/08/18 asdeck27.111
Proof of concept (v27.109) of defining groups of configurations which use common sets 
of orbitals within the groups now implemented in a robust user friendly manner, viz.
BASIS='SRLX' flags use of Simplified ReLaXed orbital bases.
MXCONF and MXCCF now define the number of groups of configurations.
Each group is defined by a group number and the number of configurations to be
read for this group, in the usual way. There is a slight adjustment of ICFG, which
is the same for all groups. If ICFG=1 (or 11) then the MIN & MAX orbital occupation
numbers are read for each group, before the configs (as usual) since it is unlikely
to want a global set applying to all groups. (If such is desired, then simply use the same
definition for each group since typically no more than 3 or 4 groups are likely.)
Rather, the groups themselves are likely to be defined by their different promotion rules.
ICFG=2 (or 22) is unchanged, a MIN/MAX are read before each config. This is unlikely to
be of interest here. 
Thereafter, scaling parameters (NLAM) and STO reference config nos (MCFMX) are interpreted
as in the BASIS='RLX', viz. again, they now define the number of groups of parameters
to be read with each group headed by the group number and, e.g., the number of scaling
parameters to be read for the group's orbitals, which then follow. Recall, this excludes 
the common closed-shell orbitals (1 thru KCOR2) which are common to all groups. 
Their parameters are set via group number zero. 
*** See 21/12/18 asdeck27.120 KCOR1=-1 to flag non-common core
Note: group numbers should be 1,2,3 etc. Their input order does not matter, 
but gaps are *not* allowed. The MXCCF group nos must span MXCONF+1,...,MXCONF+MXCCF.
Unlike the fully relaxed case, orbitals are orthogonalized within the group, unless
ORTHOG='NO'. Thus, groups of configurations can be optimized as a single strand-alone case
and the structure recovered when incorporated two or more groups.
There is no facility to estimate the effect of neglecting overlaps.
Typical uses would be 
1/ A structure problem with configs with K-shell holes and configs without.
2/ To define N-electron configs and (N+1)-electron configs. 
3/A combination of 1/ & 2/ (i.e. 3 groups) for calculating Auger and radiative rates at 
the same time, as for DR, using 2 groups, for the doubly and singly excited (N+1)-electron
configs for radiative data, plus another for the N-electron Auger final-states.

25/08/18 asdeck27.110
Fix for gfortran with array bounds checking abort.

17/08/18 adasdr 2.29
A vector write to adf09 was not initialized to length zero when it was meant to be zero.
Compilers assigning arbitrary large numbers, rather than initializing to zero, 
"crashed" the run since the format statement is (correctly) limited to handle a "small" length.

17/08/18 adasexj 3.17
Did not correctly copy header of CADW adf04_om to adf04_ups.

16/08/18 asdeck27.110
Large DW runs need INTEGER(SP) for pointers QPTLS & QPTLSJ, not INTEGER(QP).

10/08/18 asdeck27.109
Allow user to define two or more groups of repeated orbitals for use with
associated groups of configurations (e.g. optimized for two different ionization stages).
The simple presence of a repeated orbitals, 1 0 2 0 2 1  1 0 2 0 2 1 say, is enough
to flag such operation. Although it makes some use of the fully relaxed coding 
(e.g. to treat different orbitals as equivalent) there is no BASIS flag and configurations
are defined by the user using the appropriate orbitals and likewise the scaling parameters.
So, using the above orbital definition, one can have two configs

2 2 1 0 0 0
0 0 0 1 2 2

where the 1s of orbital 1 can be quite different from that of orbital 4,
i.e. one represents a K-shell hole while the other is full.
All overlaps between different groups are neglected, but orthogonalization
is applied within a group. e.g. in the above, the 2s  of orbital 2 can be
orthogonalized to the 1s of orbital 1; and the 2s of orbital 5 to the 1s or
orbital 4, but orbital 5 will not be orthogonalized to orbital 1.
As with fully-relaxed orbitals, this "poor man's" approach to relaxed
orbitals will define a common Rydberg and continuum orbital set, as
necessary for DR etc. The user may choose to define separate sets...

09/08/18 asdeck27.108
Allow zero to be an "allowed" density for plasma potential.
(So, don't have to make a separate zero-density run when a "single"
run is used to generate multiple density solutions.)

07/08/18 asdeck27.108
Tweaks for 1-body DH: added plasma pot to perturb MVD. 
Corrected plasma pot usage for continuum.

03/08/18 asdeck27.107
1-body DH plasma pot was not updated when TF pot changed,
(Historically, only long range term was included, ind. of TF.)
Now use plasma pot in MVD+Darwin for 1-body plasma pot, not just 2-body.

27/07/18 asdeck27.106
Relaxed orbitals array out of bounds  in carate/diagon/diagfs as ITMP not
allocated to correct usage. (Historic COMMON was correct/safe.)

24/07/18 asdeck27.106
Fix for LOGICAL*1 (parallel) and INTEGER*2 (interface with post-procs).

13/07/18 asdeck27.105
Added "low level" switch BFOT to NAMELIST SALGEB to enable user to switch-on direct PI
when RUN='PE'. Since 'PE' only differs from 'DR' by default choice of Thomas-Fermi potential
(N+1-electron vs N-electron, for non-Rydberg/continuum orbitals) and 'DR' from 'RR' by
the latter switching-on direct PI; the same effect (minor radial mesh diffs aside) is
achieved by setting RUN='RR' and, in &SMINIM, MRED=-1. RUN='PE' plus BFOT=.T. is less opaque.
Could add another RUN flag and use it to turn on BFOT instead...

12/07/18 asdeck27.105
An ALLOCATE statement can "initialize" an (element of an) array with a "NaN".
If not initialized by user, as not required, but accessed anyway in a general loop,
then a floating point exception occurs. There was a tendency for one-body radial integrals
to be treated such. Re-scaling during DR did not apply all the selections that applied
to the original population of the array. Now, 1/ try to ensure whole array initialized
(without doing it twice...) 2/ apply similar selection to re-scaling.

11/07/18 asdeck27.105 (Development)
Added I*2 to reallocate module procedure.
Fixed some QP.ne.SP had issues, in particular, FUNCTION VCC was sometimes called with 
integer Q arguments but the subprogram uses INTEGER(SP). Now argument call is INT(Q,SP).

11/07/18 asdeck27.104 (Development)
IMPLICIT INTEGER (Q) now has its own precision variable (QP) instead of being the
same (SP) as IMPLICIT INTEGER (I-N). Historically, SS on an IBM used INTEGER*2 (Q).
Now, keep QP=4 even when SP=8. This is for Slater state arrays.
IMPLICIT LOGICAL (B) now has a precision variable (BP) to enable to use LOGICAL*1
(for large logical arrays) instead of a system default of *4.

10/07/18 asdeck27.103 (Development)
Finish explicit LOGICAL -> IMPLICIT LOGICAL.
Finish adding of IMPLICIT INTEGER (Q) to all subprograms where it was part of IMPLICIT REAL(O-Z).

10/07/18 asdeck27.102 (Development)
Continue explicit LOGICAL -> IMPLICIT LOGICAL.
Continue adding of IMPLICIT INTEGER (Q) to all subprograms .

10/07/18 asdeck27.101 (Development)
Start conversion of explicit LOGICAL -> IMPLICIT LOGICAL.
Start adding of IMPLICIT INTEGER (Q) to all subprograms where it was part
of IMPLICIT REAL(O-Z) still (for future proofing).
This has been a low level activity, converting subroutines as I happened
to be working on them. Now the goal is to raise the activity to complete the conversion.

10/07/18 asdeck27.101 (Development)
Eliminate ANSI warnings for e.g. MAX(I,2) when I is *8 by making both the same precision,
by applying INT to one or other, depending on desired outcome.

10/07/18 asdeck27.100
SR.DIAGON v27.31 wrote IC unformatted rate flag to olsu causing adasdr to stop
due to coupling "conflict".

05/07/18 asdeck27.100
Previous change (27.96) for MXCCF.LT.0 failed for ICFG.EQ.0 - user would not normally
set MXCCF.LT.0 then, but the script does for target datasets subsequently 
scripted for DR etc.

05/07/18 asdeck27.100
Added modified spherical Bessel function derivatives .

04/07/18 asdeck27.99
sr.reallocate did not work when SP=EP since compiler could not resolve reference
to SP and EP. Now use 4 and 8 for resolution reference.

04/07/18 asdeck27.98
Use MDEN=11 to flag 2-body Debye-Huckel.
Added use of scaled one-body to MVD etc. instead of historic unscaled.

29/06/18 asdeck27.97 (Development).
Added use of modified spherical Bessel functions of 1st, 2nd, 3rd kind for
2-body Debye-Huckel, flagged by IBREIT=-1, i.e. needs kappa-averaged orbitals
since Slater integrals uses same IBREIT.gt.0 code to evaluate "retarded" integrals.

19/06/18 asdeck27.96
MXCCF.LT.0 (for ICFG.GT.0)  operation did not work (had gotten switched-off).

15/06/18 asdeck27.95
Restart did not work between 27.86 and 27.94 unless ALGEB4 was called, due to an
inconsistency between the WRITE/READ of dummy data to RESTART.

15/06/18 asdeck27.94 (Development)
Added more use of RE-ALLOC.

11/06/18 asdeck27.93 (Development)
MXEL0 determined internally now (dim =-1 in PARAM).

11/06/18 asdeck27.92 (Development)
COMMON /DBD2/ replaced by module.

08/06/18 asdeck27.91 (Development)
use of RE-ALLOC for NEL.

07/06/18 asdeck27.90 (Development)
Internal re-organization: LOGICAL to LOGICAL (B)

06/06/18 asdeck27.89 (Development)
Internal re-organization: LOGICAL to LOGICAL (B)

06/06/18 asdeck27.88 (Development)
Remove DC & IDC from DISKDC arguments, passed via their module.
Internal re-organization: LOGICAL to LOGICAL (B)

05/06/18 asdeck27.87 (Development)
DC & IDC arrays now set in a module (COMMON_DC, although they were never in COMMON)
and so remove from argument calls. Necessary to enable re-allocating them.
Internal re-organization: LOGICAL to LOGICAL (B)

04/06/18 asdeck27.86 (Development)
RE_ALLOC for MXRSS, MAXMI, MAXRK, MAXRL & SS versions MXRKS etc

30/05/18 asdeck27.85 (Development)
RE_ALLOC development/extension of capability.

29/05/18 asdeck27.84 (Development)
RE_ALLOC for MXS2I, MXS2C, MXRSS, MAXMI

23/05/18 asdeck27.83 (Development)
RE_ALLOC for MXS2I, MXS2C, MXSOI, MXRSS, MAXMI

23/05/18 asdeck27.82 (Development)
RE_ALLOC for MXS1I, MXSOI

22/05/18 asdeck27.81 (Development)
Added MODULE REALLOCATE which is a generic interface PROCEDURE for RE_ALLOC and 
RE_ALLOC2. This simplifies "re-allocation" of arrays. May use F2003 MV_ALLOC, or
not, depending on compiler capability. MV_ALLOC was a late addition to the F2003
standard and some older "f90" compilers to not have it.
Use to reallocate MXS1C, MXSOC, MXSTX initially. More to come...

21/05/18 asdeck27.80 (Development)
Re-organize box function routines to eliminate deprecated Fortran.
Turn a number of one line statement functions into true functions, but contained
within the subroutine still though.

17/05/18 asdeck27.79 (Development)
Removed non-ANSI usage. Added Subroutine names to END statements.

17/05/18 asdeck27.78 (Development)
Removed non-ANSI usage. Added Subroutine names to END statements.

17/05/18 asdeck27.77 (Development)
Removed non-ANSI usage. Added Subroutine names to END statements.
Try and make MPI precision independent of system/user via use of 
integer(kind(mpi_integer))

15/05/18 asdeck27.76 (Development)
Adjust code to make it easy to convert to free-format source (.f95) with
a couple of script/edit commands

10/05/18 asdeck27.75 (Development)
Remove use of EQUIVALENCE statements. Other changes for .f95 compatibility.

09/05/18 asdeck27.74
Added No. of terms NTT explicitly to /QTG/, although given by NTG(KMAX).

02/05/18 asdeck27.74
SR.DIAGFS: a recent allocate used NTT=NTG(KMAX) total number terms, but NTG
not read from RESTART when MSTART=5. It should be (TBD) as now ITANAL and the 
write of the TERMS file also use it, but "unlikely" to use RESTART for these.

01/05/18 asdeck27.73
ISHFTLS/IC=-1 did not adjust continuum energy of autoionizing electron.

20/04/18 asdeck27.72 (Development)
Initial attempt to reallocate MXSOC & MXSTSX arrays using call move_alloc.

19/04/18 asdeck27.71 (Development)
Make some local DIMENSIONed arrays ALLOCATABLE.

18/04/18 asdeck27.70 (Development)
No. configs appeared in two different COMMON blocks (/TERMS/ & and /NRBAL1/)
removed from both - had already added to MODULE COMMON_MQVC (under a different label).

18/04/18 asdeck27.69 (Development)
Make /NRBAL1/ consistent through-out, variable namewise.

17/04/18 asdeck27.68 (Development)
Minor internal re-org.

17/04/18 asdeck27.67 (Development)
Internal re-org (/NRBAL1/)

17/04/18 asdeck27.66 (Development)
Internal re-org - re-label No. of configs in /TERMS/ & /NRBAL1/,  and add to
module COMMON_MQVC under "final" name. 
Will remove from /TERMS/ & /NRBAL1/ in v27.70.

16/04/18 asdeck27.65 (Development)
Internal re-org of some COMMON.

16/04/18 asdeck27.64 (Development)
Re-org /GENINF/ use of DAJOLD, DAJNEW & DADJUS.

13/04/18 asdeck27.63
Adjust radial mesh (extent) for presence of plasma potential - need max
possible when multiple densities in use.

12/04/18 asdeck27.62 (Development)
Internal re-org - STO potential/SCCA.

12/04/18 asdeck27.61 (Development)
Internal re-org /GENINF/

12/04/18 asdeck27.60 (Development)
Internal re-org - /JSPOR/, SR.VPNL, SR.STOPOT.

11/04/18 asdeck27.59 (Development)
Rationalise mesh variable nomenclature SR.RADCON, SR.RADWIN.
COMMON /CRAD/ now the same through-out code.

10/04/18 asdeck27.58 (Development)
Rationalise mesh variable nomenclature SR.MESH, SR.RADIAL.

09/04/18 asdeck27.57
SR.DIAGFS call to DDOT could reference array out of bounds when multiplying zero length vectors.

01/04/18 asdeck27.57
*****Bug introduced in v27.50 due to missed logical initialization in SR.CONFG1 now fixed.
*****Bug introduced in v27.28 due to missed initialization of orbit-orbit flag fixed.
This affected Portland compiler at certain optimization levels.
Not a problem for compilers which default to FALSE and zero for uninitialized variables e.g. Oracle.

30/03/18 asdeck27.57 (Development)
Determine total number of terms (MAXTM) and Slater states (MXST0) internally, through
"dimension check" operation of SR.VCU. However, this does not give the actual
buffer space needed for full VCG/VCU operation, only an "estimate". Have coded
something based on this. May need tweaking. MXSTX0 is then the initial allocation,
to be set in param module.

29/03/18 asdeck27.56 (Development)
MXSTX is dynamically increased as necessary using fortran 2003 MOVE_ALLOC (commented-out 
for now and "manually" copy/allocate used.) MXSTX is then the initial allocation,
to be set in param module.

26/03/18 asdeck27.55 (Development)
MXEST now set internally (=-1 in PARAM_f95/param) but need "sensible" MXST0
set initially (so moved to module param and checked in case). 

26/03/18 asdeck27.54 (Development)
Determine maximal Born usage for MXIBF to be internal (=-1 in PARAM_f95/param).

22/03/18 asdeck27.53 (Development)
Fixed array out of bounds for Born/M1 (introduced in v25.35 which added missing M1 contrib to PI).
Make COMMON /CRAD/ consistent through-out.
Rework SR.POTIN, particularly potential interpolation.

21/03/18 asdeck27.52 (Development)
MXBLM now determined purely internally (=-1 in PARAM_f95/param).

20/03/18 asdeck27.51 (Development)
Dump ALGEB3 target data for DW.
Convert various DIMENSION statements to local ALLOCATEs.

19/03/18 asdeck27.50 (Development)
**** This version deleted initialization of a logical variable to FALSE in SR.CONFG1.
Portland compiler could "initialise" to TRUE, which flags a run failure but SR.ALGEB0
failed to catch the fail flag and calculation proceeded until array allocation/use failure.
**** This was not fixed until v27.57

19/03/18 asdeck27.50 (Development)
SR.ALGEB0: Rework historic MCFSS input to be compatible with use allocated arrays, 
as opposed to hardwired MAXCF.
SR.MINIM0: Allocate buffer space when reading a configuration to define model potential.

16/03/18 asdeck27.49 (Development)
Replace COMMON /NRBGCF/ & /NRBSLP/ by module. And ALLOCATE them.

15/03/18 asdeck27.48 (Development)
Relabel existing SR.CONFG0 as SR.CONFG and spin-off part of SR.ALGEG0, which
adds continuum/Rydberg orbital to n-electron confgs to form N+1, into new SR.CONFG0.

09/03/18 asdeck27.47 (Development)
Make some temporary arrays allocatable in SR.CARATE/DIAGFS/DIAGON.
Remove explicit dependence on MAXGR in SR.CONFG1.
Make local array in SR.VA04A allocatable - without inflating!

08/03/18 asdeck27.46 (Development)
Set-up input buffer array NEL0(MAXGR,MAXCF) to input and expand configs.
Then ALLOCATE actual needed NEL, & DEALLOCATE buffer.
MAXGR & MAXCF no longer needed in PARAM_f95 (but set as large as ever needed in 
module param for remaining vectors - allocate as well eventually.)

08/03/18 asdeck27.45 (Development)
Replace COMMON /MQVC/ by module. And ALLOCATE it.

07/03/18 asdeck27.44 (Development)
Make COMMON /MQVC/ consistent through-out.
Add DPNL, DQNL to DW I/O dump file.

06/03/18 asdeck27.43 (Development)
Make COMMON /MQVC/ consistent through-out.

06/03/18 asdeck27.42 (Development)
Replace COMMON /CACC/ by module and ALLOCATE.
Replace COMMON /REL/ by module and ALLOCATE.

05/03/18 asdeck27.41 (Development)
Replace COMMON /TRANS/ by module. And ALLOCATE it.
Reduce nl-loop contents within SR.MINIM to that which depends on nl.

05/03/18 asdeck27.40 (Development)
Call SR.MESH in SR.MINIM so can ALLOCATE radial arrays ex /RADF/ & /NRBDQE/.
MAXB1 can then be removed from PARAM_f95 and set as large as ever needed in
module param for remaining vectors - allocate as well eventually.

26/02/18 asdeck27.39 (Development)
Replace COMMON /RADF/ by module..
Replace COMMON /NRBDQE/ by module..

23/02/18 asdeck27.38 (Development)
Make COMMON /RADF/ consistent through-out.

23/02/18 asdeck27.37 (Development)
MXENG -> MENG in ALLOCATEs where possible.
Re-organise DEALLOCATEs in SR. MINIM.

22/02/18 asdeck27.36 (Development)
CALL RADCN0 in SR.MINIM to set up continuum energy mesh, so have MENG for ALLOCATE.
Call again in SR.RADCON, but just to finalize set-up. This means that use of external
radial orbitals in collusion with continuum orbitals can only be done with NAMELIST input
option due to ordering of READ statements - need to REWIND to access READs in SR.RADWIN.

16/02/18 asdeck27.35 (Development)
If NMETAP/J.gt.0 set then do not bundle radiative data below such when NMETAR/J.gt.0 set.
(NMETAR/J then bundles continuum  parents but does not restrict radiative data as it would
for downward transition problems e.g.DR.)

16/02/18 adaspe 1.20
Was v.slow for large cases for NTAR=0 when Augers present.

14/02/18 adaspe 1.20
PABS='YES' now generates an XPETOT file when no Augers are present.
Only radiative broadening then of course.

02/02/18 asdeck27.35 (Development)
Fixed array-out of bounds in test DW code (interpolate then mix).
Replaced use of dimension MXENG by local ALLOCATE MENG in sr.dwxls & dwxbp..

01/02/18 asdeck27.34 (Development)
Explicitly zeroize DOSC after ALLOCATE since printing can give random values for unused pairs.
Bufix for default internal PI energy mesh, used fine instead of coarse (from v27.28 onwards).

30/01/18 asdeck27.34 (Development)
Replaced use of MAXGR dimension by actual MXORB, wherever possible.

26/01/18 asdeck27.33 (Development)
Bug-fix for Intel v18.0.0 compiler "duplicate" EQUIVALENCE within a COMMON block (was benign).
"Re-label"IORIG/JORIG between DIAGON/DIAGFS so COMMON/TRANLS/ label does not switch.

25/01/18 asdeck27.32 (Development)
DIAGFS: re-label  TFU->TFUJ so TFWE->TFU and NADRU->NADRUJ so NADWE->NADRU.

25/01/18 asdeck27.31 (Development)
Now count actual B-C subset of total no of integrals.

12/01/18 asdeck27.31 (Development)
Moved bound-cont 2-body Slater and f-s integral dimensions (MXFSL & MXFSS) to param module.
Only allocated for bound-cont (+/- 2fs) (DR, but also RR/PI as any poss. calculated).
Then set to ALGEB2/3 actual determination, for B-B + B-C since B-C likely dominates.
If user sets MXFSL or MXFSS .gt. 1 in the param module then this value is used instead.
TBD, count actual B-C subset of total no of integrals.

12/01/18 asdeck27.30 (Development)
Changed PI COMMON /NRBTS1/ to module. Only allocate if PI/RR.
NFOSS with BREL could go out-of-bounds by 1 multipole.

12/01/18 asdeck27.29 (Development)
Split COMMON /TRANS/ (Slater integrals and  H(LS) indexing) into
module (COMMON_INTS) for Slater integrals and renamed  COMMON /TRANLS/
for H(LS) indexing - NADRU,NAI,NC0,JORIG.
Now allocate integral array to actual size, as give by ALGEB2.
(DOSC can give random print values for unused - see v27.34 fix.)
Fixed bug in SR.FSINT introduced in v27.28 due to non-initialization of b-c integral flag for b-b only.
Portland attempts to access non-allocated array (NLI), with cryptic "array out of bounds" message.

11/01/18 asdeck27.28 (Development)
Changed bound-cont Slater integrals COMMON /NRBINT/ to module.
Only need allocate if DR/RR/PI.
Changed bound-cont 2-body fs integrals COMMON /NRBFSI/ to module.
Only need allocate if DR/RR with KUTSS.
Changed 1- & 2-body fine-structure integrals COMMON /EX/ to module (renamed COMMON_RELINT).
Only need allocate if required (IC for 1-fs, KUTSS for 2-fs) and to their actual size,
as given by ALGEB3.
(***Bug introduced here: default internal PI energy mesh for RR is fine, not coarse. Fixed in 27.34.)
(***KUTOO=1 bug introduced, failure to initialize orbit-orbit integral flag when *no* bound-continuum
can cause attempt to access non-allocated b-c o-o arrays if compiler does not initialize to zero e.g. Portland.
Portland flags this as "array out of bounds" rather than more helpful "attempt to access non-allocated array"
which is what Oracle would do if it did not default initialize to zero. ***Not fixed until 27.57.)

11/01/18 asdeck27.27
TCCs:
Made TCC arrays allocatable so removes need to set dimension MAXTR.
(Moved to module param.)
Fixed bug in historic JAJOM output

10/01/18 asdeck27.26
Changed COMMON /NRBCAS/ to module, so only allocate if KUTCA.GE.0.
Removes need for dimensions MAXCA, and MXNOR (perhaps in extreme).
(Moved them to module param.)

10/01/18 asdeck27.25
Fixed longstanding bugs in SR.CASC, and related index mis-match in DIAGFS 
introduced in v25.33 by skipping "print" of weak radiative rates after
incrementing NTRAN..

05/01/18 asdeck27.24
Moved many dimension PARAMETER statements from PARAM_f95 to MODULE PARAM.
Those remaining in PARAM_f95 must be set by the user still.
Just possible that one dimension moved to module might need tweaking,
if so, let me know, and will change the default. 
It is still possible to use a fully-defined PARAM_f95 (or even old style PARAM)
but the user must comment-out the existing MODULE PARAM and all its PARAMETER
statements and uncomment the simple one which just includes PARAM_f95 or PARAM.

05/01/18 asdeck27.23
Misc. replacement of subprogram PARAMETER statements defining constants,
which are available in the CONSTANTS module. Still many to go...

05/01/18 asdeck27.22
Changed COMMON /NRBNF2/ to module, so only allocate if KUTOO=1.

05/01/18 asdeck27.21
Changed COMMON /NRBNFI/ to module, so only allocate if KUTOO=1.

05/01/18 asdeck27.20
Removed scratch memory from COMMON /NRBNF2/

04/01/18 asdeck27.18/.19
If KUTOO=1 (orbit-orbit etc switched-on) during RUN='DR' with CUP='LSR' or 'ICR',
then a floating point exception was possible due to a mesh mis-match.

21/12/17 asdeck27.19
With so many dimensions now internally allocated, it is not particularly clear what
dimensions are actually used for any given run. A solution is attempted through the
use of a DIMUSE subroutine which updates the max used dimension. The output is then a
replica of the initial dimension dimension listing. It should be obvious that the
dimensions "used" is just a guide. A particular use may miss a size check, particularly
if it involves buffering. The dimension tests themselves are (meant to be) rigorous.
But compiling based on very small dimension usage may run into problems not anticipated
by the original programmer.

20/12/17 asdeck27.18
MXSOC is the most painful dimension test to fail. So, now, code increases MXSOC by a
factor 1.5 each time it is exceeded. This could be done elegantly with the Fortran 2008
intrinsic MOVE_ALLOC. But, for backwards compatibility with older compilers, it's just
implemented (for now) using standard ALLOCATION and copying.

18/12/17 asdeck27.17
Obscure bugfix.

11/12/17 asdeck27.17
All unformatted integer writes now use INT(). Thus, if SP=8 (short word length INTEGER*8)
is set in MODULE PRECSN, there is no longer any need to compile adasdr etc to use
INTEGER*8 as the default integer length. (INT() converts to the compiler default integer.)

11/10/17 adasdr 2.29
Enable use of E1X(1) - first observed energy, normally zero, analogous to
use of E1C(1) - first calculated energy. Previously, any E1C(1) was subtracted
from the continuum energies of both Ryd and non-Ryd runs. Historic usage was
to lower continuum in dn=0 Ryd AS run (via ECORIC.lt.0) and subtract it again,
from continuum electron energies, in  adasdr (via E1C(1)=-ECORIC) in conjunction
with use of observed energies - this accesses resonances that are bound by
theory but autoionizing when observed energies used, which adasdr shifts alone
cannot "create", only discard if theory autoionizing are actually bound. 
It was implicit that there was no equivalent electron run (as no resonances)
or their shift did not matter, or was compensated for by ECORIC(equiv)=ECORIC(Ryd),
or were processed separately. 
(N.B. same applies to ECORLS and ECORCA.)

We assume we want to process equiv and Ryd together for a single adf09.
And we want to shift the equiv run resonances differently from any Ryd resonance shift.
We now apply E1X(1) to the Rydberg data only: the previous (Ryd) E1C(1) is then replaced
by E1C(1)-E1X(1). Judicious choice of E1C(1), E1X(1) and ECOR(equiv) and ECOR(Ryd)
should enable most desired outcomes - just give it a try is probably easiest.
But, we list a few.

1/No use of ECOR(equiv) & No use of ECOR(Ryd). 
Shift (lower) equiv resonances in adasdr by E1C(1) (.gt.0). 
Ryd resonances unchanged if E1X(1)=E1C(1).
Shift (lower) Ryd resonances by dE (.gt.0) via E1X(1)=E1C(1)-dE.

2/Use of ECOR(equiv) & No use of ECOR(Ryd).
E1C(1)=0 for no further shift of equiv. (Only use is adasdr sensitivity test.)
E1X(1) as for case 1/.

3/No use of ECOR(equiv) & Use of ECOR(Ryd).
For no change to equiv, must set ECOR(equiv)=-E1C(1).
We assume E1X(1)=0.
Normally, E1C(1)=-ECOR(Ryd) if observed energies used.
E1C(1)=0 leaves the ECOR(Ryd) shift applied.

4/Use of ECOR(equiv) & Use of ECOR(Ryd).
E1C(1) as for case 2.
E1X(1) as for case 1. e.g. dE=-ECOR(Ryd) to remove ECOR(Ryd) again, for observed.


28/09/17 adaspi 1.19
Fix for AS bundling PI over continuum (via NMETAP/J) - the max T/LV value can
be larger than NENG since not all continuum energies are printed to o-files.
Mapping of T/LV was not being re-initialized to zero, so cross sections dropped
to some electron targets. Also possibility of array out of bounds.

27/09/17 adasdr 2.29
Default JCFA was too small for large CA calculations involving core re-arrangement.

22/09/17 adaspi 1.19
Use variable TOLB, dependent on local TERMS/LEVELS splitting rather than a global one
based-on the minimum target splitting. If large numbers of electron targets then the
global value can be very small.
Note: if AS itself bundles two adjacent levels with the default fixed global TOLB
then nothing in adaspi can unpick it. User should set TOLB manually for AS run.
Ultimately, this is all cosmetic. Should be binning both electron targets and
photon targets for large cases.
Also problematic if the AS PI run target energies start to differ from those in LEVELS
by an amount comparable with a level splitting.
***This was default operation here, but see 22/09/18 adaspi 1.20 where it is made non-default.

22/09/17 asdeck27.16
Bug-fix for TOLB confusing a.u. and Ryd.
Also write AS determined continuum energy index to o-files (in addition to op-files).
Not currently read by post-processors - accessed for debug etc only.

18/09/17 asdeck27.16
Fix for default auto-generated n-mesh if user sets NMAX.gt.60.

15/09/17 asdeck27.16
NMETAP/J operation slow when set very large, e.g. hundreds of thousands, due
to unnecessary loops which ultimately give nothing (energetically forbidden).
Was set-up initially expecting the resolved photon target states to be small 
in number - ground plus metastables - then rest bundled. But cannot bundle for
opacity work - need everything resolved still for subsequent Rosseland Means,
unless set-up energy bins (TBD?).

15/09/17 asdeck27.15
RESTART used a record length .gt.2GB when standard integer length was *8.
Not a problem for Oracle, but PGI compiler segments.

13/09/17 asdeck27.15
Catch an INTEGER*4 overflow in ALGEB3.

11/09/17 asdeck27.15
Catch (don't write) fully-resolved PI cross sections which are zero at all energies.
Bundled was tested o.k. but because high multipole PI underflows at low energies,
the usual test on resolved radiative data is suppressed. "Normally", selection
rules catch this. Indeed, does so if based on angular momentum. But not if
configurations differ by too many electron pairs - no mixing either then.

05/09/17 asdeck27.15
F77 dimension test on NMETAP/J was not flagged as F77 so incorrectly applied
(as F95 allocates correctly). Also, if user set them greater than actual total
number of terms/levels then array out-of-bounds. Now reduced accordingly.

31/08/17 asdeck27.14
Oracle compiler does not like (-1)**M8 when M8 is INTEGER*8 (-1_8 does not help).
Affected M_k beyond analytic dipole and BPDW (EIE) - all results catastrophic.
Replaced throughout the code by 1-2*mod(iabs(M8),2).

30/08/17 asdeck27.13
Bugfix for Portland/gfortran compilers - Oracle o.k. Likely small energy correction
to target orbital potentials (mass-velocity, via DQNL) when Rydberg approximated by
a continuum. Normal kappa average usage unaffected.

30/08/17 assdeck27.3-13
Internal re-organization:
INTEGER/REAL precision specified in MODULE PRECSN, SP(=4) & EP(=8) for standard and
extended INTEGER; WP (=8) for standard REAL - no extended (QP=16) in current use.
Entire code can be converted to use INTEGER*8 by setting SP=8.
Associated changes:
All standard INTEGER and REAL constants now specified in MODULE CONSTANTS.
Bespoke ones still listed in individual routines, along with non-standard
names for standard constants (to be replaced, eventually).
Dimensions are set in MODULE PARAM which INCLUDEs PARAM_f95, which uses 
MODULE PRECSN, so integers .gt. 2B automatically dealt with, provided user has set SP=8.
So, copy various dimension files PARAM.N_f95, PARAM.X_f95 to PARAM_f95 for
actual use, as before, but PARAM.N_f95 etc should USE PRECSN etc - see web example.
***All post-processors still need to be compiled to force use of INTEGER*8
***E.G. Oracle -xtypemap=integer:64

18/08/17 asdeck27.3
Minor fixes.

08/08/17 adasdr 2.29
Change of
07/03/17 asdeck26.17 adasdr 2.25
could cause unresolved (excited) continuum to be taken as resolved initial
because last target bin energy is arbitrarily taken to be 20% above "last" target
energy, since it assumes no more on file. But, some unresolved are on file.
Previously these targets were "counted" but since not all present, if user
tried to use observed energies, then got nonsense - hence "fix" of 07/03/17.
Now, the "next" continuum is taken from adasin TERMS/LEVELS energies to
avoid all problems, hopefully.
So, any bundled/hybrid data calculated by asdeck26.17, or later, needs to be
reprocessed by adasdr 2.29. (If adasdr earlier than 2.25 was used, o.k. if no observed.)

13/07/17 pasdeck27.3 adasdr 2.28
If nprocperl.gt.1 then AS writes a monotonic increasing n-mesh.dat file for adasdr since
n-values are no longer read thus, and so adasdr needs such a mesh for all n.lt.NV.

05/07/ adaspe 1.19
Possible BIN index out of range.

29/06/17 asdeck27.2
Removed all F77 flagged code.
Removed all F95 flags.

29/06/17 asdeck27.1
Incorporate both loop ordering versions of dwxls/bp.
Default, XMIX=1.d-4 uses DAXPY ordering (and "exact" mixing followed by interpolation).
Setting XMIX.lt.0   uses DDOT  ordering (and "approx" interpolation followed by mixing).
dwxls/bp.f themselves are now wrappers. Can easily change which version is used.
If one ultimately wins out then can revert to single version, remove wrapper, and rename.

28/06/17 adasexj 3.16
Made dimension test operation INTEGER*8.

28/06/17 asdeck26.23
Tweak allocate for XMIX.lt.0.

27/06/17 asdeck 26.23
M_k PI array out of bounds (diagfs). This was introduced in v26.13.
No PI or default E1 PI unaffected. Fixed also in v26.19 which is the current web version.
v26.20 - v26.23 are unreleased development versions

26/06/17 asdeck26.23 
MAXSL was not checked before KGSL(MAXSL,..) was accessed (algeb2).
Likely only high multipole radiation for high energy RR.
Usual default of MAXSL=199 more than suffices normally.
Bug-fix also applied to final v24 & v25 (v23 and earlier unaffected).

23/06/17 asdeck26.23
If XMIX .lt. 0, interpolate, then mix K-matrix. The "mixed" part is then calculated at
the "wrong" energy (c.f. ICFT, which is for spin-orbit only). But, the mixing only
has to done for the number of scattered energies now, not all possible interpolation
pairs. (When DDOT is in use in dwxls/dwxbp, only the sign of XMIN matters.)
This leads to a speed-up ~energy-pairs/scattering energies when the energy loop is outside
the innermost  mixing loop (enabling use of DDOT). There is significantly relatively less 
speed up when the energy loop is the innermost. Likely this is due to the innermost
loop being vectorizable. Thus, the longer (mixing) loop should be innermost.
Note, this has nothing to do with BLAS DDOT vs DAXPY since similar timings are
obtained with native coding. The Jp groups are at most a few hundred, so likely
not large enough for BLAS to have a large impact. However, dipole transitions seem
to be overly sensitive to the K-matrix being calculated at the "wrong" energy.
Both versions have advantages and disadvantages: DDOT ordering is v. fast for XMIX.lt.0,
but this of debatable accuracy, while for XMIX.gt.0 there is no neglect of mixing and
use of DDOT itself is much slower than native code when NMETA=No. states/2, say.
DWAXPY ordering is not worth using for XMIX.lt.0 (maybe factor 3 speed-up, but same
accuracy issues) but for XMIX.gt.0 can speed-up a factor 2 (XMIX=0.01) and is robust
speedwise wrt NMETA. Should default to DDOT ordering if XMIX.lt.0 and DAXPY if XMIX.ge.0.
Including both versions with dwxls/bp becoming a wrapper is fine when ALLOCATE is used.
Technically, v26.x is meant to be F77 compatible still (the final one). So, should
delay this until v27.x

20/06/17 adaspi 1.18 adaspe 1.19
While photon targets in adf38/39l are labelled L=0,1...9,A,B... the electron targets
were still I1 - now A1.

20/06/17 asdeck26.23
Check for TFU index exceeding 2 billion - case large-scale photoionization, since
this requires storing the continuum e-vectors. Currently, must use compiler to
force I*8 64-bit integer. Will change in v27.

20/06/17 asdeck26.23
Allow user to set smallest mixing coefficient (XMIX in &SMINIM) retained in dwxls/dwxbp.
Default, 1.d-4, gives 3 s.f. accuracy on collision strengths. 1.d-2 can give
a factor 2 speed-up (dwxbp) - this additional error must be balanced against 
the uncertainty in the atomic structure anyway.
Note, because of loop ordering, does not apply to DDOT versions (even if non-lapack).

15/06/17 asdeck26.22
LAPACK dwxls/dwxbp use DAXPY - original loop ordering. Only 5% faster than native code.
However, this ordering can "skip" the multiplication loop if the mixing coeff. is
"small".  This makes the native coding faster than the DDOT ordered code, and
comparable with DDOT time. There are no non-unit increment issues. Tested to 3000 levels.
It remains to be seen which option/ordering wins out with larger cases, 5000 levels, say.

14/06/17 adaspi 1.18
Further I6 added (for adf39l) - see 22/05/17  BOLDF flag.

14/06/17 asdeck26.21
LS-DW segment/array-out-bounds due to access of uninitialized Jp selection.
Internal re-organization of integer exponentiation for some compilers...

07/06/17 asdeck26.20
Added LAPACK DDOT for RUN='DE" - applying mixing to K-matrix (dwxls,dwxbp) c.f. rates
(diagon, diagfs). When NMETAJ .lt. No. of Levels a DDOT uses non-unit increment.
This is very slow compared to native coding... If NMETAJ .eq. No. levels then only
DDOT with unit increment used. Overall, current tests (1400 levels) only 20% faster.
Likely the length of the mixing vector is not large enough yet. Rather, time is 
consumed by the number of channel loops. To use DDOT also needed to re-order loops and 
array indexes. This leads to a somewhat slower set-up, although for NMETAJ ~ No. Levels,
this is not significant overall. Will archive dwxls_ddot and dwxbp_ddot and revert
to original loop/array index ordering, but add DAXPY for LAPACK flag.

05/06/17 asdeck26.19
QED contribs for Ryd orbital approx by a cont were not "updated" - just used the last
explicit bound value. Now, upscaled from the last. These values are very small - ~/1n^3
compared to non-rel ~1/n^2.

02/06/17 asdeck26.19
KUTLS.lt.0 segmented when Ryd approx by cont since test for bound config checked orbital 
n-value (.lt.0 for cont orb) not orbital flag (bound is "bound" even when approx by cont)
Test array was DIMENSIONed MAXDK, but needed to be ALLOCATEd since MAXDK not normally
set explicitly - is only accessed when KUTLS.lt.0.

01/06/17 asdeck26.19
algeb3/diagfs: re-implemented single config mixing option (KUTLS), now for case 
of no 2-body fine-structure. (Recall, 08/01/17 asdeck26.16 for 2-fs.)
In SALGEB, set:
KUTLS.gt.0 multi-configuration mixing (default)
KUTLS.lt.0 single configuration mixing.
KUTLS.eq.0 is for testing (runs as .gt.0 but sets CF-CF' interactions to zero,
                           to reproduce .lt.0 results.)

22/05/17 adaspe 1.19 adaspi 1.18
Set BOLDF=.TRUE. in NAMELIST ONE to recover old I5/4 format in adfxx (see 17/05/17).

22/05/17 adaspi 1.18
Specifying IRSLMX significantly slowed down execution instead of significantly
speeding up (assuming "small").

19/05/17 adasdr 2.27
Missing SAVE statement in CONVOLG & CONVOLX meant Portland compiler gave nonsense
for these convolutions.

18/05/17 adaspe 1.19
(Radiative rate) memory requirement could get very large for large CI cases as 
whole NL block is read-in (fine for normal Rydberg-nl loops) e.g. only a single 
"equivalent" electron run with multiple promotions to "high-n". Now, if NTAR=0
(default) no Auger resolution, so really should have no Augers on file..., 
radiative rates are read and processed separately for each upper (autoionizing) level.
This introduces BACKSPACE(s) and some duplication of effort, but code is not slow normally.
This operation is controlled by the logical variable BOOP set at the top of SR.CROSSJ,
currently not user changeable. Note, whole Auger block is still read-in, if present, 
but likely this constrains the size of the problem, as opposed to a radiative only one.

17/05/17 adaspe 1.18 adaspi 1.18
adf38r and adf39px/tx now use I6 fields for level indexes, consistent with adf38l/39l.
The IRSL label has moved in sync and so can be used to check whether I5 or I6 fields 
are on file, necessary for backwards compatibility.
Note, the logical variable BOLDFxx set at the top of SR.CROSSJ can be set .T. to revert
to the old format, currently not user changeable (e.g. via NAMELIST).

17/05/17 adaspe 1.18 adaspi 1.18
/CA/ now gives correctly formatted/labelled output.

15/05/17 asdeck26.18
Apply the parity selector IPAR to configurations auto-generated by ICFG.gt.0.
Previously, only applied to symmetry selection via MIN/MAX/L/S/J.

25/04/17 adasdr 2.27
Ported time-of-flight cooler cut-off model from mdrcs13.

24/04/17 pasdeck26.18
olgnnn was incorrectly named for nnn.gt.099.

21/04/17 adasrr 2.9
Enable reading of AS parallel by nl files e.g. o(p)icumm.nn etc.

21/04/17 adasdr 2.26
Minor, autoionizing parent label was not written to adasout (IPRINT.gt.0) when NBIN.gt.0.
Note, this also requires NECOR.gt.0; but NECOR=1 (i.e. "zero" for ground state) suffices
and NTAR2 parents are determined/written. In general, max(NECOR,NTAR2) are written.

21/04/17 asdeck26.18
Ensure model potential (e.g. self-consistent plasma) flagged.

20/04/17 asdeck26.18
Tweaks to allow use of Rydberg approx by a zero energy continuum when plasma potential present;
case Debye and self-consistent only. Current default ion-S`sphere is neutralized beyond the
boundary and so cannot normalize a zero energy wavefunction there; and assume that plasma
potential inside the sphere is too large. So, force use of true bound only. This is not
a problem in practice since the densities for which the ion-sphere model is valid do not
support high-n bound states. Debye and self-consistent are only formally neutralized
at infinity and are normalized at a finite radius, where the plasma potential is weak.
This might be problematic for self-consistent in certain dense cases, but ibid ion-sphere,
except true-bound for all-n is not forced in this case so as to allow a smooth transition
to the low density (Debye) case. 

13/04/17 asdeck26.18
Changed ion-sphere "neutralization" condition from Z-N to Z-N+1 so as to work for neutrals.
Iteration of self-consistent plasmas potential had got switched-off (for many years...)
Improved reliability of determination of continuum normalization for plasma potential,
especially Debye - did not go out far enough. The last version that was correct was 19.8.

11/04/17 adasdr 2.25
Enhable reading of AS parallel by nl files e.g. oicumm.nn etc.

31/03/17 asdeck26.17
Case point nucleus, variable used in an array index uninitialized - segments if compiler
does not "set" to zero (not used then, as it's for finite nucleus but test "bypassed".).

30/03/17 asdeck26.17
If NDEN.LT.0 (no. of plasma N_e and T_e pairs) then read N_i, N_e, T_e; where N_i is ion density.

28/03/17 asdeck26.17
Minor fixes: for AUGER2 warning & flag ion-sphere/neutrals and for intel/pgi compilers.

08/03/17 adasdr 2.25
Minor fixes.

07/03/17 asdeck26.17 adasdr 2.25
Default bundled operation writes a few additional auger rates until true
ground continuum found. The associated continua are written to the energy list.
This gives rise to an incomplete set of unwanted continua above NMETAR/J.
However, if user sets NECOR.gt.NTAR1 then these unwanted ones would be picked-up
as the basis for energy corrections instead of using TERMS/LEVELS. (Internal
are safer in general.) This problem was introduced in 01/04/15 asdeck25.25 - see below.
Now, asdeck26 writes a flag (sets S=0) to the energy listing of such levels and adasdr
picks it up and does not use these continua. Could omit these continua
completely but then would have resolved Auger rates with no info on where they
autoionize to. (The Auger rates have already been written by the time this is realized.)
Likely not a problem since we know on energy grounds they are unwanted. But, for safety...

06/03/17 asdeck26.17
Additional safety checks for some compilers.

01/03/17 asdeck26.17
Fix abort STOP: diagon np2jj error; for case of kappa-averaged orbitals the
range of interpolation energies did not take account of mass-velocity+Darwin 
in  Ryd -> zero-energy continuum shift.

16/02/17 asdeck26.17
Added R-matrix continuum basis parametric potential for test comparison with
R-matrix stg1r when using Laguerre or box orbitals - see NPOT option.

08/02/17 asdeck26.16
Aside: Add test to catch user set non-standard nl-orbital ordering when using 
NXTRA,LXTRA for pseudo-state generation.

08/01/17 asdeck26.16
algeb3/diagfs: re-implemented single config mixing option (KUTLS)
*** ONLY *** if 2-body fine-structure switched-on (e.g. as a dummy).
It is a memory management problem for 1-body (TBD).

06/01/17 asdeck26.15
algeb2/diagon: re-implemented single config mixing option (KUTLS).

02/01/17 asdeck26.14
Tweak DDOT usage.

01/01/17 asdeck26.14
As 26.12-13, but for diagon.

31/12/16 asdeck26.13
As 26.12, but for photoionization and radiative rates.

30/12/16 asdeck26.12
diagfs (autoionization): interchange order of index of interaction matrices so 
interpolation energy is second index and interaction "matrix" (stored as a vector)
is first. Some looping over rows now, but big win is enabling use of BLAS DDOT to
carry-out multiplication by mixing vectors. Note DOT_PRODUCT intrinsic is much
slower than optimized BLAS DDOT... maybe due to need to use pointers then?

29/12/16 asdeck26.11
When no 2-body fine-structure then initial-state mixing of unmixed H(B-C) only
connects same SLp. Final state loop was searching over all initial SL(J)
to find match with the same final SL(J). Since equal SL are stored sequentially, 
we can point and loop over the required initial SL alone. This is one of the
two inner-most loops when calculating autoionization rates and so speeds-up
that part by up to a factor 2. The other is the final state mixing, which can
take up to a similar time to the original initial mixing. But, of course, the
initial state spin-orbit mixing means that the same rule does not apply to the
final state mixing - only to unmixed states.

28/12/16 asdeck26.10
Formation of H was slower than necessary, esp. LS.

27/12/16 asdeck26.9
Hard coded option to store autoionization interaction matrix (i.e. H(B-C)) by
e-vector order so as to match e-vector storage. In principle, they could be
multipled together by lapack DGEMM with this ordering. Actually a tad slower
since H(B-C) is formed and used by symmetry ordering. Note, in either case,
the transformed matrix is stored in e-vector order - see v26.5-26.8.
Since any (DGEMM) lapack use is long term development - would use alot of memory,
we only process (store in intermediate memory) one column at a time - stick
with original symmetry order here - hint, think DDOT!

25/12/16 asdeck26.8
Ditto IC. Get a modest speed-up now.

22/12/16 asdeck26.7
Re-organize (LS) autoionization rate calculation (storage) for slightly
faster operation. Currently, this necessitates disabling KUTLS. 
But re-implementation should
be faster for radiative rates, following 26.5 re-organisation.
This is the same trick as done in v26.5 for radiative rates.
However, little no/speed-up - probably because of the additional loop
of interpolation energy.

20/12/16 asdeck26.6
As 26.5 but for IC-diagfs.

16/12/16 asdeck26.5
Re-organize (LS-diagon) radiative rate calculation (storage) for faster operation
when large continuum expansion present. If no PI, want time to be similar to case
when LCON=0. Was not so, now is. The trick is to store the initial mixing
transformation of the interaction matrix in e-vector order so that the
final mixing transformation accesses sequential columns in both the mixing and
initial transformed vector storage.

15/12/16 adasdr 2.25
CA: If no. of configs .gt. 9999 then (equivalent electron) autoionizing configs
dropped if config. no. .gt.9999 as this was the default value of JCFJ.

15/12/16 adasdr 2.25
LS hybrid PP radiation bug-fix (minor - code stopped).

07/12/16 asdeck26.4
KUTLS to flag mixing within a configuration only.
Test an initial implementation (reversed later).
Speeds-up diagonalization and autoionization, but radiative loops not conducive...
Note also that a few large configs will dominate the problem.
So, for 100 configs do not get factor 10^4 speed-up, unless all equally sized.
Factor 5-10 seems more real world. Ho-hum.

28/11/16 asdeck26.3
Code CA interaction counter I*8. Finally removes ~46k limit on no. configs, for I*4 compile.

28/11/16 adasdr 2.25 adasrr 2.8
Need to keep a variable test I*4 (for backwards compatibility) when compiled for I*8,
which it must be when using unformatted output from AS compiled for I*8.

22/11/16 asdeck26.2
Ensure I*4 overflow tests are not accessed when code is compiled for I*8.

18/11/16 asdeck26.2
Separated autoionization matrix element set-up from energy Hamiltonian set-up in
SR.DIAGON and SR.DIAGFS. The two always used different storage locations, 
so only the looping was common. Makes it easier to modify coding of one independent
of the other.

17/11/16 asdeck26.2
64-bit integer operation through-out the code can be accessed via a suitable compiler.
Oracle Studio: -xtypemap=integer:64
gfortran:  -fdefault-integer-8
Only the MPI interface is explicitly set to integer*4 (note *case*) and so is unaffected
by the compiler mapping of INTEGER to *8, since these tend to be built for I*4 only. 
(If you have & want to use a 64-bit MPI library then you'll need to change this manually.)
Note, some code is explicitly INTEGER*8 for use under default I*4 operation.

08/11/16 asdeck26.1
Some under the bonnet re-organization (SR.ALGEB2/FLGL) for consistency (with SR.EKALG 
& SR.ALGEB3/4).

18/11/16 asdeck25.47
Parent selection logical was not initialized FALSE and so did not turn-off again
in config loop once it had been set TRUE.

17/11/16 asdeck25.47
MAXDC too small (and KUTDSK not used) did not stop... since v25.23

03/11/16 asdeck25.47 
Change of 08/09/16 did not work correctly for the (now) non-default sequential 
assignment for Rydberg l=0. However, default RR did (unintendedly) use sequential,
so l=0 "wrong" - all continuum orbitals were s-states.

01/11/16 adasdr 2.24
Check whether no. of configs in (formatted) o_str, o1 etc files .gt. 999 or not.
This is independent of coupling scheme, but see next. Only for adasdr so far.
Unformatted files avoids the problem. But the run_PP script default generates
o_str (rather than ou_str) so as to obtain the CAVES file (only written PRINT='FORM').

01/11/16 asdeck25.47
If number of configs .gt. 999, I3 overflowed in formatted oca. Now switches to I5,
configuration average (CUP='CA' etc) SR.CARATE only so far.

28/10/16 asdeck25.47
I*4 overflow segmented in CA (SR.CARATE) because NRK I*8 was not implemented there
(only SR.DIAGON and SR.DIAGFS) despite SR.CALGEB instructing user to change to I*8
in MODULE COMMON_DXRL.

27/10/16 adaspi 1.17
Fixed Gaussian convolution bug of total PI for very small EWIDTH (and large spacing 
between edges). Either gave zeroes, or arithmetic exception.

21/10/16 adasdr 2.24
Had lost the ability to select a core excitation from a metastable that did not belong
to the ground complex e.g. He-like 1s2s. It can now, but must set IMATCH to flag
a Rydberg/continuum config which represents the initial complex, and be common
to all data files processed (e.g. 2-3 equivalent electron and Rydberg runs).
Although much earlier versions did not need (or have) such a specification,
they only worked for outer-shell core-excitations. The move to handle
inner-shell implicitly assumed the ground complex.

05/10/16 asdeck25.47
Restrict MNAL,MXAL to be consistent with NXCITE and the base configs.
If a large number of orbitals in use and MNAL,MXAL poorly user constrained then a huge 
number of possible configs are constructed, and discarded, for many-electron atoms
which can be *very* time consuming.

29/09/16 adaspe 1.17
If NBIN is specified non-zero then default operation is to bin PE cross sections
as a function of photon energy, e.g. for Gaussian convolution. 
Now, if in addition the user specifies the temperature(s) then partial DR rate
coefficients are binned instead. The only electron distribution is the Maxwell.
In all cases *** post-processed radiation is NOT binned *** only that calculated by AS.

21/09/16 adasdr 2.23
Any JCFA.lt.0 neglects core-rearrangement autoionizing transitions.

08/09/16 asdeck25.47
Re-instated continuum-l assignment preserving parity during Rydberg loop 
when user explicitly specifies continuum orbitals on orbital redefinition line.
Needed when user splits problem by parity, as in updated OP work, as not all
continuum orbitals are attached to each config.

E.g. if LCON=5 then for l.ge.2, the continuum assignment is l+/-2,l+/-1,1.
For l=0,1,.. parity assignment gives continuum-l 
4 3 0 1 2  for Ryd-l=0
5 0 1 2 3  for Ryd-l=1
0 1 2 3 4  for Ryd-l=2 etc.
while sequential assignment simply gives
0 1 2 3 4  for Ryd-l=0
0 1 2 3 4  for Ryd-l=1 etc.

If simply a question of putting all continuum orbitals on a different set of configs
to Rydberg attachment (would normally use the DROP4RYD flag etc.) then the sequential
assignment can be recovered by setting LCMIN=-1 if desired e.g. better to have cont-l=4
when Ryd-l=1. Case A.S. input only - sequential was never possible with S.S.

07/09/16 adaspe 1.16
Introduced RAD='OP' option to recover exact 2004 updated OP operation.

26/08/16 asdeck25.46
Introduce MENGP in NAMELIST SRADCON. Acts identical to MENG, but assumes all user input 
electron energies are z=scaled in the electron target charge. 
Mainly for PI. DR/PE scale differently between dn.eq.0 and dn.gt.0 while RR uses internal
(z-scaled) energy mesh.

25/08/16 asdeck 25.46
Re-instate automatic combining of degenerate term/level in TERMS/LEVELS - got switched-off.

23/08/16 adasdr 2.23
First attempt to extrapolate rates and energies, from n=nxtrp, to assess accuracy of
such an approach.
AS currently does not separate core-rearrangement Augers from Rydberg ones in hybrid
mode - so all are scaled as 1/n^3...
No attempt is made to cut-off the sum over-n due to new Auger suppression channels
opening-up. Equally, cannot account for dielectronic capture starting at n.gt.nxtrp.
If core radiation leaves a Rydberg config straddling the ionization limit at n=nxtrp
then in hybrid mode the straddling is frozen there for all higher-n.

16/08/16 asdeck25.46
Parallel coding for CA collision strengths.
Differences caused by a bug in exchange multipole matching.
Serial was wrong as well. More processors means less matching.
Also fixed bug where OMGINF file (CA/LS/IC) was being accessed by multiple processors,
this could cause a crash for fast cases.
RUN='BBGP' also works in parallel (CA/LS/IC: LS was calculating unnecessary symmetries.)

15/08/16 adasdr 2.22
Use of IMATCH=.gt.0 with COREX='M-N' did not pick-up configs only accessible by mixing
since it applied strict one-electron jump test for 'MK-NL' selection.

05/08/16 asdeck25.46
Parallel coding for CA collision strengths.
One proc gives identical results to serial, but small differences when
multiple processors used - interpolation? No difference in LS but then interpolation
is different. To be continued.

05/08/16 asdeck25.46
RUN='BBGP' default used too many energies, as a result of NIDX implementation.
Now ensure original BBGP default.

04/08/16 asdeck25.45
RUN='BBGP' now works in CA (Type-6 adf04 threshold partial collision strengths.)
Only parallel operation left to be coded for CA.

03/08/16 asdeck25.45
LS/BP interpolate the rho-reactance matrix, which is a linear combination of Slater integrals.
CA formulation is in terms rho^2 - not good to interpolate (e.g.integral passes thru zero).
Now, step back and interpolate the actual Slater integrals themselves (CA only).

26/07/16 asdeck25.44
Implemented CA collision strengths.

21/07/16 asdeck25.44
Implemented CA collision algebra.

12/07/16 asdeck25.43
Re-organize collision algebra driver (sr.algx) prior to implementing CA here.

11/07/16 asdeck25.42
Ensure the NIDX energies are not pruned because too close together, c.f. scattering energies.

04/07/16 asdeck25.42
RUN='DE': for dipole transitions, exclude interaction integrals (Slater etc) from 
an interpolation if the continuum orbitals' energy difference is less than half the 
bound orbitals' energy difference because energy variation becomes too great. 
Other multipoles seem fine, as they should be, e.g. quadrupole for fine-structure transitions.
Also, ensure sufficient incident energies (for interpolation) above largest scattered energy,
comparable with scattered spread, before user adds any additional interpolation energies.
The (new) variable NIDX controls this, default=2. 
Also, added an option to attempt to set characteristic excitation energies (see NDE)
based-on orbital binding energies. Any NDE.lt.0 together with ILOG.lt.0 will use this.
ILOG.ge.0 still uses -NDE log/lin spaced values between DEMIN and DEMAX, default ILOG=1.
(Note: MENGI,EMIN,EMAX spacing unchanged, defaults to ILOG.le.0, linear.)

24/06/16 adasdr 2.22
If ground configuration has two open n-shells (e.g. 4f12 5s) COREX='N-M' likely does
not select all relevant core excitations (e.g. '4-4' because of spectator n=5.)
COREX='NL-MK' (now) works correctly, because it compares occupation numbers of
each configuration with the reference (e.g. ground) configuration, IMATCH - see 04/03/16.
So, COREX='N - M ' is "equivalent" to COREX='N-M' in this instance (the advantage
of COREX='N-M' is that it does not the require user to specify a ground/initial 
configuration, but it does depend on a "simple" ground/initial one.)
To simplify for scripting, setting IMATCH.gt.0 with COREX='N-M' now works as COREX='N - M '.
(Cannot simply default to IMATCH=1 for all COREX='N-M' because not backwards compatible -
not all datasets may have listed the ground configuration as the first one.)

15/06/16 asdeck25.42
Added test code for alternative interpolation methods of DW K-matrix.

18/05/16 adasrr 2.7
Fix for post-processing hybrid with only equivalent electron file present.
Final config parents mapping to EO were not determined, since they were taken from the
Rydberg run, and cont. configs were not used. Now first determine from
cont. config. Will be overwritten by Rydberg later, if present.
This caused top-up to crash, array out-of-bounds.

04/05/16 asdeck25.41
Until v25.7 correction, E1 radiative data (inc. PI) still included dielectric 
polarization potential when only one-body was requested. In later versions, the code
stopped, with a cryptic message, if only one-body was requested and radiative data
was being calculated. Everything now consistent. Two-body, one-body, none requested
does what it says on the tin and for both structure and radiative data.
(And Norcross or Bayliss is used consistently - this was the 25.7 correction.)
Thus, it is not possible to reproduce exactly the inconsistent results of
earlier versions without changing the code, as indicated, in sr.rkint
(and sr.rk4pi, if necessary).

29/03/16 asdeck25.40
SR.VCG did not check if MXEST was too small, because it was reduced to MXST0, when 
giving diagnostic info on dimension exceeded.

16/03/16 asdeck25.40
From v25.10 onwards, radial mesh got truncated during optimization to the largest
orbital being optimized, not good if only varying inner-shell orbitals, particularly
if optimization fails because of this. Ultimately, outer-shell optimization "corrects".

04/03/16 adasdr 2.22
Now also allow selection by core subshell excitation instead of usual
COREX='N-M' by initial and final principal quantum numbers. 
Viz.
COREX='NL-MK' select core sub-shell excitation, where NL and MK are the 
initial and final principal and orbital angular momentum quantum numbers.
***The initial reference configuration is CF=IMATCH, IMATCH=1, DEFAULT.
Note: currently, the core l values must be numeric, *not*  spectroscopic 
e.g. '40-52' selects 4s-5d(!) also, '40-5 ' selects 4s to all l, of n=5.

02/03/16 asdeck25.40
Don't try and calculate autoionization rates for true bound states.
There are two N^3 loops. The second which connects mixed initial autoionizing
and final continuum states checked for E.ge.0. But the first, since the final 
state is not yet defined, did not. But, if the initial is true bound, trivially,
we know it can't access any continuum. 

18/02/16 asdeck25.39
Catch case of "bound" state within TOLB of continuum.

17/02/16 adasrr 2.7
Port from adasdr check of target config labels against those from the N+1 run, and 
correct if o_str exists, for fully resolved case. This was/is automatic in hybrid case.

11/02/16 adasrr 2.6
Catch cases where PCS non-zero at test energy, but zero at other energies.

03/02/16 asdeck25.39
Coded array index associated with MXADJ to be INTEGER*8. 
Requires f95 version and user input dimension unset (=-1) so code determines
it internally. (All PARAM dimensions are I*4 still.)

27/01/16 asdeck25.38
Commented-out legacy code which exited with error if RESTART record length exceeded 2Gb.
Modern compilers transparently switch to using I*8 for the record markers then.

21/01/16 asdeck25.38
Catch I*4 pointer overflow in CALGEB from use of unnecessarily large MAXRL.

20/01/16 asdeck25.38
Allow AS MXCONF.ge.1000 flag to be used with ICFG=1 *provided* there are no promotions,
i.e. ICFG flag is a "sanity check" to remove DR core-rearrangement configs from an
equivalent electron run when using the run_PP script with an Xnbase file that is
flagged with "DROP4EQU" (explicitly or implicitly.)

18/01/16 asdeck25.38
Internal: ensure INTEGER*4 statements in every subprogram. For possible future
development to use INTEGER*8 everywhere. Note, MPI installation is usually INTEGER*4,
so an integer*4 interface is used, even if all else is INTEGER*8.
This (MPI) is one reason why using compiler -I8 option instead may be problematic.

13/01/16 adasdr 2.21
For dn=1 DR, determine hydrogenic radiation to upper equivalent n-value if user
has not included it explicitly in Ryd run. E.g. in a 4-5,n run, some 5,5  can
be bound. Since there is only a single screening electron, n->5 radiation
can still be determined to a good approx hydrogenically, with a tweak for Pauli, 
rather than include a slew of 5,5 configs.
(Note: 2,2 3,3 and most 4,4 are generally autoionizing so not needed in Ryd run as 
a source of final bound states.)

08/01/16 adasdr 2.21
Added flag IRDT to NAMELIST/TWO/ to tell adasdr where to read user input temps.
IRDT.EQ.0 historic TEMP(J=1,JTEMP) read after all target info etc. (Default)
    .NE.0 straight after NAMELIST, for ease of use with script.

17/12/15 adasdr 2.20
"Enabled" partitioning for initial metastable levels - need then to distinguish
between capture energy which is relative to the metastable and auger redistribution
energy which is relative to the ground.

14/12/15 asdeck25.37
A debug test for nprocperl.gt.1 parallel operation tripped-up serial case of NMIN.le.L
when RESTART in use.

08/12/15 asdeck25.37
Try and catch TFDAPO failure in equivalent electron run: mesh has been truncated once
target orbitals have been calculated but (N+1)-electron potential still required
(often equal to N-, but not required). Tests in SR.TFDAPO to handle large dimensioned
mesh trip-up and don't allow access to full (truncated) mesh, and which needs to go
sufficiently far past TFDAPO potential boundary. Previous failure advice usually
works - increase MSTEP, which changes boundary wrt mesh, but tedious and unnecessary.

07/12/15 asdeck25.37
Change of 01/12/15 asdeck25.37 did not allow for original operation with ICFG.gt.0,
i.e. when input MXCONF gets redefined. Note, cannot use ICFG.gt.0 with user set
MXCONF.ge.1000 flag. Can auto generate >1000 of course.

04/12/15 asdeck25.37
Change of 27/10/15 asdeck25.34 to KUTDSK  check screwed KUTDSK (to disk) operation.
Structure completely wrong etc. Default, no use of KUTDSK, was unaffected.

01/12/15 adasdr 2.20
Following below change, tweak to pick-up "missing" target energies from adasin,
as non-hybrid mode assumed all adasin targets present in DR run.
(This is for scripted runs which do not set max continuum interp energy in SRADCON,
but pick it up from CAVES/TERMS/LEVELS i.e. the structure run, so need highest
target, but script also constructs adasin from CAVES... sigh.)

01/12/15 asdeck25.37
In a Rydberg run (e.g. RUN='DR') allow user to specify different N-electron target
configs for continuum and Ryd to be coupled to when auto-generating the N+1 configs.
The first MXCONF/1000 configs have a continuum (& Rydberg coupled to them) while the
remaining MXCONF-1000*(MXCONF/1000) have a Rydberg only coupled to them.
e.g MXCONF=2008 flags first 2 target configs for cont+Ryd while the next 8 are for Ryd only.
Previously, would have used MXCONF=10 and cont+Ryd coupled to all.
An example use is dn=1 DR neglecting dn=0 Auger suppression.
Note, it has always been possible to do this explicitly/manually by specifying each
cont+target and Ryd+target (N+1)-electron configuration set (tedious).

11/11/15 asdeck25.36
RAD='LANDE' calculates Lande g-factors in the weak-field limit using IC e-vectors,
as per Cowan 17-3. This switches on M1 transitions, including the diagonal(!)
If you want to use RAD to set different options then setting the low-level switch
IONE=0 (in SALGEB, default =1, no diagonal) will give Lande, provided M1 are calculated
and no Born data is requested/generated, since they occupy the same print field.
The BORN switch takes precedence.

06/11/15 asdeck25.35
M1 and r_k+1 "omitted" from M_k PI - they are zero/negligible in the long wavelength limit. 
For high energy PI where many multipoles contribute they can contribute a few percent.

02/11/15 asdeck25.34
Minor.

30/10/15 asdeck25.34
RUN='DE' and 'BBGP' were "NOT RECOGNIZED", due to test re-ordering in v25.29.

27/10/15 asdeck25.34
(Attempt to) catch I*4 overflow of DC array index (dimension MAXDC).
Use KUTDSK then.

15/10/15 adasrr 2.6
IREL.gt.0 assumes relativistic multipole PI and restricts printing of bundle-nl data
to AS l-values, and true bound n-values - synched with AS default (n=20).

14/10/15 asdeck25.34
Fix mis-alignment of multipole do-loop when scaling Rydberg r^k integrals - some
integrals did not get re-scaled if KPOLE set .gt. 1. *** Default dipole-only unaffected.
Bug Introduced 28/05/15 asdeck25.30 (PI Development).

13/10/15 asdeck25.34
High magnetic multipoles generated an unnecessarily large table of VCCs, which are
only used for M1+BP corrections, and this in turn required factorials beyond what was
set-up so generating "false" warning messages: ****FCT.VCC: FACTORIAL ARRAY TOO SHORT

17/09/15 asdeck25.33
AS now READs any CAVES/TERMS/LEVELS using the fixed-format that it wrote it with,
rather than historic free-format. adasdr/rr have read this fixed-format by
default for some time, with an option to switch back to free-format. 
(adaspi/pe only free-format - the only problem with free-format is extreme cases
where the ang.mom. "fills" the separating space - this restriction has now been lifted.)

27/08/15 adasdr 2.20
Synched with adasrr viz. IREL.gt.0 restricts max ADAS temp as does user set JTHETA.

27/08/15 adasrr 2.6
The default ADAS temp grid is very broad, nevertheless...
If a user set min temp was smaller than the ADAS min temp by more than ~2, then,
as warned, Maxwellian convolution was in error (there) but it also affected
the lowest few temps .gt. the ADAS min due to the way that the energy mesh
was set-up for quadrature - highly synch'ed with the ADAS one for efficiency.
Now, ADAS temps should be unaffected and the lower temps should be reasonably
accurate. If the ADAS temp grid is used then no change to results, round-off accepted,
and accurate to 3 s.f. Still in error if user sets max temp >> ADAS max since 
the quadrature mesh does not extend high enough in energy even if the user has 
calculated PI to sufficiently high E. So, don't ignore
 ***WARNING: IF TMAX .GT. 10**7*ZA**2 K, THEN NEWTON-COATES QUADRATURE IN ERROR.
Note, PI is likely "inaccurate" at temps significantly beyond the ADAS max.

26/08/15 adasrr 2.6
IREL.ne.0 applies Juttner correction to Maxwellian.
Now, in addition, if.gt.0, assumes relativistic multipole PI and restricts
use of non-relativistic dipole to top-up in L, which should be small at
relativistic E/T. Also restricts the default maximum ADAS temperature,
which is synched to max AS energy, and assumes that (non-relativistic dipole)
extrapolation in energy is valid for the highest T's.
(JTHETA can be used to return it to the original - not recommended.)
IREL.lt.0 just applies Juttner correction to Maxwellian and is suitable
for use with non-relativistic dipole PI, allowing historic replacement
and extrapolation of high-E AS PI by analytic Coulomb.

24/08/15 asdeck25.33
Fix floating point exceptions for high multipole (high-E) PI, for now.

10/07/15 asdeck25.32 (PI Development)
Magnetic multipole relativistic integrals implemented.
For Ryd approx by continuum, all PI is upscaled.

26/06/15 asdeck25.32 (PI Development)
Magnetic multipole PI implemented in IC, initially just using non-relativistic
integrals. M_k-1 multipole range controlled by corresponding electric E_k one.

23/06/15 asdeck25.31 (PI Development)
MKMAX defines the highest electric multipole for downscaling of zero energy 
cont, default =1, dipole. This is the historic case of only electric dipole PI.
Recall, the ejected electron energy is actually calculated (z/n)**2 Ryd
higher to maintain energy separation. This gives good results at low
energies, including threshold. The (now) continuum-continuum r^k integrals
are calculated using the JWKB method. 
At high energies, higher multipoles become important, when so, by their very 
nature, the long-wavelength limit is not valid: r^k->j_k. Upscaling works well
here (hence default MKMAX=1) and these multipoles are negligible at low energy,
compared to dipole, where upscaling fails (we can no longer adjust the energy
separation as this would now require negative ejected electron energies, 
or some extrapolation hack.)
The high energy dipoles become increasingly inaccurate at high energies,
where the higher multipoles become important, for the very same reason - use
of the JWKB above (which also omits any small radial component.)
Thus, now allow downscaling multipoles to switch-over to upscaling at high 
energy. This occurs at energy index MXEP. By default, it is set to (index) the
lowest energy which exceeds 50 times the binding energy of the last explicit 
bound Rydberg (i.e. n=NSW-1.)
The user should not need to change MXEP (or MKMAX) but to reproduce the
historic default, set MXEP.ge.MENG, the number of PI energies, in NAMELIST
SRADCON (which also holds MKMAX.)

18/06/15 asdeck25.31 (PI Development)
Allow upscaling from highest explicit bound n, as opposed to downscaling
from zero energy cont. Former for PI .gt. dipole.

04/06/15 adasdr 2.19, adasrr 2.5
Bug-fix for use of target configs from o_str.
 
02/06/15 asdeck25.30 (PI Development)
Bug-fix

31/05/15 asdeck25.30 (PI Development)
Indexing bug fixed for when scaling higher multipole Ryd cont.

28/05/15 asdeck25.30 (PI Development)
Work on multipole PI - Ryd approx by cont.

22/05/15 asdeck25.29
Tweaks to allow bare ion to run thru gracefully (for RR script).

15/05/15 asdeck25.28 (PI Development)
Dimensioning for arbitrary number of multipoles (magnetic still to be coded).

13/05/15 asdeck25.27 (PI Development)
Improved numerics for high-energy high-multipole PI.

09/04/15 asdeck25.26 (PI Development)
Extend dipole photoionization to higher electric multipoles (two per orb pair).

09/04/15 adasdr 2.19, adasrr 2.5
Added Juttner relativistic Maxwellian correction. Currently off by default
(IREL=0) while any (subject to change) non-zero value switches it on, and
writes info to the comments in adf09/48. May change default for it to be
on for T,gt.1.e8K say, or restrict max ADAS T to less than 1.e8K so not needed.
Depends on what is agreed with MOM.

07/04/15 adasexj 3.16
Factor 2 missing from characteristic temperature of Juttner relativistic 
correction to Maxwellian distribution: Ryd vs a.u.

08/04/15 asdeck25.25
Below change also attempted to drop unused continuum terms/levels but need 
to keep at least NMETAR/J for post-processor set-up, so switch-off for now.

01/04/15 asdeck25.25
(See also discussion of EIMXLS/IC on 29/09/11 and NMETAR/J on 20/10/11.)
Now allow EIMXLS/IC .gt. 0 to flag energy relative to ionization limit,
this uses internal ionization limit which may not yet be determined for
the first/highest symmetries (LSp in particular) thus you will yet some
unwanted rates. However, this is preferable to using an absolute value
from TERMS/LEVELS which is somewhat inconsistent, e.g. based on N-electron
orbitals while (N+1)-electron orbitals are in use, which can *miss* requested
resolved Auger rates because the difference in *absolute* ionization energies
is comparable with term/level splitting. Differences *relative* to the
ionization limit are much smaller (safer). 
This is now the default operation for NMETAR/J.ne.0, which uses TERMS/LEVELS. 
Explicit user setting of EIMXLS/IC (.lt.0) works as before. 

31/03/15 adasdr 2.18, adasrr 2.4
Hybrid still requires NTAR1 resolved targets from AS. 
Previously, test was on NTAR2 resolved, which is bypassed in hybrid mode.

30/03/15 adasrr 2.4
Port adasdr changes of 13/02/15 & 17/03/15

17/03/15 adasdr 2.18
Hybrid CA did not write final parent stat. weights on the partial blocks 
(present at top of adf09 so could map-back using final parent index which was written.)

13/02/15 adasdr 2.18
Hybrid: test of target structure o-file to determine LS or CA did not work for
quasi-one-electron atoms, specifically, assumed CA if no. of confgs was equal 
to no. of energies. Now checks CF vs L label, c.f. L vs J to determine LS or IC.

11/02/15 adasdr 2.18
With mdrcs13 it was possible to use TOLR to look at the effect of assuming
that radiation to autoionizing states within TOLR above the ionization limit
subsequently cascaded with non-unit fluorescence yield, i.e. contributed to recombination.
In adasdr, TOLR is used to set the range of metastable final states for partial DR,
the totals are still for true bound only. (TOLI could be used judiciously to try
and mimic mdrcs13 behaviour of TOLR.) Now, as a simple test (since rarely used)
set JCFR .gt.0 and .le.100 to treated all final configs JCF.le.JCFR as recombined.
(Previously, applied to JCF.eq.JCFR only, mdrsc13 still does so - beware!)

09/02/15 adasdr 2.18, adasrr 2.4
If NTAR2=0 (to determine all possible final parents internally) then in IC only.
the minus sign was not stripped-off the parent spin label in the case of odd parity
parents, resulting-in an asterisk being printed for the spin of parent level in the 
adf09 file. This was purely a labelling issue. The parent spin is not used in IC.

04/02/15 asdeck25.25
If ICFG.gt.0 is used to generate configs then quietly ignore those which would include a 
Rydberg orbital to represent core re-arrangement autoionization in DR, when RUN.NE.'DR' etc.
In the past, the user was required to remove them, and even the orbital itself
because correlation configs were not checked for its (illegal) usage.
This enables the same base input file to be used for structure (RUN=' ' MXCCF=-5, say),
autoionization (RUN=' ' MXCCF=5) and DR (RUN='DR' MXCCF=5) just by re-setting
the RUN and MXCCF variables, e.g. within a script.
If ICFG.eq.0 then a structure run will still attempt to evaluate an n=80 orbital, say,
and a non-DR/RR autoionization run (MXCCF.gt.0) will result in an error.
Note, you can use ICFG=11 and set the number of promotions to zero if
you want to use an exact set of configurations (no promotions) and still take
advantage of the above feature. (You also need to add trivially the global min and max
occupation numbers - the actual values are immaterial provided they encompass the
configuration ranges used.)

11/12/14 asdeck25.24
Improve suggestions when problem with DW interpolation energy mesh.

08/12/14 asdeck25.24
DW: added LAPACK routines for fully unitarized conversion of rho-matrix to T-matrix.
The asdeck25_lap.f uses them by default, along with the Hamiltonian diagonalizer.

08/12/14 asdeck25.24
DW: Fully unitarized conversion of diagonal T-matrix from rho-to-K-matrix 
normalization used the wrong sign on the real part of T^rho. This only affects
elastic collision strengths. (Omega does not depend on the sign of T^K, but the
elastic one does depend on the sign of the diagonal T^rho.)

28/11/14 asdeck25.24
DW: Full unitarization failed to ALLOCATE a WORK array which was "only" used
in an argument to a subroutine call which then used it (as an array). 
Subsequent memory overwrite could then lead to all sorts of unexpected problems.

17/10/14 adasdr 2.18
Damping import from pcadr.f  is CA only of course. The key point is that the whole
config is present or absent (open/closed) for an Auger rate. 
Attempt to apply to LS/IC by taking Auger rate bundled by config and multiplying
by changing fraction of stat. weight  that is open/closed as redistribute higher/lower
in energy. i.e. uses the LEVELS file again as for CA to get fraction of bundle
present on resonance - this is unity in CA of course. Not overly good results,
likely due to poor scaling when only a small fraction of the config is open.
Need to try and shift ionization limit in AS run so that a good fraction of
contribution is present, then can be discarded as not needed c.f. energy corrections.
(Deleted old Auger damping of 2.16.)

13/10/14 adasdr 2.17
Import continuous smooth opening-up of Auger damping from pcadr.f for partitioned DR.

07/10/14 adasexj 3.16
Minor: do not attempt to determine forbidden high energy behaviour when 
collision strength is identically zero. (IRMPS=-1 was workaround.)

09/10/14 asdeck25.23
Sum over continuum small-l when bundling Augers. (Not done for CA since rate file
is already small. adasdr can handle any degree of bundling.)

07/10/14 asdeck25.23
Re NMETAR/J which control Auger resolution: .lt. 0 now resolves Auger loss by
final configuration, instead of a single loss term (still the case for .gt. 0).
(Recall, autoionizing levels/terms are always fully resolved - bundling is over
where they decay to, similarly for radiation.)
|NMETAR/J| (still) gives the number of fully term/level resolved initial captures.
No change to adasdr and all DR results unchanged. Rather, now it will be possible
to code to allow-for redistribution of autoionizing states and corresponding
fractionation of Auger loss, c.f. CA in the pcadr.f code, but now with LS/IC data.
Default = 0 still, all autoionization rates fully term/level-resolved.

07/10/14 asdeck25.23
Parallelization coding 27/08/12 pasdeck25.11 caused serial version to drop the
first JND n-value, i.e. NMAX+1. Has no major implications, but doesn't help attempt
to establish a consistent n-mesh, and you should get the n-values you ask for/expect!

05/09/14 asdeck25.22
DW: BP implementation of fully unitarized conversion of rho-matrix to T-matrix.
Seems to work well down to low-E, by comparison with R-matrix for transitions
that are enhanced by coupling.
Activated by NMETAJ .ge. no. of spectroscopic levels and IONE=0 (switch-on elastic).

03/09/14 asdeck25.22
DW: LS implementation of fully unitarized conversion of rho-matrix to T-matrix.
For use at moderate to high energy for now since we are still working with
a common final scattered energy. 
Activated by NMETA .ge. no. of spectroscopic terms and IONE=0 (switch-on elastic).

26/08/14 adasexj.f 3.15
This code originated to read R-matrix OMEGA files and Maxwell average them.
It has been substantially enhanced. One of the new capabilities is to be
able to read and convolute an AS adf04_om file (DW or PWB).
Since it can also convolute with non-Maxwellians (kappa, druyvesteyn) it is
a complete replacement for adf04_om2ups.f (ADAS809) but with the capability
to process, esp. interval average, R-matrix OMEGA files (unlike ADAS809). 
It uses the NAMELIST &ADASEX or &ADASEXJ to control its operation.

23/06/14 asdeck25.21
Minor (formatting).

12/06/14 asdeck25.21
Minor. Sort of degenerate continuum terms/levels by index was not restricted
to continuum, consequently near-degenerate (within TOLB) bound states 
could be reversed, i.e. out of energy order (depending on their term nos.)

16/05/14 asdeck25.21
NASTJ did not work for RUN='DE', i.e. selection by target Jp symmetries.

15/04/14 asdeck25.21
Promotion rules (ICFG.gt.0) did not respect non-zero minimum occupancy following
zero minimum occupancy: e.g. 2 0 0 1 . Not a normal physical requirement.
But occurs if "1" is an explicitly specified Rydberg orbital to allow
for core-rearrangement Augers, i.e. a continuum orbital is to follow the Rydberg
in the final config representation.

09/04/14 asdeck25.21
The negative Born limits are caused by neglect of very small contributions to
the Born integral sum. User can now set STOLB smaller, e.g. zero to force all.
May need to zero-out CMXICR as well.

08/04/14 asdeck25.21
For delta-S.gt.1 transitions, infinite energy Born limit could go negative - can
only take place via mixing spin-orbit mixing. On merging OMGINFIC with RM OMEGA, 
this causes adasexj to treat it as a dipole transition. The radiative rate output
to adf04 is nonsense. But, convolution of omega seems largely unaffected.
This would affect DW as well via adf04ic, whether adf04_om2ups is benign...
Now force a small positive value (1.d-30) to flag as Born.
The transitions are, of course, very weak. 

04/04/14 adasdr 2.16
Added NCUT warning (see adasrr below). 
Allow user to suppress stat. weight check (for case of NAST in AS): iflagw=1.

21/03/14 adasrr 2.4
Minor: added NVINT (max interp n). Flag warning if NCUT does not match a
representative n - totals not cut at interp-n since partials control.

13/03/14 adasrr 2.4
Output E vs E*Sigma(tot) to XRRTOT. Currently, unconvoluted.
TBD: add cooler & Gaussian distribs, then output Maxwellian as well.

06/03/14 asdeck25.21
Although the user could set WLG1,WLG2 to control the minimum E1 and Ek>1 radiative
rate written to olg, the oic file was still hard wired to 1.d-7 (the Ek>1 default).
Now, oic is controlled by WLG1,2, and so E1 is now 1.d-2, by default.
Also, the minimum LS/IC Auger rates were hardwired to 1.d-2 (in olg and ols/oic).
Now, the output is controlled by WLG1, so (default) unchanged.

05/03/14 asdeck25.21
New default for RUN='DR' (and all Rydberg loop options): do not mix Rydberg nl-states
with (N+1)-electron correlation configs. If an N+1 is embedded in HRS manifold
then mixing needs to be simultaneous with all states in the manifold so that the 
mixing with any one HRS is diluted. Otherwise can artificially enhance HRS DR
by a large factor (e.g. 10). Most likely problematic in low-charge fine-structure DR,
M-shell more than L-shell. Then tend to have high-lying N+1 (involving 3d say) but
the fine-structure HRS are very low-lying. The fine-structure DR spread is very
small and so it is only an unfortunate case where an N+1 happens to coincide with HRS.
But safer to default off since such mixing is always unphysical.
To switch back on, to recover historic operation, set MIXBV='YES' in &SMINIM
NAMELIST. All other values equate to 'NO'.

11/01/14 asdeck25.20
SR.RADIAL test for reaching end of radial mesh got "bypassed" in default operation.
In normal DR operation code would fail because SR.RADWAV could not determine the
Rydberg orbital, and gave a similar error message to increase MAXB1 etc.
But in RR mode (small LMAX) possible to have the last exact n-value determined
inaccurately (outer turning point still within radial array, tail "only" chopped)
before switch to approx by continuum. High energy bound-free dipole integrals
very inaccurate then because much cancellation in the tail.
This happened somewhere in the v23.x evolution.

31/12/13 adasdr 2.16
Tweak parents tests/warnings.

21/11/13 asdeck25.19
Tweak CA stat. weight output.

20/11/13 adasdr 2.16
Check user input target statistical weight.

13/11/13 asdeck25.19
Write an energy ordered CONFIG.DAT file - CUP='CA' only. Useful for subsequent
restriction following multiple promotions. ECORR also activated for CUP='CA'.

12/11/13 asdeck25.19
Configuration average expansion was limited to ~45,000 configs by unused non-allocatable
arrays MAXCF*MAXCF. They are now allocatable. CA memory is now linear in MAXCF.
Also, some MXENG*MAXCF arrays now allocatable.
******UPDATE: not true because NAD array is allocated actual number configs**2 to
point to H and EK interactions. This includes non-interactions. Since 45k configs
likely have small percent interacting, it would be more memory efficient to store
only pointers (via NAD) to actual interactions, along with additional pointers
to those configs. This requires memory approx 3 times the number of interactions.
The existing code is a direct port from LS/IC where there is already partitioning by
LSP/Jp and so "most" terms/levels within an LSP/Jp interact and just NAD alone is 
more memory efficient. Unless actually going to "need" 45k configs at once there
is no point in coding CA differently. If you have 45k configs, of which only a small
percent interact, then likely better not putting them all in at once in the first place.

11/11/13 adasdr 2.16
Allow crude on/off auger damping of partitioned DR.

01/11/13 adaspi 1.16
Explicit default NLAG=2 point interpolation of partial PI cross sections on electron
energy mesh to get totals on photon energy mesh. If user used default AS electron
energy mesh (MENG=0) then adaspi did default to NLAG=2. If user used a finer AS
energy mesh (either their own or an internal one - see below) then NLAG=4 was
an alternate default. NLAG=2 is safer given that the code is limited in its
testing of the supplied electron energy mesh to decide whether to use 2 or 4.

01/11/13 asdeck25.18
Default "photoionization" electron energy mesh (MENG=0) is really for RR, viz. a
few  energies per decade spanning many decades. User likely wants to specify a finer
more restricted energy mesh, especially to obtain totals whence the partial PI
must be interpolated to convert to a common photon energy mesh. MENG.gt.0 is only
restricted by dimension (read MENG user supplied energies). For MENG.lt.0 the
user only specifies the EMIN,EMAX range (as for autoionization). However, a little
used option was MENG=-100 to flag a finer default "PI" mesh c.f. MENG=0. So, in
practice a user could not ask the code to generate more than 99 energies between
EMIN,EMAX. Now, move MENG=-100 flag to MENG=-1000 (and old -1000 flag to -10000,
see SR.RADCN0 comments for details of this latter option.)

30/10/13 asdeck25.18
FAC='YES' SCCA option did not work for DR operation.

28/10/13 asdeck25.18
CUP='CA' or 'CAR' did not give any radiative data unless LUPMX was set.

28/10/13 asdeck25.18
ICAV.lt.0 energies now "correct" for DR operation.

25/10/13 asdeck25.18
Fix ICAV.lt.0 for DR operation - still not great energies, but no longer crashes etc.
ICAV.gt.0 will likely stop for DR operation since it does not fully take account
of N- and (N+1)-electron charge differences. ICAV.ne.0 was implemented to mimic
FAC structure. Needs working thru again for mixed N/N+1 problems. 

24/10/13 adaspi 1.16
Limit max dimension of photon energy mesh for totals - previously purely
written in terms of other dimensions but in practice unnecessarily large
when many dense packed electron target levels present.

21/10/13 mdrcs13.5
SR.AYIELD (REDA) and SR.RYIELD (two-step radiative cascade) did not work. They last 
worked in mdrcs12. The major re-write (speed-up) of SR.CROSSX (much ported from adasdr)
did not include COMMON /XX/ which transferred the major data block (rates & energies).
/XX/ is not used/needed by adasdr since it has no RYIELD cascade (and REDA is outwith
the scope of adasdr).

21/10/13 padasdr 2.15
Only processor zero should pick-up any N+1/correlation DR.

18/10/13 asdeck25.18
Adjust default LCON-1 to max-(l+1) for PI (l_c=0,1,...LCON-1 then).

11/10/13 asdeck25.18
Some orbit-orbit integrals, not yet needed by low-L DW (as multipole does not yet exist)
could cause code to crash.

10/10/13 asdeck25.18
Extend radwin orbitals (if necessary) to default internal radial extent.

21/08/13 asdeck25.18
Give info on total number of channels per scattering symmetry, spectroscopic only
as well as including correlation. This is not used by AS and no memory is based
upon it (there is no explicit storage of nchan-by-nchan) rather it gives a quick
dimension check for R-matrix.

16/08/13 asdeck25.18
Array out-of-bounds for DW if a correlation term of an outer equivalent (>1)
electron sub-shell has L which exceeds all spectroscopic target terms. 
o.k. if outermost subshell has a single electron. o.k. of KCUT=0=NAST.
Slater states for unwanted terms were not being discarded by SR.VCU
during DW operation. SR.VCG did correctly discard. So, a problem only if 
SR.VCU is used for the last sub-shell and it is used now only for l^q q>1.

02/08/12 asdeck25.18
Re-worked TCC outputs, especially TCCDW.DAT (case TCC='STGICF').

10/07/13 asdeck25.17
Use of Brewer data failed if there existed configs for which no data was entered.
(See 31/05/13 for further details.)

08/07/13 asdeck25.17
Read of an external potential (MHF>0) did not work if NZION>0 (TF).

31/05/13 asdeck25.17
Introduced use of observed (currently, ground state) configuration energies to
move configurations relative to each other, but without changing the relative position
of terms/levels within the configuration, so as to make use of Brewer's data for
low-charge lanthanides and actinides [JOSA v61, p1101 & 1666 (1971)]. 
This is implemented via the ISHFTLS/ISHFTIC options: only -1 (energies relative to
the ground state) or +1 (energy corrections), i.e. no iterations. The (resulting)
energy correction for a configuration is applied to all terms/levels of said configuration.
The fact that configuration numbers and configuration energies (ground state thereof)
are present in SHFTLS/SHFTIC is flagged by the number of energies to be read (line 1)
being the negative of the usual value. Normal usage is likely ISHFTLS=-1 ISHFTIC=-1.
Then term energy corrections (TECs) are determined for use in H(IC) prediagonalization,
and level energy corrections (LECs) for post diagonalization, just as in the original
term/level dependent usage but now using the same energy values for all terms/levels of
a configuration. It is likely (but not necessary) that the same configuration energies 
are to be used in SHFTLS/SHFTIC. In that case (-1) it is only strictly necessary to
read them from one file, the other can read -1 1.0 followed by the ground CF number and zero.
If corrections are input (+1) then they must be entered in both files if both flags=+1.

The configuration average energy is another obvious possibility (not yet coded) which
would seem a suitable choice to align with Cowan's code, since it focuses on level
energies relative to the configuration average.

28/05/13 asdeck25.16
Some combinations of ISHFTLS*ISHFTIC.ne.0 did not work as well as they could, or not at all.
The WRITEUP discussion of the use of ISHFTLS & ISHFTIC is concerned only with
them being used separately, albeit sequentially, but some mixed usage is possible.
Note: prior to this version, ISHFTLS=-1 was not used in IC as a source of TECs.
It was assumed that ISHFTLS>0 would be used to determine any required TECs.

21/05/13 adasdr 2.15/1.21
Re-instate (but modify) test to try an detect old-style adasin without user
needing to set IOLDW=1.

14/05/13 asdeck25.16
Replace "use mpi" module by internal "module mpi" plus include 'mpif.h', for broken builds.

01/05/13 asdeck25.16
Fix to SR.MESH bug introduced by 28/02/13 mod to Laguerre turning point: reduced
physical one (wrong n in energy estimate). Negligible effect on structure but
radial array can be too short for DW N+1 TF.

31/03/13 adasdr 2.15
Convolution energy mesh variable may not be initialized due to round-off.
Then, no convoluted file if compiler does not initialize, e.g. to zero.

27/03/13 adasdr 2.15
A dimension was not set in non-hybrid mode (the array was not "used" then) but
it was still ALLOCATEd (as no separate test for small arrays). So, depends
how compiler initializes non-initialized variables whether this causes an
ALLOCATE problem.

28/02/13 asdeck25.16
Allow user to explicitly set maximum extent of radial mesh (XMAX in &SMINIM).
Historically, this was all allowed by the radial dimension MAXB1. Since it
can be unnecessarily large (to accommodate DR), the code now determines it 
(XMAX) internally - has done so for some time, but it could not be overridden. 
The main reason to allow user to set it is to truncate orbitals whilst still 
orthonormalizing them. This is consistent with R-matrix stage 1 operation.
(If use the AS RZERO option, orbitals are not re-orthonormalized, it is meant
just as a box trim.) 
XMAX must be large enough to generate the numerical orbitals in the first place
and so needs to be somewhat larger than the most diffuse outer turning point.
Also, need to be able to generate the model potential, esp. Thomas-Fermi.
However, Laguerre pseudo-orbitals face no restriction, since they are generated
from an analytic power series, and so can be truncated severely if they extend
well beyond the physical orbital extent - this is exactly what is desired on 
physical grounds for RMPS.
Ideally, radial orbital generation and truncation should be de-coupled, i.e.
the orbitals should be re-orthonormalized after RZERO is applied. But the
present should suffice for most cases, for now.

28/02/13 asdeck25.16
SR.MESH now checks for Laguerre pseudo-orbitals and uses the appropriate
outer value for the turning point (4nbar/z) in its estimate of the maximum
radial extent to be initialized for (XMAX). The physical orbital value (2n^2/z) 
is usually unnecessarily large, because Laguerre to n=14 is comparable to
physical n=5.

28/02/13 asdeck25.16
For box-state generation, the user can now set TINORB explicitly in &SMINIM.
This controls the box-size when RZERO is not set explicitly - the default is
the same as R-matrix (1.e-3).

02/02/13 asdeck25.15
Minor warning/bugfix.

19/12/12 asdeck25.15
Consolidate historic non-NAMELIST reads "into" NAMELIST - use all same default
set-up and post-read switching. May need some tweaking, but non-NAMELIST rarely
used and so should have minimal independent set-up.
Also, dimension test operation did not l-loop. (Usually just tested the max l.)

18/12/12 adasdr 2.15, adasrr 2.4
Minor bugfixes

17/12/12 asdeck25.14
From 25.12 onwards, for B-C, if the last Jp symmetry did not contain a continuum,
and earlier ones did, then DEALLOCATE error results (unless out of bounds check on.)

06/12/12 asdeck25.14
DW with a pseudo-state target gave completely unphysical results if user did not
specify the scaling parameter for the (unique) potential to be used to generate the
continuum basis. The reason for this was that elsewise the negative sign of the last
read scaling parameter flagged the use of coulomb functions for the continuum, albeit
with the usual physical effective charge. However, this was not readily apparent in
the olg output since the default information written for the continuum basis is their
energies and potential - "unfortunately" the correct potential was generated, using the
default internal lambda but this was *not* passed to the basis generator (which only
requires the sign of lambda). Only by upping the print level are the continuum basis 
phase shifts printed and then the problem is obvious since they are all zero - which
is highly unlikely for near neutrals where pseudo-state use is most likely.

05/12/12 asdeck25.14
Fixed two small bugs in DW exchange mixing. One can only affect LS collision strengths.
The other could potentially affect BP, but didn't in the example where both affected LS.
For all practical cases, the error is expected to be small compared to that associated 
with interpolation and/or the DW approach.

03/12/12 asdeck25.14
In DW operation, correlation-correlation interactions are omitted from
the K-matrix, by default, since they contribute to spectroscopic transitions
only ~mixing^2. (They are always included in the structure case since the
square H has to be diagonalized anyway.) Now, if KCUT is set .lt.0 then
they are included, otherwise KCUT operation is as .gt.0. This has no effect
on a structure/DR run, save that KCUT.lt.0 no longer switches-off correlation,
only KCUT=0 or .ge. the total number of configs. Previously, it was only
possible to test the omission of such interactions from the K-matrix by
switching-off correlation completely - in a BP run this also brings in new
terms which only spin-orbit mix with the (original) spectroscopic list.

29/11/12 asdeck25.13
Orbital energy print to adf04 did not check out-of-bounds correctly.

29/11/12 asdeck25.13
For consistency, no longer set MRED=1 for TF potential for explicit closed-shell core when
pseudo-states present. Arguably, modified is better for PS configs, but not necessarily so 
for ground config.

28/11/12 adf04_om2ups.f
Updated finally to use MoM's major re-vamp - old version did not handle 
dipole transitions in neutrals well. (May have to re-implement suppression
of ADAS aborts related to incomplete data for CR modelling - WYSIWYG here.)

28/11/12 asdeck25.13
Ensure orbital energy print to adf04 is standard order
3 0 3 1 3 2 4 0 4 1 4 2 4 3 5 0 5 1 5 2 5 3 5 4 6 0
even when natural order 
3 0 3 1 4 0 4 1 3 2 5 0 5 1 4 2 6 0 4 3
is specified by the user. This is because there is no orbital definition within 
adf04 and so ADAS always assumes standard order.

27/11/12 asdeck25.13
Curtail orbital energy print to adf04 to exclude pseudo-orbitals.

26/11/12 asdeck25.13
Fix "bug" to KCUT operation introduced in v25.5, viz. correlation terms selected
only if present in spectroscopic *and* same true for parent terms as well.
This has some merit, but it is not the historic behaviour of KCUT.

21/11/12 asdeck25.13, adasdr 2.15 adasrr 2.4
Final(?) re-synching all around.

20/11/12 adasrr 2.4
Introduce ALLOCATE.

19/11/12 asdeck25.13
Bundle/sum photon/electron target/continuum photoionization cross sections
using the same NRSLMX and/or NMETAR/J parameters for radiative and Auger
rates bundling/summing. If the photon target is bundled (NRSLMX) then it
is assumed to be for adasrr (since it makes no sense to bundle the initial
state for PI) and so detailed balance is applied and (Energy times) the
photorecombination cross section is written to the op files. If the
electron continuum is summed-over as well then electron targets .gt. NMETAR/J
are dropped since they cannot affect photorecombination on NMETAR/J.
For completeness, NMETAP/J have been added (to &SMINIM) to restrict resolved
photon targets for PI (and PE.) If NMETAR/J are set then PI to higher electron
targets is retained as an unresolved sum for contribution to the total PI.
TBD: adaspe/pi may need tweaking, but that is all since there is no change
in resolution - just restriction and continuum partial wave sum being done
in AS rather than the PPs.

19/11/12 adasrr 2.3
Handle AS bundled PI. (As above.)

05/11/12 adasdr 2.15
Re-sync. with adasrr!

05/11/12 adasrr 2.2
Final synch-ing. Still TBD: handle AS bundled PI - will need detailed balance
adjusted in AS for downward.

02/11/12 adasrr 2.1
Re-sync. adasrr with adasdr viz. CA and Hybrid (internal bundle, not from AS yet.)

25/10/12 asdeck25.12
Minor bugfix.

17/10/12 adasdr 2.14
Allow specification of E1C(1) (shift of ionization limit) via TC1 in &TWO.
(This is for automated running where TERMS/LEVELS is automatically copied to adasin.)

20/09/12 adasdr 2.14
Fix for use of observed energies in hybrid mode.

18/09/12 asdeck25.12
Finite nucleus potential now used in small-r correction to one-body relativistic
integrals (small effect so don't port to 2-body).

13/09/12 asdeck25.12
Mainly a tidying-up exercise. Finite nucleus potential moved to own SR.VNUKE,
as opposed to being distributed (and repeated) in SR.RADIAL,RADWAV,RADCON,FCF6.
Any new finite nucleus (e.g. Fermi TBD) should just require changes to VNUKE.
Consequential cleaning-up and fixing of a couple of small minor obscure bugs
(e.g. M1+BP integrals during DR when a bound orbital approximated by a cont!)


12/09/12 asdeck25.12
Modified relativistic Whittaker function to use correct 1/r^2 term - needed
c/r^2 and l input separately since use l, not lambda, for norm.
This means "short" mesh can be used, as in non-rel case, for initial e-value search 
- previously not allowed for rel orbs because poor Whittaker gave slow convergence,
thus was numeroved from point where orbital "negligible".

29/08/12 pasdeck25.11

Second attempt at parallelization by Rydberg-n.

This time use one processor per-nl. Flag by mapiam=1 in SALGEB.
(Currently, any mapiam.gt.0 gives the same result.) 
Any mapiam.le.0 gives the nprocperl implementation (default),
including nprocperl=1 (default).

This implementation should be easier for adasdr to handle (still TBD).

May implement other choices (flagged by mapiam) in the future, but mapiam=1
will always flag this one-per-nl .

27/08/12 pasdeck25.11

First attempt at parallelization by Rydberg-n.

Firstly, the angular algebra is calculated parallel in Rydberg-l to generate lproc
RESTART files (there are normally one per-l, i.e., as fine as it goes) via MSTART=1.

Secondly, the rates etc are calculated on re-running (MSTART=5) with nproc an
integer multiple of lproc, i.e. there are exactly nprocperl=nproc/lproc processors
assigned to each RESTART file.

The advantage of the above is that it is simple to implement.

The main disadvantage is not being able to assign more processors to the more
time consuming l-values. (The most time consuming here is not the largest l,
as is usual for the algebra, but usually the l with the most contribution from 
the MXCCF "correlation" configs, which may be l=3 or 4.)

Ideally, one would like to go to the maximal case and assign one nl per processor.
This is mainly a mapping issue, but complicated by the differing number of
n-values per-l. There is also a technical issue in that the code has a double sum 
over n-values, one: DO NMIN,NMAX,1 and one over the JND (actually, 2*JND-1) additional
spaced n-values. Each processor expects both summations, i.e. calculates a selection
of n-values which span the entire range - in principal to load balance over-n.
If there are more than NMAX-NMIN+1 processors per-l, then these excess processors
operate only on the second sum, assuming 2*JND-1.gt.NMAX-NMIN+1 as is the case
of a production run. If nprocperl.gt.max(2*JND-1,NMAX-NMIN+1) then the excess
processors exit without warning having done nothing - ols/ic etc files empty.

Files are labelled oicull.nn etc, where ll is the usual "l-index" (=RESTARTll)
and nn+1=1,..,nprocperl. Except for olgmmm which is labelled mmm=000,...,nproc.
The first nprocperl files are for the first lproc, the next nprocperl for the
second lproc etc. N.B. if nprocperl=1 then the second index is dropped,
oicull.nn -> oicull, and  the olg index is just by lproc as before.

TBD: modify adasdr to handle these files. Looping over the (new named) files
is straightforward, but the set of n-values is no longer defined in a single
file and so a new mapping index is needed.

TBD?: The total number of n-values per l is NMAX-max(NMIN,l+1)+1 + 2*JND-1.
Thus, *assuming* the exact nproc is specified for one-to-one mapping, so there
is no load balancing by n, an alternative strategy would be to simply assign 
processors 1,...,nproc one-by-one to the range NMAX-max(NMIN,l+1)+1 + 2*JND-1
for l+1=1,...,lproc. (For ease, this might require one l-per RESTART file.)
The initial drawback with this approach is that production runs can only
be done easily on machines with several hundred processors. To start adding
multiple n-values per proc to this one-to-one mapping requires more thought.



21/08/12 asdeck25.10
Implemented a new radial mesh (not as major as it sounds) which is now the default
for kappa-averaged orbitals. These require a finer mesh near the origin than
non-relativistic orbitals. Previously, this was achieved by increasing the default
MSTEP from 11 to as much as 15 (Uranium). But, this meant that a much finer mesh 
was used asymptotically since the number of doubling intervals was unchanged.
But the asymptotic mesh should not depend on MSTEP (in addition to the normal z-scaling)
i.e., the number of radial points required should not change significantly as
you go along an isoelectronic sequence. Since the old method (MSTEP) reduced the
asymptotic step by an order of magnitude, the dimension and CPU time increased
accordingly. Now, kappa-averaged orbitals introduce IXTRA additional (doubling)
intervals at the origin, with initial step now ~ 1/2**(IXTRA+MSTEP) i.e. the
asymptotic step is unchanged (and MSTEP=11 now) but a much finer mesh is used
at the origin - e.g. IXTRA=4 for Uranium. This does not add a large number
of new steps since each interval contains 32 steps (hardwired, like the rest
of the radial mesh). Worst case (default) is an extra 128 points compared to,
say, 800 non-relativistic steps which then got multiplied by 16, say, on going to
relativistic orbitals. 
Also, a new routine (SR.MESH) is called by SR.RADIAL. 
This gathers together all aspects of the radial mesh set-up that were previously
spread over SR.MINIM0, SR.RADIAL and SR.TFDAPO/STOPOT. The only mesh related
set-up outside of SR.MESH is the optional user input of IXTRA and MSTEP, which
remains in SR.MINIM0. 
Notes:
The original (relativistic) mesh can be recovered by setting IXTRA=0 (then MSTEP
defaults back to 15, say, for U)and, optionally, MSTEP can be set/overridden as before.
IXTRA=-1 for non-relativistic orbitals (default) and no new intervals are
added - the user could add such, but likely not needed.
When continuum orbitals are in use then the default/user MSTEP likely increases
as a finer asymptotic mesh is needed to map-out sin(kr). Any default IXTRA>0 is 
reduced to compensate, i.e., only the asymptotic step gets finer, unless the user
increases IXTRA beyond the default.
Example: assume a case where the defaults are IXTRA=3 and MSTEP=13. Assume MAXE
is set by the user and this results in MSTEP=14, then IXTRA is reduced to 2.
The user can "override" this by increasing IXTRA to 4, which gets reduced to 3.
If the user explicitly sets MSTEP then IXTRA is *not* changed by this action.
Again the user can set IXTRA as well.
In practice, the user should never need to change anything, only set MAXE, say.
If the user does want to change/test then best to set both IXTRA and MSTEP.
Most of this entry is for my future benefit.

15/08/12 asdeck25.10
Mods to v24.23 caused omission of QED corrections to case of IC alone (QED=1).
They were added to LS/IC when QED=-1. Default is zero, none.

15/08/12 asdeck25.10
RADWAV mod of 22/05/12 asdeck25.8 caused incorrect convergence for 1s orbs Z>88.
However, the root problem was the very slow convergence of e-energy for such orbs.
The Hartree energy correction was being applied to E+(alpha*E/2)**2 (the Whittaker
function energy) and a new correction determined to E. Now apply original correction
directly to E. Convergence v. fast!

27/07/12 adasdr 2.14
Minor fix to 19/07/12 - for case true correlation (KCUT) specified in AS run.

26/07/12 asdeck25.9
Minor fix to 13/07/12 - for case true correlation (KCUT) specified.

24/07/12 asdeck25.9
Allow user to specify use of velocity gauge for radiative rates:
IGAUGE=0 for length (default) and IGAUGE=1 for velocity, in &SMINIM.
(Length and velocity gf-values were always written to olg, but length always
used for AEK, e.g. to ols/oic.) 

23/07/12 asdeck25.9
Allow setting of global lambda scaling parameters (one for bound and one for Ryd/cont)
when using relaxed orbitals (most likely Thomas-Fermi). Recall, then NLAM gives the
number of sets to read where a set consists of CF no., no. of lambdas & the lambdas;
closed shell orbs defined by CF no.=0. If no. of lambdas .lt. 0 then first lambda
is now used for all bound orbitals and any second one for all Ryd/cont. 
See also 05/07/12.

19/07/12 adasdr 2.14
Hybrid: write info to adf09 on configs straddling the ionization limit viz.
parent config, nl-rep, bound/autoionizing fractional weights and associated energies.

13/07/12 asdeck25.8
When configuration resolved final states (NRSLMX.lt.0) straddle the ionization limit, 
write the true bound and autoionizing weights and weighted energies to ols/oic 
(not oca as CA is one or other.)

13/07/12 adasdr 2.13
When configuration resolved final states straddle the ionization limit, write the
true bound weight and weighted energy to adf09 (hybrid only - as CA is one or other.)
Currently, adasdr re-determines these values itself from the term/level energies.

13/07/12 adasdr 2.13
Parentage of "correlation" configs is not well defined, so basically skipped, but
should at least be consistent with parity and the N+1 config - now so.

10/07/12 adasdr 2.12
When final parents are only configuration resolved (CA & Hybrid) then only
bundle-nl (and -n) data was written since resolved final config=parent config+nl,
But, for equivalent electrons, stat weight is not readily available and energy
not well described by parent+nl. So, "re-instate" config resolved final states
for the non-Rydberg bound configs, i.e. the "correlation" configs.

10/07/12 adasdr 2.12
In hybrid case, rename target config file examined to o_str. Thus, user/script has to
ensure an appropriate file is present, c.f. oic->o1 etc. Unlike, TERMS/LEVELS
which can only be target output, an arbitrary file labelled "oic", say, may not be
the ic target one.

06/07/12 asdeck25.8
The DR n-loop did not have very useful default values for NMIN(=5),NMAX(=5) and
JND(=0) and so were always set by the user, which could lead to problems...
New defaults:
NMIN=1+max core/target bound orbital n-value.
NMAX=24
JND(=-99) sets-up a log-spaced n-mesh from n=NMAX+1 to n=999.
JND.ge.0 is unchanged.
NMIN,NMAX can be varied by user as before in an obvious manner.
The n-mesh and its upper limit can be altered by various JND.lt.0 settings - see
comments in SR.ALGEB0 for details.

05/07/12 adasdr 2.11
Hybrid processing (NTAR2.lt.0) now averages over the target configs' terms/levels
in ols/oic to get config. av. energies. Previously, (needed to) read an oca file.

05/07/12 asdeck25.8
Tweaked default TF potential for use with relaxed orbitals in the case of 
autoionization of correlation configs. Previously, like the unrelaxed case,
the bound orbitals were (uniquely) from an (N+1)-electron TF potential.
Now, bound orbitals of the target configs (i.e. N-electron + continuum) default
to an N-electron TF potential. Continuum and bound orbitals of (N+1) correlation
configs still use (N+1)-electron TF potential. 
For the Rydberg case, both relaxed and unrelaxed used N-electron TF potential
for the bound orbitals and (N+1)-electron TF potential for the Ryd/cont.
Relaxed now uses (N+1) for correlation configs as well. Less important here,
since only enters via outer electron stabilization, unless a separate correlation
run was not made, then adasdr will attempt to take it from the Rydberg run.
In the unrelaxed case, the correlation contribution differs between Rydberg
and explicit correlation runs since all bound orbitals use the same N- or
(N+1)-electron TF potentials, resp.
In the relaxed case, the correlation contribution is the same from either
run, any different configuration mixing or scaling parameters aside. Still 
might want to do an explicit relaxed correlation run but an unrelaxed Ryd run.
Any user specification of MRED is in *addition* to the above and *not* a
replacement/over-riding for/of!

04/07/12 asdeck25.8
Change of 26/01/12 asdeck25.6 did not work for relaxed orbitals (BASIS='RLX')
MXORBR was not redefined.

02/07/12 adasdr 2.11
Change default NTAR2 to zero. Then, if not set by user, read all possible from
fixed-format stat. weight info supplied by TERMS/LEVELS - which is the default.
If user specifies old free-format stat. weight input then NTAR2 reverts to old
default, i.e. equal NTAR1, which likely won't be enough for adf09.

28/06/12 adasdr 2.11
Replace I1 by A1 for total L, for case of L>9.

27/06/12 adasdr 2.11
High-charge complex M-shell (e.g. Al-like): target config labelling from channel 
diagonalization becomes inconsistent. Re-use recent (16/04/12) hybrid coding to read
target configs from oca file. Requires LEVELS/TERMS with CF nos to populate adasin,
should be default now unless user using old AS or manual set-up.
Note, since only config labelling needed (not CA energies) can just use the
pre-existing target ols file rather than generate an explicit CA one.
So, code checks for oca or ols (trivially, oic is unnecessary.)

20/06/12 adasdr 2.11
Fixed formatting bug in adf09 write: case JTEMP.gt.20.

22/05/12 asdeck25.8
SR.RADWAV may fail to converge for near-neutral lanthanide 4f (orbital collapse).
Have tried adjusting an e-value search test. "Hopefully" this will not cause a new
problem...

18/05/12 asdeck25.8
Model potential operation (MPSEUD.ne.0) did not determine spin-orbit from potential
derivative when flagged to do so (was not coded.)

14/05/12 asdeck25.7
In extreme cases, some/all e-energies minus ECORE positive, then energy order
sort wrong/reversed.

19/04/12  asdeck25.7
Obscure fix of 12/04/12 caused general problem if uninitialized variables not set to
zero by compiler when there was no NVAR optimization, sigh.

17/04/12 adasdr 2.10
Allow use of (term/level resolved) observed energies when configuration resolved
radiative present/required. This means keeping two sets of parents - one for
the autoionizing terms/levels amd one for the final configurations.
Still not possible to use observed if radiative data is completely unresolved 
(no adf09 then) since final (bound) terms/levels are not present but parents are 
determined by matching to a complete internal set. Could force parent match on energy 
grounds but only reasonable for simple cases, where fully-resolved is not an issue.

16/04/12 adasdr_2.10
If resolved autoionization restricted to initial metastables but energy corrections
wanted for more excited parents then read a target oca file to populate the
configurations labelled in the TERMS/LEVELS file. Then have all info to set-up
complete internal terms/levels table used for parent determination.
(The DR run only contains resolved target+electron terms/levels.)

16/04/12 asdeck25.7
Ensure CAVES/TERMS/LEVELS not overwritten during below operation.

13/04/12 asdeck25.7
Allow user to set LCON=0 in SALGEB. For RUN='PE' this enables the Rydberg nl-loop
without adding any continuum (the default) - for cases where only radiation is
required. (Could be done before, but only by reverting to explicit specification
of Rydberg orbital attached to target, and a dummy unused continuum!)
Does not make much sense for non-Rydberg runs, e.g. 'PI' without the continuum...

12/04/12 asdeck25.7
Obscure bug. If varying an orbital number greater than NLAM, then a non-unit
lambda that is read but not varied may be set to unity. This shows in the
final lambdas. Cannot occur if NLAM.ge.max orbital number varied.

12/04/12 asdeck25.7
Cowan-type scaling of Slater integrals (SCALER) needs to be on one-body kinetic+nuclear
as well for correct asymptotic cancellation.
Also, if FAC='YES' then allow user to override default non-exchange CA potential 
(via MEXPOT). Previously, NX was hard-wired.

10/04/12 adasdr 2.9
Bundled-nl extended (optionally) to match bundle-n. Default still NLMAX=10 for level resolved,
now switched-on by default for term resolved. If CA or final state configuration resolved
then default to all-n (as bundle-n) and for all Ryd LV on file. NLMAX is the max n of
bundle-nl. There is no separate restriction on l - it is whatever is max LV+1 (+1 since
LV can radiation to LV+1.) Any restriction via LCUT/LMAX obviously applies here.
Not obvious why one would need a separate restriction, but could easily be added if so.

06/04/12 adasdr 2.8
LS/IC adf09: NTAR2.lt.0 flags production of configuration-resolved only final states.
The |NTAR2| configuration parents are read from a previously generated CA target oca file.
Most efficient when used with asdeck25.7 development of 30/03/12.
Currently (and for the foreseeable future), there can be no LS/IC fully- or parent-resolved
data (i.e. NTAR2.gt.0!) output in the same file. Just process with adasdr twice if you
want more/usual resolution to complement/as well. The AS data can be a "mixture" of
resolutions. All that is required is that AS has the necessary resolution requested
by adasdr, but it can have more than sufficient.

30/03/12 asdeck25.7
NRSLMX.lt.0 resolve final state radiation by *configuration* only, for configs .le.-NRSLMX.
Normally, set NRSLMX=-MXCONF if .lt.0, i.e. all are config resolved since adasdr
cannot handle a mix. If totals, then set NRSLMX=0 still, then *no* final state resolution.
Recall, NRSLMX.gt.0 fully resolves only for principal n.le.NRSLMX.
Only applies to terms/levels. Ignored by configuration average.
Default, NRSLMX=10000, i.e. all final state radiation fully-resolved.

29/03/12 adasdr 2.7
Tweak bundle-n post-proc radiation l->l+/-1 where l-1 is bound and l+1 autoionizing.
Extend formatting for cases previously too large, e.g. Al-like.

28/03/12 adasdr 2.7
NBIN.lt.0 adf09 temps (K) were not converted back to Ryd for convolution of binned.

28/03/12 adasdr 2.7
Produce CA adf09 file!

23/03/12 asdeck25.7
Minor CA bugfixes.

22/03/12 adasdr 2.6
Use EMAX.lt.0 to flag read of target symm/energy info from external CAVES/TERMS/LEVELS file.

16/03/12 adasdr 2.6
Minor bug-fixes for recent developments.

15/03/12 asdeck25.7
Added CAVES to optional read of target energies to set-up interpolation energies when
EMAX not set, as per TERMS and LEVELS (had missed this in initial implementation of CA).

15/03/12 asdeck25.7
Any user set MRED (to redefine the number of electrons) no longer affects Rydberg or
continuum orbitals. Not normally used for STO potentials since can specify config of 
appropriate occupation numbers to be used. With TF, sometimes want to force N-electron
potential in equivalent (N+1)-electron problem (MRED=1) so as to match N-electron 
target in DR - but no reason to change continuum. Vice-versa (less likely) set MRED=-1
in DR run to use (N+1)-electron TF target orbitals since code automatically uses
N-electron for core and N+1 for Ryd/Cont. Previously, this MRED would mean Ryd/Cont
being (N+2)-electron!)   

15/03/12 adasdr 2.6
Master configs are automatically omitted from DR so user does not need to set JCFJ
as in mdrcs13. But, for now, take such a contribution from the first nl block if no 
equivalent electron case has previously been processed. adf09 needs such a processing. 
If just binned cross sections then it could be done separately, then switch-off via 
JCFJ=-999 (an appropriate JCFJ>0 also works). The point of this is that often
one has all the equivalent electron data in the regular DR run. Saves having
to run and process an additional job. Of course, equivalent electron orbitals are
N-electron rather than N+1 if RUN (='  ') separately. See above MRED comments. 

14/03/12 asdeck25.7
Two forms of polarization potential are available for the structure but only one was 
coded for E1 & PI. (The only one present was used, irrespective of what was asked-for 
- see IPOLFN.) Both are now available for all options.

09/03/12 asdeck25.7
Changed default scaling parameter used for continuum potential in DW operation only.
see comments below for v23.27.2.

24/02/12 adasdr 2.6
Switch uniform partition to epart.lt.0.
Then, epart.gt.0 uses Breit-Wigner distribution with spreading width epart, for CA/LS/IC.

15/02/12 asdeck25.6
Ensure safe operation if min KPOLE changes during RESTART.

01/02/12 adasdr 2.6
Uniform partition over epart of binned DR if epart .gt.0 - for CA.
Add flag to recognize input files from parallel CA AS run, ocauxx files c.f. LS & IC.

26/01/12 asdeck25.6
In ALGEB2, EKALG1, EKALG2, DIAGON, DIAGFS:
MXORB -> MXORBR = MXORB - KCOR2, since closed-shell orbitals do not occur in radiation.
MXORB -> MXORBR = MXORBR - no. of continuum orbitals, unless PI requested.
KPOLE -> KPOLE - min E_k multipole. (Unless Born in use, min=1, but KPOLE+1 allows for
                                     Born monopole even when BORN='NO'.) 
Coding and decoding of NRK adjusted accordingly.
This maximises the maximum addressable I*4 problem.

20/01/12 asdeck25.6
Revert COMMON_DXRL module to I*4 for NRK and let code test when I*8 is needed, then 
inform user to recompile with I*8 in said module. Only needed for very large cases: 
(no. terms)*MXORB*MXORB*(KPOLE+1).gt.2**31 where KPOLE is the max E_k multipole.

19/01/12 asdeck25.5
Missed QMJ.EQ.QMJP in sr.spor0 (pre-specification of spin-orbit interacting Slater states.)
This both speeds-up and reduces the memory requirement (MXSTX) for spor0.
(Results unchanged, QMJ.NE.QMJP were simply a waste of time and space.)

11/01/12 asdeck25.5
Revert COMMON_COEFF, COMMON_DMQSS3 modules to I*4 for NRKP & MSS, resp., and let
code test when I*8 is needed, then inform user to recompile with I*8 in said
modules. Only needed for very large cases: 
(no. levels)*MXSOI.gt.2**31 *AND* M_k>1 (i.e. 1-body).
(no. levels)*MAXMI.gt.2**31 *AND* M1+BP (i.e. 2-body).

11/01/12 asdeck25.5
Allow user to select terms from a spectator sub-shell:
NASTS > 0 READ GAM, NE, (2S+1), L 
          orbital number of sub-shell, occupation number and term, for NASTS cases.
NASTS < 0 READ GAM, NE as above,
          but terms restricted by NAMELIST read of MINSTS, MAXSTS, MINLTS, MAXLTS.
          The default range is all possible, no restriction, i.e. user to set.
(If 2S+1=0 when NAST>0 then terms restricted by NASTS<0 range. Any range set is
 ignored if 2S+1>0. )
It is up to the user to select a meaningful subset of sub-shell terms...

23/12/11 asdeck25.4
Test-code (inactive):
Allow code to determine most efficient order for coupling of subshells when
"parentage" not specified and KUTDSK in use. Reduces size required for DC 
buffer and number of VCCs on disk.
***currently, not used by Rydberg or Continuum configs since need to map
   new QCG position of original last orbital since the last position is used
   to flag such. Once algebra is complete can re-instate original NEL sub-shell 
   order for MINIM branch since then Slater-state phase order no longer needed.

22/12/11 asdeck25.4
Re-organization of Born /NRBRN3/ common to module.

20/12/11 adasdr 2.5
Allow log energy scale for cooler distribution. See ILOG code comments.

08/12/11 asdeck25.3
Energy adjustments post-diagonalization (ISHFTLS/IC.lt.0) were done after
sorting. So, if term/level ordering changed then asymmetric quantities were
incorrect (wrong stat. weight used) and output data was not energy ordered,
which might cause problems for some post-processing codes.

03/12/11 asdeck25.3
Allow user to specify additional (fictitious) configuration occupation numbers
for STO/SCCA operation (NZION.lt.0) when MCFMX.gt.0 by setting a configuration
number .lt. 0. Code then expects to read MXVORB occupation numbers for
these configurations (-1,-2,-3...) next. These can be "mixed" with usual actual
configs. The orbital does not have to be present (occupied) in these
additional configurations. The sum of the occupation numbers does not
have to match the number of electrons in the normal configurations.
This can also be used for cases when promotion rules are being used
to define the configuration set. Then the configuration number is not
known a priori (a preliminary run is necessary) or for cases with long
lists of configurations and it is tedious to hunt for the one with the
occupation numbers required, i.e. one can simply "repeat" it. 

25/11/11 adasdr 2.5
Introduce simple partioning of CA DR cross section over bins of a partition
energy range, centred on the CA resonance energy,  defined by the energy spread
of the parent configuration.

22/11/11 asdeck25.2
Continuum orbital scratch file not being rewound for RUN='DR' CUP='CA'.

18/11/11 asdeck25.2
Move Born COMMONs to MODULE so can ALLOCATE different memory requirements for CA.
Incorporate v24.23 PWB bug-fix.

16/11/11 adasdr 1.11
Tweaked to read CA rate files (oca/u, opca/u) flag via /CA/ in adasin.
For consistency with adasdr, but no capability to make use of yet.

16/11/11 adasdr 2.5
Tweaked to read CA rate files (oca/u) flag via /CA/ in adasin.
Only binned cross sections and total rate coefficients supported by /CA/ so far,
i.e. no CA adf09 file (yet).

16/11/11 asdeck25.1
First implementation of CUP='CA' configuration average option for energies,
autoionization rates, radiative rates, photoionization cross sections, and
infinite & finite energy plane-wave Born.

Archive v24.23/4 for ADAS release.
--------------------------------
20/12/12 adasdr 1.21
If NECOR .gt. 0 then needed to set NTAR2=NECOR, which should be unnecessary for totals
(and undesirable since it starts to set-up resolved final-state indexing etc.). 

06/12/12 asdeck24.24
Fixed two small bugs in DW exchange mixing,
see comments below for v23.27.3.

28/03/12 adasdr 1.21
NBIN.lt.0 adf09 temps (K) were not converted back to Ryd for convolution of binned.

09/03/12 asdeck24.24
Changed default scaling parameter used for continuum potential in DW operation only,
see comments below for v23.27.2.

08/03/12 adasdr 1.21
Revert to using own ERF, ERFC functions rather than rely on compiler library.
Used by Gaussian and cooler distributions only. (Needed for temporary(?) 
support on old systems. So, not in adasdr v2.x, or adaspe, yet...) 

27/01/12 asdeck24.23
Add write of threshold phase shifts to BBGP type-6 adf04 file.

30/12/11 asdeck24.23
Bug fix for use of parent selection in parallel operation.

20/12/11 asdeck24.23
Fix of 27/09/11 was not quite correct and caused FCF6 failure elsewhere.

12/12/11 asdeck24.23
Minor correction to writes by offline ADAS asdeck.

08/12/11 asdeck24.23
In production mode (PRINT='UNFORM') suppress warning messages when finite energy
PWB interpolation becomes extrapolation. 
Limit screen writes to one time only during non-production mode.

18/11/11 asdeck24.23
Finite-energy Plane Wave Born (BORN='YES') lost some monopole contributions
(due to change of 13/10/11) if NMETAJ was not user set (& NMETA if CUP='LS').

29/10/11 adasdr 2.5, adasrr 1.11, adaspi 1.15, adaspe 1.15
Updated CHARACTER/INTEGER compatibility for gfortran and g95.
Also adasdr 1.21 for public distribution. adasdr v2.x is still "private".

28/10/11 asdeck24.23
Incorporated ADAS variant of HPS.

21/10/11 asdeck24.23
Break-up RESTART writes to try and keep record length less than 2Gb.
Flag if look to exceed this. Recall, RESTART not available for RUN='DE'.

21/10/11 asdeck24.23
Re-activate old dimension test switches to access current partial dimension test
operation. Historic "full" dimension test had been removed since it was only
slightly faster and inflated certain dimensions. The "new" partial one does
not inflate.

20/10/11 asdeck24.23
Introduced NMETAR/J in &SMINIM to specify resolved Augers in place of EIMXLS/IC.
This requires that the target TERMS/LEVELS file exists. Exact energy match not
required with Auger run but the greater the mis-match the greater the likelihood
that you will get more/less resolution than asked for. (Switches on summing of
radiative rates as before since all NMETAR/J does is set EIMXLS/IC based on
TERMS/LEVELS energies. Recall, can't use energy order for Augers as they are
calculated on-the-fly at the same time as the e-energy diagonalizations.)

18/10/11 pasdeck24.23
In dwxls/bp make call cpu_time BEFORE call comm_barrier, else all dwxls/bp times
reflect that of the slowest processor. (Final CPU TIME will still reflect it.)

13/10/11 asdeck24.23
Speed-up finite energy PWB for case of NMETA/J << no. of TERMS/LEVELS.
(Born multipoles are stored on scratch and read back to sum. Old code read
scratch for ALL possible transitions to see if there was a Born multipole on disc.
Trivially, there can't be for transitions with the lower state above NMETA/J!)

11/10/11 asdeck24.22
Do not write energy level in for unresolved (true) bound states, when summing.

10/10/11 adasdr 2.4
Further mod to handle reduced energies from summed Auger rates, as per autos below.

07/10/11 asdeck24.22
Do not write energy level in for target continuum summed-over.
Only write energy level info for one LCON partial wave per target continuum.

02/10/11 asdeck24.22
Sum over LCON partial waves of target continuum .le. EIMXLS/IC, in addition
to sum over target continuum .gt. EIMXLS/IC. Thus, the target continuum are still
resolved but there is no info on the level (or config) so cannot select by in adasdr.
A level number is written but it is just the last one that was summed. This is
needed by adasdr to flag the specific NTAR target continuum. 
(Could write the last CF, it would be "correct" for the N-electron target.
Then could select by JCFA - currently CF=0 is written so all "pass".)
Default, EIMXLS/IC .gt. 0 and there is no sum over LCON.

01/10/11 asdeck24.22
From asdeck v24.3 onwards the target energies written to OMGINFLS/IC for the
columnwise block (the second block) were zero.

29/09/11 adasdr 2.4
Modified to handle the summed rates from AS just described below.
Note, if radiative rates to true bound states are summed then adf09 is
currently incomplete since parentage is lost and this is needed for bundled-n etc.
Can sum over all Augers (.gt.NTAR1) as well as radiative to autoionizing states
without affecting adf09.
If only total DR is required then can sum over all radiative rates and all Augers,
save for the NTAR1 targets.

29/09/11 asdeck24.21
Sum rates to lower states (upper still fully resolved): Auger rates to all
target continuum .gt. EIMXLS/IC (absolute Ryd) are summed over and only 
this total is written to the rate files (olg fully resolved, if printed) along 
with appropriate labelling for unresolved lower state. (If EIMXLS/IC .lt. 0
then) radiative rates to all final states above EIMXLS/IC are summed also.
Those below are also summed if n.gt.NRSLMX (default 10000, i.e. no additional)
or lower state energy index exceeds LLOWX/JLOWMX (default, no restriction.)
The radiative sum is partitioned between those to true bound and autoionizing 
lower levels.
***Currently, only ADASDR can handle these summed rate files.***
Default, EIMXLS/IC .gt. 0 and all are fully resolved and LLOWX/JLOWMX etc act
to exclude still.

27/09/11 asdeck24.20
If (neutral high-L, small-E) continuum wavefunction is "zero" across the
radial integral extent then should not abort if the inner turning point not 
yet reached, i.e. this is correct, to within machine representation.

20/09/11 asdeck24.20
Add more timing info.

16/09/11 adasdr 2.3
Enable quick threshold sensitivity check by shifting binned cross sections
down by nbins bin widths when reading ocs file (nc>0). The bin energy
average is adjusted for the new bin energy.

16/09/11 adasdr 2.3
Target binning re-introduced in v1.20 did not work in 2.x.

15/09/11 adasdr 2.3
Make all large arrays ALLOCATABLE. Although dimensions are hardwired,
adf09 specific memory is not ALLOCATEd when only binned cross sections
are being computed. Also paves the way for a dynamic approach if one has
NDIM7/NDIM12=NUMR/NUMA dimension info from the AS run.

14/09/11 adasdr 2.2
Re-organize DIMENSION statements.

13/09/11 p/adasdr 2.1
Created padasdr, for which there is a one-to-one correspondence between the 
rate files being read/processed and the number of processors. Most useful for
use in conjunction with pasdeck, which generates such. A single ocs/XDRTOT
is written, the binned cross sections being gathered back to processor zero
before writing/convoluting. adasout and adf09 files are separate. So, adf09
not directly useful without an ADAS adf09 merger. Like p/asdeck, there
is a single source code with parallel specific code un/commented, as necessary
to generate the serial/parallel versions. That way future serial developments are
automatically available to the parallel "version", unless otherwise specified.

07/09/11 asdeck24.19
Speed-up Auger mixing of initial state for each unmixed final state.

02/09/11 asdeck24.19
Assignment of e-vector labels based on component became time consuming due
to n^2 sorting n times. Use a Heapsort algorithm then n*log(n) sorts n times.
(This compares to n^3 for diagonalization.)

31/08/11 asdeck24.18
Determination of position of relevant LS interaction contribution to H(BP) was
slow following 24.17 re-organisation.

30/08/11 asdeck24.18
Minor bugfix.

29/08/11 asdeck24.18
DW operation: 
If user set MXAJS=-1 to flag code to determine dimension internally (F95) then 
2-fs collision algebra pointers are undefined. They are correctly dimensioned
and are subsequently correctly accessed. Outcome is compiler dependent. If 
initialised to zero then results are identical to "off" (KUTSSX=-1); if to some
random integer (usually large) then get opaque error message: MXD13 dimension exceeded.
*** 2-fs target (KUTSS) was unaffected.

Also, move MXADJ/MXAJS dimension tests from SR.SYMLSJ to SR.ALXFS since only
required if 2-fs is "on" (KUTSSX=-9, say). Affects F77 only as F95 always
ALLOCATEs what's needed. If "off" then never ALLOCATEd in the first place

26/08/11 asdeck24.18
Switch various Slater State COMMON to ALLOCATE so can be DEALLOCATEd to save memory.

*** End major re-organization of DIAGON/DIAGFS to reduce memory requirement for 
bound-continuum problems.

25/08/11 asdeck24.17
Can skip all b-c H(BP) j-pointers if no 2-fs, just require ls-pointers (to H(BP)).

24/08/11 asdeck24.17
Minor bug-fixes following running of test-suite.

23/08/11 asdeck24.17
"Re-instated" some original code (v24.8) when this new development not needed,
i.e. no Augers/PI, since simpler (and tad faster) if know there is no b-c etc
partitioning to work with.

22/08/11 asdeck24.16
MAXDI and MAXDK are now completely ALLOCATEd. They need/should not be user set
(except to limit memory). LS mixing array de-allocated after DIAGON if no TECs
used in DIAGFS. Also a rank 2 PI array moved to allocate (so not if only Augers).

20/08/11 asdeck24.15
If no PI, then now overwrite c-c mixing coefficients once Auger rates have been
calculated for a given symmetry since only need b-b' for radiative rates - do 
need buffer memory to hold c-c for a single symmetry for calculation of Augers.

19/08/11 asdeck24.14
Only store non-zero mixing coefficients.

18/08/11 asdeck24.13
Remove An H-array and replace with H/2, and which is now only allocated if printing
(PRINT='FORM'). See DU, DV, TFU.

17/08/11 asdeck24.12
Re-organize diagonalization HDIAG package, remove use of a rank 2 array.

16/08/11 asdeck24.11
Remove explicit reference and pointers to null mixing coefficients i.e. bound-continuum
and continuum-continuum (Memory still set aside.)

15/08/11 asdeck24.10
If no 2-body fine-structure then bound-continuum autoionization S'l'J'-SLJ is subject to
S'=S, L'=L. Memory indexing now takes this into account. (Memory still set aside.)
Remove an explicit pointer array to bound-continuum autoionization interactions since
can be deduced implicitly on-the-fly.

05/08/11 asdeck24.9
Remove explicit indexing of continuum-continuum' interactions, start to remove such
memory set aside. 

*** Begin major re-organization of DIAGON/DIAGFS to reduce memory requirement for 
bound-continuum problems - much of this is available in f95 only since memory is
dynamically adjusted depending on the actual runtime problem. Changes also
made to MINIM (for DIAGON), HDIAG, and ALGEB2 & ALGEB3 so dimensions sync.

16/07/11 asdeck24.8
Determine structure one-body spin-orbit Slater-state interacting pairs a priori.
Not used if two-body fine-structure present.

30/06/11 asdeck24.7
Initial KUTDSK implementation uses the smallest practical amount of memory.
Buffer space is required to hold VCC's for a pair of SL groups for a
pair of configurations. This gives rise to much re-reading, especially in IC.
New implementation (KUTDSK=mod(KUTDSK,1000), i.e. KUTDSK=1000 all CF's on disk with ***V27.124 KUTDSK=10000
new method) stores VCC's for *all* configurations of one or more SL groups.
LS structure holds one SL group at a time (all CF's), so no re-reading
IC structure holds all SL groups for one Jp group at a time. So, re-read for each Jp.
LS radiation holds initial and final SL-group pair at a time. So, final re-read.
IC radiation ditto LS, per Jp, J'p' pair. So, initial re-read (as well) for each Jp.
A substantial reduction in I/O can be achieved using this new option, at the expense 
of a larger buffer requirement. It is up to the user to determine the optimum
approach for their problem and CPU resources viz. memory (CPU/disk) I/O speed
vs CPU speed/time for problem etc.
TBD: collision problem. (Don't know if will ever need as collision problem may be too 
demanding by time need to use disk for target - orig. implementation is present here.)

05/06/11 asdeck24.6
RUN='DE' and CUP='IC' and no collisional 2-body fine-structure requires less 
Slater states than the (spin-orbit mixed etc.) IC target. The code automatically
reduces to the minimal set (and discards corresponding unneeded VCC's.) But, could
not do so if some/all VCC's were on disk (KUTDSK). This reduction has now been
implemented for VCC disk usage as well.

31/05/11 asdeck24.5
Bug-fix for RUN='BBGP'.

30/05/11 asdeck24.5
Output adf04 file with 2I5 transition index if number of levels .gt. 999.
Retain 2I4 for backwards compatibility and existing post-processors if .lt. 1000.
(ADAS utilities do not read fixed-format, the columns need a blank separator.)

23/05/11 asdeck24.5
Introduced KUTDSK: all configs .gt. KUTDSK have their DC array VCCs stored on 
disk, those .le. in CPU memory still. Obvious, default is all in memory.

21/05/11 asdeck24.4
Implemented use of disk storage of VCCs, rather than internal (DC) array.
Currently, either everything is stored in memory (default) or on disk.
There is no facility to mix and have some (permanently) in memory and the "rest"
on disk. The DC array is still used as a buffer during their computation and
to hold them as they are read back from disk (bit-by-bit) as they are needed.
The same VCCs may be re-read many times. It remains to be seen whether the I/O
becomes prohibitive in large cases where this option is designed for. Currently, 
the file used is named (DISKDC) but deleted at the end of a job, unless
RESTART is in use, and then it is kept.
Note:
Free-free collision problems (e.g. RUN='DE') only use it for the
target since the N+1 VCCs are calculated on-the-fly and so DC memory is
only limited by that required by the target.

19/05/11 asdeck24.4
Obscure (may have only been so in a test version - can't see it archived):
If non-default VCC generation used (i.e. the original method which stores zeroes)
then 2-body BP corrections to M1 were incorrect/not computed as the original method
was commented-out still. So, the new method (store only non-zeroes) was "used" and
so result depends on what was in the incorrectly accessed locations. It is unlikely
that anyone knows how to switch-on the original operation. It is mainly for my checking.

11/05/11 asdeck24.3
DW operation: 
Write a standard (i.e. R-matrix style) OMEGALS/IC file by default. Since the energy
is that relative to the upper state (as opposed to the ground) flag it via setting
the number of scattering energies less than zero. The following utility programs:
xtrct, om2omu, omu2om, omgmrg, omgmrgp
have been modified to recognize this negative index, and adjust energy if necessary.
They have also been coded to make all memory ALLOCATABLE (omgmrgp was already so).
Others could be done but these seem the most likely needed - & possibly omadd.f (TBD).
These are stored under the /autos directory with the suffix .f95 so as to avoid
confusion with the fortran77 versions (.f) stored under /rmatrix. (/rmatrix omgmrgp.f
is f90/f95 compatible but not free source and so the .f95 suffix is not applicable.)
To avoid path confusion, the user should store .95 executables as .x95 say, or cease
use of the old /rmatrix .f versions.
***********************************************************************************
UPDATE: This (RM style OMEGA) is not particularly useful since it is based on final
scattered energies and so adasex/j cannot read it. Instead, adasex/j v2.x onwards
can read the adf04 type 5 omega file written by AS (and type 1) and convolute them.
So, although the .f95 versions are "nice", they are not actually needed as such.
So, have removed them from web and AS dir. They are archived under rmatrix dir.
***********************************************************************************

10/05/11 asdeck24.2
For KCUT.gt.0: when pseudo-orbitals in use (lambda.lt.zero) reduce the accuracy of the
PW Born integrals (including infinite energy operation) depending on how many of the
4-electron arguments are pseudo, and the multipole value. If all spectroscopic then
no change in accuracy. The greater the number of pseudo orbitals in the Born
integrals then the less that they contribute to the spectroscopic transitions
(via mixing) and hence less accuracy required. Large RMPS style targets are
very time consuming - this produces about a factor of 3 speed-up.
Note 1: if want this speed-up without any KCUT restriction, set KCUT=MXCONF value.
Transitions to pseudo-states will be inaccurate.
Note 2: if don't want this approximation then currently cannot set KCUT. Likely
of little practical interest since it makes no sense to operate KCUT on pseudo
configs if looking at direct transitions to them since they are highly mixed.
Restricting just spectroscopic configs is not likely to save much time then.

06/05/11 asdeck24.2
If greater than default (NLAG=2) Lagrange interpolation formula used then may get
extrapolation warning as not enough interpolation energies flagged for use on the
high energy side.

04/05/11 asdeck24.2
Introduce simple RUN='BBGP' switch to flag type-6 adf04 partial threshold collision
strength operation - see 27/04/11. This resets RUN='DE' and LVMAX=8. LVMAX (and
LVMIN) can still be overridden by user.

04/05/11 asdeck24.2
Allow user to override with BORN='NO' in cases where OMGINF/adf04 files are being
written. Then the Born limits have a dummy value of 1.E+30. Useful for large
pseudo-orbital expansions since this leads to a huge number of Born integrals
(time consuming). Ultimately, need the Born limit if going to Maxwell average,
although codes could detect this dummy value and switch to using the highest 
energy(s) collision strength to set the limit e.g. extrapolate assuming constant.

29/04/11 asdeck24.1
DW operation: 
When STO MCFMX=0 (default) allow user to specify target config to be used for the
occupation numbers to be used to generate the STO potential for the continuum basis.
Like specifying a non-default lambda, it uses orbital location MXORB+1 to load.
So, set MCFSTO(MXORB+1)=CF in &SMINIM. MCFSTO is the array which holds the MCFMX>0 input.
For DW (but not DR) the code averages over all target configs to get the continuum
STO potential if MCFMX=0. This is not good if a large pseudo-state target is used.

29/04/11 asdeck24.1
DW operation: 
High partial wave orbit-orbit collision algebra was omitted by Fortran95 version.
This occurred where the algebra is scaled from lower partial waves (i.e. high-L,
non-exchange). The MODULE was missing and the original COMMON was still present,
minus the Fortran77 flag and so no compile error. Graceful but opaque exit.

28/04/11 asdeck24.1
DW operation: 
LVMAX: discard unused Sp symmetries of the highest  L - initial selection by MAXLT
gives all Sp for the L. For the highest L(s), there are channel interactions l,l'
with both l,l'>LVMAX and so not needed. These are simply discarded at the DW stage.
Could drop at ALGXLS but tedious to adjust pointers (c.f. correlation) and probably
not worth the effort here.
LVMIN: same applies as above for LVMAX, but normal usage is LVMIN=0 and there is
nothing to drop then.

27/04/11 asdeck24.1
DW operation: 
Introduced LVMIN and LVMAX for RUN='DE' operation - these are the min and max orbital
angular momentum values of a threshold/Rydberg electron for which partial collision
strengths are resolved into a new style (type-6) adf04 file. Here, l=LVMIN,LVMAX,1
replaces the temperature/energy values of a type-3/5 file. Only zero final scattered
energy is run. The user need only specify LVMAX for this new option to take effect.
This is one half of an adf46 driver for the Burgess-Bethe General Program (BBGP)
for DR of complex heavy species. The other half is an adf04 file for the
recombined ion, which only needs to be for any required resolved low-lying structure,
i.e. collision data is not relevant. The program "process_adf04_adf46" will merge 
the two and add relevant default driver info for BBGP - being developed by Hugh.

20/04/11 asdeck24.1
Print warning earlier when illegal DW J-value requested (via INASTJ.gt.0).
Previously, not done until after LS collision algebra calculated, which can take
several hours in complex cases - a tad annoying then.

Now start post-CPC changes...with v24.x (except for bug-fixes, to be submitted):

CPC---CPC---CPC---CPC---CPC---CPC---CPC---CPC---CPC---CPC---CPC---CPC---CPC---CPC---CPC---

09/03/12 asdeck23.27.2
Changed default scaling parameter used for continuum potential in DW operation only.
(Bound-continuum problems are the historic 1.0.) Was 1.3, now min(1.3,1.0+0.1*z);
i.e. 1.0, 1.1, 1.2, 1.3 for 0+,1+,2+,3+ and higher charged ions. So, only
neutral and singly/doubly charged case has changed. The 1.3 default was chosen
based on L- and M-shell studies for multiply charged ions. It is too aggressive
for near neutrals, giving rise to wide physical peaks, as shown by DCG for Mo+. 
Note: the user can always set the (unique) lambda continuum for DW via reading 
NLAM=KCOR2+MXVORB+1 lambda values, the last position is used for the continuum.
(In bound-continuum problems this is more explicit and one can read-in
 NLAM=KCOR2+MXVORB+LCON values.) The actual value used is printed to the olg 
file after details of the interpolation/scattered energies.

07/12/11 asdeck23.27.1
Parallel DW operation: 
Fix for ISHFTIC=-1 and degenerate energies or level ordering changed.

29/08/11 asdeck23.27.1
DW operation: 
If user set MXAJS=-1 to flag code to determine dimension internally (F95) then 
2-fs collision algebra pointers are undefined. They are correctly dimensioned
and are subsequently correctly accessed. Outcome is compiler dependent. If 
initialised to zero then results are identical to "off" (KUTSSX=-1); if to some
random integer (usually large) then get opaque error message: MXD13 dimension exceeded.
*** 2-fs target (KUTSS) was unaffected.

06/05/11 asdeck23.27.1
DW operation: 
If greater than default (NLAG=2) Lagrange interpolation formula used then may get
extrapolation warning as not enough interpolation energies flagged for use on the
high energy side.

29/04/11 asdeck23.27.1
DW operation: 
High partial wave orbit-orbit collision algebra was omitted by Fortran95 version.
This occurred where the algebra is scaled from lower partial waves (i.e. high-L,
non-exchange). The MODULE was missing and the original COMMON was still present,
minus the Fortran77 flag and so no compile error. Graceful but opaque exit.

CPC---CPC---CPC---CPC---CPC---CPC---CPC---CPC---CPC---CPC---CPC---CPC---CPC---CPC---CPC---
04/04/11 asdeck23.27 *** bugfix submitted to CPC (prior to publication) ***
DW operation:
Specification of correlation target terms/levels by energy caused incorrect
indexing of non-exchange Coulomb interaction. Code exited gracefully but opaquely.
***The usual algebraic specification of correlation by KCUT was unaffected. 

CPC---CPC---CPC---CPC---CPC---CPC---CPC---CPC---CPC---CPC---CPC---CPC---CPC---CPC---CPC---
25/02/11 asdeck23.27 *** revised submitted to CPC ***
Minor.

23/02/11 asdeck23.27
DW operation:
If a BP run, then the target requires a larger set of Slater states than are
subsequently required by the collision run for configs with no collisional 2-FS.
The target Slater state expansion is now reduced accordingly once the target
angular algebra has been computed.

20/02/11 asdeck23.26
DW operation: 
1/If KCUT set and there existed a configuration consisting of a single
nl^q sub-shell (outside of any KCOR1,2 closed-shells) then its structure
did not match that of a non-DW run as some Slater states were omitted...
2/Correlation configurations which gave rise to no terms/levels could cause DW
operation to crash - now exit gracefully. User needs to remove them for now.
They pass silently through a structure run but re-pointing of Slater states
for a collision run currently assumes at least one Slater state exists.

17/02/11 asdeck23.26
DW operation: 
1/Energy pairs were being used which could not contribute to the scattering 
as the energy difference exceeded the max excitation energy, and by
more than required for interpolation. The resulting speed-up from their (now)
initial omission is not just in determining the radial integrals but in the
CI mixing and jK-recoupling as well since these are all a function of the
number of energy pairs. Final collision strengths are unchanged from v23.24.
2/When characteristic excitation energies were used to set the interpolation
energies some legacy interpolation energies were added which are not required
according to the specified algorithm viz. the initial interpolation energies are 
the (set of) final scattered energies plus the (set of) specified excitation energies. 
(The legacy energies resulted from subtracting.) If the separation between 
scattered energies exceeds twice the max. excitation energy then they could not
be used. If less, then a legacy energy could be used in place of, or in addition
to, the one prescribed by the algorithm. While these extra energies could result
in more accurate interpolation, there is (now) no logic to their positioning.
If greater interpolation accuracy is needed then this is much more efficiently
obtained using one of the prescribed algorithms, e.g. with an additional
characteristic excitation energy. So, final collision strengths may be changed,
but likely only by a measure of the accuracy of the interpolation. No other 
interpolation algorithm is affected and so its collision strengths are unchanged

13/02/11 asdeck23.25
Introduced relativistic corrections into the long-range integral suite.
Necessary for correct cancellation between inner- and outer-region contributions
to high energy dipole photoionization integrals when relativistic wavefunctions
are in use and Rydberg state approximated by zero energy continuum.

31/01/11 asdeck23.24
DW operation: 
Test use of interpolation by log(E) for dipole transitions. Currently switched-off.

21/01/11 asdeck23.24
DW operation: 
Flag any unused interpolation energies.

14/01/11 asdeck23.24
DW operation: 
Tweak max exchange multipole & L combination. More accurate at high-E, but
slightly slower as a result.

13/01/11 adf04_om2ups.f
Untied levels (levels with no excitation data) terminated run. For standalone
operation print warning and proceed. 

12/01/11 asdeck23.24
DW operation: 
Missed "obvious" factor of 2 speed-up in BP DW H(N+1) formation when exchange
is off - then K is conserved! Note, if NMETAJ is small then the time is likely
dominated by the update of the continuum basis & integrals, unless there is a
large CI expansion. 

22/11/10 adasdr 1.20
Re-instate "historic" specification of initial targets states by bin energies.
This enables averaging over levels of the initial ground term or terms/levels
of the ground configuration. Set IRD.lt.0 in &ONE to read (old-style)
free-format bin energies and stat. weights i.e. *not* TERMS/LEVELS file format,
which is still the (IRD.gt.0) default. See &ONE input data comments in the code.

13/11/10 adasdr 1.20
Allow user to set TOLBE to override use of internal target energies in
determining energy corrections, i.e. revert to using user supplied calculated
energies. For cases where user has set a consistent difference between
supplied calculated and observed, but calculated do not match internal.
For special and/or historic (pre v1.17) cases.

CPC---CPC---CPC---CPC---CPC---CPC---CPC---CPC---CPC---CPC---CPC---CPC---CPC---CPC---CPC---
03/11/10 asdeck23.23 *** submitted to CPC ***
Following extensive compiler checks (thanks to all concerned) viz. SUN, NAG, PGI, 
Intel, IBM, SGI, GNU (gf95/gfortran) etc. one buglet fixed and "cosmetic" changes
to remove obsolescent code.
gfortran: use v4.5 or later
g95: compile with -fsloppy-char (this avoids a runtime "error" mixing integer/character)

Note, there are timing switches "BTIME" and "BTIMEX" in SALGEB which provide more
detailed timing info for "structure" (inc. DR/RR etc.) and "DW" excitation, resp.
The structure timings are for algebra only - subtract from total for the rest -
while DW timings are for algebra and integral evaluation etc.
They both default to .FALSE. now. (During DW development, BTIMEX default was .TRUE.
The info comes to screen by default (IW=0) but setting IW=6 (in SALGEB) routes it 
to olg (hopefully).

27/10/10 asdeck23.23
Minor bug-fixes following extensive local testing, esp. of DW.

30/09/10 asdeck23.22
Default (NMETAJ.gt.0) neglects DW 2-fs between excited levels that at
most spin-orbit mix with the metastable levels. 
User input nmetaj.lt.0 includes all allowed by angular momentum selection.

29/09/10 asdeck23.22
Default interpolation energies now slightly different in BP. Previously,
they were identical to an LS run (based on LS structure). But since only
LS or BP is computed, they need not be the same. Likely just aesthetic, but 
highest LS energy.lt.BP so there was a small amount of extrapolation.

11/09/10 asdeck23.21
DW 2-body fine-structure integrals now computed (finally!)

04/09/10 asdeck23.20
Re-organized continuum basis generation for evaluation of DW fine-structure
integrals (requires a larger partial wave expansion per J than NFS.)

27/08/10 asdeck23.19
Bug corrected in DW 2-nfs integral evaluation when the two continuum
orbitals had the same orbital angular momentum but different energies.

25/08/10 asdeck23.18
Add element symbol to adf04ls/ic (instead of XX).

24/08/10 asdeck23.18
Write of configurations to adf04ls/ic and the adasex/j.in.form support files
was not Eissner or Standard Configuration format. This means that
automatic ADAS processing was not possible. With DW, need to have
adf04 integrated seamlessly with ADAS. Changed configuration format
to Standard. Related, modified adasex/j.f so that they could read
new style (as well as old style still) including extended range, which
they couldn't do before. They just write what they read i.e. they
do not covert old style to new.

09/08/10 asdeck23.17
Normal Rydberg configuration operation uses one nl at a time and so is
not sensitive to a dn=0 line strength being mixed with a dn>0 transition,
for example, np->(1s+ns). This is fine for transitions to a small set of
low-lying states. If a large number of Rydberg configurations are included
at the same time then there is a tendency for the mixing between them to
be overestimated. To allow such a CF expansion, but approximate as
treating singly, we neglect mixing between configurations with a different
Rydberg orbital. Mixing within a core-expansion+Rydberg is still included,
e.g. 2s^2nl+2p^2nl ^1S parent. Such Rydberg orbitals must be flagged by the
user on the orbital (re-)definition line by n>60, the actual value used
is then mod(n,60). The maximum n-value is then mod(79,60) because 80 onwards
flags dummy "DR" Rydberg orbital for looping over. (If radwin is in use then 
the max-n is mod(69,60).)

02/08/10 asdeck23.17
Fix for gfortran - reading a file for which have already reached EOF.

01/08/10 asdeck23.17
Added "fix" for comparing with R-matrix energies where R-matrix assumes a common
closed-shell core even though we don't have one - this is the classic K-shell
hole problem in Li-like ions. R-matrix assumes 1s^2 closed shells by default
when determining Blume & Watson. The R-matrix "fix" is to force zero closed
shells. The AS "fix" is to use 1s^2 closed-shell for Blume & Watson, even
when KCOR2=0. This is achieved in &SMINIM by setting a new variable IBWRM=K,
where K is the desired "KCOR2" to match R-matrix (which may not be obvious,
since R-matrix SPNORB is somewhat opaque in its decision making.) This
actually gives better energies for 1s^2nl since 1s^2 screening is correct,
but K-shell hole is not so good (B&W) but its energies are highly uncertain.
For this reason, or simply because default R-matrix B&W was used, one needs
to be able to generate a consistent structure from AS, especially to avoid
level swapping (e.g. for OMGINFIC).

30/07/10 asdeck23.17
Synchronized the value used for the speed-of-light/fine-structure constant
throughout the code! Use 137.03599976 & 7.2973525333E-3 for GRASP0 consistency.

23/07/10 asdeck23.17
Extended use of PJS's ITANAL coding. Recall, setting ITANAL.gt.0 in &SMINIM
causes printing of the energy contribution of each term to the lowest ITANAL 
term energies, and flags which configurations contribute at least ECNTRB(/cm)
to at least one of the ITANAL terms. Now, write a file "ITANAL" of all
terms which do *not* contribute at least ECNTRB to at least one of the
(spectroscopic) terms lying within the lowest ITANAL terms. By definition,
all spectroscopic terms within ITANAL do contribute ECNTRB! Any spectroscopic
term above ITANAL must satisfy the same condition as a correlation term.
Any correlation term within ITANAL cannot satisfy ECNTRB via itself or any
other correlation term. It is not necessary to set KCUT. ITANAL then acts
like a correlation flag. The point of this is that the algebra has been coded
to read a previous ITANAL file, if the user sets ITANAL.ne.0 in SALGEB now,
and so does not generate these terms in the first place (nor the Slater-States,
nor the VCC's etc. i.e. can use much larger CI expansions). The ITANAL file is
quite flexible and can be built up from multiple runs since its use only
requires the configuration nl^q... specification and the AS position of the
term within the configuration, i.e. the configuration list in the AS WRITE
run does not have to be the same as in the AS READ run. It might be more
efficient to have listed only those terms to be retained, especially in large
cases, but the current way "fails safe". Every term is included  unless
it is explicitly listed for omission. The reverse is dangerous, one has to
ensure that everything that is wanted is listed - you can be sure mistakes
will be made. This reverse case may be coded as an option in the future if
the current does not scale tolerably.
Note 1: the (non-zero) value/sign of ITANAL in SALGEB is currently irrelevant,
it is just on/off for non-zero/zero. But best to use .gt. 0. May use .lt.0 to
flag another option in the future.
Note 2: ECNTRB can also be set (smaller) in SALGEB and then terms that would
have been dropped are now retained. Thus, a useful strategy is to set ECNTRB
reasonably large in &SMINIM to write the file ITANAL then re-rerun reading it
with various ECNTRB in SALGEB to assess the sensitivity of energies and rates.
Note 3: if one sets ITANAL .lt. 0 in &SMINIM then file ITANAL is still written,
based-on a -ITANAL terms analysis, but the UNIT6 writing of all the components
is suppressed.
Note 4: can be used in "DR" mode. ITANAL must be constructed in non-DR mode
from N-electron and N+1-electron configurations. Then, in DR-mode, the MXCONF
configurations make use of the N-electron info and the MXCCF configurations 
make use of the N+1-electron info.

19/07/10 asdeck23.16
Introduced IZESP spin-orbit screening parameters ZESP(L), for A.M. L=1,|IZESP|,
to be read in &SMINIM (IZESP and ZESP). For L.gt.|IZESP|, ZESP(L)=ZESP(|IZESP|).
IZESP>0 and the nuclear Z0 is screened, i.e. Zeff=Z0*ZESP(L) for orbital A.M. L
        and any Blume & Watson (or potential derivative) contribution is zeroed.
IZESP<0 then the Zeff screened by Blume & Watson (or potential derivative)
        is further "corrected", i.e. Zeff'=Zeff*ZESP(L).
IZESP=0 usual Blume & Watson (or potential derivative) and no further correction.
For use when two-body fine-structure interactions are partly or wholely off
and Blume & Watson (or potential derivative) alone is not sufficient to
reproduce (theoretical) fine-structure splitting, e.g. due to deep holes
in the core or promotions out of the core.

15/07/10 asdeck23.16
Introduced ab initio configuration average energy correction c.f. FAC. Set
  ICAV.ne.0 in &SMINIM to switch-on. Then a self-consistent configuration
average set of orbitals is calculated, one configuration at a time using
said configuration occupation numbers, and the configuration average
energy determined. Then the usual user-specified unique orbital basis
calculation is carried-out and the configuration average energies determined
again using this unique basis. The difference between the two "corrects"
the diagonal of the Hamiltonian. While any of the usual unique orbital
basis options can be used in combination with this correction, using 
previously minimized scaling parameters is not likely to lead to any
improvement. The main use is likely in conjunction with orbitals that
have not been optimized, for whatever reason,  e.g. complex species.
(It is possible to use this correction during the usual optimization
procedure, but it is likely unstable or lead to extreme values for
scaling parameters, for which while energies may be reasonable, any
other quantity should be viewed with caution.) To this end: 
  ICAV.gt.0 sets suitable defaults to generate a unique self-consistent 
configuration average set of orbitals using occupation numbers averaged 
over all spectroscopic configurations. (This range of configurations can
be specified explicitly via -MCFMX, i.e. the default is MCFMX=-KCUT.)
  ICAV.lt.0 expects the user to specify the unique orbital basis determination
method, which need not be self-consistent, e.g. STO.
This is the poor man's relaxed orbital approximation for when the full 
relaxed orbital option becomes too demanding radially. 

02/07/10 adasdr 1.20
Minor fix.

27/06/10 asdeck23.15
Use INTEGER*8 for M_k index to allow large cases where it (M1+BP) exceeds 2G.
(This was done some time ago E_k.)

23/06/10 adasdr 1.20
Array out of bounds when NTAR2 "unnecessarily" inflated for near-neutral
complex ions by the estimate that a bound state exists attached to a high 
parent. This has been fixed, and this STRONG WARNING test no longer stops 
and so one is not forced to inflate NTAR2 to the max possible. Of course,
if NTAR2 is really too small then there will be a subsequent failure...
swings and roundabouts. (The large NTAR2 leads to large NDIM0 and
large memory - 10G - and slow execution, processing 100s of parents
that are not needed, so it is best not to inflate.)

18/06/10 adf04_om2ups 
Comments written to type-5 input file adf04_om by AS are now passed thru to 
type-3 output file adf04_ups (PB). Also, since AS cannot determine the IP,
and so writes zero, now only flag invalid IP but still produce adf04_ups
since it is tedious to keep having to edit adf04_om. Only do so then for
final archiving.

17/06/10 asdeck23.14
S.S. configuration input did not exit gracefully if insufficient buffer
space to read-in all configs. (v21.x and earlier had a larger buffer.)

03/06/10 asdeck23.14
Test for INTEGER*4 overflow if large number of BP corrections to M1 and/or
user sets MXSOI/MAXMI excessively large.

28/05/10 asdeck23.14
Change LS default to: NMETA=1 - ground term.

27/05/10 asdeck23.14
Default structure operation is to compute transition data between all 
non-correlation terms/levels. In a scattering problem (RUN='DE') one may
have transitions from a few metastables to a large number of excited states.
Transitions between excited states are ignored (efficiently) in the scattering
calculation. However, 'twas not so in the structure. For half-open d-shells or 
excitation to high-n, magnetic radiation or Born limits, respectively, become 
increasingly time consuming if computed between all states. The definition 
of metastables is energy dependent but magnetic algebra and Born limits
are computed before the energy is computed (all algebra and radial integrals
are computed before the Hamiltonian set-up.) To bootstrap the problem, the 
user should carry-out a fast energies-only structure run. Then, the resultant
TERMS/LEVELS files can be read-back in by a collision calculation via the new
TARGET='OLD' SALGEB NAMELIST variable (default is TARGET='NEW' - TERMS/LEVELS
files are written). Only the metastable symmetries are used so it doesn't
matter if the energies are exactly the same as in the collision run, i.e.
one can re-run the collision problem with different structures without
regenerating new TERMS/LEVELS files (they are not subsequently overwritten
when TARGET='OLD'), provided the metastable symmetries do not change.
***For many/most cases/users this option can be ignored, but if the structure
part of the scattering calculation seems to be taking an age, then, use this.
Note: TERMS is wanted even during CUP='IC' because the structure is (historically)
computed in LS as well.

14/05/10 adf04_om2ups
Fix from Paul Bryans to a read failure when scattered energy has a negative
exponent - this is a hangover from the original type-3 code which read
T(K) in this field i.e. T>1! This (E<1) only occurs for neutrals when using
the internal default scattered energy set-up.

14/05/10 asdeck23.13
Born dimensioning requested/needed unnecessarily large value of MXGRB, only by 1,
but when it needs more than the orbitals present then clearly was not "correct". 
No errors, and if increased as asked, problem ran fine, but inelegant coding.

13/05/10 asdeck23.13
Introduce buffer space for initial read/set-up of scattering+interpolation
energies since the final set is often pruned. This stops MXENG being set
unnecessarily large.

12/05/10 asdeck23.13
Fixes to BP use of correlation.

10/05/10 asdeck23.13
Write input dataset to adf04 comments.

08/05/10 asdeck23.13
Recover target level info (as long done for terms). Necessary precursor
to any collision RESTART (not yet implemented).

08/05/10 asdeck23.12
Re-organize ALGX/ALGXLS -> SYMLS

07/05/10 asdeck23.12
When NMETAJ .lt. NENERJ, omit unnecessary SLp target group interactions,
i.e. target SLp groups which do not contribute to Jp groups that metastable
levels belong to. Also, ignore any user-defined NMETA since required
interactions are now determined uniquely by NMETAJ.

05/05/10 asdeck23.11
Change default NMETAJ (to .lt.0) to be levels of ground term, (=0 still gives 
levels stable against E1 radiation.
Currently, NMETA default (.le.0) is unchanged - terms stable against E1.

05/05/10 asdeck23.11
Fixed "obvious" bug - possible INTEGER*4 overflow, only seems to show-up
in debug mode, energies completely wrong. This was introduced with v23.1,
with the repointing of the DC array.

01/05/10 asdeck23.11
As below, for LS case as well (NMETA).

30/04/10 asdeck23.11
Ensure mixing matrix multiplication always uses zero block, case NMETAJ<NENERG

29/04/10 asdeck23.10
Parallel BP tested & working.

28/04/10 asdeck23.10
Speed-up evaluation of mixing.

27/04/10 asdeck23.10
Can neglect non-metastable and/or correlation sooner.

24/04/10 asdeck23.9
Bugfixes to mixing.

23/04/10 adasrr 1.10
Below test not correct - jobs aborts.

20/04/10 adasrr 1.10 adasdr 1.20 mdrcs13.4
Only apply target energy checks for lv.ge.0 (lv=-1 case of no parentage
and so may want different energies - N vs N+1 bound core/target)

17/04/10 adasrr 1.10
Add check of any user supplied target energies against internal.

17/04/10 adasdr 1.20
Minor

13/04/10 asdeck23.9
Bugfixes.

10/04/10 asdeck23.9
First checks of BP-X, BP-NX, & top-up for H-like.

06/04/10 asdeck23.9
BP top-up done. (FS integrals still to be done.)

03/04/10 asdeck23.8
LS (inc NFS) integrals done.

02/04/10 asdeck23.7
BP mixing done. 
Bug in LS channel printout corrected. When initial algebraic term was not 
lowest energetic, term labels were swapped correctly but channel were 
unswapped (omegas unaffected).

30/03/10 asdeck23.6
BP NX done.

27/03/10 asdeck23.5
Now have jK representation in dwxbp, takes account of correlation and 
metastable flags. NX, mixing, top-up & integrals to be done.
Bug in LS corrected. For transitions within a target symmetry group,
not all mixing was taken account-of due to "skip" to avoid double
counting.

13/03/10 asdeck22.31
Allow PI to continue with velocity gauge in ICR mode, but print warning
when energy likely to cause inaccuracies. Could always force velocity
gauge explicitly, but this enables mixed length/velocity to be used.

12/03/10 asdeck23.4
First development of dwxbp subroutine, but still in LSJ representation
(and no radial integrals!) Tests pointers to SLp and SLJp algebra/integrals
indexed by NAD(NCOR) and NADR(NCORJ)

12/02/10 asdeck23.3
Implement "single pass" operation of RESTART: DC array is no longer
I/O'd to disc. This means only MSTART=1,5 are "valid". (Set BPASS=.FALSE.
to re-enable MSTART=2,3,4.)

11/02/10 asdeck22.31
VPNL: orbital not found in given (valid) CF (o.k. in STOPOT).

09/02/10 asdeck22.31
RADOUT='YES' is now independent of MHF.

09/02/10 asdeck22.31
Allow read/use of multiple external potentials (e.g. one-per orbital).
UNLIKE radwin, the existence of a suitable external potential is enough
to trigger its use for an internal orbital. So, for example, a unique/global 
external potential is used by all internal orbitals. However, can be mixed 
with radwin usage, and external orbitals ignore any external potentials.
Recommended to use POTIN variable rather than historic MHF since
MHF also controls/conflicts with RADOUT and internal change needed.
If use POTIN then it will be transparent.
POTIN='HFFC', 'FAC' and 'HFNL' are recognized ('YES' defaults to 'FAC').
See SR.POTIN for format requirements.
The historic input file name 'hffcin' is still supported (for all POTIN)
but file name 'potin', is now the preferred.

08/02/10 asdeck22.31
radwin fix.

05/02/10 asdeck22.31
Allow PPOT='SCCA' to be used in combination with external orbitals.
The external orbitals remain fixed during the SCCA procedure.

04/02/10 asdeck22.31
Allow minimization when (some) orbitals are external (from radwin file).
Checks for obvious errors like trying to vary an external orbital or if an 
external orbital would be repeatedly orthogonalized to one to be varied. 
But, caveat emptor!

03/02/10 asdeck22.31
Fixes for use of external orbitals (radwin file) with STO internal orbital
potentials.

02/02/10 asdeck22.31
When correlation CFs in use with M1+BP (default, no BP for them) their
contribution was omitted from the WRITE of zero-order line strength (SM0).
While their contribution was added to first order (SM1) phase consistency
was not guaranteed.

29/01/10 asdeck23.2
If a configuration gave rise to no terms, e.g. because correlation,
then JTGD pointer array to DC array was not set correctly.

28/01/10 asdeck23.2
Rationalized Slater-state pointer usage.

26/01/10 asdeck23.1
Memory requirement significantly reduced for large cases.
Specifically, the VCC array DC(MAXDC)*8 now only stores non-zero elements.
Between 1/4 to 1/3 are non-zero. Allowing for an INTEGER*4 array to label
the non-zero elements, there is a factor two reduction in (this) memory
when 1/3 are non-zero. If *4 was used for DC (which can be problematic)
then the reduction is by 1/3. In both cases, MAXDC is now likely well
below 2 billion (sic) at which point the DC indexing would need to be
INTEGER*8. Also, much friendlier on cache. 

20/01/10 asdeck22.31
Array out of bounds on closed-shell collision algebra.

16/01/10 asdeck22.31
Fixed bug in BP corrections to M1 radiation which affects transitions within
a Jp group between distinct SL symmetries of distinct configurations.
This was introduced when re-writing the angular algebra to work with
symmetry groups. Thus, v18.x and earlier are unaffected by this bug while
v19.x and later are so affected. (Note, v22.31 is the corrected version
for those of you who have migrated.)

12/01/10 asdeck22.31
Fix for failure to label e-vectors.

01/01/10 asdeck22.30
Fix to relativistic Rydberg orbital approximated by zero-energy continuum:
for near neutrals, estimate of Darwin" contribution to orbital energy made
it positive, leading to "exception".

29/12/09 adasdr 1.20
Check expected (i.e. user supplied) target energies against what is on file even
when no energy corrections are in use. User does need to supply them via NTAR2.

15/12/09 adasdr 1.20
Re-worked n-interpolation, especially when a new series opens-up, so that 
error on new series does not affect same n but of a higher energy series.
(In principle, all n-values should be resolved up to the highest n
for which a new series opens-up but this can be quite large for
fine-structure transitions: n=z*sqrt(1/de). )

10/12/09 adasdr 1.20
Use non-linear bin energies when convoluting with a Maxwellian and EMIN=0,
i.e., near-threshold resonances expected. Recall, adf09 does not use binned
cross sections so was/is not an issue there.
Also, if no o1 or o1u file present, now look for (unrenamed) parallel files,
based on /LS/ or /IC/ setting - saves having to rename multiple files.
Historic serial still requires ls/ic/u renamed to o1/u etc.

09/12/09 asdeck22.29/30
Minor bugfixes.

03/12/09 asdeck22.29/30
Avoid infinite loop for point nucleus (INUKE=-1) because of INUKE=1 fix!

01/12/09 asdeck22.29/30
Minor fixes to finite nucleus (INUKE=1) and self-consistent configuration 
average potential operation (PPOT='SCCA').

25/11/09 asdeck22.29/30
If orbital only exists in correlation CF then need to average over all
CFs when MCFMX=0.

19/11/09 asdeck22.30
Two related developments:

1/Large algebraic arrays in COMMON have been changed to MODULEs and made
ALLOCATABLE - F95 only. Generally, the dimension needed is not known a priori
and so the hardwired dimension is used. But, if write a RESTART file, then:

2/Read actual dimensions needed for the problem and ALLOCATE accordingly.
The combination of WRITE/READ/ALLOCATE is more efficient than manually
fine-tuning a PARAM file.

As a tidy-up, ALL arrays written to RESTART are now the actual length used,
and not the hardwired dimension, even for "small" arrays. This means that
a differently dimensioned executable can be used to read RESTART compared to
that which wrote it. HOWEVER, because of the original implementation (dimension
checks were not "necessary" - the same executable had to write/read) for 
arrays that are not allocated, there is no check that a smaller dimensioned
executable is large enough to read what was written by a larger executable.
It DOES mean that it is perfectly safe to INCREASE dimensions and not have
to regenerate a new RESTART file.

12/11/09 asdeck21.16
Minor bugfixes.

11/11/09 asdeck22.29
If DSYEVD fails gracefully then use SR.DIAG instead (Householder+QL) for
that symmetry only.

09/11/09 asdeck22.29
FAC='YES' for continuum with correlation present did not restrict average
to spectroscopic configurations (as "must").

05/11/09 asdeck21.16
But parallel code needs LORIG=LMIN, so just change comment.
See 25-27/10/09 changes

03/11/09 asdeck22.29
Small bug in FCF6 introduced in v22.23, incorrect norm on power
series solution near origin, due to mods made for high-L (collisions)
where r^(l+1) is vanishingly small.

01/11/09 asdeck22.29
Apply skip of small Auger matrix contribution test to product of
mixing coefficient and matrix element (rather than just mixing coeff.)
More accurate, esp. at high-n, and catches zero matrix element.
Default CMXLSA & CMXICA still 1.d-5 and in/decrease makes test
less/more accurate, but matrix product is tested against a variant.
Radiative rates still test mixing coeff. only, for now.

30/10/09 asdeck22.29
Improved memory ALLOCATE regarding diagonalization arrays (esp. for DSYEVD)

28/10/09 asdeck22.28
Added DSYEVD diagonalization option. (DSYEVR was always present but
often unusable since it requires graceful handling of NaNs.) 
Useful speed-up for largest cases, compared to SR.DIAG.

27/10/09 asdeck22.27
Implementation of FAC='YES' PPOT='SCCA' option for collisions. Unlike
the structure problem, it is not "obvious" just what the FAC code uses.

27/10/09 asdeck21.16
LORIG default start-L on RESTART was set to LMIN, not zero as stated.
(User could simply read it of course.)

25/10/09 asdeck21.16
For read-back of RESTART file use actual dimension for ALLOCATE DC.

24/10/09 asdeck21.16
RESTART write of DC array exceeded 2Gb limit for record length.

22/10/09 adasdr 1.19
Ported-in convolution of binned cross sections by Maxwellian for complex cases
where don't want partials (adf09) to save having to switch to using mdrcs13.

20/10/09 asdeck22.26
Removed all tab characters that had crept in over the years - fun.

20/10/09 asdeck21.16
Array out of bounds when using RESTART with no 2-body fs dimensioned (MXAJS=1)

26/09/09 mdrcs13.4
Fixes for gfortran - still not guaranteed since mdrcs13 is legacy code
and gfortran is unique in what it "faults".

11/08/09 asdeck21.16
Only write spectroscopic to TERMS/LEVELS files.

09/07/09 adf04_om2ups.f
Paul Bryans has updated the old adf04_1to3.f code which converted type-1
adf04 omegas to type-3 adf04 upsilons so as to handle the type-5 adf04 omegas
produced by AS "RUN='DE'. The name change reflects this. (It is ADAS809,
standalone.)

06/07/09 asdeck22.25
PPOT='SCFM' & 'SCCA' use extended to Rydberg/Continuum orbitals. Then, 
use local exchange approximation so no self-consistent iteration needed.

03/07/09 asdeck22.25
Allow usual minimization of energy functional with PPOT='SCFM' & 'SCCA'
by applying lambdas to the exchange potentials only. Thus, asymptotic
charges defined by the direct are not modified. Also, the exchange
is more approximate in 'SCFM'. So, if exchange is switched-off then
negligible optimization occurs, as was the case in general, since only
the initial STO potential is scaled. All self-consistent operation is
only available via the STO flag (NZION.lt.0) because it is geared to
shell structure.

01/07/09 asdeck22.25
The variable MHF (>0) flags read of a unique external potential,
historically, Hartree-Fock Frozen Core, from file "hffcin". Unhelpfully, it 
was restricted to being on the same AS radial mesh, i.e. no interpolation
was possible. Now, the external radial mesh can be arbitrary and it is
interpolated onto the AS mesh. Since there is no standard format, the
READ statement(s) at the end of SR.STOPOT may/will need adjusting to the
users format. Currently, it is set to read a FAC file. 
        READ(MHF,*,END=80)ICARD,XXX,DUMZ,PPP                 !FAC FORMAT
SR.TFDAPO still reads the old AS format only, no interpolation.

23/06/09 asdeck22.25
Added configuration average multipole potential (inc. exchange) for 
self-consistent solution flagged by PPOT='SCCA', as opposed to pre-existing
PPOT='SCFM' which uses static plus local exchange of Furness & McCarthy.
The default for both PPOT is to use a different potential for each orbital
and to use the MCFMX.ge.0 option to flag the config(s) to define the occupation
numbers, as in normal STO usage. The orbitals are still not default orthogonal
because the appropriate self-energy term is omitted for each orbital's potential.
The orbitals are Schmidt orthogonalized (unless ORTHOG='NO' is explicitly flagged.)
PPOT='SCCA' as described above is what is used by FAC save that FAC uses
a single potential determined by averaging over each orbital's potential, by
its occupation number. The orbitals are thus naturally orthogonal. 
Average occupation numbers for the first -MCFMX configurations are used 
(default MCFMX=-1). NOCC can be used instead. 
This operation, which mimics the approach of FAC, can be obtained via FAC='YES',
then MCFMX=-999 is the default. If continuum present then user should set MCFMX
or NOCC else one will get an unphysical average due to taking N-electrons for
continuum configs and N+1 for non-continuum.
(The default is FAC='NO' and a different potential is used, as just described.)
The user can also read-in their own unique set of NOCC occupation numbers.

23/06/09 asdeck21.16
Change default (static) potential (MEXPOT=-1) for self-consistent operation
(PPOT='HF') to include Furness & McCarthy local exchange (MEXPOT=0).

04/06/09 asdeck22.24
Activated optional use of FACTL, for case of use of MINLT & MAXLT,
LNEW=LOLD*FACTL+1 (default, FACTL=1.0) and so FACTL.gt.1.0 "skips"
some Ls. These are compensated for by using a Simpson's Rule quadrature
for the sum over L. Code only allows FACTL in the range 1.0 - 1.25 
LRGLAM is automatically adjusted to the nearest actual nodal L, assuming 
a valid top-up value was originally specified (i.e. between MINLT & MAXLT.)
A conservative value of 1.1 is still a significant time-saver if MAXLT.gt.30,
on the other hand topping-up at lower-L may be preferable accuracy/timewise.

03/06/09 asdeck22.24
Fixes to write of adf04 for g77.

02/06/09 asdeck22.24
Use DEX=MAX(DELTAX,TEAPOT) in determination of default scattered energies.

29/05/09 asdeck22.24
Fix to sanity check (ICFG.gt.0) introduced in v22.x only.

27/05/09 asdeck22.24
Replace DELTAX by TEAPOT, the ionization potential, for default scattering
energies (DYY0). Determined from ground CF outer-electron binding energy,
can be overridden by user. And DYY0(5)=TEAPOT*8.
Tweak XINT.

27/05/09 asdeck22.24
Lambda=0 exchange overlap was incorrect because target orbital one-body
energies had been overwritten on reading target algebra because they were
used initially just to flag an orbital's existence in a CF.

26/05/09 asdeck22.24
Change default scattering energies used when user does not specify any to
        DYY0(1)=DZERO
        DYY0(2)=DELTAX/3
        DYY0(3)=DELTAX
        DYY0(4)=DELTAX*3
        DYY0(5)=DELTAX*10
where DELTAX is the max target excitation energy, unless overridden by user.

Also, now allow a default set of interpolation energies to be used
when user specifies scattering energies but no interpolation energies
(unless user explicitly sets none) viz MENGI=0, NDE=2 with
DELTAX/2 and DELTAX being the characteristic excitation energies.


22/05/09 asdeck22.24
Fix for pruning of closely-spaced interpolation energies.

22/05/09 asdeck21.16
Allow read of unnormalized STOs in RADWIN via non-zero 2nd variable on the
orbital header ("7" here, recall fixed-format 3I5,I3 etc, not normally an issue)
    1    7    1  0
Similarly, specifying MYN,MYL (1 0 here) assigns the l-value.
Normally, it is determined from the lowest power of r^n.
But, if only have unmixed basis (i.e. no c-coefficients, hence the
normalization fix) then need a single STO per atomic orbital.
The c_i are then just the mixing coefficients resultant from diagonalizing H.

21/05/09 asdeck22.24
Spin-forbidden transitions were missing from the DW adf04 file because the
code reads the PWB adf04 file and overwrites its omegas with DW. Now inserts
forbidden transitions (those with zero infinite energy limit point).

20/05/09 asdeck22.24
(Parallel) psymls routine needed updating with latest default settings
for MAXLT, MAXLX, MXLAMX, MAXLOO & LRGLAM.
(Parallel) psymj routine needed updating/setting of LRGLAM.

19/05/09 asdeck22.24
Parallel variable incorrectly named.
***v22.24 starts post-release changes.

19/05/09 asdeck22.23
***Released for testing***
Minor fixes. Archive for distribution.

18/05/09 asdeck22.23
Limit 2-nfs algebra/integrals to MAXLX, by default. Can be overridden
by MAXLOO.

16/05/09 asdeck22.23
Similarly, L/E large requires v. large range for long-range integrals
which are ultimately negligible, so neglect.

15/05/09 asdeck22.23
Use analytic Coulomb normalization to re-scale DW function so as to
avoid overflow for extreme cases of large L/E e.g. L=100, E=0.

14/05/09 asdeck22.23
Minor fixes (inc. optional output of diagonal reactance matrix)

13/05/09 asdeck22.23
Allow NLAG=1, uses nearest energy. Useful when inputting "exact" energies.
Minor fixes.

12/05/09 asdeck22.23
Now use MENGI.lt.0 to flag insertion of -MENGI additional interpolation
energies between existing scattered energies.

11/05/09 asdeck22.23
Tidy-up.

11/05/09 asdeck22.22
l-changing elastic transitions needed factor 2 on omega, assumed by algebra
which only calculated one pair.

08/05/09 asdeck22.22
Top-up debugged. 
Track and differentiate between spectroscopic and correlation terms, 
especially for when they are interspersed.

06/05/09 asdeck22.22
Allow explicit exclusion/inclusion of elastic transitions via IONE.
Default, IONE=1 no-elastic. (IONE=0 includes elastic.) All necessary
elastic matrix elements are always determined as required by mixing.

06/05/09 asdeck21.16
Trick gfortran into storing character string in an integer variable for
backwards compatibility.

05/05/09 asdeck22.22
Re-write adf04 file with DW omegas. 

30/04/09 asdeck22.22
Implemented dipole and non-dipole (allowed) top-up, as per stgf/stgicf, i.e.
explicit dipole top-up in small l (as done for BP, rather than unnecessarily
complex top-up in large L as well).

27/04/09 asdeck22.21
Tested radial problem out to L=100.

24/04/09 asdeck22.21
Implemented NMETA and KCUT. Fixed pointer bug in mixing coefficients vector.

21/04/09 asdeck22.21
Supplement with additional interpolation energies. These can be specified
either by NDE characteristic excitation energies, read after scattered 
energies, or (technicaly, and/or since could do both) by MENGI.gt.0 
additional interpolation energies, read after the above. 
(MENG.lt.0 operation changed as of 12/05, now inserts -MENGI points.)
Code also makes use of the maximum excitation energy. This can be
restricted (redefined) by DELTAX *BUT* transitions with excitation energies
greater than DELTAX will be inaccurate, maybe quite severely because of
possible lack of any interpolation energies at these higher initial energies.
(Internally we now have MENG0 the original scattered energies, but still
read as MENG, and a redefined MENG including additional interpolation
energies.)

20/04/09 asdeck22.21
Restriction integral interactions to those energetically possible.
I.E. if two scattered energies are separated by more than the maximum
excitation energy then the interaction between them is not needed.
(Save for interpolation purposes at the end of the energy grid.)

16/04/09 asdeck22.20
Initial interpolation studies, where scattered energies are also the (only)
interpolation energies.

16/04/09 asdeck21.16
Minor fixes.

14/04/09 adasdr 1.19
Did not convolute metastable binned cross sections, with Gaussian or Cooler
distributions, due to technical oversight.

13/04/09 asdeck21.16
Use NLAMD/NLAMQ.LT.0 to flag input of dipole/quadrupole modified TF potential
scaling parameter relative to unity, as opposed to relative to zero 
(NLAMD/NLAMQ.GT.0) Then, 1.0 rather than 0.0 means NO such contribution.

09/04/09 asdeck22.20
Form LS-mixed rho-matrix and then form partial and total collision strengths.

26/03/09 asdeck22.19
Generate continuum-continuum Slater integrals, including exchange overlap, 
and 2NFS integrals. 
Index exchange integrals so that, like direct, the list is not extended as
total L increases (once the full multipole expansion is present.)
Radial print-out can be suppressed as usual via PRINT='UNFORM'.
Complete functioning releasable version.

17/03/09 asdeck21.16
Bug-fix for TF potential with new radial mesh: unnecessary STOP 
if IEND.gt.NPOINT. Fine to continue, provided DX was initialized correctly. 
Any subsequent truncation is not an issue for TFDAPO.

13/03/09 asdeck22.18
Start radial orbital/integral branch.
Read & set-up scattering/interpolation energies via MENG and SRADCON as usual.
Generate continuum distorted-wave basis.
An incomplete (non-functioning) archive.

12/03/09 adaspi 1.14
Overestimated array size requirement, when convoluting totals, for cases where 
electron energy mesh did not start at zero viz.
STOP: CONVLGT: INCREASE NDIM34
Also,total PI energy mesh does not put an original mesh point close to an 
existing one that has been added because of a threshold, implicitly assuming
that the next one will span. But, if the original is the last energy point 
then the mesh is unnecessarily truncated slightly. Now, always re-insert
the last energy.

06/03/09 xpeppi.f 1.4
Failed if an electron target symmetry was missing from XDPIPAR (due to it
being identically zero, i.e. forbidden) - would be out of sync with XPEPAR,
if had not aborted due to EOF. Now re-synched.

06/03/09 adaspe 1.14, adaspi 1.14
Minor: added variables used by one code but not the other to others' NAMELIST 
so that same adasin can be used for both codes.

05/03/09 asdeck22.17
Set default max exchange multipole (MXLAMX) to twice largest bound orbital
angular momentum (+1 added v22.19).
Set default max exchange total L (MAXLX) to twice MXLAMX.
Archive last functioning version prior to next development, but keep it
separate from the last released. Hence, 22.17 is only a small increment on 22.16.

04/03/09 mdrcs13.3
Read of multiple opn files (see 14/10/08) did not work.

26/02/09 asdeck21.16
Minimization of G functional (JPRINT=-2) did not work (and hasn't for some
time) because velocity gauge f-values were not being determined during
optimization. G is a measure of the difference between length and velocity 
gauge f-values.

14/02/09 asdeck22.16
***Released for testing***
Parallelized LS and LSJ collision algebra by LSp and Jp symmetry.
In the LSJ case, each processor calculates all LSp necessary for its Jp.
Thus, the same LSp symmetries are calculated by multiple processors.
Since the 2fs algebra is much more demanding than the LS, this is
reasonable. May need to revisit for the pure jK-recoupling (part).
Explicit parallel coding is commented-out in asdeck22, and active
in passdeck22. Currently, two routines only used by pasdeck22 are
not commented out, only the calls to them, since they have no explicit
MPI dependencies.

13/02/09 asdeck22.15
***Re-released for testing***
Fixed bugs reported by KB from ifort compiler. Mostly harmless, apart from 
an array out of bounds on some test code.

10/02/09 asdeck22.15
sr.flglx3: 3j-/6j-symbol zero again (see 04/02/09) due to mis-match in TYNY 
test for what defines a non-zero algebraic coefficient. 
Showed up in open d-shell.

04/02/09 asdeck22.15
Some re-organization of symmetry set-up, with view to parallelization.

04/02/09 asdeck22.15
Introduce IPAR to flag range of parities (case INAST/J<=0).
IPAR=0 even
IPAR=1 odd
IPAR=2 both (default).

04/02/09 asdeck22.15
Fixed a graceful failure when scaling LS collision algebra with KUTOOX=1.
Then, a Slater integral coefficient can be zero while orbit-orbit non-zero.
This leads to 0/0 when trying to scale Slater. (sr.flglx3: 3j-/6j-symbol zero)

04/02/09 asdeck22.14
MAXJFS/MAXLX not correctly synchronized (unnecessarily restrictive),
ditto MAXJT/MAXLT.

02/02/09 asdeck22.14
***Released for testing***

02/02/09 asdeck22.14
Various fixes for obscure combinations of user input.

26/01/09 asdeck22.14
Attempt to set a reasonable set of MIN/MAX/LSJ defaults, if not specified by user.

22/01/09 asdeck22.14
Two-body fine-structure collision algebra debugged (probably).

21/01/09 asdeck21.16
Bug-fix for TF potential with new radial mesh when its dimension is exceeded.

09/01/09 asdeck21.16
MPRINT=1 now gives final parents term table as well.
MPRINT=2 now gives parentage for all subconfiguration couplings. (v22.x only.)

24/12/08 asdeck22.14
First implementation of two-body fine-structure (2-fs) collision algebra in LSJ 
representation. While MINJT and MAXJT specify twice the min/max J for the eventual 
jK-recoupling, MAXJFS is twice the max J for which the 2-fs collision algebra is 
calculated and is for/between target configurations specified by KUTSSX, the (N+1)-
electron analogue of the usual target KUTSS. Like KUTSS, KUTSSX=-1 by default and no 
2-fs collision algebra is computed. For consistency, have introduced KUTOOX as well
for 2-nfs (orbit-orbit etc.) Previously, the same target KUTOO value was used for 
the collision problem. This was trivial since it is either off or on, and is not
particularly time consuming, unlike the case of 2-fs and the reason for KUTSSX.
So, one can set KUTSS=-9 to get the best target (all target 2-fs interactions on)
but set KUTSSX=1, say, and just include 2-fs collision algebra for the first target 
config etc.

22/12/08 asdeck22.13
Minor - remove redundant code from flglx1.

19/12/08 asdeck22.13
***Released for testing***

19/12/08 asdeck22.13
Allow user to restrict small l partial wave expansion to l = L +/- LCON/2.
The full default expansion is given by LCON=2*MAXLA where MAXLA (not an input
variable) is the maximum target total angular momentum. Another way of
putting it is that LCON is the number of continuum small l (=2*MAXLA+1),
the extra 1 making no difference to the restriction (assuming integer
arithmetic/truncation). This is the same LCON variable as used for
RUN='DR' etc, where it is historically set/read in/from the DRR
namelist, but it has long been available via SALGEB as well.
(Actually, there is now LCONDW (=LCON) and LCONDWJ - not likely to be of 
great interest.) 

18/12/08 asdeck22.13
Added more checks on user input. 

*********************************************************************************

17/12/08 ASDECK V22
First release (22.13) for testing of LS coupling collision algebra.
RUN='DE' selects Direct Excitation.
User then specifies a set of target configs, as in a normal structure run.
Collision symmetries can be restricted via INAST, or MINLT, MAXLT 
(& MINST, MAXST) as per R-matrix stg2 input.
The default max L for exchange is MAXLX=8, which can be overridden of course.
NX data is then written for only a single S symmetry, as per NX R-matrix,
and the direct is determined rapidly via symmetry relations of the reduced
matrix elements.
Two-body non-fine structure is included if KUTOO is switched-on, as in a normal 
structure run (recall, default is off).
NMETA can be used to restrict interactions to between target symmetries contained
in the lowest NMETA term energies and all possible excited states. Interactions
between excited states are omitted unless both contain an NMETA symmetry.
(Eventually, collision strengths will only be determined within the NMETA
terms and from the NMETA terms to all excited states.)
By default, NMETA=all target terms (no restriction).

NOW MAINTAINING V21 (MINOR DEVELOPMENT. BUGFIXES etc) and V22.
*********************************************************************************

25/11/08 asdeck21.16
Added PJS's detailed printout of CI info for lowest ITANAL terms, whose
contribution is at least ECNTRB wavenumbers. Set in &SMINIM.

24/11/08 adaspe 1.14
Output SUMBN (up) as well as SUMRN (down) to adasout for IPRINT.ge.0.
CROSS is "up".

22/11/08 asdeck21.16
Added ESKPL, ESKPH, ECORR to &SMINIM so one can specify correlation states by
energy, as per R-matrix (same values are used by LS and IC since only working 
with one in general) instead of just KCUT in SALGEB or &SMINIM. This only removes
their writing to files, e.g. OMGINFLS/IC, adf04ls/ic, adasex(j).in.form etc.
Also, no longer write correlation energies to adf04ls/ic, adasex(j).in.form,
and adjust indexing accordingly, since they are not required by adasex(j) code
or by ADAS itself. Note, adasex(j).in.form no longer has NTERM, NLEVS value
written, as the reduced number of spectroscopic states has not been determined
when the header is written. The number is the value to the right of the last
energy written.

22/11/08 adaspe 1.14
Tweaks for RESOLV='YES'. 

19/11/08 asdeck21.15
RAD='ALL' switched-off two-body contributions to BP corrections to M1
for some transitions because of the presence of higher M_k>2 multipoles.
Usual RAD='BP' or any variant that did not exceed M2 was o.k.
(BORN='INF' did the same, indirectly.) 

10/11/08 asdeck21.15
TF potential set-up requires final interval to have at least twice as many 
points as previous one.

28/10/08 WRITEUP
This has been extensively revised to bring it up to date with developments
over the past few years. Also, all examples use the A.S. format and the
auto-config generation of the collision problem, which is the recommended route.

28/10/08 asdeck21.15
Large dimensioned radial mesh operation was unnecessarily slow when only small
a small array was actually needed because some operations were carried-out 
to the end of the dimensioned array. Now, "attempt" to predict the radial
extent of the problem at hand and restrict array accordingly. This might
need fine tuning...

25/10/08 asdeck21.15
Fix of 14/10/08 to auto-config generation accidentally zeroed-out a continuum 
in non "DR" operation - fatal.

24/10/08 asdeck21.15
Implemented returns back to main before STOPping, for graceful
end to parallel run (finalize mpi).

21/10/08 asdeck21.15
Merge parallel code, suitably flagged, with serial for a single source deck 
which can trivially be converted to serial or parallel via simple
tedi/sed commands. This is how the f95/f77 "versions" are maintained.
So, the serial code now contains the parallel coding, albeit commented-out,
so that serial changes are automatically incorporated into the parallel,
again as per f95 vs f77.

17/10/08 asdeck21.14
Added QED corrections viz. vacuum polarization and self-energy.
Taken from GRASP and adapted for use with kappa-averaged orbitals.
Default: off, QED=0 in &SMINIM.
QED= 1 switched-on in IC/R operation.
QED=-1 switched-on in LS/R operation, as well as IC/R.

15/10/08 asdeck21.14
High-Z point nucleus could abort two-body magnetic V&N integrals when
relativistic radial functions in use because small-r correction factor
gives sqrt(negative number).

14/10/08 mdrcs13.3
Can now read an arbitrary number of o/p/n/u files n=1,2,3,...99.
The adasxx codes already have this capability.

14/10/08 pasdeck21 1.0/21.14
Current serial v21.14 parallelized by L-loop. Based-on Connor's beta v20.2, 
but with the restriction on the number of processors removed
Will attempt to keep the parallel in sync. with the serial (sigh).

14/10/08 asdeck21.14
RUN='DR','RR','PE','RE', i.e. L-loop, obscure bug fixes.
KCUT, with A.S. auto-configuration generation, did not always re-initialize 
configuration occupation numbers to zero. 
Run aborted with configuration mis-match error.
RESTART had not worked in all previous v21.x (o.k. in last v20.x).
Repeated the last L for all L due to a mis-guided REWIND.

02/10/08 asdeck21.13
Bug-fix for CFs with no terms because of KCUT - did not exit gracefully.
Also, KCUT did not apply to a straight structure run with A.S. input.

02/10/08 xpeppi.f 1.3
Adds resonant and direct X-files produced by adaspe and adaspi and produces
XPIPAR and XPITOT combined files. Default: interpolates resonant onto direct, but
a simple switch change at start of code does the reverse. Totals and partials are
processed automatically by the same run using file names as directly output from
adaspe/pi. Structure of output files is the same as input, except not yet finalised
which energy mesh(es) to write. Recall, adaspe/pi re-write the same photon energy
mesh relative to the initial photon target for every transition, purely as a
convenience for gnuplot, when strictly speaking it need only be written once at the
start of each file. Currently, all possible meshes are written (for convenience)
even though they are all trivially related to each other by quantities also present
in the out-files, viz. photon energy relative to ground photon target, photon energy
relative to initial photon target, electron energy relative to ground electron target
and electron energy relative to final electron target (XPIPAR only, XPITOT repeats
the ground energy).
N.B. v1.1, 1.2 were non-released development versions.

02/10/08 adaspi 1.13
Minor

01/10/08 adaspi 1.13, adaspe 1.13
Add number of energies to X-files.

24/09/08 asdeck21.13
Removal of file clutter missed checking a UNIT (14 and/or 15) was in use before 
BACKSPACE. Some compilers quietly ignored it.

24/09/08 adaspi 1.13
Some reworking of convolution. Convolute partials at the edge.

24/09/08 adaspe 1.13
Minor, for consistency with adaspi.

23/09/08 adaspi 1.13
EWIDTH.gt.TOLC (1.d-7), convolute total PI cross section with Gaussian FWHM EWIDTH,
between EMIN and EMAX photon energies (relative to ground), ELSEIF .gt.0
just interpolate onto the convolution mesh. Output to XDPITOT.

24/09/08 adaspi 1.12, adaspe 1.13 adasdr 1.18 adasrr 1.9
But in formatted case (see below) do not read too many at once else
moves onto next record, even with formatted read of a single record.

28/08/08 adaspi 1.12, adaspe 1.13 adasdr 1.18 adasrr 1.9
Increased number of orbitals read from ols/ic/u headers. This has given
problems in the past with g77 as it does not exit end of record gracefully...
but some applications need them.

28/08/08 asdeck21.13
ICFG=01 or 10 was incompatible with use of NXTRA,LXTRA,IFILL as it read
expanded orbital list rather than original user input.
Increased nl orbital values output to ols/ic/u file headers.
the problem was/is reading them in the post-processors as the number
has never been defined.

19/08/08 adasdr 1.18 adaspe 1.13
If NC.gt.0 read-in previously generated ocs/p/t binned cross section  files,
and convolute.

18/08/08 adaspe 1.13
Convolute Lorentzians with Gaussian of FWHM -EWIDTH if EWDITH.lt.TOLC.

16/08/08 adaspe 1.13
Added detail control of radiation damping:
RAD='NO' - none.
RAD='YES' - include it. However, may want to distinguish between radiation
to bound states (included by R-matrix) and radiation to autoionizing states 
(which is NOT  included by standard STGB/R-matrix).
RAD='BOUND' includes only radiation to bound states (or RAD='RM').
RAD='AUTO' includes radiation to autoionizing states (in width)  as well AND 
assumes it subsequently re-autoionizes i.e. contributes to TOTAL photoionization.
(Obviously, we can only include it in the width for partials since we don't
know which electron continuum the third-step break-up goes to.)
Actually 'AUTO'='AUTO1', there is also 'AUTO0' which assumes it doesn't
re-autoionize, just contributes to the width. 'AUTO1' is much more likely.
Finally:
PABS='NO' gives total photoionization
PABS='YES' gives photoabsorption.
No damping means photoabsorption=photoionization. 
Damping broadens and reduces (loss to bound) photoionization profiles while just
broadens photoabsorption profiles without reducing their integrated value.

15/08/08 adaspe 1.13
Use detailed Lorentz profiled cross sections, rather than binned cross sections,
if EWIDTH.lt.0. This raw unconvoluted data is output to XPEPAR and XPETOT. 
TBD: convolute if EWIDTH.lt.TOLC, where TOLC is small e.g. 1.1d-7.

13/08/08 adasdr 1.18
Convolute binned cross sections (internally) with a Gaussian of FWHM EWIDTH
or (EWIDTH=0) a cooler distribution defined by TPAR and TPER. Output to XDRTOT.

13/08/08 adaspe 1.12
Convolute binned cross sections (internally) with a Gaussian of FWHM EWIDTH.
Output to XPEPAR and XPETOT.

12/08/08 adaspe 1.11
Added write of partial (ocsp) and total (ocst) energy-averaged binned 
resonance cross section files (for photo-excitation). The bin energy is
that of the photon. Both are resolved by initial photon target (default, 
ground only). ocsp is further resolved by final electron target continuum, 
while ocst is summed over all possible. Currently, feed-in to mdrcs13 to 
convolute.

12/08/08 adaspe 1.10
Added NTARP along same lines as for adaspi, and modified NTAR operation
accordingly. I.e. |NTAR| is the number of electron targets read from adasin.
NTARP is the number of electron targets resolved. (NTAR.lt.0 looks for all
possible, but no stat. weight info read above -NTAR.) NTART has been added,
but is not yet operative. It is planned to act on the total binned cross
sections.

09/08/08 adaspi 1.12 adaspe 1.9 adasdr 1.17
TOLB was not initialized correctly if adasin did not include electron target 
energies (old-style TERMS/LEVELS) - case adaspi, adaspe - or used old-style 
(pre-TERMS/LEVELS) stat. weight format - case adasdr.

08/08/08 adaspe 1.9
Added IRSLMX (as per adaspi) to restrict initial photon targets to the
lowest IRSLMX states. Can also restrict upper photo-excited states by
JRSLMX, but this requires upper-state resolution and may not be desirable
in large cases. Normally restrict upper states more coarsely via NCUT,LCUT.

30/07/08 adaspi 1.12 adaspe 1.8 adasdr 1.17
TOLB was not flagged as re-set if determined from adasin energies.

29/07/08 adaspi 1.12
Case NTAR0.lt.0 (old  OP NTAR.lt.0) electron targets vary from datablock to
datablock. But, totals energy mesh needs to be set once and for all at the
start of processing. Now makes a first "quick" pass through all on,onu files
to build up the complete list of electron target energies so the totals mesh
can be set accordingly, then processes as normal. (And NTART.gt.0 of course.)

28/07/08 adaspi 1.12
New threshold point added to totals energy mesh only if it differs fractionally
by at least DELTAE. Previously, "DELTAE" was hardwired at 1.D-5. Now, as user
can set it, it defaults to 1.D-3. I.E. IF(ENAT(N+1).GT.ENAT(N)*(1+DELTAE))THEN
ENAT(N+1) is added as a new threshold.

28/07/08 adaspi 1.12
NTAR.lt.0 prints all electron targets used (adf39l), but symmetries only for
the -NTAR read, same as NTAR,gt.0. Now set NTAR0 explicitly for common targets,
default .eq.0, sign currently immaterial. (Previously set via NTAR.lt.0., so 
prints warning if NTAR.lt.0 but NTAR0=0 in case original OP dataset/operation 
in use/expected.)

25/07/08 adaspi 1.11
Re-organised memory usage - separated requirements for totals from partials.

23/07/08 adaspi 1.11
NTAR is the number of electron targets for which the user provides labelling info
and these are identified with the first distinct NTAR targets determined internally
from the channel energies (and the labelling written to adf39l) - the parent indexing
in ADAS-speak and which is a basic requirement of adfxx data files. Historically, 
partial photoionization cross sections have been written (to adf39px) for ALL 
electron targets found in the "op" files, i.e. all partial PI data is written.
This is a requirement of the OP (Opacity Project) output which needs everything
but doesn't require identification of the actual final electron-target, just so
long as it has the photon energy (mesh) which is associated with the partial PI
(which it does). Thus, in general, there can be partial PI data in adf39px which 
have an electron target index but no further info (the energy spectrum is known 
though). The reason for this is that in complex cases it may be problematic to
match-up targets/channels. For OP work, it is necessary to be able to easily bypass
such issues. This is the reason why NTAR does not restrict the partial PI data
written to just those electron targets. It can be of interest to do so. Thus,
NTARP has been introduced which does just that, and it is independent of NTAR.
Furthermore, when it comes to the total PI data (in adf39tx) it is an historical
accident that NTAR *did* restrict the partials that were summed to form the totals
to being just over the NTAR electron targets. Basically, this is because the total
PI sections, although written at the time of the OP work and intended for it,
were never actually needed or used then. *This restriction has been removed.*
In addition, NTART has been introduced which does enable the user to restrict
the electron targets which are summed over to form the totals. Also, NTART is
independent of NTAR *and* NTARP. In particular, NTART can be larger than NTARP.
So, NTAR is indeed just the number of electron targets for which labelling info
is provided. The default values of NTARP and NTART are "everything found on file".
Thus, nothing has changed with respect to the partials but the totals are no longer
(accidentally) restricted by the user providing a subset of the target labelling.

23/07/08 adaspi 1.10, adaspe 1.8
Until now, there has been a one-to-one correspondence between any NTAR energies
specified in adasin and the first NTAR determined from (distinct) channel energies
in the rate files. If the user restricts the symmetries in the collision run
(if only interested in initial N+1 level, say, and those dipole connected to it)
via NAST/J say, then not all target symmetries may contribute to said channels. 
There is no simple way for the user to allow for this in adasin. So, now, if user
sets MATCH='YES' then code goes through the (full set still) of target energies
and ignores those which don't match (rather than flagging a mis-match)
until it finds a match (hopefully). Does require the user to determine the
correct set of target energies... Default operation still flags a mis-match
as a mis-match (and stops if not all targets requested are found).
Note: KCUTCC has no effect on target states retained in collision run.
Also, KCUT restricts target states identically in collision and structure runs.

23/07/08 adasdr 1.17, adaspi 1.10, adaspe 1.8
Determine TOLB internally based-on TERMS/LEVELS energies in adasin, and flag
if user sets too large. (Currently, adasrr does not (need to) read any
energies that may be present in adasin.)

23/07/08 adasrr 1.9
Accumulate some minor changes.

22/07/08 asdeck21.13
Stopped in VCG if NAST/NASTJ meant a CF had no terms/levels instead of
just "dropping" the config.

22/07/08 asdeck21.13
Added MAXE to &SMINIM NAMELIST, the maximum scattering energy in Rydbergs.
This enables the optimum radial mesh to be set, which is done before any 
scattering energy is subsequently read in SRADCON (i.e. it is too late by then). 
Historically, non-resonant scattering has thus set a conservative mesh. 
MAXE can be set and is acted-upon for any problem, enabling the user to 
synchronise the radial meshes from a structure and scattering run and, 
hence, match target energies to high precision.

22/07/08 adaspi 1.10, adaspe 1.8
Added IRSLMX to enable user to restrict partial/total tabulation to lowest
IRSLMX initial (i.e. photon target) terms/levels, per datablock. (So, if
the lowest IRSLMX are not common to each datablock...)

21/07/08 adaspi 1.10
Added 4-point lagrange interpolation of partials to convert from electron
energy mesh to photon energy mesh to form totals. Code looks at high-energy
points and if .le. 4 per decade then reverts to original 2-point formula.
Note, interpolation only updated if E has changed by 1.001 (hardwired).
This avoids unnecessary update due to closely spaced thresholds.

21/07/08 asdeck21.13
For case of automatic generation of two distinct groups of interpolation energies, 
code did not check to use closest in energy rather than adjacent index points.
Only used for automatic isoelectronic sequence DR runs and with inner-shells.

18/07/08 asdeck21.13
Enable use of DR energy mesh for PI, case -100.lt.MENG.lt.0. Then -MENG
energies are set-up between EMIN and EMAX, which *must* be specified. 
This "DR" mesh omits the small non-zero energies (of MENG.le.0) and uses
a less "aggressive" log mesh (a larger base than MENG.le.0). Of course,
the user would normally set EMAX much smaller than MENG.le.0 takes.
The net result should be a finer energy mesh suitable for total PI since
then we need an electron energy mesh which can be interpolated onto the 
photon energy mesh. Can always set MENG.gt.0 and use a custom mesh still.
The default MENG.le.0 PI meshes are much coarser and wide ranging. They use
3 (MENG=0) or 5 (MENG=-100) points per  decade which is fine for Maxwellian 
convolution for RR rate coefficients. 

11/07/08 asdeck21.12
Rationalize OPEN statements. Only OPEN a file if it is going to be used!
Rationalize file writes. Only write a file if it is required!

09/07/08 asdeck21.11
Some tidy-ups e.g. remove superfluous labels (ran thru ftnchek v3.3.1).

09/07/08 asdeck21.11
Allow electron collisions with neutral atoms. (Previously stopped as negative ion.)

02/07/08 asdeck21.11
Allow user to restrict to NASTJ 2*J P level symmetries, read free-formatted one per
line before &SMINIM. This mirrors NAST operation. If NAST.EQ.0 then all possible
terms, consistent with triangle relation, are generated for the NASTJ symmetries.
If NAST.NE.0 only those term symmetries are generated and it is up to the user to 
ensure that they represent the desired levels - this was the case before, of course. 
Recall, NAST.LT.0 restricted symmetries to the range MINST, MAXST, MINLT, MAXLT.
Similarly, NASTJ.LT.0 restricts level symmetries to any user specified MINJT, MAXJT.
Useful for open d-shell problems where "just" restricting by term symmetry can
still generate a lot of time consuming unwanted level symmetries. Also provides
a way to ensure all possible terms are initially included in the representation
of a restricted set of levels. Info on NAST/NASTJ restrictions is now printed to olg.

11/06/08 adasdr 1.17
Test explicitly for Auger core re-arrangement continua. These parents do
not support recombined final states - energetically they might but they
would contribute to a different core-excitation.  But, their presence can 
cause the occasional problem when bundle-n=3 data is placed in a higher parent 
by the code. Then, the parent labelling from the Auger parents upwards is 
wrong (mis-aligned) and the Auger parent energies are meaningless since 
they should be a function of n. The config label for Auger parent configs 
should give array out-of-bounds, since =999 is the final n in a normal run.
But, if execution continues then an arbitrary character is printed. 
Only seen in inner-shell (2-3) Mg-like case.

23/05/08 asdeck21.10
Added decimal places to wavenumber energies written to adf04_ls,ic by BORN='YES'.

29/04/08 asdeck21.10
Specifying an orbital to be varied which does not exist in any configuration,
and is listed after all that did exist, did not pass thru gracefully, from
v20.20 onwards. 

28/04/08 adaspi 1.9 adaspe 1.8
Read of LS target info from TERMS was corrupted by change of 18/04. IC o.k. 

18/04/08 adasdr 1.17 adaspi 1.9 adaspe 1.8
Need to take account of mis-match in number of decimal places used to
hold target energies in adasin (ex LEVELS - 8 d.p.) when formatted rate files 
are used (6 d.p.) when looking for any energy mis-match. Not a problem
when like are compared with like. 

18/04/08 adaspi 1.9 adaspe 1.8
If target energies are present in adasin, then these are compared with
those in rate file and any mis-match is flagged.

18/04/08 adasdr 1.17
Energy corrections now based-on internal energies.

17/04/08 adaspi 1.8
Interpolation to form the total cross sections was not quite correct.
The wrong electron energy was used for that to excited electron target states.
Only appreciable near threshold and if PI to ground was not dominant.
Until recently, this code was actually commented-out so could not have
been used by anyone, in anycase. Pointed-out by Mike W.

11/03/08 mdrcs13.2
Coding of convolution of R-matrix OMEGDR with cooler distribution had not
kept up with developments on the binned cross section side to handle numerics
of the much higher resolution used these days.

10/03/08 asdeck21.10
Dimension failure in VCU did not exit gracefully. Dimension failure
in VCG is much more likely, as this is where two subconfigurations are
coupled together. Failure in VCU would be for an individual subconfiguration.

08/03/08 asdeck21.10
If automatic generation of the collision problem was used (A.S. with RUN='DR',
say, and no continuum orbitals specified, so only target configs input) then
had to manually sort subsequently generated N+1 configs before KCUT could
be set and the problem re-run. Now, KCUT can be input initially and be set
relative to the input MXCONF target configs. It is then adjusted internally 
to match the subsequently generated N+1 collisions configs, which are ordered
for KCUT operation. In addition, KCUTCC (new) can be set to apply to the
MXCCF N+1 bound configs explicitly input, and is relative to MXCCF, i.e.,
independent of MXCONF. 

08/02/08 asdeck21.9
Minor changes, left after a test development ultimately did not lead anywhere.

22/12/07 asdeck21.8
Optionally write TCCDW.DAT (TCC='STGICF') as opposed to TCC.DAT (TCC='JAJOM').
Default PHASE is Condon and Shortley (C&S). FANO PHASE tested in LS, and
probably o.k. for 1-body fine-structure, but NOT implemented for 2-body FS.

19/12/07 asdeck21.7
Re-worked ALGEB3/SPOR1/RES1 somewhat. Only about 15% faster, but clearer
and cleaner coding.

18/12/07 asdeck21.6
Separated ALGEB3 and ALGEB4 RESTART. So, now, MSTART=4 restarts a run with
a call to ALGEB4 and MSTART=5 restarts a completed algebra run.
Also, fixed some inconsistencies which had crept in over the years on
some of the more esoteric restart usage such as MSTART.lt.0 or MSTART.gt.5/6
and the ability to switch-off usage of algebra read from RESTART, such as
2FS, IC, radiation, BP, 2NFS.

13/12/07 asdeck21.5
Additional safety test on user input of polarization ALFD, RCUTD.

12/12/07 asdeck21.5
MPRINT=1,2 give increasing detailed printout of subconfiguration couplings.
Dimension tests did not reflect correct memory usage when using VCG.
Re-organized VCU.

11/12/07 asdeck21.4
Introduce NASTP to select parent terms. This operation is CF dependent.
NASTP is the global number of sets of CF and term data. Each set consists
of a CF no. and local no. of terms to be read for that CF. E.g 2 parent
terms from CF=1 (2p^2nl):
 SALGEB NASTP=1 ... &END
 $DRR ... &END
1 2
1 0 0
1 2 0
In principle, the parent parity is irrelevant since it is CF specific but
code test is as per NAST i.e. includes parity - should not be a user problem.
(Like NAST.lt.0, NASTP.lt.0 can be used to set a range of parent SL via
MINSTP,MAXSTP,MINLTP,MAXLTP - probably not of much use compared to NAST.lt.0.)

10/12/07 asdeck21.4
Further to 21.3, KCUT now operates on the PARENT, i.e. target, terms of Ryd/Cont 
configs. Previously, it operated only on channel symmetries - better than KCUT=0, 
but not as restrictive as desired.

06/12/07 asdeck21.3
Re-couple inequivalent subconfigurations, generated by VCU, via explicit
vector coupling coefficients rather than simultaneously diagonalize S^2 and L^2
matrices via VCU. This is basically PJS's approach via his VCG, but here it is
implemented in a different way. Each configuration is treated in isolation,
repeatedly looping around VCU/VCG for each equivalent electron sub-shell.
This enables a Ryd/Cont to be split-off (as per COLLAG) and still break-up the 
target config as well. (One could also specify grandparents, as well as parents,
but there is no facility to do so yet.)

29/11/07 asdeck21.2
Start to re-organise ALGEB1/VCU/VCE to work with subconfigurations.
Hive-off decoding of configs and relaxed set-up to CONFG1.
(Re-label CONFIG called by ALGEB0 as CONFG0.)

27/11/07 asdeck21.1
Start a new version. 
Re-organise ALGEB: hive-off user input and set-up into ALGEB0.
(This includes the A.S. option of generating (N+1)-electron configs from,
user specified N-electron configs, for bound-continuum problems.)

26/11/07 asdeck20.22
Orbit-orbit phase factor had never been written to RESTART.
TBD: separate ALGEB3 and 4 use of RESTART.

23/11/07 asdeck20.22
From v20.20 onwards, did not gracefully exit when NZION=0. 
(Used to time algebra run only.)

22/11/07 asdeck20.22
Add TVARY to &SMINIM, this is the max variation in scaling parameters
allowed per minimization iteration. Default is 0.01 but this can be
too large for refining sensitive cases, where 0.001 may be desirable.

21/11/07 asdeck20.22
IC closed-shell core energy got zeroed-out during TEC/LEC iterations.

20/11/07 asdeck20.22
From v20.20 onwards, relaxed orbital optimization did not vary all scaling
parameters requested.

20/11/07 asdeck20.22
CUP='ICR' with closed-subshells of non-zero ang. mom. orbitals double-counted 
Darwin contribution. Only affects absolute energies, i.e. ground state. Relative
energies unaffected, as closed-subshells are common by definition.

12/11/07 asdeck20.22
Scale Slater integrals by factor SCALER (read in &SMINIM, default=1), a la Cowan.
Can optimize this scaling parameter by flagging an unused dummy orbital ISCALR in
SALGEB. Then use INCLUD, NLAM, NVAR as usual. Only likely to converge if minimizing 
energy differences, between theory and observed. Probably best to optimize the
potential scaling parameters first and then Slater scaling. 
Can input scale factor via the usual lambda(s) or SCALER when ISCALR.gt.0.

09/11/07 asdeck20.22
Added STONLZ to &SMINIM: ='YES' uses nl-subshell resolved screening in determining
the effective charge of STOs that form STO potential; ='NO' uses n-shell resolved.
Default, n-shell up to Ar-like targets and nl-subshell from K-like onwards.
Ar-like plus continuum/Rydberg automatically recognizes and treats as Ar-like 
still.

05/11/07 asdeck20.22
Investigated use of conjugate gradient (CG) method as alternative minimization
algorithm to VA04A (Powell's method) as suggested by Manuel. Remain to be 
convinced of its worth. Activated by use of NVAR (or NVARD/Q .lt. 0, case NVAR=0). 
The (SUBROUTINE CGNR) interface to the Numerical Recipes Library is commented-out
by default and a dummy routine is in its place. This is because of the license
restrictions of Numerical Recipes - its source cannot be redistributed. Once
uncommented (along with FUNC and DFUNC), at compilation, you should link to your 
own (licensed!) Numerical Recipes library. It *must* be REAL*8 but, otherwise, 
the original unmodified routines are used: FRPRMN, F1DIM, MNBRAK, BRENT, LINMIN.

31/10/07 asdeck20.21
***Perturbed TF scaling parameters are now I/O relative to zero.

30/10/07 asdeck20.21
Added dielectric (i.e. two-body) polarization potential. Recall one-body
operation viz. IPOLFN=1 or 2 for Norcross or Bayliss potential, specified
by ALFD(L+1) and RCUT(L+1) in &SMINIM, for orbital ang. mom. L=0-2.
(Defaults to IPOLFN=1 if IPOLFN not set but ALFD/RCUT specified non-zero.)
Now, MOD(IPOLFN,10) gives one-body "IPOLFN" and IPOLFN/10 gives two-body.
So IPOLFN=11 or 22 gives one- and two-body Norcross or Bayliss potential.
N.B. IPOLFN=10 or 20 gives two-body alone.

30/10/07 asdeck20.21
Duplicate configuration test did not always work.

27/10/07 asdeck20.18-20
Combination of relaxed orbitals (BASIS='RLX'), correlation set (KCUT) and
STOs (NZION.lt.0) with no config specified for orbital potential
generation (MCFMX=0) crashed. Normally, (non-relaxed) one specifies the
config to be used to generation the STO potential for each orbital.
If this is not done, then all configs (excluding correlation) are
averaged-over. In the relaxed case, since orbitals only occur in
one config, specifying the config to use is redundant (and, not allowed,
except for common closed-shell core!) but setting KCUT threw out the only 
config they occurred in, for correlation orbitals/configs. O.K. now.

15/10/07 asdeck20.20
Tweaked output during optimization. Added code (commented-out) to enable
use of perturbed TF scaling parameters relative to zero, as opposed to unity.

13/10/07 asdeck20.20
Implemented Manuel's perturbed TFDA potential.
NLAMD, NLAMQ and NVARD, NVARQ play the role of NLAM, NVAR now for the
dipole and quadrupole perturbed potential parameters. Each read on a 
new line with lambdas before the variationals. Currently, zero perturbation
is described by unit lambdas, i.e. the potential coefficient is actually
lambda-1. This may change.

E.G.

S.S.  Sample input for optimizing perturbed TF potential for 2p
123456789 22 12513 23
                10 20 21
 &SALGEB  RUN='  ' RAD='NO' CUP='LS' TITLE='C2+ test'
          KORB1=1 KORB2=1 KUTSO=0 KUTSS=-1   &END
 &SMINIM  NZION=6 INCLUD=10 JPRINT=5
          NLAM=3 NLAMD=3 NLAMQ=3 
          NVAR=0 NVARD=1 NVARQ=1
 &END
1.37105  1.21446  1.14831      <--- usual lambdas for 1s,2s,2p
1.0 1.0 1.0                    <---dipole lambdas for 1s,2s,2p
1.0 1.0 1.0                    <---quadrupole   "      "
3                              <---vary 2p dipole
3                              <---vary 2p quadrupole

optimizes the dipole and quadrupole scaling parameters for the 2p orbital.
NOTE: From Above
01/11/07 asdeck20.22
***Perturbed TF scaling parameters are now I/O relative to zero.
So, replace the dipole and quadrupole 1.0 by 0.0 if using v20.22 or later.

11/10/07 asdeck20.18-20
From v20.5 onwards, a small change in the optimization procedure crept in.
Best illustrated by example. If varying 1s and 2s scaling parameters, then
if 1s parameter changes but the 2s does not, the 2s should formally be
recalculated so that it can be re-orthogonalized to the new 1s. This is
the historic operation. From v20.5, this was not done. Effect is small
of course and of no physical significance, but scaling parameters may/will
have not quite matched what went before.

09/10/07 asdeck20.20
Correlation "terms" were not omitted from fine-structure weighted energy 
functional, when INCLUD.gt.0, unlike LS. 

09/10/07 mdrcs13.2
Allow read of formatted files where level index overflows I5 field,
because correlation tags a minus, so can only read 9999, not 99999 levels.

08/10/07 asdeck20.18-20
Bug-fix on RESTART with 2fs on and 2BP off (QSS index again).

28/09/07 asdeck20.20
Internal re-organization of MINIM, with a view to incorporating conjugate
gradient minimization, as tested by Manuel.

27/09/07 asdeck20.19
Implemented Manuel's minimization of difference between calculated and
observed term energies, weighted over fine-structure in the latter case,
and the former if RUN='IC'. Activated by INCLUD.gt.0 (any value)
and ISHFTLS.ne.0 (any value) then SHFTLS should contain the observed 
term energies, as for iterated TEC's, BUT the absolute (calculated)
ground should be present as well now.

23/09/07 asdeck20.19
If the usual minimization of the energy functional is carried-out, but IC is 
specified, then INCLUD operates on terms averaged over fine-structure levels, 
i.e. it is the level energy sum which is minimized. Note, in this case the 
1s orbital cannot be optimized as the Mass-Velocity Darwin contribution is t
oo large and there is no minimum to the energy functional. Optimize 1s in
LS and fix and then (re-)optimize the remaining orbitals. (Previously, IC 
was switched-off during optimization and then back on for the final print-out.)

21/09/07 asdeck20.18
Iterated TECs did not work when CUP='ICR' (infinite loop).

17/09/07 asdeck20.18
Starting with v19.1 and thru to v20.17, infinite energy omegas likely
omitted octupole (and higher) multipole contributions, plus the very occasional
quadrupole. This is because the Born multipoles were not tested for being
too small for a transition to be skipped, only the radiative rates.
This has been corrected in v20.18. Thanks to Mike for pointing out the
odd missing transition, which led to this discovery.

04/09/07 asdeck20.17
Solved long-standing bug (present in original coding) in orbit-orbit interaction.
The angular algebra of the W_3 operator differs from W_1,2,4, which are the
same as for electrostatic operator, and satisfies different selection rules,
basically lambda of electrostatic is replaced by lambda+1 for W_3. This was coded
for, but there was a "hidden" selection rule switch which appears to affect
configs with 3 or more non-zero angular momentum electrons (which can be equivalent).
The effect is small and only showed itself when looking at channel energies,
which should be unaffected by coupling to a continuum orbital. Instead, slightly
non-degenerate energies could be observed for channels associated with the same
target state. (I originally attributed this to small inaccuracies in the
algebraic coefficients. This was the case for fine-structure algebra. However,
reducing tolerances in the Slater-state algebra enabled any error in the fine-
structure channel energies to be made as small as desired. But, the small
non-degeneracies stubbornly remained in the non-fine-structure case.)
A second check concerns the total orbital magnetic quantum number (M_L) used 
to determine the LS-coupling algebra. It should be independent of M_L, provided
that the necessary Slater states have been determined that result in the given M_L.
The default is to use M_L=L. Using M_L=0 gives identical results for electrostatic
algebraic coefficients, but gave different values of coefficients for orbit-orbit
W_3. Now, M_L=0 gives the same as M_L=L for W_3 as well.

02/09/07 asdeck20.17
Introduced iteration of the usual term energy corrections (TECs), and optional
iteration of level energy corrections (LECs) applied to the diagonal of H(IC).
The ISHFTLS/ISHFTIC options have been modified, as follows:

ISHFTLS (ISHFTIC) .eq. 0, no shifts (default).
 .eq. 1 Read term (level) numbers and energy corrections from file SHFTLS
        (SHFTIC) preceded by the number of state/energy pairs to be read and 
        the energy units used (as IP of H). Can be used together in an IC run,
        then LS energy shifts are applied as term energy corrections to H(IC)
        and the IC shifts as a (further) correction to the diagonal of H(IC), 
        before diagonalization. If applying both to H(IC) then they are best
        determined consistently through iteration, see next option. 
        The term(level) numbers are the algebraic T (LV) numbers, not the energy 
        ordered. 
 .gt. 1 then assumes observed energies, relative to the ground (averaged-over
        fine-structure for terms) NOT corrections, are input and then ISHFTLS OR 
        ISHFTIC iterations of H(IC) are carried-out. ISHFTLS iterations are 
        applied as term energy corrections (TEC) to H(IC). The FINAL TECs can
        then be input in SHFTLS with ISHFTLS=1 and THEN (optionally) ISHFTIC
        iterations can be applied as level energy corrections (LEC) to the diagonal
        of H(IC) before diagonalization. The FINAL LECs can then be input in SHFTIC
        with ISHFTIC=1 to regenerate the final structure without iteration.
 .lt. 0 no iterations (as .eq. 1) but assumes input observed energies (as .gt. 1).
        Note, the IC shifts are applied AFTER diagonalization now (as they must be),
        and so they can be used to achieve exact level positioning.

Note: the LS term energies are shifted by whatever term energy corrections
are present, which may not be optimal for LS of course if IC is the focus.


30/08/07 asdeck20.16
Made available for general testing.
(After having run thru ftnchek.)

29/08/07 asdeck20.16
Developmental archive, no public release.
Two-body non-fine-structure bound-free integrals are now interpolatable.
New dimension MXFOO, as MXFSS but for non-fine-structure.
Thus the NREL variable only affects at which energy continuum orbital
details are printed, along with radiative multipole integrals and H(B-C).

25/08/07 asdeck20.15
Developmental archive, no public release.
Two-body non-fine-structure now added to H(LS) for LSM/ICM option,
along with one-body NFS, assuming switched-on via KUTOO=1.
(KUTOO=1 is reset/switched-off if CUP='LS'.)

24/08/07 asdeck20.14
Developmental archive, no public release.
Two-body fine-structure bound-free integrals are now interpolatable.
(Or, rather, they are calculated at the interpolation energies and
added to H as such, which is interpolated, of course.)
New dimension MXFSS, as MXFSL but for fine-structure.
Two-body non-fine-structure bound-free still taken to be a constant
specified by NREL'th energy.

23/08/07 asdeck20.13
Developmental archive, no public release.
Separate dipole and slater integral evaluation, at continuum interpolation
energies, from RADCON.

22/08/07 asdeck20.12
Developmental archive, no public release.
Separate 2-body M1+BP integrals from 2-body Hamiltonian fine-structure
integrals.

17/08/07 asdeck20.11
Developmental archive, no public release.
IBREIT controls "retardation" of the Breit interaction.
IBREIT= 0 "usual" Breit interaction (long wavelength approx), DEFAULT,
IBREIT=-1 Generalized Breit interaction (non zero exchange photon energy), 
IBREIT= 1 applies generalized to Coulomb, as per Moller interaction.
IBREIT.ne.0 is NOT yet symmetrized.

17/08/07 asdeck20.10
Developmental archive, no public release.
Separate two-body magnetic integrals from DIAGFS.

17/08/07 asdeck20.9
Developmental archive, no public release.
Separate R^K multipole integrals from DIAGON.

16/08/07 asdeck20.8
Developmental archive, no public release.
Separate two-body Slater integrals from DIAGON and allow for retardation.

16/08/07 asdeck20.7
Developmental archive, no public release.
First re-organization with a view to symmetrizing generalized Breit.
Separate two-body magnetic integrals from M1+BP integrals (SOCC, RAD-> RADBP1).

15/08/07 asdeck20.6
Developmental archive, no public release.
Introduce retardation on structure, i.e., generalized Breit.
Compensate for use of implicit small component on 2-body magnetic integrals
(i.e. those with formal P*Q orbital densities). (1-body done some time ago.)

10/08/07 mdrcs13.2
Skip energy matching test for last term/level since that may be a representative
one, for all subsequent states.

09/08/07 asdeck20.5
Developmental archive, no public release.
Use JUPMX, JUPMN, JLOWMX, JLOWMN and LUPMX, LUPMN, LLOWMX, LLOWMN to restrict
radiative output for these rages of levels and terms.

08/08/07 asdeck20.5
Developmental archive, no public release.
Orthogonalization of kappa-averaged relativistic radial functions when small
component in use had never been coded. For l-dependent V, still non-orthogonal
for non- s-states because of different approximations for kappa: 
kappa*(kappa+1)=l*(l+1) in large cpt a.m. term but kappa=-1 in (zeroes out)
spin-orbit. Small cpt just taken from (P'-P/r)/[...], i.e. kappa=-1 here.

03/08/07 asdeck20.5
Developmental archive, no public release.
Added KCUTM1 to SALGEB: BP corrections to M1 are omitted for configs CF.gt.KCUTM1.
Does not relax any KCUT restriction:  KUT=MIN(KCUT,KCUTM1)

20/07/07 asdeck20.4
Developmental archive, no public release.
Coded magnetic radiative integrals for small component (case IREL=2).

18/07/07 asdeck20.3
Developmental archive, no public release.
Added full retardation to photoionization. Recall, 20/11/06 asdeck19.9 included
(first order) retardation on bound-bound radiative rates, this is sufficient 
because photon energy bounded (can force test of full retardation on bound-bound, 
for lowest multipole only, with IRTARD-=-1). No upper limit on PI photon energy 
so need full retardation. |IRTARD|=1/0 retardation on/off (SMINIM), CUP='ICR' ONLY.
MUST have small component (IREL=2) though, at more than a few times threshold 
energy. BABUSHKIN/LENGTH and COULOMB/VELOCITY coded (PIG='LEN', 'VEL' in SRADCON).
If relativistic wavefunctions in use, retardation is on by default for radiation. 
Small component is currently off by default, except when photoionization is on.
Currently, structure is not retarded and small component neglected by Breit interaction.
(P.S. see v20.6.)

02/07/07 asdeck20.2
Remove conflict between local variable names (ISIGN, MERGE, IFIX) and
FORTRAN intrinsic names. Many "cosmetic" changes.

01/07/07 asdeck20.1
Minor.

30/06/07 asdeck20.1
Major re-organization.

30/06/07 asdeck19.10
Werner's initial fix for one-body BP corrections to M1.
Archive.

31/05/07 adasrr 1.9 adasdr 1.17
Ensure parent labelling is mapped to states of inequivalent electron run.

22/05/07 mdrcs13.2
Added multiplication of xsctn by Schippers survival probability factors to
RR processing.

15/05/07 asdeck19.10
Some unnecessary M_k  algebra skipped.

12/05/07 asdeck19.10
Orbitals to be read via RADWIN not flagged correctly when continuum present
and RUN='  ', from v19.9.

11/05/07 asdeck19.10
Fix of 09/05/07 screwed-up closed-shell contributions (all BASIS).

10/05/07 adaspe 1.7
Allow processing of datasets where all configs are included up to some max n,
as opposed to looping over n.

10/05/07 asdeck19.10
Erroneous error message/STOP when number of orbitals exceeds 1000 (BASIS='RLX',
obviously).

09/05/07 asdeck19.10
Fixed BASIS='RLX' bug for anything other than small test cases, introduced in v19.7.
(If did not crash, then "small" errors in structure.)

08/05/07 adaspe 1.7
If NTAR is not specified then all possible electron targets, allowed by dimension, 
should be resolved (assuming target info from TERMS/LEVELS present in adasin).
This had become "inoperative", now restored.

30/04/07 asdeck19.10
In the AS/SS/ZSS suite, there is a relative phase error (between the spin and 
orbital contributions) for the determination of even magnetic multipole 
radiative rates M2, M4 etc. (SS is only coded for M2, while ZSS is only 
operational for M2 as far as I am aware.)
There is a further error for M_k>2 due to the transposition of two arguments
in the 6j-symbol of the orbital contribution. This only affects AS, as SS/ZSS
do not go beyond M2. (M2 is unaffected because the two arguments are equal
for M2, while for M1 the orbital ang. mom. are the same leading to a symmetry 
of the 6j-symbol.) Archive.

23/04/07 asdeck19.10
Set M1+BP gauges for l1.eq.l2 and l1.ne.l2.

19/04/07 asdeck19.10
Minor.

14/04/07 asdeck19.10
Corrected bug in M1BP when relativistic radial functions in use.

10/04/07 asdeck19.10
Due to re-indexing, v19.9 onwards dropped the last two-body fine-structure
radial integral for H if BP corrections to M1 were omitted.

07/07/07 asdeck19.10
Contribution from finite nucleus was not being removed from one-body
kinetic-plus-nuclear integral (necessary so as to cancel Slater
integral contribution at small-r). This is small, but important now,
given the accuracy of energies with new default finite nucleus.

06/04/07 asdeck19.10
Added finite nucleus U_6 charge distribution of Bogdanovich & Rancova
Lithuanian J. Phys. v42, 257 (2002). New DEFAULT for relativistic orbitals.
(Uniform charge gives rise to a discontinuity in V'', which occurs in
transformed radial equation, and gives numerical uncertainties larger
than desired accuracy.) 
***Now, INUKE=-1 gives point, 0 gives uniform and +1 gives non-uniform.
Recall, default atomic mass (ATM) is 2.5*Z.

16/03/07 asdeck19.9
Minor. Archive development.

15/03/07 adasdr 1.16 adasrr 1.9 adaspi 1.18 adaspe 1.7
Test to catch read-off end of orbital definition line was only
applied gracefully to first file. This is only an issue for g77
which does not reposition at start of next line.

10/03/07 adaspi 1.8
In effect, only took PI of initial outer n-shell defined by NV.
Necessary for LV.ge.0 loop, but not necessary  for LV=-1.

TOLR.gt.0 allows PI from initial autoionizing states, within TOLR of
ionization limit. Now allow TOLR.lt.0 to restrict tabulated output;
i.e. only states -TOLR below ionization limit are tabulated.
Default, TOLR=0.

04/03/07 mdrcs13.2 adasdr 1.16
Use target energies from rate file when applying energy corrections, and 
flag if they differ from user input. So user input not needed here now, 
but trivial and user should match observed with them.

02/03/07 adasdr 1.16
Imported read/use of Schippers' survival probabilities from mdrcs13.

02/03/07 adasdr 1.16
RCOR .gt. 0 multiplies core radiative rates by factor RCOR, i.e.
a single correction factor compensating for combined error in 
line strength(s) and energy factor. This is long standing.
RCOR .lt. 0 (new) .and. observed energies present, use them for
DE factor. RCOR .ne. -1 should then just be any further correction
to line strength. RCOR .lt. 0 thus applies different corrections
to each core radiative rate. Still unique factor for line strength.

01/03/07 mdrcs13.2 adasdr 1.16
Minor fix to threshold bin on interpolated n.

13/02/07 asdeck19.9
Added KCUT to &SMINIM NAMELIST to suppress printing of "correlation"
rates, but without restricting KCUT in SALGEB because of subtle
problems this engenders in DR runs.

13/02/07 asdeck19.9
Added DIM1,2 as allowed RAD options (long standing options but
were not recognized by new test to filter out unrecognized RAD
options.

****Note: 19.9 restricted range of continuum normalization. This introduced
inaccuracy when plasma (or polarization) potential present, esp. for Debye. 
Not fixed/noticed until 26.18. Final bug-fix versions of v24.x and v25.x were
also patched 03/07/18.

10/02/07 asdeck19.8
Minor:
There was a small inconsistency for Ar-like ions with STO potentials.
The screening by equivalent electrons in the Slater Type Orbital is by 
n-shell up to Ar-like and by sub-shell after Ar-like. So, an Ar-like
target uses n-shell screening but then the DR run is K-like, and used
nl-screening, so the target energies in the DR run do not quite
match those from the structure run. So, if the later are used
along with observed energies by MDRCS13, then there is a slight
mis-match. (There was a test to catch this, looking for a continuum
orbital in use, but it didn't work as the variable being tested
is not set until after  the continuum radial is calculated, but we need
to know before during bound orbital evaluation so a different test 
has been implemented, and tested properly.)
Also added EMIN, EMAX to SRADCON NAMELIST so can be specified there
(optionally) instead of on a subsequent line.

06/02/07 adasdr 1.16 mdrcs13.2
Minor synchronization.
Also, use of NMIN in adasdr omitted PP hydrogenic rates to n.gt.NLMAX (=10).

02/02/07 adasdr 1.16
ADASDR deals primarily with partial rate coefficients, resolved by final
state. For high-n is gives results for representative n. Total rate
coefficients and binned (total) cross sections require the "missing" n.
These are done via interpolation and quadrature. In MDRCS the n-nodes
are indexed by autoionizing n. In ADASDR they are naturally indexed
by recombined n. To get totals, v1.15, and earlier, weight outer electron
radiation to take account of this fact. In moving to 1.16, the weighting
was removed (for totals only) but the n-indexing was not switched to
be by autoionizing state and so effectively there was no outer electron
radiation contribution to recombination, for n.gt. sequential n. Of course,
this is a very small contribution. The indexing has now been changed to
autoionizing n - for totals and binned cross sections only! This means
that it is now possible to interpolate the missing n in energy as well.
This gives more precise binned cross sections, and has been implemented.

31/01/07 mdrcs13.2
Re-instated energy interpolation of (n-)interpolated resonances. 
This was, and is, approximate and can give false peaks when convoluting with 
high resolution cooler distribution. Hence original removal, back in 12.48,
(and interpolated cross sections placed at node n-values, so clearly wrong - 
hence forced user to use sequential n-values - but Maxwell (or other broad 
distribution fine). On the other hand, if n-values are close enough together 
and/or cooler distribution broad enough then interpolated positions are fine.
So, CAVEAT EMPTOR. If you interpolate then you may see unphysical bumps.
(Clearly, sequential n-values only make sense up to about 100, i.e. for
comparing with experiment. But one is unlikely to need anything but a
Maxwellian convolution for n.gt.100 and positioning at or between node
n-values is unimportant. Also, near threshold must have sequential,
but even weakest fine-structure is open by 100.)

22/01/07 mdrcs13.1
UNITS=13.606 used wrong bin energy - failed safe.

04/01/07 asdeck19.8
Minor bugfixes.

16/12/06 adasdr 1.16
Minor tweaks.

15/12/06 adaspe 1.7
Fixes for g77.
Remove NMAX=NRSLMX if NMAX not set (originally for OP safety), so get
all possible autoionizing Rydberg states - unless NMAX set! Initial
bound states are restricted by NRSLMX (as in DR, PE is inverse DR).

14/12/06 asdeck19.8
Note: v19.8 is still public default, all corrections made here are also made
to the current development version.
MXCCF.lt.0 did not work correctly with closed shells.
Add continuum to N-electron configs, case RUN='  ' and MXCCF.gt.0.

12/12/06 adaspi 1.8
Fixes for g77 compiler.

29/11/06 asdeck19.9
Smooth discontinuity in V'' which arises on using a uniform charge
distribution for a finite nucleus. Introduce a skin thickness (a la Fermi
distribution) and linear interpolate V'' across it.
Allow user to switch from uniform finite nucleus (default) to point, via INUKE.
INUKE=0 point, INUKE=1 finite, nucleus. 
Default atomic mass (ATM) is 2.5*Z.
Default radius RNUKE due to Cheng & Johnson.

28/11/06 asdeck19.9
M1+BP: replace non-rel kinetic operator (Del^2) by kinetic+MVD, i.e.
Del^2-alpha^2(Del^4+Del^2(1/r))/4.

20/11/06 asdeck19.9
Include retardation on non-rel M_k and E_k radiation operators (bound-bound)
only, i.e. not on photoionization yet..

20/11/06 mdrcs13.1
A free-formatted read of the op file failed, now needs to be formatted.

09/11/06 asdeck19.8
Added IFILL to NAMELIST &SMINIM.

08/11/06 asdeck19.8
If RUN.ne.'  ' and no continuum orbitals are specified on the (optional) orbital
redefinition line then it is assumed that N-electron target configs have been
specified (as above) and N+1 configs are internally generated by adding LCON
continuum orbitals to each target config. Depending on RUN, a Rydberg orbital
is also added. If explicit bound N+1 configs are needed (e.g. DR) then 

MXCCF > 0 reads N+1 configs in same fashion as N-electron configs. 
      < 0 determines all possible based on adding a base orbital to all N configs.
      = 0 (default) no explicit bound N+1 electron configs.

Note: N+1 ICFG is determined from ICFG/10 (N-electron ICFG is actually MOD(ICFG,10).)


04/11/06 asdeck19.8
Extensions to A.S. config input:
MXVORB .lt. 0 assumes nl standard order definition and so (n,l) NOT read.
ICFG.ne.0: NXTRA, LXTRA (optionally) extends the nl definition to n=NXTRA, l=LXTRA 
in standard order AND assumes MNAL(I,M)=0, MXAL(I,M)=NXCITE(M), for orbitals
I.gt.|MXVORB|, and base config. M occupation 0, i.e. only READ such info for
I.le.|MXVORB| now.

28/10/06 mdrcs13.1
Minor bug corrected.

28/10/06 asdeck19.8
M_k>2 in combination with BP corrections to M1 could give undefined index.

27/10/06 asdeck19.8
Incorporated CONFIG routine directly, for use with A.S. style input only(!).
ICFG=0 (default), as before, reads MXVORB occupation nos only for each of the 
MXCONF configurations. 
ICFG=1 reads STG2 style input viz. global min and max allowed occupation nos 
(MNAL,MXAL) together with MXCONF base configs with MXVORB occupation nos AND
number of promotions (NXCITE).
ICFG=2 read MCONFIG style input, viz. local min and max allowed occupation nos
for each base config.
ICFG=1,2 also write CONFIG.DAT which can be manually edited and read back in via
ICFG=-1.

26/10/06 asdeck19.7
Any of the RAD='BP/ALL' type options did not switch-on M2, which is the
new default. Corrected a small bug in M2 introduced in 19.4.

19/10/06 asdeck19.7
Similar vector search in ALGEB2. Modest speed-up of 2-body electrostatic
algebra.

14/10/06 asdeck19.6
Similar vector search in ALGEB3. Speed-up of 2-body fine-structure
algebra by factor 10. Modest speed-up of 1-body algebra.

13/10/06 asdeck19.5
Replaced vector search of coefficients in ALGEB4 (1- and 2-body BP
corrections to M1) by explicit indexing. Order of magnitude speed-up of 
2-body in large cases, factor 2 for 1-body.

10/10/06 asdeck19.4
Magnetic angular algebra (including BP corrections to M1) now fully
"grouped", i.e. Slater state interactions only determined between
CSLJP-C'S'L'J'P' groups not level-level, as per all other angular algebra.
Added RAD='BP1' option to restrict M1-BP corrections to 1-body, as 2-body
still time consuming in large cases.

26/09/06 asdeck19.3
Developmental archive, no public release.
Continue grouping re-organization - algeb4, diagfs.
(RESTART now works with magnetic radiation.)

16/09/06 asdeck19.2
Developmental archive, no public release.
Start re-organization of magnetic multipole algebra to work with
symmetry groups, as per rest of interactions. (M1-BP was not done when
rest of code was originally re-written.) Split algeb4 into algeb4 and mkalg.

15/09/06 asdeck19.1
RAD='M2' did not switch-on M2! This was due to a late change while looking at
other input combinations.

14/09/06 mdrcs13.1
Obvious bug (if your compiler faults it) corrected.

07/09/06 asdeck19.1
Added higher multipole magnetic radiation (>M1).
Access via RAD='M2' (but no BP on M1) or RAD='BP' (M1+BP)
or RAD='ALL' (inc inf. energy Born limit).

01/09/06 asdeck19.1
Starting with v19.1, STO default is NOT to orthogonalize unless asked to do 
so (via ORTHOG='YES'). The reason for this is that STO overlaps can be large
and if not optimized, can give poor results. Better results are obtained then
if overlaps are neglected. If overlaps are small, then there is little effect.
If optimized, both (ORTHOG='YES' or 'NO') give similar results. 
TF default is unchanged since overlaps are smaller, e.g. unoptimized orbitals
(lambda=1) are automatically orthogonal, unlike STO.

22/08/06 adasdr 1.16
Omit TOLI from final-state resolved energies written to adf09. Recall, this
is basically the difference between energies from two AS runs which include
the same final state but have slightly different energies. (In the high-n
limit it one may move above the ionization limit of the other.) So, TOLI
is within theoretical uncertainty. But, a user could set it artificially
large and still get same DR rates but energies artificially low. This does
mean that the final state energies from here-on will not quite match those
prior to this change, although the partial and total rates are unchanged.

18/08/06 mdrsc13.1
Forgot to change unformatted PI unit number in FEARS/M. Checked in
default DR run. And, formatted read of radiative rates now reads
all six integer indexes.

16/08/06 asdeck18.16
Commented-out symmetry re-ordering of 2-body M1+BP radiative integrals,
since re-ordering and no re-ordering give different results.
Am in discussion with Werner about this.
Relaxed orbital option now gives identical results to non-relaxed, in
test case when a common radial basis is used. 
The non-relaxed results are, of course, affected - typically <5%
change in M1 rates, but factor of 2 in the odd case.

14/08/06 asdeck18.16
First fix of BP corrections to M1 angular algebra when using relaxed
orbitals - no interactions between levels belonging to different
configs were being computed, in general.

12/08/06 asdeck18.16
One of the eight (or so) radiative integrals for BP corrections to M1
was not being calculated when relativistic radial functions were used.

11/08/06 adasrr 1.9
***WARNING: CRITICAL UPDATE. IF YOU RUN AN EARLIER VERSION OF ADASRR 
IN SAME DIRECTORY AS A PREVIOUS MDRCS13 (11/08/06 OR LATER) RUN, THEN
HYDROGENIC TOP-UP WILL BE WRONG, AS EXISTENCE OF EMPTY opn/u FILE
RESETS LAST L TO -1, SO TOP-UP STARTS AT L=0 INSTEAD OF OLD L+1.
THE TOP-UP IS ON BY DEFAULT.
Also, added warning if reading-in user defined T which is less than
10*z*2 K and Newton-Coates quadrature in use (default, as fast and
accurate) because internal energy quadrature mesh not set to handle lower T. 
Use INAG=-1 (mid-point rule) if you must - not good at high-T, 
especially for partials.

11/08/06 mdrcs13.1
Allow multiple photoionization cross section files (op1/u, op2/u).
op and opu are no longer accessed. ombg/u are still looked at first,
if empty then opn/u read, as was for op/u.
***WARNING MUST USE UP-TO-DATE ADASRR.***

09/08/06 adasdr 1.16
Synchronize with mdrcs13.f over minor processing differences.
Main change to adasdr is to use last energy shift as representative.
Optional read of quantum defects, as per mdrcs13.
Minor adjustment of outer shell pp'd radiation for binned cross sections
and total rate coefficients. Partials (adf09) unaffected.
If no observed energies used, then agreement to 4 or 5 s.f. - pp'd
total radiative width weighted slightly differently for n-gaps.
If observed energies used, then very first nl-block not corrected
by mdrcs13. Elsewise, adasdr has more reliable determination of
parentage. Main difference in binned cross sections due to 1/E factor 
if different parents determined.

08/08/06 mdrcs13.1
Determine metastable RR n-cut-off internally, by default. Can still
override.

28/07/06 ***** MDRCS V13 ******
Major re-write of the core CROSSX processing routine. Now an order of
magnitude faster for large cases (hundreds of thousands of rates per nl).
***Only photon emission has been tested*** Gives identical results to
v12.49 except case of DR from metastables using observed energies and
post processing outer electron radiation, determining final stable
states internally. v12.49 used autoionizing energy corrected relative 
to the initial state as basis for determining whether final-state was
bound or not - should use corrected relative to ground, as implemented
in v13.x (not easy to implement in 12.49), both (correctly) test 
(N+1)-electron final energy relative to N-electron ground.
***Electron emission still needs to be tested against 12.49***
Also, one should check little used options. (JCFJ, JCFR checked.)


28/07/06 mdrcs12.49
Archive, for testing-out v13.x. Only bug fixes will be applied in the future.

26/07/06 mdrcs12.49
Bug if run with more than 10,000 (N+1) levels. Radiative rate index gets
screwed.

22/07/06 mdrcs12.49
Add debug print.

21/07/06 asdeck18.16
STO nl-subshell resolution gave continuum orbital asymptotic charge
1 greater than correct. Default operation is n-shell.

20/07/06 mdrcs12.49
Added ADASDR style read of target symmetries and energies i.e. cut-and-
paste from TERMS and LEVELS files. Set NTAR1=-NTAR1 to access this i.e. 
default as before.

06/07/06 mdrcs12.49
Added coding and control variable NFNLMX to read survival probabilities
FNL from Stefan Schippers modelling of ion trajectories from cooler
to analyzer. NFNLMX is the max n for which probabilities are read
from file fnl; thereafter zero probability. Default, .le. 0 off.
Also added optional TCOOL to existing simple delayed cut-off (the
time-of-flight in the merged section of the cooler).

27/06/06 mdrcs12.49
Add manual (NCUTRR) RR metastable n-cut-off (unlike ADASRR, RR is
summed-over n before target energies are read, hence post-processed
RR bound vs autoionizing final state cannot be determined).

27/06/06 asdeck18.16
Add warning mesh if default PI mesh truncated. (User input mesh
truncation already warned.)

26/05/06 mdrcs12.49
Some test coding on reading parents from file meant that original use
of JPAR needed another switch set. Re-instated so that only JPAR need
be specified to select parent JPAR, as before. (Test code introduced
around time of NQDT i.e. 27/04/06.)

27/04/06 mdrcs12.49
Read NQDT quantum defects for Rydberg orbitals L=0,1,..NQDT-1 to be
used in determination of autoionizing parents, for use of observed
target energies. For case where defaults QDs are not accurate enough.
This gives close agreement with ADASDR, which uses a different approach.

14/04/06 mdrcs12.48
Do not adjust target energies for a level if it's parent not found.

13/04/06 asdeck18.16
A TINY change.

12/04/06 adasdr 1.15
Write standard binned cross section file ocs, for subsequent convolution
by mdrcs12.f for experiment etc. adasdr has a more reliable determination
of parents, needed for applying observed energies. Set NBIN, EMIN, EMAX
as usual. (No partials computed and no adf09 file written then - faster.)

10/04/06 asdeck18.16
This NCHAR/XCHAR does not work with all compilers, or even different
versions of same compiler. So, revert back to original legacy code. Only
solution is to use CHAR/ICHAR and change all post-processors accordingly
at the same time. Currently, legacy code is only a problem for gfortran.

04/03/06 asdeck18.16
Previous change did not work with MIPSpro compiler when NCHAR called
with an array element (alignment problem -> bus error) so, copy array 
element to scalar character before calling NCHAR.

10/02/06 asdeck18.16
Introduced NCHAR/XCHAR to implicitly equate integer to character, to avoid
compile error on certain compilers e.g. gfortran. Use this rather than 
explicit type conversion with ICHAR/CHAR because ICHAR(CHAR).NE.I=CHAR. So,
the UNFORMATTED passing files from AUTOSTRUCTURE to the post-processors 
would change their integer representation of characters and so all post-
processors would need changing to use ICHAR/CHAR at the same time. And
the new post-procs would not be backwards compatible with versions of
AUTOSTRUCTURE prior to the change. This way is transparent to the user 
and backward/forward compatible. Any post-processor which explicitly
equates integer to character can be modified in the same manner as and
when it is needed for use with an unforgiving compiler. So, AUTOSTRUCTURE
will now compile under gfortran. It won't run, but that is their problem.
This is a legacy issue (Fortran IV) relating back to use of characters before 
the availability of TYPE CHARACTER. Assignments such as M='TEXT' were used,
where M is I*4.

28/01/06 mdrcs12.48
NMIN only worked for low-n i.e. no gaps.

26/01/06 asdeck18.15
 ****ERROR IN SR.RADCON, UNSUITABLE ENERGY RANGE FOR INTERPOLATION...
A (new) logical variable not initialised to F for DR operation, jobs aborts 
on machines which take undefined logicals as T.

24/01/06 asdeck18.15
Re-initialise generation of cascade coefficients via KUTCA.ge.0 in &SMINIM.

18/01/06 asdeck18.15
Read P-function only in RADWIN (KEY=-15) from GRASP (large cpt) and
generate a Q-potential function (NOT small cpt!) internally.

17/01/06 asdeck18.15
Improved treatment of (semi-)relativistic radial functions.

23/12/05 adasdr 1.14
Avoid exponential overflow.

20/12/05 adasrr 1.9
Hydrogenic top-up of metastable totals was memory misaligned, mostly
being omitted. Ground state total little or not affected. Partials
not affected.

29/11/05 adasdr 1.14
IOLDW=0 New default: fixed format read of stat. weights; and any calculated
energies *alongside* as produced by new TERMS/LEVELS files. Any observed 
energies then follow directly (no calculated). Will also read old stat. weight 
(files), detect absence of calculated energies alongside and then any read of
calculated energies *afterwards* (then observed) as of old.  
IOLDW=1 use old free-formatted read of stat. weights; any calculated energies 
are then read after. For use with old files that are mis-read by fixed format 
due to manual entry/spacing of stat. weights.

26/11/05 asdeck18.14
Tweak automatic determination of Auger energy range.

23/11/05 asdeck18.14
Minor.

17/11/05 adaspe 1.7 adaspi 1.8
Suppress writing of closed-subshells if configuration field too long.

12/11/05 asdeck18.14
Tweak internal autoionization energy mesh (case EMIN and/or EMAX not set).

12/11/05 adaspe
Use JCFJ<0 to include only autoionizing configs .gt. -JCFJ; complements
JCFJ>0 which includes only autoionizing configs .le.  JCFJ.

11/11/05 asdeck18.14
INTEGER overflow for large number of relaxed orbitals (fast indexing of
radial multipoles). Solution: judicious coding of INTEGER*8.

09/11/05 asdeck18.14
RESTART did not work for case of relaxed orbitals (BASIS='RLX' etc.)

09/11/05 adaspe 1.7 adaspi 1.8
Allow for read of terminator in TERMS/LEVELS files.

08/11/05 asdeck18.14
Case MENG.LE.0 during autoionization run, if EMIN and/or EMAX not set (or set negative)
then read target energies from TERMS or LEVELS file so as to determine interpolation 
energies internally. Note, TERMS/LEVELS only written in "structure" mode i.e.
no continuum, so, no read/write conflict. Of course, must have carried-out
a structure run the the same directory beforehand. Also write CF and term/level
position with in a config (symmetry, not energy position) to TERMS/LEVELS.

02/11/05 adaspe 1.7
Allow read of TERMS/LEVELS to terminate by end-of-file, so NTAR
can default to large number and then be reset automatically.

29/10/05 asdeck18.13
Use of relaxed orbitals for photoionization generated a huge number
of unnecessary bound-free radiative multipole integrals.
Write energies to TERMS/LEVELS file.

28/10/05 adaspi 1.8
Allow read of TERMS/LEVELS to terminate by end-of-file, so NTAR
can default to large number and then be reset automatically.

27/10/05 asdeck18.12
Collapse relaxed orbital list back onto original for writing to ols/ic/u files.

25/10/05 asdeck18.12
Use of BASIS='RLX2' with closed-shells (KCOR/KORB) caused stop with
cryptic error message "diagon: why are we here?".

24/10/05 adaspi 1.8
Automatically reduce, and flag, NTAR if less symmetries present in 
TERMS/LEVELS due to degenerate energy target states being combined. 
Requires TOLB to be the same in AUTOSTRUCTURE and ADASPI!

24/10/05 asdeck18.12
Automatically merge terms/levels that are energy degenerate (within TOLB)
and average (2S+1)/2J for writing to TERMS/LEVELS (only). Does not apply
to channel energies (of course). This enables post-processors, such as adaspi,
to handle the unresolvable target states automatically.

21/10/05 adaspi 1.8
Minor, for compatibility with adasrr input files.

14/10/05 asdeck18.12
Use of ISHFTLS.lt.0 to replace energies (via SHFTLS file) did not
skip "zeroes" i.e. all but replaced energies were zeroed-out. (Use of ISHFTIC 
was o.k.)

12/10/05 asdeck18.12
ORTHOG='NO' did not work for RUN='DR' with external orbital input (radwin).

11/10/05 adasrr 1.9
Minor.

10/10/05 asdeck18.12
Dipole polarizability correction to dipole length radiative operator
was missing for bound-free transitions.

08/10/05 asdeck18.12
Use default finer radial mesh with  pseudo-states, mainly for
writing radial file to R-matrix.

01/10/05 adasrr 1.9
Allow use of observed ionization potential in converting from PI to RR,
sensitive at low-E. Should really use ECORLS/IC in AUTOS in the first place.

30/09/05 asdeck18.12
If Thomas-Fermi potential doubles step length in RR run (or any nl-loop)
then subsequent l (not n of same l) used a slightly inconsistent radial 
mesh which resulted in small absolute error in energy of no physical
consequence. But, it caused large relative energy error when ionic
thresholds that should remain unchanged get shifted slightly. Note,
was only likely in RR run since this uses a finer radial mesh than DR etc.

30/09/05 adasrr 1.9
Minor. IPRINT=1 will printout partial PI as well as RR.

24/09/05 adasdr 1.13 adasrr 1.9
Only rewind read header failure at start of file. So, just
one chance to reset MXORB for gnu compiler . Thereafter assume read-off
end of record is positioned at start on next. See 07/04/05.

24/09/05 asdeck18.12
Increase internally-set max no. of allowed iterations to determine
bound orbitals - finer radial mesh for PI seems to need this.

16/09/05 adasrr 1.9
Ensure all STOPs have ERROR flag for graceful exit by run_RR script.

15/09/05 asdeck18.12
Mirror BASIS='RLX' with STOs by not orthogonalizing, unless specifically
requested to by ORTHOG='NL'.

14/09/05 asdeck18.12
Relaxed orbital usage (BASIS='RLX') requires at least one open-shell
non-valence/continuum orbital, so stop if not the case. Solution,
treat closed-shell as open. If no closed-shell then the problem is
pure hydrogenic!

12/09/05 adasrr 1.9
Write Z and NE to adasout for RR fit code to pick-up.

07/09/05 adasrr 1.9, asdeck18.12
***First production release for RR adf48 generation.
***Requires at least adasrr v1.9 07/09/05, or later AND
   asdeck18.f v18.12 07/09/05, or later.

06/09/05 asdeck18.11
Tweaks for adasrr.

06/09/05 adasrr 1.8
Tweaks for asdeck18.

29/08/05 adasrr 1.8
Test on radial length/DE**(2*IPIG-2) seems too aggressive. Stay with
PMIN(LEN)=1.d-22 etc. Note, since hydrogenic imposed after failure,
we want to push to as high an energy as possible before switching,
but failure is "catastrophic" so cannot be too aggressive.

29/08/05 asdeck18.11
Specific PI gauge specification was screwed-up following change of 
default to variable gauge, which was fine.

27/08/05 adasrr 1.8
Since default AUTOS PI run now switches gauges, default PMIN
now set to check for failure of ACC gauge, as opposed to LEN.

27/08/05 asdeck18.11
Default PI XSCTN calculation (PIG='   ') now automatically switches
gauge progressively from LEN to VEL to ACC as energy increases.
Switching as per adasrr (26/08/05) and controlled by (initial)
setting of z-scaled PMIN (default, 1.d-22), which is reduced by
a factor 10^6 from LEN to VEL, and another 10^6 from VEL to ACC.
Will probably change PMIN to square of radial length integral
(as opposed to PI XSCTN in cm^2 currently).
Also, normal PI operation (RUN='RR' or 'PI') does not require 
(and preferably so) that the user to set anything regarding the 
energy mesh as it is determined purely internally; i.e. &SRADCON  &END 
is all that is required, no MENG and no EMIN,EMAX following - still 
required for RUN='DR' though.

26/08/05 adasrr 1.8
Now automatically switches to hydrogenic top-up in energy as
a function of nl based upon when analytic coulomb PI XSCTN falls
below PMIN. Default PMIN assumes PIG='LEN'. If PIG='VEL,'ACC'
in AUTOS then set thus in adasin &TWO and PMIN re-set internally.
User can also set (z-scaled) PMIN explicitly. Ideally would like
hybrid LEN/VEL/ACC from AUTOS then adasrr could default to PIG='ACC'.

26/08/05 asdeck18.10
Minor. Now archived.

22/08/05 asdeck18.10
PIG='ACC', 'VEL' did not treat high Rydberg states approximated
by a zero energy continuum correctly - the long range integrals
were not correct. There is still some additional approximation
required for 'VEL' because of integral G*F' and its treatment
by ASSX (amplitude phase) method; good at medium to high-E
but not quite as accurate as length at low-E. Still, this is
dominated by high-l (post-processed) hydrogenic normally.

12/08/05 asdeck18.9
PIG='ACC' now uses derivative of DW potential for photoionization
acceleration gauge. Previously, just used derivative of nuclear
coulomb potential. Still highly inaccurate for low E and/or L.

11/08/05 asdeck18.9
Use of more than 66 orbitals was restricted to them being s-orbitals.
(60 the is max number of Eissner orbitals.) Needed for large RMPS.

28/07/05 asdeck18.9
Now stops if there is a mis-match between n-value designation on
orbital redefinition line and that present in radwin file.

27/07/05 asdeck18.9
Output rate files for post-processing did not have NV specified
when using HF (or any external orbital) radwin input. It is now
taken from the orbital specification line so the n-value (modulo 70)
must be meaningful. Previously, recommended but not necessary as
n-value of an orbital taken from radwin file and first suitable
replacement orbital of correct ang. mom. replaced. THIS IS STILL
THE CASE for now. So n-value specification on orbital redefinition
line should match that of radwin, if want correct n-value on ols/oic 
file header.

06/07/05 mdrcs12.48
Make default code independent of external libraries (NCAR, NAG).
NCAR commented-out since rarely used. Use instead gnuplot on the
doutgnu file. Gauss-Laguerre quadrature and least-squares fit use
Numerical Recipes source. For ordinary quadrature, trapezoidal rule
is used (since we want to handle non-uniform meshes easily). NAG use
commented-out.

24/05/05 asdeck18.9
Use PIG='LEN', 'VEL', or 'ACC' to select photoionization gauge in &SMINIM.
Default ='LEN' for all E,n,l but this may change in the future as 'LEN' 
suffers from (lack of) numerical cancellation at high E,l.

21/05/05 adasrr 1.7
Mis-alignment of l (l.vs.l-1) hydrogenic post-processed bundled-nl.
Improved accuracy spline fitting - was inaccurate for high-l partials.
Lagrange interp. now default though.

19/05/05 adasrr 1.7
Allow for change in parent when topping-up in E. Omission of this caused
problems when fitting because of discontinuity in E (for weak transitions
though which could/should be dropped). Top-up in L only for parent conserved.

17/05/05 adasrr 1.6
Introduced Newton-Cotes quadrature for fast accurate convolution of partials,
esp. high-n/T. This is the default.

12/05/05 asdeck18.8
STOP if OMGINF incomplete due to lack of space.
FLUSH radial file once completed.

06/05/05 adasdr 1.13
Not all partials written for low-charge 1-2 because test temp is too low.
Totals unaffected.

06/05/05 asdeck18.8
Do not overwrite BORN='YES' with BORN='INF' when RAD='ALL' is used.

06/05/05 adasdr 1.13
Advanced option to deal with rare case of config labelling of a pair
of levels swapping as one moves along an n-series. (ADASDR requires
that the config label of a level be constant along an n-series.)

05/05/05 adasdr 1.13
Archived accumulated changes as v1.12. Start v1.13.

04/05/05 adasdr 1.12
Formatting fix.

03/05/05 asdeck18.8
Suppress spurious warning message due to undefined DDY when reading radial mesh
(KEY=-9) from radwin. If undefined defaults to zero then message was not
written. DDY not use elsewise before being defined.

03/05/05 adasdr 1.12
Final parent not found for master term/level just autoionizing. This was
due to a change of flags in v1.12, worked fine in v1.11. (Now fixed.)

27/04/05 asdeck18.8
Identification of e-vectors by original basis failed in extreme cases (DIAG).

11/04/05 adasdr 1.12
Below fix for g77 rewound file for EVERY nl-block (for all compilers) 
instead of first block only.

07/04/05 adasdr 1.12
Read of UNFORMATTED orbital list on record 2 relied-on read past End-of-Record 
recovering (using ERR=) to position file at start of next record. This does not 
happen with g77. Now REWIND and skip first two records to ensure correct positioning
at start of record 3.

05/04/05 adasdr 1.12
All premature STOPs should now contain the ERROR flag for automatic
termination of script jobs.

04/04/05 asdeck18.8
If dimension exceeded in ALGEB4 then the code switched off BP corrections to M1
and continued-on. The warning was buried deep in the olg file. Now STOP if
dimension exceeded.

09/02/05 asdeck18.8
Use of CHAR and ICHAR (see 02/02/05) causes incompatibility with post-
processors with UNFORMATTED files. Basically, this is because if L='C',
where L is INTEGER, then L.ne.ICHAR('C'). Thus, unless post-processors are
changed as well to use the ICHAR value of 'C' rather than L, the integer
representations of the characters used to define the orbitals in a config.
list are mis-matched. Although not a big coding exercise, it is a fundamental
change to the form of the unformatted files. So, I have reverted back to
writing L='C' rather than ICHAR('C'), say, in AUTOS. This is fine until
Fortran compilers reject this as illegal. (The experimental gnu f95 compiler
is one example.) The ICHAR coding is still present but commented-out for now.
Thus, "easy" to switch-over in the future BUT need to ensure that ALL aware
that post-processors must be updated at the same time. Thus, need a major
revision number change e.g. to 19.x.
FORMATTED files are unaffected because A-FORMAT is used for orbital rep.

08/02/05 asdeck18.8
l-mixing DR (i.e. H-like) had undefined STO potential for Ryd. orbitals
approximated by a continuum. This bug was introduced in 17.3 around 07/10/02.
The bug fixed then was separate, but affected l-mixing DR.
No H-like DR has been done since, to my knowledge...

02/02/05 asdeck18.8
Eliminate warnings on some f95 compilers when GOTO statement number on 
ENDDO, use old CONTINUE instead!
Eliminate errors arising on some f95 compilers from interchanging/equating 
integer and character - relic of days before TYPE CHARACTER.
Now explicitly use ICHAR and CHAR (tedious).

22/01/05 mdrcs12.48
Attempt to bound error when binning near threshold resonances.

20/01/05 adasdr 1.12
Minor.

19/01/05 asdeck18.8
M1 radiative rate not always included in adf04ic.

06/01/05 adasrr 1.5
Detailed balance weight adjustment was missing from hydrogenic top-up
in energy for full-resolved (and LS bundled-nS) final states. (It is
unity for bundled-nl and bundled-n, and so totals).

05/01/05 adasrr 1.5
Added hydrogenic top-up in energy - still under testing.

05/01/05 asdeck18.8
Fixed obscure bug viz. RR of bare ions to high-n, unused data in opls/ic
can contain a NaN, depending on machine, because of undefined variable.

04/01/05 asdeck18.8
Synched PI energy mesh with that in adasrr, which has been extensively
tested with analytic hydrogenic cross sections. MENG .GT. 0 still reads
user input energies. MENG .LT. 0 (.gt. -100) uses "new" default PI mesh,
which is a (better) mixture of previous "coarse" and "fine". MENG.LE.-100
uses a finer mesh (a new point between each coarse pair). Energy range
spanned by the new meshes is the same as the old fine mesh. ***Currently,
nothing to stop a user attempting to calculate PI at too large an energy
i.e. one where it is numerically impossible to get accurate results.
This will need changing. Will do so when adasrr (1.5) is implemented
which will top-up in ENERGY hydrogenically.

04/01/05 adasrr 1.4
Maxwellian convolution of partial RR now probably accurate to 1% or so,
but still needs some checking. Improved internal PI energy mesh for 
standalone hydrogenic (just pure, no top-up in energy yet, only l).
Improved interpolation of cross sections. Spline default, Lagrange
present for testing. Quadrature rule defaults to MIDPOINT, Gauss-Laguerre
does not (yet) converge for high-n partials - too strong 1/E**(l+.5)?

21/12/04 adasrr 1.3
Added RR of bare nucleus option.
Corrected small bug in RR totals.

18/12/04 adasrr 1.2
More tests to safeguard against users garbage-in=garbage-out.
Automatic top-up in hydrogenic top-up in NV.
Extrapolate partials as 1/E**(L+1) (uses effective L=0 for bundle-N).
Using a finer radial mesh in AUTOS e.g. MSTEP=14 or 15 helps high-E
numerics, but ultimately doomed.
Uses a new adfxx number, tentatively adf48, because structure is
very much like adf09 (identical, minus writes of Auger rates) and
not the "old" ADAS adf08 RR format (akin to adf04).

18/12/04 asdeck18.7
Added alternative, coarser at low-E, photoionization energy mesh (case MENG=-1).
Else, MENG.LT.0 original. WATCH THIS!!

17/12/04 adasdr 1.12
Minor.

15/12/04 adasrr 1.1
First release of adasrr. RR analogue of adasdr for DR.
Uses simplified version of DR input viz. no NECOR, COREX.
Just needs NTAR1, NTAR2 and target symmetries in general.
Automatically tops-up in LV with hydrogenic result.
BUT, does not top-up in PI energy (yet). Existing PI extrapolated
as 1/E. O.K. for totals.
Also, numerical error in high-l partials if pushed to too high-E.
Write adf08 file, RR analogue of adf09 for DR.

15/12/04 mdrcs12.47
Minor.

24/11/04 asdeck18.7
Stop if requested PI energy range results in too many energies i.e. no longer
quietly restrict the energy range.

05/11/04 asdeck18.7
Use same box test to determine RZERO as R-matrix stg1 when box states in use.

02/11/04 asdeck18.7
ORTHOG='BOX' generates box states for orbitals with lambda.lt.0,
analogous to 'LPS'. Box size is taken to be defined by largest
physical s-orbital. Can also be set manually with RZERO in &SMINIM.

29/10/04 asdeck18.7
RAD='ALL' is now equivalent to RAD='BP' and BORN='INF' - see below.

28/10/04 asdeck18.7
BORN='INF' now writes adf04ls/ic files. Contains total radiative widths
and limit points, as per BORN='YES', but faster as no finite energy Born
omegas determined, i.e. zeroes are written. Fast way to get total radiative
width summed over all electric multipoles and M1 (M2 not yet coded).
If RAD='BP' as well then M1 includes BP operator corrections.
It is planned that this could augment R-matrix adf04 files, which only
contain E1 radiative data, via a merge-adf04 code yet to be written.
Note also that a code to convert adf04 omega files to adf04 upsilon
files (adf04_1to3.f) will be available shortly (based on ADAS809).
It includes the Cowan remapping of collision strengths: X'=X+3/(1+X)
i.e. the threshold collision strength (X=1) is taken to be that originally
calculated at X'=2.5 i.e. plane-wave Born is now finite at threshold i.e.
approx Coulomb Born.

04/10/04 adasdr 1.12 adaspe 1.7
Dimension tests for NDIM7 and NDIM12 (no old rad and auger rates) were
not applied straight away, which caused overwriting if dimension exceeded
which, in turn, could cause an ungraceful exit without it being clear that
there was a dimension problem.

14/09/04 adasdr 1.12
Case of master config term/level lying between ground and (highest)
metastable not bundled correctly. Bundled data would not be used
here in any case. Resolved and totals unaffected.

13/09/04 adasdr 1.12
Extended range of parent search for satisfactory match i.e.
parent plus nl can couple to form SL. M-shell has more parents
closely spaced in energy.

09/09/04 asdeck18.6
Fixed obscure failures with STO and BASIS='RLX' (job aborted).

06/08/04 asdeck18.6
If reading external orbitals with more than 10 n's per l, e.g. for RMPS, 
forced to repeat n-value (because need 70.le.n.le.79 to flag external).
This should be o.k. as n is just a label, but post coding for relaxed
orbitals, v18.4 onwards treated repeat nl's as equivalent and so
omitted some interactions. Now fixed, only treated as equivalent when
explicitly flagged as relaxed orbitals e.g. BASIS='RLX'.

29/06/04 asdeck18.6
Approximation of high Rydberg state by zero energy continuum was
never fully-implemented in semi-relativistic mode (CUP='ICR').
Rydberg spin-orbit integral was omitted and one-electron energies
were non-relativistic. This has been rectified.

10/05/04 adaspe 1.7
Dimension test on number of radiative rates wrong.

23/04/04 adasdr 1.11 adaspe 1.7 adaspi 1.8
Check elemental and ionic consistency between multiple files.

10/04/04 asdeck18.6
Case BORN when max no of Born orbitals equals dimension allowed (MXGRB), 
stops with a secondary dimension exceeded (MXD33) and prints wrong
value to be increased to. Modified to be consistent and, hopefully,
not exceed secondary dimension. But, if so, message to increase primary
dimension appropriately. 

06/04/04 adasdr 1.12
Parents not found for radiation into core, case "all-n" problem.
Just skip and flag instead of stopping.

24/03/04 asdeck18.6
Term Energy Corrections (TECs) of level energies got switched-off
in v18.2. (Now back on.)

06/03/04 adasdr 1.12
Necess. mods to handle rate files with correlation levels specified
(by default, AUTOS does not write any rates though).

20/02/04 adasdr 1.11
Change on 28/01/04 for all-n problem stopped normal n-loop processing from 
working (sigh).

13/02/04 asdeck18.6
Initialize duplicate config switch for A.S. under g77. Stops rightaway else.

10/02/04 asdeck18.6
Increased number of steps in second last interval so TFDAPO does not
double initial step. This doubling can reset user-supplied step reduction 
(via MSTEP) for inner-shell continuum and so never satisfy RADCON test.

06/02/04 adasdr 1.11
Allow NR2 to specify upper-n cut-off, case of single data file with
multiple autoionizing n.

02/02/04 asdeck18.6
PRINT='UNFORM' can cause a variable initializing self-consistent potential
operation not to be initialized. If compiler initialises to zero then expected
operation results (non-self-consistent). If compiler  initialises to some
integer .gt. 1 then self-consistent loop entered. May see unexpected warnings:

 ****SR.VPNL, NOT ENOUGH MESH POINTS FOR ORBITAL
and/or
 RADWAV-WARNING:  INWARD-INTEGRATION STARTED AT X(***)

Results not highly inaccurate, but not what is expected either...

This problem came to light with the Intel Fortran compiler under -O3.
It has been present for a long time (e.g. in v16).


28/01/04 adasdr 1.11
Mods to allow processing of a single data file containing rates for
"all" NV, LV. Case low-T DR. Specifically, determining parent on
symmetry grounds still by tracking last n-value matched.

23/01/04 adasdr 1.11
Allow DR thru all autoionizing configs, case LV=-1, consistent
with COREX, i.e. not just n=NV.

05/12/03 asdeck18.6
The adf04 file format was incorrect. A "3X" was missing after
the initial I5.

03/12/03 asdeck18.6
Added BASIS='RLX2' option. This multiplies the relaxed
radial matrix elements by spectator electron overlaps.
BASIS='RLX1' assumes they are unity still.
(Both assume that the small overlaps are zero.)
BASIS='    ' (default) uses unique orthonormal basis set, still.

Modified memory parameter for Born for case of infinite
energy limit with pseudo-states. There we need MXGRB=MAXGR,
large, BUT only 1 energy (not finite energy). When MXGRB=MAXGR
only 1 Born energy (infinite) is allowed. Set MXGRB.lt.MAXGR
to access all energies (set internally). Basically, there is a
factor on the energy dimension of (1-MXGRB/MAXGR) which is then 
1 or 0.

01/12/03 asdeck18.5
Case BASIS='RLX', there was a bug in the radial orbital list
for two-body interactions between configs that differed by one
electron pair. The algebra was correct but the "common" orbital
was listed twice from the same config instead of one (relaxed)
from each.

Case, MXRLS exceeded tripped another error message/stop before
reaching the help dimension exceeded message/stop.

07/11/03 asdeck18.5
Minor.

06/11/03 asdeck18.5
Now calculates finite energy plane-wave Born collision strengths and
writes a type-1 adf04 file, when BORN='YES'. To obtain infinite energy
OMGINF (only) files now set BORN='INF'. (Note, unnecessarily time consuming
if closed sub-shells are not set explicitly so via KCOR1,2.)

22/10/03 adaspe 1.7
Bug-fix for K-shell O-like->N-like PE (LS only). N-like energies incorrect
(relative to wrong limit). adaspi not affected.

22/10/03 adaspi 1.8
Minor.

16/10/03 asdeck18.4
Avoid generation of unnecessary Born integrals when BASIS='RLX'.
Will archive v18.4 now.

11/10/03 asdeck18.4
Case BASIS='RLX' rapidly increases the number of radial orbitals in use
(MAXGR) as the number of configs increases. The Born integral array contains
a dimension MAXGR**4 which rapidly explodes the memory, even though Born is
almost certainly never required with BASIS='RLX'. (Because BASIS='RLX' is
a high precision refinement and Born collision strengths are crude.) Thus,
introduced MXGRB=Max number of radial orbitals for Born integral evaluation.
***Set MXGRB=2 (min) when Born not in use, to reduce memory. e.g. MAXGR=1000 
o.k. now. MXGRB only needs to be equal to the max number of non-core orbitals.
Case of complex atoms can have many orbitals defined by closed-shells.
These are not needed by Born so MXGRB.lt.MAXGR.
Finally, when MAXGR large (.gt. 100, say) ensure that the number of radial 
points (MAXB1) is not excessive (.lt. 1000 suffices for non-DR operation).
MAXB1 is often set very large, for DR operation.
***Remember to get updated PARAM file.***

11/10/03 asdeck18.4
Fixed obvious crash, case no orbital redefinition line specified!

10/10/03 asdeck18.4
Extended BASIS='RLX' to DR operation with Rydberg orbitals (n's in the 80's).
That only leaves reading of external orbitals unchecked. Should only
require minor tweak at worst to implement.

04/10/03 asdeck18.4
Modified STO potential for case NELC.gt.18.

02/10/03 asdeck18.4
Added BASIS='RLX' as better flag for relaxed orbitals ('SCF' still present).

30/09/03 asdeck18.4 (Now BASIS='RLX')
Extended BASIS='SCF' to use of continuum orbitals.
Also, simplify input of scaling/variational parameters: NLAM/NVAR
now refer to sets of data, one set per config (not all configs need
be specified). A set consists of a config. number and number of parameter 
values to be read, followed by the parameter values (almost) as usual.
All NLAM sets are read before NVAR. MCFMX is not needed as STO
automatically uses the (single) config. that each orbital belongs to.
Common core orbitals have any values specified by a config. number of zero.
Finally, since any config can have at most one continuum orbital, the
scaling parameter for a continuum orbital follows that of the last GLOBAL
bound orbital USED. This avoids specifying a long list of dummy continuum
scaling parameters to (finally) reach the one you want for the config.
in question. The GLOBAL max bound orbital number used (MXBORB) by any of the 
configs is determined internally and used to re-map orbital numbers (to 
MAXCF*MXBORB). In the example below, it is 5. If one of the continuum configs 
did not contain orbital 5 it would still be necessary to read a dummy, as has 
always been necessary if there is an "unused" orbital. E.G.

S.S.                    
123456789 21522563524555
          21522553524565
          11522563524565
          21522563524545517
          21522563524545518
          21522543524565517
          21522543524565518
                10 20 21 30 31   900902
 &SALGEB   RUN='  ' RAD='E1' CUP='IC' BASIS='SCF'  &END
 &SMINIM  NZION=26 PRINT='FORM' NLAM=7 MSTEP=11 &END
1 5
 1.40330 1.11370 1.05410 1.14790 1.12150
2 5
 1.43340 1.18870 1.13970 1.21700 1.18390
3 5
 148.55510 1.34160 1.26460 1.26120 1.23010
4 6
 1. 1. 1. 1. 1. 1.1
5 6
 1. 1. 1. 1. 1. 1.2
6 6
 1. 1. 1. 1. 1.2 1.3
7 6
 1. 1. 1. 1. 1.2  1.4
 &SRADCON MENG=-6 &END
   400. 600.

There is no special meaning to the actual values of the scaling parameters
used in the above example. In general, one would probably specify values 
for the Thomas-Fermi potential for each config.
STILL, BASIS='SCF' DOES NOT WORK FOR RYDBERG ORBITALS (n's in the 80's.)

27/09/03 asdeck18.4
Array out of bounds for non-Rydberg/non-continuum orbital with L/l.gt.9,
e.g. neutral U.

13/09/03 asdeck18.4 (Now BASIS='RLX')
Introduced BASIS='SCF' option into SALGEB. This assumes each config
has its own orbital basis so one only needs to list a single basis
(i.e. the usual config spec) and the code remaps these MXVORBs to
MAXCF*MXVORB, plus any closed-shell core orbitals which are still
taken as common. No need to specify ORTHOG='NO'. 'SCF' may change,
meant to mean single configuration. Specifying scaling parameters
could be tedious. Use of default STO potentials (NZION.lt.0) requires
no scaling parameters and model potential will be built only on
the config that contains orbital. (Case common closed shells, uses
average but could easily specify the first 1,2,3... STO configs for
these 1,2,3.. orbitals, as closed must always be 1,2,3..)
NOTE, MEMORY usage can jump dramatically, especially for Born 
radial integrals, as the number of configs increases.
CURRENTLY DOES NOT WORK FOR CONTINUUM ORBITALS (need to adjust mapping).

12/09/03 asdeck18.4
Allow for non-unique orbital basis. Resultant overlap integrals are neglected,
i.e. taken to be zero (n.ne.n') or unity (n.eq.n',l=l'). Currently, user
must set ORTHOG='NO' in &SMINIM namelist to impose this.

11/09/03 asdeck18.3
v18.2 14/08/03 introduced a bug into two-body fine-structure energies.
Will archive this bug-fix v18.3.

10/09/03 asdeck18.3
Increase MSTEP for low-charge ions so as to try and avoid code stopping
and asking user to do so.

10/09/03 adasdr 1.11
Archived yesterdays v1.10 with bug-fix and start a fresh release
to avoid confusion.

09/09/03 adasdr 1.10
IMPORTANT: v1.8, 1.9 and 1.10 earlier dates omitted some LS resolved
partials. Totals o.k.

09/09/03 asdeck18.3
Tweak tolerances in generation of algebraic coefficients so as to
minimize "drift" of channel energies.

06/09/03 asdeck18.3
Explicit dimensions for 1- and 2-body fine-structure Slater state algebra
(previously used same dimensions as LS, inefficient for large cases).
***Thus, need to use new PARAM files.

04/09/03 adaspe 1.7 adaspi 1.8
Write L>9 as A,B.. etc.

03/09/03 adasdr 1.10
Re-instate allowing COREX='  ' (the default if not set) and taking
all possible DR, restricted perhaps by JCFJ and/or NCMN and/or NCMX.

01/09/03 asdeck18.2
CUP='ICR' option failed with obscure TFU error. Caused by need to
skip to deallocate in DIAGON but wrong variable tested to skip to end.

29/08/03 asdeck18.2
Minor, increase field for writing IC dimensions - so can actually see
what was used/needed.

28/08/03 mdrcs12.47
Allow ITYPE=4 for cooler distribution (spline background, no integral 
convolution just  <v*sigma>=v*sigma).

27/08/03 adaspe 1.7
"Minor": wrong sign stat. weights in adf38r for LS, unresolved upper.

23/08/03 asdeck18.2
Had reduced TOL in DIAG to speed-up diagonalization but this results
in too inaccurate e-vectors for S^2 L^2, so reduce (a little).
Use  LAPACK for faster H diagonalization but of course DSYEVR 
fails frequently for S^2 L^2 i.e. fast but inaccurate e-vectors.
Currently, no way to control this in DSYEVR (promised for future
release of LAPACK).

22/08/03 adaspe 1.7
Reduced memory usage a little. 

21/08/03 asdeck18.2
Bug-fix: A legal memory location was being accessed before it 
was being initialized but it was never subsequently used. 
On Patrick's compaq the location sometimes contained a NaN
and accessing it caused a crash. But if the run doesn't crash 
then the results are correct.

16/08/03 asdeck18.2
More ALLOCATE/DE-ALLOCATE added (F90 only).

14/08/03 asdeck18.2
Optional F90 ALLOCATE/DE-ALLOCATE added - look for lines appended !F90.
Uncomment them to use this feature AND comment-out lines appended !f77.

14/08/03 asdeck18.2
Two-body fine-structure radial integrals incomplete in DR mode, only.
Note in new PARAM file MXAJS=MXADJ or =1, if no two-body fine-structure
required. Significant memory reduction when =1.

12/08/03 asdeck18.2
Fix phase of e-vectors following H diagonalization.

11/08/03 asdeck18.2
Array out of bounds occurs when number of radiative algebraic
coefficients exceeds number of electrostatic (slater) algebraic
coefficients. Only occurs on trivially small cases e.g. H-like ions!

02/08/03 asdeck18.1
First public release of preceding development versions (17.5-17.8).

02/08/03 asdeck17.8
Added LAPACK diagonalizer DSYEVR (aggressive) to DIAGON/DIAGFS.
Commented-out. In current largest cases (10,000 levels) gives
less than 15% speed-up overall if just energies computed and
less than 10% if radiative rates computed. Time dominated by
angular algebra (LS and IC) and IC radiative rate generation.
Will stabilize these developments as Version 18.1.

01/08/03 asdeck17.7
Re-code radiative rate generation in DIAGFS for IC, as per DIAGON below (LS).
We should be close to a new stable version now (17.3 was the last).

29/07/03 asdeck17.6
Fast algebra means generation of radiative rates in DIAGON now a 
bottleneck, even though coded as N^3 operation (as opposed to Werner's N^4).
Cause is loop over DRK storage to "find" radiative algebra. For large
set of terms in symmetry groups, this becomes like N^4 again. Use this
loop over DRK storage to replace one of the N loops in N^3. (Alt. could
explicitly index upper and lower states, and multipole and orbitals, but
this would largely increase storage requirements.) Above solution utilizing
DRK loop for two purposes is much more elegant. Time now dominated by
angular algebra again, at least for E1, in LS. TBD: IC.

28/07/03 asdeck17.5
ALGEB3: Slater-state interactions now determined between SLJp groups.
Both one-body fine-structure (SPOR) and two-body (RES) coded.
Speed-ups the angular algebra by two orders of magnitude for large cases.
Only algebra of BP corrections to M1 remains "ungrouped". Thus, version 17.x
development "almost" complete".

18/07/03 asdeck17.4
Fix RESTART case E2 (or higher) multipole radiation specified - IC results
(obviously) wrong. Case E1 or no radiation, IC was fine as was LS in all
cases.

17/07/03 asdeck17.4
First re-organization of ALGEB3 to (eventually) speed-up fine-structure
algebra. ALGEB3 (originally) loops over intercations between levels
of a given Jp group, but takes no account of the LS blocking i.e.
interactions between (Jp) levels of a given (or pair of) SL group will 
occur non-sequentially. Re-organized so that all levels within an SLJp
group have their interactions (with all other S'L'Jp groups) determined
sequentially. Eventually the Slater-state intercations can be taken out
side of the loops over levels within Sl and S'L' groups.
(Note, construct of H in DIAGFS needs loops over J synchronized with
ALGEB3 since f-s algebraic interactions stored as a sequential vector.)

14/07/03 asdeck17.4
Skip unnecessary determination of Slater-state interactions between
configs that cannot contribute to the given symmetry group.
Saves only a little on time and memory in large cases.

10/07/03 adasdr 1.10
Extend COREX to inner-shell core excitations e.g. 1-2  in Li-like DR.

09/07/03 asdeck17.3
Added ORTHOG='NO', as an alternative to IORT=-3, to omit orthogonalization
of orbitals. **** ARCHIVE as a STABLE VERSION ****.

27/06/03 adaspe 1.7
Fix array out of bounds (NaNs in adf38r).

23/06/03 adasdr 1.9
Minor.

17/06/03 adaspi 1.8
Comment-out target config match case NTAR.lt.0 and BMATCH='YES'.

16/06/03 adaspi 1.8
Some unwanted (lower state autoionizing) PIs were being written to adf39px
with a lower level index of 0.

11/06/03 asdeck17.3
Added LAPACK diagonalizer DSYVER to SR.VCE (commented-out).
Absolute time being spent using DIAG just starting to become
significant for configs with 1000's of terms. Not an issue for H yet.

11/06/03 adasdr 1.9
Minor.

11/06/03 adaspi 1.8
Minor.

10/06/03 adaspe 1.7
Fix configuration labelling bug, only occurs with PLUS/STAR ions.

22/05/03 adaspe 1.7
Allow larger field in adf38r for resolved upper states.

21/05/03 adasdr 1.9
Now allow arbitrary number of on(u) files, up to n=99.

15/05/03 adasdr 1.9
Implement same master configuration approach as in adaspe.

12/05/03 adaspe 1.7
Match master configuration states by energy order within a  symmetry group
within each configuration, as opposed to index order (v1.6 and earlier).
This is of importance for M-shell work with open p- and d-subshells.
The same configuration (usually initial) can arise from several
runs. When the raw data is merged during the post-processing, these
states (terms/levels) are matched. If the atomic structure of
these common configurations is unchanged between runs then matching 
by index order within a configuration (basically, the dominant 
e-vector component) is exact. If the structure changes, due to
different CI or radial functions, then the dominant e-vector
component can change and, typically, the term/level labelling within
a configuration gets swapped in comparison to the energy order.
From v1.7 onwards, matching is done by energy order within each
symmetry group of each configuration. Thus, in the above example,
states are "correctly" matched still. This still assumes that the
configuration number is a good quantum number. "Failure" in the
previous method only means that close, highly mixed, states have
data partitioned between them "incorrectly". But, clearly, in this
instance little physical significance could be attached to the
theoretical partitioning, which must remain highly uncertain.

08/05/03 adaspe 1.6
Allow resolution by upper state, in adf38r and list adf38l, if
RESOLV='YES'. Default, RESOLV='NO' only lower state resolved still.

06/05/03 adaspe 1.6 adaspi 1.8, adasdr 1.9
Master config terms/levels not required based on structure in first 
file are now never used subsequently. Also, force any equivalent electron
files (LV=-1) to be read before Rydberg files.

01/05/03 adaspe 1.6 adaspi 1.7
Minor

28/04/93 asdeck17.3
Allow increment in l-loop by LINC, default LINC=1 of course.

05/03/03 adasdr 1.9
Archived cumulative changes made to 1.8.

05/03/03 adasdr 1.8
Minor correction to resolved post-processed outer electron radiation
(IC only).

04/03/03 adasdr 1.8
Minor, avoid array out of bounds.

03/03/03 mdrcs12.47
Introduced NMIN, LMIN on RR.

28/02/03 mdrcs12.47
Form bundled-nl parent-resolved Auger rates and corresponding omegas.

26/02/03 asdeck17.3
Minor.

24/02/03 adaspe 1.6
Always write lowest state (hopefully ground) when no PE exist
(e.g. all upper states bound).

21/02/03 adaspe 1.6, adaspi 1.7
Allow UNIT dependent JCFJ via JCF(UNIT).

20/02/03 adaspi 1.7
Revised NTAR.lt.0 option to allow more general matching of electron
targets if MATCH='YES'. Previously, any duplicate targets were listed 
twice or more (not wrong per se, just inelegant). MATCH='NO', as before.
-NTAR stat weight info is now read-in and applied to lowest -NTAR targets.
Note, NTAR.gt.0 not affected by MATCH, still assumes same electron
targets in every data block.

17/02/03 adaspe 1.6
Minor, increase dimension.

19/11/02 asdeck17.3
Minor fixes.

08/11/02 asdeck17.3
Array out of bound (minor) case nl occupation number .gt. 9.

28/10/02 adasdr 1.8
Allow obs. & calc. energies to be input using any units specified
by the usual UNITS variable (In NAMELIST ONE still).

26/10/02 adaspe 1.6, adaspi 1.7
Suppress INQUIRE(5), OPEN(5) so input through re-direct, like all
other codes. Originally thought that it might not be necessary
to have UNIT5 input, hence set-up.

24/10/02 adaspi 1.6
Suppress total PI. Add TEAPOT for when lowest target not present.

24/10/02 adaspe 1.5, adaspi 1.5
Suppress listing of states with no photo data.

11/10/02 adasdr 1.8
Modify TOLI usage for near degenerate levels within a term.
10/10/02 
Modify TOLI usage for higher metastables (see also 13/09/02/).

09/10/02 adasdr 1.8, mdrcs12.47
For compatibility with AUTOSTRUCTURE V17. (adaspe and adaspi already o.k.)

09/10/02 adaspi 1.5, adaspe 1.5
Minor.

07/10/02 asdeck17.3
Obscure incorrect stop and error message when using multiple Rydberg orbitals
(e.g. l-mixing) AND they start at high-n such that that some are true bound 
and some approximated by a (zero-energy) continuum. (I said it was obscure...)

01/10/02 adaspi 1.5
QNVP,QLVP -> INTEGER.
30/09/02 
Allow spectator as resolved continuum parent.

26/09/02 adaspe 1.5
Tweak NVMAX, LVMAX output.

21/09/02 mdrcs12.47
Autoionizing parent was not being determined for IPRINT=1,
only IPRINT=0.

13/09/02 adasdr 1.8
Attempt to correct imbalanced CI (03/04/02) assumed lowest bound
Rydberg parent was ground but it can be metastable, now allowed for.


***************************** ASDECK V17 (LS) *****************************

25/09/02 asdeck17.3
Common closed-shell energy (ECORE) incorrect for second and subsequent
l-values in DR loop over Rydberg (n)l.
Array out of bounds, DZLX2, can cause overwriting of Rydberg/Continuum
potential giving rise to incorrect orbitals on second and subsequent
n-values in DR loop over Rydberg n(l).

23/09/02 asdeck17.3
In SR.VCE, work arrays for DIAG incorrectly dimensioned by MAXDI instead of 
MAXDF. MAXDF normally set larger than MAXDI. Need several hundred terms in
a configuration to trigger failure in DIAG, code then switched to JACORD
which is not affected since it does not use the affected work arrays.

19/09/02 asdeck17.3
In COMMON /NXRLS/, NSTJ, NSTJD incorrectly dimensioned by MXST0
instead of MXRKS, the latter being larger so garbage results in
non-trivial cases i.e. when MXST0 exceeded. Compare MXRKS used
with MXST0 to see if this has occurred.

16/09/02 asdeck17.3
Re-organize matrix mult loops in VCE.

12/09/02 asdeck17.3
Now move (E K-pole) Slater state algebra outside of term loops, but
inside of loops over symmetry groups. (Introduce MXRKO, MXRLO for
orbit-orbit dimensions in place of MAXRK, MAXRL so can re-set =1
if not needed. Also, MXROS for MXRKS, orbit-orbit Slater states.)

09/09/02 asdeck17.2
Re-organize E K-pole algebra so as to loop over initial/final symmetry
groups and then terms within groups. Prelude to v17.3.

05/09/02 asdeck17.1
The electrostatic algebra has been re-organized and re-written, as per the 
introduction to v17. Large scale (inner-shell photoionization) problems 
show a factor of 20 speed-up in FLGL, which originally dominated the CPU 
time. Memory increase for these large scale problems is only 5% over v16.
(Note, two new dimensions MXRLS, MXRKS are currently needed relating 
to Slater state interaction memory storage.)

*************************** NEW  ASDECK V17 ***************************
This initiates a program to re-organise the angular algebra generation.
The basic approach to angular algebra in AS and SS is to generate
the algebra for Slater states and then transform (via VCCs) to the
required representation. This will not change, but the way it is
carried-out will. The existing approach was developed for small
memory machines and small numbers of terms (or levels). Thus, the
Slater state interactions are (re-)computed for every term interaction.
But the Slater state interactions are (virtually) independent of the
term, for a given symmetry. The VCCs contain the (main) term dependence.
Thus, it is only necessary to compute the Slater state interactions
between symmetry groups, store the result, and then evaluate specific
term dependencies within the group, which is trivial. For problems with 
large symmetry degeneracy, the old approach is extremely inefficient 
(slow). For those of you nervous about such major changes to the code,
the last V16 (v16.12) will remain on the web, but the only changes
that will be made to it are to fix any serious bugs.

The first change will be to the electrostatic algebra in ALGEB2/FLGL.

Next the electric multipole radiation algebra in ALGEB2.

Then the one-body spin-orbit algebra in SOCC.

Two-body fine-structure algebra, BP M1 corrections etc are much more
long term.
**********************************************************************

14/09/02 asdeck16.12
Tweak STO model potential.

11/09/02 asdeck16.12
Allow printout of algebra in photoionization mode.

02/09/02 asdeck16.12
The little used SALGEB variable MAXLAM which restricts the maximum 
electrostatic multipole interaction (to MAXLAM) has been extended
such that negative values result in a single configuration
calculation, of maximum multipole -MAXLAM. Default, 1000
multiconfiguration CI with all multipoles. (This negative MAXLAM
option is only available in the algebraic version, NOT in &SMINIM.)

16/08/02 adaspi 1.5
Allow NTAR .lt. 0, then no target statistical weights read (or used).
If the same target appears in two files (o1u, o2u) it will be listed
twice - not inaccurate, just inefficient, resulting in larger adf39 files.
Note, NTAR .gt. 0 assumes same set of target states in all o1u, o2u etc
files.

05/08/02 asdeck16.11
Reduced failure rate for S^2, L^2 diagonalization with DIAG.

27/07/02 asdeck16.11
Write ols/oic files even when no continuum present, i.e. for
generation and processing of radiative rates only for photoexcitation.

05/05/02 mdrcs12.46
Tweak use of non-linear mesh. This version is now being archived.

28/05/02 mdrcs12.46
Improved high temperature Maxwellian integration of RR.

23/05/02 adasdr 1.8
Allow user to read-in own set of temperatures (in Kelvin) via JTEMP.

16/05/02 adasdr 1.8
Corrected minor formatting error (a textual underline was missing)
which causes ADAS401, which reads adf09 files, to fall over.

14/05/02 asdeck16.11
Fix possible array out of bounds (DOSC) and failure in DIAG.

16/04/02 asdeck16.11
Minor corrections.

09/04/02 adaspi 1.4, adaspe 1.4
Various, minor.

03/04/02 adasdr 1.8
Attempt to correct for imbalanced CI of parity split case (dn.gt.0)
whereby a bound state (core+Rydberg) can move above its own continuum.
Important for low-charge dn.gt.0 DR, although 2-2 probably dominates
(Ne-like excepted).

03/04/02 mdrcs12.46
Re-instate (negative) TOLR to solve the above problem - recall TOLR positive
tries to evaluate Auger yield for one step cascade. We want to just
say everything within |TOLR| (TOLI above) of the ionization limit is bound.
Set -TOLR equal to how far above the limit we want this to apply. Code
then takes abs(TOLR). The negative switches off the Auger yield operation
of positive TOLR.

28/03/02 mdrcs12.46
Switches to study Auger damping and resolving final state inner-shell
excitation.

26/03/02 asdeck16.11
Some residual two-body fine-structure interactions were being dropped
without warning.

26/03/02 mdrcs12.46
Altered zero-energy switch on cooler distribution for convoluting Lorentzians.

23/03/02 asdeck16.11
Retain smaller (1.d-8) IC mixing coefficients when higher multipole
radiation requested (1.d-5 for dipole only).

27/02/02 asdeck16.11, adaspi 1.4
Improve determination of target energies when coupled to continuum.

22/02/02 asdeck16.11, adaspi 1.4, adaspe 1.4
Various, minor.

10/01/02 asdeck16.11, adaspi 1.4, adaspe 1.4
Tweaks for photoionization of He-like ions, i.e. (near) degenerate
H-like residual ion energy levels.

21/12/01 adaspi 1.4
New AUTOSTRUCTURE post-processor for direct photoionization producing ADAS 
format level (adf39l) and partial (adf38px) and total (adf38px) cross section 
files.
(adaspi versions 1.1 - 1.3 were not released.)

15/12/01 adaspe 1.4
New AUTOSTRUCTURE post-processor for indirect photoionization (i.e.
inner-shell photoexcitation-autoionization) producing ADAS format
level (adf38l) and rate (adf38r) files. Being used to generate
inner-shell data to supplement R-matrix Opacity Project data.
An analogous program (adaspi) for direct inner-shell photoionization
is under development/testing.
(adaspe versions 1.1 - 1.3 were not released.)

15/12/01 adasdr 1.7
Minor checks.

14/12/01 asdeck16.11
Increased no. of orbital definitions written to on/u header, for adaspe.
Back compatible with existing adasdr.

10/12/01 adasdr 1.7
While it was possible to override the default TOLB with a larger value,
it wasn't possible to do so with a smaller value.

30/11/01 adasdr 1.7
Minor

28/11/01 asdeck16.11
Local variable not saved in RADCON. Caused "obvious" problem on SGI -Ofast.

23/11/01 asdeck16.11
Automatically switch from Householder-QL to Jacobi if simultaneous
diagonalization of L^2 and S^2 matrices fails. (Failure caused by
use of high level optimization on Cray/SGI compilers, e.g. div_split=ON.)

17/11/01 asdeck16.10
Added dimension consistency check in plasma potential routine VFREE.

16/11/01 adasdr 1.7
Tidied-up precision etc.

10/11/01 adasdr 1.6
Added additional diagnostic on reasons for NTAR2 failure.

26/10/01 asdeck16.10
Tidied-up precision etc.

24/10/01 asdeck16.9
Re-worked identification of (dominant component) of e-vectors for H 
diagonalization.

26/09/01 mdrcs12.45
Coded non-NAG alternative for Gauss-Laguerre Maxwellian background convolution
(non R-matrix). Also, put in simple trapezoidal alternative for ordinary
NAG convolution (cooler, Gaussian etc.). Accuracy controlled by bin width.

18/07/01 asdeck16.9
Minor, for neutrals.

14/07/01 asdeck16.9
Improved numerical accuracy of high energy photoionization cross sections.
User may still need to reset finer radial mesh (via MSTEP) to get accurate
but small photoionization cross sections at high energies, > 4.z**2 Ryd.

13/07/01 mdrcs12.45
Can now read photoionization cross sections from UNFORMATTED file opu/ombgu.

13/07/01 asdeck16.9
Added UNFORMATTED output for photoionization cross section, case PRINT='UNFORM'.

19/06/01 asdeck16.9
Extended (lowered) internal tabulation of energies for photoionization by
two decades. (This is in addition to E=0. of course.) Necessary because
E=0. to the next energy was too large a span for photoionized (low
temperature) plasmas. 

11/06/01 mdrcs12.44
Dimension increase for non-resonant backgrounds.
Add ESWTCHX to force switch to scaled Gaussian above ESWTCH, rather than
use cooler distribution.

05/06/01 asdeck16.9
Tweak e-vector component identification (IUP=0) in DIAG.
(Archived Born changes as 16.8.)

05/05/01 asdeck16.8
Eliminated a forbidden E2/M1 transition that had slipped-in during Born mods.

27/04/01 mdrcs12.44
Extended DITTNER by using ERFC when E>>E', but ERF when E~E' still, so as
to avoid cancellation error.

25/04/01 asdeck16.8
Minor.

04/04/01 asdeck16.8
Extended generation of angular algebra to arbitrary electric multipoles.
Generalised evaluation of Born collision strengths to all possible
multipoles. Now accessed via BORN='YES' in NAMELIST SALGEB, BORN='NO' is 
the default. When BORN='YES', the default is to loop thru from E0 to E6,
which suffices for spectroscopic one-electron orbitals up to l=3. ONLY the 
K Born multipole is calculated on EK, i.e. no scaling to higher multipoles. 
This release generates Born collision strengths for all transitions Jp->J'p'
for p.eq.p' for all J,J', and for p.ne.p' for |J-J'|.gt.1 or J+J'.lt.1.
(Also, non-Born dipole limits for p.ne.p' and |J-J'|.le.1 and J+J'.ge.1.
Actually, Born limits are computed here as well if the dipole line strength 
is vanishingly small.) ***Note the updated PARAM file (again). 
With sufficient mixing, the only forbidden transitions now arise from J=0->J'
transitions with J' odd (even) for parity conserving (changing) transitions.

28/03/01 asdeck16.7 (UNRELEASED)
As 16.8 (see above) but scales the lowest non-vanishing multipole to get
the contribution from higher multipoles. This can involve a large error in
certain circumstances, e.g. when the lowest multipole for a given transition
is only via (weak) mixing then a higher "unmixed" is missed. The problem is 
that now, in general, there is no multipole common to all transitions, even 
allowing for odd and even. More elaborate book keeping would be needed.
However, it is now simple to eliminate the loop over Born multipoles
within the electric multipole loop, and instead compute one Born multipole
per electric multipole, accumulating the Born omega as we go. The loop over 
electric multipole now needs extending to twice the max spectroscopic 
(one-electron) orbital l. This has been implemented as v16.8, above.

15/02/01 asdeck16.6
Extended Born coding to lambda>2 multipoles (lambda=2 must exist though)
for both l->l and l->l' (l'.ne.l). Note updated PARAM file. This release
(16.6) only generates Born collision strengths for transitions Jp->J'p'
for p.eq.p' and |J-J'|.le.2 and J+J'.ge.2. (Also, non-Born dipole limits
for p.ne.p' and |J-J'|.le.1 and J+J'.ge.1.). Ditto for LSp->L'S'p'.

10/02/01 asdeck16.6
Added infinite energy Born limits (accessed via RAD='E2') for lambda=0,2.

20/12/00 asdeck16.5
Fixed screw-up of BP corrected M1 radiative rates - bug introduced 27/07/00.

19/12/00 adasdr 1.6
Minor mod for H-like ions only.

12/12/00 adasdr 1.6
Fixed conflict between initial states specified by metastables vs those
specified by (initial) core excitation. Only affects case of a metastable 
not in the ground complex AND only for dn=1 from it (i.e. dn=2 from ground).

24/11/00 asdeck16.5
Minor, eliminate g77 compiler warnings.

28/09/00 mdrcs12.44
Fixed minor bug affecting energy corrections when E_THY(1) was non-zero
i.e. ECORLS/IC was non-zero in the AUTOSTRUCTURE run.

27/07/00 asdeck16.5
Added output template files for adasex. and adasexj.f codes.

11/07/00 asdeck16.5
Allow user to lower the minimum value of the radiative rates printed-out 
(via RMIN1, RMIN2). Previously, these variables could only be used to raise
the minimum value.

07/07/00 mdrcs12.44
Added separate output file (ocsnl) of weighted energies and cross sections
resolved by initial state and parent of autoionizing state, summed over all
final states.

25/05/00 asdeck16.5
Minor.

20/05/00 asdeck16.5
Minor changes to MODE=4 operation (not normally used).

10/05/00 asdeck16.5
Read-in NFIX and IFIX  as a simpler alternative to reading IEQUAL directly
during minimization. See comments in SR.MINIM.

13/04/00 asdeck16.5
Allow valence n-value to be .le. core n-value if Laguerre pseudo states
being used (ORTHOG='LPS') as need overlaps for projection.

25/03/00 asdeck16.5
Minor.

02/02/00 asdeck16.5
In v15.13 I made RADWIN compatible with CIV3 STO/Clementi input, unfortunately
this made it incompatible with MCHF input. Now fixed. You will see small
differences in energy, for various reasons, between 15.12 and current 16.5.

09/12/99 asdeck16.5
Identifying e-values/vectors by dominant component could fail (get stuck in
infinite loop) when two components had exactly the same magnitude, to 
machine precision. (Yes, it is possible!)

11/09/99 adasdr 1.6
Minor mods to avoid compiler warnings.

11/09/99 asdeck16.5
Minor mods to avoid compiler warnings.

18/08/99 asdeck16.4
Default, use Householder-QL to diagonalize Hamiltonian (IDIAG=-1 in  NAMELIST 
SMININ). In highly-charged ions the term labels on levels may change as
they are now determined by the dominant component(s). Set IDIAG=1 to recover
old default Jacobi method and labelling.
12/07/99 
Re-ordered IC radiative rate calculation as an N^3 operation, rather than N^4.

09/07/99 asdeck16.3
Re-ordered LS radiative rate calculation as an N^3 operation, rather than N^4.

08/07/99 asdeck16.2
Re-ordered autoionization rate determination loops so as to reduce memory.
(Nice by-product, all possible transitions from a given autoionizing state
come out in sequence.)
Interchanged outer-two loops in determination of LS radiative rates.
All possible transitions from a given upper (e.g. autoionizing) state
come out in sequence - taken full advantage of by adasdr. N.B. the IC
radiative rates were already ordered so.
Results are identical to 16.1, but the order of the rates (except IC radiative)
in the output has changed.

02/07/99 *** asdeck16.1 ***
I have recoded the calculation of the autoionization rates as an N^3
process. The original N^4 process was memory efficient but the scaling
of memory requirement and availability over the years now means that
N^3 only requires a minimal (10-15%) increase in memory. In the largest
(IC) cases considered by v15.x, where 90% of the time was being spent in
calculating the autoionization rates, the speed-up is an order of magnitude.

29/06/99 asdeck15 15.13
Added option for mass-velocity plus Darwin terms in LS - use CUP='LSM'.
(N.B. CUP='IC' still gives non-relativistic LS data, use CUP='ICM' to
obtain mass-velocity plus Darwin terms in LS in this case.)
26/06/99
Added option to read-in (via RADWIN) CIV3 Clementi/STO orbitals (via
KEY=-10) - a la WE. Orbital (free) format is as for R-matrix - see CPC 1995 -
except that the number of expansion coefficients is read as I5 - this
being the orbital header card. All data read from UNIT5 after SRADWIN,
unless re-directed.
28/04/99
Minor mods for g77 compiler.

26/03/99 adasdr 1.5
Add auger rates from resolved metastable final states to adf09 output.
20/02/99
Extended to determine all required parents of Rydberg states on symmetry
grounds, rather than energy which was used in general when n.gt.NRSLMX
in previous versions. This is necessary for low-charge IC where the
parent levels within a term become nearly degenerate.

20/02/99 
sccs delget mdrcs12.f
Fixed bug in high-n scaling of energies used to determine if post-
processed outer electron radiation to a given final state is stable.
Only occurs for n.gt.NRAD.
19/12/98
Minor mods on convoluting with cooler distribution, including output of the
energy at which a switch is made to using a scaled Gaussian instead at high-E.
16/06/98
Deleted (!) SR.CROSSJ which produced (LS only) adf09 files. This feature
has been superseded by adasdr which, even in LS mode, is superior in its
treatment to CROSSJ in mdrcs12.f which corresponded to adasdr (1.1) only.
12.43
8863 lines

11/02/99
sccs delget asdeck15
Reduce tolerances in JACORD to handle very large IC cases, i.e. avoid
setting small numbers to zero too soon.
05/12/98 
Minor mods for Cray.
16/09/98
The RESTART option has been re-instated (use MSTART=1 in NAMELIST ALGEB to 
write, and MSTART=4 to read back in.)
Class of radiative rates can be restricted via NAMELIST MINIM e.g. for just
transitions between autoionizing and bound states (e.g. for DR) use RAD='BF'.
Doesn't save much time but greatly reduces size of rate file. This does
save time when post-processing resolved radiation for adf09 files. (Recall,
can also use RMIN1 to set minimum size of radiative rate calculated.)
Added xtra info to LEVELS for adasdr.
Fixed dimension bug that affected photoionization operation, but only when
running close to dimension limits.
15.12
18520 lines

11/02/99 
sccs delget adasdr
Extended to handle final-state resolved recombination into metastable
autoionizing final states i.e those states that lie above the ionization
limit but consist of core+nl where the core is metastable.
1.4
3211 lines

16/06/98 
sccs delget adasdr
Extends adasdr to handle IC data and produce a suitable adf09 file.
Still handles LS data as well. First line of UNIT5 data contains /LS/ or
/IC/ to set the scene. Also, better determination of parentage using 
symmetries (via the NR1 variable) - needed for IC as level-resolved parents
are closer in energy. But, no longer necessary to specify NR1. Also, can
specify a core excitation to be processed viz. COREX='2-3' for all core
2l->3l' excitations i.e. only n need/should be specified. This is an
alternative to the JCFJ variable. See comments to NAMELISTS in SR.POSTP.
1.3
3150 lines

27/03/98 
sccs delget adasdr
Improved matching of final states utilizing a master list of configurations.
1.2
2004 lines

14/03/98 
sccs delget asdeck15
comments? Update with latest DIAG which sorts up/down/sideways and
bugfix for N<0. Also, take -ABS(E) for Fischer orbital energy (RADWIN).
15.11
18197 lines

27/02/98 
sccs delget mdrcs12.f
comments? Tweaked (log) plots etc. associated with Maxwellian distribution.
And cooler distribution yet again - experiment is such high resolution
now compared to Dittner's original that contributions to the convolution that 
are vanishingly small are being calculated unnecessarily and indeed 
generating cancellation error/overflow.
12.42
9882 lines

04/11/97  
sccs delget mdrcs12.f
comments? Modified cooler distribution to handle smaller kT's.
12.41
9870 lines

07/08/97 
sccs delget mdrcs12.f
comments? Added simple trapezoidal rule alternative to NAG for convolution of
R-matrix data. INAG=1 gives NAG (default) else trapezoidal in NAMELIST ONE.
12.40
9852 lines

01/08/97 
sccs delget asdeck15
comments? Fixed obscure, but obvious, bugs.
1/Bug-fix to Laguerre orbital generation, Coulomb expansion could fail
in obscure cases. Rather obvious from energies generated.
2/Try to gracefully ignore orbitals in radwin file that are not needed.
3/Esoteric bug-fix of radiative rates, only if there are NO Slater integrals 
(i.e. H-like ions or possibly model potential use MPSEUD) and only E1 
radiation is requested.
15.10
18198 lines

19/06/97
sccs delget mdrcs12.f
comments? Re-worked RCONVOLX, especially near E=0.
12.39
9812 lines

06/06/97
sccs delget asdeck15
comments? Physical & Laguerre orbitals used wrong Zeff when BDR true (in OVRLAP
generation) since in this case (MORT=-4 only) the number of electrons should NOT
be reduced by one for them when a Rydberg orbital is present.
15.9
18192 lines

29/05/97 
sccs delget mdrcs12.f
comments? Tweak Time-of-Flight operation (TFILTE,NFLITE).
12.38
9754 lines

28/05/97 makefiles
Under SUN f77 4.x it appears that repeated making increases the size
of the executable greatly, I hadn't noted this before (e.g. 3.x). So
have added a line to the makefiles to delete automatically the old 
executable before forming the new one.

10/05/97 
sccs delget asdeck15
comments? Write out orbital overlap file OVRLAP for use with pseudo-state projection, 
only written when Laguerre orbitals exist.
15.8
18175 lines

02/04/97
sccs delget mdrcs12.f
comments? Extend Lotz to multiple shells.
12.37
9747 lines

22/02/97
sccs delget mdrcs12.f
comments? Added TFILTE (time of flight) & NFLITE (analyzer cut-off -- NCUT
specifies max n to be modelled) to model cascade of Rydberg electron during
passage from cooler to analyzer.
12.36
9733 lines

19/02/97
sccs delget mdrcs12.f
comments? Convolute R-matrix with Maxwellian or Compton. 
Select photons by wavelength & atom binding energy range.
12.35
9718 lines

05/02/97
sccs delget asdeck15
comments? Fixed bug when using internal valence orbitals of higher a.m. than 
external core orbitals. Switched sign on LS photoionization matrix element to 
be downwards, for consistency! Default NRAD=20 -> 50.
15.7
18152 lines

06/12/96
sccs delget asdeck15
comments? f90 mod: comment out COMMON/DXRL/ and EQUIVALENCE in SR.ALGEB.
15.6
18150 lines

06/12/96
sccs delget mdrcs12.f
comments? Multiply R-matrix (DR) data by metastable fractions and sum for comparison with experiment.
12.34
9588 lines

05/12/96 
sccs delget mdrcs12.f
comments? Fixed convolution of R-matrix cross sections from excited states.
No id keywords (cm7)
12.33
9582 lines

21/11/96 adasdr (1.1)
New code, stripped from mdrcs12.f, that purely post-processes
AUTOSTRUCTURE rate files (ols etc.) to produce ADF09 files for ADAS.

21/11/96
sccs delget mdrcs12.f
comments? Fixed bug in energy correction for JET ADF09 branch.
12.32
9541 lines

19/11/96
sccs delget asdeck15
comments? Mods for SUN f90 compiler.
15.5
18149 lines

18/10/96
sccs delget asdeck15
comments? Generate Laguerre pseudo-states (IORT=-4 or ORTHOG='LPS')
when pseudo-orbital specified (lambda.LT.0, note -lambda is the Laguerre lambda).
15.4
18148 lines

30/08/96
sccs delget asdeck15
comments? Householder option in H now, Jacobi default still. 
The new JACORD eliminates the "drift" seen on target+e- energies. Restart now works (MXD01). 
Compiler -C now executes without error. Can select LS/IC Arad with WLG1,2.
15.3
18135 lines

30/08/96
sccs delget mdrcs12.f
comments? Enables old NECOR (use IOLD). Reduced TOLB as have eliminated "drift" from e-energies.
12.31
9541 lines


asdeck 15.2 29/06/96
NAG diagonalisation replaced by source for HOUSEHOLDER+QL algorithm, which
actually runs much faster on my machine, for S**2 L**2 matrices. The slower
Jacobi method is retained for troublesome cases (no details). Hamiltonians
still use Jacobi for now.

asdeck 15.1 15/06/96   *****************NEW************************************

See INSTALL for how to set-up 15.x.
Now reads an identification line at the beginning of the UNIT5 data.
If the first 4 characters are S.S. then expects configurations in
Eissner fixed-format as in 12.x (as in SUPERSTRUCTURE). NAMELIST data
is unchanged. If A.S. is read then expects to read MXVORB and MXCONF from
NAMELIST SALGEB - number of valence orbitals and number of configurations -
MXVORB nl's are then read followed by MXCONF configurations defined by
MXVORB occupation numbers, all free-formatted. See revised WRITEUP and
*.15 datasets for examples. N.B. To tag closed-shell orbitals for
replacement via SR.RADWIN (via n=70-79) set KCOR2 negative then MXVORB+|KCOR2|
(i.e. all) nl's are read BUT only MXVORB occupation numbers are read still.

******************************************************************************

asdeck 14.1-14.12 22/05/96-15/06/96
Highly developmental, paving the way for 15.x. 
All preprocessable code has been removed - NAG hardwired though. 
General tidying and standardisation to FORTRAN77 & 90.

asdeck 13.x THERE ARE NONE

asdeck 12.18 96/05/22
Eliminate DEC f77 warnings and one f90 error.

asdeck 12.17 96/05/22 08:49:08
MXD01 gone

asdeck 12.16 96/05/17
Tidied-up through to, but not including, RADWAV. Only MXD01 left.

asdeck 12.15 96/05/17
blank common replaced by two named commons

asdeck 12.14 96/05/17
most secondary dimensions removed (MXD01 & MXD10 left)

asdeck 12.13 96/05/16
Adjusted COMMON blocks to be constant length. No warnings now!

14/05/96
sccs delget mdrcs12.f
comments? EPHMIN,EPHMAX now refer to a range of binding energies i.e. diagonals
of an EBIT data plot and NOT photon energies (horizontals).  Number of minor
mods as well.
12.30
9538 lines

19/04/96
sccs delget mdrcs12.f
comments? Added EPHMIN, EPHMAX to select DR by photon energy
12.29
9501 lines

15/01/96
sccs delget asdeck12
comments? Bug fixes for CRAY operation
12.12
15928 lines

20/11/95
sccs delget asdeck12
comments? Write helpful info on mesh (too coarse) error.
12.11
15926 lines

11/11/95
sccs delget mdrcs12.f
comments? minor bug fixes: round-off error on mesh, option conflict on interference
12.27
9464 lines

10/10/95
sccs delget asdeck12
comments? Write closed-shell occupation number to radial file for R-matrix Blume&Watson.
12.10
15919 lines

22/09/95
sccs delget asdeck12
comments? fixed bug in energy order list in photoionization file. 
Output semi-relativistic radial file for stg1r. NRAD->NRAD+1.
12.9
15916 lines

22/09/95
sccs delget mdrcs12.f
comments? fixed bug in plot of exp data (if <50 pts). Selecting J2PI=0 now works.
12.26
9452 lines

16/09/95
sccs delget mdrcs12.f
comments? Added read of "omega" format file for RR. Select Jp partial wave. 
Extended cooler-distribution to high energy. Aligned common blocks.
12.25
9452 lines

22/08/95
sccs delget mdrcs12.f
comments? eliminate false resonances in IPIRDW Lorentzian with YMULT. 
Also, convolute Lorentzian on a coarse mesh but evaluate on fine mesh, 
up to 100000 points say.
12.24
9392 lines

19/08/95
sccs delget mdrcs12.f
comments? 0.0 -> zero in calls to dittner
12.23
9270 lines

07/07/95
sccs delget asdeck12
comments? Write energy-ordered TERM/LEVEL list for R-matrix input
No id keywords (cm7)
12.8
15869 lines

07/07/95
sccs delget mdrcs12.f
comments? Tweak dimensions for large cases in BEXA
No id keywords (cm7)
12.22
9220 lines

27/06/95
sccs delget mdrcs12.f
comments? Added SR.RCONVOLX to convolute R-matrix omega with cooler distribution
12.21
9217 lines

08/06/95
sccs delget mdrcs12.f
comments? Read N-state DW omega's. Can also mult by Auger yield to get E-A.
12.19
9121 lines

14/02/95
sccs delget mdrcs12.f
comments? ncar log scale fixed, no disspla now
12.16
8601 lines

12/11/94
sccs delget mdrcs12.f
comments? BP stat wt, Mitch's DF format....
12.10
8931 lines

08/11/94
sccs delget asdeck12
comments? Bayliss potl, ols/oic write, and minor mods
12.7
15861 lines

22/10/94
sccs delget mdrcs12.f
comments? input B.P. R-matrix data, output gnuplot file
12.9
8908 lines

23/09/94
sccs delget mdrcs12.f
comments? DR+RR multi electron & multi photon case (fearm).
12.8
8879 lines

10/09/94
sccs delget asdeck12
comments? core model potential introduced (MPSEUD.GT.0)
12.6
15854 lines

07/09/94
sccs delget mdrcs12.f
comments? minor mods to REDA operation
No id keywords (cm7)
12.7
8533 lines

13/08/94
sccs delget asdeck12
comments? write ic rad file for stgf
12.5
15529 lines

28/06/94
sccs delget mdrcs12.f
comments? JCFA .gt. 10 allowed for REDA
12.3
8513 lines

28/06/94
 sccs delget asdeck12
comments? continuum STOPOT CF=0 forbidden
12.4
15519 lines

20/06/94
sccs delget mdrcs12.f
comments? minor changes to NECOR and TOLB operation
No id keywords (cm7)
12.2
8513 lines

3/6/94
patiala> sccs delget mdrcs12.f
comments? read stat weight corrected; NDIM8=15 now
12.1
8502 lines