Implement batched RGF refactorization and related unit tests#27
Merged
Conversation
…d [B,n,n] self-energies.
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.
This pull request introduces robust support for batched (vectorized) energy calculations throughout the NEGF device and recursive Green's function code. The changes update both the core algorithms and their documentation to consistently handle tensors with a leading batch dimension, enabling efficient multi-energy evaluations. Several tensor operations have been generalized to work in both batched and scalar modes, and some mathematical expressions have been modernized for clarity and performance.
Batched energy and tensor support:
recursive_gf_caland related device property routines, ensuring all tensors (Hamiltonians, self-energies, Green's functions) can carry a leading batch dimension and updating all relevant tensor operations accordingly. [1] [2] [3] [4]_build_s_in_batchedhelper indevice_property.pyto efficiently construct per-block self-energy tensors for batched calculations.Tensor operation improvements and consistency:
.conj().Twith.mH(Hermitian transpose) for clarity and consistency in all Green's function and self-energy calculations. [1] [2].diag()to.diagonal(dim1=-2, dim2=-1),torch.cat(..., dim=-1)) to support batched tensors and maintain correct output shapes. [1] [2]Algorithmic and codebase enhancements:
_cal_tc_), density of states (_cal_dos_), and local density of states (_cal_ldos_) to work seamlessly in both batched and scalar modes, improving performance and code maintainability. [1] [2] [3]recursive_gf_calto clearly describe batched tensor shapes and requirements for all arguments and outputs. [1] [2]Minor and maintenance changes:
These changes collectively modernize the NEGF codebase, making it more efficient and ready for high-throughput device simulations across multiple energies.