version 0.0.8
This commit is contained in:
parent
7d699063ae
commit
dfaa80fbe0
@ -65,7 +65,8 @@ eigenvalue_array = guan.calculate_eigenvalue_with_two_parameters(x, y, hamiltoni
|
||||
eigenvector = guan.calculate_eigenvector(hamiltonian)
|
||||
|
||||
# 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
|
||||
green = guan.green_function(fermi_energy, hamiltonian, broadening, self_energy=0)
|
@ -1,7 +1,7 @@
|
||||
[metadata]
|
||||
# replace with your username:
|
||||
name = guan
|
||||
version = 0.0.7
|
||||
version = 0.0.8
|
||||
author = guanjihuan
|
||||
author_email = guanjihuan@163.com
|
||||
description = An open source python package
|
||||
|
@ -39,3 +39,16 @@ def find_vector_with_the_same_gauge_with_binary_search(vector_target, vector_ref
|
||||
if show_phase==1:
|
||||
print('Phase=', phase)
|
||||
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
|
Loading…
x
Reference in New Issue
Block a user