real_shells

Function real_shells 

Source
pub(super) fn real_shells(
    lattice: &BlochLattice,
    k: Complex,
    eta: Complex,
) -> i32
Expand description

Cube shells the real-space sum may visit.

§Formula

The terms fall like exp(Re(1 / (2 eta^2)) - Re((k eta)^2) |R|^2 / 2) from the nearest ones, below exp(-50) beyond |R| = sqrt(2 (50 + Re(1 / (2 eta^2))) / Re((k eta)^2)). Splits with |k eta| well below the automatic one need more than the fixed limit to reach it.

§Why

Where (k eta)^2 lies more than 45 degrees off the real axis (Re((k eta)^2) < |Im((k eta)^2)|), the phase of the terms turns faster than they fall, and their far shells cancel. There only 1D and 2D sums at small splits, which check the cancellation of their parts, take the grown limit.

Calibrated: with the grown limit, 3D sums take up to 20 s, and a 1D cylindrical sum above the automatic splits comes back 2e-5 of max(|S|, 1) off.