xnn.common.models.eeq.EEQSystem#
- class xnn.common.models.eeq.EEQSystem(diag, rad, pos, edge_index=None, edge_vec=None, alpha=0.0, gvec=None, gfac=None, grid=None, solver='auto', reuse=None, signature=None)[source]#
Bases:
objectThe EEQ linear system of one structure as a constant, matrix-free operator.
Built from detached geometry: it is the fixed Jacobian of the implicit differentiation.
apply_differentiable()re-evaluates the same operator on live tensors for the residual.- Parameters:
diag (Tensor) – Diagonal
J_A + sqrt(2/pi) / a_A(periodic:- 2 alpha / sqrt(pi)),(N,).rad (Tensor) – EEQ charge widths
a_Ain bohr,(N,).pos (Tensor) – Positions in bohr,
(N, 3); molecular kernel and structure factors.edge_index (Tensor or None) – Directed neighbor list within the real-space cutoff (periodic case),
(2, E)and(E, 3)in bohr;Nonefor a molecule.edge_vec (Tensor or None) – Directed neighbor list within the real-space cutoff (periodic case),
(2, E)and(E, 3)in bohr;Nonefor a molecule.alpha (float) – Ewald splitting parameter (periodic case), 0 for a molecule.
gvec (Tensor or None) – Reciprocal vectors
(N_G, 3), weights(N_G,)and their integer triples (periodic), fromreciprocal_vectors().gfac (Tensor or None) – Reciprocal vectors
(N_G, 3), weights(N_G,)and their integer triples (periodic), fromreciprocal_vectors().grid (Tensor or None) – Reciprocal vectors
(N_G, 3), weights(N_G,)and their integer triples (periodic), fromreciprocal_vectors().solver (str) –
"auto"(LU up toLU_MAX_ATOMS, else CG),"lu"or"cg".reuse (EEQReuse or None) – Carry the solve over from the previous structure of an MD run or optimization (
EEQReuse);solveris then only the fallback.signature (tuple or None) – Hashable identity of the system (atom count and elements) that
EEQReusecompares before reusing its state.
- keep_structure_factors = True#
keep the
(N, N_G)cos / sin tables when they fit inSF_BUDGET(a subclass with its own reciprocal sum turns this off)
- assemble()[source]#
The dense
(N, N)matrix of the operator (for the LU path and tests).- Return type:
- 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=1e-12, maxiter=1000)[source]#
Jacobi-preconditioned CG for
A y = b(Asymmetric positive definite).