Re: [Kwant] Spin Currents using Greens Functions

2015-09-01 Thread Joseph Weston
Hi all,

It was pointed out to me by Qingtian Zhang that the file that I posted
cannot actually be opened. There was some odd binary cruft at the
bottom. The non-mangled file is attached.

Happy kwanting,

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: Digital signature


Re: [Kwant] Spin Currents using Greens Functions

2015-07-17 Thread Anton Akhmerov
Hi Joe,

This is a nice hack! I once thought of a more systematic and cleaner
solution would be to produce the scattering matrix whose modes are
identical aside of spin degeneracy. This wouldn't rely on using the
slower and less stable Green's functions.
Forcing extra requirements on the modes in the lead is really quite
easy and can be preferable since you can probably save computational
costs also for the modes. For example in [1] we've done it for
time-reversal symmetry, and in [2] Michael used it to calculate
Andreev conductance in a neater way than what is suggested by the
Kwant tutorial.

I started implementing such leads once, but didn't have enough time to
come to a reasonable point.

Cheers,
Anton

[1]: http://arxiv.org/src/1408.1563v2/anc/trijunction.py (see class
TRIInfiniteSystem)
[2]: http://wwwhome.lorentz.leidenuniv.nl/~wimmer/tcscxviii/phlead.py
(was used for example in
http://nbviewer.ipython.org/url/wwwhome.lorentz.leidenuniv.nl/~wimmer/tcscxviii/Hybrid%20nanowire%20system.ipynb)

On Fri, Jul 17, 2015 at 7:44 PM, Joseph Weston  wrote:
> This time *with* the recipe attached
>
> Joe


Re: [Kwant] Spin Currents using Greens Functions

2015-07-17 Thread Joseph Weston
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