Ejemplo n.º 1
0
               # 'legend.fontsize': 14,  # 8
               # 'font.size': 14,        # 8
               # 'xtick.labelsize': 14,  # 8
               # 'ytick.labelsize': 14,  # 8
               # 'lines.markersize': 16, # 8
               # 'savefig.bbox': 'tight',   # tight
               # 'savefig.pad_inches': 0.1, # 0.1
               # 'text.usetex': True,
               # 'font.family': 'serif',
               # 'text.latex.preamble' : [r'\usepackage{amsmath}'],
               # 'figure.figsize': (10, 7)}  # (3.5, 2.5) default
# rcParams.update(plot_params)

i=10
stri = str(i)
IO.go_to_data_parent('interpolatedboson/a'+stri)
IO.add_to_path()
state = IO.get_state()
Ls = range(9, 11, 1)
L_min, L_max = min(Ls), max(Ls)
shift_func = lambda L: 0.1 if L==9 else -0.15
#shift_func = lambda L: 0.2*(L-L_max)/(L_max - L_min)
#shift_func = lambda L: 0

params = IO.Params.kw('LKN', L=Ls, K=[0], N=[0])
for p in params:
    run.create_edge_spectrum(state, p, overwrite=False)

spectrum = pp.load_edge_spectrum(state, Ls)
spectrum = pp.shift_boson_number(spectrum)
Ejemplo n.º 2
0
# coding: utf-8
from PEPS import mps_tools
from __future__ import division
import math
import numpy as np
from PEPS import IO_helper as IO
IO.go_to_data_parent('softcoreboson')
IO.add_to_path()
state = IO.get_state()
mps = mps_tools
mps.example_SPT_calc()
L=3
p=2
edge_d=2

#lcst = get_left_canonical_site_tensor(statename='hardcoreboson', L=L)
gcst, Lambda, V_basis_change = mps.get_canonical_site_tensor(statename='hardcoreboson', L=L)
p_dim, bond_dim, _ = gcst.shape
reload(mps)
L=3
p=2
edge_d=2

#lcst = get_left_canonical_site_tensor(statename='hardcoreboson', L=L)
gcst, Lambda, V_basis_change = mps.get_canonical_site_tensor(statename='hardcoreboson', L=L)
p_dim, bond_dim, _ = gcst.shape
#print rhoL
XHC = np.array([[0, 1], [1, 0]])
ZHC = np.array([[1, 0],[0,-1]])
ZSC = np.array([[1, 0, 0, 0],[0,-1, 0, 0],[0,0, 1, 0],[0,0, 0, -1]])
Id = np.identity(p_dim)
cax10 = divider10.append_axes("right", size="5%", pad=0)
divider11 = make_axes_locatable(ax11)
cax11 = divider11.append_axes("right", size="5%", pad=0)


L = 8
radius1 = radius2 = 5.0
hexradius1 = hexradius2 = 4.2
# radius1 = radius2 = 14.0
# hexradius1 = hexradius2 = 13.5

circle_size = "radius"

## Left two plots for softcoreboson

IO.go_to_data_parent("softcoreboson", parent="Data//FBI-TM")
params = IO.Params.kw("LKN", L=[L], K=[0], N=[0])
param = next(iter(params))

corrmap, corrmap_string = plot.load_combined_corrmap(param, ("bdag", "b"))
hexcorrmap = hexplot.convert_zigzag_dict_to_hex(
    corrmap, L, [p for p, dist in hexplot.Hex(-1, 2).disc(radius=radius1) if p.sub != "C"]
)
hexcorrmap = {k: np.real(v).item() for k, v in hexcorrmap.items()}
p = hexplot.hex_circle_plot(
    hexcorrmap,
    hexlattice_radius=hexradius1,
    cmap=hexplot.cmap_seq,
    ax=ax00,
    circle_size=circle_size,
    scale=1,
from matplotlib.backends.backend_pdf import PdfPages
from DataAnalysis import data
from DataAnalysis import PEPS_plots as pp
import numpy as np
from matplotlib import pyplot as plt
from PEPS import IO_helper as IO
from PEPS import spectra_analyzer as spec
from PEPS.CylinderPEPS import run

show_fit_details = True
show_legend = True

############ Go to state data
i = 10
stri = str(i)
IO.go_to_data_parent("interpolatedboson/a" + stri)
IO.add_to_path()
state = IO.get_state()
Ls = range(2, 11, 2)
L_min, L_max = min(Ls), max(Ls)
shift_func = lambda L: 0.3 * (L - L_max - 1) / (L_max - L_min)

# if needed create edge spectrum
params = IO.Params.kw("LKN", L=Ls, K=[0], N=[0])
for p in params:
    run.create_edge_spectrum(state, p, overwrite=False)

# load and prepare spectrum
spectrum = pp.load_edge_spectrum(state, Ls)
spectrum = pp.shift_boson_number(spectrum)
spectrum.add_as_prop(pp.energy, val="val")
Ejemplo n.º 5
0
        if tmspec:
            norm = tmspec[(0, 0)][0]
            ev1 = tmspec[(0, 1)][0]/norm
            if L>1:
                symev00 = tmspec[(0, 0)][1]/norm
                symev10 = tmspec[(1, 0)][0]/norm #K=+-1, N=0 ev is bigger than K=0, N=0 sometimes
                print abs(symev00), abs(symev10)
                symev = symev00 if abs(symev00)>abs(symev10) else symev10
                #symev = symev00
            else:
                symev00 = tmspec[(0, 0)][1]/norm
                symev = symev00
            ans[L] = ev_to_corr(ev1), phase(ev1), ev_to_corr(symev), phase(symev)
    return ans

IO.go_to_data_parent('softcoreboson', parent='Data//FBI-TM')
IO.add_to_path()
scb = IO.get_state()
maxL = 10
scb_ans = corrbound_data(scb, range(1,maxL+1))


IO.go_to_data_parent('hardcoreboson', parent='Data//FBI-TM')
IO.add_to_path()
hcb = IO.get_state()
maxL = 10
hcb_ans = corrbound_data(hcb, range(1, maxL+1))


data = [(L,)+scb_ans.get(L, (None, None, None, None))+hcb_ans.get(L,(None, None, None, None)) for L in scb_ans]
from tabulate import tabulate
# coding: utf-8
get_ipython().system(u'explorer .')
from __future__ import division
from DataAnalysis import data
from DataAnalysis import PEPS_plots as pp
import numpy as np
from matplotlib import pyplot as plt
from PEPS import IO_helper as IO
from PEPS import spectra_analyzer as spec
from PEPS.CylinderPEPS import run
IO.go_to_data_parent('armchair_softcoreboson')
state = IO.get_state()
params = IO.Params.kw('LKN', L=[1,2, 3], K=[0], N=[0])
from PEPS import spectra_analyzer as spec
def armchair_state_params(Ls):
    params = data.pdict.kw('LKN', L = Ls, K = range(max(Ls)), N = range(-max(Ls),                                                                  2*max(Ls)+1))
    K_lt_L = lambda p: p['K']<p['L']
    N_le_2L = lambda p: -p['L'] <= p['N'] <= 2*p['L']
    params.add_constraints([K_lt_L, N_le_2L])
    return params
Ls = [1, 2, 3]
params = armchair_state_params(Ls)
spectrum = data.ParametrizedDataSet(params)
for L in Ls:
    edge_spectrum_list = run.load_edge_spectrum(state, data.OrderedDict(zip(['L', 'K', 'N'], [L, 0, 0])))
    edge_spectrum_dict = spec.collect_spectrum_points(edge_spectrum_list)
    for K, N in edge_spectrum_dict:
        for indx, val in enumerate(edge_spectrum_dict[(K, N)]):
            spectrum.append(data.DataPoint(L=L, K=K, N=N, val=val, band=indx))
Ls = [1, 2, 3]
params = armchair_state_params(Ls)
def go(L):
    #with PdfPages('L_10_all_mom_10.pdf') as pdf:
    ###########################################################
    #get state
    i=10
    stri = str(i)
    IO.go_to_data_parent('interpolatedboson/a'+stri)
    IO.add_to_path()
    state = IO.get_state()
    Ls = [L]
    L_min, L_max = min(Ls), max(Ls)
    shift_func = lambda L: 0
    ###########################################################
    #make edge spectrum if necessary
    params = IO.Params.kw('LKN', L=Ls, K=[0], N=[0])
    for p in params:
        run.create_edge_spectrum(state, p, overwrite=False)
    ###########################################################
    #load and prepeare edge spectrum
    spectrum = pp.load_edge_spectrum(state, Ls)
    spectrum = pp.shift_boson_number(spectrum)
    spectrum.add_as_prop(pp.energy, val='val')
    data_name = 'energy'
    pp.shift_and_scale(spectrum, scale=0) #just shift
    data_name = 'E'
    all_points = list(spectrum.points())

    spec_points = spectrum.collect(['K', 'N', 'band'], 'L', data_name)
    spec_points = spec_points.filter([lambda p: p['K']<=L/2])
    spec_points.plot_toolbox = data.SpectraPlotTools()
    spec_points.plot_toolbox.markers = ['1', '2', '3', '4']
    spec_points.update_plot_args(title='', xlabel='K', ylabel='Energy',
                                      xlim=[-0.5, 12], ylim=[-0.4, 6])
    #even_colors = ['k', 'b', 'g', 'r', 'gold', 'orange', 'orangered', 'y','m', 'lime', 'c']    
    color_pairs = [('k', 'k'), ('b', 'c'),('g', 'lime'),('r', 'm'),('orange', 'orangered'),('gold', 'y')] 
    colors = [c for cp in color_pairs for c in cp]
    def color_func(N):
        x=0
        if N<0:
            x=1
        if N%2==0: 
            return abs(N)+x
        else:
            return abs(N)+1+4+x

    spec_points.plot_toolbox.colors = colors
    spec_points.plot_toolbox.color_func = color_func
    ###########################################################
    #make plot
    if makelegend:
        xlim=[-0.5, np.floor(L/2)+1.1]
    else:
        xlim=[-0.5, np.floor(L/2)+.5]

    fig, spec_ax = spec_points.plot_toolbox.spec_plot(spec_points, data_name,
                                                     shift_func=shift_func, copy_points=True,xlim=xlim, legend=None)

    # if i!=10 and i!=0:
        # plt.title('Entanglement Spectrum for b=0.'+stri)
    # elif i==10:
        # plt.title('Entanglement Spectrum for soft-core state')
    # elif i==0:
        # plt.title('Entanglement Spectrum for hard-core FBI')
    if L==10:
        plt.ylabel('Entanglement Energy')
    if L==9:
        plt.ylabel('')
    ax = plt.gca()
    Ks = np.arange(0, np.floor(L/2+1))
    ax.set_xticks(Ks)
    if L==10:
        ax.set_xticklabels(['0', '$\pi/5$', '$2\pi/5$', '$3\pi/5$', '$4\pi/5$', '$\pi$'])
    if L==9:
        ax.set_xticklabels(['0', '$2\pi/9$', '$4\pi/9$', '$6\pi/9$', '$8\pi/9$'])  
    #ax.set_xticklabels(['$2\pi'+str(K)+'/'+str(L)+'$' if K in [1for K in Ks])
    ax.yaxis.tick_left()
    ax.xaxis.tick_bottom()
    if makelegend:
        handles, labels = ax.get_legend_handles_labels()
        hl = sorted(zip(handles, labels),
                key= lambda x: abs(int(x[1])))
        handles2, labels2 = zip(*hl)
        def label_helper(string_representing_integer):
            i = int(string_representing_integer)
            if not i%2:
                if i<=0:
                    return str(i//2)
                else:
                    return '+'+str(i//2)
            else:
                if i<=0:
                    return str(i)+'/2'
                else:
                    return '+'+str(i)+'/2'
                
        labels3 = [label_helper(l) for l in labels2]
        if L==9:
            legendloc = (0.8, 0.15)
        if L==10:
            legendloc = (0.825, 0.15)
        leg=ax.legend(handles2, labels3, loc = legendloc, numpoints=1, frameon=False, labelspacing=0.25)