Exemplo n.º 1
0
def nanotube_data(n, m, R=1.42):
    """
    Return a dictionary if miscellaneous nanotube data 
    """
    from hotbit import Atoms
    a = sqrt(3.0) * R
    data = {}
    data['a'] = a
    data['diameter'] = a / pi * sqrt(n**2 + m**2 + n * m)
    data['radius'] = data['diameter'] / 2
    data['C'] = data['diameter'] * pi
    if n == m:
        d = n
        dR = 3 * n
    else:
        d = gcd(n, m)
        if np.mod(n - m, 3 * d) == 0:
            dR = 3 * d
        else:
            dR = d

    data['T'] = 3 * R * sqrt(n**2 + m**2 + n * m) / dR
    data['metallic'] = (np.mod(n - m, 3) == 0)
    data['semiconducting'] = not data['metallic']
    data['angle'] = atan(sqrt(3) * m / (m + 2 * n))
    data['hexagons_per_cell'] = int(round(2 * (m**2 + n**2 + m * n) / dR, 0))
    if n == m:
        data['type'] = 'armchair'
    elif n == 0 or m == 0:
        data['type'] = 'zigzag'
    else:
        data['type'] = 'chiral'
    return data
Exemplo n.º 2
0
def nanotube_data(n,m,R=1.42):
    """
    Return a dictionary if miscellaneous nanotube data 
    """
    from hotbit import Atoms
    a=sqrt(3.0)*R
    data={}
    data['a'] = a
    data['diameter'] = a/pi*sqrt(n**2+m**2+n*m)
    data['radius'] = data['diameter']/2
    data['C'] = data['diameter']*pi
    if n==m:
        d = n
        dR = 3*n
    else:
        d = gcd(n,m)
        if np.mod(n-m,3*d)==0:
            dR = 3*d
        else:
            dR = d
        
    data['T'] = 3*R*sqrt(n**2+m**2+n*m)/dR
    data['metallic'] = (np.mod(n-m,3)==0)
    data['semiconducting'] = not data['metallic']
    data['angle'] = atan( sqrt(3)*m/(m+2*n) )
    data['hexagons_per_cell'] = int(round(2*(m**2+n**2+m*n)/dR,0))
    if n==m:
        data['type'] = 'armchair'
    elif n==0 or m==0:
        data['type'] = 'zigzag'
    else:
        data['type'] = 'chiral'
    return data
Exemplo n.º 3
0
def nanotube(n, m, R=1.42, length=1, element='C'):
    '''
    Create a nanotube around z-axis.
    
    parameters:
    -----------
    n,m:    chiral indices
    R:      nearest neighbor distance
    length: number of unit cells
    element: element symbol
    '''
    from hotbit import Atoms
    at = Atoms(pbc=(False, False, True))

    sq3 = sqrt(3.0)
    a0 = R
    gcn = gcd(n, m)

    a1 = np.array([sq3 / 2, 0.5]) * a0 * sq3
    a2 = np.array([sq3 / 2, -0.5]) * a0 * sq3

    h = float(float(n) - float(m)) / float(3 * gcn)

    if h - int(h) == 0.0:
        RR = 3
    else:
        RR = 1

    c = n * a1 + m * a2
    abs_c = sqrt(dot(c, c))

    a = (-(2 * m + n) * a1 + (2 * n + m) * a2) / (gcn * RR)
    abs_a = sqrt(dot(a, a))

    eps = 0.01
    b = [[1. / 3 - eps, 1. / 3 - eps], [2. / 3 - eps, 2. / 3 - eps]]

    nxy = max(n, m) + 100
    eps = 0.00001

    for x in xrange(-nxy, nxy):
        for y in xrange(-nxy, nxy):
            for b1, b2 in b:
                p = (x + b1) * a1 + (y + b2) * a2
                abs_p = sqrt(dot(p, p))

                sa = dot(p, a) / (abs_a**2)
                sc = dot(p, c) / (abs_c**2)

                if sa >= 0 and sa < 1 - eps and sc >= 0 and sc < 1 - eps:
                    r = (cos(2 * pi * sc) * abs_c / (2 * pi),
                         sin(2 * pi * sc) * abs_c / (2 * pi), sa * abs_a)
                    at += Atom(element, r)
    at.set_cell((2 * abs_c / (2 * pi), 2 * abs_c / (2 * pi), length * abs_a))
    b = at.copy()

    for i in range(length - 1):
        b.translate((0.0, 0.0, abs_a))
        for j in b:
            at += j
    at.center(axis=2)
    rcm = at.get_center_of_mass()
    at.translate((-rcm[0], -rcm[1], 0))
    at.set_pbc((False, False, True))
    at.data = nanotube_data(n, m)
    return at
Exemplo n.º 4
0
def nanotube(n,m,R=1.42,length=1,element='C'):
    '''
    Create a nanotube around z-axis.
    
    parameters:
    -----------
    n,m:    chiral indices
    R:      nearest neighbor distance
    length: number of unit cells
    element: element symbol
    '''
    from hotbit import Atoms
    at = Atoms( pbc = ( False, False, True ) )

    sq3 = sqrt(3.0)
    a0 = R
    gcn = gcd(n, m)
    
    a1 = np.array( [ sq3/2,  0.5 ] ) * a0 * sq3
    a2 = np.array( [ sq3/2, -0.5 ] ) * a0 * sq3

    h = float(float(n)-float(m))/float(3*gcn)

    if h-int(h) == 0.0:
        RR = 3
    else:
        RR = 1

    c = n*a1 + m*a2
    abs_c = sqrt(dot(c, c))

    a = ( -(2*m+n)*a1 + (2*n+m)*a2 )/(gcn*RR)
    abs_a = sqrt(dot(a, a))

    eps = 0.01
    b = [ [ 1./3-eps, 1./3-eps ], [ 2./3-eps, 2./3-eps ] ]

    nxy = max(n, m)+100
    eps = 0.00001
    
    for x in xrange(-nxy, nxy):
        for y in xrange(-nxy, nxy):
            for b1, b2 in b:
                p = (x+b1)*a1 + (y+b2)*a2
                abs_p = sqrt(dot(p, p))

                sa = dot(p, a)/(abs_a**2)
                sc = dot(p, c)/(abs_c**2)

                if sa >= 0 and sa < 1-eps and sc >= 0 and sc < 1-eps:
                    r = ( cos(2*pi*sc)*abs_c/(2*pi), sin(2*pi*sc)*abs_c/(2*pi), sa*abs_a )
                    at += Atom( element, r ) 
    at.set_cell( ( 2*abs_c/(2*pi), 2*abs_c/(2*pi), length*abs_a ) )
    b = at.copy()

    for i in range(length-1):
        b.translate( ( 0.0, 0.0, abs_a ) )
        for j in b:
            at += j
    at.center(axis=2)
    rcm = at.get_center_of_mass()
    at.translate( (-rcm[0],-rcm[1],0) )
    at.set_pbc((False,False,True))
    at.data = nanotube_data(n,m)
    return at