zerothi / sisl

Electronic structure Python package for post analysis and large scale tight-binding DFT/NEGF calculations
https://zerothi.github.io/sisl
Mozilla Public License 2.0
181 stars 58 forks source link

"transfer matrix has 0 elements" in TBtrans #643

Closed AsymmetryChou closed 10 months ago

AsymmetryChou commented 10 months ago

Describe the issue Dear developers, Hello! I encounter a problem when run TBtrans for calculating TB model of an carbon chain with 12 atoms, where 4 for central part and 4 for left/right electrode resepctively.

I have no idea where the problem is. The lead( with 4 atoms) Hamiltonian elements are: [[-0.50120997 0.02240228 0. 0.02240228] [ 0.02240228 -0.50120997 0.02240228 0. ] [ 0. 0.02240228 -0.50120997 0.02240228] [ 0.02240228 0. 0.02240228 -0.50120997]]

Thank you very much!

Version details Run the below code and add to issue (if an issue is relevant for the issue): 3.9.18 (main, Sep 11 2023, 13:41:44) [GCC 11.2.0] 0.14.3.dev54+g83feb814c

AsymmetryChou commented 10 months ago

The RUN.fdf is :

TBT.HS chain.nc TBT.k [50 50 1] TBT.DOS.Gf true TBT.DOS.A true %block TBT.Elec.Left HS lead_L.nc semi-inf-direction -A3 electrode-position 1 %endblock TBT.Elec.Left %block TBT.Elec.Right HS lead_R.nc semi-inf-direction +A3 electrode-position end -1 %endblock TBT.Elec.Right

AsymmetryChou commented 10 months ago

I think I have solved this problem. The mistake above may result from ignoring hopping elements between unit cells. The interesting thing now is that: the Lead Hamiltonina is ( read by sisl.Hamiltonian.H[i,j] ,i/j range from 0 to 3) [[-0.50120997 0.02240228 0. 0. ] [ 0.02240228 -0.50120997 0.02240228 0. ] [ 0. 0.02240228 -0.50120997 0.02240228] [ 0. 0. 0.02240228 -0.50120997]] which contains 10 non-zero elements. However, if I print out the Lead Hamiltonian.nnz, it shows 12 non-zero element. So it hides the 2 elements corresponding connection between nearest unit cells. That's the reason I encountered the above mistake.

zerothi commented 10 months ago

Seems like you solved the problem your self?

If anything, it seems you are building the structure erroneously, something about the couplings and nsc. If you want help, please post the code that creates the Hamiltonian. Also, please put your code (and fdf-inputs) in triple back ticks to get code blocks: ```