Portal codes
In this section, we describe supplementary python scripts used to generate csv-formatted databases of energy levels and matrix elements for the University of Delaware’s Portal for High-Precision Atomic Data and Computation. The required input files can be obtained from pconf for energies and pdtm for matrix elements. This process has been automated using the pCI-py scripts.
Method
The method of generating the csv-formatted atomic data files is summarized in the following steps:
Reading and reformatting input files
First, we read all
FINAL.RESoutputs frompconffrom each calculation done. The script will first check theci+all-order/andci+second-order/top-level directories foreven*andodd*parity subdirectories (e.g.even0,odd1). If a config.yml is provided the J values inconf.even.Jandconf.odd.Jdetermine which subdirectory is selected automatically; otherwise the script prompts interactively. If these top-level directories are not detected, then it will check theDATA_RAW/directory, where users should place the files manually. The all-order output files should be namedCONFFINALeven.RESandCONFFINALodd.RES, and the second-order output files should be namedCONFFINALevenMBPT.RESandCONFFINALoddMBPT.RES. If the all-order and second-order directories are detected, the script will copy and rename the files intoDATA_RAW/itself. Additionally, matrix element output files such asE1.RESfrompdtmcan be read. The script will checktm*subdirectories withinci+all-order/andci+second-order/first beforeDATA_RAW/. If twotm*directories are found (e.g. for two J values), theirE1.RESfiles are merged into a singleE1.RES; the second-order counterpart is handled identically to produceE1MBPT.RES. Once all input files are read, if second-order/MBPT data exist, energy uncertainties are estimated as the absolute difference between the CI+all-order and CI+second-order energies and a summary filefinal_res.csvis written. Otherwise uncertainties are set to 0. Experimental data are then acquired by parsing the NIST Atomic Spectral Database for the full list of energy levels and stored for comparison with the data generated through pCI.Filtering and correcting misidentified configurations
Sometimes the configurations and terms of energy levels outputted from the pCI codes are misidentified due to strong configuration mixing or numerical precision. At this stage, we attempt to correct misidentified configurations and establish a one-to-one correspondence between NIST and theory levels. The process proceeds in several sub-steps:
Preprocessing. Both the NIST and theory datasets are loaded. A common ground-state core prefix is subtracted from configuration strings so that comparisons are made on the valence part only. Theory levels are filtered to only those flagged as converged. For NIST levels that have no term label (e.g. levels with \(jj\)-coupled designations), a term is inferred from the best-matching theory state.
Configuration correction. The theory sometimes assigns the wrong principal quantum number to an orbital (e.g., predicts
2s.7pwhen the physical level is2s.6p). The corrected configurations are found by tracking the expected sequence of principal quantum numbers for each \((L, 2S+1)\) group and detecting gaps where the theory has jumped ahead by one.NIST-theory matching. For each NIST level, candidate theory counterparts are found through a series of passes:
Pass 1: \(J\) must match.
Pass 2: Configuration must match the primary theory configuration (or its inverted orbital ordering).
Pass 3: Term symbol must match exactly; if not, a correction of ±1 to the multiplicity is tried (Pass 4).
Pass 5: If the term matches but configurations differ, the theory principal quantum number of the last orbital is decremented by one and re-checked against the NIST configuration.
When multiple candidates survive, they are ranked by the percentage energy difference \(\Delta E / E_\mathrm{NIST}\). Secondary-configuration matches receive a 2% additive penalty to prefer primary-configuration matches. Assignments are then made greedily in order of score, with each theory level allowed to match at most one NIST level. Theory levels that remain unmatched receive their corrected (sequential) configuration label, provided it does not conflict with an already-assigned NIST designation.
Missing level detection. After the mapping is complete, the expected set of term symbols for each configuration is computed from the electron occupation and compared against the combined NIST+theory set. Any term/J combinations that are theoretically expected but absent from both datasets are appended to the output and flagged with a
~prefix.
The correspondence is written to
DATA_Output/{Element}_Even.txtandDATA_Output/{Element}_Odd.txt, with a companion+missingfile listing the absent levels.Outputting data for portal
The final part of the portal codes reformats the mapping of NIST and pCI energy levels for use on the UD Atom portal. The output is a csv-formatted file of the energies of the system, with a preference for NIST data over pCI-calculated data, i.e. for each configuration, NIST energies and identifications are chosen over the theory data. If NIST data is not available, then the theory values are used. The final column of the csv file
is_from_theoryis set toTrueif theory values are used. The energy levels are stored inElement_Energies.csvand the matrix elements are stored inElement_Matrix_Elements_Theory.csv. Matrix element uncertainties are combined in quadrature from the theory uncertainty (difference between all-order and second-order matrix elements) and a minimum floor based on themin_uncertaintyparameter. The total matrix element uncertainty is given by:\[\Delta_\mathrm{total} = \sqrt{\Delta_\mathrm{theory}^2 + \left(\frac{f_\mathrm{min}}{100} \cdot |d|\right)^2}\]where \(\Delta_\mathrm{theory}\) is the uncertainty from comparing CI+all-order and CI+second-order matrix elements, \(f_\mathrm{min}\) is the minimum uncertainty percentage (
portal.min_uncertaintyin the config), and \(d\) is the matrix element value. Additionally, the scriptgen_rates_lifetimes.pycan be used to generate csv-formatted files of transition rates and lifetimes from these two output files. These are outputted asElement_Lifetimes_Error_Check.csvandElement_Transition_Rates_Error_Check.csv.
Programs
gen_portal_csv.py
Reads pCI energy and matrix element output files, compares them against the NIST Atomic Spectra Database, corrects misidentified configurations, and writes the final csv files used by the portal.
Usage
python gen_portal_csv.py
The script is interactive. It first asks whether a config.yml file will be used. If yes, it prompts for the filename; if no, it prompts for the atom name and minimum matrix element uncertainty.
Configuration (config.yml)
When a config.yml is provided, the following keys are read:
atom.name— element and ionization stage in any of the formatsBa,Ba I,Ba+, orBa2conf.even.J,conf.odd.J— J values used to locate theeven{J}andodd{J}output directoriesportal.ignore_g(optional, defaultTrue) — exclude states with agorbital from the portal outputportal.min_uncertainty(optional) — minimum matrix element uncertainty as a percentage of the value; prompted interactively if absentportal.min_energy_diff_percent(optional, default3.0) — levels whose NIST-theory energy difference exceeds this percentage are excludedportal.energy_cutoff(optional) — explicit global energy cutoff in cm-1; overrides themin_energy_diff_percentcutoff when set
Input files
The script first checks for ci+all-order/ and ci+second-order/ subdirectories and copies their output into DATA_RAW/ automatically. If those directories are absent, files must be placed in DATA_RAW/ manually with the following names:
File |
Description |
|---|---|
|
CI+all-order even parity energies |
|
CI+all-order odd parity energies |
|
CI+second-order even parity energies |
|
CI+second-order odd parity energies |
|
E1 matrix elements (combined into E1.RES) |
|
MBPT matrix elements (combined into E1MBPT.RES) |
The second-order files are optional; if absent, uncertainties are set to 0.
Output files
File |
Description |
|---|---|
|
Energy levels preferring NIST over theory |
|
E1 matrix elements with uncertainties |
|
Even parity energies with uncertainty column |
|
Odd parity energies with uncertainty column |
|
NIST-theory mapping table, even parity |
|
NIST-theory mapping table, odd parity |
|
Filtered theory energies, even parity |
|
Filtered theory energies, odd parity |
|
Filtered NIST energies by parity |
|
Merged even+odd energies with uncertainties |
gen_rates_lifetimes.py
Reads the energy and matrix element csv files produced by gen_portal_csv.py and computes transition rates, lifetimes, and branching ratios in three steps:
Calculate E1 transition rates from matrix elements and energy differences.
Sum rates per upper state to obtain lifetimes and branching ratios.
Format all quantities with parenthetical uncertainty notation for portal display.
Usage
python gen_rates_lifetimes.py <atom_name>
where <atom_name> is the filename prefix used by gen_portal_csv.py (e.g. Ba1, Ca2).
Input files
File |
Description |
|---|---|
|
Required. Output of |
|
Required. Output of |
|
Optional. Experimental lifetimes to replace
theory values. Columns: |
Output files
File |
Description |
|---|---|
|
Step 1: raw rates per matrix element row |
|
Step 2: upper to lower transitions with display columns for wavelength, matrix element, branching ratio, and rate |
|
Step 2: per-state lifetimes and uncertainties |
|
Step 3: transition properties with parenthetical uncertainty notation |
|
Step 3: lifetimes with parenthetical uncertainty
notation; experimental values substituted where
|
|
Human-readable decay summary per upper state |