示例#1
0
def PlotEpsilon( h = [ 0.5 , 1.0 , 1.5 ] ):
    j = 1.0
    L = 100
    k = system.kpoints(L,0,"all")
    lines = []
    ll = []
#    pp.title(r"$$")
    for i in range(len(h)):
        ek = system.epsilon(k, h[i] ,j )
        lines.append( pp.plot(k,ek) )
        ll.append( "".join( ['$ h =',`h[i]`,'$' ] ) )
    pp.xlabel('$k$', fontsize=16)
    pp.ylabel(r'$\epsilon_k/J$',fontsize=16)
    pp.legend( lines, ll, loc=0)
    pp.xlim( -numpy.pi,numpy.pi )
    pp.show()
    return
示例#2
0
def PlotMaxMag( ):
    import ising1D
    
    h = 0.5
    L = 500

    k = system.kpoints(L,0,">")

    ising1D.system.L = L
    ising1D.system.h = h
    
    egs_p = ising1D.system.egs()
    egs_m = egs_p
    mgs_p = ising1D.system.mgs()
    mgs_m = mgs_p
    
    edata_p = [ egs_p ]
    edata_m = [ egs_m ]
    mdata_p = [ mgs_p ]
    mdata_m = [ mgs_m ]

    for i in range(len(k)):
        
        egs_p += 2.0*ising1D.system.energy( k[i], h, 1.0 )/numpy.float(L)
        mgs_p += 2.0*ising1D.system.sigmaz( k[i] )/numpy.float(L)

        egs_m += 2.0*ising1D.system.energy( k[len(k)-1-i], h, 1.0 )/numpy.float(L)
        mgs_m += 2.0*ising1D.system.sigmaz( k[len(k)-1-i] )/numpy.float(L)

        edata_p.append( egs_p )
        edata_m.append( egs_m )

        mdata_p.append( mgs_p )
        mdata_m.append( mgs_m )

    pp.plot(edata_p,mdata_p)
    pp.plot(edata_m,mdata_m)
    pp.show()
    
    return
示例#3
0
def PlotCoef():
    h0 = [0.5 , 1.0 , 1.5]
#attenzione che hai copiato solo il link
    h = h0
    L = 100
    lines = []
    ll = []
    k = system.kpoints(L,0,">")
    for i in range(len(h0)):
        for j in range(len(h)):
            if (h0[i] < h[j]):
                c = system.Coef( h0[i] , h[j] , L )
                lines.append( pp.plot( k,c ) )
                ll.append( "".join(["$h^0 =",`h0[i]`,"$, $h =",`h[j]`,"$" ]) )

    pp.title(''.join(["$L = ",`L`,"$"]))
    pp.xlabel("$k$",fontsize=16)
    pp.ylabel("$z_k$",fontsize=16)
    pp.legend( lines, ll, loc=0 )
    pp.yscale('log')
    pp.xlim(0,numpy.pi)
    pp.show()
    return
示例#4
0
def PlotSigmaz( h = [ 0.5 , 1.0 ,1.5 ] ):
    import ising1D

    L = 100
    k = system.kpoints(L,0,"all")
    lines = []
    ll = []
    ising1D.system.l = L

    for i in range(len(h)):
        ising1D.system.h = h[i]
        ek = []
        for j in range( len(k) ):
            ek.append( ising1D.system.sigmaz( k[j] ) )

        lines.append( pp.plot(k,ek) )
        ll.append( "".join( ['$ h =',`h[i]`,'$' ] ) )

    pp.xlabel('$k$', fontsize=16)
    pp.ylabel(r'$m_k$',fontsize=16)
    pp.legend( lines, ll, loc=0)
    pp.xlim( -numpy.pi,numpy.pi )
    pp.show()
    return
示例#5
0
文件: runs.py 项目: farnsworth/i1D
def PlotMagArrayAllSpace(h, l, ebin, mbin ):

    import matplotlib.cm as cm

    ising1D.system.h = h
    ising1D.system.l = l
    ising1D.exact.mag_array_calc_allspace( ebin, mbin)
#    ising1D.exact.mag_array_calc( ebin, mbin)
    
    data = ising1D.exact.real_array
    data2 = ising1D.exact.array
    emax = ising1D.exact.emax_plot
    mmax = ising1D.exact.obsmax_plot

#    tmp = data.min()
#    for i in range(ebin):
#        for j in range(mbin):
#            if ( data2[i,j] == 0 ):
#                data[i,j] = tmp
            
    data = numpy.log(data)

    fig = pp.figure()
    ax = fig.add_subplot(111)

    cax = ax.imshow( numpy.transpose(data), origin="lower", interpolation="nearest", extent=(-emax,emax,-mmax,mmax),aspect='auto',cmap=cm.gray_r )
#    cbar = fig.colorbar( cax )
#    cbar.set_label(r"$\log ( \rho(E,M) ) $")
    ax.set_ylabel(r"${M_z{}}_{\alpha \alpha}$",fontsize=20)
    ax.set_xlabel(r"$E_\alpha/(L J)$",fontsize=20)
    [i.set_fontsize(15) for i in ax.get_xticklabels() + ax.get_yticklabels()]
#    ax.set_title( r"".join( ["$L = ",`l`,"$, $h = ",`h`,"$"] ) )



    k = system.kpoints(l,0,">")
    
    egs_p = ising1D.system.egs()
    egs_m = egs_p
    mgs_p = ising1D.system.mgs()
    mgs_m = mgs_p
    
    edata_p = [ egs_p ]
    edata_m = [ egs_m ]
    mdata_p = [ mgs_p ]
    mdata_m = [ mgs_m ]

    for i in range(len(k)):
        
        egs_p += 2.0*ising1D.system.energy( k[i], h, 1.0 )/numpy.float(l)
        mgs_p += 2.0*ising1D.system.sigmaz( k[i] )/numpy.float(l)

        egs_m += 2.0*ising1D.system.energy( k[len(k)-1-i], h, 1.0 )/numpy.float(l)
        mgs_m += 2.0*ising1D.system.sigmaz( k[len(k)-1-i] )/numpy.float(l)

        edata_p.append( egs_p )
        edata_m.append( egs_m )

        mdata_p.append( mgs_p )
        mdata_m.append( mgs_m )

    ax.plot(edata_p,mdata_p,'g--')
    ax.plot(edata_m,mdata_m,'g--')
    ax.set_xlim(-emax,emax)
    ax.set_ylim(-mmax,mmax)
    
    return