Skip to content

Feature: LR-TDDFT analytical forces (gradients) by Z-vector method and excited-state geometry relaxation - #8069

Open
maki49 wants to merge 105 commits into
deepmodeling:developfrom
maki49:LR-Grad-relax
Open

maki49 wants to merge 105 commits into
deepmodeling:developfrom
maki49:LR-Grad-relax

Conversation

@maki49

@maki49 maki49 commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

Features

  1. Analytic LR-TDDFT excited-state forces (Z-vector method, gamma-only)
  • Implements the Lagrangian/Z-vector equations to solve for the relaxed and energy-weighted transition density matrices, giving analytic excited-state forces matching well with finite differences (see results.md).
  • Supports RPA, LDA, GGA, Hartree-Fock, hybrid functionals (HSE/range-separated, including a sigma-clamping fix for the wpbeh kernel's short-range divergence) and the long-range-corrected (LRC) kernel.
  • Supports both spin-restricted (singlet/triplet) and spin-unrestricted (open-shell) excited states.
  • For a degenerate excited multiplet, computes and prints the full (non-diagonal) gradient matrix over the degenerate subspace, with its eigen-decomposition, instead of a single force vector.
  1. Excited-state geometry relaxation
  • Drives the existing Relax_Driver on an excited-state PES: the ground state is re-converged and the Z-vector gradient is recomputed at every ionic step.
  • Tracks the target excited state across ionic steps by maximum wavefunction overlap, so relaxation follows the same diabatic state through near-degeneracies/state crossings.
  • For degenerate states, adds an isotropic (symmetry-averaged) relax mode and a Jahn-Teller mode that follows the distortion direction extracted from the degenerate gradient matrix (lr_relax_degen_mode).

Refactors

  • Generalizes OperatorLRHxc/OperatorLREXX (previously built only for the Casida A-matrix) so the same Hxc/EXX operators are reused to build the Z-vector/multiplier equations.
  • Keeps the ground-state KS solver as a persistent member of ESolver_LR (rather than a one-shot temporary) so it can be re-run every ionic step during relaxation.

Other Behavior changes

  • KXC-enabled LibXC build in CI/CD: the build will take longer time.
  • XC kernel cutoffs: the density cutoff changes from 1e-6 to 1e-14, and the gradient cutoff from 1e-10 to 1e-20. This can change excitation energies even when forces are disabled. A four-rank A/B run reproduces the LDA gamma reference changes. The periodic Si multi-k case has a minimum spin density of approximately 1.29e-3, above the old cutoff; its four excitation energies agree at 17-digit output precision between the two settings.
  • Closed-shell singlet weighting: nspin=1 singlet response uses the factor-two Hartree/XC contribution, while ground-state S1_gs retains weight one. Existing single-spin excitation results can therefore change. BSE grid initialization uses S1_gs because HamiltBSE already applies the singlet factor; the existing RI BSE path is unaffected by this grid correction.
  • HSE06 kernel regularization: the LR HSE06 implementation clamps sigma to at least 1e-6 when evaluating XC derivatives. This can change HSE06 response energies and gradients near vanishing density gradients; it does not apply this clamp to ordinary PBE.
  • Composite XC third derivatives: contributions from multiple XC functionals are accumulated when evaluating kxc, rather than allowing the last functional to overwrite earlier contributions. This affects the XC contribution to analytic excited-state forces.
  • Davidson MPI broadcast: eigenvector broadcasts use the actual scalar type through the guarded wrapper, replacing an unconditional complex-double broadcast. This fixes real-valued MPI buffer handling and can affect both ground-state and LR calculations using this solver.
  • Gradient orbital window: the Z-vector calculation uses all available ground-state virtual bands, while lr_nvirt continues to select the response basis. The gradient can depend on the available ground-state band window even when the response basis is held fixed.
  • Failure handling: incomplete full-window wavefunction reads and unconverged Z-vector CG solves now fail explicitly instead of continuing to produce a force. CG convergence is checked using the final residual; its iteration limit and tolerance remain internal constants.
  • MPI and buffer robustness: empty local grid matrices, spin-resolved EXX density-matrix buffers, and the single-channel complex spectrum buffer are handled without invalid indexing or incorrect allocation assumptions.
  • Force output and diagnostics: excited-state force output and test force summaries retain ten decimal places. Full Z-vector dumps are restricted to test_force runs.

Copilot AI balanced review requested due to automatic review settings October 2, 2026 10:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@maki49
maki49 marked this pull request as draft October 2, 2026 10:11
Comment thread source/source_lcao/module_lr/cal_edm.cpp
Comment thread source/source_lcao/module_lr/lr_force.cpp
@mohanchen mohanchen added Features Needed The features are indeed needed, and developers should have sophisticated knowledge EXX and lr-TDDFT Related to EXX or lr-TDDFT labels Oct 2, 2026
@maki49
maki49 force-pushed the LR-Grad-relax branch 6 times, most recently from e5a8e55 to cd8346b Compare October 5, 2026 07:56
@maki49
maki49 marked this pull request as ready for review October 6, 2026 13:40
@mohanchen

Copy link
Copy Markdown
Collaborator

Thanks a lot for your hard work on this PR — the overall direction looks great! Below are a few suggestions, ordered from the easiest to the more involved ones. Most should be quick to address, and I'm happy to discuss any of them.

  1. File naming: please use lowercase for source file names. For consistency with the rest of the codebase, new source files should use all-lowercase names.
  2. INPUT parameter names must not exceed 15 characters. The name lr_relax_degen_mode violates this rule — please shorten it. This limit exists so that INPUT files stay nicely aligned and readable.
  3. Keep new files under 500 lines. A single file shouldn't exceed 500 lines. I know some existing code is over this limit too, but that's exactly why we need everyone's help to gradually break things down — at the very least, new code should not add to the problem. Splitting it up will also make this PR much easier to review and maintain.
  4. No mutable members. Please avoid mutable, such as the members dmr and dmr_save declared mutable so that the const function cal_dmr can modify them. A const function that mutates state is a sign the design needs adjusting — you're welcome to refactor the density matrix class itself instead, for example by making cal_dmr non-const, or by restructuring where these buffers live.
  5. Don't obtain data indirectly through the density matrix. I've already removed Parallel_Orbitals and get_kvec_d() from the density matrix. If you need these quantities, please pass them in as explicit parameters rather than borrowing them through the density matrix — that creates unnecessary data dependencies. Convenience is nice, but dependency hygiene matters more.
  6. ESolver functions should stay high-level. There's a strict convention for ESolver functions: they should only contain the top-level flow — the skeleton of the algorithm. All detailed work should go into free functions (not class member functions); if that's truly impractical, a class member function is acceptable as a fallback. For example, something at the level of print_force is a detail, and its definition should not live inside the ESolver. Think of the ESolver as an outline that directs the flow — it shouldn't manage any details itself.
  7. Merge with the existing LR ESolver rather than adding a new one. LR already has an ESolver — why introduce another one? If the new functionality can't be merged into the existing LR ESolver, that usually indicates a framework design issue. And when problems aren't fixed at the root, they tend to grow bigger and harder to clean up over time. Conceptually, I'd strongly recommend merging this into the existing LR ESolver as much as possible. This is the biggest item on the list, so feel free to reach out if you'd like to discuss the design together!
    None of these are blockers in spirit — items 1–3 are quick fixes, and for items 4–7 I'm glad to help brainstorm the refactoring approach. Looking forward to the next iteration!

@maki49

maki49 commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator Author

@mohanchen For the last point (7.), no new ESolver is added: esolver_lr_grad.cpp is just a separate .cpp file from esolver_lr_lcao_tddft.cpp, corresponding to esolver_lr_lcao_tddft.h.
All of your other suggestions have been followed by the last several refactor commits.

maki49 and others added 15 commits October 7, 2026 00:19
Port the LR-Grad series (44 commits, 7c6398d..6aea1fc, all by maki49)
onto current develop as a single squashed change, adapted to develop's
large-scale refactor.

Path/layout migration:
  module_lr        -> source_lcao/module_lr
  module_ri        -> source_lcao/module_ri (Exx_LRI.h -> exx_lri.h)
  esolver_lrtd_lcao -> source_esolver/esolver_lr_lcao_tddft
  ESolver_LR now lives in namespace ModuleESolver, not LR.

Interface adaptation:
  - Grid integration: the Gint_Gamma/Gint_k objects and TGint<T> selector
    are gone. All call sites now use the free functions in ModuleGint
    (cal_gint_rho / cal_gint_vl / cal_gint_fvl); the gint pointer has been
    removed from LR_Force, LR_Density, OperatorLRHxc, HamiltLR/HamiltULR,
    the Z-equation Hamiltonians and the multiplier helpers.
  - PulayForceStress::cal_pulay_fs (grid overload) keeps the explicit
    `nspin` argument the gradient code needs; develop's own callers pass
    PARAM.inp.nspin.
  - Parallel_Orbitals::get_row_size(iat)/get_col_size(iat)
    -> get_nrow_atom(iat)/get_ncol_atom(iat).
  - elecstate::Potential::init_pot(istep, chg) -> init_pot(chg);
    get_effective_v -> get_eff_v; Structure_Factor::setup_structure_factor
    -> setup; Charge::allocate now takes kin_den.
  - ModuleIO::output_single_R takes a SparseWriteOptions struct.
  - ModuleIO::read_wfc_nao uses develop's signature (ik2iktot/nkstot/nspin).
  - ModuleBase::timer::tick -> start/end pairs.
  - LR_Util::gather_2d_to_full keeps develop's explicit-dimension form;
    scatter_full_to_2d is added for the Z-equation solver.
  - get_DMR_real_imag_part / set_HR_real_imag_part are now the templated,
    nat-free versions; module_bse call sites updated, the now-dead
    lr_util_hcontainer.cpp is removed.
  - DensityMatrix::cal_DMR is const (_DMR is mutable).

Known gap: LR_Force::cal_force_exx_gs_dm_relaxed_diff still uses
RI::LR from LibRI, which no longer derives from RI::Exx in the current
LibRI master (commit 5c6c262 refactored it into a k-space CVCX/BSE helper).
That single function does not compile; everything else does.
…X force kernel

LibRI commit 5c6c262 repurposed RI::LR: it no longer derives from RI::Exx and
lost set_Ds/cal_Hs/cal_force/force. Reintroduce just the piece the LR-TDDFT
gradient needs as LR::ExxForceTwoDM, a thin RI::Exx subclass whose cal_force
overload overwrites post_2D.saves["Ds_<suffix>"] with the left density matrix
before delegating to Exx::cal_force. This reproduces the old RI::LR semantics
(D_IJ from Ds_left, D_KL from set_Ds) without pinning LibRI.

Also drop dm_trans/dmr_complex.cpp from the build: develop moved the
DensityMatrix<complex,complex>::cal_DMR specialization into density_matrix.cpp,
so keeping both gave a duplicate definition at link time.
…ose HSolverLR timer

Two crashes found running the H2/TDHF/SZ gradient case:

1. PulayForceStress::cal_pulay_fs (the LR overload in pulay_force_hcontainer.h)
   passed the density matrix's spin count as `nspin` to ModuleGint::cal_gint_fvl
   while supplying a single potential channel. Gint_fvl::cal_fvl_svl_ indexes
   vr_eff_[is] for is<nspin, so with a two-channel DM (the test_force path feeds
   in the ground-state DM) it read past the vector and segfaulted inside the
   OpenMP region. The LR kernel produces one potential channel, so the grid
   integrals now run with nspin=1 on the leading DM channel -- exactly what the
   old `Gint_inout(is=0, ...)` calls did.

2. HSolverLR::solve started a timer that was never ended, so the second
   (triplet) call threw "timer::start HSolverLR::solve". Added the matching
   ModuleBase::timer::end on the common exit path.

Verified on H2 / TDHF / SZ (nspin=2, gamma-only):
  - SCF reproduces the pre-port reference bit-for-bit (E_KohnSham -2.3110142036 Ry,
    TOTAL-FORCE -14.7806682608 eV/Ang).
  - test_force cross-check: GS Hxc force via potential -28.4711400896 vs via the
    LR kernel -28.4711414920 eV/Ang (7 significant digits).
  - The reproduced EXX force (31.3817781891) is exactly 2x the SCF EXX force
    (15.6908890935), confirming ExxForceTwoDM replaces RI::LR correctly.
  - Excitations 22.484 eV (singlet) / 13.813 eV (triplet); excited-state
    gradients -0.6313 / -2.01497 eV/Ang, antisymmetric with ~1e-14 transverse
    components.
solve_Z_lapack built a replicated Hessian via HamiltLR::matrix() but handed
LAPACK the pX-distributed right-hand side `R` directly. lapack_linear_solver
then copies n_global*nstates entries out of a buffer that only holds
ld*nstates = nk*pX[0].get_local_size()*nstates -- an out-of-bounds read as soon
as the local size is smaller than the global one, and a segfault on any rank
whose local size is 0.

Gather R into a global buffer first, mirroring the scatter of Z_full that
already follows the solve. Serial results are bit-for-bit unchanged (verified
on H2/TDHF/SZ: excited-state gradients -0.631306 / -2.01497 eV/Ang, all
per-term forces identical to the pre-fix run).
`PotHxcLR::cal_v_eff` dominates an LR run: 74% of the total for 07_LiF/pbe
(949 s of 1289 s over 541 calls). Roughly half of that was FFT; the rest was
serial element-wise work and allocator traffic. Five changes, no algorithmic
change:

1. OpenMP on the element-wise loops. Everything these loops call
   (`grad_rho`, `grad_dot`, the Hartree kernel) was already parallel; the
   integrands here were the only part still running on one thread.

2. Raw pointers instead of `.at()` (43 sites). The bounds check is a branch
   per access, ~10 per grid point, and it blocks vectorization. The
   outer-vector lookups (`drho_gs.at(0)`) are hoisted out of the loops, where
   they keep their bounds check for free.

3. A scratch pool instead of per-call temporaries. `drho`, `gdot_terms` and
   `vxc_tmp` were allocated and value-initialized on every call and then
   overwritten before being read -- ~450 MB of pointless memset per call at a
   200^3 grid, plus the page faults. `grad_dot` assigns rather than
   accumulates, so even `vxc_tmp`'s zero-fill was dead. The pool is shared by
   all instances (a run holds three `PotHxcLR`) so it does not multiply.

4. `add_v_hartree` replaces `H_Hartree_pw::v_hartree`, which (a) re-did the
   forward FFT of rho^X that the GGA branch needs anyway -- 1 of the 10 FFTs
   per call was pure duplication, (b) reduced a Hartree "energy" of the
   transition density through `Parallel_Reduce::reduce_pool` every call, a
   collective nobody reads that also clobbers the global
   `H_Hartree_pw::hartree_energy`, and (c) returned a `matrix` by value, to
   which `v_eff += 2 * (...)` added a second full-size temporary.

5. The nspin=2 singlet/triplet combinations `v2rho2_uu -+ v2rho2_ud` and
   `2*vsigma_uu -+ vsigma_ud` are pre-contracted once per potential instead
   of being rebuilt at every grid point of every call, which also replaces
   two strided reads with one contiguous one. Costs 8-16 B/point, and only
   for closed-shell nspin=2.

`PotGradXCLR::cal_v_eff` (the g^xc branch feeding the Z-vector RHS) gets 1-3
of the same treatment, for -20% to -28%. The shared pool matters more there:
a `PotGradXCLR` is constructed inside the loop over excited states, so
per-object buffers would never be reused at all.

Measured (single node, 16 threads), analytic gradients unchanged:

  01_Si/lda    93 s -> 51 s   (-45%)   cal_v_eff  66 ->   45 ms/call
  01_Si/pbe   229 s -> 125 s  (-46%)   cal_v_eff 356 ->  268 ms/call
  02_Li2/lda  165 s -> 86 s   (-48%)   cal_v_eff 559 ->  278 ms/call
  02_Li2/pbe  530 s -> 253 s  (-52%)   cal_v_eff 2651 -> 1553 ms/call

(The total also benefits from solving the Z-vector equation once instead of
three times, a separate fix; the per-call figures above isolate this commit.)

Excitation energies are identical to every printed digit; the nspin=1 cases
agree to 1e-14, and of 60 force components per nspin=2 case, 2-3 differ by
exactly one unit in the last printed digit (the Hartree prefactor is now
associated differently).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QMV7xFZ69hhc3HnVBHbD96
maki49 added 9 commits October 9, 2026 18:12
Add two-step four-rank BeH2 average and CH4 JT fixtures with gauge-independent subspace checks. Restore force checks for supported LDA/PBE Gamma cases using the CI image's LibXC version rebuilt with KXC and cached. Time the complete follow_target_state_ function, including its early return.

Validation: cmake --build build -j2; python3 tests/integrate/tools/test_root_check.py (8 passed); four-rank Autotest on five LR cases (15 property checks passed) with KXC-enabled LibXC 5.1.7 runtime; workflow YAML and shell syntax; staged governance and diff checks. Timer instrumentation and test-only changes do not change INPUT behavior; no parameter documentation update is needed.
Resolve RI build-list conflicts by retaining both exx_lr_ws and develop's extracted ri_util in CMake and Makefile.Objects. Preserve the existing reviewed fix SHAs and the develop CI updates alongside KXC support.

Validation: cmake --build build -j2 (GNU full executable passed); serial lr and three root-tracking CTest targets passed; GNU Makefile ri_util.o and exx_lr_ws.o passed using local MKL FFTW headers; eight root-checker tests passed; five four-rank LR integration cases passed all 15 property checks with OMP_NUM_THREADS=1 and KXC-enabled LibXC 5.1.7 runtime. Workflow YAML/shell syntax, governance and diff checks passed without blocking findings. No new INPUT behavior is introduced by conflict resolution.
Adapt LR relaxation validation to develop's validation_tools directory and modular collectors. Retain excited-state force extraction in props_basic, move the root checker and its tests, and update the CI test path. Preserve all previously reviewed fix SHAs.

Validation: eight root-checker unit tests passed; recollecting existing logs for five LR cases matches their previous result.out exactly excluding timing; missing ionic step produces CompareRootTracking_pass 1; workflow YAML and collector shell syntax passed; no unresolved paths; conflict-resolution files pass whitespace checks and staged governance has no blocking findings. Physical calculations and C++ builds were not rerun for this script conflict resolution. Existing PR and incoming develop whitespace warnings were left unchanged.
Report the resolved full KS band count and the selected LR window count instead of reading eig_ks.nc before its allocation. This only changes diagnostic output; INPUT and numerical behavior are unchanged, so parameter documentation needs no update.

Validation: cmake --build build --target abacus_std_para -j4 passed; four-rank MPI controls with OMP_NUM_THREADS=1 and lr_solver=lapack passed for both ks-lr and standalone lr, asserting KS=6 and LR window=5 and nonempty absorption.dat. The initial small-window Davidson controls hit its dimension assertion; LAPACK was used for the log checks. Staged governance and whitespace checks passed, with test/documentation review warnings addressed by this evidence and rationale.
Replace the unconditional KXC build reminder with a capability check on initialized functionals only when third derivatives are needed. Check independent mixed components recursively and name unsupported functionals with the loaded LibXC version. Release initialized functionals before reporting the normal ABACUS fatal error.

Validation: cmake --build build -j2 passed; MODULE_LR_xc_kxc passed five tests with KXC-enabled LibXC and the system library; three four-rank LDA/PBE integration cases passed all 13 property checks with OMP_NUM_THREADS=1; a four-rank control loading system LibXC without KXC failed early with the expected functional/version/build guidance; C++11 syntax checks with and without LibXC passed. Staged governance has no blocking findings. No INPUT parameter behavior changes; this replaces an unconditional reminder and improves diagnostics for an already unsupported configuration, so parameter documentation updates are not required.
The updated write_vdata_palgrid interface requires a running log stream and data description. Pass the stream explicitly through LR density output and supply an electron-hole density description for both closed-shell and unrestricted callers, fixing the shared build failure across GNU, Intel, CUDA, serial, no-ELPA and Makefile jobs.

Validation: cmake --build build -j4 passed; affected ESolver source passed GNU syntax compilation with serial and no-ELPA configuration flags; Intel Makefile esolver_lr_lcao_tddft.o passed; four-rank closed-shell LDA and unrestricted HF out_chg=1 controls generated 4 and 6 complete finite cube files with matching log descriptions, and both force totals passed existing references within 1e-6. OMP_NUM_THREADS=1. Conflict-resolution whitespace and staged governance checks have no blocking findings; inherited develop whitespace warnings are unchanged. No new INPUT behavior, so parameter docs need no update. Remote CI results remain pending.
@mohanchen

Copy link
Copy Markdown
Collaborator

@mohanchen For the last point (7.), no new ESolver is added: esolver_lr_grad.cpp is just a separate .cpp file from esolver_lr_lcao_tddft.cpp, corresponding to esolver_lr_lcao_tddft.h. All of your other suggestions have been followed by the last several refactor commits.

OK, thanks. I will look into your details soon.

@mohanchen mohanchen added the Refactor Refactor ABACUS codes label Oct 10, 2026
Comment thread tests/integrate/validation_tools/excited_state_check.py
Comment thread tests/integrate/validation_tools/test_es_check.py
Comment thread source/source_lcao/module_lr/state_group.cpp
Comment thread source/source_lcao/module_lr/state_group.h
Comment thread source/source_lcao/module_lr/state_track.cpp
Comment thread source/source_lcao/module_lr/state_track.h
Comment thread source/source_esolver/esolver_lr_grad.cpp Outdated
Comment thread source/source_esolver/esolver_lr_lcao_tddft.cpp
Keep the existing dimensionless 1e-6 diagnostic threshold and explain its meaning in the warning. Rename state tracking sources and checker without changing numerical behavior. Test basenames use grp/chk abbreviations to retain the requested length limit; no INPUT or documentation behavior changes.
Separate orbital distributions and ground-state input, KS initialization and refresh, and dimension/kernel configuration into esolver_lr_orb.cpp, esolver_lr_init.cpp, and esolver_lr_cfg.cpp. Keep member definitions under source_esolver; update CMake and Make. Preserve numerical behavior and global dependency counts. No INPUT changes.

Verified: full GNU MPI builds after each extraction; Intel Make object compilation; C++11 checks without MPI and ELPA; four-rank BeH2 average, CH4 JT, and unrestricted HF regressions.
@maki49

maki49 commented Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator Author

@mohanchen The files named root_* are renamed as state_*. esolver_lr_lcao_tddft.cpp is split into 4 files.

Apply the flattened UnitCell symmetry-analysis interface to esolver_lr_init.cpp while preserving the ESolver split and original feature SHAs. Verified full GNU MPI build, C++11 initialization checks without MPI and without ELPA, and four-rank two-step BeH2 state tracking. No INPUT behavior changes.
Use vector initialization for iat2it and iat2ia after the develop UnitCell refactor. Fix both the overlap block fixture and the cross-geometry AO overlap fixture. Verified both MPI-linked test targets, the four-rank state-overlap suite, and the serial state-overlap suite. No production behavior or reference changes.
Redistribute occupied and virtual MO-overlap subblocks to descriptors starting at (1,1) on the amplitude BLACS grid before PBLAS contractions. Preserve the existing block size and local distribution without gathering matrices. Remove the unit-block restriction while retaining dimension and layout checks.

Regression tests cover block sizes 2, 4 and 32, misaligned occupied windows, multiple blocks, complex adjoints and empty ranks against independent contractions. Verified full GNU MPI build; 19 overlap tests in serial, MPI single-rank and four-rank runs; projection tests on a six-rank non-square grid; two-step BeH2 tracking with nb2d=32 on one rank and nb2d=2 on four ranks. No INPUT defaults or reference changes.
Redistribute selected old/new MO coefficient columns before AO-to-MO contraction, constructing only oo and vv overlaps once per spin. Reuse these aligned blocks for every tracked reference; projection now performs only the two matrix multiplications. Reuse the coefficient work buffer and avoid storing unused occupied-virtual overlaps. Preserve block sizes, numerical formulas and INPUT behavior.

Verified full GNU MPI build; 21 overlap tests in serial and MPI single/four-rank runs; distributed tests on six ranks; two-step BeH2 tracking with nb2d=32 on one rank and nb2d=2 on four ranks. Added independent occupied/virtual construction checks including complex and misaligned large blocks. No reference changes or user-facing documentation changes required.
Merge cd2c7ce, including the upstream consistent AO radial spline values/derivatives correction (deepmodeling#8119). Resolve the unrestricted HF reference conflict by retaining the LR force check and adopting the verified new spectrum. Refresh force sums in the five Gamma LR cases; multi-k spectra and BeH2/CH4 state-following references remain unchanged. Keep existing thresholds and timing references.

Verification: cmake --build build -j8 passed. Run all eight tests/08_RI/lr_* integration cases with OMP_NUM_THREADS=1, MKL_NUM_THREADS=1 and mpirun -np 4, using LibXC 5.1.7 with KXC as in CI; collect with catch_properties.sh. All 28 reference checks pass. Repeat unrestricted HF on four ranks (same force sum) and one rank (3.12e-7 deviation, below 1e-6). ABACUS v3.11.0-beta10.
@mohanchen

Copy link
Copy Markdown
Collaborator

If this PR is ready for review again, let me know. @maki49

@maki49
maki49 requested a review from mohanchen October 13, 2026 02:13
@maki49

maki49 commented Oct 13, 2026

Copy link
Copy Markdown
Collaborator Author

If this PR is ready for review again, let me know. @maki49

Yes, ready.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep this file as simple as possible, we don't have exx, ofdft, sdft or rt-tddft information here, so I think the codes related to LR-TDDFT can be moved to somewhere else?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about 'exited_state_check' instead of state_check?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this file name still contains 'root'?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this file name contains 'root' ?

@mohanchen

Copy link
Copy Markdown
Collaborator

Did you introduce KXC and LXC in this PR? If so, please make sure to mention it. I noticed that compiling KXC increases the overall CI/CD build time.

@maki49

maki49 commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator Author

Did you introduce KXC and LXC in this PR? If so, please make sure to mention it. I noticed that compiling KXC increases the overall CI/CD build time.

Yes, kxc is necessary for lda/pbe LR force and relax tests. lxc is not introduced. I've mentioned it in the description.
See 61f310e for changes according to your latest requests.

# Conflicts:
#	source/source_lcao/module_lr/utils/test/CMakeLists.txt
#	source/source_lcao/module_ri/test/CMakeLists.txt
#	source/source_lcao/module_ri/unittests/test_exx_lr_ws.cpp

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

EXX and lr-TDDFT Related to EXX or lr-TDDFT Features Needed The features are indeed needed, and developers should have sophisticated knowledge Refactor Refactor ABACUS codes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants