data_management.generate_elec_configs

This script parses a file containing ground state atomic electronic configurations and generates a function to load that data into a PeriodicTable object.

For readability and convenience we use a few abbreviations throughout this script:

  • Z: the atomic number of an atom

  • Sym: the atomic symbol of an atom (e.g. H for hydrogen, He for helium)

Usage

usage: generate_ptable_configs.py [-h] data_dir src_dir

positional arguments:
  data_dir         Data directory for atomic information files.
  src_dir          Destination directory for generated source files.

optional arguments:
  -h, --help       show this help message and exit

This script looks for the following file(s):

+---data_dir
|       ElementNames.txt
|       NIST-ATOMICION.txt

This script creates the following file(s):

+---src_dir/atomic_configurations
|       atomconfigs.cpp

Attributes

LMAX

NMAX

i_to_lchar

lchar_to_i

Classes

AtomicData

Functions

parse_symbols(→ None)

Parse the given symbols file and add them to the existing atom

parse_config_str(→ dict)

parse an electronic configuration and return dict containing number

parse_nist_configs(→ None)

Parses file containing ionization energy data from the NIST Atomic

_write_configs(→ None)

Generate the electronic_configurations.cpp source file.

main(→ None)

Entry point function to generate atomic info files.

parse_args(→ argparse.Namespace)

Parse command line arguments.

Module Contents

data_management.generate_elec_configs.LMAX = 3
data_management.generate_elec_configs.NMAX = 7
data_management.generate_elec_configs.i_to_lchar
data_management.generate_elec_configs.lchar_to_i
class data_management.generate_elec_configs.AtomicData
sym = ''
name = ''
Z = 0
confstr = ''
confdict
property config_full
return full electronic configuration (number of electrons for each (l, n))
Returns:

number of electrons for each (l, n); indexed by [l][n-(l+1)]

Return type:

list[list[int]]

property config
return reduced config (number of electrons per l)
Returns:

(Ns, Np, Nd, …)

Return type:

tuple[int]

__repr__()
data_management.generate_elec_configs.parse_symbols(name_file: str, atoms: dict) None

Parse the given symbols file and add them to the existing atom collection. Atoms will be added twice (same data with two keys) to allow access via either Z or Sym

Parameters:
  • name_file (str) – File with atomic numbers, symbols, and names for atoms.

  • atoms (dict) – Current collection of atoms. Loaded atoms will be added here.

data_management.generate_elec_configs.parse_config_str(sconf: str) dict

parse an electronic configuration and return dict containing number of electrons in each shell, indexed by (n,l)

Returns:

dictionary with number of electrons in each shell, indexed by (n, l) where n is an int and l is a str with length 1

Return type:

dict[tuple[int,str],int]

data_management.generate_elec_configs.parse_nist_configs(ip_file: str, atoms: dict) None

Parses file containing ionization energy data from the NIST Atomic Spectra Database or other file with similar format each line should contain “Z element_name atomic_config […]”

If an element symbol is used to represent a closed-shell core in a config, the config for that element must be parsed and added to atoms before it is used to represent a core configuration. e.g. Ne config must be added before [Ne]3s2

Parameters:
  • ip_file – path to file containing configs

  • atoms (dict of AtomicData) – Collection of atoms. Loaded configs will be added here.

data_management.generate_elec_configs._write_configs(out_dir: str, atoms: dict) None

Generate the electronic_configurations.cpp source file.

Parameters:
  • out_dir (str) – Output directory for the generated header file.

  • atoms (dict of AtomicData) – Collection of atoms.

data_management.generate_elec_configs.main(args: argparse.Namespace) None

Entry point function to generate atomic info files.

Parameters:

args (argparse.Namespace) – Command line argument namespace

data_management.generate_elec_configs.parse_args() argparse.Namespace

Parse command line arguments.

Returns:

Values of command line arguments.

Return type:

argparse.Namespace