This time *with* the recipe attached Joe
# -*- coding: utf-8 -*- import numpy as np
sigma_z = np.array([[1, 0], [0, -1]]) def spin_conductance(G, lead_out, lead_in, sigma=sigma_z): """Calculate the spin conductance between two leads. Parameters ---------- G : an instance of `kwant.solvers.common.GreensFunction` The Greens function of the system as returned by `kwant.greens_function`. lead_out : integer The lead where spin current is collected lead_in : integer The lead where spin current is injected sigma : `numpy.ndarray` of shape (2, 2) The Pauli matrix of the quantization axis along which to measure the spin current Notes ----- Calculates the spin conductance between two leads p and q according to: G_{pq} = Tr[ Ï_{α} Î_{q} G_{qp} Î_{p} G^+_{qp} ] Where Î_{q} is the coupling matrix to lead q ( = i[Σ - Σ^+] ) and G_{qp} is the submatrix of the system's Greens function between sites interfacing with lead p and q. """ ttdagger = G._a_ttdagger_a_inv(lead_out, lead_in) sigma_z_matrix = numpy.kron(np.eye(attdagger.shape[0]//2), sigma) return np.trace(sigma_z_matrix.dot(ttdagger)).real
signature.asc
Description: OpenPGP digital signature