Skip to content

[wien2k] fix dmftproj port for non-centrosymmetric cells - #19

Open
krystophny wants to merge 16 commits into
TRIQS:unstablefrom
krystophny:fix/dmftproj-noncentrosym
Open

krystophny wants to merge 16 commits into
TRIQS:unstablefrom
krystophny:fix/dmftproj-noncentrosym

Conversation

@krystophny

@krystophny krystophny commented Jun 24, 2026 •

Copy link
Copy Markdown

Fixes the non-centrosymmetric generator paths; stacks on #16. This is separate from the converter-frame correction in #18.

The tellurium context from dft_tools#148 exposes three conventions hidden by centrosymmetric d-shell fixtures: normalized px,py,pz cubic p harmonics, transpose basis changes for antiunitary operations, and composition of the representative local frame with the atom-mapping symmetry operation.

The composed local rotation is now shared by ctqmcout, parproj and outband, including the non-SO local matrix path. Symqmc and sympar use the antiunitary transpose. The earlier nonidentity-struct rejection is removed because every affected projector writer now applies the reference frame.

Validation: the small Te symmetry reference agrees with native dmftproj at 1e-7 and all matrices are unitary. An independent test checks that Te's composed p-shell rotation is unitary and differs from the mapping operation alone. The common, Te, odd-l, non-SO, ctqmcout, parproj and outband tests pass locally. The out-of-tree full Te comparison remains limited by the retained 193 MB almblm input and is documented in the discussion.

Chris&AI

Port the dmftproj almblm reader and case.oubwin writer to NumPy. Given
case.almblm{up,dn} and the energy window in case.indmftpr, select the
contiguous band range per k-point and spin and write case.oubwin{up,dn}
in the dmftproj format. Support proj_mode 0; band-index modes remain
explicitly unsupported. Part of TRIQS#7.

Keep window-open and window-valid flags separate, as set_projections.f
does. A window opening only at nbmax remains excluded with zero bounds,
including nbmin == nbmax. Preserve this native behavior on both sides.

Reuse the existing compressed CaOs2 almblm fixtures, decompressing into
a temporary directory. Compare both spin outputs with CaOs2.oubwinup,
ignoring only trailing whitespace stripped from the shipped reference.
Add focused checks for the final-band edge cases, energy boundaries,
Fermi shifts, per-k lowest-band weights and excluded output records.

Validation: the generator test passes locally with NumPy, including both
reviewer reproducers and regeneration of the 43-92 CaOs2 band window.
@krystophny

Copy link
Copy Markdown
Author

GPT Sol rebased this onto the reviewed odd-l stack and completed the local-frame fix across ctqmcout, parproj and outband. Preserved the p-basis and antiunitary corrections, removed the struct guard only after every projector writer used the composed frame, and added an independent Te rotation regression. Seven affected local tests pass; CI is running.

Chris&AI

@krystophny
krystophny force-pushed the fix/dmftproj-noncentrosym branch from 6b22e44 to c69074b Compare October 12, 2026 17:38
Read the almblm coefficients, assemble and locally rotate correlated
projectors, apply the cubic/complex basis, and Loewdin-orthonormalize the
stacked shells before writing ctqmcout. Part of TRIQS#7, following TRIQS#8.

Keep the native separate window-open/valid flags. Validate matching SO
spin windows and use each spin's own band offsets. Reject unsupported
non-SO, band-index, cubic p/f and non-identity struct rotation paths
instead of producing misleading files; subsequent port stages add them.

Reuse the current full-rank CaOs2 inputs and TRIQS#8 fixture handling. Compare
integer fields exactly and finite float fields at atol=1e-7, rtol=0.
Add regressions for final-band-only windows and mismatched SO spins.
Local validation gives max native residual 1.3e-8 and full 20x50 projector
orthonormality error 3.2e-15. The old rank-deficient-window claims no
longer apply to this fixture.
Generate symmetry matrices for every included shell, including the uncorrelated Ca d shell in the native partial fixture. Rebase onto the corrected projector stack and reuse source fixtures without unused build-directory copies.

Correct the cubic p normalization/order and use the dmftsym iprop parity for improper rotations. Add independent inversion and basis-normalization regressions. Reject the unsupported non-SO and cubic f paths until their port stages. Compare headers exactly, finite complex matrices at atol=1e-7 with rtol=0, and verify unitarity at the native basis precision floor.
The port was validated only on centrosymmetric, trivial-rotloc, d-shell
fixtures (CaOs2, SrVO3). Non-centrosymmetric spin-orbit cells (the
dft_tools#148 regime) hit three convention bugs in the p-shell and
local-frame paths:

- _CUBIC[1]: the cubic l=1 (p) transform was un-normalized and row-ordered
  pz,py,px instead of the Fortran px,py,pz, so P P^dag != I. _CUBIC[2] (d)
  was correct, so the d-shell tests never caught it.
- The non-mixing magnetic (time-inversion) operations used conj(P.T) where
  the antiunitary basis change needs P.T (symqmc and sympar shell matrices,
  and the ctqmcout Rloc rotrep). The mixing path already used P.T; the
  non-mixing path was inconsistent. It is a no-op for real bases
  (complex-identity, cubic-d), so only the p-shell with its imaginary p_y
  row was affected.
- The non-mixing ctqmcout path dropped the struct reference local rotation
  rotloc_ref (beta=pi/2 for Te) that the mixing path composes via
  rotloc_rotl_so. Both the Rloc rotrep and the projector rotation now
  compose it; the projector uses dmat(R[isym]) @ dmat(rotloc_ref), the
  orbital dmat of the full rotloc (rot_projectmat.f), no spin part, no time
  reversal.

Verified against the dmftproj Fortran on the identical lapw2 -almd output
(tellurium, P3_1 21, SP+SO): case.symqmc and case.sympar match to 6e-8 and
case.ctqmcout (Rloc rotrep + all projectors) to 2e-8, the float32
cubic-template floor; the only larger field is elecn (36 vs 35.999998, a
float32 almblm value). Centrosymmetric CaOs2 is byte-identical.

Adds a non-centrosymmetric tellurium case.symqmc regression test (small
symmetry inputs, no almblm) and a cubic l=1 unitarity check.
@krystophny
krystophny force-pushed the fix/dmftproj-noncentrosym branch from c69074b to 132dd4e Compare October 12, 2026 17:39
@krystophny

krystophny commented Oct 12, 2026 •

Copy link
Copy Markdown
Author

GPT Sol re-reviewed the non-centrosymmetric changes using the linked Te discussion and restacked them on updated #16. The Te symmetry, shared-parser, partial-projector and non-SO regressions pass. Generator and converter frame fixes remain distinct; this PR is ready for review. Latest-head CI is running/queued.

Chris&AI

@krystophny
krystophny marked this pull request as ready for review October 12, 2026 17:48
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.

1 participant