# source:trunk/src/fortran/maketube.f@2

Revision 2, 2.4 KB checked in by ngel1914, 8 years ago (diff)
• Property svn:executable set to `*`
Line
1c
2c Atomic Coordinates for several unit cells of a (n,m) nanotube
3c
4c Made by 10/31/95   by T. Takeya and R. Saito
5c
6c Reference: ''Physical Properties of Carbon Nanotubes''
7c             Imperial College Press,
8c             by R. Saito, G. Dresselhaus, and M.S. Dresselhaus
9c
10c Input : n (from keyboard, the number of the unit cell.)
11c       : cell.xyz (coordinates of unit cell--work file made by the program A-2)
12c Output: tube.xyz (atomic coordinates)
13c
14c  modified by M.S. Lundstrom to output pdb file
15c  2/22/02
16
17      implicit real*8(a-h,o-z)
18      character argv*10
19      integer oone
20      parameter (nk=5000)
21      dimension x(nk),y(nk),z(nk),uniquez(nk)
22      logical found
23c
24      argc = iargc()
25      if(argc .ne. 1) then
26         write(*,*)'Usage:  maketube <approx_length_in_atoms>'
27         write(*,*)''
28         call exit(1)
29      endif
30      call getarg(1, argv)
32c
33      open(61,FILE='cell.xyz')
36c
37      if(nn .gt. nk) stop 'change parameter nk to a larger value'
38c
39      do 10 i=1,nn
41 10   continue
42      close(61,status='keep')
43c
44c Scan through all z-coordinates and look for unique values.
45c This tells us how many atoms tall a unit cell is.  Then, we
46c know how many periods to generate to get the desired length
47c of nanotube below.
48c
49      numz = 0
50      do 100 i=1,nn
51         found = .false.
52         do 110 j=1,numz
53            if (abs(z(i)-uniquez(j)) .le. 1.d-6) then
54               found = .true.
55               exit
56            endif
57 110     continue
58         if (.not. found) then
59            numz = numz+1
60            uniquez(numz) = z(i)
61         endif
62 100  continue
63c
64      periods = n/numz
65      if (mod(n,numz) .gt. 0) then
66         periods = periods + 1
67      endif
68c
69      open(60,FILE='tube.xyz')
70      write(60,*)periods*nn
71      write(60,*)' '
72      do 21 jj=1,periods
73         do 20 i=1,nn
74            write(60,700)x(i),y(i),z(i)+dfloat(jj-1)*t
75 20      continue
76 21   continue
77
78 700  format('C',3f10.5)
79      close(60)
80
81      open(80,FILE='tube.pdb')
82      oone = 1
83      one = 1.00
84      zero = 0.00
85      do 210 jj=1,periods
86         do 200 i=1,nn
87            write(80,800) (jj-1)*nn+i,
88     2                    oone,x(i),y(i),z(i)+dfloat(jj-1)*t,one,zero
89 200     continue
90 210  continue
91 800  format('ATOM  ',i5,' C    ADE A',i4,4x,3f8.3,2f6.2)
92
93      write(80,810)
94 810  format('TER')
95      close(80)
96      stop
97      end
Note: See TracBrowser for help on using the repository browser.