From d6023c7bbb459c4e2810cae76ab806b24d47898d Mon Sep 17 00:00:00 2001 From: Jon Drobny Date: Fri, 28 Aug 2026 14:30:09 -0700 Subject: [PATCH 1/2] rcpr minor changes --- src/bca.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/bca.rs b/src/bca.rs index 0b648e2..22befec 100644 --- a/src/bca.rs +++ b/src/bca.rs @@ -1,6 +1,7 @@ use super::*; use rand::RngExt; + #[cfg(feature = "cpr_rootfinder")] const CPR_ROOTFINDER_LOWER_BOUND: f64 = 1e-4; @@ -17,6 +18,8 @@ use rcpr::rootfinders::{ real_polynomial_roots, Config }; +#[cfg(feature = "cpr_rootfinder")] +use rcpr::chebyshev::ErrorCalc; /// Geometrical quantities of binary collision. pub struct BinaryCollisionGeometry { @@ -606,8 +609,6 @@ fn transform(x: f64, l: f64) -> f64 { l/(x*PI/2.).tan().powi(2) } - - #[cfg(feature = "cpr_rootfinder")] /// Computes the distance of closest approach of two particles with atomic numbers `Za`, `Zb` and masses `Ma`, `Mb` for an arbitrary interaction potential (e.g., Morse) for a given impact parameter and incident energy `E0` using the Chebyshev-Proxy Root-Finder method. /// @@ -655,7 +656,8 @@ pub fn cpr_rootfinder(Za: f64, Zb: f64, Ma: f64, Mb: f64, E0: f64, impact_parame nmax, complex_threshold, far_from_zero, - interval_limit + interval_limit, + ErrorCalc::Relative, ); let roots = find_roots(&g, vec![(lower_bound, upper_bound)], config)?; From a4e684242ea3b83b7db6841857342c7a8cf25b78 Mon Sep 17 00:00:00 2001 From: Jon Drobny Date: Wed, 2 Sep 2026 10:06:12 -0700 Subject: [PATCH 2/2] remove unused option from scat. int. morse func in librustbca --- src/lib.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index d296b7c..71d08ac 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2175,8 +2175,8 @@ fn scattering_integrals(Za: f64, Zb: f64, Ma: f64, Mb: f64, E0: f64, p: f64, n_g #[cfg(feature = "python")] #[pyfunction] -#[pyo3(signature = (Za, Zb, Ma, Mb, E0, p, d, alpha, r0, n0=2, nmax=64, epsilon=1e-6, complex_threshold=0.0, far_from_zero=1e22, interval_limit=1e-3, n_gl_points=100, interaction_potential="KR_C"))] -fn scattering_integral_morse(Za: f64, Zb: f64, Ma: f64, Mb: f64, E0: f64, p: f64, d: f64, alpha: f64, r0: f64, n0: usize, nmax: usize, epsilon: f64, complex_threshold: f64, far_from_zero: f64, interval_limit: f64, n_gl_points: usize, interaction_potential: &str) -> PyResult<(f64, f64, f64)> { +#[pyo3(signature = (Za, Zb, Ma, Mb, E0, p, d, alpha, r0, n0=2, nmax=64, epsilon=1e-6, complex_threshold=0.0, far_from_zero=1e22, interval_limit=1e-3, n_gl_points=100))] +fn scattering_integral_morse(Za: f64, Zb: f64, Ma: f64, Mb: f64, E0: f64, p: f64, d: f64, alpha: f64, r0: f64, n0: usize, nmax: usize, epsilon: f64, complex_threshold: f64, far_from_zero: f64, interval_limit: f64, n_gl_points: usize) -> PyResult<(f64, f64, f64)> { let E0 = E0*EV; let p = p*ANGSTROM; let d = d*EV; @@ -2199,7 +2199,6 @@ fn scattering_integral_morse(Za: f64, Zb: f64, Ma: f64, Mb: f64, E0: f64, p: f64 let theta_gm = bca::gauss_mehler(Za, Zb, Ma, Mb, E0, p, x0, screening_length, potential, n_gl_points); let theta_gl = bca::gauss_legendre(Za, Zb, Ma, Mb, E0, p, x0, screening_length, potential); - Ok((x0, theta_gm, theta_gl)) }