In [1]:
import HH

In [2]:
#reload("HH")

In [3]:
using Base.Test

In [4]:
using PyPlot

In [5]:
# matplotlib parameters
matplotlib["rcParams"][:update](["axes.labelsize" => 22,
                                 "axes.titlesize" => 20,
                                 "font.size" => 18,
                                 "legend.fontsize" => 14,
                                 "axes.linewidth" => 1.5,
                                 "font.family" => "serif",
                                 "font.serif" => "Computer Modern Roman",
                                 "xtick.labelsize" => 20,
                                 "xtick.major.size" => 5.5,
                                 "xtick.major.width" => 1.5,
                                 "ytick.labelsize" => 20,
                                 "ytick.major.size" => 5.5,
                                 "ytick.major.width" => 1.5,
                                 "text.usetex" => true,
                                 "figure.autolayout" => true])

In [6]:
q = 7;
gs = Array(Float64, 200,200);
HH.hhgrstate!(gs, q);

In [7]:
a, b = extrema(gs)


Out[7]:
(-3.2033030254750585,-3.197578907340933)

In [8]:
f, ax = plt.subplots(figsize=(5, 5))
im = ax[:imshow](gs, origin="upper", ColorMap("gist_heat_r"), interpolation="none",
                 extent=[-π/q, π/q, -π, π],
                 aspect="auto")

ax[:set_ylabel](L"$p_y$",labelpad=-1)
ax[:set_xlabel](L"$p_x^0$", labelpad=-1)
ax[:xaxis][:set_ticks]([-π/q,0,π/q])
ax[:xaxis][:set_ticklabels]([LaTeXString(string("\$-\\pi/",q,"\$")), L"$0$", LaTeXString(string("\$\\pi/",q,"\$"))])

ax[:yaxis][:set_ticks]([-π,0,π])
ax[:yaxis][:set_ticklabels]([L"$-\pi$", L"$0$", L"$\pi$"])

cbaxes = f[:add_axes]([0.25, 0.04, 0.65, 0.015])
cbar = f[:colorbar](im, cax=cbaxes, orientation="horizontal")
cbar[:set_ticks]([a,b])
cbar[:set_ticklabels]([L"$a$", L"$b$"])
cbar[:set_label](L"$E[J]$", rotation=0, labelpad=-20, y=0.5)
cbar[:solids][:set_edgecolor]("face")

#f[:savefig]("../figures/gs_q_7.svg", transparent=true, pad_inches=0.0, bbox_inches="tight")
plt.close(f)



In [9]:
#second index must be odd!

In [10]:
ladder = Array(Float64, (200,201,q));

In [11]:
HH.hhladder!(ladder)

In [12]:
f, ax = plt.subplots(figsize=(8, 5))

for i in 1:q
    ax[:plot](linspace(-π,π,size(ladder,1)), ladder[:,div(size(ladder,2)-1,2)+1,i], "k")
end

ax[:yaxis][:set_ticks]([-4,-2,0,2,4])
ax[:xaxis][:set_ticks]([-π,-π/2,0,π/2,π])
ax[:xaxis][:set_ticklabels]([L"$-\pi$",L"$-\pi/2$", L"$0$",L"$\pi/2$" ,L"$\pi$"])

ax[:set_xlim](-π, π)

ax[:set_ylabel](L"$E[J]$")
ax[:set_xlabel](L"$p_y$")

#f[:savefig]("../figures/7bands.svg", transparent=true, pad_inches=0.0, bbox_inches="tight")
plt.close(f)



In [13]:
qs = 3:20;

In [14]:
f, ax = plt.subplots(figsize=(8, 3))
ax[:plot](qs, HH.bgap(qs), "black", marker="o", label=L"$\Delta E$") 
ax[:plot](qs, HH.bwidth(qs).*10, "black", marker="o", ls="dashed", label=L"$BW \times 10$") 

ax[:set_ylim](-0.1, 3)
ax[:yaxis][:set_ticks]([0,1.5,3])
ax[:set_xlim](qs[1], qs[end])

ax[:set_xlabel](L"$q$")

ax[:legend](loc="upper right")

f[:savefig]("../figures/bands.pdf", transparent=true, pad_inches=0.0, bbox_inches="tight")
plt.close(f)



In [15]:
κs = linspace(0.02, 0.3, 100);
qs = 5:15;

In [16]:
#@time η2Dzpe = HH.ηzpe(qs, κs);

In [17]:
#@time η2Dlev = HH.ηlev(qs, κs);

In [18]:
#toterr = abs(η2Dzpe) + abs(η2Dlev);

In [19]:
#extrema(toterr)

In [20]:
#i,j = ind2sub(size(toterr), indmin(toterr));

In [21]:
#f, ax = plt.subplots(figsize=(5, 5))
#im = ax[:imshow](toterr, origin="lower", ColorMap("gist_heat_r"), interpolation="none",
#                 extent=[κs[1], κs[end], qs[1], qs[end]],
#                 vmin=minimum(toterr), vmax=1,
#                 aspect="auto")

#ax[:set_ylabel](L"$q$",labelpad=-1)
#ax[:set_xlabel](L"$\kappa$", labelpad=-6)
#ax[:xaxis][:set_ticks]([.02,1,2,3])
#ax[:xaxis][:set_ticklabels]([L"$.02$", L"$1$", L"$2$", L"$3$"])
#cbaxes = f[:add_axes]([0.25, 0.04, 0.65, 0.015])
#cbar = f[:colorbar](im, cax=cbaxes, orientation="horizontal")
#cbar[:set_ticks]([minimum(toterr), 1])
#cbar[:set_ticklabels]([L"$-.8$", L"$0$"])
#cbar[:set_label](L"$|\eta|$", rotation=0, labelpad=-20, y=0.5)
#cbar[:solids][:set_edgecolor]("face")
#plt.close(f)

In [22]:
#f, ax = plt.subplots(figsize=(5, 5))
#im = ax[:imshow](η2Dzpe, origin="lower", ColorMap("gist_heat_r"), interpolation="none",
#                 extent=[κs[1], κs[end], qs[1], qs[end]],
#                 vmin=minimum(η2Dzpe), vmax=1,
#                 aspect="auto")

#ax[:set_ylabel](L"$q$",labelpad=-1)
#ax[:set_xlabel](L"$\kappa$", labelpad=-6)
#ax[:xaxis][:set_ticks]([.02,1,2,3])
#ax[:xaxis][:set_ticklabels]([L"$.02$", L"$1$", L"$2$", L"$3$"])
    
#cbaxes = f[:add_axes]([0.25, 0.04, 0.65, 0.015])
#cbar = f[:colorbar](im, cax=cbaxes, orientation="horizontal")
#cbar[:set_ticks]([minimum(η2Dzpe), 1])
#cbar[:set_ticklabels]([L"$-.6$", L"$0$" ,L"$1$"])
#cbar[:set_label](L"$\eta_{\text{zpe}}$", rotation=0, labelpad=-20, y=0.5)
#cbar[:solids][:set_edgecolor]("face")
#f[:savefig]("../figures/zpe.pdf", transparent=true, pad_inches=0.0, bbox_inches="tight")
#plt.close(f)

In [23]:
#f, ax = plt.subplots(figsize=(5, 5))
#im = ax[:imshow](η2Dlev, origin="lower", ColorMap("gist_heat_r"), interpolation="none",
#                 extent=[κs[1], κs[end], qs[1], qs[end]],
#                 vmin=minimum(η2Dlev), vmax=0,
#                 aspect="auto")

#ax[:set_ylabel](L"$q$",labelpad=-1)
#ax[:set_xlabel](L"$\kappa$", labelpad=-6)
#ax[:xaxis][:set_ticks]([.02,1,2,3])
#ax[:xaxis][:set_ticklabels]([L"$.02$", L"$1$", L"$2$", L"$3$"])
    
#cbaxes = f[:add_axes]([0.25, 0.04, 0.65, 0.015])
#cbar = f[:colorbar](im, cax=cbaxes, orientation="horizontal")
#cbar[:set_ticks]([minimum(η2Dlev), 0])
#cbar[:set_ticklabels]([L"$-.8$", L"$0$"])
#cbar[:set_label](L"$\eta_{\text{lev}}$", rotation=0, labelpad=-20, y=0.5)
#cbar[:solids][:set_edgecolor]("face")
#plt.close(f)

In [24]:
qs = 5:20;

In [25]:
ηL= HH.ηlev(qs,0.02);

In [26]:
f, ax = plt.subplots(figsize=(8, 3))
ax[:plot](qs, ηL*10^2, "black", label=L"$\kappa=0.02$") 

ax[:set_ylim](-10, 0)
ax[:yaxis][:set_ticks]([-10, -5, 0])

ax[:legend](loc="upper right")

ax[:set_xlim](qs[1], qs[end])
ax[:set_xlabel](L"$q$")
ax[:set_ylabel](L"$\eta_{lev}(0) \times 10^2$")

#f[:savefig]("../figures/level_error.pdf", transparent=true, pad_inches=0.0, bbox_inches="tight")
plt.close(f)



In [27]:
κs = linspace(.02,3., 100);
qs = 4:20;

In [28]:
η5 = HH.ηzpe(5, κs);
η11 = HH.ηzpe(11, κs);
η20 = HH.ηzpe(20, κs);

In [29]:
η002 = HH.ηzpe(qs, 0.02);
η03 = HH.ηzpe(qs, 0.3);
η30 = HH.ηzpe(qs, 3.0);

In [30]:
f, axes = plt.subplots(2, figsize=(8, 6))
for (i,ax) in enumerate(axes)
    if i == 1
        ax[:plot](κs, η5, "red", label=L"$q=5$") 
        ax[:plot](κs, η11,"green", label=L"$q=11$") 
        ax[:plot](κs, η20,"blue", label=L"$q=20$") 
        
        ax[:set_yticks]([-0.6, 0, 1, 3])
        ax[:set_yticklabels]([L"$-.6$", L"$0$" ,L"$1$", L"$3$"])
        
        ax[:legend](loc="upper right")
        
        ax[:xaxis][:set_ticks]([.02,1,2,3])
        ax[:xaxis][:set_ticklabels]([L"$.02$", L"$1$", L"$2$", L"$3$"])
        ax[:set_xlim](κs[1], κs[end])
        ax[:set_xlabel](L"$\kappa$")
        ax[:set_ylabel](L"$\eta_{\text{zpe}}$")
    else
        ax[:plot](qs, η002, "red", marker="o", label=L"$\kappa=0.02$") 
        ax[:plot](qs, η03, "green",marker="o", label=L"$\kappa=0.3$") 
        ax[:plot](qs, η30, "blue",marker="o", label=L"$\kappa=3$") 
        ax[:legend](loc="upper right")

        ax[:set_yticks]([-0.6, 0, 1, 3, 6])
        ax[:set_yticklabels]([L"$-.6$", L"$0$" ,L"$1$", L"$3$", L"$6$"])

        ax[:set_xlim](qs[1], qs[end])

        ax[:set_xlabel](L"$q$")
        ax[:set_ylabel](L"$\eta_{\text{zpe}}$")
    end
end
plt.close(f)



In [ ]: