def GNR_zigzag(Nz): # create cnt coordinates cnt = swcnt(((Nz+1)//2,(Nz+1)//2)) # armchair CNT ! minx = Inf maxx = -Inf atoms = cnt.atoms[:Nz*2] # unroll the cnt for a in atoms: r = norm(a.pos[:2]) # print a.pos phi = atan2(a.pos[1],a.pos[0])%(2*pi) # print phi a.pos[0] = r*phi minx = min(minx,a.pos[0]) maxx = max(maxx,a.pos[0]) a.pos[1] = 0 a.rot = asmatrix(eye(3)) for a in atoms: a.pos[0] -= (maxx+minx)*0.5 res = xyz.chain(period=cnt.period) res.atoms = atoms return res
def zigzag(N): CC_distance = param.GRAPHENE_CC_DISTANCE period = 3*CC_distance r = N * 3.**.5 * CC_distance / (2*pi) res = xyz.chain((0,0,period)) res.radius = r def addatom(rho,phi,z): res.atoms.append(xyz.atom('C', pos=(rho*cos(phi),rho*sin(phi),z), rot=[[cos(phi),-sin(phi),0],[sin(phi),cos(phi),0],[0,0,1]], )) for n in range(N): addatom(r,2*pi*(2*n )/(2*N),period/6) addatom(r,2*pi*(2*n )/(2*N),period/2) addatom(r,2*pi*(2*n+1)/(2*N),0) addatom(r,2*pi*(2*n+1)/(2*N),period/1.5) return res
def chiral(M,N): assert M >= 0 assert N >= 0 if M==0: M,N=N,0 assert M > 0 CC_distance = param.GRAPHENE_CC_DISTANCE r = radius(M,N) multiple = gcd(M,N) multiple_perp = gcd((M+2*N),(2*M+N)) # = gcd(3M+3N,2M+N) # = gcd(-3M,2M+N) # = gcd(-3M,-M+N) # = gcd(3M,M-N) M_perp = (M+2*N) / multiple_perp N_perp = (2*M+N) / multiple_perp period = CC_distance * (3.0 * (M_perp**2 + N_perp**2 - M_perp*N_perp))**0.5 # = CC_distance * sqrt(3.0) * sqrt((M+2*N)**2 + (2*M+N)**2 - (M+2*N)*(2*M+N)) / multiple_perp # = CC_distance * sqrt(3.0) * sqrt(3*M**2 + 3*N**2 + 3*M*N) / multiple_perp # = CC_distance * 3 * sqrt(M**2 + N**2 + M*N) / gcd((M+2*N),(2*M+N)) Nplaquettes = 2 * (M**2 + N**2 + M*N)/multiple_perp Natoms = Nplaquettes * 2 Nlines = (M+N)/multiple start = [0]*Nlines stop = [0]*Nlines for l in range(Nlines): start[l] = -(l*N/(M+N)) for l in range(Nlines): stop[l] = N_perp + start[(l-(M_perp-N_perp))%Nlines] - N/multiple*((l-(M_perp-N_perp))/Nlines) # assert (sum(stop) - sum(start)) * multiple == Nplaquettes """ X*a = R*(Ma+Nb)+L*((M+2N)a-(2M+N)b) b: 0 = RN-2LM-LN R = 2LM/N+L a: X = (2LM/N+L)M+LM+2LN L:=N R = 2M+N X = 2MM+2NM+2NN """ dphi_a = 2*pi * (2*M+N)/(2*(M*M + M*N + N*N)) dphi_b = 2*pi * (M+2*N)/(2*(M*M + M*N + N*N)) dphi_c = dphi_a - dphi_b dz_a = CC_distance * sqrt(3) * sqrt((2*M+N)**2 + (M+2*N)**2 - (2*M+N)*(M+2*N)) * N / (2*(M*M + M*N + N*N)) dz_b = - CC_distance * sqrt(3) * sqrt((2*M+N)**2 + (M+2*N)**2 - (2*M+N)*(M+2*N)) * M / (2*(M*M + M*N + N*N)) dz_c = dz_a - dz_b res = xyz.chain((0,0,period)) res.radius = r def addatom(rho,phi,z): res.atoms.append(xyz.atom('C', pos=(rho*cos(phi),rho*sin(phi),z), rot=[[cos(phi),-sin(phi),0],[sin(phi),cos(phi),0],[0,0,1]], )) n = 0 for l in range(Nlines): for p in range(start[l],stop[l]): for m in range(multiple): phi_A = dphi_a * l + dphi_c * p + 2*pi*m/multiple z_A = dz_a * l + dz_c * p phi_B = phi_A + (dphi_a+dphi_b)/3 z_B = z_A + (dz_a+dz_b)/3 addatom(r,phi_A,z_A) addatom(r,phi_B,z_B) assert len(res.atoms) == Natoms return res