xnn.common.models.dispersion_fast.eeq.FastEEQSystem#
- class xnn.common.models.dispersion_fast.eeq.FastEEQSystem(diag, rad, pos, edge_index=None, edge_vec=None, alpha=0.0, gvec=None, gfac=None, grid=None, solver='auto', reuse=None, signature=None, cell=None)[source]#
Bases:
EEQSystemEEQSystemwith the fast operator and solves.Takes the arguments of the reference class plus the lattice
cell(3, 3)in bohr (periodic case), from which the phase tables are built. Right-hand sides may be(N,)or(N, K).Preconditioner: the long-range Coulomb modes (the smallest reciprocal vectors, whose weights
g ~ 1/G^2are the largest) are what a Jacobi preconditioner leaves untouched and what slows the conjugate gradients. The periodic system therefore usesM = D + U W U^T:U = [cos, sin]of theLOW_K_VECTORSsmallest vectors,Wtheir weights, andDthe full diagonal ofAwithout that part;M^-1is applied through the Woodbury identity (one2L x 2LCholesky factor per structure, twoN x 2Lproducts per iteration). A preconditioner only changes how fast the iteration converges, not what it converges to.- Parameters:
- keep_structure_factors = False#
keep the
(N, N_G)cos / sin tables when they fit inSF_BUDGET(a subclass with its own reciprocal sum turns this off)
- precondition(r)[source]#
M^-1 rforrof shape(N,)or(N, K): the matrix-free preconditionerEEQReuseuses for large systems in place of a dense inverse.
- solve_augmented(b_top, b_bot, role='charges')[source]#
Solve
[[A, 1], [1^T, 0]] [y; mu] = [b_top; b_bot]; returns(y, mu).rolenames the solve of the step:"charges","residual"(the correction ofeeq_charges_large()) or"adjoint"(the backward pass);EEQReusekeeps a separate history per role.
- conjugate_gradient(b, tol=None, maxiter=1000, atol=None)[source]#
Preconditioned CG for
A Y = B, the columns ofBin lockstep.Each column stops at
|r| <= tol |b|(or|r| <= atol); a finished column takes no further steps while the others converge.toldefaults toCG_TOLin float64 andCG_TOL_FLOAT32in float32.