0.0.34
This commit is contained in:
parent
8a3234ba03
commit
54ea831b24
@ -54,8 +54,8 @@ hamiltonian = guan.hamiltonian_of_haldane_model_in_quasi_one_dimension(k, N=10,
|
|||||||
|
|
||||||
# calculate band structures # Source code: https://py.guanjihuan.com/source-code/calculate_band_structures_and_wave_functions
|
# calculate band structures # Source code: https://py.guanjihuan.com/source-code/calculate_band_structures_and_wave_functions
|
||||||
eigenvalue = guan.calculate_eigenvalue(hamiltonian)
|
eigenvalue = guan.calculate_eigenvalue(hamiltonian)
|
||||||
eigenvalue_array = guan.calculate_eigenvalue_with_one_parameter(x_array, hamiltonian_function)
|
eigenvalue_array = guan.calculate_eigenvalue_with_one_parameter(x_array, hamiltonian_function, print_show=0)
|
||||||
eigenvalue_array = guan.calculate_eigenvalue_with_two_parameters(x_array, y_array, hamiltonian_function)
|
eigenvalue_array = guan.calculate_eigenvalue_with_two_parameters(x_array, y_array, hamiltonian_function, print_show=0, print_show_more=0)
|
||||||
eigenvector = guan.calculate_eigenvector(hamiltonian)
|
eigenvector = guan.calculate_eigenvector(hamiltonian)
|
||||||
vector_target = guan.find_vector_with_the_same_gauge_with_binary_search(vector_target, vector_ref, show_error=1, show_times=0, show_phase=0, n_test=10001, precision=1e-6)
|
vector_target = guan.find_vector_with_the_same_gauge_with_binary_search(vector_target, vector_ref, show_error=1, show_times=0, show_phase=0, n_test=10001, precision=1e-6)
|
||||||
vector = guan.find_vector_with_fixed_gauge_by_making_one_component_real(vector, precision=0.005, index=None)
|
vector = guan.find_vector_with_fixed_gauge_by_making_one_component_real(vector, precision=0.005, index=None)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[metadata]
|
[metadata]
|
||||||
# replace with your username:
|
# replace with your username:
|
||||||
name = guan
|
name = guan
|
||||||
version = 0.0.33
|
version = 0.0.34
|
||||||
author = guanjihuan
|
author = guanjihuan
|
||||||
author_email = guanjihuan@163.com
|
author_email = guanjihuan@163.com
|
||||||
description = An open source python package
|
description = An open source python package
|
||||||
|
@ -14,7 +14,7 @@ def calculate_eigenvalue(hamiltonian):
|
|||||||
eigenvalue, eigenvector = np.linalg.eigh(hamiltonian)
|
eigenvalue, eigenvector = np.linalg.eigh(hamiltonian)
|
||||||
return eigenvalue
|
return eigenvalue
|
||||||
|
|
||||||
def calculate_eigenvalue_with_one_parameter(x_array, hamiltonian_function):
|
def calculate_eigenvalue_with_one_parameter(x_array, hamiltonian_function, print_show=0):
|
||||||
dim_x = np.array(x_array).shape[0]
|
dim_x = np.array(x_array).shape[0]
|
||||||
i0 = 0
|
i0 = 0
|
||||||
if np.array(hamiltonian_function(0)).shape==():
|
if np.array(hamiltonian_function(0)).shape==():
|
||||||
@ -27,13 +27,15 @@ def calculate_eigenvalue_with_one_parameter(x_array, hamiltonian_function):
|
|||||||
dim = np.array(hamiltonian_function(0)).shape[0]
|
dim = np.array(hamiltonian_function(0)).shape[0]
|
||||||
eigenvalue_array = np.zeros((dim_x, dim))
|
eigenvalue_array = np.zeros((dim_x, dim))
|
||||||
for x0 in x_array:
|
for x0 in x_array:
|
||||||
|
if print_show==1:
|
||||||
|
print(x0)
|
||||||
hamiltonian = hamiltonian_function(x0)
|
hamiltonian = hamiltonian_function(x0)
|
||||||
eigenvalue, eigenvector = np.linalg.eigh(hamiltonian)
|
eigenvalue, eigenvector = np.linalg.eigh(hamiltonian)
|
||||||
eigenvalue_array[i0, :] = eigenvalue
|
eigenvalue_array[i0, :] = eigenvalue
|
||||||
i0 += 1
|
i0 += 1
|
||||||
return eigenvalue_array
|
return eigenvalue_array
|
||||||
|
|
||||||
def calculate_eigenvalue_with_two_parameters(x_array, y_array, hamiltonian_function):
|
def calculate_eigenvalue_with_two_parameters(x_array, y_array, hamiltonian_function, print_show=0, print_show_more=0):
|
||||||
dim_x = np.array(x_array).shape[0]
|
dim_x = np.array(x_array).shape[0]
|
||||||
dim_y = np.array(y_array).shape[0]
|
dim_y = np.array(y_array).shape[0]
|
||||||
if np.array(hamiltonian_function(0,0)).shape==():
|
if np.array(hamiltonian_function(0,0)).shape==():
|
||||||
@ -52,7 +54,11 @@ def calculate_eigenvalue_with_two_parameters(x_array, y_array, hamiltonian_funct
|
|||||||
i0 = 0
|
i0 = 0
|
||||||
for y0 in y_array:
|
for y0 in y_array:
|
||||||
j0 = 0
|
j0 = 0
|
||||||
|
if print_show==1:
|
||||||
|
print(y0)
|
||||||
for x0 in x_array:
|
for x0 in x_array:
|
||||||
|
if print_show_more==1:
|
||||||
|
print(x0)
|
||||||
hamiltonian = hamiltonian_function(x0, y0)
|
hamiltonian = hamiltonian_function(x0, y0)
|
||||||
eigenvalue, eigenvector = np.linalg.eigh(hamiltonian)
|
eigenvalue, eigenvector = np.linalg.eigh(hamiltonian)
|
||||||
eigenvalue_array[i0, j0, :] = eigenvalue
|
eigenvalue_array[i0, j0, :] = eigenvalue
|
||||||
|
Loading…
x
Reference in New Issue
Block a user