Skip to content

Commit

Permalink
clean uo examples
Browse files Browse the repository at this point in the history
  • Loading branch information
freude committed Jun 27, 2020
1 parent f136bcb commit 475faee
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
2 changes: 1 addition & 1 deletion examples/si_bulk.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from nanonet.tb import get_k_coords


# Crystal structure parameters
# Lattice constant
a = 5.50

# Primitive cell
Expand Down
29 changes: 16 additions & 13 deletions examples/si_nw_transmission.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ def main():
left_lead = [40, 66, 58, 47, 48, 71, 72, 73, 74, 65]

# create a Hamiltonian object storing the Hamiltonian matrices
hamiltonian = Hamiltonian(xyz=path, nn_distance=2.4,
sort_func=sort_projection,
left_lead=left_lead, right_lead=right_lead)
# hamiltonian = Hamiltonian(xyz=path, nn_distance=2.4,
# sort_func=sort_projection,
# left_lead=left_lead, right_lead=right_lead)
hamiltonian = Hamiltonian(xyz=path, nn_distance=2.4)
hamiltonian.initialize()

# set periodic boundary conditions
Expand All @@ -39,10 +40,10 @@ def main():
hl1, h01, hr1, subblocks = hamiltonian.get_hamiltonians_block_tridiagonal()

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

# specify dephasing constant
damp = 0.0005j
damp = 0.001j

# initialize output arrays by zeros
tr = np.zeros(energy.shape)
Expand All @@ -60,16 +61,16 @@ def main():
s11, s12 = h01[-1].shape

# apply self-energies
h01[0] = h01[0] + L[:s01, :s02]
h01[-1] = h01[-1] + R[-s11:, -s12:]
# h01[0] = h01[0] + L[:s01, :s02]
# h01[-1] = h01[-1] + R[-s11:, -s12:]

# compute Green's functions using the recursive Green's function algorithm
# g_trans, grd, grl, gru, gr_left = negf.recursive_gf(E, [hl, hl], [h0+L, h0, h0+R], [hr, hr], damp=damp)
g_trans, grd, grl, gru, gr_left = negf.recursive_gf(E, hl1, h01, hr1, damp=damp)
g_trans, grd, grl, gru, gr_left = negf.recursive_gf(E, [hl, hl], [h0+L, h0, h0+R], [hr, hr], damp=damp)
# g_trans, grd, grl, gru, gr_left = negf.recursive_gf(E, hl1, h01, hr1, damp=damp)

# detach self-energies
h01[0] = h01[0] - L[:s01, :s02]
h01[-1] = h01[-1] - R[-s11:, -s12:]
# h01[0] = h01[0] - L[:s01, :s02]
# h01[-1] = h01[-1] - R[-s11:, -s12:]

# number of subblocks
num_periods = len(grd)
Expand All @@ -78,8 +79,10 @@ def main():
for jj in range(num_periods):
dos[j] = dos[j] + np.real(np.trace(1j * (grd[jj] - grd[jj].conj().T))) / num_periods

gamma_l = 1j * (L[:s01, :s02] - L[:s01, :s02].conj().T)
gamma_r = 1j * (R[-s11:, -s12:] - R[-s11:, -s12:].conj().T)
# gamma_l = 1j * (L[:s01, :s02] - L[:s01, :s02].conj().T)
# gamma_r = 1j * (R[-s11:, -s12:] - R[-s11:, -s12:].conj().T)
gamma_l = 1j * (L - L.conj().T)
gamma_r = 1j * (R - R.conj().T)

# compute transmission spectrum
tr[j] = np.real(np.trace(gamma_l.dot(g_trans).dot(gamma_r).dot(g_trans.conj().T)))
Expand Down
4 changes: 2 additions & 2 deletions nanonet/negf/greens_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ def surface_greens_function_poles(h_list):
eigenvects = eigenvects[:, ind]

vals = np.copy(eigenvals)
mask1 = np.abs(vals) < 0.9999
mask2 = np.abs(vals) > 1.0001
mask1 = np.abs(vals) < 0.9999999
mask2 = np.abs(vals) > 1.0000001
vals = np.angle(vals)

vals[mask1] = -5
Expand Down

0 comments on commit 475faee

Please sign in to comment.