Skip to content

feat(xc): add SCANL meta-GGA functional with FD Laplacian kernel#7533

Open
dyzheng wants to merge 7 commits into
deepmodeling:developfrom
dyzheng:feat/scanl-laplacian-support
Open

feat(xc): add SCANL meta-GGA functional with FD Laplacian kernel#7533
dyzheng wants to merge 7 commits into
deepmodeling:developfrom
dyzheng:feat/scanl-laplacian-support

Conversation

@dyzheng

@dyzheng dyzheng commented Jun 28, 2026

Copy link
Copy Markdown
Collaborator

Implement Laplacian-dependent XC functional support enabling the SCANL (SCAN + Laplacian) meta-GGA functional. Key changes:

  • Register SCANL functional name with runtime user warning
  • Add laplacian_rho() for single-FFT spectral Laplacian computation
  • Pass correct lapl_rho to tau_xc/tau_xc_spin (was wrongly using grho)
  • Add vlapl output from tau_xc/tau_xc_spin
  • Implement FD Laplacian kernel for vlapl potential to avoid |G|^2 amplification that causes SCF divergence (following dyzheng PR Fix(module_xc): compute real density laplacian for meta-GGA functionals #7286)
  • Add vlapl stress contribution via density Hessian in G-space
  • Guard vlapl processing when functional doesn't depend on Laplacian
  • Fix SCAN unit test (pass lapl_rho=0.0, vlapl=0.0)
  • Update test CMakeLists with required source files and link libraries

Si2 FCC stress FD validation: SCANL 1.1% error, SCAN 0.0% error. Metallic Al error is pre-existing k-point convergence issue.

Reminder

  • Have you linked an issue with this pull request?
  • Have you added adequate unit tests and/or case tests for your pull request?
  • Have you noticed possible changes of behavior below or in the linked issue?
  • Have you explained the changes of codes in core modules of ESolver, HSolver, ElecState, Hamilt, Operator or Psi? (ignore if not applicable)

Linked Issue

Fix #...

Unit Tests and/or Case Tests for my changes

  • A unit test is added for each new feature or bug fix.

What's changed?

  • Example: My changes might affect the performance of the application under certain conditions, and I have tested the impact on various scenarios...

Any changes of core modules? (ignore if not applicable)

  • Example: I have added a new virtual function in the esolver base class in order to ...

@dyzheng

dyzheng commented Jun 28, 2026

Copy link
Copy Markdown
Collaborator Author

The remain issue of this PR:
image

@mohanchen mohanchen added the Refactor Refactor ABACUS codes label Jun 30, 2026
@dyzheng
dyzheng force-pushed the feat/scanl-laplacian-support branch from 7cf3f3a to c97319e Compare July 21, 2026 09:15
dyzheng added 4 commits July 21, 2026 20:52
Implement Laplacian-dependent XC functional support enabling the SCANL
(SCAN + Laplacian) meta-GGA functional. Key changes:

- Register SCANL functional name with runtime user warning
- Add laplacian_rho() for single-FFT spectral Laplacian computation
- Pass correct lapl_rho to tau_xc/tau_xc_spin (was wrongly using grho)
- Add vlapl output from tau_xc/tau_xc_spin
- Implement FD Laplacian kernel for vlapl potential to avoid |G|^2
  amplification that causes SCF divergence (following dyzheng PR deepmodeling#7286)
- Add vlapl stress contribution via density Hessian in G-space
- Guard vlapl processing when functional doesn't depend on Laplacian
- Fix SCAN unit test (pass lapl_rho=0.0, vlapl=0.0)
- Update test CMakeLists with required source files and link libraries

Si2 FCC stress FD validation: SCANL 1.1% error, SCAN 0.0% error.
Metallic Al error is pre-existing k-point convergence issue.
…er functions

- Remove SCANL_IMPLEMENTATION.md documentation
- Extract add_vlapl_stress_contribution() in xc_grad.cpp from gradcorr()
- Extract process_vlapl_potential() in libxc_pot.cpp from v_xc_meta()
- Fix hse_omega parameter passing for develop branch compatibility
…tion

- Add detailed mathematical formulas and explanations for:
  * add_vlapl_stress_contribution() in xc_grad.cpp
  * process_vlapl_potential() in libxc_pot.cpp
  * tau_xc/tau_xc_spin wrappers in libxc_abacus.h
  * cal_lapl/cal_lapl_fd/cal_rho_hessian in libxc_tools.cpp
  * laplacian_rho() in xc_functional.h
  * SCANL registration in xc_functional.cpp
- Document FD Laplacian kernel formula and rationale
- Add notes about convergence warnings for metallic systems
- Add development notes about caching vlapl values for performance
Pass hybrid_alpha and hse_omega as parameters to add_vlapl_stress_contribution
instead of accessing GlobalC::exx_info directly, reducing cross-layer global
dependency usage and fixing the agent governance check failure.
@dyzheng
dyzheng force-pushed the feat/scanl-laplacian-support branch from 8da32be to f89d3c9 Compare July 21, 2026 12:54
dyzheng added 3 commits July 22, 2026 18:10
…ests

Bug fixes:
- libxc_mgga_wrap: add hybrid alpha scaling for vlapl in tau_xc/tau_xc_spin
- xc_grad: replace hardcoded func_type check with XC_FLAGS_NEEDS_LAPLACIAN flag
  to support future Laplacian-dependent meta-GGA functionals generically

Efficiency:
- libxc_tools: add cal_gdr_and_lapl() to share real2recip FFT between
  gradient and Laplacian computation (one FFT saved per spin channel)
- libxc_pot: use cal_gdr_and_lapl in v_xc_meta instead of separate cal_gdr
  + cal_lapl calls

New features:
- libxc_setup: add generic XC_FLAGS_NEEDS_LAPLACIAN warning for all
  Laplacian-dependent functionals, not just SCANL

Tests:
- test_xc6.cpp: SCANL Laplacian sensitivity test with libxc reference values
  (MGGA_X_SCANL, MGGA_C_SCANL, tau_xc wrapper)
- test_xc7.cpp: analytical Laplacian tests for laplacian_rho()
  (zero input, imaginary rhog, linearity, single plane wave)
- Updated test CMakeLists.txt with new test targets
The previous commit (XC_FLAGS_NEEDS_LAPLACIAN) incorrectly replaced
'func_type == 3 || func_type == 5' with 'need_laplacian' in the stress
path of gradcorr(). This caused SCAN (func_type=3, need_laplacian=false)
to call gcxc_libxc instead of tau_xc, losing the tau-dependent v2xc
and making the GGA stress contribution zero.

Fix: use func_type check for selecting tau_xc vs gcxc_libxc (all mGGA
functionals need tau_xc), and need_laplacian only for Laplacian
computation and vlapl stress contribution.

SCAN PW stress FD: error reduced from 41.3% to 0.45%.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Refactor Refactor ABACUS codes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants