Skip to content

Refactor RGF logic and update parameter types for PyTorch compatibility#26

Merged
AsymmetryChou merged 6 commits into
deepmodeling:mainfrom
AsymmetryChou:rgf_acc
Jun 11, 2026
Merged

Refactor RGF logic and update parameter types for PyTorch compatibility#26
AsymmetryChou merged 6 commits into
deepmodeling:mainfrom
AsymmetryChou:rgf_acc

Conversation

@AsymmetryChou

Copy link
Copy Markdown
Collaborator

This pull request enhances the flexibility and efficiency of the Green's function calculations in the NEGF (Non-Equilibrium Green's Function) code by introducing new options to control which components of the Green's function are computed. The changes allow users to selectively compute the lesser, greater, and last-column blocks of the retarded Green's function, which can reduce memory usage and computational cost when certain outputs are not needed. Additionally, the documentation is improved for clarity and accuracy.

Key changes include:

Green's function calculation flexibility:

  • Added new boolean parameters (need_lesser, need_greater, need_gr_lc) to the cal_green_function method in device_property.py and to the core recursive Green's function routines in recursive_green_cal.py, allowing users to specify which components (lesser, greater, last-column retarded) to compute. This enables memory and computational savings by only calculating required quantities. [1] [2] [3] [4] [5] [6]

Conditional computation and memory optimization:

  • The construction of coupling matrices (s_in, s_out) and the computation of the corresponding Green's functions are now conditional, only performed if the relevant flags (need_lesser, need_greater) are set. The last-column blocks (gr_lc) are also only stored if need_gr_lc is True. [1] [2] [3] [4] [5] [6] [7] [8]

Documentation improvements:

  • Updated and clarified docstrings in both device_property.py and recursive_green_cal.py to accurately describe new parameters and return values, and to fix references to the correct documentation locations. [1] [2] [3]

Minor code and documentation cleanup:

  • Removed commented-out code and improved comments for better readability and maintainability.

These changes collectively make the NEGF code more modular, efficient, and user-friendly, especially for large-scale or memory-constrained calculations.

@AsymmetryChou AsymmetryChou requested a review from Copilot June 10, 2026 16:03

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@AsymmetryChou AsymmetryChou requested review from Copilot June 11, 2026 02:32

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@AsymmetryChou AsymmetryChou merged commit 06278bc into deepmodeling:main Jun 11, 2026
1 check passed
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.

2 participants