Skip to content

Test: Add <phi|r_a|p_{l,m}> snap_psibeta unit test#7587

Open
AsTonyshment wants to merge 2 commits into
deepmodeling:developfrom
AsTonyshment:deepks_td
Open

Test: Add <phi|r_a|p_{l,m}> snap_psibeta unit test#7587
AsTonyshment wants to merge 2 commits into
deepmodeling:developfrom
AsTonyshment:deepks_td

Conversation

@AsTonyshment

@AsTonyshment AsTonyshment commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Linked Issue

No linked issue; this PR is a focused RT-TDDFT unit-test and numerical-convention cleanup for the velocity-gauge beta-projector snapshot path.

Unit Tests and/or Case Tests for my changes

This PR extends the existing MODULE_LCAO_tddft_snap_psibeta_half_test GoogleTest target to cover real Ti orbital and UPF beta-projector data. The test compares snap_psibeta_half_tddft at zero vector potential against the existing cal_r_overlap_R::get_psi_r_beta two-center reference path for both projector overlaps and Cartesian position moments.

Focused check:

ctest --test-dir build -R '^MODULE_LCAO_tddft_snap_psibeta_half_test$' --output-on-failure

Exact Verification Performed

  • Commands run: not run while drafting this PR text.
  • Result summary: verification is pending on the focused GoogleTest target above.
  • Checks not run, with reason: local PR metadata update only; no fresh build/test output was collected during this text update.

What's changed?

  • Replaces the synthetic beta-projector coverage in snap_psibeta_half_tddft_test with real Ti orbital data and Ti UPF beta projectors.
  • Compares zero-vector-potential results for nlm[0] = <phi|p_{l,m}> and nlm[1..3] = <phi|r_a|p_{l,m}>.
  • Exercises the production quadrature settings, a denser radial grid, and a higher-order Lebedev angular grid.
  • Makes the shared projector snapshot interface explicit about the UPF convention that beta projectors are stored as r * p_l(r).
  • Updates the radial quadrature factor so the shared integrator evaluates the intended p_l(r) * r^2 dr volume-integral contribution from stored r * p_l(r) data.
  • Registers the extra source dependencies required by the focused test target.
  • Makes cal_r_overlap_R orbital-index maps robust when a test-built UnitCell has more orbitals than PARAM.globalv.nlocal.

Governance Checklist

  • Global dependencies: the PR-level budget is non-increasing (GlobalV/GlobalC/PARAM added=10, removed=18, net_delta=-8 in the Agent Governance report). The flagged cal_r_overlap_R.cpp lines are migration-neutral formatting/partial-cleanup lines in a legacy writer/reference path that already depends on PARAM.globalv for matrix dimensions, output directories, spin polarization, and rank-gated sparse output.
  • Default parameters: no new default arguments are added to existing interfaces.
  • Headers: the reported cal_r_overlap_R.h include is not a new logical dependency; the header already needed source_lcao/module_ri/abfs-vector3_order.h for the public std::set<Abfs::Vector3_Order<int>> signature, and the diff only moves it within the include block.
  • Line endings: new and changed text uses LF.
  • Build linkage: the additional sources needed by MODULE_LCAO_tddft_snap_psibeta_half_test are listed in source/source_lcao/module_rt/test/CMakeLists.txt.
  • Documentation: no documentation update required because this only changes internal RT-TDDFT projector integration behavior/tests and does not change user-facing INPUT syntax, runtime options, file formats, or documented workflows.
  • CodeRabbit: request @coderabbitai review if automatic review does not start.

INPUT Parameter Changes

  • Parameters added, removed, or changed: none.
  • docs/parameters.yaml updated: no.
  • docs/advanced/input_files/input-main.md updated: no.
  • No input documentation update required because no INPUT parameter metadata, defaults, parsing behavior, availability, or user-facing INPUT documentation changed.

Core Module Impact

  • Affected core modules: RT-TDDFT LCAO projector snapshot helpers in source_lcao/module_rt; test-only reference coverage through source_io/module_hs/cal_r_overlap_R.
  • Risk summary: the production default quadrature remains the same, while the radial-projector convention is clarified and corrected for UPF beta projectors stored as r * p_l(r). The main behavioral risk is numerical drift in beta-projector overlaps, which is covered by comparison against the existing two-center reference path.
  • Compatibility or performance impact: no INPUT or file-format compatibility impact. Production runtime cost is expected to remain unchanged for default quadrature settings; the denser radial and higher-order Lebedev grids are selected only by the test overload.

Governance Exception

  • Rule: Global dependency budget warning and header dependency review warning.
  • Reason: cal_r_overlap_R is a legacy sparse-output/reference helper that still reads PARAM.globalv, PARAM.inp, and GlobalV::DRANK directly for matrix dimensions, output paths, spin layout, and root-rank IO. This PR reduces the total global-reference budget and does not introduce a new ownership pattern; it only keeps the existing path usable as a two-center reference for the focused RT-TDDFT test.
  • Scope: source/source_io/module_hs/cal_r_overlap_R.cpp and source/source_io/module_hs/cal_r_overlap_R.h.
  • User or maintenance risk: low for users because there is no INPUT or file-format change. Maintenance risk is limited to retaining the existing global-dependency shape in this helper until the surrounding sparse-output API receives an explicit context object.
  • Why the normal rule cannot be followed now: removing the remaining globals would require a broader API migration across cal_r_overlap_R, sparse matrix output, and call sites that is outside this focused test/numerical-fix PR.
  • Follow-up cleanup plan: migrate cal_r_overlap_R to explicit context inputs for dimensions, spin polarization, output directories, and rank-gated IO in a dedicated cleanup PR.
  • Requested approver: ABACUS maintainer/reviewer for the Agent Governance warning acknowledgement.

@AsTonyshment AsTonyshment requested review from Copilot and mohanchen and removed request for Copilot July 3, 2026 13:19
Copilot AI review requested due to automatic review settings July 4, 2026 05:31
@AsTonyshment AsTonyshment requested review from Copilot and removed request for Copilot July 4, 2026 05:32
@AsTonyshment AsTonyshment removed the request for review from Copilot July 6, 2026 13:45
Copilot AI review requested due to automatic review settings July 6, 2026 13:46
@AsTonyshment AsTonyshment removed the request for review from Copilot July 6, 2026 13:46
Copilot AI review requested due to automatic review settings July 6, 2026 14:14
@AsTonyshment AsTonyshment removed the request for review from Copilot July 6, 2026 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants