Module reciprocal

Module reciprocal 

Source
Expand description

Reciprocal-space terms of the five sums (family and lattice dimension: sw3d, sw2d, sw1d, cw2d, cw1d) and the self term.

Upstream: recsum*, _recsw*, _reccw*, _n_sum_*, _s_sum_*, zero2d and zero3d of lattice/_esum.pyx. The compensated threshold distance and the outgoing sheets are treams-rs extensions.

Structsยง

Compensated ๐Ÿ”’
A sum of products that keeps the rounding errors of its products and additions apart until the end.
Diffraction ๐Ÿ”’
The wavevector q = kpar + G of one reciprocal summand and its shared arguments.

Constantsยง

NEAR_THRESHOLD ๐Ÿ”’
Largest moduli of the real and imaginary parts of q . q / k^2 - 1 of the zeroth diffraction order at which the reciprocal sums take compensated_threshold_distance: there the rounded form loses 50 ulps of v or more (about 3 ulps of q . q / k^2 over the difference).
THRESHOLD_DISTANCE ๐Ÿ”’
Largest |v| (for the reciprocal terms) or |k_q^2 / k^2| (for the spectral series) at which a diffraction order counts as on its threshold |q| = k, where the sums are singular.

Functionsยง

axial_cylindrical_reciprocal ๐Ÿ”’
The reciprocal term of a value-only 1D cylindrical sum on its axis, which needs half of the polynomial terms: adjacent half-integer gamma functions share one evaluation, recurring downward near zero and upward at large arguments, where a downward step would subtract the leading asymptotic term. On a sheet (reduced_gamma) the endpoint term takes the phase e^(-i pi n) of the lower side.
compensated_threshold_distance ๐Ÿ”’
q . q - k^2 of a diffraction order to a few ulps of itself, from exact products and compensated additions: next to a threshold the rounded q . q / k^2 - 1 loses about eps k^2 / |k_q^2| of it. Only the zeroth order of an unreduced Bloch vector takes it (within NEAR_THRESHOLD): every other q carries the rounding of its reciprocal vector, as large as the rounding this removes.
exponential_kernel ๐Ÿ”’
F_1(v) = Gamma(1, v) / (-v) = exp(-v) / (-v) of the 3D spherical and 2D cylindrical reciprocal sums, in closed form with dF_1/dv = F_2 = (1 + v) exp(-v) / v^2.
half_integer_orders ๐Ÿ”’
sum_n factor (2 eta^2)^n F_(1/2 - n) P(n) over the half-integer orders n = 0..=orders of one reciprocal point with the degree polynomials P (zero ones skipped). Below every automatic split the orders weigh their terms, and are summed again from the single Kambe integrals where those bound the sum more tightly (Reduced::prefers_single).
polynomial_cw1d ๐Ÿ”’
The inner sum S_ln of the 1D cylindrical summand of reciprocal_term (upstream _s_sum_cw1d, whose docstring formula omits the factor l! that its code includes) for l = |m|, with y = k r_y (-k r_y for negative m) and beta = q_x / k: sum_s (-y)^(2n - s) beta^(l - s) l! / (2^s (2n - s)! (l - s)! (s - n)!) over s = n..=min(2n, l).
polynomial_sw1d ๐Ÿ”’
The inner sum S_lmn of the 1D spherical summand of reciprocal_term (upstream _s_sum_sw1d times (-1)^m e^(i m phi)), with rho2 = (k rho)^2, beta = q_z / k and the azimuth phi of the shift: sum_s (k rho)^(2n - s) beta^(l - s) (-1)^m e^(i m phi) / ((n - (s + |m|) / 2)! (n - (s - |m|) / 2)! (l - s)! (s - n)!) over s = n..=min(2n - |m|, l) with even s - |m|.
polynomial_sw2d ๐Ÿ”’
The inner sum S_lmn of the 2D spherical summand of reciprocal_term (upstream _s_sum_sw2d times e^(i m phi)), with z = k r_z, beta^2 = beta2 and beta e^(i phi) = (q_x + i q_y) / k: sum_s (-z)^(2n - s) beta^(l - s) e^(i m phi) / ((2n - s)! (s - n)! ((l + |m| - s) / 2)! ((l - |m| - s) / 2)!) over s = n..=min(l - |m|, 2n) with even l - |m| - s.
reciprocal_term ๐Ÿ”’
One reciprocal summand T(q) of the sum, without the Bloch phase exp(-i q . r) that the caller multiplies in. Every sum shares the argument v = (q . q / k^2 - 1) / (2 eta^2); wave and dim select the sum. 1D spherical sums, whose odd Kambe orders cancel by up to e^(w^2) at w = k rho eta, add the rounding bounds of its value and derivatives in units of epsilon to bound; the other sums keep their relative accuracy.
self_term ๐Ÿ”’
The self term: the Cartesian Taylor term of real_Ewald(-r) - outgoing(-r) at the origin. Upstream zero2d (cylindrical) and zero3d (spherical) give its value at degree and order zero. Keeping its first-order polynomial gives the regular image-sum derivative at self.