from liebTB import *
# lattice
nx, ny = 8, 8
ri = [[0, 0], [1, 0], [0, 1]]
tags = [b'a', b'b', b'c']
lat_lieb = latticeTB(tags=tags, ri=ri, nor=2, ang=pi/2)
lat_lieb.get_lattice(nx=nx, ny=ny)
lat_lieb.remove_dangling(nor_bond=1)
ta, tb, tc, td = 2, 1, 2, 1
# first configuration
eig_lieb = eigLieb(lat_lieb)
on = [0j, -.2j, -.2j]
eig_lieb.set_onsite(on=on)
ta, tb, tc, td = 2., 1., 2., 1.
eig_lieb.set_hop_alt(ta=ta, tb=tb, tc=tc, td=td)
eig_lieb.set_dim_defect(dim_x=2, dim_y=2)
eig_lieb.get_ham(compl_trans=True)
ham0 = np.copy(eig_lieb.ham)
eig_lieb.get_eig(eigenvec=True)
zero_mode = eig_lieb.get_state_pola(b'a')
plt_lieb = plotLieb(eig_lieb)
fig_lat = plt_lieb.plt_lattice(ms=10, plt_index=True, fs=14)
fig_lat0 = plt_lieb.plt_lattice(ms=10, plt_hop=True)
fig_zm0 = plt_lieb.plt_intensity(zero_mode)
# second configuration
eig_lieb.set_hop_alt(ta=ta, tb=tb, tc=tc, td=td)
eig_lieb.set_dim_defect(dim_x=12, dim_y=2)
eig_lieb.get_ham(compl_trans=True)
ham1 = np.copy(eig_lieb.ham)
eig_lieb.get_eig(eigenvec=True)
zero_mode = eig_lieb.get_state_pola(b'a')
fig_lat1 = plt_lieb.plt_lattice(ms=10, plt_hop=True)
fig_zm1 = plt_lieb.plt_intensity(zero_mode)
# third configuration
eig_lieb.set_hop_alt(ta=ta, tb=tb, tc=tc, td=td)
eig_lieb.set_dim_defect(dim_x=12, dim_y=12)
eig_lieb.get_ham(compl_trans=True)
ham2 = np.copy(eig_lieb.ham)
eig_lieb.get_eig(eigenvec=True)
zero_mode = eig_lieb.get_state_pola(b'a')
fig_lat2 = plt_lieb.plt_lattice(ms=10, plt_hop=True)
fig_zm2 = plt_lieb.plt_intensity(zero_mode)
# fourth configuration
eig_lieb.set_hop_alt(ta=ta, tb=tb, tc=tc, td=td)
eig_lieb.set_dim_defect(dim_x=7, dim_y=7)
eig_lieb.get_ham(compl_trans=True)
ham3 = np.copy(eig_lieb.ham)
eig_lieb.get_eig(eigenvec=True)
zero_mode = eig_lieb.get_state_pola(b'a')
fig_lat3 = plt_lieb.plt_lattice(ms=10, plt_hop=True)
fig_zm3 = plt_lieb.plt_intensity(zero_mode)
# adiabatic pumping
psi_init = np.zeros(eig_lieb.sites) / eig_lieb.sites
psi_init[25] = 1.
hams = np.array([ham0, ham1, ham2, ham3])
prop_lieb = propTB(lat_lieb, steps=300, dz=.15)
prop_lieb.get_pump(hams, psi_init=psi_init, norm=True)
ani = prop_lieb.get_ani(s=180, fs=20)
plt.show()
# save
from collections import OrderedDict
save_lieb = saveFigTB(sys=eig_lieb, params=OrderedDict([('ta', ta), ('tb', tb), ('tc', tc), ('td', td)]), dir_name='lieb', ext='png')
save_lieb.save_fig(fig_lat, 'latXY')
save_lieb.save_fig(fig_lat0, 'latXY0')
save_lieb.save_fig(fig_lat1, 'latXY1')
save_lieb.save_fig(fig_lat2, 'latXY2')
save_lieb.save_fig(fig_lat3, 'latXY3')
save_lieb.save_fig(fig_zm0, 'zm0')
save_lieb.save_fig(fig_zm1, 'zm1')
save_lieb.save_fig(fig_zm2, 'zm2')
save_lieb.save_fig(fig_zm3, 'zm3')
save_lieb.save_ani(ani, 'pump3')