Skip to content
Snippets Groups Projects
Commit 923f4c73 authored by Anton Akhmerov's avatar Anton Akhmerov Committed by Christoph Groth
Browse files

fix indentation error, apply pep8

parent c23aceaf
No related branches found
No related tags found
No related merge requests found
...@@ -23,6 +23,7 @@ from .. import physics, system ...@@ -23,6 +23,7 @@ from .. import physics, system
LinearSys = namedtuple('LinearSys', ['lhs', 'rhs', 'kept_vars']) LinearSys = namedtuple('LinearSys', ['lhs', 'rhs', 'kept_vars'])
class SparseSolver(object): class SparseSolver(object):
"""Solver class for computing physical quantities based on solving """Solver class for computing physical quantities based on solving
a liner system of equations. a liner system of equations.
...@@ -210,7 +211,7 @@ class SparseSolver(object): ...@@ -210,7 +211,7 @@ class SparseSolver(object):
y, x = np.meshgrid(indices, indices) y, x = np.meshgrid(indices, indices)
sig_sparse = splhsmat((sigma.flat, [x.flat, y.flat]), sig_sparse = splhsmat((sigma.flat, [x.flat, y.flat]),
lhs.shape) lhs.shape)
lhs = lhs + sig_sparse # __iadd__ is not implemented in v0.7 lhs = lhs + sig_sparse # __iadd__ is not implemented in v0.7
if leadnum in out_leads: if leadnum in out_leads:
kept_vars.extend(list(indices)) kept_vars.extend(list(indices))
if leadnum in in_leads: if leadnum in in_leads:
...@@ -321,7 +322,6 @@ class SparseSolver(object): ...@@ -321,7 +322,6 @@ class SparseSolver(object):
return result return result
def ldos(self, fsys, energy=0): def ldos(self, fsys, energy=0):
""" """
Calculate the local density of states of a system at a given energy. Calculate the local density of states of a system at a given energy.
...@@ -431,23 +431,23 @@ class BlockResult(namedtuple('BlockResultTuple', ['data', 'lead_info'])): ...@@ -431,23 +431,23 @@ class BlockResult(namedtuple('BlockResultTuple', ['data', 'lead_info'])):
"""Return transmission from lead_in to lead_out.""" """Return transmission from lead_in to lead_out."""
if isinstance(self.lead_info[lead_out], tuple) and \ if isinstance(self.lead_info[lead_out], tuple) and \
isinstance(self.lead_info[lead_in], tuple): isinstance(self.lead_info[lead_in], tuple):
return np.linalg.norm(self.submatrix(lead_out, lead_in))**2 return np.linalg.norm(self.submatrix(lead_out, lead_in)) ** 2
else: else:
result = np.trace(self._a_ttdagger_a_inv(lead_out, lead_in)).real result = np.trace(self._a_ttdagger_a_inv(lead_out, lead_in)).real
if lead_out == lead_in: if lead_out == lead_in:
# For reflection we have to be more careful # For reflection we have to be more careful
gamma = 1j * (self.lead_info[lead_in] - gamma = 1j * (self.lead_info[lead_in] -
self.lead_info[lead_in].conj().T) self.lead_info[lead_in].conj().T)
gf = self.submatrix(lead_out, lead_in) gf = self.submatrix(lead_out, lead_in)
# The number of channels is given by the number of # The number of channels is given by the number of
# nonzero eigenvalues of Gamma # nonzero eigenvalues of Gamma
# rationale behind the threshold from # rationale behind the threshold from
# Golub; van Loan, chapter 5.5.8 # Golub; van Loan, chapter 5.5.8
eps = np.finfo(gamma.dtype).eps * 1000 eps = np.finfo(gamma.dtype).eps * 1000
N = np.sum(np.linalg.eigvalsh(gamma) > N = np.sum(np.linalg.eigvalsh(gamma) >
eps * np.linalg.norm(gamma, np.inf)) eps * np.linalg.norm(gamma, np.inf))
result += 2 * np.trace(np.dot(gamma, gf)).imag + N result += 2 * np.trace(np.dot(gamma, gf)).imag + N
return result return result
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment