xnn.common.models.pme.least_squares_moduli#
- xnn.common.models.pme.least_squares_moduli(size, order, dtype, device, n_alias=50)[source]#
|b(m)|^2of the least-squares spline fit along one mesh axis.The particle-mesh sum replaces
exp(2 pi i m u / K)byb(m) sum_k M_p(u - k) exp(2 pi i m k / K). The Euler exponential spline (bspline_moduli()) choosesb(m)to make the two equal at the mesh points; hereb(m)minimises the mean squared difference overu. Withs_j = |sinc(m / K + j)|^pthe amplitudes of the spline sum at the aliased frequenciesm + j K, that is|b(m)|^2 = s_0^2 / (sum_j s_j^2)^2. Both choices agree atm = 0and as the mesh is refined; at a coarse mesh the least-squares one leaves a far smaller mean self-interaction error in the energies. For an odd order on an even mesh the Nyquist frequency, where the spline sum of an odd order vanishes at the mesh points, carries no weight.