Skip to content

Feature: Plane-wave RT-TDDFT with CPU/GPU and mixed-precision support - #8043

Merged
mohanchen merged 6 commits into
deepmodeling:developfrom
AsTonyshment:tddft_pw
Sep 30, 2026
Merged

mohanchen merged 6 commits into
deepmodeling:developfrom
AsTonyshment:tddft_pw

Conversation

@AsTonyshment

@AsTonyshment AsTonyshment commented Sep 28, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

This PR implements real-time TDDFT with a plane-wave basis for fixed-ion electronic dynamics in molecular and periodic systems. It supports external electric fields in the length and velocity gauges, spin-unpolarized and collinear spin-polarized calculations, and time-dependent current output on CPUs and GPUs, with double- and mixed-precision support.

Time propagation uses a self-consistent Crank-Nicolson predictor-corrector scheme with iterative linear solvers. The implementation integrates with the existing RT-TDDFT field infrastructure and includes user documentation, focused unit tests, and matching CPU/GPU integration tests.

⚠️ IMPORTANT INFORMATION

This PR also fixes a missing Rydberg-to-Hartree conversion in the nonlocal contribution to the velocity operator. The correction changes the calculated transport spectra, so the affected SDFT integration-test references have been regenerated.

Validation

Isolated benzene molecule (C₆H₆): The time-dependent current, dipole response, and optical absorption spectra are compared between the length and velocity gauges, with spectra extracted from both current and dipole signals.

c6h6_current_dipole_combined

Periodic bulk silicon (Si-8, 5×5×5 k-point sampling): The time-dependent current and dielectric function are compared between double- and mixed-precision PW calculations, alongside LCAO results.

si8_current_combined

PS: Oh btw, below is the timing statistics of the bulk Si test (I have no idea why the LCAO benchmark is the slowest...).

Hardware: 2 × Intel Xeon Gold 6348 CPU @2.60GHz, 56 cores in total

si8_timing

@AsTonyshment
AsTonyshment requested review from mohanchen and a lite review from Copilot September 28, 2026 19:46
@AsTonyshment
AsTonyshment removed the request for review from Copilot September 28, 2026 19:48
@AsTonyshment
AsTonyshment requested a lite review from Copilot and removed request for Copilot September 28, 2026 20:48
@mohanchen mohanchen added Features Needed The features are indeed needed, and developers should have sophisticated knowledge Refactor Refactor ABACUS codes GPU & DCU & HPC GPU and DCU and HPC related any issues labels Sep 29, 2026
Copilot AI lite review requested due to automatic review settings September 29, 2026 00:34

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 review overview

🟡 Changes recommended

One or more issues must be addressed before approval.

Review effort: Lite
Findings: 1 High severity · 1 Medium severity

Open (2)
What changed in this PR

Implements plane-wave RT-TDDFT with CPU/GPU, spin, gauge, solver, and precision support, including updated current handling and regression references.

Changes:

  • Adds PW Crank–Nicolson propagation, linear solvers, shifted projectors, and current evaluation.
  • Updates field units, restart/vector-potential output, and related LCAO interfaces.
  • Adds CPU/GPU integration cases and refreshes affected references.

Verification: Static review only; no build or test execution was performed.

File Description
tests/​16_SDFT_GPU/​002_PW_SKG_MALL_GPU/​refOnsager.txt Updated as part of this pull request.
tests/​16_SDFT_GPU/​001_PW_KG_100_GPU/​refOnsager.txt Updated as part of this pull request.
tests/​15_rtTDDFT_GPU/​CASES_GPU.txt Updated as part of this pull request.
tests/​15_rtTDDFT_GPU/​26_PW_single_TDDFT_GPU/​threshold Updated as part of this pull request.
tests/​15_rtTDDFT_GPU/​26_PW_single_TDDFT_GPU/​STRU Updated as part of this pull request.
tests/​15_rtTDDFT_GPU/​26_PW_single_TDDFT_GPU/​result.ref Updated as part of this pull request.
tests/​15_rtTDDFT_GPU/​26_PW_single_TDDFT_GPU/​README Updated as part of this pull request.
tests/​15_rtTDDFT_GPU/​26_PW_single_TDDFT_GPU/​KPT Updated as part of this pull request.
tests/​15_rtTDDFT_GPU/​26_PW_single_TDDFT_GPU/​INPUT Updated as part of this pull request.
tests/​15_rtTDDFT_GPU/​26_PW_single_TDDFT_GPU/​current_tot.txt.ref Updated as part of this pull request.
tests/​15_rtTDDFT_GPU/​25_PW_noprec_TDDFT_GPU/​STRU Updated as part of this pull request.
tests/​15_rtTDDFT_GPU/​25_PW_noprec_TDDFT_GPU/​result.ref Updated as part of this pull request.
tests/​15_rtTDDFT_GPU/​25_PW_noprec_TDDFT_GPU/​README Updated as part of this pull request.
tests/​15_rtTDDFT_GPU/​25_PW_noprec_TDDFT_GPU/​KPT Updated as part of this pull request.
tests/​15_rtTDDFT_GPU/​25_PW_noprec_TDDFT_GPU/​INPUT Updated as part of this pull request.
tests/​15_rtTDDFT_GPU/​25_PW_noprec_TDDFT_GPU/​current_tot.txt.ref Updated as part of this pull request.
tests/​15_rtTDDFT_GPU/​24_PW_cgs_TDDFT_GPU/​STRU Updated as part of this pull request.
tests/​15_rtTDDFT_GPU/​24_PW_cgs_TDDFT_GPU/​result.ref Updated as part of this pull request.
tests/​15_rtTDDFT_GPU/​24_PW_cgs_TDDFT_GPU/​README Updated as part of this pull request.
tests/​15_rtTDDFT_GPU/​24_PW_cgs_TDDFT_GPU/​KPT Updated as part of this pull request.
tests/​15_rtTDDFT_GPU/​24_PW_cgs_TDDFT_GPU/​INPUT Updated as part of this pull request.
tests/​15_rtTDDFT_GPU/​24_PW_cgs_TDDFT_GPU/​current_tot.txt.ref Updated as part of this pull request.
tests/​15_rtTDDFT_GPU/​23_PW_spin_TDDFT_GPU/​STRU Updated as part of this pull request.
tests/​15_rtTDDFT_GPU/​23_PW_spin_TDDFT_GPU/​result.ref Updated as part of this pull request.
tests/​15_rtTDDFT_GPU/​23_PW_spin_TDDFT_GPU/​README Updated as part of this pull request.
tests/​15_rtTDDFT_GPU/​23_PW_spin_TDDFT_GPU/​KPT Updated as part of this pull request.
tests/​15_rtTDDFT_GPU/​23_PW_spin_TDDFT_GPU/​INPUT Updated as part of this pull request.
tests/​15_rtTDDFT_GPU/​23_PW_spin_TDDFT_GPU/​current_tot.txt.ref Updated as part of this pull request.
tests/​15_rtTDDFT_GPU/​22_PW_vel_TDDFT_GPU/​STRU Updated as part of this pull request.
tests/​15_rtTDDFT_GPU/​22_PW_vel_TDDFT_GPU/​result.ref Updated as part of this pull request.
tests/​15_rtTDDFT_GPU/​22_PW_vel_TDDFT_GPU/​README Updated as part of this pull request.
tests/​15_rtTDDFT_GPU/​22_PW_vel_TDDFT_GPU/​KPT Updated as part of this pull request.
tests/​15_rtTDDFT_GPU/​22_PW_vel_TDDFT_GPU/​INPUT Updated as part of this pull request.
tests/​15_rtTDDFT_GPU/​22_PW_vel_TDDFT_GPU/​current_tot.txt.ref Updated as part of this pull request.
tests/​15_rtTDDFT_GPU/​21_PW_len_TDDFT_GPU/​STRU Updated as part of this pull request.
tests/​15_rtTDDFT_GPU/​21_PW_len_TDDFT_GPU/​result.ref Updated as part of this pull request.
tests/​15_rtTDDFT_GPU/​21_PW_len_TDDFT_GPU/​README Updated as part of this pull request.
tests/​15_rtTDDFT_GPU/​21_PW_len_TDDFT_GPU/​KPT Updated as part of this pull request.
tests/​15_rtTDDFT_GPU/​21_PW_len_TDDFT_GPU/​INPUT Updated as part of this pull request.
tests/​15_rtTDDFT_GPU/​21_PW_len_TDDFT_GPU/​current_tot.txt.ref Updated as part of this pull request.
tests/​15_rtTDDFT_GPU/​20_NO_MIXED_EFIELD_TDDFT_GPU/​vector_pot.txt.ref Updated as part of this pull request.
tests/​15_rtTDDFT_GPU/​19_NO_SUPERSINE_TDDFT_GPU/​vector_pot.txt.ref Updated as part of this pull request.
tests/​15_rtTDDFT_GPU/​12_NO_re_TDDFT_GPU/​restart/​Restart_td.txt Updated as part of this pull request.
tests/​11_PW_GPU/​scf_out_wf/​result.ref Updated as part of this pull request.
tests/​05_rtTDDFT/​CASES_CPU.txt Updated as part of this pull request.
tests/​05_rtTDDFT/​26_PW_single_TDDFT/​threshold Updated as part of this pull request.
tests/​05_rtTDDFT/​26_PW_single_TDDFT/​STRU Updated as part of this pull request.
tests/​05_rtTDDFT/​26_PW_single_TDDFT/​result.ref Updated as part of this pull request.
tests/​05_rtTDDFT/​26_PW_single_TDDFT/​README Updated as part of this pull request.
tests/​05_rtTDDFT/​26_PW_single_TDDFT/​KPT Updated as part of this pull request.
tests/​05_rtTDDFT/​26_PW_single_TDDFT/​INPUT Updated as part of this pull request.
tests/​05_rtTDDFT/​26_PW_single_TDDFT/​current_tot.txt.ref Updated as part of this pull request.
tests/​05_rtTDDFT/​25_PW_noprec_TDDFT/​STRU Updated as part of this pull request.
tests/​05_rtTDDFT/​25_PW_noprec_TDDFT/​result.ref Updated as part of this pull request.
tests/​05_rtTDDFT/​25_PW_noprec_TDDFT/​README Updated as part of this pull request.
tests/​05_rtTDDFT/​25_PW_noprec_TDDFT/​KPT Updated as part of this pull request.
tests/​05_rtTDDFT/​25_PW_noprec_TDDFT/​INPUT Updated as part of this pull request.
tests/​05_rtTDDFT/​25_PW_noprec_TDDFT/​current_tot.txt.ref Updated as part of this pull request.
tests/​05_rtTDDFT/​24_PW_cgs_TDDFT/​STRU Updated as part of this pull request.
tests/​05_rtTDDFT/​24_PW_cgs_TDDFT/​result.ref Updated as part of this pull request.
tests/​05_rtTDDFT/​24_PW_cgs_TDDFT/​README Updated as part of this pull request.
tests/​05_rtTDDFT/​24_PW_cgs_TDDFT/​KPT Updated as part of this pull request.
tests/​05_rtTDDFT/​24_PW_cgs_TDDFT/​INPUT Updated as part of this pull request.
tests/​05_rtTDDFT/​24_PW_cgs_TDDFT/​current_tot.txt.ref Updated as part of this pull request.
tests/​05_rtTDDFT/​23_PW_spin_TDDFT/​STRU Updated as part of this pull request.
tests/​05_rtTDDFT/​23_PW_spin_TDDFT/​result.ref Updated as part of this pull request.
tests/​05_rtTDDFT/​23_PW_spin_TDDFT/​README Updated as part of this pull request.
tests/​05_rtTDDFT/​23_PW_spin_TDDFT/​KPT Updated as part of this pull request.
tests/​05_rtTDDFT/​23_PW_spin_TDDFT/​INPUT Updated as part of this pull request.
tests/​05_rtTDDFT/​23_PW_spin_TDDFT/​current_tot.txt.ref Updated as part of this pull request.
tests/​05_rtTDDFT/​22_PW_vel_TDDFT/​STRU Updated as part of this pull request.
tests/​05_rtTDDFT/​22_PW_vel_TDDFT/​result.ref Updated as part of this pull request.
tests/​05_rtTDDFT/​22_PW_vel_TDDFT/​README Updated as part of this pull request.
tests/​05_rtTDDFT/​22_PW_vel_TDDFT/​KPT Updated as part of this pull request.
tests/​05_rtTDDFT/​22_PW_vel_TDDFT/​INPUT Updated as part of this pull request.
tests/​05_rtTDDFT/​22_PW_vel_TDDFT/​current_tot.txt.ref Updated as part of this pull request.
tests/​05_rtTDDFT/​21_PW_len_TDDFT/​STRU Updated as part of this pull request.
tests/​05_rtTDDFT/​21_PW_len_TDDFT/​result.ref Updated as part of this pull request.
tests/​05_rtTDDFT/​21_PW_len_TDDFT/​README Updated as part of this pull request.
tests/​05_rtTDDFT/​21_PW_len_TDDFT/​KPT Updated as part of this pull request.
tests/​05_rtTDDFT/​21_PW_len_TDDFT/​INPUT Updated as part of this pull request.
tests/​05_rtTDDFT/​21_PW_len_TDDFT/​current_tot.txt.ref Updated as part of this pull request.
tests/​05_rtTDDFT/​20_NO_MIXED_EFIELD_TDDFT/​vector_pot.txt.ref Updated as part of this pull request.
tests/​05_rtTDDFT/​19_NO_SUPERSINE_TDDFT/​vector_pot.txt.ref Updated as part of this pull request.
tests/​05_rtTDDFT/​12_NO_re_TDDFT/​restart/​Restart_td.txt Updated as part of this pull request.
source/​source_pw/​module_pwdft/​vnl_pw.h Updated as part of this pull request.
source/​source_pw/​module_pwdft/​velocity_workspace.h Updated as part of this pull request.
source/​source_pw/​module_pwdft/​velocity_workspace.cpp Updated as part of this pull request.
source/​source_pw/​module_pwdft/​td_pw.h Updated as part of this pull request.
source/​source_pw/​module_pwdft/​td_pw.cpp Updated as part of this pull request.
source/​source_pw/​module_pwdft/​td_history_pw.h Updated as part of this pull request.
source/​source_pw/​module_pwdft/​td_history_pw.cpp Updated as part of this pull request.
source/​source_pw/​module_pwdft/​projector_gradient.h Updated as part of this pull request.
source/​source_pw/​module_pwdft/​op_pw_vel.h Updated as part of this pull request.
source/​source_pw/​module_pwdft/​op_pw_veff.h Updated as part of this pull request.
source/​source_pw/​module_pwdft/​op_pw_nl.h Updated as part of this pull request.
source/​source_pw/​module_pwdft/​op_pw_nl_td.h Updated as part of this pull request.
source/​source_pw/​module_pwdft/​op_pw_nl_td.cpp Updated as part of this pull request.
source/​source_pw/​module_pwdft/​op_pw_meta.h Updated as part of this pull request.
source/​source_pw/​module_pwdft/​op_pw_ekin_td.h Updated as part of this pull request.
source/​source_pw/​module_pwdft/​op_pw_ekin_td.cpp Updated as part of this pull request.
source/​source_pw/​module_pwdft/​nonlocal_workspace.h Updated as part of this pull request.
source/​source_pw/​module_pwdft/​nonlocal_maths.hpp Updated as part of this pull request.
source/​source_pw/​module_pwdft/​kernels/​rocm/​projector_gradient_op.hip.cu Updated as part of this pull request.
source/​source_pw/​module_pwdft/​kernels/​projector_gradient_op.cpp Updated as part of this pull request.
source/​source_pw/​module_pwdft/​kernels/​cuda/​projector_gradient_op.cu Updated as part of this pull request.
source/​source_pw/​module_pwdft/​hamilt_pw.h Updated as part of this pull request.
source/​source_pw/​module_pwdft/​hamilt_pw.cpp Updated as part of this pull request.
source/​source_pw/​module_pwdft/​CMakeLists.txt Updated as part of this pull request.
source/​source_psi/​setup_psi_pw.h Updated as part of this pull request.
source/​source_psi/​setup_psi_pw.cpp Updated as part of this pull request.
source/​source_md/​test/​verlet_test.cpp Updated as part of this pull request.
source/​source_md/​test/​nhchain_test.cpp Updated as part of this pull request.
source/​source_md/​test/​msst_test.cpp Updated as part of this pull request.
source/​source_md/​test/​langevin_test.cpp Updated as part of this pull request.
source/​source_md/​test/​fire_test.cpp Updated as part of this pull request.
source/​source_md/​md_base.cpp Updated as part of this pull request.
source/​source_lcao/​module_rt/​td_info.h Updated as part of this pull request.
source/​source_lcao/​module_rt/​force_rt_overlap.cpp Updated as part of this pull request.
source/​source_lcao/​module_operator_lcao/​test/​tmp_mocks.cpp Updated as part of this pull request.
source/​source_lcao/​module_operator_lcao/​td_pot_hybrid.cpp Updated as part of this pull request.
source/​source_lcao/​module_operator_lcao/​td_pot_hybrid_fs.cpp Updated as part of this pull request.
source/​source_lcao/​module_operator_lcao/​td_nonlocal_lcao.cpp Updated as part of this pull request.
source/​source_lcao/​module_operator_lcao/​td_ekinetic_lcao.cpp Updated as part of this pull request.
source/​source_lcao/​module_operator_lcao/​overlap.cpp Updated as part of this pull request.
source/​source_lcao/​module_operator_lcao/​operator_lcao.cpp Updated as part of this pull request.
source/​source_lcao/​module_deepks/​test/​mock_tdinfo.cpp Updated as part of this pull request.
source/​source_io/​test/​td_efield_io_test.cpp Updated as part of this pull request.
source/​source_io/​module_parameter/​input_parameter.h Updated as part of this pull request.
source/​source_io/​module_parameter/​input_conv.cpp Updated as part of this pull request.
source/​source_io/​module_efield/​td_vector_pot_io.cpp Updated as part of this pull request.
source/​source_io/​module_efield/​td_efield_io.cpp Updated as part of this pull request.
source/​source_io/​module_current/​td_current_pw.h Updated as part of this pull request.
source/​source_io/​module_current/​td_current_io_comm.cpp Updated as part of this pull request.
source/​source_io/​module_ctrl/​ctrl_output_td.cpp Updated as part of this pull request.
source/​source_io/​module_ctrl/​ctrl_output_pw.h Updated as part of this pull request.
source/​source_io/​module_ctrl/​ctrl_output_pw.cpp Updated as part of this pull request.
source/​source_io/​CMakeLists.txt Updated as part of this pull request.
source/​source_hsolver/​test/​linear_test_utils.h Updated as part of this pull request.
source/​source_hsolver/​test/​CMakeLists.txt Updated as part of this pull request.
source/​source_hsolver/​linear_workspace.h Updated as part of this pull request.
source/​source_hsolver/​linear_solver_types.h Updated as part of this pull request.
source/​source_hsolver/​linear_operator.h Updated as part of this pull request.
source/​source_hsolver/​linear_cgs.h Updated as part of this pull request.
source/​source_hsolver/​linear_bicgstab.h Updated as part of this pull request.
source/​source_hsolver/​kernels/​linear_op.h Updated as part of this pull request.
source/​source_hsolver/​hsolver_pw_tddft.h Updated as part of this pull request.
source/​source_hsolver/​hsolver_linear.h Updated as part of this pull request.
source/​source_hsolver/​hsolver_linear.cpp Updated as part of this pull request.
source/​source_hsolver/​CMakeLists.txt Updated as part of this pull request.
source/​source_hamilt/​operator.h Updated as part of this pull request.
source/​source_estate/​uspp_density.cpp Updated as part of this pull request.
source/​source_estate/​test/​td_field_test.cpp Updated as part of this pull request.
source/​source_estate/​test/​elecstate_pw_test.cpp Updated as part of this pull request.
source/​source_estate/​module_pot/​td_field.h Updated as part of this pull request.
source/​source_estate/​module_pot/​td_field_manager.h Updated as part of this pull request.
source/​source_estate/​module_pot/​h_tddft_pw.h Updated as part of this pull request.
source/​source_estate/​module_pot/​h_tddft_pw.cpp Updated as part of this pull request.
source/​source_esolver/​esolver_ks.h Updated as part of this pull request.
source/​source_esolver/​esolver_ks.cpp Updated as part of this pull request.
source/​source_esolver/​esolver_ks_pw.cpp Updated as part of this pull request.
source/​source_esolver/​esolver_ks_pw_tddft.h Updated as part of this pull request.
source/​source_esolver/​esolver_ks_lcao.cpp Updated as part of this pull request.
source/​source_esolver/​esolver_factory.cpp Updated as part of this pull request.
source/​source_esolver/​esolver_dfpt_pw.cpp Updated as part of this pull request.
source/​source_esolver/​CMakeLists.txt Updated as part of this pull request.
source/​source_basis/​module_pw/​pw_momentum.h Updated as part of this pull request.
source/​Makefile.Objects Updated as part of this pull request.
source/​Makefile Updated as part of this pull request.
source/​CMakeLists.txt Updated as part of this pull request.
docs/​generate_input_main.py Updated as part of this pull request.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread source/source_estate/module_pot/h_tddft_pw.cpp
Comment thread source/source_pw/module_pwdft/hamilt_pw.cpp

@Critsium-xy Critsium-xy left a comment

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.

Additional issue outside the diff:

PW RT-TDDFT logs have no SCF headers. ESolver_KS::iter_init skips write_head for esolver_type == "tddft", assuming the runner prints write_head_td itself (LCAO does, esolver_ks_lcao_tddft.cpp:265). ESolver_KS_PW_TDDFT has no equivalent, so running_*.log contains no step/iter headers for either the ground-state SCF or the propagation steps.

Comment thread source/source_esolver/esolver_ks_pw_tddft.cpp Outdated
Comment thread source/source_estate/module_pot/td_field_manager.cpp
Comment thread source/source_esolver/esolver_ks_pw_tddft.h
Comment thread source/source_esolver/esolver_ks.cpp Outdated
@AsTonyshment

Copy link
Copy Markdown
Collaborator Author

Additional issue outside the diff:

PW RT-TDDFT logs have no SCF headers. ESolver_KS::iter_init skips write_head for esolver_type == "tddft", assuming the runner prints write_head_td itself (LCAO does, esolver_ks_lcao_tddft.cpp:265). ESolver_KS_PW_TDDFT has no equivalent, so running_*.log contains no step/iter headers for either the ground-state SCF or the propagation steps.

Fixed. PW RT-TDDFT now prints the standard RT-TDDFT step and iteration headers for both the initial ground-state SCF and subsequent propagation steps.

@AsTonyshment AsTonyshment changed the title Feature: Plane-wave RT-TDDFT with GPU and mixed-precision support Feature: Plane-wave RT-TDDFT with CPU/GPU and mixed-precision support Sep 29, 2026
@mohanchen

Copy link
Copy Markdown
Collaborator

Well done! This is another big step of ABACUS.

@mohanchen
mohanchen merged commit 9602380 into deepmodeling:develop Sep 30, 2026
18 checks passed
Critsium-xy added a commit to Critsium-xy/abacus-develop that referenced this pull request Sep 30, 2026
.editorconfig has required `indent_style = space` with `indent_size = 4`
for the whole repository, but 339 files under source/ still indent with
tabs. This converts the leading whitespace of 246 of them.

253 files were selected when this was prepared. Since then, develop has
deleted two of them and already converted five others, which leaves 246:

  - deleted: source_lcao/setup_dm.h (deepmodeling#8000),
    source_pw/module_stodft/hamilt_sdft_pw.cpp (deepmodeling#8012);
  - already converted: source_base/module_out/binstream.{h,cpp} (deepmodeling#8025),
    source_pw/module_stodft/sto_hamilt_pw.h (renamed from
    hamilt_sdft_pw.h in deepmodeling#8012), source_io/module_ctrl/ctrl_output_pw.h
    and source_pw/module_pwdft/op_pw_nl.cpp (deepmodeling#8043).

Files that develop moved are converted at their new path, e.g.
onsite_proj_tools_stress.cpp is now under source_pw/module_proj/
(deepmodeling#8007).

Scope. Three groups were deliberately left out:

  - 48 files touched by the pull requests open at the time of writing
    (deepmodeling#8000, deepmodeling#7924, deepmodeling#7906, deepmodeling#8005 and others), so this does not force a
    conflict on work in flight;
  - 5 vendored files: source_base/libm/ is ported from glibc-2.36 and
    carries its own LICENCE, and source_base/mcd.c is Softpixel
    MemCheckDeluxe under a BSD licence. Reformatting vendored sources
    makes future syncs with their upstream harder;
  - tabs that appear after the first non-blank character (alignment
    tabs, 1193 lines). Only leading indentation is converted.

Method and verification. `expand -i -t4`, which rewrites the initial
whitespace of a line and nothing else, followed by three checks:

  - `git diff -w --stat` is empty, so not one non-whitespace character
    changed anywhere in the diff;
  - of the 42 raw string literals in the changed files (222 lines, all
    in source_io/module_parameter/read_inp_out.cpp), none has a line
    that this commit touches. Leading whitespace inside `R"(...)"` is
    part of the string, so that was the one place a leading-whitespace
    rewrite could have changed behaviour;
  - no changed line follows a line ending in a backslash, so no
    backslash-continued string literal is affected either;
  - no file gained a CR.

Effect on tools/03_code_analysis/code_quality_score.py: average score
over source/ goes from 82.15 to 82.58 and the number of passing files
from 1560 to 1562.

Six files score 1 to 3 points lower, all through the `line_too_long`
rule, because the scorer counts a tab as a single character while it
renders as up to four columns. The lines were already over 120 columns
on screen; the tab was hiding it. One of them,
module_ri/exx_abfs_ctor_orbs.cpp, moves from 60 to 59 and so drops just
below the tool's pass line. Wrapping those lines would mean editing code
in a commit that is otherwise whitespace-only, so it is left for a
follow-up.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@AsTonyshment
AsTonyshment deleted the tddft_pw branch September 30, 2026 02:10
mohanchen pushed a commit that referenced this pull request Sep 30, 2026
…o spaces (#8011)

* docs: fix two @file tags that name a different file

Doxygen's @file takes the name of the file it documents. These two
name a file that does not exist, so Doxygen attributes the block to the
wrong (or to no) file:

  source_base/ndarray.h                  said NDArray.h
  source_lcao/module_rt/band_energy.h    said bandenegy.h (also a typo)

Found by tools/03_code_analysis/code_quality_score.py (rule
doc_file_mismatch). The scan also flagged
source_pw/module_pwdft/radial_proj.h (said radial_projection.h), but
#8007 has since moved that header to source_pw/module_proj/ with the
tag already corrected, so it is no longer part of this commit.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* style: convert leading tab indentation to spaces in 246 source files

.editorconfig has required `indent_style = space` with `indent_size = 4`
for the whole repository, but 339 files under source/ still indent with
tabs. This converts the leading whitespace of 246 of them.

253 files were selected when this was prepared. Since then, develop has
deleted two of them and already converted five others, which leaves 246:

  - deleted: source_lcao/setup_dm.h (#8000),
    source_pw/module_stodft/hamilt_sdft_pw.cpp (#8012);
  - already converted: source_base/module_out/binstream.{h,cpp} (#8025),
    source_pw/module_stodft/sto_hamilt_pw.h (renamed from
    hamilt_sdft_pw.h in #8012), source_io/module_ctrl/ctrl_output_pw.h
    and source_pw/module_pwdft/op_pw_nl.cpp (#8043).

Files that develop moved are converted at their new path, e.g.
onsite_proj_tools_stress.cpp is now under source_pw/module_proj/
(#8007).

Scope. Three groups were deliberately left out:

  - 48 files touched by the pull requests open at the time of writing
    (#8000, #7924, #7906, #8005 and others), so this does not force a
    conflict on work in flight;
  - 5 vendored files: source_base/libm/ is ported from glibc-2.36 and
    carries its own LICENCE, and source_base/mcd.c is Softpixel
    MemCheckDeluxe under a BSD licence. Reformatting vendored sources
    makes future syncs with their upstream harder;
  - tabs that appear after the first non-blank character (alignment
    tabs, 1193 lines). Only leading indentation is converted.

Method and verification. `expand -i -t4`, which rewrites the initial
whitespace of a line and nothing else, followed by three checks:

  - `git diff -w --stat` is empty, so not one non-whitespace character
    changed anywhere in the diff;
  - of the 42 raw string literals in the changed files (222 lines, all
    in source_io/module_parameter/read_inp_out.cpp), none has a line
    that this commit touches. Leading whitespace inside `R"(...)"` is
    part of the string, so that was the one place a leading-whitespace
    rewrite could have changed behaviour;
  - no changed line follows a line ending in a backslash, so no
    backslash-continued string literal is affected either;
  - no file gained a CR.

Effect on tools/03_code_analysis/code_quality_score.py: average score
over source/ goes from 82.15 to 82.58 and the number of passing files
from 1560 to 1562.

Six files score 1 to 3 points lower, all through the `line_too_long`
rule, because the scorer counts a tab as a single character while it
renders as up to four columns. The lines were already over 120 columns
on screen; the tab was hiding it. One of them,
module_ri/exx_abfs_ctor_orbs.cpp, moves from 60 to 59 and so drops just
below the tool's pass line. Wrapping those lines would mean editing code
in a commit that is otherwise whitespace-only, so it is left for a
follow-up.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Features Needed The features are indeed needed, and developers should have sophisticated knowledge GPU & DCU & HPC GPU and DCU and HPC related any issues Refactor Refactor ABACUS codes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants