Dear Kwant Developers,

I am trying to calculate the conductance of a 3D system with dimension L ×
W × H, by imposing periodic boundary conditions in all three directions. I
am able to calculate the band structure but unable to calculate the
corresponding conductance using kwant.smatrix. I am not sure whether kwant
is able to do transport calculations on systems with periodic boundaries
using smatrix. Please advise. The code is following

import kwant
import scipy.sparse.linalg as sla
import matplotlib.pyplot as plt
import tinyarray
import numpy as np
from numpy import cos, sin, pi
import cmath
from cmath import exp
from matplotlib import rc, rcParams
rc('text', usetex=True)
rc('axes', linewidth=2)
rc('font', weight='bold')
#rcParams['text.latex.preamble'] = [r'\usepackage{sfmath} \boldmath']
#rcParams['text.latex.preamble'] = [r'\usepackage{sfmath} \boldmath']
sigma_0 = tinyarray.array([[1, 0], [0, 1]])
sigma_x = tinyarray.array([[0, 1], [1, 0]])
sigma_y = tinyarray.array([[0, -1j], [1j, 0]])
sigma_z = tinyarray.array([[1, 0], [0, -1]])


def make_sys(a=1, m_0 = 2, L=1, W=100, H=1, t=1.0, t_z=0.0, phi=0.01):
    #L=10; W=80; H=60;
    def onsite(site):
        return 2 * m_0 * sigma_x

    def hoppingx(site0, site1):
        y = site1.pos[1]
        return (t * sigma_x)

    def hoppingy(site0, site1):
        return -1j * t * sigma_y - (m_0/2) * sigma_x

    def hoppingz(site0, site1):
        y = site1.pos[1]
        return (-1j * t * sigma_z - (m_0/2) * sigma_x - 1j * t_z * sigma_0)
* exp(2 * pi * 1j * (y) * phi)

    lat =kwant.lattice.cubic(norbs=2)
    #sys = kwant.Builder(kwant.TranslationalSymmetry(lat.vec((0, 0, H))))
    #sys[(lat(x, y, z) for x in range(L) for y in range(W) for z in
range(H))] = onsite
    #sys = kwant.Builder(kwant.TranslationalSymmetry((L, 0, 0),(0, 0, H)))
    #sys[(lat(0, y, 0) for y in range(W))] = onsite
    sys = kwant.Builder(kwant.TranslationalSymmetry((L, 0, 0),(0, W, 0),(0,
0, H)))
    sys[lat.shape(lambda p: True, (0,0,0))] =  onsite
    sys[kwant.builder.HoppingKind((1, 0, 0), lat, lat)] = hoppingx
    sys[kwant.builder.HoppingKind((0, 1, 0), lat, lat)] = hoppingy
    sys[kwant.builder.HoppingKind((0, 0, 1), lat, lat)] = hoppingz
    sys = kwant.wraparound.wraparound(sys, keep=None)

    leadL = kwant.Builder(kwant.TranslationalSymmetry((-a, 0,
0),lat.vec((0, W, 0)),lat.vec((0, 0, H))))

    leadL[(lat(0, y, z) for y in range(W) for z in range(H))] = onsite
    leadL[kwant.builder.HoppingKind((1, 0, 0), lat, lat)] = hoppingx
    leadL[kwant.builder.HoppingKind((0, 1, 0), lat, lat)] = hoppingy
    leadL[kwant.builder.HoppingKind((0, 0, 1), lat, lat)] = hoppingz

    leadR = kwant.Builder(kwant.TranslationalSymmetry((a, 0, 0),lat.vec((0,
W, 0)),lat.vec((0, 0, H))))

    leadR[(lat(0, y, z) for y in range(W) for z in range(H))] = onsite
    leadR[kwant.builder.HoppingKind((1, 0, 0), lat, lat)] = hoppingx
    leadR[kwant.builder.HoppingKind((0, 1, 0), lat, lat)] = hoppingy
    leadR[kwant.builder.HoppingKind((0, 0, 1), lat, lat)] = hoppingz

    leadL = kwant.wraparound.wraparound(leadL, keep=0)
    leadR = kwant.wraparound.wraparound(leadR, keep=0)

    sys.attach_lead(leadL)
    sys.attach_lead(leadR)

    sys = sys.finalized()
    return sys
syst=make_sys()
def plot_bands_2d(syst, momenta=(101, 101, 101), ky=0, kz=0):
    if not isinstance(syst, kwant.system.FiniteSystem):
        raise TypeError("Need a system without symmetries.")
    fig = plt.figure(figsize=(5, 5))
    #kwant.plotter.bands(syst.leads[0], momenta=np.linspace(-np.pi, np.pi,
101), show=False)
    kxs = np.linspace(-np.pi, np.pi, momenta[0])
    def get_energies(ky=ky, kz=kz):
        energies = [np.linalg.eigvalsh(syst.hamiltonian_submatrix
                                        ((kx, ky, kz))) for kx in kxs]
        return energies
    energies = np.array(get_energies(ky=ky, kz=kz))
    # Plot the band structure
    for band in np.array(energies).T:
        plt.plot(kxs, band)
    plt.ylim(-2.5, 2.5)
    plt.xlim(-pi, pi)
    plt.xlabel("kx")
    plt.ylabel("Energy")
plot_bands_2d(syst)


kzs = np.linspace(-pi,pi,101)
kys = np.linspace(-pi,pi,101)
energies = np.linspace(0.0, 0.5, 30)
data=[]

for energy in energies:

    Tkx = np.zeros(101)

    for i in np.arange(len(kzs)):
        kz=kzs[i]
        ky=kys[i]
        smatrix = kwant.smatrix(syst, energy, [kz], [ky])
        Tkx[i]=smatrix.transmission(1, 0)
    data.append(sum(Tkx))

plt.plot(energies, data)
plt.show()


Also as a separate question, I am trying to run the notebook
Kubo_Bastin_conductivity_with_periodic_boundary_conditions.ipynb from
https://gitlab.com/kpm-tools/bloch/-/tree/master/examples?ref_type=heads
to understand the kubo conductivity calcualton on a system with periodic
boundaries but various errors are there in importing bloch.py. I am using
kwant.__version__ = '1.4.4'. Please help in this regard.

Thanks in advance.
-- 
Best Regards,
Naveen Yadav
Department of Physics & Astrophysics
University Of Delhi
New Delhi-110007

Reply via email to