Dear KWANT developers, I would like to add a localized magnetic impurity into a quantum spin hall system with spin-flip interaction (sigma_plus I_- + sigma_- I_+ where I is the magnetic impurity spin operator. The spin-flip interaction depends on the state of the magnetic impurity (whether it is spin-up or spin-down). If it's spin-up, it needs to interact only with the spin down electrons (term sigma_+) flip them upwards, while the magnetic impurity state needs to be updated to spin-down. I've written a code using two different lattices (lat_up and lat_down) and simply check transmission from one lattice lead to the other lattice lead. But this method becomes impractical if i want to add more magnetic impurities because i need to add more and more lattice (2^N). Is there any easier way to include a scatterer with internal degree of freedom (which can be updated perhaps using tkwant or any other way)? BTW this is the model I'm working on:https://arxiv.org/abs/1705.04985 Below is the relevant part of my code and thank you so much in advance! Mert # Scattering region syst[lat_up.shape(shape, (0, 0))] = onsite syst[lat_down.shape(shape, (0, 0))] = onsite syst[kwant.HoppingKind((1, 0), lat_up)] = hopx syst[kwant.HoppingKind((1, 0), lat_down)] = hopx syst[kwant.HoppingKind((0, 1), lat_up)] = hopy syst[kwant.HoppingKind((0, 1), lat_down)] = hopy syst[(lat_up(10, 2), lat_down(10, 2))] = 0.1*0.5*np.kron(pauli.sp, pauli.s0) syst[(lat_down(10, 2), lat_up(10, 2))] = 0.1*0.5*np.kron(pauli.sm, pauli.s0) # two lines above correspond to spin-flip of the magnetic impurity, jumping from one #lattice to the other. #### Define the leads. #### sym_left = kwant.TranslationalSymmetry((-1, 0)) lead_up = kwant.Builder(sym_left) lead_down = kwant.Builder(sym_left) lead_up[lat_up.shape(lead_shape, (0, 0))] = onsite_lead lead_down[lat_down.shape(lead_shape, (0, 0))] = onsite_lead lead_up[kwant.HoppingKind((1, 0), lat_up)] = hopx_lead lead_up[kwant.HoppingKind((0, 1), lat_up)] = hopy_lead lead_down[kwant.HoppingKind((1, 0), lat_down)] = hopx_lead lead_down[kwant.HoppingKind((0, 1), lat_down)] = hopy_lead # Attach leads syst.attach_lead(lead_up) syst.attach_lead(lead_down) syst.attach_lead(lead_up.reversed()) syst.attach_lead(lead_down.reversed()) def plot_conductance(sys, p, mu): # Compute conductance p.mu = mu data = [] smatrix = kwant.smatrix(sys, energy = 0.0, params = dict(p=p)) no_flip = smatrix.transmission(2, 0) flip = smatrix.transmission(1,0) return no_flip, flip