Repository navigation
feat(xc): add libvdwxc-backed rVV10 nonlocal XC - #8140
CleverPhysician wants to merge 55 commits into
Conversation
|
Update after the hosted checks completed:
The PR remains Draft while the maintainer confirms the staged CPU/serial/nspin=1 scope and while the QE same-density reference comparison (including gradient/divergence sign and normalization) is completed. libvdwxc MR !32 is still a Draft dependency, so I am not presenting it as a stable release. |
Could you provide the detailed information? Another side note: libvdwxc currently requires FFTW-MPI wrapper when MPI is enabled, so be careful with MKL; for now you can consider adding a |
ABACUS-PR-BOT
left a comment
There was a problem hiding this comment.
Static review of 32e12de74c07d2307a90c695dac6f8e452f592e5, independently cross-checked against the pinned libvdwxc implementation. Two geometry issues and one nonblocking timer-label cleanup are noted inline. No builds or runtime tests were run.
|
Follow-up on head
The PR remains Draft while the new head's hosted checks are queued and the QE same-density reference is discussed. |
|
Addressed the ABACUS-PR-BOT static review on head
The intern004 adapter CTest is 1/1 after these changes, and the Si CPU/PW/nspin=1 SCF remains numerically unchanged. The PR stays Draft pending the hosted checks for the new head and maintainer review. |
| if(NOT TARGET libvdwxc::vdwxc) | ||
| message(FATAL_ERROR | ||
| "ENABLE_LIBVDWXC requires the libvdwxc::vdwxc CMake target. " | ||
| "Use the libvdwxc development build that includes the rVV10 API.") | ||
| endif() |
There was a problem hiding this comment.
That shouldn't be needed as libvdwxc's CMake config will definitely have libvdwxc::vdwxc target. Previously I did this in abacus for RapidJSON due to its embarrassing release status, but with it replaced by nlohmann-json there's no longer the case. If abacus can deal with items like dftd4 and pexsi well then the same for libvdwxc (its cmake is cleaner). If you really encountered issues please report them.
There was a problem hiding this comment.
Agreed. c23f000 removes the if(NOT TARGET libvdwxc::vdwxc) check; ABACUS now relies on find_package(libvdwxc CONFIG REQUIRED) and links the exported libvdwxc::vdwxc target through _abacus_feature_libs, alongside Libxc::xc.
|
Thanks for asking. I reran the unchanged libvdwxc revision Both builds used GCC 11.2.1, Release ( With
The original MKL executable reproduces exactly the same values under a clean environment with no env -i PATH=/usr/bin:/bin LANG=C LC_ALL=C OMP_NUM_THREADS=1 MKL_NUM_THREADS=1 \
/tmp/libvdwxc-mr32-audit/build-audit/libvdwxc_rvv10_testSelecting Both configurations pass the separate CP2K-table reference comparisons in that test: energy, density/sigma derivatives, and explicit stress on a The current evidence therefore isolates the discrepancy to this MKL backend configuration. The underlying cause has not been established. Updated head This update also removes the manual CMake target/header/API checks and uses |
|
Ah OK, I can now reproduce the failure with oneMKL 2026.1.0. I will have a look into it. |
@CleverPhysician This should be fixed on libvdwxc side, please check |
|
Follow-up on
The earlier 18 successful hosted checks apply to |
|
Thanks, checked the fix at The new adapter has now also been compared against the immutable original-QE |
The Rvv10Workspace::evaluate timer separates libvdwxc and the plane exchange from the density and potential work of vdw::add_rvv10, so the timer table shows where rVV10 spends its time. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Rvv10Workspace: function-local static instead of a leaked heap object, non-copyable; prepare split into same_grid/set_cell/rebuild; the FFTW-MPI slab bounds come from one helper; evaluate takes XCFunctionalParameters and skips the dE/dn exchange in the stress path, which never reads it - add_rvv10 and add_rvv10_stress share the density and libvdwxc preamble - the workspace buffers are reported to ModuleBase::Memory - ScopedType::restore swaps the whole XCFunctionalParameters struct, so a new parameter cannot be forgotten there - easy_install.md lists libvdwxc among the CMAKE_PREFIX_PATH packages Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…air vdw_rvv10_b with the functional - MatchesDirectLibvdwxc checks the four-component layout: energy and vtxc of the total density, potential in v(0) only - BigGridDistributionMatchesCompleteGrid runs the adapter on a PW_Basis_Big with bz = 4 (the LCAO density grid), where a process may own no plane - VxcAddsRvv10ToEveryFunctionalPath also covers the gga_grad 0 noncollinear branches of v_xc and v_xc_libxc and the libxc local collinear map - vdw_rvv10_b, when not given, follows dft_functional: 15.7 for SCAN, 11.95 for r2SCAN, 6.3 otherwise with a warning unless rPW86-PBE; read_input_test checks the four cases Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
With one spin channel, v_xc_libxc and v_xc_meta already hold the plane-wave gradient of the total density. They now hand it to add_rvv10, which saves the adapter's own transform and gradient (four dense-grid FFTs per SCF call). The gradient is built the same way on both sides, so results are identical to the last bit; the unit test requires exact equality on these two paths. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The transposes, the density sum, sigma and the scaling of the gradient get the OpenMP pragmas that the neighbouring module_xc loops use. The two reductions (vtxc and the gradient term of the stress) stay serial, so the result does not depend on the thread count. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…esses take the same path In LCAO the density grid is shared by all processes in blocks of bz planes, and a process may hold no point at all. Its empty gradient has a null data pointer, which add_rvv10 took as "compute the gradient here": that process entered the collective transforms while the others went on to libvdwxc, and the run hung before the first SCF step. The overload now takes the vector itself; the unit test runs v_xc_libxc with rVV10 on the big-cell grid, where rank 3 of 4 is empty. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
- tests/01_PW/815_PW_rvv10_GaAs: zincblende GaAs with NLCC pseudopotentials, two spin channels, forces and stress, PBE through the native XC path - tests/03_NAO_multik/relax_cell_rvv10: one cell-relaxation step of SnTe in LCAO (the relax_cell_vdw4_d4 case with rVV10 instead of D4) Both are listed in CASES_LIBVDWXC.txt and registered under if(ENABLE_LIBVDWXC), so they run only when the library is built in. The references were generated with 4 MPI ranks. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
- assert the length of a handed-over gradient; schedule clauses on the transposes; comments on the workspace lifetime and the exchange plan - the warning for an unset vdw_rvv10_b says that the functional comes from the pseudopotential when dft_functional is default; docs follow the automatic pairing - unit tests: exact equality only for the point-wise potential (etxc and vtxc are OpenMP reductions of the caller), a 2-process/2-thread registration, 300 s timeouts because a collective mismatch shows as a hang, two more vdw_rvv10_b pairings in the input test Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
- tests/01_PW/216_PW_rvv10_graphite: AB graphite with ONCV carbon, rPW86-PBE through libxc (the path that hands its gradient to the rVV10 term), forces (one atom displaced) and stress - tests/01_PW/215_PW_rvv10_GaAs replaces 815_PW_rvv10_GaAs: Γ point and 60 Ry (8.5 s instead of 13 s), numbered with the other XC cases References generated with 4 MPI ranks and reproduced. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
- workspace lifetime comment says why data_ is left alone; the header speaks of all three functions; the test comment names the halved axis correctly - docs spell the dft_functional values that select b and say that rPW86-PBE gets no warning; the three test READMEs say how their references were made Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…end of life
- Rvv10Workspace moves to rvv10_workspace.{h,cpp} (declaration with Doxygen,
definitions apart); nonlocal_xc.cpp keeps the adapter functions
- the instance is created on first use and released by vdw::finalize_rvv10,
which ESolver_FP::after_all_runners calls before MPI_Finalize, instead of a
function-local static that was never finalized
- vdw::is_rvv10 holds the method name; ESolver_FP and make_vdw use it
- unit tests split into a fixture header with its helpers source and two test
sources, constants in lower case, a check that a released workspace is
rebuilt; 215_PW_rvv10_GaAs at 30 Ry; two-line test READMEs
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
@mohanchen I compared
An rVV10 call took 0.63 s on a 216³ grid with 32 ranks; about 0.55 s was spent inside libvdwxc. Across the timing cases, rVV10 accounted for 6–16 % of the wall time for S22 dimers in a 20 Å box, 9 % for four-atom graphite and below 1 % for 64-atom graphite. The 64-atom case used an additional 27–66 MB per rank across the measured rank counts. libvdwxc's buffers are distributed over the pool. I checked the DZP–PW binding-energy gap with counterpoise correction using the existing ghost-atom support. Each monomer calculation contains one graphene layer in a finite 20 Å periodic cell, with the other layer's orbitals at c/2 as ghost atoms. The binding-energy reference remains the bulk c = 20 Å cell. At c = 6.70 Å, the DZP correction is 5.15 meV/atom with rVV10 and 5.30 meV/atom without it. Across the 12 distances, correction reduces the maximum DZP–PW deviation from 9.02 to 1.91 meV/atom; the fitted c_eq values are 6.715 and 6.717 Å. For TZDP, the correction is 0.28 meV/atom at c = 6.70 Å and the corrected curve differs from PW by at most 0.53 meV/atom. These results support using larger orbitals or counterpoise correction for weak LCAO binding energies. The counterpoise comparisons use the default ABACUS FFT grid. For five graphite cells that grid is 27×27×75, versus 27×27×80 in QE. Matching QE's grid reduces the PW binding-energy deviation from 0.14 to 0.018 meV/atom; the c_eq = 6.686 Å result in the table uses this matched grid. Graphite E_b(c), meV/atom
2H-MoS2 E_b(c), meV/atom
S22, kcal/mol (monomers in the dimer geometry)
Stress, kbar
rVV10 part of the stress, analytic vs central differences of E (±0.5 % strain):
This update also reuses the libxc density gradient, adds OpenMP to element-wise loops and releases the libvdwxc workspace at the end of the run. In the five-case old/new regression, energies, forces and stresses agree within rounding. The added tests cover The latest commits ( |
… rVV10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
vdwxc_init_mpi takes the slab of each process from FFTW-MPI but did not report it, so the adapter assumed the FFTW-MPI default blocks of ceil(nz/P) planes. With a libvdwxc that provides vdwxc_get_local_grid, every process now asks for its slab when the workspace is built, the slabs are gathered over the pool with the new Parallel_Common::allgather_data and checked to cover the z axis in rank order, and the exchange is planned from them. CMake detects the function (LIBVDWXC_HAS_LOCAL_GRID); without it the previous rule is kept. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… tests after their sources
Following AGENTS.md:
- nonlocal_xc.h provides empty inline hooks without libvdwxc, so v_xc,
v_xc_libxc, v_xc_meta, stress_gga and ESolver_FP call them without
#ifdef __LIBVDWXC; the switch stays in module_vdw, as for DFT-D4.
- Rule 11: test_nonlocal_xc.cpp tests nonlocal_xc.cpp and the new
test_rvv10_workspace.cpp tests rvv10_workspace.cpp; the shared fixture
moves to nonlocal_xc_test_helpers.{h,cpp}, whose header includes only
what its declarations need.
- Rule 14: computed arguments are assigned to named locals first.
No change of results.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
|
||
| ```{important} | ||
| For some dependencies built with CMake, such as Libxc, dftd4, cereal, and nlohmann-json, you'll have to add their prefix paths to the environment variable `CMAKE_PREFIX_PATH` so that CMake can correctly find and use their CMake configuration files. A non-general variable such as `PKG_DIR` is discouraged for these packages. | ||
| For some dependencies built with CMake, such as Libxc, dftd4, libvdwxc, cereal, and nlohmann-json, you'll have to add their prefix paths to the environment variable `CMAKE_PREFIX_PATH` so that CMake can correctly find and use their CMake configuration files. A non-general variable such as `PKG_DIR` is discouraged for these packages. |
There was a problem hiding this comment.
What is this package used for?
There was a problem hiding this comment.
libvdwxc evaluates the rVV10 nonlocal correlation for vdw_method rvv10 (kernel, FFT convolution, energy, potential and stress). It is optional; that line now says so.
There was a problem hiding this comment.
... that line now says so.
Please leave the package description to where it should be. Here is simply a hint regarding CMake dependencies.
| #ifdef __MPI | ||
| #include <vdwxc_mpi.h> | ||
| #endif | ||
| #undef I |
There was a problem hiding this comment.
this line is strange, remove it if possible
There was a problem hiding this comment.
this line is strange, remove it if possible
Unfortunately, libvdwxc's public header pulls in <complex.h>, exposing the C99 macro I to subsequently included ABACUS headers. Therefore, #undef I is needed as a workaround. This is actually an upstream bug as the public libvdwxc API doesn't use any complex type...
There was a problem hiding this comment.
Thanks @Growl1234 for the explanation. I will drop the line once the libvdwxc header no longer includes <complex.h>.
| option(ENABLE_ABACUS_LIBM "Build libmath from source to speed up" OFF) | ||
| option(ENABLE_LIBXC "Enable using the LibXC package" OFF) | ||
| cmake_dependent_option(ENABLE_LIBVDWXC "Enable using the libvdwxc package" OFF | ||
| "ENABLE_LIBXC" OFF) |
There was a problem hiding this comment.
You are right, it was a leftover from when rVV10 was tied to rPW86-PBE. ENABLE_LIBVDWXC no longer depends on ENABLE_LIBXC; the Libxc-specific tests are built only with ENABLE_LIBXC, and the adapter tests and the native-PBE GaAs case pass with ENABLE_LIBXC=OFF.
| # vdwxc_get_local_grid reports the grid slab of each process; without it the adapter assumes the FFTW-MPI | ||
| # default blocks (see source_hamilt/module_vdw/rvv10_workspace.h). | ||
| include(CheckCXXSourceCompiles) | ||
| set(CMAKE_REQUIRED_LIBRARIES libvdwxc::vdwxc) | ||
| check_cxx_source_compiles( | ||
| "#include <complex.h> | ||
| #include <complex> | ||
| #include <vdwxc.h> | ||
| int main() { int shape[3]; int offset[3]; vdwxc_get_local_grid(nullptr, shape, offset); return 0; }" | ||
| LIBVDWXC_HAS_LOCAL_GRID) | ||
| unset(CMAKE_REQUIRED_LIBRARIES) |
There was a problem hiding this comment.
It's not a good idea to include a code test against dependencies in CMake.
There was a problem hiding this comment.
Agreed. Will vdwxc_get_local_grid be in the release that brings rVV10? If so, I will require that release and remove the probe and the ceil(nz/P) fallback.
rVV10 is independent of the semilocal functional and works with the built-in ones, so ENABLE_LIBVDWXC no longer depends on ENABLE_LIBXC. The unit tests run the Libxc paths (v_xc_libxc, v_xc_meta) only with __LIBXC, and the integration cases, two of which use rPW86-PBE, are registered when both libraries are enabled. easy_install.md says what libvdwxc is used for. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Following the unit-test layout rule of AGENTS.md (deepmodeling#8245): the rVV10 adapter and workspace tests move to module_vdw/unittests, with the shared fixture as a header; the tests added to legacy directories move to new files next to them, test_vdw.cpp (module_vdw/unittests), test_read_inp_model.cpp (source_io/unittests) and test_parallel_device.cpp (source_base/unittests), and the legacy files are restored. The INPUT test checks invalid values on the declared domains, since a rejected INPUT ends the process in the MPI build. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ABACUS-PR-BOT
left a comment
There was a problem hiding this comment.
The earlier lattice mapping, left-handed-cell and timer findings are addressed in the current source. The remaining notes concern workspace cleanup, memory guidance, test coverage and call-site clarity.
Static review of 5a3eb84 against f531565; full and incremental whitespace checks passed. No builds, numerical/runtime tests or CI diagnostics ran. Author-reported numerical results, installed dependency identity and the newer optional grid-query implementation remain unverified.
| GlobalV::ofs_running << " --------------------------------------------\n\n" << std::endl; | ||
|
|
||
| // the libvdwxc FFT plans must be destroyed before MPI_Finalize | ||
| vdw::finalize_rvv10(); |
There was a problem hiding this comment.
Non-blocking: LCAO calls this base cleanup before its XC matrix output, which can recreate the workspace after this release; the ks-lr finalizer also does not reach this hook. Please release the workspace after the last post-processing XC evaluation, while MPI is still active, so its final FFT plans and buffers are freed.
There was a problem hiding this comment.
Addressed in source at 04e913b: Driver::driver_run now releases the workspace after late solver output and solver destruction, while MPI is still active. This also covers the ks-lr composite path.
| cmake --build build-libvdwxc && cmake --install build-libvdwxc | ||
| ``` | ||
|
|
||
| Then pass `-DENABLE_LIBVDWXC=ON` to CMake for ABACUS and add `/path/to/libvdwxc` to `CMAKE_PREFIX_PATH`. rVV10 works with the built-in functionals; functionals such as rPW86 (`GGA_X_RPW86+GGA_C_PBE`) or SCAN also need `-DENABLE_LIBXC=ON`. CMake also checks for `vdwxc_get_local_grid`; with it, ABACUS asks libvdwxc for the grid slab of each process instead of assuming the FFTW-MPI default distribution. ABACUS hands each k-point pool's density to libvdwxc's distributed interface, so the nonlocal convolution and its memory are shared by the processes of the pool; libvdwxc keeps about 25 doubles (200 bytes) per grid point of a process's slab, and the adapter 5 more, so the memory per process falls as the pool grows. libvdwxc's MPI build plans its FFTs with FFTW-MPI, so an MPI build of ABACUS with libvdwxc must use FFTW3 rather than the FFTW interface of MKL or KML; CMake stops otherwise. The legacy Makefile does not build this feature. |
There was a problem hiding this comment.
Non-blocking: Please label the adapter's five-double estimate as cached workspace storage. During add_rvv10 evaluation, nonlocal_xc.cpp also holds rho, sigma, the three-component gradient, dedn and dedsigma, totaling another seven doubles per ABACUS-local grid point. The current estimate therefore does not describe peak adapter memory.
There was a problem hiding this comment.
The guide now separates cached workspace storage from the additional seven doubles per ABACUS-local grid point used during evaluation. This addresses the requested memory-description clarification at 04e913b.
| { | ||
| for (int iz = 0; iz < pw.nplane; ++iz) | ||
| { | ||
| values[(ix * pw.ny + iy) * pw.nplane + iz] = f(pw, ix, iy, pw.startz_current + iz); |
There was a problem hiding this comment.
Non-blocking: Please assign pw.startz_current + iz to a named global_z before calling f, following AGENTS rule 14. Likewise, name the generated valence and core grids before their constructor calls in test_rvv10_workspace.cpp:42-43; the data and formulas can stay unchanged.
There was a problem hiding this comment.
The requested call sites now use named global_z, valence and core values before passing them as arguments. The data, assertions and numeric thresholds are preserved in 04e913b.
| endif() | ||
|
|
||
| # the rVV10 cases also use the Libxc functional rPW86-PBE | ||
| if(ENABLE_LIBVDWXC AND ENABLE_LIBXC) |
There was a problem hiding this comment.
Non-blocking: This guard leaves ENABLE_LIBVDWXC=ON, ENABLE_LIBXC=OFF without a registered rVV10 integration case. Please register the native-PBE GaAs case separately under ENABLE_LIBVDWXC alone, so the newly supported configuration keeps SCF, force and stress regression coverage; graphite still needs Libxc.
There was a problem hiding this comment.
The native-PBE GaAs case is now registered under ENABLE_LIBVDWXC alone, while graphite and the NAO case retain the additional Libxc gate. The requested native-only integration registration is present at 04e913b.
| for (const std::string esolver: {"lr", "ks-lr"}) | ||
| { | ||
| input.esolver_type = esolver; | ||
| input.cal_force = true; |
There was a problem hiding this comment.
Non-blocking: Setting cal_force directly drops the former full-INPUT check that calculation relax activates forces before the rVV10 requirement is validated. Please retain an isolated-process rejection test for rvv10 + ks-lr + calculation relax to cover that reset/validation ordering. The current rejection logic remains intact.
There was a problem hiding this comment.
MODULE_IO_input_error_mpi_rvv10_lr_relax now reads the requested combination without explicit cal_force, checking the dependency diagnostic and all four reader shutdown markers. This restores the full-INPUT regression coverage in source at 04e913b.
io_input references stru_frame_io::extract_frame_by_step since deepmodeling#8159, so MODULE_IO_test_read_inp_model compiles stru_frame_io.cpp, as the neighbouring targets do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
vdwxc_get_local_grid is not part of the libvdwxc interface this PR depends on (merge request !32), so the CMake probe, the __LIBVDWXC_LOCAL_GRID definition, the query branch of the workspace and Parallel_Common::allgather_data are removed. The adapter applies the documented ceil(nz/P) slab rule again; the query can come back once a libvdwxc release provides it. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
ESolver_FP::after_all_runners released the workspace before the LCAO and PW post-processing, which evaluates XC again and rebuilt it, and the ks-lr solver did not reach the hook. The driver now releases it once, after the solver is deleted and before MPI_Finalize; ESolver_FP only copies the rVV10 parameters. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…llow-ups - tests: 215_PW_rvv10_GaAs (built-in PBE) is registered with ENABLE_LIBVDWXC alone, the rPW86-PBE cases with Libxc as well. - An isolated-process INPUT test rejects rvv10 + ks-lr + relax, where relax turns the forces on before the requirement is checked. - docs: the libvdwxc component is described in the component list of easy_install.md; install.md separates the adapter's cached storage from the memory of an evaluation. - AGENTS rule 14 in the unit tests; named constants for the published b values and the test lower bounds. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
ABACUS-PR-BOT
left a comment
There was a problem hiding this comment.
The five outstanding cleanup, memory-description, argument-style, native-PBE registration and INPUT-regression requests are addressed in source at 04e913b. I found no new implementation defect in the incremental changes.
Non-blocking: Please refresh the PR description for the driver cleanup, removed grid-query/allgather path and split test lists (CASES_LIBVDWXC_LIBXC.txt for NAO). Attribute earlier test results to their tested revision, and identify the new parser regression when reporting that check.
Verification was limited to static source/dependency-contract review and recorded governance/whitespace checks. No build or runtime test was run; CI and the installed dependency versions remain unverified.
|
Just a heads up in case I missed it:
|
Linked Issue
No separate issue; this continues the rVV10 work discussed in #8031.
Unit Tests and/or Case Tests for my changes
ctest -R 'XCTest|surchem|parallel_device|MODULE_HAMILT_vdw|MODULE_HAMILT_test_vdw|read_input_serial|test_read_inp_model|nonlocal_xc': 28/28 withENABLE_LIBVDWXC=ON, 24/24 withOFFand OpenMP (the hosted-CI configuration, wherevdw_method rvv10stops with a rebuild hint).abacus --version(v3.11.0-beta12),abacus -h vdw_method|vdw_rvv10_b|vdw_rvv10_cshow the choices, legal ranges, defaults and availability;abacus --check-inputaccepts the rVV10 integration cases and rejectsvdw_rvv10_b -1with the manual link.Autotest.sh -n 4 -f CASES_LIBVDWXC.txtintests/01_PWandtests/03_NAO_multik: pass.-DENABLE_LIBXC=OFF -DENABLE_LIBVDWXC=ON: the selected tests pass 6/6, and215_PW_rvv10_GaAs(native PBE) passes.fft-newat 4b18416b give the same results.What's changed?
vdw_method rvv10adds the rVV10 nonlocal correlation (Vydrov and Van Voorhis 2010; Sabatini et al. 2013) to the functional ofdft_functional, evaluated by libvdwxc MR !32.vdw_rvv10_cdefaults to 0.0093;vdw_rvv10_bfollowsdft_functionalunless set (15.7 SCAN, 11.95 r2SCAN, else 6.3 with a warning unless rPW86-PBE). The energy is counted in E_xc;evdwstays 0.vdw::add_rvv10(source_hamilt/module_vdw/nonlocal_xc.{h,cpp}) is called at the end of every XC evaluator, so forces, NLCC terms and all consumers of v_xc see the term;v_xc_libxcandv_xc_metapass on their density gradient (four FFTs saved per call).vdw::add_rvv10_stressinStress_Func::stress_ggacovers PW, LCAO, SDFT and OFDFT.Rvv10Workspace(rvv10_workspace.{h,cpp}) keeps the libvdwxc object, FFT plans, slab bounds and buffers per grid and pool, created on first use and released inESolver_FP::after_all_runners. The density is redistributed between ABACUS z planes and libvdwxc slabs withParallel_Common::alltoallv_data; the slabs are taken fromvdwxc_get_local_gridwhen libvdwxc has it (checked by CMake), otherwise the FFTW-MPI default blocks are assumed. Element-wise loops are OpenMP-parallel.ENABLE_LIBVDWXC(find_package(libvdwxc CONFIG); independent ofENABLE_LIBXC, which is needed only for Libxc functionals such as rPW86 or SCAN); an MPI build requires libvdwxc with MPI and FFTW3 (not the MKL/KML interface). Compile definition and build info follow DFT-D4.unittests/directories:MODULE_HAMILT_nonlocal_xcTest(module_vdw/unittests/test_nonlocal_xc.cppfor the adapter,test_rvv10_workspace.cppfor the workspace, shared fixture in the headernonlocal_xc_test_helpers.h) on 1, 2, 4 ranks and 2 ranks × 2 threads (adapter vs direct libvdwxc, distributed vs complete grid incl. an empty process, potential and stress vs finite differences, nspin 1/2/4, everyv_xcpath, rebuild afterfinalize_rvv10);test_vdw.cppformake_vdw,source_io/unittests/test_read_inp_model.cppfor valid INPUT reads, declared domains and requirements, and b pairing,source_base/unittests/test_parallel_device.cppfor the two new collectives; the legacy test files are unchanged; the integration groups are gated by bothENABLE_LIBVDWXCandENABLE_LIBXCbecause they include rPW86-PBE cases. The native-PBE GaAs case can also be run separately without Libxc.Governance Notes
vdw_methodgainsrvv10(rejectsesolver_type dfptand LR-TDDFT forces); newvdw_rvv10_b(Real > 0) andvdw_rvv10_c(Real ≥ 0). Docs:docs/advanced/install.md,docs/advanced/scf/advanced.md,docs/quick_start/easy_install.md,docs/CITATIONS.md.XCFunctionalParameters(viavdw::is_rvv10) and releases the workspace at the end; Hamilt/XC has one hook per XC evaluator and one instress_gga; they callnonlocal_xc.hwithout preprocessor branches, because its functions are empty inline functions without libvdwxc, so__LIBVDWXCappears only inmodule_vdwand CMake, as for DFT-D4;source_basegainsParallel_Common::alltoallv_dataandallgather_data. The governance check passes with 17 header-dependency warnings and no blockers:<vector>innonlocal_xc.h,<mpi.h>and<vector>inrvv10_workspace.h, and the includes of the header-only test fixturenonlocal_xc_test_helpers.h.code_quality_score.py: adapter sources 97–100, test sources 93–95 and the shared fixture header 88.module_vdwnext to the other vdW methods but is compiled intoxc_, its only caller. I can move it tomodule_xcif preferred.Governance Exception
__LIBVDWXC,ABACUS_LIBVDWXC_VERSIONand__LIBVDWXC_LOCAL_GRID(private toxc_) switch an optional library and one of its functions, as DFT-D4 does (CMake: Move __DFTD4 to global feature definitions #7793).build_info.h.in,module_xc/CMakeLists.txt.ENABLE_LIBVDWXC=OFF.Open points for the maintainers
da2d55fandfft-newat4b18416b.215_PW_rvv10_GaAsuses native PBE on purpose: in PW, the stress of a libxc functional with NLCC pseudopotentials double counts the core term, independent of this PR; I will report it separately.