Function adas.write_adf04

def write_adf04(file=None, fulldata=None, sort=False, comments=None)

Write an adf04 specific ion file from a user supplied fulldata dictionary.

Parameters

file : str
full name of adf04 file.
fulldata : dict
contents of the adf04 file
    'adf04_type' :  variant of the adf04 file
                      1 = collision strengths vs E/delta_E
                      2 = unused
                      3 = effective collision strengths
                      4 = non-Maxwellian
                      5 = collision strengths vs E-delta_E (Ryd)
                      6 = specific for BBGP

    'iz0'        :  nuclear charge
    'iz'         :  recombined ion charge
    'ia'         :  energy level index number (array)
    'cstrga'     :  nomenclature/configuration for level (array)
    'isa'        :  multiplicity for level (array)
                       note: (isa-1)/2 = quantum number (s)
    'ila'        :  quantum number (l) for level (array)
    'xja'        :  quantum number (j-value) for level (array)
                       note: (2*xja)+1 = statistical weight
    'wa'         :  energy relative to level 1 (cm-1) for level (array)
    'npla'       :  number of parent/zeta contributions to ionisation
                    of level (array)
    'ipla'       :  parent index of contributions to ionisation
                    of level (array[parent index, level index])
    'zpla'       :  effective zeta parameter of contributions to ionisation
                    of level (array[parent index, level index])
    'bwnoa'      :  ionisation potential (cm-1) of parents (array)
    'cprta'      :  parent name in brackets (array)
    'prtwta'     :  parent weight for parents in bwnoa array
    'eorb'       :  orbital energies (Rydberg) of occupied orbitals
                    in the configuration present (array)
    'te'         :  electron temperatures (K) or energy parameter (array)
    'lower'      :  lower energy level index for excitation (array)
    'upper'      :  upper energy level index for excitation (array)
    'aval'       :  transition probability (s-1) (array)
    'gamma'      :  gamma (array [transition, te]
                      - effective collision strength for type 3 adf04
                      - collision strength for type 1 and 5
    'beth'       :  Bethe coefficient
    'lower_p'    :  lower energy level index for heavy particle excitation (array)
    'upper_p'    :  upper energy level index for heavy particle excitation (array)
    'aval_p'     :  E2 transition probability for heavy particle (s-1) (array)
    'gamma_p'    :  gamma for heavy particle (array [transition, te]
                      - effective collision strength for type 3 adf04
                      - collision strength for type 1 and 5
    'level_rec'  :  capturing level index for recombination (array)
    'parent_rec' :  parent level index for recombination (array)
    'rec'        :  recombination rate (cm3 s-1) (array[te, transition])
    'level_ion'  :  ionising level index for ionisation (array)
    'parent_ion' :  parent level index for ionisation (array)
    'ion'        :  ionisation rate (cm3 s-1) (array[te, transition])
    'level_cx'   :  capturing level index for charge exchange (array)
    'parent_cx'  :  parent level index for cx (array)
    'cx'         :  cx rate (cm3 s-1) (array[te, transition])
sort : bool
if set to True, sort the excitation indices
comments : list
comments for the end of the file as a list of strings.

Notes

Not all of the entries in an adf04 fulldata dictionary are needed (yet). The above is the subset required. eg There is a check for heavy particle (plines) in the input fulldata dictinary before attempting to use them.

Version History

  • Martin O'Mullane, 23-02-2021

    • First version
  • Martin O'Mullane, 25-03-2021

    • Improve warning message for missing Bethe limits.
  • Martin O'Mullane, 31-07-2021

    • Allow the possibility of just 2 decimal places for the orbital energies of high-Z elements.
  • Martin O'Mullane, 31-07-2021

    • Use the value of zpla to decide on whether to write {X}.
    • Check fulldata has entries for orbital energies, R, H or S lines before writing these parts of the adf04 file.
  • Martin O'Mullane, 17-10-2022

    • Some re-structuring to enable writing NIST-style (ie no transition data) files.
  • Martin O'Mullane, 09-12-2022

    • Convert lists in input dictionary to numpy arrays rather than stopping with errors.
  • Martin O'Mullane, 04-04-2024

    • Write P-lines if present in input fulldata dictionary.

Example

Round trip of He-like carbon file.

>>> import adas as adas
>>> file='/home/adas/adas/adf04/adas#6/mom97_ls#c4.dat'
>>> fulldata=adas.xxdata_04(file)
>>> my_comments=['C Testing write_adf04', 'C By me, today']
>>> my_file='/tmp/test_write_adf04.dat'
>>> adas.write_adf04(file=my_file, fulldata=fulldata,
...                  comments=my_comments)