Hydrogen and hydrogen-like atoms
Hydrogen.py module
Bohr model / analytical solution of the Schrödinger equation for a one-electron system (H, He⁺, Li²⁺, …), with an optional finite nuclear-mass (reduced-mass) correction. Covers energy levels, ionization energies, spectral series, and their visualization as energy-level diagrams and line spectra.
Note: this module covers energy levels, ionization energies, and spectra (lines and diagrams). The atomic orbitals themselves — radial parts, angular parts, and their 2D/3D visualization — are in the separate
AO.pymodule.
Quick Start
from pyphyschemtools import (
rydberg_Z, En_hydrogenic, Ei_hydrogenic,
spectral_series, plot_energy_levels, plot_line_spectrum
)
# Ground-state energy of hydrogen, in eV
En_hydrogenic(1)
# Ionization energy of He+ (Z=2)
Ei_hydrogenic(Z=2)
# Print the Lyman to Humphreys series, transitions up to n2=12
spectral_series(n2_max=12)
# Energy-level diagram, absorption transitions
plot_energy_levels(n2_max=6, transition_type="absorption")
# Line spectrum on a log wavelength axis
plot_line_spectrum(n2_max=12)
ou bien
import pyphyschemtools.hydrogen as H
H.Ei_hydrogenic(Z=1)
H.plot_line_spectrum(n2_max=12)
Reduced-mass correction
All energy calculations go through a Rydberg constant that can be corrected for the finite mass of the nucleus:
rydberg_Z(Z=1, A=None, M_atom=None)returns \(R_M\) in m⁻¹. The nuclear mass is looked up viamendeleevfor isotopeAof elementZ(the most abundant isotope by default), or can be given directly asM_atom(kg), bypassing the lookup entirely.Every other function accepts
reduced_mass=True(default, uses \(R_M\)) orreduced_mass=False(uses \(R_\infty\), the infinite-nucleus limit —AandM_atomare then ignored).The correction is small (~10⁻⁴ relative) and shrinks as the nucleus gets heavier; it is included mainly for pedagogical completeness rather than to close the gap with experiment, which — for Z > 1 — is dominated by relativistic and QED effects that this module does not include.
Energy levels
En_hydrogenic(n, Z=1, A=None, M_atom=None, reduced_mass=True, unit='eV')
returns the (negative, bound-state) energy of level \(n\) of a hydrogenic
atom/ion of nuclear charge \(Z\), in joules or eV.
Ionization energy
Ei_hydrogenic(Z, A=None, M_atom=None, reduced_mass=True) returns the
energy (eV) needed to remove the single electron from the ground state
to the continuum. The \(Z\)-th ionization energy of an element matches the
hydrogen-like ion of nuclear charge \(Z\), which makes this a convenient
reference point against tabulated ionization energies.
Spectral series
Named series are keyed by their lower level \(n_1\):
\(n_1\) |
Name |
Short |
|---|---|---|
1 |
Lyman |
Ly |
2 |
Balmer |
Ba |
3 |
Paschen |
Pa |
4 |
Brackett |
Br |
5 |
Pfund |
Pf |
6 |
Humphreys |
Hu |
For \(Z > 1\) these names are historically defined for hydrogen only and are used “by analogy” — printed and labeled with a “-like” suffix (e.g. the Lyman-like series of He⁺).
spectral_series(Z=1, A=None, M_atom=None, reduced_mass=True, n2_max=12, series_names=None) prints, for each series in series_names (default:
SERIES_NAMES, Lyman to Humphreys), its series limit (\(n_2 \to \infty\))
and every transition \(n_2 \to n_1\) with its energy (eV), wavelength (nm),
and frequency (Hz).
Energy-level diagrams
plot_energy_levels(Z=1, A=None, M_atom=None, reduced_mass=True, n2_max=7, series_names=None, to_scale=True, transition_type="absorption", size=(9, 11), show_level_labels=True, show_transition_labels=True, save_as=None) draws:
a horizontal line for each level \(n = 1 \ldots n_2^{\max}\), labeled with its energy;
the ionization limit at 0 eV, with the continuum of free-electron states shaded above it;
the transitions of each series as colored arrows labeled with Greek letters (\(\alpha, \beta, \ldots\), up to \(\epsilon\) — there is no standard name for higher members).
Two display modes, controlled by to_scale:
to_scale=True(default): levels sit at their true eV energy. Since \(E_n \propto 1/n^2\), levels \(n \geq 2\) crowd together near the ionization limit while \(n=1\) sits far below — itself a useful illustration of why the spectrum bunches up with increasing \(n\).to_scale=False: levels are evenly spaced by rank — the usual simplified textbook diagram, more readable for \(n \geq 2\) but no longer a true energy axis.
transition_type controls both arrow direction and layout:
"absorption"(default): arrows point up (\(n_1 \to n_2\)), ordered left to right by increasing transition size (α first)."emission": arrows point down (\(n_2 \to n_1\), the electron falling back to \(n_1\)), ordered left to right by decreasing transition size, all converging on the same \(n_1\).
Figures are saved through pyphyschemtools.core.save_fig (missing
directories created automatically).
Line spectra
plot_line_spectrum(Z=1, A=None, M_atom=None, reduced_mass=True, n2_max=12, series_names=None, show_visible=True, log_scale=True, ax=None) draws a wavelength axis (nm) with one colored vertical line per
transition \(n_2 \to n_1\), colored by series, the α-line of each series
labeled (e.g. “Ly-α”), and — by default — the visible range (380–780 nm)
shaded and a log wavelength scale (the series span several decades, from
~100 nm to several microns).
API reference
hydrogen.py — hydrogen atom and hydrogenic ions
Bohr model / analytical solution of the Schrodinger equation for a one-electron system (H, He+, Li2+, …), with an optional finite nuclear-mass (reduced-mass) correction.
Public functions: - rydberg_Z : Rydberg constant corrected for the reduced mass - En_hydrogenic : energy of level n (in joules) - Ei_hydrogenic : ionization energy (in eV)
- pyphyschemtools.hydrogen.Ei_hydrogenic(Z, A=None, M_atom=None, reduced_mass=True)[source]
Ionization energy (in eV) of a hydrogenic (hydrogen-like) ion of nuclear charge Z, i.e. the energy to remove its single electron from the ground state (n=1 to infinity). Ei = h*c*R*Z^2, the opposite of the ground-state energy.
input:
Z = nuclear charge / atomic number (1 = H, 2 = He+, 3 = Li2+, …)
A = mass number of the isotope (for the mendeleev mass lookup)
M_atom = atomic mass in kg (overrides the lookup)
reduced_mass = if True (default), R = R_M is corrected for the finite nuclear mass of the isotope (see rydberg_Z); if False, R = Rinf is the infinite-nucleus limit (A and M_atom are then ignored)
output:
ionization energy of the hydrogen-like ion, in eV
note: this is a non-relativistic Bohr/Schrodinger result. The reduced-mass correction is tiny (~1e-4 relative) and shrinks as Z grows, whereas the gap to experiment grows with Z because relativistic and QED effects (absent here) scale steeply with Z. To compare with mendeleev, the Z-th ionization energy of the element matches the hydrogen-like ion of charge Z.
- pyphyschemtools.hydrogen.En_hydrogenic(n, Z=1, A=None, M_atom=None, reduced_mass=True, unit='eV')[source]
Energy of level n of a hydrogenic (hydrogen-like) atom or ion (Bohr model / analytical solution of the Schrodinger equation), in joules or eV.
E_n = -h*c*R * Z^2 / n^2, with R the Rydberg constant. With reduced_mass=True (default) R = R_M is corrected for the finite nuclear mass of the isotope (see rydberg_Z); with reduced_mass=False R = Rinf is the infinite-nucleus limit. Equivalently E_n = -Ei * Z^2 / n^2 with Ei = h*c*R.
input:
n = principal quantum number (integer > 0)
Z = atomic number (default: 1 for hydrogen)
A = mass number of the isotope (for the mendeleev mass lookup)
M_atom = atomic mass in kg (overrides the lookup)
reduced_mass = if True (default), use the reduced-mass-corrected R_M; if False, use the infinite-nucleus constant Rinf
unit = ‘J’ or ‘eV’ (default)
output:
energy of level n, in joules or eV (negative value, bound state)
- pyphyschemtools.hydrogen.plot_energy_levels(Z=1, A=None, M_atom=None, reduced_mass=True, n2_max=7, series_names=None, to_scale=True, transition_type='absorption', size=(9, 11), show_level_labels=True, show_transition_labels=True, save_as=None)[source]
Draw an energy-level diagram of a hydrogenic atom/ion of nuclear charge Z: a horizontal line for each level n = 1 .. n2_max (labeled “n = …” on the right, against a true energy axis in eV on the left), a dashed line for the ionization limit at 0 eV with the continuum of free-electron states shaded above it, and the transitions n2 <-> n1 of each series in series_names, drawn as colored arrows and labeled with Greek letters (alpha, beta, …) in the series’ color.
By default (to_scale=True) the levels are placed at their true energy (eV) on the left-hand axis: since E_n scales as 1/n^2, n=2..n2_max then crowd together near the ionization limit while n=1 sits far below – itself a good illustration of why the levels bunch up as n increases. With to_scale=False the levels are evenly spaced by rank instead (the usual simplified “schematic” textbook diagram), which keeps the n>=2 levels readable but no longer reflects the true energy axis.
transition_type controls both the arrow direction and, within a series, the left-to-right layout: “absorption” (default) draws arrows pointing up (n1 -> n2), ordered left to right by increasing transition size (alpha first); “emission” draws arrows pointing down (n2 -> n1, the electron falling back to n1), ordered left to right by decreasing transition size, all arriving at the same n1.
input:
Z = nuclear charge / atomic number (default: 1 for H)
A = mass number of the isotope (for the mass lookup)
M_atom = atomic mass in kg (overrides the lookup)
reduced_mass = if True (default), use the reduced-mass-corrected R_M; if False, use the infinite-nucleus constant Rinf
n2_max = highest principal quantum number shown
series_names = {n1: name} mapping of lower levels to draw; defaults to SERIES_NAMES (Lyman to Humphreys, n1 = 1 to 6)
to_scale = if True (default), levels are placed at their true energy on the left-hand eV axis; if False, they are evenly spaced by rank instead (schematic)
transition_type = “absorption” (default) or “emission”; see above
show_level_labels = if True (default), label every level “n = … (… eV)” on the right; if False, only n=1 to 5 are labeled (the others still get their line, just no text). The ionization limit label is kept either way.
show_transition_labels = if True (default), label each transition with its Greek letter, alpha to epsilon only (the first five transitions of a series) – there is no standard name for higher members, so none is invented and those stay unlabeled regardless of this setting. If False, no per-transition label is drawn at all (the arrows and series names are unaffected).
size = (width, height) in inches for a new figure
save_as = file path to save the figure to (e.g. “levels.png” or “levels.svg”), passed to pyphyschemtools.core’s save_fig (format taken from the extension, missing directories created automatically). Not saved if None (default)
- pyphyschemtools.hydrogen.plot_line_spectrum(Z=1, A=None, M_atom=None, reduced_mass=True, n2_max=12, series_names=None, show_visible=True, log_scale=True, ax=None)[source]
Draw the line spectrum of a hydrogenic atom/ion of nuclear charge Z: a wavelength axis (nm) with one colored vertical line per transition n2 –> n1, colored by series, and the alpha line of each series labeled with an arrow (e.g. “Ly-alpha”).
input:
Z = nuclear charge / atomic number (default: 1 for hydrogen)
A = mass number of the isotope (for the mendeleev mass lookup)
M_atom = atomic mass in kg (overrides the lookup)
reduced_mass = if True (default), use the reduced-mass-corrected R_M; if False, use the infinite-nucleus constant Rinf
n2_max = highest principal quantum number n2 included
series_names = {n1: name} mapping of lower levels to draw; defaults to SERIES_NAMES (Lyman to Humphreys, n1 = 1 to 6)
show_visible = if True (default), shade the visible range (380-780 nm)
log_scale = if True (default), use a log wavelength axis (the series span several decades, from ~100 nm to several microns)
ax = matplotlib Axes to draw on; a new figure is created if None (default)
output:
the matplotlib Axes used
- pyphyschemtools.hydrogen.rydberg_Z(Z=1, A=None, M_atom=None)[source]
Rydberg constant (in m^-1) corrected for the finite nuclear mass of the given isotope: R = Rinf * M_nucleus / (me + M_nucleus).
Note: the value depends on the nuclear mass only, not on Z. The Z^2 factor belongs to the level/transition formula, not to the Rydberg constant itself.
input:
Z = atomic number (default: 1 for hydrogen); used to look up the element and, together with M_atom, to get the nuclear mass
A = mass number of the isotope to use. If None (default), the most abundant isotope of element Z (highest abundance among its isotopes with known abundance) is used
M_atom = atomic mass in kg; overrides the mendeleev lookup entirely (A is then ignored)
output:
Rydberg constant corrected for the reduced mass, in m^-1
- pyphyschemtools.hydrogen.spectral_series(Z=1, A=None, M_atom=None, reduced_mass=True, n2_max=12, series_names=None)[source]
Print the spectral series of a hydrogenic atom/ion of nuclear charge Z: for each n1 in series_names, the series limit (as n2 tends to infinity) and every transition n2 –> n1 for n1 < n2 <= n2_max, …, with the transition energy (eV), wavelength (nm) and frequency (Hz).
The series names (Lyman, Balmer, …) were historically defined for the hydrogen atom (Z=1). For Z>1 they are only used “by analogy” (the term structure is the same, just scaled by Z^2; e.g. the “Lyman-like” series of He+ is sometimes called its Lyman series in the literature) – printed here with a “-like” suffix to make that explicit.
input:
Z = nuclear charge / atomic number (default: 1 for hydrogen)
A = mass number of the isotope (for the mendeleev mass lookup)
M_atom = atomic mass in kg (overrides the lookup)
reduced_mass = if True (default), use the reduced-mass-corrected R_M; if False, use the infinite-nucleus constant Rinf
n2_max = highest principal quantum number n2 to print
series_names = {n1: name} mapping of lower levels to print; defaults to SERIES_NAMES (Lyman to Humphreys, n1 = 1 to 6)
output:
None (prints to stdout)