Dear Simon,

To take into account temperature, you need to do an integration over an interval at least 3x KT  around Ef if you want to have a good approximation (Unless your transmission is very sharp around EF).
You need also to do a proper integration and not just a sum as you did.
Taking the eigenenergies of the scattering system is not the correct way. The electrons are coming from the lead and you need to take all the energies (continuum) in the band (you can descritize your band in a smart way depending on the profile of the transmission as Ef). 
You need to be careful about how the band end the Fermi Dirac distribution change with the magnetic field too.

I hope this helps,

On Mon, Dec 9, 2019 at 7:48 PM <> wrote:
Dear kwant users

I'm trying to calculate magnetic field dependent conductance of a system. For this I used the scattering matrix and adding temperature dependence
by multiplying the transmission value by the derivative of the fermi-dirac function. Because of the results I got, I'm not sure if this is the right way of doing it.
Can someone please help me?

Thank you very much

Best regards


fluxes = np.linspace(0, 5, 100)

def make_system(a=1, t=1.5, w=15, d=30):
    lat = kwant.lattice.square(a)
    syst = kwant.Builder()

    def onsite(site, U0, salt):
        return U0 * (uniform(repr(site), repr(salt)) - 0.5) +  4*t

    syst[(lat(x, y) for x in range(w) for y in range(d))] = onsite

    def hopping(site_i, site_j, phi):
        xi, yi = site_i.pos
        xj, yj = site_j.pos
        if yi == yj:
            return -t
        if xi == xj:
            return -0.001 * t * exp(-0.5j * phi * (xi + xj) * (yi - yj))

    syst[lat.neighbors()] = hopping

    lead = kwant.Builder(kwant.TranslationalSymmetry((0, -a)))
    lead[(lat(j, 0) for j in range(w))] = 4 * t
    lead[lat.neighbors()] = hopping

    return syst

def plot_conductance(syst):
    temp = 0.01
    salt = 0.2
    phis = np.linspace(0, (2 * pi / w) * 5, 100)
    count = 0
    values = []
    for phi in phis:
        count += 1
        ham_mat = syst.hamiltonian_submatrix(params=dict(phi=phi, U0=U0, salt=salt), sparse=True)
        evals = np.real(np.sort(np.linalg.eigvals(ham_mat.todense())))
        EF = evals[int(len(evals) / 2)]
        liste = []
        for k in range(0,len(evals)):
            energy = evals[k]

            if EF-temp <= energy <= EF+temp:
                df = np.real(exp((energy - EF) / temp) / (temp * (exp((energy - EF) / temp) + 1) ** 2))
                Smatrix = kwant.smatrix(syst, energy, params=dict(phi=phi, U0=U0, salt=salt))
        val = sum(liste)/(len(liste))

    plt.plot(fluxes,values, label = w)
    plt.title("Conductance eqhop temp=0.1")
    plt.xlabel(r'$\phi [2\pi / L]$')

def main():
    syst = make_system()
    syst = syst.finalized()

if __name__ == "__main__":

Abbout Adel