data_management.generate_atomicinfo

This script is used to create the experimental data look up tables for the atom class.

Original author: Ben Pritchard
Modified by: Zachery Crandall

In order to run, this script needs to know the location of the data directory to read from and the src code directory to output the result into. One can also optionally provide a nondefault value for the electron mass to Dalton ratio.

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_atomicinfo.py [-h] [--amu2me AMU2ME] 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
  --amu2me AMU2ME  Ratio of mass of electron to one Dalton. (Default: 1822.888486192)

This script looks for the following file(s):

+---data_dir
|       ElementNames.txt
|       CIAAW-ISOTOPEMASSES.txt
|       CIAAW-MASSES.txt

This script creates the following file(s):

+---src_dir
|       load_elements.hpp

Classes

AtomicData

Functions

parse_symbols(→ None)

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

_parse_ciaaw_isotopes(→ None)

Parses an isotope mass file from the Commission on Isotopic Abundances

_parse_ciaww_mass(→ None)

Parses a mass file from the Commission on Isotopic Abundances

_write_z_from_sym(→ None)

Generate the Z_from_sym.cpp source file.

_write_sym_from_z(→ None)

Generate the sym_from_Z.cpp source file.

_write_atoms_average(→ None)

Generate the atoms_average.cpp source file.

_write_atoms_isotope(→ None)

Generate the atoms_isotopes.cpp source file.

main(→ None)

Entry point function to generate atomic info files.

parse_args(→ argparse.Namespace)

Parse command line arguments.

Module Contents

class data_management.generate_atomicinfo.AtomicData
sym = ''
name = ''
Z = 0
mass = 0.0
isotopes = []
isotope_masses
add_isotope(num: int, mass: float) None

Add a new isotope mass to the list of isotopes for this element.

Parameters:
  • num (int) – Isotope mass number (Z + number of neutrons, N)

  • mass (float) – Isotope mass value

__repr__()

Return a formatted text representation of the atomic data.

Returns:

Formatted representation of the atomic data

Return type:

str

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

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

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_atomicinfo._parse_ciaaw_isotopes(iso_file: str, atoms: dict) None

Parses an isotope mass file from the Commission on Isotopic Abundances and Atomic Weights (CIAAW) and adds it to a given atomic collection.

Parameters:
  • iso_file (str) – CIAAW isotope mass file

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

data_management.generate_atomicinfo._parse_ciaww_mass(mass_file: str, atoms: dict) None

Parses a mass file from the Commission on Isotopic Abundances and Atomic Weights (CIAAW) and adds it to a given atomic collection.

Parameters:
  • iso_file (str) – CIAAW mass file

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

data_management.generate_atomicinfo._write_z_from_sym(out_dir: str, amu2me: float, atoms: dict) None

Generate the Z_from_sym.cpp source file.

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

  • amu2me (float) – Ratio of mass of electron to a Dalton.

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

data_management.generate_atomicinfo._write_sym_from_z(out_dir: str, amu2me: float, atoms: dict) None

Generate the sym_from_Z.cpp source file.

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

  • amu2me (float) – Ratio of mass of electron to a Dalton.

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

data_management.generate_atomicinfo._write_atoms_average(out_dir: str, amu2me: float, atoms: dict) None

Generate the atoms_average.cpp source file.

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

  • amu2me (float) – Ratio of mass of electron to a Dalton.

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

data_management.generate_atomicinfo._write_atoms_isotope(out_dir: str, amu2me: float, atoms: dict) None

Generate the atoms_isotopes.cpp source file.

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

  • amu2me (float) – Ratio of mass of electron to a Dalton.

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

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

Entry point function to generate atomic info files.

Parameters:

args (argparse.Namespace) – Command line argument namespace

data_management.generate_atomicinfo.parse_args() argparse.Namespace

Parse command line arguments.

Returns:

Values of command line arguments.

Return type:

argparse.Namespace