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 + Gof one reciprocal summand and its shared arguments.
Constantsยง
- NEAR_
THRESHOLD ๐ - Largest moduli of the real and imaginary parts of
q . q / k^2 - 1of the zeroth diffraction order at which the reciprocal sums takecompensated_threshold_distance: there the rounded form loses 50 ulps ofvor more (about 3 ulps ofq . q / k^2over 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 phasee^(-i pi n)of the lower side. - compensated_
threshold_ ๐distance q . q - k^2of a diffraction order to a few ulps of itself, from exact products and compensated additions: next to a threshold the roundedq . q / k^2 - 1loses abouteps k^2 / |k_q^2|of it. Only the zeroth order of an unreduced Bloch vector takes it (withinNEAR_THRESHOLD): every otherqcarries 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 withdF_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 ordersn = 0..=ordersof one reciprocal point with the degree polynomialsP(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_lnof the 1D cylindrical summand ofreciprocal_term(upstream_s_sum_cw1d, whose docstring formula omits the factorl!that its code includes) forl = |m|, withy = k r_y(-k r_yfor negativem) andbeta = q_x / k:sum_s (-y)^(2n - s) beta^(l - s) l! / (2^s (2n - s)! (l - s)! (s - n)!)overs = n..=min(2n, l). - polynomial_
sw1d ๐ - The inner sum
S_lmnof the 1D spherical summand ofreciprocal_term(upstream_s_sum_sw1dtimes(-1)^m e^(i m phi)), withrho2 = (k rho)^2,beta = q_z / kand the azimuthphiof 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)!)overs = n..=min(2n - |m|, l)with evens - |m|. - polynomial_
sw2d ๐ - The inner sum
S_lmnof the 2D spherical summand ofreciprocal_term(upstream_s_sum_sw2dtimese^(i m phi)), withz = k r_z,beta^2 = beta2andbeta 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)!)overs = n..=min(l - |m|, 2n)with evenl - |m| - s. - reciprocal_
term ๐ - One reciprocal summand
T(q)of the sum, without the Bloch phaseexp(-i q . r)that the caller multiplies in. Every sum shares the argumentv = (q . q / k^2 - 1) / (2 eta^2);waveanddimselect the sum. 1D spherical sums, whose odd Kambe orders cancel by up toe^(w^2)atw = k rho eta, add the rounding bounds of its value and derivatives in units of epsilon tobound; 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. Upstreamzero2d(cylindrical) andzero3d(spherical) give its value at degree and order zero. Keeping its first-order polynomial gives the regular image-sum derivative at self.