From a8fd9a20ad2452d4e1a2faeaa7220ca816682566 Mon Sep 17 00:00:00 2001 From: guanjihuan Date: Mon, 16 May 2022 15:35:33 +0800 Subject: [PATCH] 0.0.86 --- PyPI/README.md | 2 +- PyPI/setup.cfg | 4 ++-- PyPI/src/guan/__init__.py | 25 +++++++++++++++++++++++-- README.md | 2 +- 4 files changed, 27 insertions(+), 6 deletions(-) diff --git a/PyPI/README.md b/PyPI/README.md index cee258b..e4dcff0 100644 --- a/PyPI/README.md +++ b/PyPI/README.md @@ -1 +1 @@ -Guan is an open-source python package developed and maintained by https://www.guanjihuan.com/about. The primary location of this package is on website https://py.guanjihuan.com. \ No newline at end of file +Guan is an open-source python package developed and maintained by https://www.guanjihuan.com/about. The primary location of this package is on website https://py.guanjihuan.com. With this package, you can calculate band structures, density of states, quantum transport and topological invariant of tight-binding models by invoking the functions you need. Other frequently used functions are also integrated in this package, such as file reading/writing, figure plotting, data processing. \ No newline at end of file diff --git a/PyPI/setup.cfg b/PyPI/setup.cfg index e9c0d31..44572f6 100644 --- a/PyPI/setup.cfg +++ b/PyPI/setup.cfg @@ -1,10 +1,10 @@ [metadata] # replace with your username: name = guan -version = 0.0.85 +version = 0.0.86 author = guanjihuan author_email = guanjihuan@163.com -description = Guan is an open-source python package developed and maintained by https://www.guanjihuan.com/about. The primary location of this package is on website https://py.guanjihuan.com. With this package, you can calculate band structures, density of states, quantum transport and topological invariant of tight-binding models by invoking the functions you need. Other frequently used functions are also integrated in this package, such as file reading/writing, figure plotting, data processing. +description = An open source python package long_description = file: README.md long_description_content_type = text/markdown url = https://py.guanjihuan.com diff --git a/PyPI/src/guan/__init__.py b/PyPI/src/guan/__init__.py index 683f9c6..2970538 100644 --- a/PyPI/src/guan/__init__.py +++ b/PyPI/src/guan/__init__.py @@ -109,7 +109,9 @@ hamiltonian = guan.hamiltonian_of_finite_size_system_along_two_directions_for_sq hamiltonian = guan.hamiltonian_of_finite_size_system_along_three_directions_for_cubic_lattice(N1, N2, N3, on_site=0, hopping_1=1, hopping_2=1, hopping_3=1, period_1=0, period_2=0, period_3=0) -hopping = guan.hopping_matrix_along_zigzag_direction_for_graphene_ribbon(N) +hamiltonian = guan.hamiltonian_of_finite_size_SSH_model(N, v=0.6, w=1, onsite_1=0, onsite_2=0, period=1) + +hopping = guan.hopping_matrix_along_zigzag_direction_for_graphene_ribbon(N, eta=0) hamiltonian = guan.hamiltonian_of_finite_size_system_along_two_directions_for_graphene(N1, N2, period_1=0, period_2=0) @@ -609,9 +611,28 @@ def hamiltonian_of_finite_size_system_along_three_directions_for_cubic_lattice(N hamiltonian[i1*N2*N3*dim+i2*N3*dim+0:i1*N2*N3*dim+i2*N3*dim+dim, i1*N2*N3*dim+i2*N3*dim+(N3-1)*dim+0:i1*N2*N3*dim+i2*N3*dim+(N3-1)*dim+dim] = hopping_3.transpose().conj() return hamiltonian -def hopping_matrix_along_zigzag_direction_for_graphene_ribbon(N): +def hamiltonian_of_finite_size_SSH_model(N, v=0.6, w=1, onsite_1=0, onsite_2=0, period=1): + hamiltonian = np.zeros((2*N, 2*N)) + for i in range(N): + hamiltonian[i*2+0, i*2+0] = onsite_1 + hamiltonian[i*2+1, i*2+1] = onsite_2 + hamiltonian[i*2+0, i*2+1] = v + hamiltonian[i*2+1, i*2+0] = v + for i in range(N-1): + hamiltonian[i*2+1, (i+1)*2+0] = w + hamiltonian[(i+1)*2+0, i*2+1] = w + if period==1: + hamiltonian[0, 2*N-1] = w + hamiltonian[2*N-1, 0] = w + return hamiltonian + +def hopping_matrix_along_zigzag_direction_for_graphene_ribbon(N, eta=0): hopping = np.zeros((4*N, 4*N), dtype=complex) for i0 in range(N): + hopping[4*i0+0, 4*i0+0] = eta + hopping[4*i0+1, 4*i0+1] = eta + hopping[4*i0+2, 4*i0+2] = eta + hopping[4*i0+3, 4*i0+3] = eta hopping[4*i0+1, 4*i0+0] = 1 hopping[4*i0+2, 4*i0+3] = 1 return hopping diff --git a/README.md b/README.md index f95fdb8..92e8ae9 100755 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ import guan ## About this package -+ The original motivation of this project is for self use. Based on this project, the frequent functions can be imported by “import guan” instead of repeated copies and pastes. You can also install and use this open-source package if some functions are helpful for you. If one function is not good enough, you can copy the source code and modify it. You can also feed back to guanjihuan@163.com. The modifications and supplements will be in the following updated version. ++ The original motivation of this project is for self use. Based on this project, the frequent functions can be imported by “import guan” instead of repeated copies and pastes. You can also install and use this open-source package if some functions are helpful for you. If one function is not good enough, you can copy the Source Code and modify it. You can also feed back to guanjihuan@163.com. The modifications and supplements will be in the following updated version. + All realizations of this package are based on functions without any class, which are concise and convenient. The boring document is omitted and you have to read the Source Code for details if it is necessary. Nevertheless, you don’t have to be worried about the difficulty, because all functions are simple enough without too many prejudgments and the variable names are written commonly as far as possible for the easy reading. + Before the beginning of function call in your project, you are recommended to briefly read the Source Code to know the specific formats of input and output about the function. Applying functions mechanically may cause errors. Notice that as the package is developed, the function names may be changed in the future version. Therefore, the latest API Reference is important and helpful.