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. Co-Authored-By: Claude Opus 5 <[email protected]>
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. Co-Authored-By: Claude Opus 5 <[email protected]>
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. Co-Authored-By: Claude Opus 5 <[email protected]>
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. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…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). Co-Authored-By: Claude Opus 5.5 <[email protected]>
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. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Resolve tests/01_PW/CASES_CPU.txt: keep both appended cases (dfpt_si_g_symm from develop, 215_PW_rvv10_GaAs from this branch).
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.
What's changed?
This PR adds rVV10 nonlocal correlation to PW and LCAO calculations. The kernel runs on the existing ABACUS charge-density grid and uses the plane-wave FFT and BLAS routines. It contributes to the XC energy and potential during self-consistency and to the stress when requested. No additional library or kernel data file is needed.
For rPW86-PBE with rVV10, use the following in
INPUT(the semilocal functional in this example needs Libxc):The defaults are
rvv10_b = 6.3andrvv10_c = 0.0093. Setrvv10_bexplicitly for SCAN (15.7) or r2SCAN (11.95). The rVV10 response kernel for DFPT and LR-TDDFT forces is outside the scope of this PR.Unit Tests and/or Case Tests for my changes
MODULE_HAMILT_nonlocal_xcTestpassed on 1, 2 and 4 MPI ranks, and on 2 ranks with 2 OpenMP threads. It checks the kernel against an analytic Fourier mode, the potential and stress against finite differences of the energy, and the distributed grid against a complete grid.215_PW_rvv10_GaAs, native PBE) passed on 4 ranks withAutotest.sh. The PW graphite and LCAO cell-relaxation cases passed withctest -R '01_PW_libxc|03_NAO_multik_libxc'.ks_solver genelpa. GPU, USPP, rt-TDDFT and DeePKS runs with rVV10 were not tested.Linked Issue
Related to #6277 (r2SCAN+rVV10).
Build note for reviewers
Governance Exception
__RVV10lets the standalone XC and surchem tests use their lightweight plane-wave fixtures.