Skip to content

Commit

Permalink
unified docstrings and made additional tb_params module
Browse files Browse the repository at this point in the history
  • Loading branch information
freude committed Jul 22, 2020
1 parent c5566a8 commit 3f677ce
Show file tree
Hide file tree
Showing 34 changed files with 2,358 additions and 750 deletions.
9 changes: 7 additions & 2 deletions examples/si_nw_transmission.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import numpy as np
import nanonet.negf as negf
import matplotlib.pyplot as plt
from nanonet.tb import Hamiltonian
from nanonet.tb import Hamiltonian, HamiltonianSp
from nanonet.tb import Orbitals
from nanonet.tb.sorting_algorithms import sort_projection

Expand Down Expand Up @@ -40,7 +40,7 @@ def main():
hl1, h01, hr1, subblocks = hamiltonian.get_hamiltonians_block_tridiagonal()

# specify energy array
energy = np.linspace(2.0, 2.45, 50)
energy = np.linspace(2.1, 2.2, 50)

# specify dephasing constant
damp = 0.001j
Expand All @@ -56,6 +56,8 @@ def main():

# compute self-energies describing boundary conditions at the leads contacts
R, L = negf.surface_greens_function(E, hl, h0, hr, iterate=False, damp=damp)
# R, L = surface_greens_function_poles_Shur(E, hl, h0, hr)
# R, L = surface_greens_function(E, hl, h0, hr, iterate=False, damp=damp)

s01, s02 = h01[0].shape
s11, s12 = h01[-1].shape
Expand Down Expand Up @@ -92,6 +94,9 @@ def main():
plt.plot(energy, dos)
plt.show()

plt.plot(dos)
plt.show()

plt.plot(energy, tr)
plt.show()

Expand Down
85 changes: 72 additions & 13 deletions nanonet/negf/cfr.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@


class CFR(object):
""" """

val_inf = 1.0e4

Expand All @@ -16,6 +17,17 @@ def __init__(self, cutoff=0):
self.gen_poles_and_residues(self.cutoff)

def fd_approximant(self, energy):
"""
Parameters
----------
energy :
Returns
-------
"""
arg = np.array(energy)
ans = np.zeros(arg.shape) + 0.5

Expand All @@ -27,6 +39,17 @@ def fd_approximant(self, energy):
return ans

def fd_approximant_diff(self, energy):
"""
Parameters
----------
energy :
Returns
-------
"""

arg = np.array(energy)
ans = np.zeros(arg.shape) + 0.5 * 0
Expand All @@ -39,11 +62,16 @@ def fd_approximant_diff(self, energy):
return ans

def gen_poles_and_residues(self, cutoff=50):
"""
Compute positions of poles and their residuals for the Fermi-Dirac function
"""Compute positions of poles and their residuals for the Fermi-Dirac function
Parameters
----------
cutoff :
cutoff energy (Default value = 50)
Returns
-------
:param cutoff: cutoff energy
:return:
"""

self.cutoff = cutoff
Expand All @@ -60,16 +88,26 @@ def gen_poles_and_residues(self, cutoff=50):
self.num_poles = len(self.fd_poles_coords)

def get_poles_and_residues(self):
""" """
return self.fd_poles_coords, self.fd_poles

def integrate(self, gf, ef=0, tempr=300, zero_moment=-1):
"""
:param gf:
:param ef:
:param tempr:
:param zero_moment:
:return:
Parameters
----------
gf :
param ef:
tempr :
param zero_moment: (Default value = 300)
ef :
(Default value = 0)
zero_moment :
(Default value = -1)
Returns
-------
"""

if zero_moment == -1:
Expand All @@ -86,6 +124,19 @@ def integrate(self, gf, ef=0, tempr=300, zero_moment=-1):
return np.real(zero_moment + np.imag(ans))

def genetate_integration_points(self, ef, tempr):
"""
Parameters
----------
ef :
tempr :
Returns
-------
"""
ans = []
betha = 1.0 / (8.617333262145e-5 * tempr)

Expand All @@ -97,10 +148,18 @@ def genetate_integration_points(self, ef, tempr):
def integrate1(self, gf_vals, tempr, zero_moment=0):
"""
:param gf_vals:
:param tempr:
:param zero_moment:
:return:
Parameters
----------
gf_vals :
param tempr:
zero_moment :
return: (Default value = 0)
tempr :
Returns
-------
"""

assert len(gf_vals) == len(self.fd_poles_coords)
Expand Down
106 changes: 106 additions & 0 deletions nanonet/negf/continued_fraction_representation.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,36 @@


def t_order_frac(x):
"""
Parameters
----------
x :
Returns
-------
"""
return 0.5 * (np.sign(x) + 1.0) / x


def approximant(energy, poles, residues):
"""
Parameters
----------
energy :
poles :
residues :
Returns
-------
"""

arg = np.array(energy)
ans = np.zeros(arg.shape) + 0.5
Expand All @@ -20,6 +46,21 @@ def approximant(energy, poles, residues):


def approximant_diff(energy, poles, residues):
"""
Parameters
----------
energy :
poles :
residues :
Returns
-------
"""

arg = np.array(energy)
ans = np.zeros(arg.shape) + 0.5 * 0
Expand All @@ -32,6 +73,17 @@ def approximant_diff(energy, poles, residues):


def poles_and_residues(cutoff=2):
"""
Parameters
----------
cutoff :
(Default value = 2)
Returns
-------
"""

b_mat = [1 / (2.0 * np.sqrt((2*(j+1) - 1)*(2*(j+1) + 1))) for j in range(0, cutoff-1)]
b_mat = np.diag(b_mat, -1) + np.diag(b_mat, 1)
Expand All @@ -46,20 +98,59 @@ def poles_and_residues(cutoff=2):


def test_gf1(z):
"""
Parameters
----------
z :
Returns
-------
"""
return t_order_frac(z + 10.0) + \
t_order_frac(z + 5.0) + \
t_order_frac(z + 2.0) + \
t_order_frac(z - 5.0)


def test_gf(z):
"""
Parameters
----------
z :
Returns
-------
"""
return 1.0 / (z + 10.0) + \
1.0 / (z + 5.0) + \
1.0 / (z + 2.0) + \
1.0 / (z - 5.0)


def test_integration(Ef, tempr, cutoff=70, gf=test_gf):
"""
Parameters
----------
Ef :
tempr :
cutoff :
(Default value = 70)
gf :
(Default value = test_gf)
Returns
-------
"""

R = 1.0e10

Expand All @@ -81,6 +172,21 @@ def test_integration(Ef, tempr, cutoff=70, gf=test_gf):


def bf_integration(Ef, tempr, gf=test_gf):
"""
Parameters
----------
Ef :
tempr :
gf :
(Default value = test_gf)
Returns
-------
"""

# temp = 100
R = 2e2
Expand Down

0 comments on commit 3f677ce

Please sign in to comment.