Repository navigation
Conversation
When cal_force is enabled, single-point ks-lr now evaluates and reports the KS force once. Pass the force-table title explicitly from the KS caller through LCAO assembly so ks-lr uses GROUND-STATE FORCE while ordinary KS retains TOTAL-FORCE. Label per-state LR output as excitation-energy contributions (-dOmega/dR), and update the relaxation comment. Validation: full CPU EXX/MPI build passed. The requested N2 LDA case completed with 2 MPI ranks and 1 thread per rank in 82.36 s. Ground-state forces match an independent ksdft run exactly at printed precision (+/-14.0918076630 eV/Angstrom along z). All six excitation energies and 12 atom-force rows match a same-source baseline without the new single-point KS-force call exactly at printed precision. One ground-state table and two excitation-contribution tables are present; the misleading old title and TOTAL-FORCE are absent in ks-lr output. Governance: the existing global output stream is unchanged (net global dependency zero); string is required for the explicit title interface. Runtime verification and logs are recorded under checks/n2-force-output-20261104 in the calculation workspace. No INPUT changes; the output contract is documented by its titles and call-site comments.
Use lr_target_spin to select the sole nspin=1 response channel, retaining singlet as the default. Evaluate the triplet XC kernel with a temporary half-density shared by both spin inputs, while preserving scalar orbital, k-point and density-matrix layouts. Keep nspin=2 channel behavior unchanged. Update relaxation indices, gradient kernel spin metadata, RI response spin selection, INPUT validation and external kernel-file requirements. Documentation is updated in Input_Item metadata; generated parameter YAML and Markdown are intentionally not committed. Validation: - Built abacus_std_para, esolver, io_input, MODULE_IO_input_test_para and MODULE_LR_pot_hxc_lrtd in /tmp/abacus-rebase-20261106-build. - OMP_NUM_THREADS=1 ctest --test-dir /tmp/abacus-rebase-20261106-build -R '^(MODULE_LR_pot_hxc_lrtd|MODULE_IO_input_test_para)$' --output-on-failure: 2/2 tests passed; potential suite includes 14 tests. - abacus_std_para --version: v3.11.0-beta12; -h lr_target_spin and --check-input passed for the nspin=1 triplet input. - Two-rank OMP_NUM_THREADS=1 H2, H2O, CO and distorted CH4, LDA/PBE: 24 single-point runs completed with converged SCF; compared excitation energies and signed force components to corresponding nspin=2 channels. LDA energy outputs agree and maximum force difference is 6e-10 eV/A. PBE maximum printed energy/force differences are 3e-6 Ry/6e-5 eV/A; nspin=1 and nspin=2 already differ in their ground states before LR, and the unchanged default singlet path reproduces this baseline difference. - Two-rank nspin=1 triplet H2 relaxation completed two ionic steps with cross-geometry state tracking. - git diff --cached --check passed; staged governance check has no errors, only a documentation review warning (metadata documentation updated above).
Store the closed-shell fxc gradient contractions as scalar arrays and multiply by the ground-state gradient during potential evaluation. Reuse these arrays for the equal gxc transition-gradient coefficients, removing duplicate contractions and buffers. Preserve the nspin=1 singlet normalization and the nspin=2 singlet/triplet weights. Add an independent contraction regression test for nspin=1 and both closed-shell nspin=2 channels. General open-shell contractions are unchanged. Validation: - CPU Release build with KXC-enabled LibXC 5.2.3; 15 potential tests pass. - Twelve TD-PBE excitation/analytic-force runs: BH, N2 and BeH2, two runs per binary, with one MPI rank and one OpenMP/MKL thread. - Printed excitation energies agree; maximum individual force change is 1.1e-9 eV/Angstrom and retained multiplet-mean change is 1e-10. - Peak RSS falls about 5.7%; timings show no consistent overall speedup. - git diff --check passes. No INPUT parameters change.
Port the GS-response portion of Shane-Sayoko's HSE derivative fix from 415f0e0. Keep the LR sigma floor while using raw sigma and second derivatives only for HSE orbital response. Preserve this branch's scalar GGA cache and nspin=1 triplet layout checks. No NAC, SCF potential or density-cutoff changes are included. Validation: built MODULE_LR_xc_kernel and MODULE_LR_pot_hxc_lrtd in the existing isolated CPU source snapshot, with the ported sources verified byte-identical to this worktree. OMP_NUM_THREADS=1 ctest --test-dir /tmp/xc-scalar-reuse-build -R '^(MODULE_LR_xc_kernel|MODULE_LR_pot_hxc_lrtd)$' -V passed 2/2 entries. Kernel-role regression compares FXC directly to LibXC at raw sigma and confirms that the GS factory does not request KXC. Behavior and remaining GS/LR low-density-cutoff limitations are documented in the API and implementation comments; no INPUT interface changes.
Port the closed- and open-shell chain-rule portion of Shane-Sayoko's 415f0e0. Store the componentwise sigma preparation Jacobian and apply it only to implicit sigma dependencies in the closed-shell divergence coefficients and unrestricted drho*upp term. Preserve the local terms and explicit transition-gradient factors. Adapt the author's tests to this branch's shared scalar GGA coefficient cache, retaining its existing normalization. Do not import the NAC branch's empty-grid support, NAC interfaces, documentation or unrelated formatting. LR excitation matrix values, the sigma floor and GS cutoffs are unchanged. API comments document the Jacobian layout, lifetime and derivative model; there are no INPUT changes requiring generated parameter documentation. Validation: - Built MODULE_LR_xc_kernel, MODULE_LR_pot_grad_xc and MODULE_LR_pot_hxc_lrtd in the existing isolated CPU snapshot; all modified sources were checked against this worktree. - OMP_NUM_THREADS=1 ctest --test-dir /tmp/xc-scalar-reuse-build -R '^(MODULE_LR_xc_kernel|MODULE_LR_pot_grad_xc|MODULE_LR_pot_hxc_lrtd)$' -V: 3/3 entries and 22 individual tests passed. LibXC 5.2.3-KXC actually executed the HSE derivative tests; none skipped. - Independent FXC quadratic-form finite differences cover clipped RKS, both unrestricted free spins, positive/negative mixed sigma, mixed clipped/unclipped components, and two FD steps. Closed-shell limits and PBE identity controls passed without tolerance changes. - Negative control in the temporary snapshot, with implicit Jacobians disabled, failed both the RKS derivative and unrestricted FD regressions. Restored corrected sources, rebuilt, and reran all three entries above. - Staged whitespace check passed; governance reports no errors, only its documentation review warning (API documentation updated). No new molecular force finite-difference runs or full executable builds were performed for this port.
Port the local-grid handling from Shane-Sayoko's NAC branch independently of its NAC functionality. An empty spin cutoff is a no-op only for empty coefficient arrays; inconsistent nonempty data still throws. Track GXC construction explicitly so zero local array length does not mean a requested spin combination is unavailable. Retain FFT calls on empty ranks rather than bypassing potentially collective operations. Source: 15f939b and the regression fixtures in 415f0e0. Restore the author's empty-grid tests and extend coverage to closed-shell gradient contractions. Missing spin combinations and HF kernels still reject GXC access. No INPUT or physical-model changes; behavior is documented in GxcCoef's availability comment. Verification: built MODULE_LR_xc_kernel, MODULE_LR_pot_grad_xc and MODULE_LR_pot_hxc_lrtd in /tmp/xc-scalar-reuse-build. With OMP_NUM_THREADS=1, ctest --test-dir /tmp/xc-scalar-reuse-build -R '^(MODULE_LR_xc_kernel|MODULE_LR_pot_grad_xc|MODULE_LR_pot_hxc_lrtd)$' -V passed 3/3 entries and all 27 individual tests, with no skips. Tests exercise zero local grids through isolated FFT mocks; no real empty-rank distributed-FFT runtime case was run. Staged whitespace check passed; governance has no errors, only a documentation-review warning.
Remove twelve cached three-component open-shell GGA arrays and construct all four spin blocks from the packed LibXC scalar derivatives instead. Reuse these scalars in the first- and second-order potential contractions, keeping independent spin gradients and existing HSE clipping behavior. Select spin-dependent weights, gradient pointers, and derivative indices before the grid loops; contract only the two active sigma channels. Read only structurally active components to avoid new zero-times-NaN contributions. Remove manuscript-specific coefficient notation from the previous closed-shell cache comment. Validation: 29 LR kernel/potential tests pass, including independent four-block Cartesian contractions and inactive-component NaN coverage. BeH TD-PBE LR-plus-force regression (one MPI rank, one thread) preserves all printed eigenvalues and force components. The follow-up loop-hoisting check uses a common converged 10 Ry ground state and compares both versions. No performance measurements were made for this follow-up. Removing 36 doubles per grid point reduces peak RSS by about 1.56 GiB in the original 180^3-grid benchmark before loop hoisting. Documentation: no user-facing INPUT, solver behavior, or supported-functional changes; this changes internal cache representation and contractions only.
Move the three focused XC suites and their existing CMake targets into the current unit-test directory. Preserve source contents, assertions and CTest names. No INPUT or numerical behavior changes. Legacy Makefile and pyabacus source lists do not include these test sources. Validation: full PR CPU build and four XC plus one INPUT CTest passed with KXC-enabled LibXC 5.2.3. Full-window nspin=1 singlet/triplet single points completed. This commit only relocates tests and their build registrations.
Preserve raw HSE GS-response coefficients when finite. If any rank reports non-finite e_sigma or FXC, collectively rebuild the complete response with the existing LR sigma floor, keeping first- and second-order coefficients at the same evaluation point. Reject a non-finite retry; report successful recovery as an approximate GS orbital Hessian without changing SCF or the LR sigma Jacobian. Cover raw preservation, real LibXC small-gradient failures in both spin layouts, empty-rank collective recovery, and collective retry failure. Document the approximation and expose read-only construction metadata. Validation: focused XC/kernel/gradient CTests including 4-rank recovery; Table 5 production defaults and all 44 threshold comparisons accepted. Analytic central forces are freshly evaluated; unchanged displaced LR energies at the same fixed SCF references are reused for FD comparison. Diagnostic threshold overrides remain outside the production source. Staged governance and diff format checks pass. No INPUT changes. (cherry picked from commit 7496f7e)
Remove the HSE response note and its developer-guide index entry. The virtual-window response note is not present on this branch. Keep both manuscript-specific response notes outside this PR; source behavior and tests are unchanged.
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
…adients Account for the retained virtual subspace response in the Z-vector source, relaxed difference density, and occupied/direct energy-weighted density. (cherry picked from commit 7a5b911)
Recognize both the historical and explicit -dOmega/dR force-table headings in the total-force collector and signed LR force checker. Stop collecting when a table ends so KS and total excited-state forces remain excluded. Cover new/mixed headings, force sums, excluded tables, sign changes and missing components. Production calculations, references and tolerances are unchanged. Validation: 8 LR checker unit tests and 3 collector CTests passed. Replayed four actual CI-case outputs: LDA nspin=1/2 and closed-shell HF match their references; PBE is parsed successfully and still reports its independent small signed-force discrepancy. Staged governance and whitespace checks passed. No documentation update is needed for test-parser compatibility.
Use scf_thr=1e-2 for the unrestricted HF behavior regression so the preliminary SCF reaches its EXX update and KS forces can be evaluated. Refresh its signed excitation-energy forces and excitation energies; two lowest roots remain negative, as documented for this deliberately coarse code-path regression. Keep every PBE INPUT setting unchanged. Refresh force references for closed-shell scalar XC coefficient reuse at the existing loose spin-density reference; excitation energies and all comparison tolerances are unchanged. Explain the finite local spin asymmetry and the tight-SCF control in README. Validation: both cases passed the standard Autotest harness with four MPI ranks and one OpenMP/MKL thread, including signed forces and all requested excitation energies. Ground-state and LR force output is finite; HF reaches its EXX update and the configured SCF criterion. Three collector CTests, staged governance and whitespace checks passed. No production code changes.
Change only exx_hybrid_step from 1 to 2 in the coarse unrestricted HF integration input. A single fixed-exchange inner SCF left negative LR roots; the second EXX update gives three positive requested roots while retaining ecutwfc=10, scf_thr=1e-2 and scf_nmax=20. Refresh signed LR forces and excitation-energy references and explain the behavior-test scope in README. PBE and all tolerances are unchanged. Validation: the standard Autotest harness passed the unrestricted HF and unchanged PBE cases with four MPI ranks and one OpenMP/MKL thread. All 27 HF and 36 PBE force components and all requested excitation energies pass. The HF run reports finite KS/LR forces and positive roots 1.5151843, 1.5621012 and 4.2149284 eV. Staged governance and whitespace checks passed. No production source changes.
ABACUS-PR-BOT
left a comment
There was a problem hiding this comment.
Scalar-triplet density output is mislabeled as singlet. This was a static source review; no builds or runtime tests were run.
Non-blocking: please update the nocc/nvirt help in read_inp_tddft.cpp for the corrected real-Gamma virtual response and the nondegenerate-boundary requirement. It still describes the old missing-response approximation and warning-only behavior. Retain the separate limits for omitted occupied orbitals, uncomputed KS bands and window convergence.
|
Re: nocc/nvirt help — updated in 8dfbd33. The help now describes the corrected real-Gamma virtual response and rejected degenerate boundary, while retaining the omitted-occupied, uncomputed-KS-band and window-convergence caveats. Both CLI help commands and --check-input were verified. |
ABACUS-PR-BOT
left a comment
There was a problem hiding this comment.
The density-label fix and production regression are in place. Two nonblocking follow-ups remain below. This was a static source review; no builds, CLI checks or numerical tests were run.
Truncated virtual windows now include the missing orbital-subspace response in analytic LR gradients. Single-point
ks-lralso reports the KS force separately from the excitation-energy force, and HSE LR gradients retain stable response coefficients without imposing the LR floor on every ground-state Hessian.What's changed?
GROUND-STATE FORCEonce in single-point KS+LR force runs; label the per-state LR contribution as-dOmega/dRand distinguish the excited-state total force.nspin=1: supportlr_target_spin=tripletfor LR energies and gradients, with spin-resolved XC coefficients and INPUT/file-layout validation.e_sigmaor FXC at the LR sigma floor, recomputing the complete coefficient set. Warn that recovery uses an approximate GS orbital Hessian, and stop if the retry is still non-finite. SCF is unchanged; GS response does not request KXC.Force checks: virtual-window response
Maximum relative analytic–FD excitation-energy-force error (%), using FD energies of the same virtual window, central half-step 0.0005 Angstrom, and the same retained-multiplet normalization as Table 5. The highest complete multiplet is excluded from both the error and force scale in each SA channel or once from the joint unrestricted spectrum. All occupied orbitals and all AO-supported KS bands are available; only the Casida virtual window is truncated. SA denotes closed-shell spin adaptation; U denotes the coupled unrestricted spectrum, including unpolarized H2. Counts for U are up/down.
Small-window columns use the dense Z solver; full-window values retain the earlier gap-CG force campaign with its matched full-window FD energies, except OH/HF, which was supplemented using LAPACK for the Z equation after CG failed. Full-window columns are context for numerical accuracy and do not isolate a code-version effect. A dash means a symmetry-zero tested direction (C2H4/CH3) or the full-window Li zero-force control; OH/HF now has successful dense-Z force validation for both windows. Its full-window forces are finite and its printed excitation energies match the existing reference; the saved ground state and FD energies are reused. OH uses fixed occupations and the existing 1e-6 SCF reference threshold. Corrections restore differentiation of the truncated model; they do not establish convergence to the full-window excitation energy or force. Diamond's corrected residual decreases from 0.16222% to 0.03968% on halving the FD step, consistent with central-difference truncation error.
Force checks: HSE/RPA@HSE precision, before → after
Maximum relative excitation-energy-force error (%). Both error and force normalization use retained multiplet means, excluding the highest requested complete multiplet per channel. Identical converged SCF references, structures, basis/window/auxiliary settings, and LR models are used. New central analytic forces are compared with the existing matched displaced LR energies; this validation does not rerun FD/SCF. All matched finite printed central excitation energies are unchanged. The before column is the pre-Jacobian/shared-GS-kernel diagnostic, rather than the intermediate GS-separated version that still produced BeH2 NaNs.
Positive diagnostic bounds give finite forces in all 30 HSE/RPA@HSE comparisons. BeH2/HSE and RPA@HSE recover 0.085% and 0.058% at the production HSE bound (1e-6), while the large BeH/Li2 errors fall substantially. Recovery is approximate and does not improve every individual value. The no-bound diagnostic disables the retry floor too: BeH2 now stops instead of propagating NaNs; N2/HSE's finite but invalid large force (~100% error) and CH4/HSE's negative-root/non-finite control remain unresolved.
Peak RSS from controlled cache-reuse tests
CPU TD-PBE excitation energies + analytic forces, saved GS references, one MPI rank and one OpenMP/MKL thread, Release/GCC with KXC-enabled LibXC 5.2.3, LibRI/EXX disabled.
/usr/bin/time -vpeak RSS is converted to MiB. Closed-shell values are medians of two runs per version; unrestricted BeH is one uncontended pair. These are separate incremental cache optimizations, not a cumulative before/after measurement of every fix in this PR.The closed-shell change removes 12 doubles/grid point (648 MiB at 192^3); the unrestricted change removes 36 doubles/grid point (1601.81 MiB at 180^3). Printed excitation energies agree; closed-shell maximum individual-force change is 1.1e-9 eV/Angstrom and retained-group-mean change is 1e-10 eV/Angstrom; unrestricted printed forces agree exactly. Timings did not establish a reproducible end-to-end speedup.
Why these two integration-test references changed
scf_thr=1e-2andexx_hybrid_step=2, retaining the other input settings. The original tight preliminary SCF exhausted 20 steps before the EXX update, exposingExx Hamiltonian unfinishedwhen KS forces were requested. A single EXX update then still left negative LR roots: inner SCF convergence with a fixed exchange potential does not establish HF outer-loop self-consistency. Allowing the second update gives finite KS/LR forces and three positive energies, 1.51518, 1.56210 and 4.21493 eV; energy and signed-force references are refreshed accordingly. This remains a coarse code-behavior regression, not a physical-accuracy benchmark.scf_thr=1e-3. Force references follow scalar XC coefficient reuse; energy references and all comparison tolerances are unchanged. The reuse relies on closed-shell spin-exchange identities, e.g.The loose PBE reference has residual absolute magnetism
8.08e-5mu_B despite nearly zero total magnetism; these same-point identities are only approximate, giving a maximum force change of8.59e-6eV/Angstrom. A separate tight-SCF control restores before/after agreement at printed precision. Both refreshed cases passed standard Autotest with four MPI ranks and one OpenMP/MKL thread, checking signed forces and all requested excitation energies.Review follow-up validation
Correct scalar-triplet electron-hole density filenames and pass the selected channel explicitly to the writer. Preserve unrestricted up/down labels.
Add
lr_tddft_lda_triplet_window_gammato the CPU Autotest suite: all six KS bands, four occupied orbitals, one retained and one discarded virtual, scalar triplet, andout_chg=1. Signed force references are independent central differences of the same-window energies at +/-0.0005 Angstrom for every atom/direction. Maximum component error is 1.7e-4 eV/Angstrom; the filename check rejects the pre-fix singlet labels.Validation passed: main MPI/LibRI build; eight focused LR/INPUT CTest targets;
ctest -R '^(lr_force_collector|lr_energy_collector|md_force_collector)$'; standardAutotest.sh -a <build>/abacus_std_para -n 4 -o 1 -j 1on the LDA scalar, LDA spin-adapted, PBE, HF, HF unrestricted and new triplet-window cases.abacus --version,abacus -h nocc,abacus -h nvirtandabacus --check-inputalso passed.No documentation update required outside the updated
nocc/nvirtInput_Item help and case README: YAML/Markdown INPUT references are generated from that metadata and are not committed. The help now distinguishes corrected real-Gamma virtual response, rejected degenerate boundaries, missing occupied/KS bands, and window convergence.Further review follow-ups:
nvirthelp explicitly states that complex/multi-k truncated-virtual force requests are rejected and that the full available virtual window avoids that restriction. Autotest now removes only opted-in cases' oldLR_e-h_density_*.cubefiles before launching ABACUS, preserving unrelated output and restart files.Follow-up validation passed: incremental main/INPUT-test build;
ctest -R '^(MODULE_IO_input_test_para(_4)?|lr_force_collector|lr_energy_collector|md_force_collector)$'(five targets); CLI help and--check-input. The density Autotest passed twice in the same directory with stale expected/extra cubes seeded before launch; a third run without_chg=0correctly failed only the density check. A harness regression also verifies that cases withoutlr_density.refkeep existing cubes.