program honeycomb
   implicit none
   integer::i,j,N
   real::x,y,z
   open(unit=15,file='carbon-A.dat')
   N=8
   z=0.0
   do i=0,N-1,2
      do j=0,N-1
         x=sqrt(3.0)/2.0*real(i)
         y=j
         write(15,30) "C",x,y,z
         x=sqrt(3.0)/2.0*real(i+1)
         y=j+0.5
         if(i .ne. N-2) write(15,30) "C", x,y,z
      enddo
   enddo
   close(15)

   open(unit=16,file='carbon-B.dat')
   do i=0,N-1,2
      do j=0,N-1
         x=sqrt(3.0)/2.0*real(i)
         y=j
         if(i .ne. 0) write(16,30) "C",x-1.0/sqrt(3.0),y,z
         x=sqrt(3.0)/2.0*real(i+1)
         y=j+0.5
         write(16,30) "C",x-1.0/sqrt(3.0),y,z
      enddo
   enddo
   close(16)
   30 format(a6,3f9.5)
end program
