def generateParticleForABFrequency():
    """
    This function generates the R function for four different voltages, as a 
    function of a changing edge. All other parameters are fixed. The result
    is used for th Fourier Analysis of the AB oscillations at different voltages.
    """
    
    Vpoints = np.array([mpf(i)/mpf(10**6) for i in [10, 20, 30, 40]])
    Nterms= 201
    dist1 = np.array([mpf('2.5')/ mpf(10**(6))]*Nterms)
    dist2 = np.linspace(mpf('2.0')/mpf(10**(6)), mpf('3.0')/mpf(10**(6)), Nterms)

    genData = { 
        "v":[mpf(i) * mpf(10**j) for (i,j) in [(9,2),(9,2),(5,2),(5,2)]],
        "c":[1,1,1,1],
        "g":[1/mpf(8), 1/mpf(8), 1/mpf(8), 1/mpf(8)],
        "x":[-dist1, dist2, -dist1, dist2]}

    mp.mp.dps= 150
    A = base_parameters(genData, V = Vpoints, Q = 1/mpf(4), T = 0)
    B = Rfunc_constructor(A, method = 'series')
    B.setParameter(nterms = 550)
    B.genAnswer()
    
    return A, B, dist2
def Propagator_three_modes(saving=False):
    """Plots the modulating function and interference current for an edge with
    3 modes."""
    Vpoints = mp.linspace(0, mpf('1.') / mpf(10**4), 201)
    dist1 = np.array(mpf('4.5') / mpf(10**(6)))
    genData = {
        "v": [mpf(i) * mpf(10**j) for (i, j) in [(10, 3), (3, 3), (5, 3)]],
        "x": [dist1, dist1, dist1],
        "g": [mpf(1) / mpf(10),
              mpf(1) / mpf(10),
              mpf(1) / mpf(10)],
        "c": [1, 1, 1]
    }

    mp.mp.dps = 50
    A = base_parameters(genData,
                        V=Vpoints,
                        Q=1 / mpf(4),
                        T=mpf(5) / mpf(10**3))
    B = Rfunc_constructor(A, method='series')
    B.setParameter(nterms=800)
    _, interference = Current(B)

    fig = plt.figure()
    xt = np.linspace(0, 1 * 10**(-4), 5)
    xt_labels = [str(int(i * 10**6)) for i in xt]

    ax = fig.add_subplot(211)
    ax.plot(Vpoints, interference, label=r"With interference", linewidth=1.5)

    for i in ax.get_lines():
        i.set_color('black')

    ax.set_title(r'Tunnelling current for edge with three modes')
    ax.set_ylabel(r"$I_B/\mathrm{max}(I_B){}$")
    ax.set_ybound([0, 1])
    ax.set_yticks([0, .25, .5, .75, 1])
    ax.set_yticklabels([0, 0.25, 0.5, 0.75, 1])
    ax.set_xticks(xt)
    ax.set_xticklabels([])
    ax.legend(loc='upper right', prop={'size': 12})
    plt.setp(ax.get_xticklabels(), fontsize=12.)
    plt.setp(ax.get_yticklabels(), fontsize=12.)
    ax.grid(True)
    ax2 = fig.add_subplot(212)
    ax2.plot(Vpoints, B.rrfunction, linewidth=1.5)
    ax2.get_lines()[0].set_color('black')
    ax2.set_title(r'Modulating function for edge with three modes')
    ax2.set_ylabel(r"$\mathrm{Re}[H_{ij}^{\mathrm{mod}}]{}$")
    ax2.set_xlabel(r'Volt [$\mu$V]')
    ax2.set_yticks([-0.25, 0, .25, .5, .75, 1])
    ax2.set_yticklabels([-0.25, 0, 0.25, 0.5, 0.75, 1])
    ax2.set_xticks(xt)
    ax2.set_xticklabels(xt_labels)
    ax2.grid(True)
    plt.setp(ax2.get_xticklabels(), fontsize=12.)
    plt.setp(ax2.get_yticklabels(), fontsize=12.)
    if saving: plt.savefig('multi_mode_error.pdf', bbox_inches=0, dpi=300)
    plt.show()
    return B
Exemple #3
0
def generateParticleForABFrequency():
    """
    This function generates the R function for four different voltages, as a 
    function of a changing edge. All other parameters are fixed. The result
    is used for th Fourier Analysis of the AB oscillations at different voltages.
    """

    Vpoints = np.array([mpf(i) / mpf(10**6) for i in [10, 20, 30, 40]])
    Nterms = 201
    dist1 = np.array([mpf('2.5') / mpf(10**(6))] * Nterms)
    dist2 = np.linspace(
        mpf('2.0') / mpf(10**(6)),
        mpf('3.0') / mpf(10**(6)), Nterms)

    genData = {
        "v":
        [mpf(i) * mpf(10**j) for (i, j) in [(9, 2), (9, 2), (5, 2), (5, 2)]],
        "c": [1, 1, 1, 1],
        "g": [1 / mpf(8), 1 / mpf(8), 1 / mpf(8), 1 / mpf(8)],
        "x": [-dist1, dist2, -dist1, dist2]
    }

    mp.mp.dps = 150
    A = base_parameters(genData, V=Vpoints, Q=1 / mpf(4), T=0)
    B = Rfunc_constructor(A, method='series')
    B.setParameter(nterms=550)
    B.genAnswer()

    return A, B, dist2
def main_plot(saving = False):
    """Main plot:
    Plots the mod-H function, the current with and without interference
    # and transmission"""
    Vpoints = mp.linspace(0, mpf('1.')/mpf(10**4), 201)
    dist1 = mpf('2.0')/ mpf(10**(6))
    dist2 = mpf('1.8')/mpf(10**(6))
    genData = { 
        "v":[mpf(i) * mpf(10**j) for (i,j) in [(7,3),(7,3),(1,3),(1,3)]],
        "c":[1,1,1,1],
        "g":[mpf(1)/mpf(8),mpf(1)/mpf(8),mpf(1)/mpf(8),mpf(1)/mpf(8)],
         "x":[-dist1, dist2, -dist1, dist2]}
    mp.mp.dps= 60    
    A = base_parameters(genData, V = Vpoints, Q = 1/mpf(4), T = 1/mpf(10**4))
    B = Rfunc_constructor(A, method = 'series')
    B.setParameter(nterms = 450, maxA = 11, maxK = 11)
    single, interference = Current(B)
    
    fig = plt.figure()
    xt = np.linspace(0, 1 * 10**(-4), 5)
    xt_labels = [str(int(i * 10**6)) for i in xt]      
    
    ax = fig.add_subplot(211)  
    ax.plot(Vpoints,interference/np.max(single), label = r"With interference", linewidth=1.5)
    ax.plot(Vpoints,single/np.max(single), label = r"Without interference", linewidth=1.5)                        
    
    ax.get_lines()[1].set_dashes([5,2])    
    for i in ax.get_lines(): i.set_color('black')
  
    ax.set_title(r'Tunnelling current for the Pfaffian state', fontsize=16)
    ax.set_ylabel(r"$I_B/\mathrm{max}(I_B){}$", fontsize=16)
    ax.set_ybound([0,1])
    ax.set_yticks([.25, .5, .75, 1])
    ax.set_yticklabels([0.25, 0.5, 0.75, 1])
    ax.set_xticks(xt)
    ax.set_xticklabels([])
    ax.legend(loc = 'upper right', prop={'size':14})
    plt.setp(ax.get_xticklabels(), fontsize = 14)
    plt.setp(ax.get_yticklabels(), fontsize = 14)    
    ax.grid(True)
    ax2 = fig.add_subplot(212)
    ax2.plot(Vpoints, B.rrfunction, linewidth=1.5) 
    ax2.get_lines()[0].set_color('black')
    ax2.set_title(r'Modulating function for the Pfaffian state', fontsize=16)
    ax2.set_ylabel(r"$\mathrm{Re}[H_{ij}^{\mathrm{mod}}]{}$", fontsize=16)
    ax2.set_xlabel(r'Voltage [$\mu$V]', fontsize=16)
    ax2.xaxis.set_label_coords(.9, -0.12)
    ax2.set_yticks([-0.25,0,.25,.5,.75,1])
    ax2.set_yticklabels([-0.25,0,0.25,0.5,0.75,1])
    ax2.set_xticks(xt) 
    ax2.set_xticklabels(xt_labels)
    ax2.grid(True)
    plt.setp(ax2.get_xticklabels(), fontsize=14)
    plt.setp(ax2.get_yticklabels(), fontsize=14)        
    if saving: plt.savefig('main_plot.pdf', bbox_inches=0, dpi=300)
    plt.subplots_adjust(hspace=0.3)
    plt.show()
    return B
def temperature(saving=False):
    Vpoints = mp.linspace(0, mpf('1.') / mpf(10**4), 201)
    dist1 = np.array(mpf('3.5') / mpf(10**(6)))
    dist2 = np.array(mpf('3.5') / mpf(10**(6)))
    genData = {
        "v":
        [mpf(i) * mpf(10**j) for (i, j) in [(9, 4), (9, 4), (9, 3), (9, 3)]],
        "c": [1, 1, 1, 1],
        "g": [1 / mpf(8), 1 / mpf(8), 1 / mpf(8), 1 / mpf(8)],
        "x": [-dist1, dist2, -dist1, dist2]
    }
    names = [0, 10, 18]
    temperatureset = [mpf(i) / mpf(10**3) for i in names]
    ans = []
    fig = plt.figure()
    ax = fig.add_subplot(111)
    for i, j in enumerate(temperatureset):
        A = base_parameters(genData, V=Vpoints, Q=1 / mpf(4), T=j)

        if j < 9 / mpf(10**3):
            mp.mp.dps = 30
            B = Rfunc_constructor(A, method='series')
            B.setParameter(nterms=500, maxA=15, maxK=15)
        else:
            mp.mp.dps = 20
            B = Rfunc_constructor(A, method='fortran')
            B.setParameter(nterms=2 * 132000, maxA=25, maxK=25)
        B.genAnswer()

        ans.append(B)
        ax.plot(Vpoints, B.rrfunction, \
                            label = str(names[i]) +' [mK]', linewidth=1.5)

    dashstyle = [(None, None), [7, 2], [3, 4]]
    for i in range(len(ax.get_lines())):
        ax.get_lines()[i].set_color('black')
        ax.get_lines()[i].set_dashes(dashstyle[i])
    xt = np.linspace(0, 1 * 10**(-4), 5)
    xt_labels = [str(int(i * 10**6)) for i in xt]
    ax.set_title(
        r'The modulating function \\ for different temperature scales',
        fontsize=16)
    ax.set_ylabel(r"$\mathrm{Re}[H_{ij}^{\mathrm{mod}}]{}$", fontsize=16)
    ax.set_xlabel(r'Voltage [$\mu$V]', fontsize=16)
    ax.xaxis.set_label_coords(.9, -0.06)
    ax.set_ybound([-.25, 1.125])
    ax.set_yticks([-0.25, 0, .25, .5, .75, 1])
    ax.set_yticklabels([-0.25, 0, 0.25, 0.5, 0.75, 1])
    ax.set_xticks(xt)
    ax.set_xticklabels(xt_labels)
    ax.grid(True)
    ax.legend(loc='upper right', prop={'size': 14})
    plt.setp(ax.get_xticklabels(), fontsize=14)
    plt.setp(ax.get_yticklabels(), fontsize=14)
    if saving: plt.savefig('temperature.pdf', bbox_inches=0, dpi=300)
    plt.show()
    return ans
def multi_modes(saving = False):
    """Plots the modulating function and interference current for an edge with
    3 modes."""
    Vpoints = mp.linspace(0, mpf('2.')/mpf(10**4), 201)
    dist1 = np.array(mpf('4.5')/ mpf(10**(6)))
    dist2 = np.array(mpf('3.')/mpf(10**(6)))
    genData = { 
        "v":[mpf(i) * mpf(10**j) for (i,j) in [(10,3),(10,3),(3,3),(3,3),(5,3),(5,3)]],
        "x":[dist1, -dist2, dist1, -dist2,dist1, -dist2],
        "g":[mpf(1)/mpf(10), mpf(1)/mpf(10), mpf(1)/mpf(10), mpf(1)/mpf(10),mpf(1)/mpf(10), mpf(1)/mpf(10)], 
        "c":[1,1,1,1,1,1]}        

                            
    mp.mp.dps= 90    
    A = base_parameters(genData, V = Vpoints, Q = 1/mpf(4), T = mpf(0))
    B = Rfunc_constructor(A, method = 'series')
    B.setParameter(nterms = 800)
    single, interference = Current(B)
    
    fig = plt.figure()
    xt = np.linspace(0, 2 * 10**(-4), 5)
    xt_labels = [str(int(i * 10**6)) for i in xt]      
    
    ax = fig.add_subplot(211)  
    ax.plot(Vpoints,interference/np.max(single), label = r"With interference", linewidth=1.5)
    ax.plot(Vpoints,single/np.max(single), label = r"With interference", linewidth=1.5)                        
    
    ax.get_lines()[1].set_dashes([5,2])    
    for i in ax.get_lines(): i.set_color('black')
  
    ax.set_title(r'Tunnelling current for edge with three modes')
    ax.set_ylabel(r"$I_B/\mathrm{max}(I_B){}$")
    ax.set_ybound([0,1])
    ax.set_yticks([0,.25, .5, .75, 1])
    ax.set_yticklabels([0,0.25, 0.5, 0.75, 1])
    ax.set_xticks(xt)
    ax.set_xticklabels([])
    ax.legend(loc = 'upper right', prop={'size':14})
    plt.setp(ax.get_xticklabels(), fontsize = 14)
    plt.setp(ax.get_yticklabels(), fontsize = 14)    
    ax.grid(True)
    ax2 = fig.add_subplot(212)
    ax2.plot(Vpoints, B.rrfunction, linewidth=1.5) 
    ax2.get_lines()[0].set_color('black')
    ax2.set_title(r'Modulating function for edge with three modes', fontsize=16)
    ax2.set_ylabel(r"$\mathrm{Re}[H_{ij}^{\mathrm{mod}}]{}$", fontsize=16)
    ax2.set_xlabel(r'Volt [$\mu$V]')
    ax2.set_yticks([-0.25,0,.25,.5,.75,1])
    ax2.set_yticklabels([-0.25,0,0.25,0.5,0.75,1])
    ax2.set_xticks(xt) 
    ax2.set_xticklabels(xt_labels)
    ax2.grid(True)
    plt.setp(ax2.get_xticklabels(), fontsize=12.)
    plt.setp(ax2.get_yticklabels(), fontsize=12.)        
    if saving: plt.savefig('main_plot.pdf', bbox_inches=0, dpi=300)
    plt.show()
    return B
def temperature(saving = False):
    Vpoints = mp.linspace(0, mpf('1.')/mpf(10**4), 201)
    dist1 = np.array(mpf('3.5')/ mpf(10**(6)))
    dist2 = np.array(mpf('3.5')/mpf(10**(6)))
    genData = { 
         "v":[mpf(i) * mpf(10**j) for (i,j) in [(9,4),(9,4),(9,3),(9,3)]],
         "c":[1,1,1,1],
         "g":[1/mpf(8), 1/mpf(8), 1/mpf(8), 1/mpf(8)],
         "x":[-dist1, dist2, -dist1, dist2]}
    names = [0,10,18]   
    temperatureset = [mpf(i)/mpf(10**3) for i in names]  
    ans = []
    fig = plt.figure()
    ax = fig.add_subplot(111)
    for i, j in enumerate(temperatureset):
        A = base_parameters(genData, V = Vpoints, Q = 1/mpf(4), T = j)
        
        

        if j < 9/mpf(10**3):
            mp.mp.dps = 30
            B = Rfunc_constructor(A, method = 'series')
            B.setParameter(nterms = 500, maxA = 15, maxK = 15)
        else:
            mp.mp.dps = 20
            B = Rfunc_constructor(A, method = 'fortran')
            B.setParameter(nterms = 2*132000, maxA = 25, maxK = 25)
        B.genAnswer()

        ans.append(B)
        ax.plot(Vpoints, B.rrfunction, \
                            label = str(names[i]) +' [mK]', linewidth=1.5) 
                            
    dashstyle  = [(None, None), [7,2], [3,4]]
    for i in range(len(ax.get_lines())):
        ax.get_lines()[i].set_color('black')
        ax.get_lines()[i].set_dashes(dashstyle[i])
    xt = np.linspace(0, 1 * 10**(-4), 5)
    xt_labels = [str(int(i * 10**6)) for i in xt]        
    ax.set_title(r'The modulating function \\ for different temperature scales', fontsize=16)
    ax.set_ylabel(r"$\mathrm{Re}[H_{ij}^{\mathrm{mod}}]{}$", fontsize=16)
    ax.set_xlabel(r'Voltage [$\mu$V]', fontsize=16)
    ax.xaxis.set_label_coords(.9, -0.06)
    ax.set_ybound([-.25,1.125])
    ax.set_yticks([-0.25,0,.25,.5,.75,1])
    ax.set_yticklabels([-0.25,0,0.25,0.5,0.75,1])
    ax.set_xticks(xt)
    ax.set_xticklabels(xt_labels)
    ax.grid(True)
    ax.legend(loc='upper right', prop={'size':14})
    plt.setp(ax.get_xticklabels(), fontsize=14)
    plt.setp(ax.get_yticklabels(), fontsize=14)
    if saving: plt.savefig('temperature.pdf', bbox_inches=0, dpi=300)
    plt.show()
    return ans
Exemple #8
0
def distanceChangeParticleForAB(strong_effect = True, abelian = False):
    """
    Computes modulating function as a function of changing the distance along
    one edge.
    
    Warning: this function can take very long to complete.
    """
    assert isinstance(strong_effect, bool)
    Vpoints = np.array([mpf(50)/mpf(10**6)])
    Nterms= 201
    dist1 = np.array([mpf('2.5')/ mpf(10**(6))]*Nterms)
    
    if strong_effect:
        dist2 = np.linspace(mpf('2.0')/mpf(10**(6)), mpf('3.0')/mpf(10**(6)), Nterms)
    else:
        dist2 = np.linspace(mpf('2.25')/mpf(10**(6)), mpf('2.75')/mpf(10**(6)), 
                            Nterms)
    genData = { 
        "v":[mpf(i) * mpf(10**j) for (i,j) in [(9,2),(9,2),(6,2),(6,2)]],
        "c":[1,1,1,1],
        "g":[mpf(1)/mpf(10),mpf(1)/mpf(10),mpf(1)/mpf(8),mpf(1)/mpf(8)],
        "x":[-dist1, dist2, -dist1, dist2]}
    Qe = 1/mpf(4)

    if not strong_effect:
        genData["v"] = [mpf(i) * mpf(10**j) for (i,j) in [(8,3),(8,3),(3,3),(3,3)]]
    
    # Abelian case is not used in text    
    if abelian:
        Qe = 1/mpf(2)
        genData["c"] = [1,1]
        genData["g"] = [1/mpf(2), 1/mpf(2)]
        genData["x"] = [-dist1, dist2]
        if strong_effect:
            genData["v"] = [mpf(i) * mpf(10**j) for (i,j) in [(5,2),(5,2)]]
        else:
            genData["v"] = [mpf(i) * mpf(10**j) for (i,j) in [(5,3),(5,3)]]
            
    mp.mp.dps= 150
    A = base_parameters(genData, V = Vpoints, Q = Qe, T = 0)
    B = Rfunc_constructor(A, method = 'series')
    B.setParameter(nterms = 500, maxA = 20, maxK = 20)
    B.genAnswer()
    
    return A,B, dist2
def distanceChangeParticle():
    """
    Computes modulating function as a function of changing the distance along
    one edge.
    
    Warning: this function can take very long to complete.
    """
    Vpoints = np.array([mpf(60)/mpf(10**6)])
    Nterms= 201
    dist1 = np.array([mpf('2.5')/ mpf(10**(6))]*Nterms)
    dist2 = np.linspace(mpf('0.001')/mpf(10**(6)), mpf('3.0')/mpf(10**(6)), Nterms)
    
    genData = { 
        "v":[mpf(i) * mpf(10**j) for (i,j) in [(1,3),(1,3),(6,2),(6,2)]],
        "c":[1,1,1,1],
        "g":[mpf(1)/mpf(8),mpf(1)/mpf(8),mpf(1)/mpf(8),mpf(1)/mpf(8)],
        "x":[-dist1, dist2, -dist1, dist2]}
    mp.mp.dps= 150
    A = base_parameters(genData, V = Vpoints, Q = 1/mpf(4), T = 0)
    B = Rfunc_constructor(A, method = 'series')
    B.setParameter(nterms = 700)
    B.genAnswer()
    
    return A,B
def particles_12_5(saving=False):
    Vpoints = mp.linspace(0, mpf('1.') / mpf(10**4), 201)
    dist1 = mpf('2.4') / mpf(10**(6))
    dist2 = mpf('2.1') / mpf(10**(6))
    genData = {
        "v": [
            mpf(i) * mpf(10**j)
            for (i, j) in [(5, 3), (5, 3), (1.4, 3), (1.4, 3)]
        ],
        "x": [-dist1, dist2, -dist1, dist2]
    }
    LaughlinE5 = {
        "g": [mpf(2) / mpf(5), mpf(2) / mpf(5)],
        "c": [1, 1],
        "x": [-dist1, dist2],
        "v": [mpf(i) * mpf(10**j) for (i, j) in [(5, 3), (5, 3)]],
        "Q": 1 / mpf(3)
    }
    BS25 = {
        "g":
        [mpf(1) / mpf(10),
         mpf(1) / mpf(10),
         mpf(1) / mpf(8),
         mpf(1) / mpf(8)],
        "c": [1, 1, 1, 1],
        "Q": 1 / mpf(5)
    }
    HH25 = {
        "g":
        [mpf(1) / mpf(5),
         mpf(1) / mpf(5),
         mpf(2) / mpf(5),
         mpf(2) / mpf(5)],
        "c": [1, 1, 1, 1],
        "Q": 1 / mpf(5)
    }
    aRR3 = {
        "g": [
            mpf(1) / mpf(10),
            mpf(1) / mpf(10),
            mpf(3) / mpf(10),
            mpf(3) / mpf(10)
        ],
        "c": [1, 1, -1, -1],
        "Q":
        mpf(1) / mpf(5)
    }

    particleset = [HH25, aRR3, BS25, LaughlinE5]
    names = [
        r"$\mathrm{HH}_{2/5}$ (e/5)", r"$\overline{\mathrm{RR}}_{k=3} $ (e/5)",
        r"$\mathrm{BS}_{2/5}$ (e/5)", r"Laughlin (2e/5)"
    ]
    mp.mp.dps = 60
    fig = plt.figure()
    ax = fig.add_subplot(111)
    ans = []
    for i in range(len(names)):
        particle = genData.copy()
        particle.update(particleset[i])
        Qe = particle["Q"]
        del particle["Q"]
        A = base_parameters(particle, V=Vpoints, Q=Qe, T=1 / mpf(10**3))

        B = Rfunc_constructor(A, method='series')
        B.setParameter(nterms=1000, maxA=12, maxK=12)
        B.genAnswer()
        ans.append(B)
        ax.plot(Vpoints, B.rrfunction, label=names[i], linewidth=1.5)
    xt = np.linspace(0, 1 * 10**(-4), 5)
    xt_labels = [str(int(i * 10**6)) for i in xt]
    dashstyle = [(None, None), [10, 4], [6, 3, 1, 3, 1, 3], [2, 2], [2, 6]]
    for i in range(len(ax.get_lines())):
        ax.get_lines()[i].set_color('black')
        ax.get_lines()[i].set_dashes(dashstyle[i])

    ax.set_ylabel(r"$\mathrm{Re}[H_{ij}^{\mathrm{mod}}]{}$", fontsize=16)
    ax.set_xlabel(r'Voltage [$\mu$V]', fontsize=16)
    ax.xaxis.set_label_coords(.9, -0.06)
    ax.set_ybound([-.5, 1])
    ax.set_yticks([-0.25, 0, .25, .5, .75, 1])
    ax.set_yticklabels([-0.25, 0, 0.25, 0.5, 0.75, 1])
    xt = np.linspace(0, 1 * 10**(-4), 5)
    xt_labels = [str(int(i * 10**6)) for i in xt]
    ax.set_xticks(xt)
    ax.set_xticklabels(xt_labels)
    ax.set_title(r"Modulating function for $\nu = 12/5 $ candidates",
                 fontsize=16)
    ax.legend(loc='upper right', prop={'size': 14})
    ax.grid(True)
    plt.setp(ax.get_xticklabels(), fontsize=14)
    plt.setp(ax.get_yticklabels(), fontsize=14)
    if saving: plt.savefig('particles_12_5.pdf', bbox_inches=0, dpi=300)
    plt.show()
    return ans
def main_plot(saving=False):
    """Main plot:
    Plots the mod-H function, the current with and without interference
    # and transmission"""
    Vpoints = mp.linspace(0, mpf('1.') / mpf(10**4), 201)
    dist1 = mpf('2.0') / mpf(10**(6))
    dist2 = mpf('1.8') / mpf(10**(6))
    genData = {
        "v":
        [mpf(i) * mpf(10**j) for (i, j) in [(7, 3), (7, 3), (1, 3), (1, 3)]],
        "c": [1, 1, 1, 1],
        "g":
        [mpf(1) / mpf(8),
         mpf(1) / mpf(8),
         mpf(1) / mpf(8),
         mpf(1) / mpf(8)],
        "x": [-dist1, dist2, -dist1, dist2]
    }
    mp.mp.dps = 60
    A = base_parameters(genData, V=Vpoints, Q=1 / mpf(4), T=1 / mpf(10**4))
    B = Rfunc_constructor(A, method='series')
    B.setParameter(nterms=450, maxA=11, maxK=11)
    single, interference = Current(B)

    fig = plt.figure()
    xt = np.linspace(0, 1 * 10**(-4), 5)
    xt_labels = [str(int(i * 10**6)) for i in xt]

    ax = fig.add_subplot(211)
    ax.plot(Vpoints,
            interference / np.max(single),
            label=r"With interference",
            linewidth=1.5)
    ax.plot(Vpoints,
            single / np.max(single),
            label=r"Without interference",
            linewidth=1.5)

    ax.get_lines()[1].set_dashes([5, 2])
    for i in ax.get_lines():
        i.set_color('black')

    ax.set_title(r'Tunnelling current for the Pfaffian state', fontsize=16)
    ax.set_ylabel(r"$I_B/\mathrm{max}(I_B){}$", fontsize=16)
    ax.set_ybound([0, 1])
    ax.set_yticks([.25, .5, .75, 1])
    ax.set_yticklabels([0.25, 0.5, 0.75, 1])
    ax.set_xticks(xt)
    ax.set_xticklabels([])
    ax.legend(loc='upper right', prop={'size': 14})
    plt.setp(ax.get_xticklabels(), fontsize=14)
    plt.setp(ax.get_yticklabels(), fontsize=14)
    ax.grid(True)
    ax2 = fig.add_subplot(212)
    ax2.plot(Vpoints, B.rrfunction, linewidth=1.5)
    ax2.get_lines()[0].set_color('black')
    ax2.set_title(r'Modulating function for the Pfaffian state', fontsize=16)
    ax2.set_ylabel(r"$\mathrm{Re}[H_{ij}^{\mathrm{mod}}]{}$", fontsize=16)
    ax2.set_xlabel(r'Voltage [$\mu$V]', fontsize=16)
    ax2.xaxis.set_label_coords(.9, -0.12)
    ax2.set_yticks([-0.25, 0, .25, .5, .75, 1])
    ax2.set_yticklabels([-0.25, 0, 0.25, 0.5, 0.75, 1])
    ax2.set_xticks(xt)
    ax2.set_xticklabels(xt_labels)
    ax2.grid(True)
    plt.setp(ax2.get_xticklabels(), fontsize=14)
    plt.setp(ax2.get_yticklabels(), fontsize=14)
    if saving: plt.savefig('main_plot.pdf', bbox_inches=0, dpi=300)
    plt.subplots_adjust(hspace=0.3)
    plt.show()
    return B
def particles_5_2(saving=False):
    Vpoints = mp.linspace(0, mpf('1.') / mpf(10**4), 201)
    dist1 = mpf('2.4') / mpf(10**(6))
    dist2 = mpf('2.1') / mpf(10**(6))
    genData = {
        "v": [
            mpf(i) * mpf(10**j)
            for (i, j) in [(5, 3), (5, 3), (1.4, 3), (1.4, 3)]
        ],
        "x": [-dist1, dist2, -dist1, dist2]
    }
    pfaffE2 = {
        "g": [mpf(1) / mpf(2), mpf(1) / mpf(2)],
        "c": [1, 1],
        "x": [-dist1, dist2],
        "v": [mpf(i) * mpf(10**j) for (i, j) in [(5, 3), (5, 3)]],
        "Q": 1 / mpf(2)
    }
    pfaff = {
        "g":
        [mpf(1) / mpf(8),
         mpf(1) / mpf(8),
         mpf(1) / mpf(8),
         mpf(1) / mpf(8)],
        "c": [1, 1, 1, 1],
        "Q": 1 / mpf(4)
    }
    apf = {
        "g":
        [mpf(1) / mpf(8),
         mpf(1) / mpf(8),
         mpf(3) / mpf(8),
         mpf(3) / mpf(8)],
        "c": [1, 1, -1, -1],
        "Q": 1 / mpf(4)
    }
    state331 = {
        "g":
        [mpf(1) / mpf(8),
         mpf(1) / mpf(8),
         mpf(1) / mpf(4),
         mpf(1) / mpf(4)],
        "c": [1, 1, 1, 1],
        "Q": 1 / mpf(4)
    }

    particleset = [apf, state331, pfaff, pfaffE2]
    names = [
        "Anti-Pfaffian (e/4)", "(3,3,1)-state (e/4)", "Pfaffian (e/4)",
        "Laughlin (e/2)"
    ]

    mp.mp.dps = 60
    fig = plt.figure()
    ax = fig.add_subplot(111)
    ans = []
    for i in range(0, 4):
        particle = genData.copy()
        particle.update(particleset[i])
        Qe = particle["Q"]
        del particle["Q"]
        A = base_parameters(particle, V=Vpoints, Q=Qe, T=1 / mpf(10**3))
        B = Rfunc_constructor(A, method='series')
        B.setParameter(nterms=1200, maxA=12, maxK=12)
        B.genAnswer()
        ###        uncomment to return all instances
        #        ans.extend([copy.deepcopy(A),copy.deepcopy(B)])
        ###
        if B.rrfunction.shape[1] > 1:
            ax.plot(Vpoints, B.rrfunction[:, 0], label=names[i], linewidth=1.5)
        else:
            ax.plot(Vpoints, B.rrfunction, label=names[i], linewidth=1.5)

    dashstyle = [(None, None), [10, 4], [5, 3, 1, 3], [2, 4]]
    for i in range(len(ax.get_lines())):
        ax.get_lines()[i].set_color('black')
        ax.get_lines()[i].set_dashes(dashstyle[i])

    ax.set_ylabel(r"$\mathrm{Re}[H_{ij}^{\mathrm{mod}}]{}$", fontsize=16)
    ax.set_xlabel(r'Voltage [$\mu$V]', fontsize=16)
    ax.xaxis.set_label_coords(.9, -0.06)
    ax.set_ybound([-.5, 1])
    ax.set_yticks([-0.25, 0, .25, .5, .75, 1])
    ax.set_yticklabels([-0.25, 0, 0.25, 0.5, 0.75, 1])
    xt = np.linspace(0, 1 * 10**(-4), 5)
    xt_labels = [str(int(i * 10**6)) for i in xt]
    ax.set_xticks(xt)
    ax.set_xticklabels(xt_labels)
    ax.set_title(r"Modulating function for $\nu = 5/2 $ candidates",
                 fontsize=16)
    ax.legend(loc='upper right', prop={'size': 14})
    ax.grid(True)
    plt.setp(ax.get_xticklabels(), fontsize=14)
    plt.setp(ax.get_yticklabels(), fontsize=14)
    if saving: plt.savefig('particles_5_2.pdf', bbox_inches=0, dpi=300)
    plt.show()
    return ans
def frequencyParticle(plotting=True):
    """This function constructs and computes the modulating functions,
    which will be used in the frequency analysis
    
    It comes with an optional plotting instruction -- this was used to look for
    a "nice" parameter set.    
    """
    # Voltages array and distances.
    Vpoints = mp.linspace(0, mpf('1.') / mpf(10**4), 201)
    dist1 = np.array(mpf('4.0') / mpf(10**(6)))
    dist2 = np.array(mpf('2.5') / mpf(10**(6)))

    # We did not have a particular anyon in mind -- frequency is
    # independent of the g-values anyway.
    particletype = { \
         "g":[mpf(1)/mpf(8), mpf(1)/mpf(8), mpf(1)/mpf(6), mpf(1)/mpf(6)],
         "c":[1,1,1,1],
         "v":[mpf(i) * mpf(10**j) for (i,j) in [(3,3),(3,3),(9,2),(9,2)]],
         "x":[-dist1, dist2, -dist1, dist2],
         "Q":1/mpf(4)}

    particleset = [particletype]
    if plotting:
        # plotting is optional
        fig = plt.figure()
        ax = fig.add_subplot(111)

    # we can add more particle types to  particleset, and loop over these
    for particle in particleset:
        Qe = particle["Q"]
        del particle["Q"]

        # because of the large range of the voltage and low values of the
        # velocities we enable many oscillations in the spectrum
        # The downside is that we require an insane precision (170 digits)
        mp.mp.dps = 170

        # The T=0 function behaves requires high precision numbers.
        # At finite temperatures we run into two problems:
        # (1) Need high precision numbers
        # (2) Need large number of terms
        # We can only fix one of these at a time -- the fortran + cnct method
        # can handle (to some extent) the large number of terms, but does not
        # support arbitrary precision

        # Conclusion: stick to T=0 and you only encounter problems with
        # lack of high-precision numbers
        A = base_parameters(particle, V=Vpoints, Q=Qe, T=0)
        B = Rfunc_constructor(A, method='series')
        B.setParameter(nterms=1000)
        B.genAnswer()

        # fix this output if you are looking at multiple particle species
        ans = [A, B]
        if plotting:
            ax.plot(Vpoints, B.rrfunction, linewidth=1.5)
        particle["Q"] = Qe

    # plotting instructions. Dashstyle will give problems for more than
    # 3 particles -- just add more styles.
    if plotting:
        dashstyle = [(None, None), [7, 2], [3, 4]]
        for i in range(len(ax.get_lines())):
            ax.get_lines()[i].set_color('black')
            ax.get_lines()[i].set_dashes(dashstyle[i])
        xt = np.linspace(0, 1 * 10**(-4), 5)
        xt_labels = [str(int(i * 10**6)) for i in xt]
        ax.set_ylabel(r"H_mod")
        ax.set_xlabel(r'Volt')
        ax.set_yticks([-0.25, 0, .25, .5, .75, 1])
        ax.set_yticklabels([-0.25, 0, 0.25, 0.5, 0.75, 1])
        ax.set_xticks(xt)
        ax.set_xticklabels(xt_labels)
        ax.grid(True)
        plt.setp(ax.get_xticklabels(), fontsize=12.)
        plt.setp(ax.get_yticklabels(), fontsize=12.)
        plt.show()
    return ans
def frequencyParticle(plotting = True):
    """This function constructs and computes the modulating functions,
    which will be used in the frequency analysis
    
    It comes with an optional plotting instruction -- this was used to look for
    a "nice" parameter set.    
    """
    # Voltages array and distances.
    Vpoints = mp.linspace(0, mpf('1.')/mpf(10**4), 201)
    dist1 = np.array(mpf('4.0')/ mpf(10**(6)))
    dist2 = np.array(mpf('2.5')/mpf(10**(6)))
    
    # We did not have a particular anyon in mind -- frequency is
    # independent of the g-values anyway.
    particletype = { \
         "g":[mpf(1)/mpf(8), mpf(1)/mpf(8), mpf(1)/mpf(6), mpf(1)/mpf(6)], 
         "c":[1,1,1,1], 
         "v":[mpf(i) * mpf(10**j) for (i,j) in [(3,3),(3,3),(9,2),(9,2)]],
         "x":[-dist1, dist2, -dist1, dist2],
         "Q":1/mpf(4)}
        
            
    particleset = [particletype]
    if plotting:
        # plotting is optional
        fig = plt.figure()
        ax = fig.add_subplot(111)
        
    # we can add more particle types to  particleset, and loop over these        
    for particle in particleset:
        Qe = particle["Q"]
        del particle["Q"]

        # because of the large range of the voltage and low values of the 
        # velocities we enable many oscillations in the spectrum
        # The downside is that we require an insane precision (170 digits)
        mp.mp.dps= 170

        # The T=0 function behaves requires high precision numbers. 
        # At finite temperatures we run into two problems:
        # (1) Need high precision numbers
        # (2) Need large number of terms
        # We can only fix one of these at a time -- the fortran + cnct method
        # can handle (to some extent) the large number of terms, but does not
        # support arbitrary precision
        
        # Conclusion: stick to T=0 and you only encounter problems with
        # lack of high-precision numbers
        A = base_parameters(particle, V = Vpoints, Q = Qe, T = 0)
        B = Rfunc_constructor(A, method = 'series')
        B.setParameter(nterms = 1000)
        B.genAnswer()
        
        # fix this output if you are looking at multiple particle species
        ans = [A,B]
        if plotting:
            ax.plot(Vpoints, B.rrfunction, linewidth=1.5) 
        particle["Q"] = Qe
        
    # plotting instructions. Dashstyle will give problems for more than 
    # 3 particles -- just add more styles.
    if plotting:
        dashstyle  = [(None, None), [7,2], [3,4]]
        for i in range(len(ax.get_lines())):
            ax.get_lines()[i].set_color('black')
            ax.get_lines()[i].set_dashes(dashstyle[i])
        xt = np.linspace(0, 1 * 10**(-4), 5)
        xt_labels = [str(int(i * 10**6)) for i in xt]        
        ax.set_ylabel(r"H_mod")
        ax.set_xlabel(r'Volt')
        ax.set_yticks([-0.25,0,.25,.5,.75,1])
        ax.set_yticklabels([-0.25,0,0.25,0.5,0.75,1])
        ax.set_xticks(xt)
        ax.set_xticklabels(xt_labels)
        ax.grid(True)
        plt.setp(ax.get_xticklabels(), fontsize=12.)
        plt.setp(ax.get_yticklabels(), fontsize=12.)
        plt.show()
    return ans
def particles_12_5(saving = False):
    Vpoints = mp.linspace(0, mpf('1.')/mpf(10**4), 201)
    dist1 = mpf('2.4')/ mpf(10**(6)) 
    dist2 = mpf('2.1')/mpf(10**(6)) 
    genData = { 
        "v":[mpf(i) * mpf(10**j) for (i,j) in [(5,3),(5,3),(1.4,3),(1.4,3)]],
         "x":[-dist1, dist2, -dist1, dist2]}
    LaughlinE5 = {
        "g":[mpf(2)/mpf(5),mpf(2)/mpf(5)],
        "c":[1,1],
        "x":[-dist1, dist2],
        "v":[mpf(i) * mpf(10**j) for (i,j) in [(5,3),(5,3)]],"Q":1/mpf(3)}
    BS25 = {
        "g":[mpf(1)/mpf(10),mpf(1)/mpf(10),mpf(1)/mpf(8), mpf(1)/mpf(8)], 
        "c":[1,1,1,1],"Q":1/mpf(5)}
    HH25 = {
        "g":[mpf(1)/mpf(5),mpf(1)/mpf(5),mpf(2)/mpf(5), mpf(2)/mpf(5)], 
        "c":[1,1,1,1],"Q":1/mpf(5)} 
    aRR3 = {
        "g":[mpf(1)/mpf(10), mpf(1)/mpf(10), mpf(3)/mpf(10), mpf(3)/mpf(10)], 
        "c":[1,1,-1,-1],"Q":mpf(1)/mpf(5)}


    particleset = [HH25,aRR3, BS25, LaughlinE5]
    names =[    r"$\mathrm{HH}_{2/5}$ (e/5)",
                r"$\overline{\mathrm{RR}}_{k=3} $ (e/5)",
                r"$\mathrm{BS}_{2/5}$ (e/5)",
                r"Laughlin (2e/5)"]
    mp.mp.dps= 60    
    fig = plt.figure()
    ax = fig.add_subplot(111)
    ans = []
    for i in range(len(names)):
        particle = genData.copy()
        particle.update(particleset[i])
        Qe = particle["Q"]
        del particle["Q"]
        A = base_parameters(particle, V = Vpoints, Q = Qe, T = 1/mpf(10**3))
        
        B = Rfunc_constructor(A, method = 'series')
        B.setParameter(nterms = 1000, maxA = 12, maxK = 12)
        B.genAnswer()
        ans.append(B)
        ax.plot(Vpoints, B.rrfunction, label = names[i], linewidth=1.5) 
    xt = np.linspace(0, 1 * 10**(-4), 5)
    xt_labels = [str(int(i * 10**6)) for i in xt]
    dashstyle  = [(None, None), [10,4], [6,3,1,3,1,3],[2,2] ,[2,6]]
    for i in range(len(ax.get_lines())):
        ax.get_lines()[i].set_color('black')
        ax.get_lines()[i].set_dashes(dashstyle[i]) 

    ax.set_ylabel(r"$\mathrm{Re}[H_{ij}^{\mathrm{mod}}]{}$", fontsize=16)
    ax.set_xlabel(r'Voltage [$\mu$V]', fontsize=16)
    ax.xaxis.set_label_coords(.9, -0.06)
    ax.set_ybound([-.5, 1])
    ax.set_yticks([-0.25, 0, .25, .5, .75, 1])
    ax.set_yticklabels([-0.25, 0, 0.25, 0.5, 0.75, 1])
    xt = np.linspace(0, 1 * 10**(-4), 5)
    xt_labels = [str(int(i * 10**6)) for i in xt]    
    ax.set_xticks(xt)
    ax.set_xticklabels(xt_labels)
    ax.set_title(r"Modulating function for $\nu = 12/5 $ candidates", fontsize=16)
    ax.legend(loc='upper right', prop={'size':14})
    ax.grid(True)
    plt.setp(ax.get_xticklabels(), fontsize=14)
    plt.setp(ax.get_yticklabels(), fontsize=14)
    if saving: plt.savefig('particles_12_5.pdf', bbox_inches=0, dpi=300)
    plt.show()
    return ans    
def particles_5_2(saving = False):
    Vpoints = mp.linspace(0, mpf('1.')/mpf(10**4), 201)
    dist1 = mpf('2.4')/ mpf(10**(6)) 
    dist2 = mpf('2.1')/mpf(10**(6)) 
    genData = { 
        "v":[mpf(i) * mpf(10**j) for (i,j) in [(5,3),(5,3),(1.4,3),(1.4,3)]],
         "x":[-dist1, dist2, -dist1, dist2]}
    pfaffE2 = {
        "g":[mpf(1)/mpf(2),mpf(1)/mpf(2)],
        "c":[1,1],
        "x":[-dist1, dist2],
        "v":[mpf(i) * mpf(10**j) for (i,j) in [(5,3),(5,3)]],"Q":1/mpf(2)}
    pfaff = {
        "g":[mpf(1)/mpf(8), mpf(1)/mpf(8),mpf(1)/mpf(8), mpf(1)/mpf(8)], 
        "c":[1,1,1,1],"Q":1/mpf(4)}
    apf = {
        "g":[mpf(1)/mpf(8),mpf(1)/mpf(8),mpf(3)/mpf(8), mpf(3)/mpf(8)], 
        "c":[1,1,-1,-1],"Q":1/mpf(4)}
    state331 = {
        "g":[mpf(1)/mpf(8), mpf(1)/mpf(8), mpf(1)/mpf(4), mpf(1)/mpf(4)], 
        "c":[1,1,1,1],"Q":1/mpf(4)}

    particleset = [apf, state331, pfaff, pfaffE2]
    names = [
            "Anti-Pfaffian (e/4)",                
            "(3,3,1)-state (e/4)",
            "Pfaffian (e/4)", 
            "Laughlin (e/2)"]

    mp.mp.dps= 60
    fig = plt.figure()
    ax = fig.add_subplot(111)
    ans = []
    for i in range(0,4):
        particle = genData.copy()
        particle.update(particleset[i])
        Qe = particle["Q"]
        del particle["Q"]
        A = base_parameters(particle, V = Vpoints, Q = Qe, T = 1/mpf(10**3))
        B = Rfunc_constructor(A, method = 'series')
        B.setParameter(nterms = 1200, maxA = 12, maxK = 12)
        B.genAnswer()
###        uncomment to return all instances
#        ans.extend([copy.deepcopy(A),copy.deepcopy(B)])
###
        if B.rrfunction.shape[1] > 1:
            ax.plot(Vpoints, B.rrfunction[:,0], label = names[i], linewidth=1.5) 
        else:
            ax.plot(Vpoints, B.rrfunction, label = names[i], linewidth=1.5)             

        
    dashstyle  = [(None, None), [10,4], [5,3,1,3], [2,4]]
    for i in range(len(ax.get_lines())):
        ax.get_lines()[i].set_color('black')
        ax.get_lines()[i].set_dashes(dashstyle[i])            
        
    ax.set_ylabel(r"$\mathrm{Re}[H_{ij}^{\mathrm{mod}}]{}$", fontsize=16)
    ax.set_xlabel(r'Voltage [$\mu$V]', fontsize=16)
    ax.xaxis.set_label_coords(.9, -0.06)
    ax.set_ybound([-.5, 1])
    ax.set_yticks([-0.25, 0, .25, .5, .75, 1])
    ax.set_yticklabels([-0.25, 0, 0.25, 0.5, 0.75, 1])
    xt = np.linspace(0, 1 * 10**(-4), 5)
    xt_labels = [str(int(i * 10**6)) for i in xt]
    ax.set_xticks(xt)
    ax.set_xticklabels(xt_labels)
    ax.set_title(r"Modulating function for $\nu = 5/2 $ candidates", fontsize=16)
    ax.legend(loc='upper right', prop={'size':14})
    ax.grid(True)    
    plt.setp(ax.get_xticklabels(), fontsize=14)
    plt.setp(ax.get_yticklabels(), fontsize=14)
    if saving: plt.savefig('particles_5_2.pdf', bbox_inches=0, dpi=300)
    plt.show()
    return ans