Repository navigation
Feature: rVV10 nonlocal correlation implemented natively (replaces #8140) - #8520
Open
CleverPhysician wants to merge 8 commits into
Open
CleverPhysician wants to merge 8 commits into
CleverPhysician wants to merge 8 commits into
Conversation
deepmodeling#8140 added rVV10 through libvdwxc; the maintainers decided against taking the extra dependency, so the correction moves into ABACUS itself. This commit carries over everything that is independent of the library -- the INPUT parameters, the hooks in every XC evaluator and in stress_gga, the adapter that forms the total density and its gradient, the unit tests and the three Autotest cases -- and replaces the library call by the interface of the native kernel in rvv10_kernel.h. The slab exchange is gone: the native kernel works on the plane distribution of the ABACUS grid. rvv10_kernel.cpp is not part of this commit yet.
The nonlocal correlation is evaluated with the Roman-Perez--Soler expansion: the density is projected on a logarithmic mesh of the local variable q with a cardinal cubic-spline basis, each channel is convolved with the tabulated reduced kernel in reciprocal space, and the result is contracted back. The kernel table is built from the published analytic kernel at run time, so no generated data file enters the repository and the build takes no new dependency. Every formula carries the section of the reference note it comes from. The table exploits that the rVV10 denominator factorizes as 2 (1+q R^2)(1+q' R^2) (1+((q+q')/2) R^2) and that the product of the three reciprocals is the triangular-weight average of (1+Q R^2)^-3 over [q, q'], so one accurate radial transform serves every node pair. The unit tests replace the former external-library reference by an analytic single-mode benchmark and a parameter-and-total-density check; the five contract tests (potential and stress against finite differences, every XC path, distributed against complete grid, left-handed cell) are unchanged.
The native kernel removed the preprocessor guard of the former optional dependency, so every target that compiles an XC evaluator had to resolve vdw::add_rvv10. The focused tests in module_xc/test and module_surchem/test construct a PW_Basis by hand and link neither the plane-wave basis nor module_base, so linking the correction there would pull its whole closure into tests that do not exercise it. The hooks become empty inline functions without __RVV10, which the production build always defines and those two test directories switch off.
The reduced radial transform has an elementary closed form, int_0^inf u^2 j0(z u) (1+u^2)^-3 du = pi (1+z) exp(-z) / 16, obtained by differentiating int_0^inf u sin(a u)/(u^2+s) du = pi/2 exp(-a sqrt(s)) twice with respect to s. Use it instead of a Simpson quadrature, which removes the radial cutoff, the radial grid size and both tail tapers. Set the q lattice from a convergence scan on graphite and MoS2: 56 geometric nodes on [1e-3, 3] bohr^-2 stay within 0.007 meV/atom of 128 nodes. The upper end keeps q_c = 3 bohr^-2 (Obata et al., JPSJ 84, 024715, Table I); the lower end leaves room for larger b, since q scales as 1/b at fixed density.
…tice - Every channel is a real field: transform the channels on a gamma-only PW_Basis built from the density basis (same FFT grid, cutoff and real-space planes, rebuilt when the cell or the pool changes), real-to-complex. Plane waves off the kept plane count twice in the sums. Where the half sphere would leave a process without plane waves, the density basis itself is used. - Multiply each |G| shell by the kernel matrix with BlasConnector::gemm_cm on the (Re, Im) rows of a channel-major block, instead of a scalar pair loop. - Locate each density point on the q lattice once; evaluate the cardinal splines as Hermite cubics from the knot slopes of CubicSpline::build. - Build the kernel table once per process (it depends on the lattice only), one radial curve per node pair, so the lattice need not be geometric. - q lattice: ratio 1.157 on [5e-3, 0.3] bohr^-2, widening outwards to 1e-3 and q_c = 3; 38 nodes give the accuracy of the previous 56. - Regenerate the three rVV10 references. With the previous 56-node lattice the restructured code reproduces the previous total energies to 1e-11 eV (graphite, MoS2, S22 ammonia and benzene dimers).
PW_Basis_Big hands out z planes in blocks of bz, so the half-sphere basis must use the same bx/by/bz; otherwise its real-space planes differ from the caller's and rVV10 silently falls back to the full sphere (the LCAO case). The half sphere is now always a PW_Basis_Big, with blocks of one for a plain PW_Basis (which distributes planes the same way), held as one static object that is set up again when the key changes; the block sizes are part of that key. The checks are split into small functions. A new unit test forces the full-sphere path and checks that energy, potential coefficients and stress agree with the half-sphere path to rounding.
CleverPhysician
force-pushed
the
rvv10-native
branch
from
December 5, 2026 13:55
a0547d6 to
9998eec
Compare
The references were generated with cg, the PW default before deepmodeling#8507. With dav_subspace the two-atom spin-polarized GaAs case reaches a different SCF solution, so both cases keep cg like the other pinned 01_PW cases.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds the rVV10 nonlocal correlation (
vdw_method rvv10) as a native implementation. It replaces #8140, which evaluated rVV10 through libvdwxc: no external library and no tabulated data file are needed.Linked Issue
Replaces #8140.
What's changed?
vdw_method rvv10with parametersrvv10_b(default 6.3) andrvv10_c(default 0.0093). Energy, potential, forces and stress are available for PW and LCAO. DFPT and LR-TDDFT forces are rejected at input.module_vdw/rvv10_kernel.cpp: Román-Pérez–Soler interpolation of the kernel on 38 q points. The kernel table is generated at start-up (0.12 s) from a closed-form radial transform; the convolution runs on the density FFT grid.module_vdw/nonlocal_xc.cpp: adds the rVV10 potential to every XC evaluator and its stress tostress_gga.docs/advanced/scf/advanced.md, references indocs/CITATIONS.md.Unit Tests and/or Case Tests for my changes
MODULE_HAMILT_nonlocal_xcTeston 1, 2 and 4 ranks and 2 ranks × 2 threads: potential and stress against finite differences, distributed against serial, nspin 1/2/4.215_PW_rvv10_GaAs,216_PW_rvv10_graphiteandrelax_cell_rvv10.Governance Exception
__RVV10is always on; the focused XC unit tests inmodule_xc/testandmodule_surchem/testdo not link the plane-wave library, so they switch it off and use empty hooks.