calculate_conductance_and_scattering_matrix.py
Code:
import guan
import numpy as np
fermi_energy_array = np.linspace(-4, 4, 400)
h00 = guan.hamiltonian_of_finite_size_system_along_one_direction(4)
h01 = np.identity(4)
conductance_array = guan.calculate_conductance_with_fermi_energy_array(fermi_energy_array, h00, h01)
guan.plot(fermi_energy_array, conductance_array, xlabel='E', ylabel='Conductance', style='-')
fermi_energy = 0
guan.print_or_write_scattering_matrix(fermi_energy, h00, h01)
Result:

Active channel (left or right) = 4
Evanescent channel (left or right) = 0
K of right-moving active channels:
[-2.51327412 -1.88495559 -1.25663706 -0.62831853]
K of left-moving active channels:
[0.62831853 1.25663706 1.88495559 2.51327412]
Velocity of right-moving active channels:
[1.1755705 1.90211303 1.90211303 1.1755705 ]
Velocity of left-moving active channels:
[-1.1755705 -1.90211303 -1.90211303 -1.1755705 ]
Transmission matrix:
[[1.00000000e+00 2.88051716e-30 8.33511813e-31 1.24844696e-30]
[1.26080355e-30 1.00000000e+00 2.05654486e-31 2.97797913e-30]
[2.14653915e-30 1.26509165e-30 1.00000000e+00 1.15767723e-30]
[1.67318168e-29 4.78142290e-31 3.37550560e-30 1.00000000e+00]]
Reflection matrix:
[[7.32829498e-30 1.65131531e-30 3.61937300e-30 4.45308623e-30]
[2.31376744e-31 2.89620985e-31 1.88395613e-30 5.96210151e-30]
[5.56363263e-30 9.94260647e-30 4.78761487e-30 6.65051851e-31]
[8.88884354e-30 3.88334273e-30 7.37760352e-31 1.57752921e-30]]
Total transmission of channels:
[1. 1. 1. 1.]
Total reflection of channels:
[2.20121479e-29 1.57668855e-29 1.10287044e-29 1.26577688e-29]
Sum of transmission and reflection of channels:
[1. 1. 1. 1.]
Total conductance = 3.999999999999991