from latticeTB import *
from eigTB import *
from plotTB import *
from math import pi
from collections import OrderedDict
nx, ny = 5, 5
ri = [[0, 0], [0.5*sqrt(3), 0.5], [0.25*sqrt(3), 0.25], [0.75*sqrt(3), 0.25], [0.5*sqrt(3), 1.]]
tags = [b'a', b'b', b'c', b'd', b'e']
hlc = latticeTB(tags=tags, ri=ri, nor=sqrt(3), ang=pi/3)
hlc.get_lattice(nx=nx, ny=ny)
hlc.remove_dangling(nor_bond=0.5)
eig_hlc = eigTB(hlc)
t1, t2 = 1., .5
eig_hlc.set_hop([t1, t2])
eig_hlc.get_ham()
eig_hlc.get_eig(eigenvec=True)
zero_mode = eig_hlc.get_state_pola(pola_tag=b'a')
branch_neg = eig_hlc.get_states_en(e_min=-6, e_max=-2.1)
flat_band = eig_hlc.get_states_en(e_min=-2.01, e_max=-1.99)
branch_pos = eig_hlc.get_states_en(e_min=.1, e_max=6)
plt_hlc = plotTB(eig_hlc)
fig_lat_hlc = plt_hlc.plt_lattice(ms=12)
fig_spec_hlc = plt_hlc.plt_spec(pola_tag=b'a')
fig_zero_mode_hlc = plt_hlc.plt_intensity(zero_mode, title='')
fig_banch_neg_hlc = plt_hlc.plt_intensity(branch_neg, title='')
fig_flat_band_hlc = plt_hlc.plt_intensity(flat_band, title='')
fig_banch_pos_hlc = plt_hlc.plt_intensity(branch_pos, title='')
fig_branch_neg_disk_hlc = plt_hlc.plt_intensity_disk(branch_neg, s=2000, title='')
plt.show()
save_hlc = saveFigTB(sys=hlc, dir_name='hexa_lc', params=OrderedDict([('t1', t1), ('t2', t2)]))
save_hlc.save_fig_lat(fig_lat_hlc, 'lattice')
save_hlc.save_fig(fig_spec_hlc, 'spec')
save_hlc.save_fig(fig_zero_mode_hlc, 'zero_mode')
save_hlc.save_fig(fig_banch_neg_hlc, 'banch_neg')
save_hlc.save_fig(fig_flat_band_hlc, 'flat_band')
save_hlc.save_fig(fig_banch_pos_hlc, 'banch_pos')
save_hlc.save_fig(fig_branch_neg_disk_hlc, 'banch_neg_disk')