Skip to content

Commit f7efed7

Browse files
committed
Fix: add self_energy_save_path to load self-energy when scf=true with dirichelete leads
1 parent cc14a27 commit f7efed7

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

dpnegf/negf/density.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ def __init__(self, n_gauss=None, integrate_way:str="direct", e_grid=None):
267267

268268
def density_integrate_Fiori(self,e_grid,kpoint,Vbias,block_tridiagonal,subblocks,integrate_way,deviceprop,
269269
device_atom_norbs,potential_at_atom,with_Dirichlet_leads,free_charge,E_ref,
270-
eta_lead=1e-5, eta_device=1e-5):
270+
eta_lead=1e-5, eta_device=1e-5, self_energy_save_path=None):
271271

272272
for eidx, e in enumerate(self.integrate_range):
273273
if not with_Dirichlet_leads:
@@ -276,14 +276,13 @@ def density_integrate_Fiori(self,e_grid,kpoint,Vbias,block_tridiagonal,subblocks
276276
# to ensure the Neuamnn boundary condition in the leads.
277277
deviceprop.lead_L.self_energy(kpoint=kpoint, energy=e, eta_lead=eta_lead, save=False)
278278
deviceprop.lead_R.self_energy(kpoint=kpoint, energy=e, eta_lead=eta_lead, save=False)
279+
else:
280+
# For the Dirichlet leads, the self-energy of the leads is only calculated once and saved.
281+
# In each iteration, load the pre-computed self-energy from disk.
282+
deviceprop.lead_L.self_energy(kpoint=kpoint, energy=e, eta_lead=eta_lead, save_path=self_energy_save_path)
283+
deviceprop.lead_R.self_energy(kpoint=kpoint, energy=e, eta_lead=eta_lead, save_path=self_energy_save_path)
284+
279285

280-
# else:
281-
# # For the Dirichlet leads, the self-energy of the leads is only calculated once and saved.
282-
# # In each iteration, the self-energy of the leads is not updated.
283-
# deviceprop.lead_L.self_energy(kpoint=kpoint, energy=e, eta_lead=eta_lead, save=True)
284-
# deviceprop.lead_R.self_energy(kpoint=kpoint, energy=e, eta_lead=eta_lead, save=True)
285-
286-
287286
deviceprop.cal_green_function(energy=e, kpoint=kpoint, block_tridiagonal=block_tridiagonal,\
288287
eta_device=eta_device,Vbias = Vbias)
289288

dpnegf/runner/NEGF.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -588,20 +588,21 @@ def negf_compute(self,scf_require=False,Vbias=None):
588588
self.negf_hamiltonian.subblocks = self.negf_hamiltonian.get_hs_device(only_subblocks=True)
589589

590590
self.density.density_integrate_Fiori(
591-
e_grid = self.uni_grid,
591+
e_grid = self.uni_grid,
592592
kpoint=k,
593593
Vbias=Vbias,
594594
block_tridiagonal=self.block_tridiagonal,
595595
subblocks=self.negf_hamiltonian.subblocks,
596-
integrate_way = self.density_options["integrate_way"],
596+
integrate_way = self.density_options["integrate_way"],
597597
deviceprop=self.deviceprop,
598598
device_atom_norbs=self.device_atom_norbs,
599599
potential_at_atom = self.potential_at_atom,
600600
with_Dirichlet_leads = self.poisson_options["with_Dirichlet_leads"],
601601
free_charge = self.free_charge,
602602
eta_lead = self.eta_lead,
603603
eta_device = self.eta_device,
604-
E_ref = self.deviceprop.E_ref
604+
E_ref = self.deviceprop.E_ref,
605+
self_energy_save_path = self.self_energy_save_path
605606
)
606607
else:
607608
# TODO: add Ozaki support for NanoTCAD-style SCF

0 commit comments

Comments
 (0)