Skip to content
This repository was archived by the owner on Nov 10, 2025. It is now read-only.

Commit eb949e7

Browse files
various improvements species
1 parent 665fa36 commit eb949e7

6 files changed

Lines changed: 37 additions & 40 deletions

File tree

src/ryd_numerov/radial/model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def calc_effective_potential_centrifugal(self, x: XType) -> XType:
162162
163163
"""
164164
x2 = x * x
165-
return (1 / self.species.reduced_mass_factor) * self.l * (self.l + 1) / (2 * x2)
165+
return (1 / self.species.reduced_mass_au) * self.l * (self.l + 1) / (2 * x2)
166166

167167
def calc_effective_potential_sqrt(self, x: XType) -> XType:
168168
r"""Calculate the effective potential V_sqrt(x) from the sqrt transformation in atomic units.
@@ -183,7 +183,7 @@ def calc_effective_potential_sqrt(self, x: XType) -> XType:
183183
184184
"""
185185
x2 = x * x
186-
return (1 / self.species.reduced_mass_factor) * (3 / 32) / x2
186+
return (1 / self.species.reduced_mass_au) * (3 / 32) / x2
187187

188188
def calc_total_effective_potential(self, x: XType) -> XType:
189189
r"""Calculate the total effective potential V_eff(x) in atomic units.

src/ryd_numerov/radial/radial_state.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def create_grid(
134134
if self.l_r <= 10:
135135
z_min = 0.0
136136
else:
137-
energy_au = calc_energy_from_nu(self.species.reduced_mass_factor, self.nu)
137+
energy_au = calc_energy_from_nu(self.species.reduced_mass_au, self.nu)
138138
z_min = self.model.calc_turning_point_z(energy_au)
139139
z_min = math.sqrt(0.5) * z_min - 3 # see also compare_z_min_cutoff.ipynb
140140
else:

src/ryd_numerov/radial/wavefunction.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,9 @@ def integrate(self, run_backward: bool = True, w0: float = 1e-10, *, _use_njit:
173173
grid = self.grid
174174

175175
species = self.radial_state.species
176-
energy_au = calc_energy_from_nu(species.reduced_mass_factor, self.radial_state.nu)
176+
energy_au = calc_energy_from_nu(species.reduced_mass_au, self.radial_state.nu)
177177
v_eff = self.model.calc_total_effective_potential(grid.x_list)
178-
glist = 8 * species.reduced_mass_factor * grid.z_list * grid.z_list * (energy_au - v_eff)
178+
glist = 8 * species.reduced_mass_au * grid.z_list * grid.z_list * (energy_au - v_eff)
179179

180180
if run_backward:
181181
# During the Numerov integration we define the wavefunction such that it should always stop

src/ryd_numerov/rydberg_state.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def get_energy(self, unit: str | None = None) -> PintFloat | float:
6767
where `\mu = R_M/R_\infty` is the reduced mass and `\nu` the effective principal quantum number.
6868
"""
6969
nu = self.get_nu()
70-
energy_au = calc_energy_from_nu(self.species.reduced_mass_factor, nu)
70+
energy_au = calc_energy_from_nu(self.species.reduced_mass_au, nu)
7171
if unit == "a.u.":
7272
return energy_au
7373
energy: PintFloat = energy_au * BaseQuantities["ENERGY"]

src/ryd_numerov/species/species_object.py

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ def get_corrected_rydberg_constant(self, unit: str | None = "hartree") -> PintFl
281281
The corrected Rydberg constant is defined as
282282
283283
.. math::
284-
R_M = R_\infty * \frac{m_{Core}}{m_{Core} + m_e}
284+
R_M = R_\infty \frac{m_{Core}}{m_{Core} + m_e}
285285
286286
where :math:`R_\infty` is the Rydberg constant for infinite nuclear mass,
287287
:math:`m_{Core}` is the mass of the core,
@@ -305,18 +305,18 @@ def get_corrected_rydberg_constant(self, unit: str | None = "hartree") -> PintFl
305305
return corrected_rydberg_constant.to(unit, "spectroscopy").magnitude
306306

307307
@cached_property # don't remove this caching without benchmarking it!!!
308-
def reduced_mass_factor(self) -> float:
309-
r"""The reduced mass factor \mu.
308+
def reduced_mass_au(self) -> float:
309+
r"""The reduced mass mu in atomic units.
310310
311-
The reduced mass factor
311+
The reduced mass in atomic units :math:`\mu / m_e` is given by
312312
313313
.. math::
314-
\mu = \frac{m_{Core}}{m_{Core} + m_e}
314+
\frac{\mu}{m_e} = \frac{m_{Core}}{m_{Core} + m_e}
315315
316-
calculated via the corrected Rydberg constant
316+
We calculate the reduced mass via the corrected Rydberg constant
317317
318318
.. math::
319-
\mu = \frac{R_M}{R_\infty}
319+
\frac{\mu}{m_e} = \frac{R_M}{R_\infty}
320320
321321
"""
322322
return self.get_corrected_rydberg_constant("hartree") / rydberg_constant.to("hartree").m
@@ -334,23 +334,17 @@ def calc_nu(
334334
r"""Calculate the effective principal quantum number nu of a Rydberg state with the given n, l, j_tot and s_tot.
335335
336336
I.e. either look up the energy for low lying states in the nist data (if use_nist_data is True),
337-
and calculate nu from the energy.
338-
Or calculate nu via the quantum defect theory.
339-
340-
The effective principal quantum number nu in quantum defect theory
341-
is defined as series expansion :math:`\nu = n^* = n - \delta_{lj}(n)`
342-
where
337+
and calculate nu from the energy via (see also `calc_nu_from_energy`):
343338
344339
.. math::
345-
\delta_{lj}(n) = d0_{lj} + d2_{lj} / [n - d0_{lj}(n)]^2 + d4_{lj} / [n - \delta_{lj}(n)]^4 + ...
346-
340+
\nu = \sqrt{\frac{1}{2} \frac{\mu/m_e}{-E/E_H}}
347341
348-
is the quantum defect. The energy of the Rydberg state is then given by
342+
Or calculate nu via the quantum defect theory,
343+
where nu is defined as series expansion :math:`\nu = n^* = n - \delta_{lj}(n)`
344+
with the quantum defect
349345
350346
.. math::
351-
E_{nlj} / E_H = -\frac{1}{2} \frac{Ry}{Ry_\infty} \frac{1}{n^*}
352-
353-
where :math:`E_H` is the Hartree energy (the atomic unit of energy).
347+
\delta_{lj}(n) = d0_{lj} + d2_{lj} / [n - d0_{lj}(n)]^2 + d4_{lj} / [n - \delta_{lj}(n)]^4 + ...
354348
355349
References:
356350
- On a New Law of Series Spectra, Ritz; DOI: 10.1086/141591, https://ui.adsabs.harvard.edu/abs/1908ApJ....28..237R/abstract
@@ -365,7 +359,6 @@ def calc_nu(
365359
Default is True.
366360
nist_n_max: Maximum principal quantum number for which to use the NIST energy data.
367361
Default is 15.
368-
unit: Desired unit for the energy. Default is atomic units "hartree".
369362
370363
"""
371364
if s_tot is None:
@@ -381,7 +374,7 @@ def calc_nu(
381374
if (n, l, j_tot, s_tot) in self._nist_energy_levels:
382375
energy_au = self._nist_energy_levels[(n, l, j_tot, s_tot)]
383376
energy_au -= self.get_ionization_energy("hartree")
384-
return calc_nu_from_energy(self.reduced_mass_factor, energy_au)
377+
return calc_nu_from_energy(self.reduced_mass_au, energy_au)
385378
logger.debug(
386379
"NIST energy levels for (n=%d, l=%d, j_tot=%s, s_tot=%s) not found, using quantum defect theory.",
387380
*(n, l, j_tot, s_tot),

src/ryd_numerov/species/utils.py

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,49 +2,53 @@
22
import re
33

44

5-
def calc_nu_from_energy(reduced_mass_factor: float, energy_au: float) -> float:
5+
def calc_nu_from_energy(reduced_mass_au: float, energy_au: float) -> float:
66
r"""Calculate the effective principal quantum number nu from a given energy.
77
88
The effective principal quantum number is given by
99
1010
.. math::
11-
\nu = \sqrt{\frac{1}{2} \frac{\mu}{-E}}
11+
\nu
12+
= \sqrt{\frac{1}{2} \frac{R_M/R_\infty}{-E/E_H}}
13+
= \sqrt{\frac{1}{2} \frac{\mu/m_e}{-E/E_H}}
1214
13-
where :math:`\mu` is the reduced mass factor and :math:`E` the energy in atomic units.
15+
where :math:`\mu/m_e` is the reduced mass in atomic units and :math:`E/E_H` the energy in atomic units.
1416
1517
Args:
16-
reduced_mass_factor: The reduced mass factor :math:`\mu = \frac{m_{Core}}{m_{Core} + m_e}`.
17-
energy_au: The energy :math:`E` in atomic units (hartree).
18+
reduced_mass_au: The reduced mass in atomic units (electron mass).
19+
energy_au: The energy in atomic units (hartree).
1820
1921
Returns:
20-
The effective principal quantum number :math:`\nu`.
22+
The effective principal quantum number nu.
2123
2224
"""
23-
nu = math.sqrt(0.5 * reduced_mass_factor / -energy_au)
25+
nu = math.sqrt(0.5 * reduced_mass_au / -energy_au)
2426
if abs(nu - round(nu)) < 1e-10:
2527
nu = round(nu)
2628
return nu
2729

2830

29-
def calc_energy_from_nu(reduced_mass_factor: float, nu: float) -> float:
31+
def calc_energy_from_nu(reduced_mass_au: float, nu: float) -> float:
3032
r"""Calculate the energy from a given effective principal quantum number nu.
3133
3234
The energy is given by
3335
3436
.. math::
35-
E = -\frac{1}{2} \frac{\mu}{\nu^2}
37+
E/E_H
38+
= -\frac{1}{2} \frac{R_M/R_\infty}{\nu^2}
39+
= -\frac{1}{2} \frac{\mu/m_e}{\nu^2}
3640
37-
where :math:`\mu` is the reduced mass factor and :math:`\nu` the effective principal quantum number.
41+
where :math:`\mu/m_e` is the reduced mass in atomic units and :math:`\nu` the effective principal quantum number.
3842
3943
Args:
40-
reduced_mass_factor: The reduced mass factor :math:`\mu = \frac{m_{Core}}{m_{Core} + m_e}`.
44+
reduced_mass_au: The reduced mass in atomic units :math:`\mu/m_e = \frac{m_{Core}}{m_{Core} + m_e}`.
4145
nu: The effective principal quantum number :math:`\nu`.
4246
4347
Returns:
44-
The energy :math:`E` in atomic units (hartree).
48+
The energy E in atomic units (hartree).
4549
4650
"""
47-
return -0.5 * reduced_mass_factor / nu**2
51+
return -0.5 * reduced_mass_au / nu**2
4852

4953

5054
def convert_electron_configuration(config: str) -> list[tuple[int, int, int]]:

0 commit comments

Comments
 (0)