from chainTB import *
# lattice
tags = [b'a', b'b']
ri = [[0, 0], [1, 0]]
chain_tb = latticeTB(tags=tags, ri=ri, nor=2, ang=0.)
chain_tb.get_lattice(nx=1, ny=1)
# solve eigenvalue problem
eig_chain = eigChain(lat=chain_tb)
t = 1.
on = [1.2j, -1.2j]
eig_chain.set_hop(ho=[t])
eig_chain.set_onsite(on=on)
eig_chain.get_ham()
eig_chain.get_eig(eigenvec=True)
# plots
plot_chain = plotTB(sys=eig_chain)
lattice = plot_chain.plt_lattice(plt_index=True, ms=50, fs=20)
fig_spec = plot_chain.plt_spec(ms=20, pola_tag=b'a')
#propagation
prop_chain = propTB(lat=chain_tb, steps=1400, dz=0.02)
psi_init = [1, 0]
prop_chain.get_prop(ham=eig_chain.ham, psi_init=psi_init, norm=True)
fig_prop0 = prop_chain.plt_prop1d()
fig_prop_dimer0 = prop_chain.plt_prop_dimer()
psi_init = [0, 1]
prop_chain.get_prop(ham=eig_chain.ham, psi_init=psi_init, norm=True)
fig_prop1 = prop_chain.plt_prop1d()
fig_prop_dimer1 = prop_chain.plt_prop_dimer()
plt.show()
# save figures
save_chain = saveFigTB(sys=eig_chain, params={'t': t}, dir_name='chain', ext='png')
save_chain.save_fig(fig_spec, 'spec')
save_chain.save_fig(fig_prop_dimer0, 'prop_dimer0')
save_chain.save_fig(fig_prop0, 'prop0')
save_chain.save_fig(fig_prop_dimer1, 'prop_dimer1')
save_chain.save_fig(fig_prop1, 'prop1')