1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 # Copyright 2011-2013 Kwant authors.  #  # This file is part of Kwant. It is subject to the license terms in the file  # LICENSE.rst found in the top-level directory of this distribution and at  # http://kwant-project.org/license. A list of Kwant authors can be found in  # the file AUTHORS.rst at the top-level directory of this distribution and at  # http://kwant-project.org/authors.    import numpy as np  from ..solvers.common import SMatrix    __all__ = ['two_terminal_shotnoise']      def two_terminal_shotnoise(smatrix):  r"""Compute the shot-noise in a two-terminal setup.    In a two terminal system the shot noise is given by tr((1 - t*t^\dagger) *  t*t^\dagger).    Parameters  ----------  smatrix : ~kwant.solvers.common.SMatrix instance  A two terminal scattering matrix.    Returns  -------  noise : float  Shot noise measured in noise quanta 2 e^3 |V| / pi hbar.  """    32 ↛ 33line 32 didn't jump to line 33, because the condition on line 32 was never true if not isinstance(smatrix, SMatrix):  raise NotImplementedError("Noise expressions in terms of Green's "  "functions are not implemented.")    if len(smatrix.lead_info) != 2:  raise ValueError("Only works for two-terminal systems!")    t = smatrix.submatrix(smatrix.out_leads[0], smatrix.in_leads[0])  ttdag = np.dot(t, t.conj().T)  return np.trace(ttdag - np.dot(ttdag, ttdag)).real      # A general multi-terminal routine for noise would need to also have the  # voltages at various leads as input. (See  # http://arxiv.org/abs/cond-mat/9910158) It could still be based on  # smatrix._a_ttdagger_a_inv, i.e. be also valid also for self-energy leads,  # provided that only true transmission blocks are used. As long as nobody needs  # it though, it does make little sense to make such a routine.