// Povray file for generating (n,m) nanotube // author: Florian Simon // date: 2012/06/18 // // Persistence Of Vision raytracer version 3.62 // // //=============================================================================================================================EXPLANATION===== // // This file creates a unit cell of (n,m) nanotubes (4 macros can be used here). // //============================================================================================================================================= #include "colors.inc" #include "functions.inc" #include "logo.inc" #include "shapes.inc" #include "textures.inc" #include "Woods.inc" #include "stones.inc" #include "glass.inc" #include "metals.inc" //global_settings {max_trace_level 5} camera{ // orthographic // location <0, 0, -15>*2 translate 0 // look_at 0 } // light_source{ <15, 10, -10> // color White parallel // point_at 0 } background{color White} //============================================================================================================================================= //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ #macro lat (n,m,xx,lev) //---------------------------------------------------------------------------------------------------------------------------------- // Parameters for lattice //---------------------------------------------------------------------------------------------------------------------------------- #declare a = 1.49 ; // length of unit vector (2.49 Angstrom) #declare theta = acos( (2*n+m)/(2*sqrt(n*n+m*m+n*m)) ) ;// chiral angle #declare s = a / sqrt(3) ; // length of bond #declare s2 = s/2 ; // half of length of bond #declare sx = cos(pi/6) * s ; // s in x-direction when 30deg rotated #declare sy = sin(pi/6) * s ; // s in y-direction when 30deg rotated #declare d = sx ; // distance between levels #declare sh1x = cos(pi/3) * 2*sx ; // shift vector 1 in x-direction #declare sh1y = sin(pi/3) * 2*sx ; // shift vector 1 in y-direction #declare sh3x = 2*sx ; // shift vector 3 in x-direction #declare sh3y = 0 ; // shift vector 3 in y-direction #declare sh1 = ; // shift vector 1 #declare sh2 = <-sh1x,sh1y,0> ; // shift vector 2 #declare sh3 = ; // shift vector 3 #declare cor = ; // start point correction (shifts lattice, so that <0,0,0> is an atom) ... //---------------------------------------------------------------------------------------------------------------------------------- #union{ // #declare Atex = pigment{color rgb<1,0,0>} ; // atom texture (A) #declare Botex = pigment{color rgb<0.5,0.5,0.5>} ; // bond texture #declare Ar = 0.05 ; // atom radius #declare Br = 0.05 ; // bond radius //---------------------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------------------- #declare X = array[ 6 ] ; // arrays for coordinates of first hexagon #declare Y = array[ 6 ] ; // #declare X[0] = sx ; // #declare Y[0] = s2 ; // #declare X[1] = 0 ; // #declare Y[1] = s2+sy ; // #declare X[2] = -sx ; // #declare Y[2] = s2 ; // #declare X[3] = -sx ; // #declare Y[3] = -s2 ; // #declare X[4] = 0 ; // #declare Y[4] = -s2-sy ; // #declare X[5] = sx ; // #declare Y[5] = -s2 ; // //---------------------------------------------------------------------------------------------------------------------------------- #declare hex = // #union{ // #declare label = 0 ; // while loop for drawing of first hexagon #while ( label <=5 ) // sphere { ,Ar // drawing the atom texture{Atex} no_shadow } // cylinder{ ,,Br // bond texture {Botex} no_shadow } // #declare label = label + 1 ; // #end // } // //---------------------------------------------------------------------------------------------------------------------------------- #union{ // loop(s) for "big" hexagon // object{ hex } // #declare ring = 1 ; // #while ( ring<=xx ) // // object{ hex translate ring*-sh3 } // object{ hex translate ring*+sh3 } // // #declare index = 0 ; // #while ( index<=(2*xx+1-ring-1) ) // // object{ hex translate xx*-sh3 translate ring*+sh1 translate index*sh3 } // object{ hex translate xx*-sh3 translate ring*-sh2 translate index*sh3 } // // #declare index = index + 1 ; // #end // #declare ring = ring + 1 ; // #end // // translate cor translate z*lev*d} // rotate z*(theta*360/2/pi) // //---------------------------------------------------------------------------------------------------------------------------------- } // union end //---------------------------------------------------------------------------------------------------------------------------------- #end // macro end //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ //============================================================================================================================================= object{ lat (4,0,20,0) } object{ lat (4,0,20,0) rotate z*(120*clock) }