-
Notifications
You must be signed in to change notification settings - Fork 5
self energy and e3 model fix #52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Lonya0
wants to merge
2
commits into
DeePTB-Lab:main
Choose a base branch
from
Lonya0:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -109,6 +109,26 @@ def __init__(self, | |
| self.kpoints,self.wk = kmesh_sampling_negf(self.stru_options["kmesh"], | ||
| self.stru_options["gamma_center"], | ||
| self.stru_options["time_reversal_symmetry"]) | ||
|
|
||
| if 'override_overlap' in kwargs: | ||
| assert isinstance(kwargs['override_overlap'], str) | ||
| self.override_overlap = kwargs['override_overlap'] | ||
| log.info(msg="Using external calculated overlap overriding!") | ||
| else: | ||
| self.override_overlap = None | ||
|
|
||
| if 'parallel_options' in kwargs: | ||
| assert isinstance(kwargs['parallel_options'], dict) | ||
| self.parallel_options = kwargs['parallel_options'] | ||
| log.info(msg="Read parallel options from input!") | ||
| else: | ||
| self.parallel_options = { | ||
| "n_job": -1, | ||
| "batch_size": 200, | ||
| "backend": "loky" | ||
| } | ||
|
Comment on lines
+125
to
+129
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Default parallel options will crash with Line 126 defines Suggested fix else:
self.parallel_options = {
- "n_job": -1,
+ "n_jobs": -1,
"batch_size": 200,
"backend": "loky"
}Also applies to: 564-565, 571-572 🤖 Prompt for AI Agents |
||
| log.info(msg="No parallel options Input, using default settings!") | ||
|
|
||
| log.info(msg="------ k-point for NEGF -----") | ||
| log.info(msg="Gamma Center: {0}".format(self.stru_options["gamma_center"])) | ||
| log.info(msg="Time Reversal: {0}".format(self.stru_options["time_reversal_symmetry"])) | ||
|
|
@@ -168,7 +188,7 @@ def __init__(self, | |
| e_fermi = {}; chemiPot = {} | ||
| # calculate Fermi level | ||
| if self.e_fermi is None: | ||
| elec_cal = ElecStruCal(model=model,device=self.torch_device) | ||
| elec_cal = ElecStruCal(model=model, device=self.torch_device, override_overlap=self.override_overlap) | ||
| nel_atom_lead = self.get_nel_atom_lead( | ||
| struct_leads, | ||
| charge={lead_tag: self.stru_options[lead_tag].get("charge", 0) for lead_tag in ["lead_L", "lead_R"]} | ||
|
|
@@ -522,7 +542,8 @@ def prepare_self_energy(self, scf_require: bool) -> None: | |
| # self energy calculation | ||
| log.info(msg="------Self-energy calculation------") | ||
| if self.self_energy_save_path is None: | ||
| self.self_energy_save_path = os.path.join(self.results_path, "self_energy") | ||
| self.self_energy_save_path = os.path.join(self.results_path, "self_energy") | ||
| self.self_energy_save_path = os.path.abspath(self.self_energy_save_path) | ||
| os.makedirs(self.self_energy_save_path, exist_ok=True) | ||
|
|
||
| if self.use_saved_se: | ||
|
|
@@ -539,11 +560,17 @@ def prepare_self_energy(self, scf_require: bool) -> None: | |
| # self.deviceprop.lead_L.self_energy(kpoint=k, energy=e, eta_lead=self.eta_lead, save=True) | ||
| # self.deviceprop.lead_R.self_energy(kpoint=k, energy=e, eta_lead=self.eta_lead, save=True) | ||
| compute_all_self_energy(self.eta_lead, self.deviceprop.lead_L, self.deviceprop.lead_R, | ||
| self.kpoints, self.density.integrate_range, self.self_energy_save_path) | ||
| self.kpoints, self.density.integrate_range, self.self_energy_save_path, | ||
| n_jobs=self.parallel_options["n_jobs"], | ||
| batch_size=self.parallel_options["batch_size"], | ||
| parallel_backend=self.parallel_options["backend"]) | ||
| elif not self.scf: | ||
| # In non-scf case, the self-energy of the leads is calculated for each energy point in the energy grid. | ||
| compute_all_self_energy(self.eta_lead, self.deviceprop.lead_L, self.deviceprop.lead_R, | ||
| self.kpoints, self.uni_grid, self.self_energy_save_path) | ||
| self.kpoints, self.uni_grid, self.self_energy_save_path, | ||
| n_jobs=self.parallel_options["n_jobs"], | ||
| batch_size=self.parallel_options["batch_size"], | ||
| parallel_backend=self.parallel_options["backend"]) | ||
| log.info(msg="-----------------------------------\n") | ||
|
|
||
|
|
||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
override_overlap=Falsecannot pass through runner validation.Line 114 asserts
str, which rejects the explicitFalsedisable behavior supported downstream.Suggested fix
📝 Committable suggestion
🤖 Prompt for AI Agents