xnn.common.models.dispersion_fast.eeq#
The large-regime EEQ operator, evaluated without trigonometry in the solver loop.
EEQSystem applies the Ewald reciprocal sum
through structure factors cos(G . r_i), sin(G . r_i) of shape (N,
N_G). Above SF_BUDGET they are recomputed at
every matrix-vector product, which is 85-90% of a D4 step at 12-24k atoms (2e9
sines and cosines per product at 24k atoms). FastEEQSystem computes the
same operator another way:
Factorized phases. With
G = m_1 b_1 + m_2 b_2 + m_3 b_3andtheta_k = b_k . r,exp(i G . r) = exp(i (m_1 theta_1 + m_2 theta_2)) exp(i m_3 theta_3). The reciprocal vectors are grouped into columns of fixed(m_1, m_2), and the two factors are tabulated once per system:B (C, N)over the columns andP (N, 2 M_3 + 1)overm_3.A_rec vis then two complex matrix products (S = B (v P), the structure factor ofvon every column, andB^H (g S)back onto the atoms) and no trigonometry.Gand-Gcontribute equally, so only half of the set is kept, with twice the weight. The tables are formed in float64 from float64 phases, so in float32 they are more accurate than the reference’s float32 phases.Real space. The screened kernel of the neighbor list becomes a sparse CSR matrix (images of the same pair merged), applied with one sparse matrix product.
Solves. The charge solve and the constraint solve
A y = 1run in lockstep as two right-hand sides of one conjugate-gradient loop. The residual correction ofeeq_charges_large(), which is zero at convergence, stops at the charge solve’s tolerance instead of converging its own (tiny) right-hand side again.Implicit differentiation. The differentiable application of
A(r)uses the same factorization on live positions and cell, in column blocks that are recomputed in the backward pass.
The operator is the same matrix, so the charges agree with the reference solve to the solver tolerance.
Module Attributes
atoms up to which the fast system factorizes the assembled matrix; conjugate gradients above (the reference switches at 12000 atoms) |
|
complex entries of the |
|
complex entries per column block of the differentiable reciprocal sum |
|
the reference's 100 machine epsilons (1.2e-5) leave about 3e-5 e in the charges of a 5k-atom box, where its refined LU solve reaches 2e-6 e; 1e-6 matches that at a few more iterations (EEQReuse uses the same value) |
|
reciprocal vectors (smallest |
Classes
|
|