c234567
      PROGRAM FORMATS

C THIS PROGRAM READS THE FILE WITH THE X,Y,Z COORDINATES
C AND GIVES THE FILE shape.dat WITH THE FORMAT NEEDED BY DDSCAT
C AND THE FILE crystal.dat WITH THE FORMAT NEEDED BY CRYSTAL MAKER

C TERMS AND CONDITIONS
C This program has been devised for its use in research within the academic commnunity. 
C The authors are: Ana Lilia Gonzalez and Cecilia Noguez. There is no warranty for any 
C part of the program, which is provided by the authors without warranty of any 
C kind, either express or implied.
C The use of this program in any form, subject to the restriction that in any paper or 
C other academic publication containing results wholly or partially derived from the 
C results of use of this program, the papers relevant to this program and method should
C be cited as best scientific practice dictates.
C The authors do not supply support services of any kind, including, but not 
C limited to, installation, compilation and use of the software.
C Please report errors and modifications to cecilia@fisica.unam.mx

        PARAMETER(M=200000) 

        IMPLICIT REAL*8 (A-H,O-Q,T-Z)
        DIMENSION NX(M),NY(M),NZ(M),n1(m),n2(m),n3(m)
        

 25       FORMAT(I7,4x,I4,4x,I4,4x,I4,4x,'1',4x,'1',4x,'1')
 26      FORMAT(3x,'1.0000',4X,'0.0000',4X,'0.0000',2X,'=A_1 vector')
 27      FORMAT(3x,'0.0000',4X,'1.0000',4X,'0.0000',2X,'=A_1 vector')
 28      FORMAT(3x,'1.0',7X,'1.0',7X,'1.0')
 
       open(unit=1,file='coordinates.dat',status='old',
     *   access='sequential')
      
       write(*,*)'Write the number of dipoles'
       read(*,*)natoms
       write(*,*)'write the number of the shape'
       write(*,*)'Truncated Cube ==> 1'
       write(*,*)'Octahedron  ==> 2' 
       write(*,*)'Icosahedron ==> 3' 
       write(*,*)'Regular Decahedron ==> 4' 
       write(*,*)'Star Decahedron    ==> 5'
       write(*,*)'Marks Decahedron   ==> 6' 
       write(*,*)'Rounded Decahedron ==> 7' 
       write(*,*)'Hexagonal Prism    ==> 8' 
       write(*,*)'Pentagonal Prism   ==> 9' 
       write(*,*)'Octahedral Prism   ==> 10' 

       read(*,*)nshape
     
       open(unit=2,file='shape.dat') !formato DDA
        OPEN(unit=3,file='crystal.dat') !formato CRYSTAL
 
       If (nshape.eq.1) then   
             write(2,*)'Truncated cube'
        else if (nshape.eq.2) then   
             write(2,*)'Octahedron'
        else if (nshape.eq.3) then   
             write(2,*)'Icosahedron'
        else if (nshape.eq.4) then   
             write(2,*)'Regular Decahedron'
        else if (nshape.eq.5) then   
             write(2,*)'Star Decahedron'
        else if (nshape.eq.6) then   
             write(2,*)'Marks Decahedron'
        else if (nshape.eq.7) then   
             write(2,*)'Rounded Decahedron'
        else if (nshape.eq.8) then   
             write(2,*)'Hexagonal Prism'
        else if (nshape.eq.9) then   
             write(2,*)'Pentagonal Prism'
        else if (nshape.eq.10) then   
             write(2,*)'Octahedral Prism'
         end if

         write(2,*)natoms
         write(2,26)
         write(2,27)
         write(2,28)
         write(2,*)

         write(3,*)natoms
 
        Do 15 i=1,natoms

        read(1,*)nx(i),ny(i),nz(i)
       
C25       FORMAT(4x,I6,4x,I6,4x,I6)
c       WRITE(*,25) i,nx(i),ny(i),nz(i),n1(i),n2(i),n2(i)
        write(2,25)i,nx(i),ny(i),nz(i)

        WRITE(3,*)'Ag',i, nx(i),ny(i),nz(i) 
 15       continue

          stop

          end
