Dear all,

I have tried a primitive forking of kwant computation with joblib package. This worked well for bands computation, here's the code, but it fails for smatrix.transmission. I would be grateful for any hints and examples.

Thank you,

Sergey

from joblib import Parallel, delayed

def plot_bandstructure(flead, momenta, args, max=0.05):
    global  processors
    switch=False
    cutoff=0.001
    bands = kwant.physics.Bands(flead, args=args)
energies = Parallel(n_jobs=processors)(delayed(bands)(k) for k in momenta)

    pyplot.figure()
    pyplot.plot(momenta, energies)
    pyplot.ylim([-max,max])
    pyplot.xlabel("momentum [(lattice constant)^-1]")
    pyplot.ylabel("energy [t]")
    pyplot.show(block=False)

def transm(sys, energy, lead1,lead2,args):
    print("Smatrix for energy ", energy)
    smatrix = delayed(kwant.smatrix)(sys, energy,args=args)
    return smatrix.transmission(lead1, lead2)

def plot_conductance(sys, lead1,lead2, energies,args,label):
    # Compute transmission as a function of energy

    global processors

data = Parallel(n_jobs=processors)(delayed(transm)(sys, energy,lead1, lead2, args=args) for energy in energies)
    print(data)
    pyplot.figure()
    pyplot.plot(energies, data)
    pyplot.xlabel("energy [t]")
    pyplot.ylabel("conductance [e^2/h]")
    pyplot.title(label)
    return data

Reply via email to