This commit is contained in:
guanjihuan 2022-07-12 20:31:31 +08:00
parent d28e6b334f
commit f5f3f2d2f5
3 changed files with 30 additions and 2 deletions

View File

@ -282,6 +282,10 @@ guan.make_gif(image_path_array, filename='a', duration=0.1)
parameter_array = guan.preprocess_for_parallel_calculations(parameter_array_all, cpus=1, task_index=0) parameter_array = guan.preprocess_for_parallel_calculations(parameter_array_all, cpus=1, task_index=0)
new_array = guan.find_close_values_in_one_array(array, precision=1e-2)
degenerate_k_array, degenerate_eigenvalue_array = guan.find_degenerate_points(k_array, eigenvalue_array, precision=1e-2)
guan.change_directory_by_replacement(current_key_word='code', new_key_word='data') guan.change_directory_by_replacement(current_key_word='code', new_key_word='data')
guan.batch_reading_and_plotting(directory, xlabel='x', ylabel='y') guan.batch_reading_and_plotting(directory, xlabel='x', ylabel='y')

View File

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

@ -2,7 +2,7 @@
# 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. # 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.
# The current version is guan-0.0.103, updated on July 06, 2022. # The current version is guan-0.0.105, updated on July 12, 2022.
# Installation: pip install --upgrade guan # Installation: pip install --upgrade guan
@ -1902,6 +1902,30 @@ def preprocess_for_parallel_calculations(parameter_array_all, cpus=1, task_index
parameter_array = parameter_array_all[task_index*num_parameter:num_all] parameter_array = parameter_array_all[task_index*num_parameter:num_all]
return parameter_array return parameter_array
def find_close_values_in_one_array(array, precision=1e-2):
new_array = []
i0 = 0
for a1 in array:
j0 = 0
for a2 in array:
if j0>i0 and abs(a1-a2)<precision:
new_array.append([a1, a2])
j0 +=1
i0 += 1
return new_array
def find_degenerate_points(k_array, eigenvalue_array, precision=1e-2):
degenerate_k_array = []
degenerate_eigenvalue_array = []
i0 = 0
for k in k_array:
degenerate_points = find_close_values_in_one_array(eigenvalue_array[i0], precision=precision)
if len(degenerate_points) != 0:
degenerate_k_array.append(k)
degenerate_eigenvalue_array.append(degenerate_points)
i0 += 1
return degenerate_k_array, degenerate_eigenvalue_array
def change_directory_by_replacement(current_key_word='code', new_key_word='data'): def change_directory_by_replacement(current_key_word='code', new_key_word='data'):
import os import os
code_path = os.getcwd() code_path = os.getcwd()