From 831af1a1574c849192b0c28fbb990ecc1fcad428 Mon Sep 17 00:00:00 2001 From: guanjihuan Date: Thu, 9 May 2024 05:23:09 +0800 Subject: [PATCH] 0.1.98 --- PyPI/setup.cfg | 2 +- PyPI/src/guan.egg-info/PKG-INFO | 2 +- PyPI/src/guan/quantum_transport.py | 28 ++++++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/PyPI/setup.cfg b/PyPI/setup.cfg index 1227b41..c9827c7 100644 --- a/PyPI/setup.cfg +++ b/PyPI/setup.cfg @@ -1,7 +1,7 @@ [metadata] # replace with your username: name = guan -version = 0.1.97 +version = 0.1.98 author = guanjihuan author_email = guanjihuan@163.com description = An open source python package diff --git a/PyPI/src/guan.egg-info/PKG-INFO b/PyPI/src/guan.egg-info/PKG-INFO index 60e3a59..05c6917 100644 --- a/PyPI/src/guan.egg-info/PKG-INFO +++ b/PyPI/src/guan.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: guan -Version: 0.1.97 +Version: 0.1.98 Summary: An open source python package Home-page: https://py.guanjihuan.com Author: guanjihuan diff --git a/PyPI/src/guan/quantum_transport.py b/PyPI/src/guan/quantum_transport.py index 29de1ca..7ce0c0a 100644 --- a/PyPI/src/guan/quantum_transport.py +++ b/PyPI/src/guan/quantum_transport.py @@ -19,6 +19,10 @@ def calculate_conductance(fermi_energy, h00, h01, length=100): dim = np.array(h00).shape[0] if dim == 1: conductance = np.dot(np.dot(np.dot(gamma_left, green_0n_n), gamma_right), green_0n_n.transpose().conj()) + if conductance.shape == (): + pass + else: + conductance = conductance[0][0] else: conductance = np.trace(np.dot(np.dot(np.dot(gamma_left, green_0n_n), gamma_right), green_0n_n.transpose().conj())) return conductance @@ -59,6 +63,10 @@ def calculate_conductance_with_barrier(fermi_energy, h00, h01, length=100, barri green_0n_n = guan.green_function_in_n(green_0n_n, h01, green_nn_n) if dim == 1: conductance = np.dot(np.dot(np.dot(gamma_left, green_0n_n), gamma_right), green_0n_n.transpose().conj()) + if conductance.shape == (): + pass + else: + conductance = conductance[0][0] else: conductance = np.trace(np.dot(np.dot(np.dot(gamma_left, green_0n_n), gamma_right), green_0n_n.transpose().conj())) return conductance @@ -88,6 +96,10 @@ def calculate_conductance_with_disorder(fermi_energy, h00, h01, disorder_intensi green_0n_n = guan.green_function_in_n(green_0n_n, h01, green_nn_n) if dim == 1: conductance = np.dot(np.dot(np.dot(gamma_left, green_0n_n), gamma_right), green_0n_n.transpose().conj()) + if conductance.shape == (): + pass + else: + conductance = conductance[0][0] else: conductance = np.trace(np.dot(np.dot(np.dot(gamma_left, green_0n_n), gamma_right), green_0n_n.transpose().conj())) conductance_averaged += conductance @@ -116,6 +128,10 @@ def calculate_conductance_with_disorder_array(fermi_energy, h00, h01, disorder_a green_0n_n = guan.green_function_in_n(green_0n_n, h01, green_nn_n) if dim == 1: conductance = np.dot(np.dot(np.dot(gamma_left, green_0n_n), gamma_right), green_0n_n.transpose().conj()) + if conductance.shape == (): + pass + else: + conductance = conductance[0][0] else: conductance = np.trace(np.dot(np.dot(np.dot(gamma_left, green_0n_n), gamma_right), green_0n_n.transpose().conj())) return conductance @@ -142,6 +158,10 @@ def calculate_conductance_with_slice_disorder(fermi_energy, h00, h01, disorder_i green_0n_n = guan.green_function_in_n(green_0n_n, h01, green_nn_n) if dim == 1: conductance = np.dot(np.dot(np.dot(gamma_left, green_0n_n), gamma_right), green_0n_n.transpose().conj()) + if conductance.shape == (): + pass + else: + conductance = conductance[0][0] else: conductance = np.trace(np.dot(np.dot(np.dot(gamma_left, green_0n_n), gamma_right), green_0n_n.transpose().conj())) return conductance @@ -169,6 +189,10 @@ def calculate_conductance_with_disorder_inside_unit_cell_which_keeps_translation green_0n_n = guan.green_function_in_n(green_0n_n, h01, green_nn_n) if dim == 1: conductance = np.dot(np.dot(np.dot(gamma_left, green_0n_n), gamma_right), green_0n_n.transpose().conj()) + if conductance.shape == (): + pass + else: + conductance = conductance[0][0] else: conductance = np.trace(np.dot(np.dot(np.dot(gamma_left, green_0n_n), gamma_right), green_0n_n.transpose().conj())) return conductance @@ -196,6 +220,10 @@ def calculate_conductance_with_random_vacancy(fermi_energy, h00, h01, vacancy_co green_0n_n = guan.green_function_in_n(green_0n_n, h01, green_nn_n) if dim == 1: conductance = np.dot(np.dot(np.dot(gamma_left, green_0n_n), gamma_right), green_0n_n.transpose().conj()) + if conductance.shape == (): + pass + else: + conductance = conductance[0][0] else: conductance = np.trace(np.dot(np.dot(np.dot(gamma_left, green_0n_n), gamma_right), green_0n_n.transpose().conj())) return conductance