Skip to content

Commit

Permalink
changed order of output parameters from surface_greens_function
Browse files Browse the repository at this point in the history
  • Loading branch information
freude committed Sep 22, 2020
1 parent efbd7a9 commit 50d0285
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion examples/si_nw_transmission.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def main():
logging.info("{0} Energy: {1:.4f} eV".format(j, E))

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

# 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)
Expand Down
2 changes: 1 addition & 1 deletion examples/si_nw_transmission_blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def main():
logging.info("{0} Energy: {1:.4f} eV".format(j, E))

# compute self-energies describing boundary conditions at the leads contacts
R, L = negf.surface_greens_function(E, hl_bd, h0_bd, hr_bd, iterate=True, damp=damp)
L, R = negf.surface_greens_function(E, hl_bd, h0_bd, hr_bd, iterate=True, damp=damp)

# compute Green's functions using the recursive Green's function algorithm
g_trans, grd, grl, gru, gr_left = negf.recursive_gf(E,
Expand Down
2 changes: 1 addition & 1 deletion nanonet/negf/greens_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,4 +256,4 @@ def surface_greens_function(E, h_l, h_0, h_r, iterate=False, damp=0.0001j):
sgf_l = sgf_l[-s11:, -s12:]
sgf_r = sgf_r[:s01, :s02]

return sgf_l, sgf_r
return sgf_r, sgf_l
12 changes: 6 additions & 6 deletions nanonet/negf/hamiltonian_chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ def sgf(self):

for jjj in range(len(self.h_0)):
if jjj == 0:
sgf[jjj] = -2.0 * np.imag(self.sgf_r) * fd(self.energy, self.ef1, self.tempr)
sgf[jjj] = -2.0 * np.imag(self.sgf_l) * fd(self.energy, self.ef1, self.tempr)
elif jjj == len(self.h_0) - 1:
sgf[jjj] = -2.0 * np.imag(self.sgf_l) * fd(self.energy, self.ef2, self.tempr)
sgf[jjj] = -2.0 * np.imag(self.sgf_r) * fd(self.energy, self.ef2, self.tempr)
else:
sgf[jjj] = np.zeros(self.h_0[jjj].shape)

Expand Down Expand Up @@ -172,14 +172,14 @@ def add_self_energies(self, sgf_l, sgf_r, energy=0, tempr=0, ef1=0, ef2=0):
self.sgf_l = sgf_l
self.sgf_r = sgf_r

self.h_0[-1] = self.h_0[-1] + sgf_l
self.h_0[0] = self.h_0[0] + sgf_r
self.h_0[-1] = self.h_0[-1] + sgf_r
self.h_0[0] = self.h_0[0] + sgf_l

def remove_self_energies(self):
""" """

self.h_0[-1] = self.h_0[-1] - self.sgf_l
self.h_0[0] = self.h_0[0] - self.sgf_r
self.h_0[-1] = self.h_0[-1] - self.sgf_r
self.h_0[0] = self.h_0[0] - self.sgf_l

self.sgf_l = None
self.sgf_r = None
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
install_requires = fp.read().splitlines()

setup(name='nano-net',
version='1.2.1',
version='1.3.0',
description='Python framework for tight-binding computations',
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down
9 changes: 5 additions & 4 deletions test/test_greens_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -811,13 +811,14 @@ def z_dependence(coord):
h_chain.h_l,
h_chain.h_0,
h_chain.h_r,
s_in=h_chain.sgf)
s_in=h_chain.sgf,
damp=0.0000001j)
h_chain.remove_self_energies()

gamma_l = 1j * (sgf_l[j, :, :] - sgf_l[j, :, :].conj().T)
gamma_r = 1j * (sgf_r[j, :, :] - sgf_r[j, :, :].conj().T)

tr[j] = np.real(np.trace(gamma_l.dot(g_trans).dot(gamma_r).dot(g_trans.conj().T)))
tr[j] = np.real(np.trace(gamma_r.dot(g_trans).dot(gamma_l).dot(g_trans.conj().T)))

for jj in range(num_periods):
dos1[j] = dos1[j] + np.real(np.trace(1j * (grd[jj] - grd[jj].conj().T))) / num_periods
Expand All @@ -830,7 +831,7 @@ def z_dependence(coord):
# test_double_barrier_density_recursive()
# test_gf_complex_chain_several_periods()
# test_gf_single_atom_chain_several_periods()
# test_double_barrier_density_recursive(complex_chain, 20)
test_double_barrier_density_recursive(complex_chain, 20)
# test_complex_chain()
test_gf_complex_chain_several_periods_recursive()
# test_gf_complex_chain_several_periods_recursive()
# test_single_atom_chain()

0 comments on commit 50d0285

Please sign in to comment.