Exemple #1
0
def plot_fig3c():

    plot_mus = True  # False #
    edge = 'ac'
    T, wis = 10, [5, 7, 9, 11, 13]
    _, axs = get_axes(1, 1, .8)

    deva = .6
    data = np.empty(len(wis), dtype='object')
    width_f = np.zeros(len(wis))
    F = .006  # eV/angst
    fmax = F * 1. / (3 * np.sqrt(3) * bond**2 / 4) * .4
    a = .3
    colors = ['red', 'blue', 'green', 'black', 'cyan', 'yellow']

    for i, wi in enumerate(wis):
        data[i] = get_stick_data('KC', T, '%s_stickTaito' % edge, wi)
        width_f[i] = int_toAngst(wi, edge, key='width', C_C=bond)

    print width_f

    def axplusb(x, a, b):

        return a * x + b

    def Mmax(Lt, width_f, f):
        def gfun(x):
            return 0

        def hfun(x):
            return width_f / 2

        def func(y, x):
            return np.sqrt(x**2 + y**2)

        return 2 * f * dblquad(func, 0, Lt, gfun, hfun)[0]

    #thetas =   width_f/(2*360/mus*1./(2*np.pi)*10)
    def teor(theta, W0):
        #return 2*np.sqrt(3)/9*1000*bond**3/W0*k*(1- 2*tau/(k*W0))**2*theta**3
        return 2 * 2 * np.sqrt(3) / 9 * 1000 * bond**3 / W0 * k * (
            1 - 2 * tau / (k * W0))**2 * theta**3

    plot2 = []
    plot3 = []

    fit_vals = [
        [.0007, .46],
        [.0008, .4],
        [.00075, .64],
        [.00084, .705],
        [.00085, .868],
    ]

    fit_vals = [
        [.00077, .6],
        [.00077, .6],
        [.00077, .6],
        [.00077, .6],
        [.00077, .6],
    ]

    for j, wi in enumerate(wis):
        LbLt = data[j]
        LbLt.view('i8,i8').sort(order=['f0'], axis=0)
        Rs = LbLt[:, 0] / (np.pi / 3.)
        thetas = width_f[j] / (2 * Rs)
        mus = thetas * 2. / width_f[j] * 360 / (2 * np.pi) * 10
        print thetas

        if wi == 5: m = 0
        if wi == 7: m = 1
        if wi == 9: m = 2
        if wi == 11: m = 3
        if wi == 13: m = 4

        if plot_mus:
            #plt.plot(mus, LbLt[:,1], '-o', color = colors[j],
            #         alpha = .8, label = r'width = %.2f\AA' %(width_f[j] + 2))

            #a,b = curve_fit(axplusb, mus, LbLt[:,1]/LbLt[:,0], p0 = [1.,11])[0][:2]

            #plt.plot(mus, LbLt[:,1]/LbLt[:,0], '-o', color = colors[j],
            #         alpha = .8, label = r'width = %.2f\AA' %(width_f[j] + 2))
            #plt.plot(mus, a*mus + b, '--', color = colors[j],
            #         alpha = .8)
            #plot2.append([width_f[j], -b/a])
            #plt.plot(mus, LbLt[:,1]/width_f[j], '-o', color = colors[j],
            #         alpha = .8, label = r'width = %.2f\AA' %(width_f[j] + 2))
            R_exp = width_f[j] / (2 * thetas)

            add_L = np.sqrt(2 * R_exp * deva + deva**2) / 10.

            axs[0].scatter(LbLt[:, 1] / 10 + add_L, mus, color=colors[m])
            axs[0].text(3 + 1.5 / 4 * m,
                        11 - 7. / 4 * m,
                        r'w=%i' % wi,
                        color=colors[m])

        else:
            axs[0].plot(thetas, LbLt[:, 1], '-o', color=colors[m], alpha=.8)
            '''
            a,b = curve_fit(axplusb, thetas, LbLt[:,1]/LbLt[:,0], p0 = [1.,11])[0][:2]
            
            plt.plot(thetas, LbLt[:,1]/LbLt[:,0], '-o', color = colors[j], 
                     alpha = .8, label = r'width = %.2f\AA' %(width_f[j] + 2)) 
            plt.plot(thetas, a*thetas + b, '--', color = colors[j], 
                     alpha = .8) 
            
            
            plot2.append([width_f[j], -b/a])
            '''
        #plt.plot(thetas, LbLt[:,1]/LbLt[:,0], '-o', color = colors[j], alpha = .8)

        print np.sqrt(width_f[j] / .01 * a + a**2)

        def gfunc(Lt, theta, f, a):
            L = np.sqrt(width_f[j] / theta * a + a**2) + Lt
            return (1. / 6. * theta * k * width_f[j]**2 -
                    Mmax(L, width_f[j], f))**2

        def Ltail(thetas, f, a):

            Lts = np.zeros(len(thetas))
            print f, a
            for i, theta in enumerate(thetas):
                Lts[i] = fmin(gfunc, 1, args=([theta, f, a]), disp=0)[0]
            return Lts

        def Ltail2(theta, f, a):

            return fmin(gfunc, 1, args=([theta, f, a]), disp=0)[0]**2

        Lmax = 55
        Lts = np.linspace(0, Lmax, 15)
        thts = np.linspace(0.005, .045, len(Lts))
        teor_Lt = np.zeros(len(Lts))

        if False:
            fmax, a = curve_fit(Ltail, thetas, LbLt[:, 1], p0=[fmax, .2])[0]
        else:
            fmax, a = fit_vals[j]

        print fmax, a

        for i, Lt in enumerate(Lts):
            #teor_theta[k]   =   6*Mmax(Lt)/(k*width_f**2)
            teor_Lt[i] = Ltail([thts[i]], fmax, a) + np.sqrt(
                width_f[j] / thts[i] * deva +
                deva**2)  #fmin(gfunc, 1, args=([thts[i]]), disp = 0)[0]
            #print thts[i], teor_Lt[i], 6*Mmax(teor_Lt[i], width_f[j])/(k*width_f[j]**2) - thts[i]

        if plot_mus:
            degs = thts * 2 / width_f[j] * 3600 / (2 * np.pi)
            Lbend_teor = np.pi / 3 * width_f[j] / (2 * thts)
            #plt.plot(degs, teor_Lt/Lbend_teor, '--', color = colors[j], label = 'width = %i' %wi)
            #plt.plot(degs, teor_Lt/width_f[j], '--', color = colors[j], label = 'width = %i' %wi)

            R_teor = width_f[j] / (2 * thts)

            axs[0].plot(teor_Lt / 10,
                        degs,
                        '--',
                        color=colors[m],
                        label='width = %i' % wi)

            theta0 = fmin(Ltail2, .001, args=([fmax, a]), disp=0)[0]
            deg0 = theta0 * 2 / width_f[j] * 3600 / (2 * np.pi)
            plot3.append([width_f[j], deg0, theta0])

        else:
            axs[0].plot(teor_Lt / 10,
                        thts,
                        '--',
                        color=colors[m],
                        label='width = %i' % wi)

        #plt.legend(loc = 2, frameon = False)
    if not plot_mus:
        axs[0].set_ylabel(r'$\Theta$')
        axs[0].set_xlabel(r'$L (nm)$')
    else:
        axs[0].set_ylabel(r'Curvature $\kappa$ (deg/nm)')
        axs[0].set_xlabel(r'$L$ (nm)')

    #axs[0].legend(loc = 2, frameon = False)
    #axs[0].set_title('Required tail length for pinning')
    axs[0].set_ylim([0, 13])
    axs[0].set_xlim([1, 6])
    axs[0].set_xticks(np.linspace(0, 7, 8))

    a = plt.axes([.3, .675, .27, .23])
    plot3 = np.array(plot3)
    plt.plot(plot3[:, 0], plot3[:, 1], '--', color='black', alpha=.5)
    for i in range(5):
        plt.scatter(plot3[i, 0], plot3[i, 1], color=colors[i])
    plt.yticks(np.linspace(.6, 2.2, 5))
    plt.xticks(np.linspace(4, 16, 4))
    plt.xlabel(r'Width (\AA)')
    plt.ylabel(r'$\kappa$ (deg/nm)')

    plt.show()

    plot3 = np.array(plot3)
    plt.plot(plot3[:, 0], plot3[:, 1], '-o')
    plt.show()

    plot3 = np.array(plot3)
    plt.plot(plot3[:, 0], plot3[:, 2], '-o')
    plt.show()

    plot2 = np.array(plot2)
    plt.plot(plot2[:, 0], plot2[:, 1], '-o')
    plt.show()
Exemple #2
0
def plot_fig3c():
    
    plot_mus    = True # False #
    edge    =   'ac'
    T, wis  =   10, [5, 7, 9, 11, 13]
    _, axs    =   get_axes(1,1, .8)
    
    deva    =   .6
    data    =   np.empty(len(wis), dtype = 'object')
    width_f =   np.zeros(len(wis))
    F       =   .006 # eV/angst
    fmax    =   F*1./(3*np.sqrt(3)*bond**2/4)*.4
    a       =   .3
    colors  =   ['red', 'blue', 'green', 'black', 'cyan', 'yellow']
    
    for i, wi in enumerate(wis):
        data[i]     =   get_stick_data('KC', T, '%s_stickTaito' %edge, wi)
        width_f[i]  =   int_toAngst(wi, edge, key='width', C_C = bond)
    
    print width_f
    
    def axplusb(x, a, b):
        
        return a*x + b
    
    def Mmax(Lt, width_f, f):
        
        def gfun(x):
            return 0
        def hfun(x):
            return width_f/2
        
        def func(y,x):
            return np.sqrt(x**2 + y**2)
            
        return 2*f*dblquad(func, 0, Lt, gfun, hfun)[0]
    
    
    
    #thetas =   width_f/(2*360/mus*1./(2*np.pi)*10)
    def teor(theta, W0):
        #return 2*np.sqrt(3)/9*1000*bond**3/W0*k*(1- 2*tau/(k*W0))**2*theta**3
        return 2*2*np.sqrt(3)/9*1000*bond**3/W0*k*(1- 2*tau/(k*W0))**2*theta**3

    plot2 = []
    plot3 = []
    
    fit_vals    =   [[.0007, .46],
                     [.0008, .4],
                     [.00075, .64],
                     [.00084, .705],
                     [.00085, .868],]

    fit_vals    =   [[.00077, .6],
                     [.00077, .6],
                     [.00077, .6],
                     [.00077, .6],
                     [.00077, .6],]

    
    for j, wi in enumerate(wis):
        LbLt    =   data[j]
        LbLt.view('i8,i8').sort(order=['f0'], axis=0)
        Rs      =   LbLt[:,0]/(np.pi/3.)
        thetas  =   width_f[j]/(2*Rs) 
        mus     =   thetas*2./width_f[j]*360/(2*np.pi)*10 
        print thetas
        
        if wi == 5: m = 0
        if wi == 7: m = 1
        if wi == 9: m = 2
        if wi == 11: m = 3
        if wi == 13: m = 4
        
        
        if plot_mus:
            #plt.plot(mus, LbLt[:,1], '-o', color = colors[j], 
            #         alpha = .8, label = r'width = %.2f\AA' %(width_f[j] + 2))
            
            #a,b = curve_fit(axplusb, mus, LbLt[:,1]/LbLt[:,0], p0 = [1.,11])[0][:2]
            
            #plt.plot(mus, LbLt[:,1]/LbLt[:,0], '-o', color = colors[j], 
            #         alpha = .8, label = r'width = %.2f\AA' %(width_f[j] + 2)) 
            #plt.plot(mus, a*mus + b, '--', color = colors[j], 
            #         alpha = .8) 
            #plot2.append([width_f[j], -b/a])
            #plt.plot(mus, LbLt[:,1]/width_f[j], '-o', color = colors[j], 
            #         alpha = .8, label = r'width = %.2f\AA' %(width_f[j] + 2)) 
            R_exp   =   width_f[j]/(2*thetas)
            
            add_L   =   np.sqrt(2*R_exp*deva + deva**2)/10.
            
            axs[0].scatter(LbLt[:,1]/10 + add_L, mus, color = colors[m])
            axs[0].text(3 + 1.5/4*m, 11 - 7./4*m, r'w=%i' %wi, color = colors[m]) 
            
        else:
            axs[0].plot(thetas, LbLt[:,1], '-o', color = colors[m], alpha = .8)
            
            '''
            a,b = curve_fit(axplusb, thetas, LbLt[:,1]/LbLt[:,0], p0 = [1.,11])[0][:2]
            
            plt.plot(thetas, LbLt[:,1]/LbLt[:,0], '-o', color = colors[j], 
                     alpha = .8, label = r'width = %.2f\AA' %(width_f[j] + 2)) 
            plt.plot(thetas, a*thetas + b, '--', color = colors[j], 
                     alpha = .8) 
            
            
            plot2.append([width_f[j], -b/a])
            '''
        #plt.plot(thetas, LbLt[:,1]/LbLt[:,0], '-o', color = colors[j], alpha = .8) 
        
        print  np.sqrt(width_f[j]/.01*a + a**2)
            
        def gfunc(Lt, theta, f, a):
            L       =   np.sqrt(width_f[j]/theta*a + a**2) + Lt 
            return (1./6.*theta*k*width_f[j]**2 - Mmax(L, width_f[j], f))**2
        
        def Ltail(thetas, f, a):
            
            Lts =   np.zeros(len(thetas))
            print f, a 
            for i, theta in enumerate(thetas):
                Lts[i]  =   fmin(gfunc, 1, args=([theta, f, a]), disp = 0)[0]
            return Lts
        
        def Ltail2(theta, f, a):
            
            return fmin(gfunc, 1, args=([theta, f, a]), disp = 0)[0]**2
        
        Lmax        =   55
        Lts         =   np.linspace(0, Lmax, 15)
        thts        =   np.linspace(0.005, .045, len(Lts))
        teor_Lt     =   np.zeros(len(Lts))
         
        if False:
            fmax, a =   curve_fit(Ltail, thetas, LbLt[:,1], p0 = [fmax, .2])[0]
        else:
            fmax, a =   fit_vals[j]
            
        print fmax, a
        
        for i, Lt in enumerate(Lts):
            #teor_theta[k]   =   6*Mmax(Lt)/(k*width_f**2) 
            teor_Lt[i]      =   Ltail([thts[i]], fmax ,a) + np.sqrt(width_f[j]/thts[i]*deva + deva**2) #fmin(gfunc, 1, args=([thts[i]]), disp = 0)[0]
            #print thts[i], teor_Lt[i], 6*Mmax(teor_Lt[i], width_f[j])/(k*width_f[j]**2) - thts[i]
        
        
        
        if plot_mus:
            degs        =   thts*2/width_f[j]*3600/(2*np.pi)
            Lbend_teor  =   np.pi/3*width_f[j]/(2*thts)
            #plt.plot(degs, teor_Lt/Lbend_teor, '--', color = colors[j], label = 'width = %i' %wi)
            #plt.plot(degs, teor_Lt/width_f[j], '--', color = colors[j], label = 'width = %i' %wi)
            
            R_teor  =   width_f[j]/(2*thts)
            
            axs[0].plot(teor_Lt/10, degs, '--', color = colors[m], label = 'width = %i' %wi)
            
            theta0  =   fmin(Ltail2, .001, args=([fmax, a]), disp = 0)[0]
            deg0    =   theta0*2/width_f[j]*3600/(2*np.pi)
            plot3.append([width_f[j], deg0, theta0])
            
        else:
            axs[0].plot(teor_Lt/10, thts, '--', color = colors[m], label = 'width = %i' %wi)
            
        #plt.legend(loc = 2, frameon = False)
    if not plot_mus:
        axs[0].set_ylabel(r'$\Theta$')
        axs[0].set_xlabel(r'$L (nm)$')
    else:
        axs[0].set_ylabel(r'Curvature $\kappa$ (deg/nm)')
        axs[0].set_xlabel(r'$L$ (nm)')
     
    #axs[0].legend(loc = 2, frameon = False)
    #axs[0].set_title('Required tail length for pinning')
    axs[0].set_ylim([0,13])
    axs[0].set_xlim([1,6])
    axs[0].set_xticks(np.linspace(0, 7, 8))
    
    
    a = plt.axes([.3, .675, .27, .23])
    plot3 = np.array(plot3)
    plt.plot(plot3[:,0], plot3[:,1], '--', color = 'black', alpha = .5)
    for i in range(5):
        plt.scatter(plot3[i,0], plot3[i,1], color = colors[i])
    plt.yticks(np.linspace(.6, 2.2, 5))
    plt.xticks(np.linspace(4, 16, 4))
    plt.xlabel(r'Width (\AA)')
    plt.ylabel(r'$\kappa$ (deg/nm)')
    
    plt.show()
    
    
    
    plot3 = np.array(plot3)
    plt.plot(plot3[:,0], plot3[:,1], '-o')
    plt.show()

    plot3 = np.array(plot3)
    plt.plot(plot3[:,0], plot3[:,2], '-o')
    plt.show()

    plot2 = np.array(plot2)
    plt.plot(plot2[:,0], plot2[:,1], '-o')
    plt.show()
Exemple #3
0
def plot_stick2(edge):

    
    plot_mus    = True # False #
    #edge    =   'ac'
    T, wis  =   10, [5, 7, 9, 11, 13]
    
    data    =   np.empty(len(wis), dtype = 'object')
    width_f =   np.zeros(len(wis))
    F       =   .006 # eV/angst
    fmax    =   F*1./(3*np.sqrt(3)*bond**2/4)*.4
    a       =   .3
    colors  =   ['blue', 'red', 'black', 'green', 'yellow']
    #print fmax
    
    for i, wi in enumerate(wis):
        data[i]     =   get_stick_data('KC', T, '%s_stickTaito' %edge, wi)
        width_f[i]  =   int_toAngst(wi, edge, key='width', C_C = bond)
    
    print width_f
    
    def axplusb(x, a, b):
        
        return a*x + b
    
    def Mmax(Lt, width_f, f):
        
        def gfun(x):
            return 0
        def hfun(x):
            return width_f/2
        
        def func(y,x):
            return np.sqrt(x**2 + y**2)
            
        return 2*f*dblquad(func, 0, Lt, gfun, hfun)[0]
    
    
    
    #thetas =   width_f/(2*360/mus*1./(2*np.pi)*10)
    def teor(theta, W0):
        #return 2*np.sqrt(3)/9*1000*bond**3/W0*k*(1- 2*tau/(k*W0))**2*theta**3
        return 2*2*np.sqrt(3)/9*1000*bond**3/W0*k*(1- 2*tau/(k*W0))**2*theta**3

    plot2 = []
    plot3 = []
    
    fit_vals    =   [[.0007, .46],
                     [.0008, .4],
                     [.00075, .64],
                     [.00084, .705],
                     [.00085, .868],]

    fit_vals    =   [[.00077, .6],
                     [.00077, .6],
                     [.00077, .6],
                     [.00077, .6],
                     [.00077, .6],]

    
    for j, wi in enumerate(wis):
        LbLt    =   data[j]
        LbLt.view('i8,i8').sort(order=['f0'], axis=0)
        Rs      =   LbLt[:,0]/(np.pi/3.)
        thetas  =   width_f[j]/(2*Rs) 
        mus     =   thetas*2./width_f[j]*360/(2*np.pi)*10 
        print thetas
        
        '''
        if plot_mus:
                    
            for i in range(len(mus)):
                if LbLt[i,1] < 3:
                    print 'hoos'
                    plt.scatter(mus[i], LbLt[i,1]/LbLt[i,0], marker = 'D',color = 'red')
                else:
                    plt.scatter(mus[i], LbLt[i,1]/LbLt[i,0], color = 'blue') 
            
            plt.scatter(mus, teor(thetas, width_f), marker = 'v', label = 'teor')
            
            plt.plot([2,2], [0, .4], '--', color = 'black')
            plt.plot([4,4], [0, .4], '--', color = 'black')
            plt.text(1.03, .4, 'experimetl stick below 2deg/angst')
            plt.text(1.03, -.05, 'red squares only one unit cell \n enought to hold bend')
            plt.text(3.7, .4, 'buckling')
            plt.title('Reguired tail length for bend to stick ac, w=7')
            plt.legend(loc = 2, frameon = False)
            plt.xlabel('Deg/angst')
            plt.ylabel('Ltail/Lbend')
            plt.show()
    
        else:
        '''
        if plot_mus:
            #plt.plot(mus, LbLt[:,1], '-o', color = colors[j], 
            #         alpha = .8, label = r'width = %.2f\AA' %(width_f[j] + 2))
            
            #a,b = curve_fit(axplusb, mus, LbLt[:,1]/LbLt[:,0], p0 = [1.,11])[0][:2]
            
            #plt.plot(mus, LbLt[:,1]/LbLt[:,0], '-o', color = colors[j], 
            #         alpha = .8, label = r'width = %.2f\AA' %(width_f[j] + 2)) 
            #plt.plot(mus, a*mus + b, '--', color = colors[j], 
            #         alpha = .8) 
            #plot2.append([width_f[j], -b/a])
            #plt.plot(mus, LbLt[:,1]/width_f[j], '-o', color = colors[j], 
            #         alpha = .8, label = r'width = %.2f\AA' %(width_f[j] + 2)) 
            R_exp   =   width_f[j]/(2*thetas)
            plt.plot(mus, LbLt[:,1]/R_exp, '-o', color = colors[j], 
                     alpha = .8, label = r'width = %.2f\AA' %(width_f[j] + 2)) 
            
        else:
            plt.plot(thetas, LbLt[:,1], '-o', color = colors[j], alpha = .8)
            
            '''
            a,b = curve_fit(axplusb, thetas, LbLt[:,1]/LbLt[:,0], p0 = [1.,11])[0][:2]
            
            plt.plot(thetas, LbLt[:,1]/LbLt[:,0], '-o', color = colors[j], 
                     alpha = .8, label = r'width = %.2f\AA' %(width_f[j] + 2)) 
            plt.plot(thetas, a*thetas + b, '--', color = colors[j], 
                     alpha = .8) 
            
            
            plot2.append([width_f[j], -b/a])
            '''
        #plt.plot(thetas, LbLt[:,1]/LbLt[:,0], '-o', color = colors[j], alpha = .8) 
        
        print  np.sqrt(width_f[j]/.01*a + a**2)
            
        def gfunc(Lt, theta, f, a):
            L       =   np.sqrt(width_f[j]/theta*a + a**2) + Lt 
            return (1./6.*theta*k*width_f[j]**2 - Mmax(L, width_f[j], f))**2
        
        def Ltail(thetas, f, a):
            
            Lts =   np.zeros(len(thetas))
            print f, a 
            for i, theta in enumerate(thetas):
                Lts[i]  =   fmin(gfunc, 1, args=([theta, f, a]), disp = 0)[0]
            return Lts
        
        def Ltail2(theta, f, a):
            
            return fmin(gfunc, 1, args=([theta, f, a]), disp = 0)[0]**2
        
        Lmax        =   35
        Lts         =   np.linspace(0, Lmax, 15)
        thts        =   np.linspace(0.005, .04, len(Lts))
        teor_Lt     =   np.zeros(len(Lts))
         
        if False:
            fmax, a =   curve_fit(Ltail, thetas, LbLt[:,1], p0 = [fmax, .2])[0]
        else:
            fmax, a =   fit_vals[j]
            
        print fmax, a
        
        for i, Lt in enumerate(Lts):
            #teor_theta[k]   =   6*Mmax(Lt)/(k*width_f**2) 
            teor_Lt[i]      =   Ltail([thts[i]], fmax ,a) #fmin(gfunc, 1, args=([thts[i]]), disp = 0)[0]
            #print thts[i], teor_Lt[i], 6*Mmax(teor_Lt[i], width_f[j])/(k*width_f[j]**2) - thts[i]
        
        
        
        if plot_mus:
            degs        =   thts*2/width_f[j]*3600/(2*np.pi)
            Lbend_teor  =   np.pi/3*width_f[j]/(2*thts)
            #plt.plot(degs, teor_Lt/Lbend_teor, '--', color = colors[j], label = 'width = %i' %wi)
            #plt.plot(degs, teor_Lt/width_f[j], '--', color = colors[j], label = 'width = %i' %wi)
            
            R_teor  =   width_f[j]/(2*thts)
            
            plt.plot(degs, teor_Lt/R_teor, '--', color = colors[j], label = 'width = %i' %wi)
            
            theta0  =   fmin(Ltail2, .001, args=([fmax, a]), disp = 0)[0]
            deg0    =   theta0*2/width_f[j]*3600/(2*np.pi)
            plot3.append([width_f[j], deg0, theta0])
        else:
            plt.plot(thts, teor_Lt, '--', color = colors[j], label = 'width = %i' %wi)
            
        #plt.legend(loc = 2, frameon = False)
    if not plot_mus:
        plt.xlabel('Theta')
        plt.ylabel('Ltail Angst')
    else:
        plt.xlabel('Curve deg/Angst')
        plt.ylabel('Ltail Angst')
     
    plt.legend(loc = 2, frameon = False)
    plt.title('Required tail length for pinning')
    plt.show()
    
    plot3 = np.array(plot3)
    plt.plot(plot3[:,0], plot3[:,1], '-o')
    plt.show()

    plot3 = np.array(plot3)
    plt.plot(plot3[:,0], plot3[:,2], '-o')
    plt.show()

    plot2 = np.array(plot2)
    plt.plot(plot2[:,0], plot2[:,1], '-o')
    plt.show()
Exemple #4
0
def plot_stick():

    #width_f = 7.5
    #print 4./360*2*np.pi*width_f/10/2.
    #exit()
    plot_mus    = False
    edge    =   'ac'
    T, wi   =   10, 11
    LbLt    =   get_stick_data('KC', T, '%s_stickTaito' %edge, wi)
    LbLt.view('i8,i8').sort(order=['f0'], axis=0)
    width_f =   int_toAngst(wi, edge, key='width', C_C = bond)
    
    Rs      =   LbLt[:,0]/(np.pi/3.)
    thetas  =   width_f/(2*Rs) 
    mus     =   thetas*2./width_f*360/(2*np.pi)*10 
    
    #thetas =   width_f/(2*360/mus*1./(2*np.pi)*10)
    def teor(theta, W0):
        #return 2*np.sqrt(3)/9*1000*bond**3/W0*k*(1- 2*tau/(k*W0))**2*theta**3
        return 2*2*np.sqrt(3)/9*1000*bond**3/W0*k*(1- 2*tau/(k*W0))**2*theta**3

    
    if plot_mus:
                
        for i in range(len(mus)):
            if LbLt[i,1] < 3:
                print 'hoos'
                plt.scatter(mus[i], LbLt[i,1]/LbLt[i,0], marker = 'D',color = 'red')
            else:
                plt.scatter(mus[i], LbLt[i,1]/LbLt[i,0], color = 'blue') 
        
        plt.scatter(mus, teor(thetas, width_f), marker = 'v', label = 'teor')
        
        plt.plot([2,2], [0, .4], '--', color = 'black')
        plt.plot([4,4], [0, .4], '--', color = 'black')
        plt.text(1.03, .4, 'experimetl stick below 2deg/angst')
        plt.text(1.03, -.05, 'red squares only one unit cell \n enought to hold bend')
        plt.text(3.7, .4, 'buckling')
        plt.title('Reguired tail length for bend to stick ac, w=7')
        plt.legend(loc = 2, frameon = False)
        plt.xlabel('Deg/angst')
        plt.ylabel('Ltail/Lbend')
        plt.show()

    else:

        for i in range(len(mus)):
            if LbLt[i,1] < 3:
                print 'hoos'
                plt.scatter(thetas[i], LbLt[i,1]/LbLt[i,0], marker = 'D',color = 'red')
                #plt.scatter(thetas[i], LbLt[i,1], marker = 'D',color = 'red')
                
            else:
                plt.scatter(thetas[i], LbLt[i,1]/LbLt[i,0], color = 'blue') 
                #plt.scatter(thetas[i], LbLt[i,1], color = 'blue') 
            print LbLt[i,1]/(np.pi/3)*2*thetas[i]/width_f, LbLt[i,1], 1/(np.pi/3)*2*thetas[i]/width_f, LbLt[i,0]
        #plt.scatter(thetas, teor(thetas, width_f), marker = 'v', label = 'teor')
        #plt.scatter(thetas, teor(thetas, width_f)*LbLt[:,0], marker = 'v', label = 'teor')
        
        plt.twinx()
        plt.scatter(thetas, LbLt[:,0])
        plt.scatter(thetas, LbLt[:,1])
        
        plt.legend(loc = 2, frameon = False)
        plt.xlabel('Theta')
        plt.ylabel('Ltail Angst')
        plt.show()
Exemple #5
0
def plot_stick2(edge):

    plot_mus = True  # False #
    #edge    =   'ac'
    T, wis = 10, [5, 7, 9, 11, 13]

    data = np.empty(len(wis), dtype='object')
    width_f = np.zeros(len(wis))
    F = .006  # eV/angst
    fmax = F * 1. / (3 * np.sqrt(3) * bond**2 / 4) * .4
    a = .3
    colors = ['blue', 'red', 'black', 'green', 'yellow']
    #print fmax

    for i, wi in enumerate(wis):
        data[i] = get_stick_data('KC', T, '%s_stickTaito' % edge, wi)
        width_f[i] = int_toAngst(wi, edge, key='width', C_C=bond)

    print width_f

    def axplusb(x, a, b):

        return a * x + b

    def Mmax(Lt, width_f, f):
        def gfun(x):
            return 0

        def hfun(x):
            return width_f / 2

        def func(y, x):
            return np.sqrt(x**2 + y**2)

        return 2 * f * dblquad(func, 0, Lt, gfun, hfun)[0]

    #thetas =   width_f/(2*360/mus*1./(2*np.pi)*10)
    def teor(theta, W0):
        #return 2*np.sqrt(3)/9*1000*bond**3/W0*k*(1- 2*tau/(k*W0))**2*theta**3
        return 2 * 2 * np.sqrt(3) / 9 * 1000 * bond**3 / W0 * k * (
            1 - 2 * tau / (k * W0))**2 * theta**3

    plot2 = []
    plot3 = []

    fit_vals = [
        [.0007, .46],
        [.0008, .4],
        [.00075, .64],
        [.00084, .705],
        [.00085, .868],
    ]

    fit_vals = [
        [.00077, .6],
        [.00077, .6],
        [.00077, .6],
        [.00077, .6],
        [.00077, .6],
    ]

    for j, wi in enumerate(wis):
        LbLt = data[j]
        LbLt.view('i8,i8').sort(order=['f0'], axis=0)
        Rs = LbLt[:, 0] / (np.pi / 3.)
        thetas = width_f[j] / (2 * Rs)
        mus = thetas * 2. / width_f[j] * 360 / (2 * np.pi) * 10
        print thetas
        '''
        if plot_mus:
                    
            for i in range(len(mus)):
                if LbLt[i,1] < 3:
                    print 'hoos'
                    plt.scatter(mus[i], LbLt[i,1]/LbLt[i,0], marker = 'D',color = 'red')
                else:
                    plt.scatter(mus[i], LbLt[i,1]/LbLt[i,0], color = 'blue') 
            
            plt.scatter(mus, teor(thetas, width_f), marker = 'v', label = 'teor')
            
            plt.plot([2,2], [0, .4], '--', color = 'black')
            plt.plot([4,4], [0, .4], '--', color = 'black')
            plt.text(1.03, .4, 'experimetl stick below 2deg/angst')
            plt.text(1.03, -.05, 'red squares only one unit cell \n enought to hold bend')
            plt.text(3.7, .4, 'buckling')
            plt.title('Reguired tail length for bend to stick ac, w=7')
            plt.legend(loc = 2, frameon = False)
            plt.xlabel('Deg/angst')
            plt.ylabel('Ltail/Lbend')
            plt.show()
    
        else:
        '''
        if plot_mus:
            #plt.plot(mus, LbLt[:,1], '-o', color = colors[j],
            #         alpha = .8, label = r'width = %.2f\AA' %(width_f[j] + 2))

            #a,b = curve_fit(axplusb, mus, LbLt[:,1]/LbLt[:,0], p0 = [1.,11])[0][:2]

            #plt.plot(mus, LbLt[:,1]/LbLt[:,0], '-o', color = colors[j],
            #         alpha = .8, label = r'width = %.2f\AA' %(width_f[j] + 2))
            #plt.plot(mus, a*mus + b, '--', color = colors[j],
            #         alpha = .8)
            #plot2.append([width_f[j], -b/a])
            #plt.plot(mus, LbLt[:,1]/width_f[j], '-o', color = colors[j],
            #         alpha = .8, label = r'width = %.2f\AA' %(width_f[j] + 2))
            R_exp = width_f[j] / (2 * thetas)
            plt.plot(mus,
                     LbLt[:, 1] / R_exp,
                     '-o',
                     color=colors[j],
                     alpha=.8,
                     label=r'width = %.2f\AA' % (width_f[j] + 2))

        else:
            plt.plot(thetas, LbLt[:, 1], '-o', color=colors[j], alpha=.8)
            '''
            a,b = curve_fit(axplusb, thetas, LbLt[:,1]/LbLt[:,0], p0 = [1.,11])[0][:2]
            
            plt.plot(thetas, LbLt[:,1]/LbLt[:,0], '-o', color = colors[j], 
                     alpha = .8, label = r'width = %.2f\AA' %(width_f[j] + 2)) 
            plt.plot(thetas, a*thetas + b, '--', color = colors[j], 
                     alpha = .8) 
            
            
            plot2.append([width_f[j], -b/a])
            '''
        #plt.plot(thetas, LbLt[:,1]/LbLt[:,0], '-o', color = colors[j], alpha = .8)

        print np.sqrt(width_f[j] / .01 * a + a**2)

        def gfunc(Lt, theta, f, a):
            L = np.sqrt(width_f[j] / theta * a + a**2) + Lt
            return (1. / 6. * theta * k * width_f[j]**2 -
                    Mmax(L, width_f[j], f))**2

        def Ltail(thetas, f, a):

            Lts = np.zeros(len(thetas))
            print f, a
            for i, theta in enumerate(thetas):
                Lts[i] = fmin(gfunc, 1, args=([theta, f, a]), disp=0)[0]
            return Lts

        def Ltail2(theta, f, a):

            return fmin(gfunc, 1, args=([theta, f, a]), disp=0)[0]**2

        Lmax = 35
        Lts = np.linspace(0, Lmax, 15)
        thts = np.linspace(0.005, .04, len(Lts))
        teor_Lt = np.zeros(len(Lts))

        if False:
            fmax, a = curve_fit(Ltail, thetas, LbLt[:, 1], p0=[fmax, .2])[0]
        else:
            fmax, a = fit_vals[j]

        print fmax, a

        for i, Lt in enumerate(Lts):
            #teor_theta[k]   =   6*Mmax(Lt)/(k*width_f**2)
            teor_Lt[i] = Ltail(
                [thts[i]], fmax,
                a)  #fmin(gfunc, 1, args=([thts[i]]), disp = 0)[0]
            #print thts[i], teor_Lt[i], 6*Mmax(teor_Lt[i], width_f[j])/(k*width_f[j]**2) - thts[i]

        if plot_mus:
            degs = thts * 2 / width_f[j] * 3600 / (2 * np.pi)
            Lbend_teor = np.pi / 3 * width_f[j] / (2 * thts)
            #plt.plot(degs, teor_Lt/Lbend_teor, '--', color = colors[j], label = 'width = %i' %wi)
            #plt.plot(degs, teor_Lt/width_f[j], '--', color = colors[j], label = 'width = %i' %wi)

            R_teor = width_f[j] / (2 * thts)

            plt.plot(degs,
                     teor_Lt / R_teor,
                     '--',
                     color=colors[j],
                     label='width = %i' % wi)

            theta0 = fmin(Ltail2, .001, args=([fmax, a]), disp=0)[0]
            deg0 = theta0 * 2 / width_f[j] * 3600 / (2 * np.pi)
            plot3.append([width_f[j], deg0, theta0])
        else:
            plt.plot(thts,
                     teor_Lt,
                     '--',
                     color=colors[j],
                     label='width = %i' % wi)

        #plt.legend(loc = 2, frameon = False)
    if not plot_mus:
        plt.xlabel('Theta')
        plt.ylabel('Ltail Angst')
    else:
        plt.xlabel('Curve deg/Angst')
        plt.ylabel('Ltail Angst')

    plt.legend(loc=2, frameon=False)
    plt.title('Required tail length for pinning')
    plt.show()

    plot3 = np.array(plot3)
    plt.plot(plot3[:, 0], plot3[:, 1], '-o')
    plt.show()

    plot3 = np.array(plot3)
    plt.plot(plot3[:, 0], plot3[:, 2], '-o')
    plt.show()

    plot2 = np.array(plot2)
    plt.plot(plot2[:, 0], plot2[:, 1], '-o')
    plt.show()
Exemple #6
0
def plot_stick():

    #width_f = 7.5
    #print 4./360*2*np.pi*width_f/10/2.
    #exit()
    plot_mus = False
    edge = 'ac'
    T, wi = 10, 11
    LbLt = get_stick_data('KC', T, '%s_stickTaito' % edge, wi)
    LbLt.view('i8,i8').sort(order=['f0'], axis=0)
    width_f = int_toAngst(wi, edge, key='width', C_C=bond)

    Rs = LbLt[:, 0] / (np.pi / 3.)
    thetas = width_f / (2 * Rs)
    mus = thetas * 2. / width_f * 360 / (2 * np.pi) * 10

    #thetas =   width_f/(2*360/mus*1./(2*np.pi)*10)
    def teor(theta, W0):
        #return 2*np.sqrt(3)/9*1000*bond**3/W0*k*(1- 2*tau/(k*W0))**2*theta**3
        return 2 * 2 * np.sqrt(3) / 9 * 1000 * bond**3 / W0 * k * (
            1 - 2 * tau / (k * W0))**2 * theta**3

    if plot_mus:

        for i in range(len(mus)):
            if LbLt[i, 1] < 3:
                print 'hoos'
                plt.scatter(mus[i],
                            LbLt[i, 1] / LbLt[i, 0],
                            marker='D',
                            color='red')
            else:
                plt.scatter(mus[i], LbLt[i, 1] / LbLt[i, 0], color='blue')

        plt.scatter(mus, teor(thetas, width_f), marker='v', label='teor')

        plt.plot([2, 2], [0, .4], '--', color='black')
        plt.plot([4, 4], [0, .4], '--', color='black')
        plt.text(1.03, .4, 'experimetl stick below 2deg/angst')
        plt.text(1.03, -.05,
                 'red squares only one unit cell \n enought to hold bend')
        plt.text(3.7, .4, 'buckling')
        plt.title('Reguired tail length for bend to stick ac, w=7')
        plt.legend(loc=2, frameon=False)
        plt.xlabel('Deg/angst')
        plt.ylabel('Ltail/Lbend')
        plt.show()

    else:

        for i in range(len(mus)):
            if LbLt[i, 1] < 3:
                print 'hoos'
                plt.scatter(thetas[i],
                            LbLt[i, 1] / LbLt[i, 0],
                            marker='D',
                            color='red')
                #plt.scatter(thetas[i], LbLt[i,1], marker = 'D',color = 'red')

            else:
                plt.scatter(thetas[i], LbLt[i, 1] / LbLt[i, 0], color='blue')
                #plt.scatter(thetas[i], LbLt[i,1], color = 'blue')
            print LbLt[i, 1] / (np.pi / 3) * 2 * thetas[i] / width_f, LbLt[
                i, 1], 1 / (np.pi / 3) * 2 * thetas[i] / width_f, LbLt[i, 0]
        #plt.scatter(thetas, teor(thetas, width_f), marker = 'v', label = 'teor')
        #plt.scatter(thetas, teor(thetas, width_f)*LbLt[:,0], marker = 'v', label = 'teor')

        plt.twinx()
        plt.scatter(thetas, LbLt[:, 0])
        plt.scatter(thetas, LbLt[:, 1])

        plt.legend(loc=2, frameon=False)
        plt.xlabel('Theta')
        plt.ylabel('Ltail Angst')
        plt.show()