Open
Conversation
Implement the Lanczos algorithm in q-space (Bloch basis) where momentum
conservation q1+q2=q_pert makes the 2-phonon sector block-diagonal,
reducing psi vector size and anharmonic computation cost by ~N_cell.
New files:
- Modules/QSpaceLanczos.py: Python class inheriting from DL.Lanczos with
Hermitian Lanczos iteration, Bloch-transformed ensemble, q-pair mapping,
and correct PG symmetry construction (Cartesian rotations from spglib
fractional coords, manual atom permutation with lattice reduction)
- Modules/tdscha_qspace.jl: Julia extension for q-space ensemble averaging
with separate D3/D4 functions and acoustic mode masking
- tests/test_qspace/test_qspace_lanczos.py: Test comparing q-space vs
real-space Green functions (match within 2.4e-7 relative error)
Key fixes during development:
- Convert spglib rotations from crystal to Cartesian coords via M@R@M^{-1}
- Replace CC.symmetries.GetIRT (gives wrong atom permutations for some
symmetries) with manual modular lattice reduction
- Include translation in Bloch phase: exp(-2πi q'·L) where L=Rτ+t-τ'
- Mask acoustic modes (ω<1e-6) in f_Y, f_psi, and chi factors
Also includes the translational projection optimization in DynamicalLanczos
(O(n^2) permutations instead of O(n^3) matmuls for gamma_only).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
New usage guide section covering the QSpaceLanczos workflow (perturbation setup, mode looping, when to prefer q-space over real-space) and a new API reference page with auto-generated docs via mkdocstrings. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Computes the anharmonic phonon spectral function at the Brillouin zone boundary (X point) for SnTe using the Q-space Lanczos algorithm with the pre-existing test ensemble. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
which should solve the free energy Hessian in q space correctly. Right now, it seems to work extremely well, except for 1 q point in the test, where none of the algorithms seems to converge. We need to investigate the issue.
We fixed a nasty hermitian conjugation in Q points not related to themselves by the inversion symmetries. These q-points are not hermitian, so the Lanczos was failing in them due to a mismatch between row-major and column-major transposition done in julia vs python. This is fixed and now it seems to work properly. Still an issue on IR prefactor and convergence of the bicg for that q != -q + G points is present to be fixed (its is only a convergence issue, as by explicitly computing the full L matrix and inverting produces the correct result, and also the standard Lanczos with no-mode-mixing produces the correct results).
Documents the q-space free energy Hessian with usage examples, performance comparison table, and deep-dive on the algorithm (static Liouvillian, q-space block diagonality, acoustic mode handling, Hermiticity enforcement, symmetry reduction). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…nd q-space Lanczos This test verifies that the IR perturbation modulus matches exactly between DynamicalLanczos and QSpaceLanczos after fixing the double mass scaling and missing supercell factor in QSpaceLanczos.prepare_ir. The test: 1. Creates ASR-satisfying effective charges (+I for first atom, -I for second) 2. Compares perturbation_modulus for all three polarization directions 3. Uses existing SnTe test data with 2×2×2 supercell
- Implemented prepare_raman() method in QSpaceLanczos with support for:
- Polarized Raman (pol_vec_in, pol_vec_out)
- Unpolarized Raman components (indices 0-6 with correct prefactors)
- Mixed Raman tensor components
- Implemented prepare_unpolarized_raman() method for raw components
without prefactors (matching parent class interface)
- Modified prepare_perturbation_q() to support add parameter for
cumulative perturbations (needed for unpolarized Raman)
- Added comprehensive test test_raman_modulus.py that verifies:
- Perturbation modulus consistency between real-space and q-space
Lanczos for all polarized Raman components (xx, xy, yy, zz)
- Consistency for all 7 unpolarized Raman components
- Tests use dummy Raman tensor that satisfies translation invariance
- Fixed test setup to ensure Raman tensor is properly attached to
ens.current_dyn (used by Lanczos constructor) rather than ens.dyn_0
All tests pass, confirming the q-space implementation matches the
real-space implementation for Raman perturbations.
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.
We can use an efficient implementation of the Q-space Lanczos for computing the Hessian.
This is now implemented and working.