Conversation
added 20 commits
September 26, 2026 07:22
The out_dos=3 code path (BXSF Fermi surface file via nscf_fermi_surface)
is unused and unmaintained. Remove the feature entirely:
- Delete the out_dos==3 branches in write_dos_lcao/write_dos_pw.
- Make out_dos=3 a hard error in INPUT validation.
- Delete the now-orphaned nscf_fermi_surf.{cpp,h} and drop it from
CMakeLists.txt, Makefile.Objects, and the IO test target.
Verified: full build succeeds; ctest MODULE_IO_cal_dos,
MODULE_IO_write_dos_pw, MODULE_IO_read_item_serial, and
MODULE_IO_input_test_para all pass.
- Replace raw new/delete buffers (pdosk, pdos, waveg, Gauss) with std::vector, removing manual memory management. - Fix missing non-MPI fallback: previously the non-MPI build left pdos as all zeros because the gemv into mulk and the reduction were only compiled under __MPI. Add a serial BlasConnector::gemv branch and a plain std::copy in place of MPI_Reduce. - Unify the energy grid with cal_dos: npoints = floor((emax-emin)/de)+1 so the last grid point is included.
Add an istep parameter to both cal_pdos overloads (gamma and multi-k)
and forward it from write_dos_lcao. The parameter is currently unused;
it will be consumed when PDOS output switches to per-step text files
(pdoss{spin}g{geom}_{basis}.txt) in a following step.
Introduce write_pdos_text() which writes PDOS in a plain-text
long-table format: energy(eV) atom species l z m pdos(1/eV).
Files are named pdoss{spin}g{geom}_{basis}.txt, following the
same convention as the doss* files for total DOS.
For nspin=2, two files are written (one per spin channel).
For nspin=4, the two spinor components are summed into a single
file, consistent with the previous XML behaviour.
Remove print_tdos_gamma/multik and print_pdos_gamma/multik which
wrote TDOS.dat and PDOS.dat (XML). These are superseded by the
new text output and by cal_dos (doss*.txt) respectively.
- Remove the out_dos==2 branch in write_dos_lcao; PDOS is computed unconditionally when DOS output is requested (LCAO only). - Deprecate out_dos=2 with WARNING_QUIT, directing users to out_dos=1 which now includes PDOS. - Update the out_dos description string accordingly.
Rename the ambiguous column headers in doss*.txt: energy -> energy(eV) elec_states -> dos(1/eV) sum_states -> dos_int (integrated DOS) states_smear -> dos_smear(1/eV) sum_states -> dos_smear_int (integrated smeared DOS) The old header had two columns both named "sum_states", which was confusing. The new names make the distinction explicit and include units where applicable.
- parameters.yaml / input-main.md: remove out_dos=2 and out_dos=3 descriptions; out_dos=1 now includes PDOS for LCAO. - dos.md: update DOS output file name and column descriptions to match the new doss*.txt header; replace the XML PDOS section with the new plain-text long-table pdoss*.txt format.
- Add out_dos=2 deprecation test in read_input_item_test.cpp - Change scf_out_dos_spin2/INPUT from out_dos=2 to out_dos=1 - Remove obsolete TDOS.dat and PDOS.dat from the reference output
The old default of 0.01 eV is much finer than needed given the default Gaussian smearing width (dos_sigma = 0.07 eV). With 0.03 eV the grid spacing is still well below sigma/2, so no features are lost, but the output file is ~3x smaller. Update the default in input_parameter.h, the read_inp_postproc metadata, the documentation, and the test INPUT/reference values.
Replace the long-table layout (one row per energy x orbital, with repeated atom/species/l/z/m columns) with a wide-table layout: energy in column 1, one column per orbital, and a header block mapping each column number to its (atom, species, l, z, m). This reduces the file size by ~3-4x since the orbital metadata is no longer repeated on every energy row. The format is also more convenient for plotting (gnuplot, pandas, numpy loadtxt).
This reverts commit 106a683.
Collapse the zeta dimension in PDOS output: for each (atom, l, m), sum the contributions from all zeta components into a single value. This aligns the output with VASP's DOSCAR format and reduces file size, since most PDOS analysis does not require zeta resolution. The columns are now: energy(eV), atom, species, l, m, pdos(1/eV).
- Zero out PDOS values below 1e-6 to suppress numerical noise. - Switch from scientific notation to fixed-point with 6 decimal places for better readability.
Each row now corresponds to one energy point and one (atom, l) combination, with 2l+1 pdos values for m = -l..l in separate columns. This removes the m column and reduces redundant metadata repetition. Column widths are tightened for a more compact layout.
Each row now corresponds to one energy point and one atom, with all (l, m) pdos values laid out in columns ordered as s, p, d, f. The l column is removed; the column count varies per atom type depending on its angular momentum content. Zeta components remain summed and values below 1e-6 are zeroed out.
Replace the vague orbital name listing in the header with an explicit enumeration of the m ordering for each l block, matching ABACUS's complex spherical harmonics convention (m = -l..+l).
iw2m stores m as 0..2l (non-negative), but the code was looping m = -l..+l and matching against iw2m. This caused all negative-m components to be silently dropped. Fix the loop to m = 0..2l to match the internal convention.
iw2m stores m as 0..2l, mapping to physical m values 0,+1,-1,+2,-2,... Update the header comment to reflect this convention.
added 4 commits
September 26, 2026 11:34
- Move cal_dos_test.cpp and write_dos_pw_test.cpp from source/source_io/test/ to source/source_io/module_dos/unittests/ - Add minimal support files (kpoints, istate.info, INPUT, KPT) - Remove unnecessary files (Si.upf, STRU, SK_nspin*, DMK_nspin*) - Update CMakeLists.txt paths accordingly
Remove PARAM global dependencies from cal_dos, write_dos_pw, and write_dos_lcao by threading input values (nspin, out_dos, dos_setemax/ dos_emax_ev, dos_setemin/dos_emin_ev, two_fermi, out_app_flag, bndpar, global_out_dir) through the function signatures. Update call sites in ctrl_output_pw / ctrl_scf_lcao / cal_ldos and the unit tests accordingly. Verified: cmake --build (full) passes; ctest -R MODULE_DOS passes (2/2).
Remove PARAM global dependencies from cal_pdos (gamma-only and multi-k) by threading nlocal, nspin, and global_out_dir through the function signatures. write_dos_lcao gains an nlocal parameter so it can forward it; the call site in ctrl_scf_lcao passes PARAM.globalv.nlocal. Verified: cmake --build (full) passes; ctest -R MODULE_DOS passes (2/2).
Remove PARAM global dependencies from the LDOS code paths (Cal_ldos<T>::cal_ldos_lcao, cal_ldos_pw, stm_mode_pw, ldos_mode_pw) by threading stm_bias, nspin, global_out_dir, two_fermi, out_ldos_precision, nbands, dos_edelta_ev, dos_scale, dos_setemax/ dos_emax_ev, dos_setemin/dos_emin_ev, dos_sigma, and ldos_line through the function signatures. Update the call sites in ctrl_runner_lcao and ctrl_output_pw. Verified: cmake --build (full) passes; ctest -R MODULE_DOS passes (2/2).
…tep 4) - test_write_dos_pw.cpp: drop the #define private public hack and all PARAM.input/PARAM.sys assignments; pass values through write_dos_pw arguments (dosp.nbands, local dos_setemax/dos_setemin) instead - write_pdos_text.cpp: drop unused module_parameter/parameter.h include module_dos (outside test support data) no longer references PARAM. Verified: cmake --build . -j16; ctest -R MODULE_DOS (2/2 passed).
Replace the file-based test fixture (support/kpoints + support/istate.info,
36 k-points x 8 bands) with a small synthetic dataset inlined in the new
header dos_test_data.h (4 k-points, 4 bands, equal weights). DosPrepare now
fills wk/ekb/wg from this data via set_wk()/set_istate_info() instead of
reading files, so the tests no longer depend on the working directory or
on-disk fixtures.
- dos_test.h: drop read_wk()/read_istate_info(); add set_wk()/
set_istate_info() reading from dos_test_data.h; fix set_isk() to use
resize instead of reserve+operator[] (which wrote out of bounds)
- dos_test_data.h: new header with nks/nkstot/nbands and wk/ekb_ev/wg arrays
- test_cal_dos.cpp, test_write_dos_pw.cpp: use dos_test_data dimensions and
update expected DOS rows for the synthetic spectrum
- delete support/{INPUT,KPT,kpoints,istate.info} (INPUT/KPT were unreferenced
leftovers; kpoints/istate.info superseded by dos_test_data.h)
Verified: cmake --build . --target MODULE_DOS_cal_dos MODULE_DOS_write_dos_pw;
ctest -R MODULE_DOS (2/2 passed).
Add test_write_pdos_text.cpp covering the text PDOS writer:
- basic output: header lines, energy/atom/species columns, and the
s + p(m=0,+1,-1) column ordering for a single Si atom
- istep>=0 appends g{istep+1} to the file name (pdoss1g3_lcao.txt)
- spin-polarized (nspin=2): writes pdoss1/pdoss2 from pdos[0]/pdos[1]
The test builds a minimal UnitCell by hand (iat2it/iat2ia/itia2iat filled
directly) so it only links the UnitCell/Atom constructor/destructor via
mock_unitcell.cpp, not the full source_cell library. iat2it/iat2ia are
owned by UnitCell's Statistics member and must not be deleted in TearDown.
To set the private iat2iwt/npol without a #define-private-public hack, add
a small public setter UnitCell::set_iat2iwt_for_test().
cal_pdos_gamma/cal_pdos_multik are not unit-tested here: they require a full
LCAO Hamiltonian (HamiltLCAO Sk matrix, Parallel_Orbitals distribution and
ScaLAPACK descriptors) and are covered by integration tests instead.
Verified: cmake --build .; ctest -R MODULE_DOS (3/3 passed).
ABACUS now writes PDOS as per-spin-channel text files (pdoss1_*[/pdoss2_*]_<basis>.txt) instead of a single XML file. Rewrite PDOS._read to parse this format: - discover one or two spin-channel files from a directory, a path prefix, or a concrete spin-up file; nspin is derived from the number of files found - rebuild the per-(atom,l,m) orbital entries from the flattened text columns (s=1, p=3, d=5, f=7; column index -> physical m via 0,+1,-1,+2,-2,...); zeta is already summed by ABACUS so the 'z' key and all zeta handling are removed - concatenate the two spin channels so orb['data'] stays (npoints,2) for nspin=2, keeping the downstream _plot/_write logic unchanged Drop the lxml dependency. Also fix a pre-existing bug where the total-DOS and list-species branches of _parial_plot passed a list of Axes to DOSPlot, and remove the obsolete XML example data file examples/Si/PDOS (config.json now points to a 'pdos' prefix).
- plot-tools/README.md: pdosfile now points to a directory/prefix of the text pdoss1_*[/pdoss2_*] files instead of the old XML 'PDOS' file; note that lxml is only needed for the XML projected-band output - docs/advanced/elec_properties/dos.md: fix the PDOS header example to match the actual text output and document the m = 0,+1,-1,... column order and the optional '# istep:' line - docs/advanced/interface/pyabacus.md: replace the obsolete XML 'PDOS' output-file entry with pdoss1_*.txt
Commit 6184953 accidentally committed a local absolute executable path (/home/510Group/.../abacus_max_para) into Autotest.sh and general_info. This broke CI: the container has no such file, so mpirun failed to launch ABACUS and all 11_PW_GPU cases errored with "No ABACUS executable was found". Restore the default "abacus" so the runner resolves it from PATH.
# Conflicts: # source/source_io/module_dos/cal_dos.cpp # source/source_io/module_dos/cal_dos.h # source/source_io/module_dos/cal_pdos_gamma.h # source/source_io/module_dos/cal_pdos_multik.h # source/source_io/module_dos/write_dos_lcao.cpp # source/source_io/module_dos/write_dos_pw.cpp # source/source_io/module_dos/write_dos_pw.h # source/source_io/module_energy/nscf_fermi_surf.cpp
- Fix TDOS._read() in dos.py to handle new 5/9-column format with two non-# header lines, while keeping backward compatibility with old DOS1_smearing.dat 2/3-column format. - Update examples/13_dos run.sh to check new DOS output file names (dos.txt for PW, doss1g1_nao.txt for LCAO) and new charge density file name chg.cube instead of SPIN1_CHG.cube. - Update examples/13_dos README to reflect new DOS output format. - Update docs (parameters.yaml, input-main.md, dos.md, spin.md, faq.md, pyabacus.md) for new file names and default changes: dos_edelta_ev default 0.01 -> 0.03, out_dos=2/3 no longer supported. - Update tests/performance/catch_properties.sh to use new DOS file name. - Update Wannier90 interface to use new charge density file patterns.
Move the out_dos deprecation note and dos_edelta_ev default-change note into the C++ Input_Item descriptions so the generated parameters.yaml matches the checked-in docs.
Critsium-xy
reviewed
Oct 1, 2026
The non-MPI gemv fallback introduced in the cal_pdos refactor wrote every band's S^T*psi result into row 0 of mulk, while the accumulation loop below reads column ic=i. Bands i>0 therefore contributed stale/undefined values to the projected DOS in serial builds. Offset the gemv output pointer by i * pv.nrow so band i lands in mulk column i, matching the pdgemv_/pzgemv_ layout used in the MPI path. Verification: python3 tools/03_code_analysis/agent_governance_check.py --staged (pass). No serial runtime build available; layout equivalence with the MPI path verified by index arithmetic (serial: pv.nrow == nlocal, mulk is row-major with nc=pv.nrow, so column i starts at c + i*pv.nrow).
…erve() reserve() only allocates capacity without changing size(), so the subsequent writes via operator[] were out-of-bounds undefined behavior. Use resize() to actually create the elements before writing.
The text PDOS parser rewrite (8b2c56a) started storing the physical magnetic quantum number m (0, +1, -1, +2, -2, ...) in orb['m'], but two downstream consumers still treated it as a 0..2l column index: - parse_projected_data: user selections {l: [m, ...]} never matched for m > l, so e.g. selecting p with m=2 silently produced no data. - get_angular_momentum_name: labels were looked up with the physical m as an index into angular_momentum_name, producing wrong labels for d/f orbitals (e.g. l=2, m=+2 would be labeled d_yz instead of d_{x^2-y^2}). Also orb['index'] changed from the 1-based global orbital index of the legacy XML format to a 0-based counter, breaking 'index'-keyed selections (index=1 no longer matched the first orbital). Fixes: - utils.py: get_angular_momentum_name now accepts physical m by default (m_is_physical=True) and maps it to the correct column via _m_to_col; pass m_is_physical=False for the legacy XML column-index semantics. - band.py: pass m_is_physical=False at the two call sites, since the projected-band XML stores m as iw2m (0..2l index). - dos.py: restore orb['index'] to a 1-based global orbital index. Verification: python3 -m py_compile on all three files (pass); python3 tools/03_code_analysis/agent_governance_check.py --staged (pass). No runtime test data available for the new text PDOS format.
When a concrete file such as pdoss1g5_nao.txt was passed to PDOS(), _find_spin_files reduced it to the prefix 'pdos' and returned the first sorted glob match of pdoss1*.txt (e.g. pdoss1g1_nao.txt), silently discarding the requested file. The same happened for the spin-2 file. Now a concrete pdoss* file is used directly as its spin channel, and the matching spin-2 file is looked up by replacing 'pdoss1' with 'pdoss2' in the filename only. Verification: python3 -m py_compile (pass); python3 tools/03_code_analysis/agent_governance_check.py --staged (pass).
- dos.py (TDOS): strip inline comments before parsing, so the new
header lines "1 # ionic step" / "4801 # number of points" no
longer crash abacus-plot -d with ValueError.
- dos.py (PDOS): when pdosfile is a directory (e.g. OUT.ABACUS),
search for pdoss{1,2}*.txt inside it instead of treating the
directory name as a file prefix.
- cal_dos.cpp: keep DOS columns separated when values reach
10000.000000 (12 chars) by inserting an explicit space separator;
rename the raw-histogram column header from dos(1/eV) to dos, since
it is a state count per energy bin, not per eV. Update unit tests
and docs/advanced/elec_properties/dos.md accordingly.
- write_dos_pw.cpp: remove the dead out_dos == 2 branch (rejected in
read_inp_out.cpp).
- cal_pdos_gamma.cpp / cal_pdos_multik.cpp: drop the stale (void)istep
now that istep is passed to write_pdos_text.
- Remove leftover legacy test files source/source_io/test/cal_dos_test.cpp
and write_dos_pw_test.cpp, replaced by module_dos/unittests/.
Verification:
- cmake --build . --target MODULE_DOS_cal_dos MODULE_DOS_write_dos_pw
MODULE_DOS_write_pdos_text (pass)
- OMP_NUM_THREADS=1 ctest -R MODULE_DOS --output-on-failure
(3/3 pass)
- OMP_NUM_THREADS=1 ctest -R MODULE_IO_read_input_serial (pass)
- cmake --build . --target io_basic (pass, includes cal_pdos_*)
- python3 functional check of TDOS/PDOS parsing with synthetic
new-format files (directory lookup, inline-comment header, m=+1/-1
selection) passes.
The C++ description was updated to note the default change from 0.01 to 0.03 eV, but docs/parameters.yaml still carried the old one-line text, so the CI sync check failed.
Critsium-xy
approved these changes
Oct 1, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix #6162
Refactor DOS and PDOS output
Now the new format of PDOS (LCAO) looks like: