Dear kwant user,
Just for fun, I used Deepseek to generate what you need. After small
corrections, I got the code below. Enjoy!
I hope the helps,
Adel
#################################################
import kwant
import numpy as np
import matplotlib.pyplot as plt
# Define Pauli matrices for spin
sigma_x = np.array([[0, 1], [1, 0]])
sigma_y = np.array([[0, -1j], [1j, 0]])
sigma_z = np.array([[1, 0], [0, -1]])
sigma_0 = np.eye(2) # Identity matrix
# Define the graphene lattice
graphene = kwant.lattice.honeycomb(a=1, norbs=2)
a, b = graphene.sublattices
# Define the system
def make_system(width, length):
# Create the system
syst = kwant.Builder()
# Define the scattering region
def central_region(pos):
x, y = pos
return -length / 2 < x < length / 2 and -width / 2 < y < width / 2
# On-site energy in the scattering region
syst[graphene.shape(central_region, (0, 0))] =0* sigma_0 # On-site
energy
# Rashba spin-orbit coupling in the central region
def rashba(site1, site2, rashba_strength):
x1, y1 = site1.pos
x2, y2 = site2.pos
dx, dy = x2 - x1, y2 - y1
return -sigma_0+1j * rashba_strength * (dy * sigma_x - dx * sigma_y)
# Add Rashba SOC to the central region
syst[graphene.neighbors()] = rashba
# Attach leads
def lead_shape(pos):
x, y = pos
return -width / 2 < y < width / 2
# Define the symmetry for the leads
sym_left = kwant.TranslationalSymmetry(graphene.vec((-1, 0)))
# Define the lead with spin conservation
lead_left = kwant.Builder(sym_left, conservation_law=-sigma_z)
lead_left[graphene.shape(lead_shape, (0, 0))] = 0* sigma_0 # On-site
energy
lead_left[graphene.neighbors()] = -sigma_0 # Hopping strength
# Attach the leads to the system
syst.attach_lead(lead_left)
syst.attach_lead(lead_left.reversed())
# Finalize the system
syst = syst.finalized()
return syst
# Parameters
width = 11
length = 20
#rashba_strength = 0.1 # Default value, can be overridden via params
#fermi_energy = 0.1
# Create the system
syst = make_system(width, length)
# Calculate the spin-resolved transmission
def spin_resolved_transmission(syst, energy, params):
# Calculate the scattering matrix
smatrix = kwant.smatrix(syst, energy, params=params)
# Define the spin projection operators
P_up = np.array([[1, 0], [0, 0]]) # Spin-up to Spin-up
P_down = np.array([[1, 0], [0, 1]]) # Spin-up to Spin-up
# Calculate transmission for spin-up and spin-down
transmission_up = smatrix.transmission(*P_up)
transmission_down = smatrix.transmission(*P_down)
return transmission_up, transmission_down
# Define the parameters as a dictionary
params = dict(rashba_strength=0.2, fermi_energy=0.51)
# Calculate the spin-resolved transmission at the Fermi energy
transmission_up, transmission_down = spin_resolved_transmission(syst,
params['fermi_energy'], params)
print(f"Transmission (spin up): {transmission_up}")
print(f"Transmission (spin down): {transmission_down}")
# Plot the system
kwant.plot(syst)
plt.show()
On Fri, Mar 7, 2025 at 1:14 PM 西科大刘燕 <[email protected]> wrote:
> Hi
> Using the Kwant package to calculate the spin-resolved conductance
> of a graphene nanoribbon, where the device region incorporates Rashba
> spin-orbit coupling (RSOC) in its Hamiltonian while the leads do not. The
> left lead is numbered 0 and the right lead is numbered 1. The goal is to
> obtain the conductance from spin-up electrons in the left lead to spin-down
> electrons in the right lead. How should the program be written?
> We tried the program in the attachment, but the result was
> unsatisfactory.
> Any help and guidance would be appreciated!
>
--
Abbout Adel