Repository navigation
[dmftproj] eliminate single-precision loss in the projector construction - #14
Open
krystophny wants to merge 1 commit into
Open
krystophny wants to merge 1 commit into
krystophny wants to merge 1 commit into
Conversation
krystophny
added a commit
to krystophny/dftkit
that referenced
this pull request
Jun 16, 2026
…sion fix)
Use the exact analytic cubic harmonics (reptrans no longer applies the legacy
float32 cast) and call the same LAPACK routine the Fortran does for the Loewdin
inverse (scipy ZHEEV('V','U'), not numpy's ZHEEVD). Regenerate the references
from the precision-fixed dmftproj (PR TRIQS#14) with full-precision templates.
Against that reference the port is now exact: symqmc 1.5e-14, sympar 1.9e-14,
parproj 1.5e-14 (machine precision), oubwin byte-identical. ctqmcout stays at
~6.6e-7: its overlap is rank-deficient (20 correlated spin-orbitals, 17 bands),
so O^{-1/2} amplifies the last-ULP libm difference between gfortran and numpy by
~1e8; dmftproj reproduces itself across BLAS but no cross-language port can match
it below that floor without changing the (preserved) algorithm. Tolerances
tightened to 1e-11 accordingly; ctqmcout documented at 1e-6. Part of TRIQS#7.
This was referenced Jun 16, 2026
Open
krystophny
added a commit
to krystophny/dftkit
that referenced
this pull request
Jun 16, 2026
…sion fix)
Use the exact analytic cubic harmonics (no float32 cast) and call the same
LAPACK/BLAS routines the Fortran does for the Loewdin step (scipy ZHEEV('V','U')
and ZGEMM with the matching trans flags, not numpy's ZHEEVD / conj-transpose
copies). Regenerate references from the precision-fixed dmftproj (PR TRIQS#14) with
full-precision templates.
The port is now exact to machine precision on every output:
oubwin byte-identical
symqmc 1.5e-14
sympar 1.9e-14
parproj 1.5e-14
ctqmcout 1.5e-14 (full-rank window: 50 bands > 20 correlated spin-orbitals,
so the Loewdin overlap O is non-singular and its
eigenvectors are unique. The physical narrow-window CaOs2
makes O rank-deficient; O^{-1/2} then amplifies the
last-ULP libm difference, a property of that degenerate
case, not the port.)
Tolerances tightened to 1e-11. Part of TRIQS#7.
krystophny
added a commit
to krystophny/dftkit
that referenced
this pull request
Jun 16, 2026
run_dmftproj writes every case.* file the converter reads (band mode writes case.outband), a drop-in for the dmftproj Fortran binary. Delete fortran/dmftproj and its build. End-to-end: the driver feeds the converter and the resulting HDF5 matches the reference (h5diff). The Fortran precision fix lives separately in TRIQS#14; this stack reproduces dmftproj to machine precision. Closes the port. Part of TRIQS#7.
This was referenced Jun 16, 2026
krystophny
added a commit
to krystophny/dftkit
that referenced
this pull request
Jun 16, 2026
run_dmftproj writes every case.* file the converter reads (band mode writes case.outband), a drop-in for the dmftproj Fortran binary. Delete fortran/dmftproj and its build. End-to-end: the driver feeds the converter and the resulting HDF5 matches the reference (h5diff). The Fortran precision fix lives separately in TRIQS#14. Closes the port. Part of TRIQS#7.
krystophny
added a commit
to krystophny/dftkit
that referenced
this pull request
Jun 16, 2026
run_dmftproj writes every case.* file the converter reads (band mode writes case.outband), a drop-in for the dmftproj Fortran binary. Delete fortran/dmftproj and its build. End-to-end: driver -> converter -> h5diff. The Fortran precision fix is TRIQS#14; non-SO support is TRIQS#15. Closes the port. Part of TRIQS#7.
krystophny
added a commit
to krystophny/dftkit
that referenced
this pull request
Oct 12, 2026
Generate correlated-shell spinor symmetry matrices from case.dmftsym, case.indmftpr and case.struct using the dmftproj Wigner-D, angular-basis, time-reversal and spin-phase construction. Cover the non-mixing cubic, spin-mixing fromfile (|j,m_j>) and l=0 paths on the CaOs2 fixture. The cubic matrices differ from the shipped native fixture by 8.6e-8 in complex magnitude (6.9e-8 per real/imaginary component). set_ang_trans.f reads the 8-digit cubic template through CMPLX without KIND=8; magnetic operations apply this rounded basis twice. outputqmc.f also evaluates spin phases in single precision. Python uses exact cubic d coefficients and double-precision phases. Reproducing the native rounding in a local check reduces the complex residual to 2.2e-14; the native precision fixes remain separate in TRIQS#14. Generate into a temporary directory and compare the complete symqmc header exactly and the complex matrices at atol=1e-7, rtol=0. Check Python cubic unitarity at 1e-12. This preserves the SOC converter's shared fixture and avoids h5diff's hard-coded array tolerance and the unrelated parproj archive groups. The fromfile and l=0 tests retain their native matrix references. Read generator inputs from the source fixtures instead of copying unused files into the build directory.
the-hampel
pushed a commit
that referenced
this pull request
Oct 12, 2026
…#5) Generate correlated-shell spinor symmetry matrices from case.dmftsym, case.indmftpr and case.struct using the dmftproj Wigner-D, angular-basis, time-reversal and spin-phase construction. Cover the non-mixing cubic, spin-mixing fromfile (|j,m_j>) and l=0 paths on the CaOs2 fixture. The cubic matrices differ from the shipped native fixture by 8.6e-8 in complex magnitude (6.9e-8 per real/imaginary component). set_ang_trans.f reads the 8-digit cubic template through CMPLX without KIND=8; magnetic operations apply this rounded basis twice. outputqmc.f also evaluates spin phases in single precision. Python uses exact cubic d coefficients and double-precision phases. Reproducing the native rounding in a local check reduces the complex residual to 2.2e-14; the native precision fixes remain separate in #14. Generate into a temporary directory and compare the complete symqmc header exactly and the complex matrices at atol=1e-7, rtol=0. Check Python cubic unitarity at 1e-12. This preserves the SOC converter's shared fixture and avoids h5diff's hard-coded array tolerance and the unrelated parproj archive groups. The fromfile and l=0 tests retain their native matrix references. Read generator inputs from the source fixtures instead of copying unused files into the build directory.
krystophny
force-pushed
the
fix/dmftproj-precision
branch
from
October 12, 2026 14:29
b8515f4 to
9e7ad09
Compare
Author
|
GPT Sol rebased this onto current unstable, reviewed the constructor/template changes, and added an independent native unitarity regression. It fails before the fix and passes afterward in local CMake/CTest. Updated the accuracy explanation to distinguish external template truncation and the obsolete rank-deficient fixture. CI is running. Chris&AI |
Author
|
GPT Sol re-reviewed the native precision changes against the linked context; no further source change was needed. Reused the precision-fixed native executable as the independent oracle for the new band-mode checks (maximum residual 1.2e-16). All four checks on this unchanged PR head are green. Chris&AI |
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.
Fixes double-precision values being rounded by default-kind
CMPLXconstructors in native dmftproj. Angular transforms, spin phases, tetrahedron weights and Loewdin eigenvalues now retain double precision. The shipped p/f templates also retain full-precision coefficients, and the basis reader accepts their longer records.Adds a native-producer regression using the retained full-rank CaOs2 inputs and a full-precision external d template. It checks symmetry unitarity at
1e-12independently of golden files. The test fails with the pre-fix producer and passes with this fix in local CMake/CTest. Full TRIQS tests run in CI.Wien2k supplies the d template externally: this patch cannot recover digits already truncated in an installed template. #12 compares the Python generators against the fixed producer with full-precision templates. The old narrow-window CaOs2 accuracy explanation is superseded by the current 50-band, full-rank fixture; rank-deficient Loewdin output is not a meaningful precision oracle.
Chris&AI