Skip to content

Commit

Permalink
change sorting algorithm to the mergesort
Browse files Browse the repository at this point in the history
  • Loading branch information
freude committed Jul 1, 2020
1 parent 25b470f commit d180b2b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions examples/si_nw_transmission.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def main():

# define leads indices
right_lead = [0, 33, 35, 17, 16, 51, 25, 9, 53, 68, 1, 8, 24]
left_lead = [40, 66, 58, 47, 48, 71, 72, 73, 74, 65]
left_lead = [40, 66, 58, 47, 48, 71, 72, 73, 74, 65, 6, 22, 7, 23, 14, 30, 15, 31]

# create a Hamiltonian object storing the Hamiltonian matrices
# hamiltonian = Hamiltonian(xyz=path, nn_distance=2.4,
Expand Down Expand Up @@ -78,7 +78,7 @@ def main():
# compute DOS
for jj in range(num_periods):
# dos[j] = dos[j] + np.real(np.trace(1j * (grd[jj] - grd[jj].conj().T))) / num_periods
dos[j] = dos[j] + np.real(np.trace(np.imag(grd[jj]))) / num_periods
dos[j] = dos[j] - np.real(np.trace(np.imag(grd[jj]))) / num_periods

# gamma_l = 1j * (L[:s01, :s02] - L[:s01, :s02].conj().T)
# gamma_r = 1j * (R[-s11:, -s12:] - R[-s11:, -s12:].conj().T)
Expand Down
2 changes: 1 addition & 1 deletion nanonet/tb/hamiltonian.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ def get_hamiltonians_block_tridiagonal(self, left=None, right=None, optimized=Tr
hr = right

if optimized:
subblocks = split_into_subblocks_optimized(h0, hl, hr)
subblocks = split_into_subblocks_optimized(h0, left=hl, right=hr)
else:
subblocks = split_into_subblocks(h0, hl, hr)

Expand Down
2 changes: 1 addition & 1 deletion nanonet/tb/sorting_algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def sort_projection(coords=None, left_lead=None, right_lead=None, **kwargs):
vec = np.mean(coords[left_lead], axis=0) - np.mean(coords[right_lead], axis=0)
keys = np.dot(coords, vec) / np.linalg.norm(vec)

return np.argsort(keys)
return np.argsort(keys, kind='mergesort')


def sort_capacitance(coords, mat, left_lead, right_lead, **kwargs):
Expand Down

0 comments on commit d180b2b

Please sign in to comment.