Skip to content

Fix part of 6608: Make IO output self-describing: running-log messages, cube data_desc, and ofs_running parameterization - #8068

Open
mohanchen wants to merge 40 commits into
deepmodeling:developfrom
mohanchen:2026-10-02-6
Open

mohanchen wants to merge 40 commits into
deepmodeling:developfrom
mohanchen:2026-10-02-6

Conversation

@mohanchen

@mohanchen mohanchen commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

fix part of #6608 fix #8096

Summary

This PR improves the readability and consistency of ABACUS IO output (running log and .cube files) and removes a class of default-argument debt (Rule 5) from the IO layer. The work is split into three themes that build on each other.

1. Running-log messages: label what is being written

The running log previously contained many bare Write data to file: ... lines that did not say what data was written. This PR adds descriptive labels and spin tags so each line is self-describing:

  • Sparse matrix outputs (out_mat_h, out_mat_dh, out_mat_*) now report Write H matrix ..., Write dH matrix ..., etc., with per-spin/channel tags where applicable.
  • Cube outputs now carry a data_desc string at every call site (charge density, partial charge, effective/electrostatic potential, kinetic energy density, electron localization function, local DOS, wave function norm/real/imag, exciton density). The spin tag is owned by the caller through make_data_desc (cube_io.h) instead of being inferred from is inside write_vdata_palgrid, so spin-summed (is = -1) and 1-based-index callers are labeled correctly. nspin=4 magnetic channels are labeled magnetization density m{x,y,z} (rho[1..3]) and effective magnetic field b{x,y,z} (the B_xc components of the potential) instead of bare "charge density" / "effective potential" for all four channels.
  • Removed the pre-write Writing cube file <name> log lines in get_pchg_lcao.cpp / get_wf_lcao.cpp that duplicated the Write ... to file: line now emitted by write_vdata_palgrid.
  • H(R) CSR header uses an explicit has_efermi flag instead of string-matching the label, and the running-log banner for Fermi energy is emitted through a single path. The CSR header example in docs/advanced/elec_properties/hs_matrix.md is updated for the , E_Fermi = <value> eV annotation.

Tests:

  • test_hsr_writer.cpp gains a text-CSR case covering per-spin Fermi sourced from Efermi; fixed under single-rank __MPI (the Parallel_Orbitals source must call set_atomic_trace before gatherParallels, otherwise get_nnrow_atom throws on nat==0).
  • Refreshed hrs*.csr.ref for scf_out_hsr_spin2 to carry the E_Fermi header.
  • Fixed Fermi-energy assertions in hsr_writer and output_log unittests.

2. Cube filename normalization

.cube filenames are now lowercase, short, and consistent with the chg.cube / chgs1.cube / pot.cube / wfi1s1k1re.cube family. Indices start from 1 and carry a short suffix indicating their meaning (s = spin, k = k-point, g = geometry step, st = state, i = band index).

  • SPIN1_CHG.cube → chgs1.cube (esolver_dm2rho).
  • LDOS_<en>eV.cube → ldos_<en>ev.cube (cal_ldos; updated stm.py, catch_properties.sh, result.ref, README; git mv LDOS.cube.ref → ldos.cube.ref).
  • Exciton_avg_<type>_state<n>_spin<s>.cube → exc_<type>_st<n+1>_s<s+1>.cube (exciton_plotter; indices now start from 1). The matching .dat slice filename is renamed the same way, and the conditional-slice .dat becomes exc_cond_<type>_slice_st<n+1>.dat so one run no longer mixes Exciton_cond_..._state<N> (0-based) with exc_..._st<N+1> names for the same state.
  • chg_init.cpp reads tau from tau.cube / taus1.cube (instead of legacy SPIN1_TAU.cube / SPIN<n>_TAU.cube), aligning with the charge read path. The probe distinguishes nspin==1 vs nspin>1.
  • Removed dead std::remove("./support/OLD2_SPIN1_CHG.cube") in test_chg_extra.cpp (no code path generates that file).
  • Help text and docs that describe the historical 3.10-LTS filenames (SPIN1_CHG.cube etc.) are intentionally left in place.

3. Parameterize ofs_running through IO output chains (Rule 5)

The IO output layer used to read GlobalV::ofs_running directly in many leaf and mid-level functions. This PR threads std::ofstream& ofs_running explicitly through:

  • write_vdata_palgrid (cube_io.h), write_bands / nscf_bands, save_dH_sparse / output_dHR / output_dSR / output_TR / output_SR / output_mat_sparse, cal_ldos_lcao / cal_ldos_pw / stm_mode_pw / ldos_mode_pw, write_elf, write_chg_init / write_pot_init, Get_pchg_pw / Get_wf_pw begin + write_cube helpers, Get_pchg_lcao / Get_wf_lcao begin, ctrl_iter_pw / ctrl_scf_pw / ctrl_runner_pw / ctrl_runner_lcao / ctrl_output_fp, plus their explicit template instantiations (CPU/GPU, double/complex).
  • All esolver / non-IO boundary call sites pass GlobalV::ofs_running once at the boundary; the IO layer itself no longer reads the global.

Additionally, two historical default arguments are removed (Rule 5) and every caller now passes the value explicitly:

  • cube_io.h: removed data_desc = "data"; all 22 call sites pass a descriptive string (see theme 1).
  • write_bands.h: removed nspin0 = 1; 4 test call sites in write_bands_test.cpp now pass 1 explicitly.

Governance notes

  • GlobalV dependency: net non-increasing at the PR level. The IO layer no longer reads GlobalV::ofs_running; reads are now concentrated at the esolver/control boundary (one std::ofstream& ofs_running = GlobalV::ofs_running; alias in ctrl_scf_lcao.cpp is a local alias, not a new global read).
  • Rule 5: two default arguments removed; all call sites updated. write_cube's ndata_line = 6 remains as pre-existing debt (out of scope here).
  • Header includes: 4 <fstream> additions in headers that now carry std::ofstream& parameters; each is required by the new signature.

Test plan

  • make -j 30 passes.
  • ctest --test-dir build -V -R "rho_io|write_bands|hsr_writer|dhs_sparse|output_mat_sparse|CHARGE_extra" — 8/8 pass (MODULE_CHARGE_extra, MODULE_IO_rho_io, MODULE_IO_write_bands, MODULE_IO_write_bands_parallel, MODULE_IO_hsr_writer_test, MODULE_IO_hsr_writer_test_parallel, MODULE_IO_dhs_sparse_writer_test, MODULE_IO_output_mat_sparse_test).
  • python3 tools/03_code_analysis/code_quality_score.py on the 66 changed C++ files at head 2427fe3afe: average 73.5 (pass line 60), 52/66 pass. 14 files below 60 are pre-existing debt (tab_indentation, global_dependency, too_many_parameters) not introduced by this PR: ctrl_scf_lcao.cpp 0, esolver_ks_lcao.cpp 31, ctrl_output_pw.cpp 32, cal_ldos.cpp 33, dhs_sparse_writer.cpp 41, ctrl_output_fp.cpp 43, ctrl_runner_lcao.cpp 50, esolver_ks_pw.cpp 55, cal_ldos.h 55, exciton_plotter.cpp 56, test_chg_extra.cpp 57, esolver_fp.cpp 58, esolver_gets.cpp 58, pos_op_writer.cpp 59.
  • CASES_CPU.txt / CASES_GPU.txt (03_NAO_multik): newly enable scf_out_hsr_spin2 — it was previously in neither CI list, and its hrs{1,2}_nao.csr.ref were refreshed in this PR for the E_Fermi header, so CI now covers the new format. Three commented-out placeholders (#scf_out_hsr_npz, #scf_out_hr_npz, #scf_out_dm_npz) are reserved for future npz cases and have no effect.
  • catch_properties.sh strips the , E_Fermi = ... eV header annotation (printed with setprecision(6), ~1e-4 eV resolution) before the 1e-8 CSR token comparison, avoiding platform-dependent rounding failures on the header value; matrix tokens still compare at 1e-8.
  • Full integrate/regression suite (tests/integrate) — to be run on the CI side; catch_properties.sh updated for the new ldos_<en>ev.cube filename.
  • Manual dispatch run required for workflow_dispatch-only workflows (e.g. interface.yml).

The TB2J interface (issue deepmodeling#6608) reads the Fermi energy from ABACUS output
to set the upper bound of the Green's-function integral, but the
"EFERMI = ... eV" line was removed from output_efermi on 2025-06-22 and
the CSR header of H(R) carried no Fermi information either.

- output_log: output_efermi now takes elecstate::Efermi and prints
  " E_Fermi = <ef> eV" or " E_Fermi = <up> <down> eV    # two fermi
  energies (up, down)" when two_efermi is set.
- hsr_writer: write_hcontainer_csr accepts an extra efermi_eV argument
  and appends ", E_Fermi = <value> eV" to the "# spin index" header line
  only when label == "H". write_hsr threads elecstate::Efermi through
  and converts each spin channel via Efermi::get_efval(ispin).
- esolver_fp / ctrl_scf_lcao: pass pelec->eferm down to the writers.
- write_dh / hterm_writer: pass 0.0 for the Fermi argument since dH/dR
  and other derived terms are not Hamiltonians and must not carry the
  Fermi annotation.
- unit tests: migrate OutputEfermiTest to the Efermi signature, add
  TestSingleFermi / TestTwoFermi content checks; extend hsr_writer
  unittests with per-channel Fermi header coverage and an "S(R) has no
  E_Fermi" assertion; link fp_energy.cpp into MODULE_IO_hsr_writer_test.
- integration reference: refresh scf_out_hsr/hrs1_nao.csr.ref with the
  new header line; remaining hrs*.csr.ref files will follow after their
  reference Fermi values are confirmed.
@mohanchen
mohanchen requested a review from Critsium-xy October 2, 2026 09:21
@mohanchen mohanchen added Input&Output Suitable for coders without knowing too many DFT details Refactor Refactor ABACUS codes The Absolute Zero Reduce the "entropy" of the code to 0 labels Oct 2, 2026
@mohanchen mohanchen changed the title Fix 6608: Fix(TB2J): restore Fermi energy in H(R) CSR header and running log Fix #6608: Fix(TB2J): restore Fermi energy in H(R) CSR header and running log Oct 2, 2026
@mohanchen mohanchen changed the title Fix #6608: Fix(TB2J): restore Fermi energy in H(R) CSR header and running log Fix(TB2J): restore Fermi energy in H(R) CSR header and running log Oct 2, 2026
@mohanchen mohanchen changed the title Fix(TB2J): restore Fermi energy in H(R) CSR header and running log Fix part of 6608: (TB2J) restore Fermi energy in H(R) CSR header and running log Oct 2, 2026
abacus_fixer added 5 commits October 2, 2026 21:44
- test_hsr_writer: expect setprecision(6) significant-digit output
  (5.4321 / 3.2109) instead of fixed 6-decimal strings; write the two
  spin channels to separate files since istep=0 opens in truncate mode
  and the second write was overwriting the first.
- outputlog_test: recompute expected E_Fermi values with the actual
  ModuleBase::Ry_to_eV = 13.605698 constant instead of 13.605693122994.

Verified: ctest -R "MODULE_IO_hsr_writer_test|MODULE_IO_output_log_test"
passes 3/3.
@mohanchen mohanchen added Machine Learning & AI Issues related to AI Interfaces Interfaces with other packages labels Oct 2, 2026
Report each matrix file with a consistent "Write <X> matrix in NAO
basis to file:" line in running log so users can see the write action:
H(R), S(R), T(R), r(R), and dH/dR components now all follow the
eig/occ message style. Drop the redundant "#Print out dH/dR
components#" banner. Pass ofs_running into write_hsr, out_lat_r, and
out_rR instead of reading GlobalV inside the IO layer.
@mohanchen mohanchen changed the title Fix part of 6608: (TB2J) restore Fermi energy in H(R) CSR header and running log Fix part of 6608: (TB2J) restore Fermi energy in H(R) CSR header and running log, adding output information for most out_* commands Oct 2, 2026
@mohanchen mohanchen changed the title Fix part of 6608: (TB2J) restore Fermi energy in H(R) CSR header and running log, adding output information for most out_* commands Fix part of 6608: (TB2J) restore Fermi energy in H(R) CSR header and running log, adding output information for most out_* input keywords Oct 2, 2026
abacus_fixer and others added 9 commits October 3, 2026 07:14
Print "Write H(R) (<term> term) matrix in NAO basis to file: <fname>"
for the individual Hamiltonian terms (kinetic/nonlocal/local/hartree/
xc/exx) when out_mat_h_t/vnl/vl/vh/vxc/exx writes their H(R) CSR
files. Thread ofs_running through WriteHParams and gather_and_write
instead of reading GlobalV inside the IO layer.
Print "Write dH/dR (<term> term) matrix in NAO basis to file: <fname>"
for each dH/dR component CSR file written by out_mat_dh and
out_mat_dh_t/vnl/vl/vh/vxc/exx (including the Pulay variants and the
total dH sum). Thread ofs_running through WriteDHParams and pass a
term name into write_dh_perI instead of reading GlobalV in the IO
layer.
Add "Write <X> matrix in NAO basis to file" running-log lines for the
matrix outputs that previously stayed silent: DM(R) (out_dmr), DM(k)
(out_dmk, replacing a commented-out cout), dS/dR (out_mat_ds, and fix
the label that hardcoded "dH/dR" for dS files), T(k) (out_mat_tk),
L(R) (out_mat_l, replacing the large banner), and Vxc(R) (out_mat_xc2).

Mark spin-polarized channels as "(spin up  )"/"(spin down)" padded to
equal width before the word "matrix" so consecutive lines stay aligned.
Thread ofs_running through the IO functions (write_dmr, write_dmk,
write_Vxc_R) instead of reading GlobalV inside the IO layer.
…sages

Move the generic "Write data to file" message out of the low-level
ModuleIO::write_cube (shared by all volumetric outputs) up into
write_vdata_palgrid, which knows the spin component. Add a data_desc
parameter (default "data") so the charge/potential call sites can pass
"charge density" and "potential", and annotate spin-polarized files
with "(spin up  )"/"(spin down)".

Do the same for out_band: thread nspin0 into nscf_bands so bands1/bands2
are labeled by spin channel. eig_occ.txt holds all spins in one file and
stays unlabeled.
Cache the global running-log stream in a local std::ofstream& at the
top of ctrl_scf_lcao and pass that reference onward, instead of naming
GlobalV::ofs_running at each call site. This drops the repeated global
references (13 -> 1) and brings the PR's global-dependency budget back
below zero.
# Conflicts:
#	source/source_io/module_dhs/write_dh.h
#	source/source_io/module_dhs/write_dh_terms.cpp
Comment thread source/source_io/module_output/output_log.cpp
Comment thread source/source_io/module_output/output_log.cpp
Comment thread tests/03_NAO_multik/scf_out_hsr/hrs1_nao.csr.ref
Comment thread source/source_io/module_hs/unittests/test_hsr_writer.cpp
Comment thread source/source_io/module_hs/hsr_writer.cpp Outdated
Comment thread source/source_io/module_ctrl/ctrl_scf_lcao.cpp
Comment thread source/source_io/module_dm/write_dmk.cpp
Comment thread source/source_io/module_hs/hterm_writer.cpp Outdated
Comment thread tests/03_NAO_multik/scf_deltaspin4/README Outdated
abacus_fixer added 2 commits October 6, 2026 16:50
Add the ', E_Fermi = 10.3798 eV' annotation to the '# spin index' line
of hrs1_nao.csr.ref and hrs2_nao.csr.ref so the reference matches the
output of write_hcontainer_csr. The Fermi value (10.3798 eV) is taken
from the last E_Fermi row of the energy table in running_scf.log.
… write_hcontainer_csr

The previous implementation keyed the Fermi-energy annotation on the
string label == "H" and used 0.0 as a sentinel for 'no Fermi value'.
That silently emitted 'E_Fermi = 0 eV' when a caller wrote an H(R)
file without a Fermi value available (e.g. the gamma-folded test),
which looks like a real value.

Add an explicit 'const bool has_efermi' parameter to write_hcontainer_csr.
The spin-index header line now appends ', E_Fermi = <value> eV' iff
has_efermi is true, independent of label. Update all call sites:

  - write_hsr: H(R) -> true, S(R) -> false
  - write_h_term (T/V^NL/V^L/V^H/V^XC): false
  - write_dh_perI (dH/dR components): false
  - unittests: pass true/false explicitly

Add a Not(HasSubstr("E_Fermi")) assertion to GammaFoldedHeaderKeepsCsrReadable
to lock in that label="H" + has_efermi=false produces no Fermi line.
abacus_fixer added 7 commits October 6, 2026 17:10
output_efermi took 'std::ofstream& ofs_running = GlobalV::ofs_running'
as a default argument, which hides the GlobalV dependency at every
call site that omits it. Remove the default so the stream is always
passed explicitly; update the single production caller in esolver_fp.
…output_log.h

output_convergence_after_scf, output_after_relax, and output_vacuum_level
each declared 'std::ofstream& ofs_running = GlobalV::ofs_running'. Remove
all three defaults so the stream is always passed explicitly at every
call site, matching the treatment of output_efermi in the previous commit.

Update the two production callers that relied on the default:
  - esolver_fp.cpp: pass GlobalV::ofs_running to output_convergence_after_scf
  - write_elecstat_pot.cpp: pass GlobalV::ofs_running to output_vacuum_level

With this change, no function in output_log.h carries a GlobalV default
argument. The GlobalV references added at the two call sites are explicit
rather than hidden behind a default.
The comment claimed 'dH/dR and similar derived terms are not the
Hamiltonian', but gather_and_write writes the H(R) component term
matrices (T, V^NL, V^L, V^H, V^XC, V^EXX), not dH/dR. dH/dR output
lives in write_dh.cpp. Reword the comment to reflect that these are
parts of the Hamiltonian, not the full H(R), and therefore do not
carry the Fermi energy annotation.
write_dmk emitted one 'Write DM(k) ... matrix to file: <fn>' line per
(k-point, spin) file. With dense k-meshes this noticeably bloats
running_*.log. Remove the per-file log line from the inner loop and
emit one summary line after the loops finish (rank 0 only), giving the
output directory and the total number of files written. Failed file
creation still triggers a WARNING for each failed file.
The previous commit in this PR replaced the 47-line README (root-cause
analysis of the np>=3 stress chaos, measured deviations per np/OMP
setting, threshold rationale, and follow-up fix plan) with a one-line
summary. That change is unrelated to this PR (Fermi energy output and
running-log message unification) and dropped valuable diagnostic
information. Restore the original README in full; the threshold change
should be proposed in a separate PR that also keeps the rationale and
the planned fixes.
The only existing write_hsr test uses out_type=2 (binary), which skips
the Fermi-energy branch entirely. Add WriteHsrTextCsrCarriesPerSpinFermiFromEfermi
which drives write_hsr with out_type=1, two_efermi=true, ef_up=0.5 Ry
and ef_dw=0.3 Ry, and asserts that hrs1_nao.csr / hrs2_nao.csr carry
ef_up*Ry_to_eV / ef_dw*Ry_to_eV in the '# spin index' header line.

This covers the actual fix path in write_hsr:
  eferm.get_efval(ispin) * ModuleBase::Ry_to_eV
which was previously untested (the write_hcontainer_csr tests pass eV
values directly, bypassing the conversion).
Comment thread source/source_io/module_hs/unittests/test_hsr_writer.cpp Outdated
Comment thread source/source_io/module_output/output_log.cpp
Comment thread source/source_io/module_output/write_cube.cpp Outdated
Comment thread tests/03_NAO_multik/scf_out_hsr_spin2/hrs1_nao.csr.ref
Comment thread source/source_io/module_energy/write_bands.h Outdated
abacus_fixer added 6 commits October 8, 2026 09:20
The WriteHsrTextCsrCarriesPerSpinFermiFromEfermi case crashed with an
unknown C++ exception / segfault when the unit-test build defines
__MPI but runs on one rank:

- write_hsr builds a serial pv and calls gatherParallels; passing
  iat2iwt=nullptr with nat=0 made get_nrow_atom(0) throw on the
  gather path.
- gatherParallels also reaches get_indexes_row(iat) on the source pv,
  which dereferences iat2iwt_; init_serial_orbitals never sets it.
- append=false with istep=0 produced hrs*g1_nao.csr names while the
  test read hrs*_nao.csr.

Install a real iat2it/iat2iwt map, set the atomic trace on the source
pv, and switch the call to append=true so the generated names match
the asserted files. Remove the generated S(R) file afterwards.

Verified: make -j 30; MODULE_IO_hsr_writer_test 21 passed + 1 expected
skip, MODULE_IO_hsr_writer_test_parallel (np=2) passed (2/2 ctest).
Pass the running-log stream explicitly from the esolver/control boundary
down to the leaf output writers instead of reading GlobalV::ofs_running
inside the IO layer.

Leaf writers gain a std::ofstream& ofs_running parameter:
- write_vdata_palgrid, save_dH_sparse, write_elf, write_chg_init, write_pot_init

Mid-layer functions updated (signatures, definitions, explicit
instantiations, and internal call sites):
- write_bands / nscf_bands
- output_dHR / output_dSR / output_SR / output_TR
- output_mat_sparse
- Cal_ldos::cal_ldos_lcao, cal_ldos_pw / stm_mode_pw / ldos_mode_pw
- Get_pchg_pw / Get_wf_pw (begin / write_separate / write_summed /
  write_norm / write_complex / write_cube)
- ctrl_iter_pw / ctrl_scf_pw / ctrl_runner_pw
- ctrl_runner_lcao, ctrl_output_fp
- write_dos_pw

esolver boundary passes GlobalV::ofs_running:
esolver_ks, esolver_ks_pw, esolver_ks_lcao, esolver_fp, esolver_gets.

Non-IO boundary call sites (esolver_dm2rho, write_elecstat_pot,
exciton_plotter, get_pchg_lcao, get_wf_lcao) pass GlobalV::ofs_running
directly.

Tests updated to pass a std::ofstream instance:
rho_io_test, write_bands_test, test_dhs_sparse_writer.

No INPUT behavior change; docs not required.
- cube_io.h: remove `data_desc = "data"` default; pass explicit
  descriptive strings at all 22 call sites (charge density, partial
  charge, effective/electrostatic potential, kinetic energy density,
  electron localization function, local DOS, wave function norm/real/imag,
  exciton density).
- write_bands.h: remove `nspin0 = 1` default; pass nspin0=1 explicitly
  at 4 test call sites in write_bands_test.cpp.
- Normalize cube filenames to lowercase with consistent short prefixes:
  SPIN1_CHG.cube -> chgs1.cube (esolver_dm2rho)
  LDOS_<en>eV.cube -> ldos_<en>ev.cube (cal_ldos + stm.py + catch_properties.sh)
  Exciton_avg_<type>_state<n>_spin<s>.cube -> exc_<type>_st<n+1>_s<s+1>.cube
  (exciton_plotter; indices now start from 1)
- Rename test reference: LDOS.cube.ref -> ldos.cube.ref (git mv).
- Update result.ref and README to match new filenames.

Verification: make -j 30 passed; ctest 7/7 passed (rho_io, write_bands,
write_bands_parallel, hsr_writer_test, hsr_writer_test_parallel,
dhs_sparse_writer_test, output_mat_sparse_test); code_quality_score
average 74.9 (pass line 60), 3 files below 60 are pre-existing debt
(tab_indentation, global_dependency, too_many_parameters in
cal_ldos/ctrl_output_fp/exciton_plotter).
- chg_init.cpp: read_kin_file now probes and reads tau.cube (nspin==1)
  / taus1.cube (nspin>1) instead of the legacy SPIN1_TAU.cube /
  SPIN<n>_TAU.cube. Aligns with the charge read path (chg.cube /
  chgs1.cube) in the same file.
- test_chg_extra.cpp: remove dead `std::remove("./support/OLD2_SPIN1_CHG.cube")`
  in ExtrapolateChargeCase4; no code path generates that file.

Verification: make -j 30 passed; ctest 8/8 passed (MODULE_CHARGE_extra +
  the 7 IO tests from the prior commit); code_quality_score chg_init.cpp
  64 (pass), test_chg_extra.cpp 57 (pre-existing debt: tab_indentation,
  uppercase_constant, global_dependency).
@mohanchen mohanchen changed the title Fix part of 6608: (TB2J) restore Fermi energy in H(R) CSR header and running log, adding output information for most out_* input keywords Fix part of 6608: Make IO output self-describing: running-log messages, cube data_desc, and ofs_running parameterization Oct 8, 2026

@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.

Follow-up review on fa75532.

Verification: ran agent_governance_check.py --base 4c69130 --head fa75532 (0 errors, 46 warnings, GlobalV net delta -5) and code_quality_score.py on the 66 changed C++ files; static cross-check of every write_vdata_palgrid call site, every hrs*.csr.ref, and renamed-filename references across tests/, tools/ and docs/. Not compiled and no tests executed locally, so the make -j 30 / ctest results in the body are unverified here.

Comment thread source/source_io/module_output/write_cube.cpp Outdated
Comment thread source/source_io/module_chgpot/get_pchg_lcao.cpp Outdated
Comment thread source/source_io/module_hs/hsr_writer.cpp
Comment thread source/source_lcao/module_lr/utils/exciton_plotter.cpp
Comment thread source/source_io/module_ctrl/ctrl_scf_lcao.cpp
Comment thread tests/03_NAO_multik/CASES_CPU.txt
Comment thread tests/03_NAO_multik/scf_out_hsr/hrs1_nao.csr.ref
Comment thread source/source_io/module_ctrl/ctrl_output_fp.cpp Outdated
abacus_fixer added 5 commits October 9, 2026 20:02
Address remaining review comments on PR deepmodeling#8068:

- Let callers own the spin tag via make_data_desc() in cube_io.h; the
  removed write_cube.cpp inference mislabeled is=-1/1-based/summed calls
  as "(spin down)" or "(spin up)". nspin=4 magnetic channels now log
  magnetization density mx/my/mz (chgs), effective magnetic field
  bx/by/bz (pots, holding B_xc) instead of bare "charge density" /
  "effective potential" for all four channels.
- Drop the 5 pre-write cube log lines duplicated by write_vdata_palgrid.
- Sync hs_matrix.md CSR header example with the E_Fermi annotation.
- Rename the conditional-slice .dat to the 1-based exc_cond_ style so
  one run no longer mixes Exciton_cond_..._state<N> (0-based) with
  exc_..._st<N+1> names for the same state.
- Strip the 6-digit E_Fermi header annotation before the 1e-8 CSR
  comparison in catch_properties.sh to avoid platform-dependent
  rounding failures; matrix tokens still compare at 1e-8.
# Conflicts:
#	source/source_io/module_ctrl/ctrl_output_fp.cpp
ReadFile() pre-checked inputs with os.path.isfile(), which returns False
for the /dev/fd/<n> pipes produced by bash process substitution <(...),
so the CSR comparisons in catch_properties.sh (added in 23d0ee4 to
strip the E_Fermi header annotation) aborted with "can not find file".
Open the path directly and catch OSError instead; missing files still
report the same error and exit code.
# Conflicts:
#	tests/integrate/tools/catch_properties.sh

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

Input&Output Suitable for coders without knowing too many DFT details Interfaces Interfaces with other packages Machine Learning & AI Issues related to AI Refactor Refactor ABACUS codes The Absolute Zero Reduce the "entropy" of the code to 0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IO layer cleanup: remove Rule 5 default arguments and normalize cube filenames

2 participants