Core package¶
The core page documents the package-level exports together with the utility modules that support kinematics and nuclear data, and shared helper functions.
Public package entry points for jitr.
Utilities¶
The jitr.utils package re-exports the most common helper modules and
functions. The defining modules are documented below so objects only
appear once in the API index.
Physical constants used throughout jitr.
Analytic and tabulated proton/neutron density utilities.
Tabulated densities ship with the package as one compressed .npz file per
density model under data/densities/ (e.g. d1m.npz, bskg3.npz).
Each file stores the proton and neutron densities of every nuclide on a
uniform radial grid as float32 (the source tables carry 5-6 significant
digits). The original 11-column ASCII .rad tables can be converted with
scripts/convert_density_tables.py (see read_rad_file() and
write_density_npz()).
- class jitr.utils.density.DensityTable(A, Z, model, symbol, dr, radial_grid, proton_density_grid, neutron_density_grid)[source]¶
Bases:
objectTabulated proton and neutron densities for a single nuclide.
- Parameters:
A (
int) – Atomic mass number.Z (
int) – Atomic number.model (
str) – Density-model identifier.symbol (
str) – Chemical symbol used by the packaged table.dr (
float) – Nominal radial-grid spacing in fm.radial_grid (
ndarray[tuple[Any,...],dtype[double]]) – Tabulated radial grid in fm.proton_density_grid (
ndarray[tuple[Any,...],dtype[double]]) – Proton density sampled onradial_grid.neutron_density_grid (
ndarray[tuple[Any,...],dtype[double]]) – Neutron density sampled onradial_grid.
- class jitr.utils.density.TwoParameterFermiDensity(R, a, rho0=None, N=None)[source]¶
Bases:
objectCallable two-parameter Fermi density profile.
- Parameters:
- Raises:
ValueError – If neither
rho0norNis provided.
- jitr.utils.density.densities(A, Z, r, model='d1m')[source]¶
Return proton and neutron densities on the requested radial grid.
- jitr.utils.density.density_from_array(r_array, rho_array, clip_negative=True)[source]¶
Wrap a tabulated radial density as a callable interpolator.
- Parameters:
- Return type:
Callable[[float|TypeAliasType],ndarray[tuple[Any,...],dtype[double]]]- Returns:
A callable density interpolator that returns zero outside the tabulated range and exposes
r_maxas the maximum tabulated radius.- Raises:
ValueError – If the tabulated arrays have different shapes or the radial grid is not strictly increasing.
- jitr.utils.density.density_table(A, Z, model='d1m')[source]¶
Return the tabulated density table for a nuclide.
- Parameters:
- Return type:
- Returns:
The packaged density table for
(A, Z).- Raises:
KeyError – If no table exists for the requested nuclide/model.
- jitr.utils.density.density_targets(model='d1m', Z=None)[source]¶
Return the available nuclides for a density model.
- jitr.utils.density.init_density_db()[source]¶
Load the packaged density tables into memory if needed.
- Return type:
- jitr.utils.density.matter_density(A, Z, r, model='d1m')[source]¶
Return the total matter density on the requested radial grid.
- jitr.utils.density.neutron_density(A, Z, r, model='d1m')[source]¶
Return the neutron density on the requested radial grid.
- jitr.utils.density.proton_density(A, Z, r, model='d1m')[source]¶
Return the proton density on the requested radial grid.
- jitr.utils.density.read_rad_file(path, model)[source]¶
Parse all nuclide blocks from an ASCII
.raddensity table.This is the conversion-time reader for the original tables; the runtime loader reads the packaged
.npzfiles instead. Each block starts with a header lineZ A n_points drfollowed byn_pointsrows of 11 columns, of which column 0 (radius), column 1 (proton density) and column 6 (neutron density) are used. The file stem must be the element symbol forZ.- Parameters:
- Return type:
- Returns:
Parsed density-table records from
path.- Raises:
ValueError – If the file contents are malformed.
- jitr.utils.density.two_parameter_fermi(r, R, a, rho0=None, N=None)[source]¶
Return a two-parameter Fermi density.
- Parameters:
r (
float|TypeAliasType) – Radial coordinate or coordinates in fm.R (
float) – Half-density radius in fm.a (
float) – Surface diffuseness in fm.rho0 (
float|None) – Central density normalization. Mutually exclusive withN.N (
float|None) – Integrated particle number used to normalize the profile.
- Return type:
- Returns:
Density values sampled at
r.- Raises:
ValueError – If neither
rho0norNis provided.
- jitr.utils.density.write_density_npz(tables, path)[source]¶
Pack density tables into a compressed
.npzfile.The radial grid is not stored: every table must be tabulated on a uniform grid
np.arange(n_points) * dr(checked here), so it is rebuilt on load. Densities are stored as float32; nuclides may have differentn_points.Layout (
format_version=DENSITY_NPZ_FORMAT_VERSION):Z, A, n_points : int16 (N,) dr : float64 (N,) offsets : int64 (N + 1,) cumulative n_points, starting at 0 rho_p, rho_n : float32 (M,) densities of nuclide i are rho[offsets[i]:offsets[i + 1]]
- Parameters:
tables (
list[DensityTable]) – Density tables to pack.path (
Path) – Output.npzpath.
- Raises:
ValueError – If a table is not on a uniform radial grid or if two tables share the same
(A, Z).- Return type:
Free-particle and Coulomb asymptotic solutions.
- jitr.utils.free_solutions.Gamow_factor(l, eta)[source]¶
Return the Coulomb Gamow factor for angular momentum
l.
- class jitr.utils.free_solutions.CoulombHankelTable(Hp, Hm, Hpp, Hmp)[source]¶
Bases:
NamedTupleCoulomb-Hankel functions
H± = G ± iFand derivatives forl = 0..lmax.- Parameters:
- jitr.utils.free_solutions.coulomb_hankel_table(rho, eta, lmax, wronskian_tol=1e-08)[source]¶
Return
H+,H-,H+'andH-'atrhoforl = 0..lmax.For
eta == 0the functions are Riccati-Bessel functions fromscipy; otherwiseFandGcome from the three-term recurrence anchored on twompmathevaluations. The derivatives follow from the exact recurrence. Everylis verified against the WronskianF' G - F G' = 1; anylfailingwronskian_tolis recomputed withmpmathdirectly.- Return type:
- Parameters:
- jitr.utils.free_solutions.H_plus(s, l, eta)[source]¶
Return the outgoing Coulomb-Hankel function
G + iFats.
- jitr.utils.free_solutions.H_minus(s, l, eta)[source]¶
Return the incoming Coulomb-Hankel function
G - iFats.
- jitr.utils.free_solutions.H_plus_prime(s, l, eta)[source]¶
Return the derivative of the outgoing Coulomb-Hankel function at
s.
- jitr.utils.free_solutions.H_minus_prime(s, l, eta)[source]¶
Return the derivative of the incoming Coulomb-Hankel function at
s.
Kinematic helpers for entrance, exit, and frame-conversion calculations.
- class jitr.utils.kinematics.ChannelKinematics(Elab, Ecm, mu, k, eta)[source]¶
Bases:
objectKinematic quantities for a single reaction channel.
- Variables:
Elab – Laboratory-frame kinetic energy in MeV.
Ecm – Center-of-mass kinetic energy in MeV.
mu – Reduced mass in MeV/c^2.
k – Center-of-mass wavenumber in fm^-1.
eta – Sommerfeld parameter.
- Parameters:
- jitr.utils.kinematics.semi_relativistic_kinematics(mass_target, mass_projectile, Elab, Zz=0)[source]¶
Compute semi-relativistic entrance-channel kinematics.
Uses the approximation from Ingemarsson (1974) for a projectile scattering from a fixed target.
- Parameters:
- Return type:
- Returns:
A populated
ChannelKinematicsinstance.
- jitr.utils.kinematics.classical_kinematics(mass_target, mass_projectile, Elab, Zz=0)[source]¶
Compute non-relativistic kinematics from a laboratory energy.
- Parameters:
- Return type:
- Returns:
A populated
ChannelKinematicsinstance.
- jitr.utils.kinematics.classical_kinematics_cm(mass_target, mass_projectile, Ecm, Zz=0)[source]¶
Compute non-relativistic kinematics from a center-of-mass energy.
- Parameters:
- Return type:
- Returns:
A populated
ChannelKinematicsinstance.
- jitr.utils.kinematics.cm_to_lab_frame(angles_cm_deg, ma, mb, mc, md, E, Q)[source]¶
Convert center-of-mass angles to laboratory angles.
- Parameters:
- Return type:
- Returns:
A NumPy array of laboratory-frame angles in degrees.
- jitr.utils.kinematics.lab_to_cm_frame(angles_lab_deg, ma, mb, mc, md, E, Q)[source]¶
Convert laboratory angles to center-of-mass angles.
- Parameters:
- Return type:
- Returns:
A NumPy array of center-of-mass angles in degrees.
General-purpose numerical helpers used across jitr.
- jitr.utils.utils.block(matrix, block_index, block_size)[source]¶
Extract a sub-block from a block-structured matrix.
- jitr.utils.utils.second_derivative_op(s, channel, interaction, args=())[source]¶
Evaluate the scaled radial Schrödinger operator.
- jitr.utils.utils.schrodinger_eqn_ivp_order1(s, y, channel, interaction, args=())[source]¶
Convert the radial Schrödinger equation to a first-order system.
- jitr.utils.utils.smatrix(Rl, a, l, eta)[source]¶
Compute an S-matrix element from a channel R-matrix value.
- jitr.utils.utils.eval_scaled_interaction(s, interaction, ch, args)[source]¶
Evaluate a local interaction in dimensionless coordinates.
- jitr.utils.utils.eval_scaled_nonlocal_interaction(s, sp, interaction, ch, args)[source]¶
Evaluate a nonlocal interaction in dimensionless coordinates.
- jitr.utils.utils.interaction_range(A, rA=1.2, r0=0.0)[source]¶
Estimate an interaction radius in femtometers.
- jitr.utils.utils.suggested_dimensionless_channel_radius(interaction_range, k)[source]¶
Suggest a dimensionless channel radius for a given interaction range.
The estimate leaves roughly one asymptotic wavelength beyond the interaction region.
- jitr.utils.utils.suggested_basis_size(a, zeros_per_node=5)[source]¶
Suggest an R-matrix basis size for a dimensionless channel radius.
Mass-table accessors and simple derived nuclear-mass observables.
- jitr.utils.mass.init_mass_db()[source]¶
Load the packaged mass tables into memory if needed.
- Return type:
- jitr.utils.mass.mass_excess(A, Z, model='ame2020')[source]¶
Return the mass excess and uncertainty in MeV.
The uncertainty is
Nonewhen the mass table does not include an uncertainty for the requested model, or when the nuclide is not found.
- jitr.utils.mass.binding_energy(A, Z, **kwargs)[source]¶
Return the total binding energy and uncertainty in MeV.
- jitr.utils.mass.neutron_separation_energy(A, Z, **kwargs)[source]¶
Return the one-neutron separation energy and uncertainty in MeV.
- jitr.utils.mass.proton_separation_energy(A, Z, **kwargs)[source]¶
Return the one-proton separation energy and uncertainty in MeV.
- jitr.utils.mass.neutron_fermi_energy(A, Z, **kwargs)[source]¶
Return the neutron Fermi-energy estimate and uncertainty in MeV.
- jitr.utils.mass.proton_fermi_energy(A, Z, **kwargs)[source]¶
Return the proton Fermi-energy estimate and uncertainty in MeV.
Evaluate low-order polynomials and their derivatives.
- jitr.utils.poly.poly1d(x, coeffs, start_i=0)[source]¶
Evaluate a one-dimensional polynomial in ascending-power form.
- Parameters:
- Return type:
- Returns:
Polynomial values evaluated at
x.
- jitr.utils.poly.poly2d(x, y, coeffs, start_i=0, start_j=0)[source]¶
Evaluate a two-dimensional polynomial in ascending-power form.
- Parameters:
x (
float|TypeAliasType) – First evaluation coordinate or coordinates.y (
float|TypeAliasType) – Second evaluation coordinate or coordinates.coeffs (
TypeAliasType) – Coefficient matrix wherecoeffs[i, j]multipliesx ** (start_i + i) * y ** (start_j + j).start_i (
int) – Lowest power represented along thexaxis.start_j (
int) – Lowest power represented along theyaxis.
- Return type:
- Returns:
Polynomial values evaluated on the paired
xandyinputs.
- jitr.utils.poly.poly1d_deriv(coeffs, start_i=0)[source]¶
Differentiate a one-dimensional ascending-power polynomial.
- Parameters:
coeffs (
TypeAliasType) – Polynomial coefficients wherecoeffs[i]multipliesx ** (start_i + i).start_i (
int) – Lowest polynomial power represented bycoeffs.
- Return type:
- Returns:
Tuple of derivative coefficients and the new lowest represented power.
- jitr.utils.poly.poly2d_deriv(coeffs, start_i=0, start_j=0, wrt='y')[source]¶
Differentiate a two-dimensional ascending-power polynomial.
- Parameters:
coeffs (
TypeAliasType) – Coefficient matrix wherecoeffs[i, j]multipliesx ** (start_i + i) * y ** (start_j + j).start_i (
int) – Lowest power represented along thexaxis.start_j (
int) – Lowest power represented along theyaxis.wrt (
str) – Coordinate to differentiate with respect to, either"x"or"y".
- Return type:
- Returns:
Tuple of derivative coefficients and the new
start_i/start_jvalues suitable for passing back intopoly2d().- Raises:
ValueError – If
wrtis not"x"or"y".