Skip to content

PDOS: collinear spin support, atom sync, and BC parsing fix - #268

Merged
phanish-suryanarayana merged 1 commit into
SPARC-X:masterfrom
qihao-cheng:master
Aug 7, 2026
Merged

PDOS: collinear spin support, atom sync, and BC parsing fix#268
phanish-suryanarayana merged 1 commit into
SPARC-X:masterfrom
qihao-cheng:master

Conversation

@qihao-cheng

Copy link
Copy Markdown
Collaborator

Extend the SPARC PDOS post-processing utility (utils/pdos) to collinear spin-polarized calculations (SPIN_TYP = 1), keep the existing spin-unpolarized path, sync utils/atom with the latest SPARC-atomSFE sources (and adapt the PDOS Default path to that API), and harden BC parsing for filenames that contain substrings like BCC.

Summary

  1. Collinear spin PDOS
    Read SPIN_TYP from the SPARC .out file (0 → unpolarized, 1 → collinear). Parse spin-resolved eigenvalues from .eigen and orbitals from .psi (SPARC write order: k-point → band → spin). Project each spin channel with spin degeneracy factor 1 (unpolarized path still uses 2). Noncollinear spin is not supported.

  2. Spin-resolved outputs
    For collinear runs, write DOS_up.txt / DOS_down.txt, PDOS_up.txt / PDOS_down.txt, and a combined DOS.txt with columns Energy, DOS_up, DOS_down, DOS_tot (DOS_tot = up + down). Unpolarized runs still write DOS.txt / PDOS.txt as before.

  3. Examples
    Add examples/Si2_nmag (SPIN_TYP: 0) and examples/Si2_nmag_spin (SPIN_TYP: 1, zero initial magnetization). On this closed-shell setup, net magnetization stays ~0 and the spectra can be compared after aligning to each Fermi level.

  4. BC parsing fix
    Match the input tag BC: explicitly when reading the SPARC .out, so strings such as BCC in filenames are not treated as the boundary-condition line.

  5. utils/atom sync + PDOS Default path
    Refresh the in-tree atomic DFT package from SPARC-atomSFE (data/, xc/ml_xc/, HF, response helpers, etc.), add a trimmed README/logo under utils/atom, and update PDOS’s Default atomic-orbital generator for the new solver API (verbose, solve(evaluate_basis_on_uniform_grid=True), n_l_orbitals shape (n_states, 2)).

  6. Docs / versioning
    Update utils/pdos/README.md, ChangeLog, and the SPARC version banner in src/initialization.c to August 06, 2026.

@phanish-suryanarayana
phanish-suryanarayana merged commit bd7aed4 into SPARC-X:master Aug 7, 2026
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants