You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix(module_xc): compute real density laplacian and vlapl stress for meta-GGA functionals
SCANL, R2SCANL, and REVSCAN require the density laplacian (∇²ρ) but
v_xc_meta was passing |∇ρ|² instead. This caused ~150 kbar stress error
for Na with SCANL vs SCAN. Additionally, the vlapl stress contribution
was completely missing.
Laplacian computation method:
∇²ρ(r) = -∑_G |G|² ρ(G) e^{iGr}
- ρ(r) is Fourier-transformed to ρ(G) via real2recip()
- Each G-component is multiplied by -|G|² (i.e. -gg[ig] * tpiba²)
- Inverse FFT via recip2real() yields ∇²ρ(r) on the real-space grid
- Only the real part is retained (imaginary part should be ~0 for real ρ)
This is exact within the plane-wave basis, not numerical differentiation.
Spin handling:
- cal_lapl(nspin, nrxx, rho, tpiba2, chr) computes ∇²ρ for each spin
channel: rho is interleaved [rho_up[0], rho_dw[0], rho_up[1], ...]
and output lapl is [lapl_up[0], lapl_dw[0], lapl_up[1], ...]
- nspin=1: single channel (spin-unpolarized), loop runs once for is=0
- nspin=2: separate laplacian for spin-up and spin-down channels,
each computed independently from its own real-space density
- nspin=4 (noncollinear): blocked by set_xc_type for meta-GGA
Hessian computation for vlapl stress:
- cal_rho_hessian(nspin, nrxx, rho, chr) computes ∂²ρ/∂r_α∂r_β
via reciprocal space: FFT[ -G_α G_β ρ(G) ]
- Returns 6 independent components per spin (xx, yy, zz, xy, yz, zx)
- Stress contribution: σ_αβ^vlapl = -2 ∫ vlapl(r) ∂²ρ/∂r_α∂r_β dr
- Applied in gradcorr is_stress path for both nspin=1 and nspin=2
Changes:
- Add cal_lapl() and cal_rho_hessian() as reusable functions
- Fix v_xc_meta to call cal_lapl() and pass real laplacian to LibXC;
handle vlapl output by computing ∇²(vlapl) via same G-space method
- Fix tau_xc/tau_xc_spin wrappers to return vlapl derivative
- Fix gradcorr stress/force paths: replace duplicated inline Laplacian
code with cal_lapl() calls; add Hessian computation and vlapl stress
contribution for meta-GGA functionals
- Update test_xc4.cpp and test CMakeLists for new tau_xc signature
0 commit comments