PDOS: collinear spin support, atom sync, and BC parsing fix - #268
Merged
Conversation
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.
Extend the SPARC PDOS post-processing utility (
utils/pdos) to collinear spin-polarized calculations (SPIN_TYP = 1), keep the existing spin-unpolarized path, syncutils/atomwith the latest SPARC-atomSFE sources (and adapt the PDOS Default path to that API), and harden BC parsing for filenames that contain substrings likeBCC.Summary
Collinear spin PDOS
Read
SPIN_TYPfrom the SPARC.outfile (0→ unpolarized,1→ collinear). Parse spin-resolved eigenvalues from.eigenand orbitals from.psi(SPARC write order: k-point → band → spin). Project each spin channel with spin degeneracy factor1(unpolarized path still uses2). Noncollinear spin is not supported.Spin-resolved outputs
For collinear runs, write
DOS_up.txt/DOS_down.txt,PDOS_up.txt/PDOS_down.txt, and a combinedDOS.txtwith columnsEnergy,DOS_up,DOS_down,DOS_tot(DOS_tot = up + down). Unpolarized runs still writeDOS.txt/PDOS.txtas before.Examples
Add
examples/Si2_nmag(SPIN_TYP: 0) andexamples/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.BC parsing fix
Match the input tag
BC:explicitly when reading the SPARC.out, so strings such asBCCin filenames are not treated as the boundary-condition line.utils/atomsync + PDOS Default pathRefresh the in-tree atomic DFT package from SPARC-atomSFE (
data/,xc/ml_xc/, HF, response helpers, etc.), add a trimmed README/logo underutils/atom, and update PDOS’s Default atomic-orbital generator for the new solver API (verbose,solve(evaluate_basis_on_uniform_grid=True),n_l_orbitalsshape(n_states, 2)).Docs / versioning
Update
utils/pdos/README.md,ChangeLog, and the SPARC version banner insrc/initialization.cto August 06, 2026.