version 0.0.8

This commit is contained in:
guanjihuan 2021-07-20 01:26:09 +08:00
parent 7d699063ae
commit dfaa80fbe0
3 changed files with 17 additions and 3 deletions

View File

@ -65,7 +65,8 @@ eigenvalue_array = guan.calculate_eigenvalue_with_two_parameters(x, y, hamiltoni
eigenvector = guan.calculate_eigenvector(hamiltonian) eigenvector = guan.calculate_eigenvector(hamiltonian)
# find vector with the same gauge # find vector with the same gauge
vector_target = 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)
# calculate Green functions # calculate Green functions
green = guan.green_function(fermi_energy, hamiltonian, broadening, self_energy=0) green = guan.green_function(fermi_energy, hamiltonian, broadening, self_energy=0)

View File

@ -1,7 +1,7 @@
[metadata] [metadata]
# replace with your username: # replace with your username:
name = guan name = guan
version = 0.0.7 version = 0.0.8
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

View File

@ -39,3 +39,16 @@ def find_vector_with_the_same_gauge_with_binary_search(vector_target, vector_ref
if show_phase==1: if show_phase==1:
print('Phase=', phase) print('Phase=', phase)
return vector_target return vector_target
def find_vector_with_fixed_gauge_by_making_one_component_real(vector, precision=0.005):
index = np.argmax(np.abs(vector))
sign_pre = np.sign(np.imag(vector[index]))
for phase in np.arange(0, 2*pi, precision):
sign = np.sign(np.imag(vector[index]*cmath.exp(1j*phase)))
if np.abs(np.imag(vector[index]*cmath.exp(1j*phase))) < 1e-9 or sign == -sign_pre:
break
sign_pre = sign
vector = vector*cmath.exp(1j*phase)
if np.real(vector[index]) < 0:
vector = -vector
return vector