           PROGRAM Conf
    
      PARAMETER (nx=6,ny=6,nz=6, Nt=6,NVOL=NX*NY*NZ*NT,NLINK=4*NVOL)
      PARAMETER (NVOLP2=2*NVOL ,NLINK2=2*NLINK ,NVOL3=3*NVOL)
      PARAMETER (NX3=NX*NY*NZ,NX34=4*NX3, LI1FI=8)
      PARAMETER (LINKAG=52,ICGAUGE=55,LINKF=57,IGCF=58)
      PARAMETER (NVOL16=NVOL/16,NVOL4=NVOL/4)
      PARAMETER (NVOL8=2*NVOL16 ,NVOL2=4*NVOL8 ,NVO316=3*NVOL16)
      PARAMETER(NX38=NX3/8,NT2=NT/2,NX312=NX3*12,NYNT=NY*NT,NT2P1=NT2+1)
      PARAMETER (NX383=3*NX38,NX384=4*NX38,NX33=NX3*3)
      PARAMETER (LX3=2*NX3,LX38=2*NX38,LX383=2*NX383,NYZ=NY*NZ)
      PARAMETER (MXX=NX/2,MYY=NY/2,MZZ=NZ/2)
      COMPLEX GT,GC,LINK
      INTEGER XX(4)

      CHARACTER*1024 ofile

      COMMON/LATT/LL(4),LSVO(5),IP(NVOL,4),IM(NVOL,4)
      COMMON/PROC/GC(9,NX3)
      COMMON/PROA/LINK(9,NX33),GT(9,NX3)
      DATA IRG/0/                ! FLAG IRG=0 FOR GAUGE TRAN
************************************************************
*          FILE DIRECTORY
*    8--LI1FI          ORIGINAL LINKS
*    57--LINKF         LINKS IN COULOMB GAUGE (ALL 4 DIRECTI
*    58--IGCF          GAUGE TRANSFORMATIONS INTO COULOMB GA
*                      CONJUGATED AS FOR AXIAL GAUGE)
*    92               FMUNU SPACE only in COULOMB GAUGE
*    52,53,55,56       AUXILLIARY FILES USED IN COUL
************************************************************
    
    
C     Output file name is first command-line argument (added, DBC)

      CALL getarg (1, ofile)
      OPEN (UNIT = LI1FI, FILE = ofile,
     1      STATUS = 'UNKNOWN', FORM = 'UNFORMATTED')
    
C     INIZIALIZZAZIONI VARIE
    
      LL(1)=NX
      LL(2)=NY
      LL(3)=NZ
      LL(4)=NT
    
    
      LSVO(1) = 1
      LSVO(2) = NX
      LSVO(3) = NX*NY
      LSVO(4) = NX*NY*NZ
      LSVO(5) = NX*NY*NZ*NT
    
    
    
      DO 1 ID = 1,4
      DO 1 IT=1,NT
      XX(4) = IT
      DO 1 IZ=1,NZ
      XX(3) = IZ
      DO 1 IY=1,NY
      XX(2) = IY
      DO 1 IX=1,NX
      XX(1) = IX
    
      ITOT = IX + LSVO(2)*(IY-1) +LSVO(3)*(IZ-1) + LSVO(4)*(
     C      IT-1)
      IP1=MOD(XX(ID),LL(ID))+1
      IM1=MOD(XX(ID)-2+LL(ID),LL(ID))+1
      IP(ITOT,ID)=LSVO(ID)*(IP1-XX(ID))
1     IM(ITOT,ID)=LSVO(ID)*(IM1-XX(ID))
    
C          LETTURA CONFIGURAZIONE DI GAUGE
    
    
              LY=NX
              LZ=NX
    
    
             CALL SCACCHI
    
             IF(IRG.EQ.0) THEN
                 CALL Crea
              ENDIF
    
    
9999        CONTINUE
      STOP
      END
    
    
      SUBROUTINE Crea
      PARAMETER (nx=6,ny=6,nz=6, Nt=6,NVOL=NX*NY*NZ*NT,NLINK=4*NVOL)
      PARAMETER (NVOLP2=2*NVOL ,NLINK2=2*NLINK ,NVOL3=3*NVOL)
      PARAMETER (NX3=NX*NY*NZ,NX34=4*NX3, LI1FI=8)
      PARAMETER (LINKAG=52,ICGAUGE=55,LINKF=57,IGCF=58)
      PARAMETER (NITER=200)    !FLA
      PARAMETER (omega=1.60, om=omega, om2=om*(om-1.)/2. )    !FLA
      PARAMETER (NVOL16=NVOL/16,NVOL4=NVOL/4)
      PARAMETER (NVOL8=2*NVOL16 ,NVOL2=4*NVOL8 ,NVO316=3*NVOL16)
      PARAMETER(NX38=NX3/8,NT2=NT/2,NX312=NX3*12,NYNT=NY*NT,NT2P1=NT2+1)
      PARAMETER (NX383=3*NX38,NX384=4*NX38,NX33=NX3*3)
      PARAMETER (LX3=2*NX3,LX38=2*NX38,LX383=2*NX383,NYZ=NY*NZ)
      PARAMETER (MXX=NX/2,MYY=NY/2,MZZ=NZ/2)
    
      INTEGER ITT(9)
      INTEGER X,XTE,TE,NEIGH(27),SN(NX3,27)
      INTEGER  XPL(LX38,3),XML(LX38,3)
      INTEGER ADXY1PP(NX3),ADXY2PP(NX3),ADXY3PP(NX3),ADXY4PP(NX3)
      INTEGER ADXZ1PP(NX3),ADXZ2PP(NX3),ADXZ3PP(NX3),ADXZ4PP(NX3)
      INTEGER ADYZ1PP(NX3),ADYZ2PP(NX3),ADYZ3PP(NX3),ADYZ4PP(NX3)
      INTEGER ADXY1MP(NX3),ADXY2MP(NX3),ADXY3MP(NX3),ADXY4MP(NX3)
      INTEGER ADXZ1MP(NX3),ADXZ2MP(NX3),ADXZ3MP(NX3),ADXZ4MP(NX3)
      INTEGER ADYZ1MP(NX3),ADYZ2MP(NX3),ADYZ3MP(NX3),ADYZ4MP(NX3)
      INTEGER ADXY1MM(NX3),ADXY2MM(NX3),ADXY3MM(NX3),ADXY4MM(NX3)
      INTEGER ADXZ1MM(NX3),ADXZ2MM(NX3),ADXZ3MM(NX3),ADXZ4MM(NX3)
      INTEGER ADYZ1MM(NX3),ADYZ2MM(NX3),ADYZ3MM(NX3),ADYZ4MM(NX3)
      INTEGER ADXY1PM(NX3),ADXY2PM(NX3),ADXY3PM(NX3),ADXY4PM(NX3)
      INTEGER ADXZ1PM(NX3),ADXZ2PM(NX3),ADXZ3PM(NX3),ADXZ4PM(NX3)
      INTEGER ADYZ1PM(NX3),ADYZ2PM(NX3),ADYZ3PM(NX3),ADYZ4PM(NX3)
      INTEGER ADXT4PP(NX3),ADXT2PP(NX3),ADYT2PP(NX3),ADZT2PP(NX3)
    
      INTEGER IVBC(3,9)
      INTEGER IPG(NX3,NT),IOUXF(NX3,NT),IOUYF(NX3,NT)
     &        ,IOUZF(NX3,NT),IOUTF(NX3,NT)
    
      COMPLEX GT(9,NX3),GC,FMUNU(9,NX3,6)
      COMPLEX PROVV(9,4,NX3),PRUVV(9,NX34),LINK(9,NX33)
      COMPLEX XL(9),XR(9),XK(9),dva(9),trdva
      COMPLEX OUT1(9),OUT2(9),OUT3(9)
      COMPLEX OUTX(9),OUTY(9),OUTZ(9),OUTTOT(9)
      COMPLEX OUTXM(9),OUTYM(9),OUTZM(9),OUTTOTM(9)
      COMPLEX XXTTG(9,NX3),YYTTG(9,NX3),ZZTTG(9,NX3)
      COMPLEX USE1(9,NX3),USE2(9,NX3),USE3(9,NX3)
      COMPLEX USEX(9,NX3),USEY(9,NX3),USEZ(9,NX3)
      COMPLEX STR(6),SSTRR(6),SSTRI(6)
      COMPLEX PEXT(9,NT+1,27),PCEXT(9,NT,27)
      COMPLEX PEXT2(9,NT+1,729),PCEXT2(9,NT,729)
    
      COMMON/LATT/LL(4),LSVO(5),IP(NVOL,4),IM(NVOL,4)
      COMMON/PROC/GC(9,NX3)
      COMMON/PAR/HK,MINITER,MAXITER,PREC
      COMMON/ICS/X(NVOL16,16),XTE(NX38,8)
    
      EQUIVALENCE (PROVV,PRUVV)
    
      DATA ITT/1,4,7,2,5,8,3,6,9/
C   
C                 ISG =              1        2        3
C   
C             1 2 4 5 9 3 6 7 8    X X 0    1 0 0     X 0 X
C    IVBC =   5 6 8 9 1 2 3 4 7    X X 0    0 X X     0 1 0
C             1 3 7 9 5 2 4 6 8    0 0 1    0 X X     X 0 X
C   
      DATA IVBC/1,5,1,2,6,3,4,8,7,5,9,9,9,1,5,3,2,2,6,3,4,7,
     C     4,6,8,7,8/
    
*                           ADDRESSES  FOR FMUNU
    
        DO 501 IZ=1,NZ
        DO 501 IY=1,NY
        DO 501 IX=1,NX
        IOU=IX+NX*(IY-1)+NX*NY*(IZ-1)
    
*       ADRESSES X-Y
        ADXY1PP(IOU)=1+4*(IOU-1)
        ADXY2PP(IOU)=2+4*(IOU-IX+MOD(IX,NX))
        ADXY3PP(IOU)=1+4*(IOU+NX*(-IY+MOD(IY,NY)+1)-1)
        ADXY4PP(IOU)=ADXY1PP(IOU)+1
        ADXY1MP(IOU)=2+4*(IOU-1)
        ADXY2MP(IOU)=1+4*(IOU-IX+MOD(IX+NX-2,NX)+NX*
     &  (-IY+MOD(IY,NY)+1))
        ADXY3MP(IOU)=2+4*(IOU-IX+MOD(IX+NX-2,NX))
        ADXY4MP(IOU)=ADXY3MP(IOU)-1
        ADXY1MM(IOU)=ADXY4MP(IOU)
        ADXY2MM(IOU)=2+4*(IOU-IX+MOD(IX+NX-2,NX)+NX*
     &  (-IY+MOD(IY+NY-2,NY)+1))
        ADXY3MM(IOU)=ADXY2MM(IOU)-1
        ADXY4MM(IOU)=2+4*(IOU+NX*(-IY+MOD(IY+NY-2,NY)+1)-1)
        ADXY1PM(IOU)=ADXY4MM(IOU)
        ADXY2PM(IOU)=ADXY1PM(IOU)-1
        ADXY3PM(IOU)=2+4*(IOU-IX+MOD(IX,NX)+NX*
     &  (-IY+MOD(IY+NY-2,NY)+1))
        ADXY4PM(IOU)=ADXY1PP(IOU)
    
*       ADRESSES X-Z
        ADXZ1PP(IOU)=ADXY1PP(IOU)
        ADXZ2PP(IOU)=ADXY2PP(IOU)+1
        ADXZ3PP(IOU)=1+4*(IOU+NX*NY*(-IZ+MOD(IZ,NZ)+1)-1)
        ADXZ4PP(IOU)=ADXY4PP(IOU)+1
        ADXZ1MP(IOU)=ADXZ4PP(IOU)
        ADXZ2MP(IOU)=1+4*(IOU-IX+MOD(IX+NX-2,NX)+
     &  NX*NY*(-IZ+MOD(IZ,NZ)+1))
        ADXZ3MP(IOU)=ADXY3MP(IOU)+1
        ADXZ4MP(IOU)=ADXY4MP(IOU)
        ADXZ1MM(IOU)=ADXY1MM(IOU)
        ADXZ2MM(IOU)=3+4*(IOU-IX+MOD(IX+NX-2,NX)+NX*NY*
     &  (-IZ+MOD(IZ+NZ-2,NZ)+1))
        ADXZ3MM(IOU)=ADXZ2MM(IOU)-2
        ADXZ4MM(IOU)=3+4*(IOU+NX*NY*(-IZ+MOD(NZ+IZ-2,NZ)+1)-1)
        ADXZ1PM(IOU)=ADXZ4MM(IOU)
        ADXZ2PM(IOU)=ADXZ1PM(IOU)-2
        ADXZ3PM(IOU)=3+4*(IOU-IX+MOD(IX,NX)+NX*NY*
     &  (-IZ+MOD(IZ+NZ-2,NZ)+1))
        ADXZ4PM(IOU)=ADXZ1PP(IOU)
    
*       ADRESSES Y-Z
        ADYZ1PP(IOU)=ADXY1PP(IOU)+1
        ADYZ2PP(IOU)=ADXY3PP(IOU)+2
        ADYZ3PP(IOU)=ADXZ3PP(IOU)+1
        ADYZ4PP(IOU)=ADXY1PP(IOU)+2
        ADYZ1MP(IOU)=ADYZ4PP(IOU)
        ADYZ2MP(IOU)=2+4*(IOU+NX*(-IY+MOD(IY+NY-2,NY)+1)+NX*NY*
     &  (-IZ+MOD(IZ,NZ)+1)-1)
        ADYZ3MP(IOU)=1+ADXY4MM(IOU)
        ADYZ4MP(IOU)=ADXY4MM(IOU)
        ADYZ1MM(IOU)=ADYZ4MP(IOU)
        ADYZ2MM(IOU)=3+4*(IOU+NX*(-IY+MOD(IY+NY-2,NY)+1)+NX*NY*
     &  (-IZ+MOD(IZ+NZ-2,NZ)+1)-1)
        ADYZ3MM(IOU)=ADYZ2MM(IOU)-1
        ADYZ4MM(IOU)=ADXZ4MM(IOU)
        ADYZ1PM(IOU)=ADYZ4MM(IOU)
        ADYZ2PM(IOU)=ADYZ1PM(IOU)-1
        ADYZ3PM(IOU)=3+4*(IOU+NX*(-IY+MOD(IY,NY)+1)+NX*NY*
     &  (-IZ+MOD(IZ+NZ-2,NZ)+1)-1)
        ADYZ4PM(IOU)=ADYZ1PP(IOU)
    
501     CONTINUE
                       DO 129 IZ=1,NZ
                       DO 129 IY=1,NY
                       DO 129 IX=1,NX
           IJK=IX+NX*(IY-1)+NX*NY*(IZ-1)
           ADXT2PP(IJK)=4+4*(IJK-IX+MOD(IX,NX))
           ADYT2PP(IJK)=4+4*(IJK+NX*(MOD(IY,NY)-IY+1)-1)
           ADZT2PP(IJK)=4+4*(IJK+NX*NY*(MOD(IZ,NZ)-IZ+1)-1)
           ADXT4PP(IJK)=4+4*(IJK-1)
                       DO 1311 IT=1,NT
           IOU=IX+NX*(IY-1)+NX*NY*(IZ-1)+NX*NY*NZ*(IT-1)
           IPG(IJK,IT)=IOU
           IOUXF(IJK,IT)=IOU+MOD(IX,NX)-IX+1
           IOUYF(IJK,IT)=IOU+NX*(MOD(IY,NY)-IY+1)
           IOUZF(IJK,IT)=IOU+NX*NY*(MOD(IZ,NZ)-IZ+1)
           IOUTF(IJK,IT)=IOU+NX*NY*NZ*(MOD(IT,NT)-IT+1)
1311       CONTINUE
129                      CONTINUE
    
    
    
      DO 4 IT = 1, NT
      do 3 iz=1,nz
      do 3 iy=1,ny
      do 3 ix=1,nx
      do 3 id=1,4
c       print *,id,ix,iy,iz,it
      xnorm=1./sqrt(float(id**2+ix**2+iy**2+iz**2))
      iou= id+4*(ix-1)+4*nx*(iy-1)+4*nx*ny*(iz-1)
      pruvv(1,iou)= it*(ix+(0.,1.)*iy)*cexp(xnorm*(0.,1.)*(ix+id))
      pruvv(2,iou)= it**2*(ix-(0.,1.)*iy)*cexp(xnorm*(0.,1.)*(iy-id))
      pruvv(3,iou)= it**3*iz*cexp(xnorm*(0.,1.)*iz)
      pruvv(4,iou)= ix*cexp(xnorm*(0.,1.)*(iy+id))
      pruvv(5,iou)= iy*cexp(xnorm*(0.,1.)*(ix-id))
      pruvv(6,iou)= 1./iz*cexp(-xnorm*(0.,1.)*iz/float(id))
      call norma(pruvv(1,iou),9,1)
c      iou= 4+4*(ix-1)+4*nx*(iy-1)+4*nx*ny*(iz-1)
c      do 5 j=1,9
c      pruvv(j,iou)=0.
c5     continue
c      pruvv(1,iou)=1.
c      pruvv(5,iou)=1.
c      pruvv(9,iou)=1.
3     continue
 
      write(6,*) '1 ------'
      write(6,*) (pruvv(j,1),j=1,9)
      write(6,*) '23 ------'
       iqq1=2+5*4
      write(6,*) (pruvv(j,iqq1),j=1,9)
      write(6,*) '47 ------'
      iqq2=3+3*4+4*nx
      write(6,*) (pruvv(j,iqq2),j=1,9)
      write(6,*) '99 ------'
      iqq3=3+3*4*nx+4*nx*ny
      write(6,*) (pruvv(j,iqq3),j=1,9)
      
C      write(LI1FI) ((pruvv(I1,I2),I1=1,6),I2=1,NX34)

C     Break up implied do loop, because SUN FORTRAN seems to
C     fall over if IO list contains more than about 8K of data (DBC)

      DO 10 I2 = 1, NX34
	write(LI1FI) (pruvv(I1,I2),I1=1,6)
 10   CONTINUE

4     continue

       RETURN
       END
    
      SUBROUTINE SCACCHI
      PARAMETER (nx=6,ny=6,nz=6, Nt=6,NVOL=NX*NY*NZ*NT,NLINK=4*NVOL)
      PARAMETER (NVOLP2=2*NVOL ,NLINK2=2*NLINK ,NVOL3=3*NVOL)
      PARAMETER (NX3=NX*NY*NZ,NX34=4*NX3, LI1FI=8)
      PARAMETER (LINKAG=52,ICGAUGE=55,LINKF=57,IGCF=58)
      PARAMETER (NVOL16=NVOL/16,NVOL4=NVOL/4)
      PARAMETER (NVOL8=2*NVOL16 ,NVOL2=4*NVOL8 ,NVO316=3*NVOL16)
      PARAMETER(NX38=NX3/8,NT2=NT/2,NX312=NX3*12,NYNT=NY*NT,NT2P1=NT2+1)
      PARAMETER (NX383=3*NX38,NX384=4*NX38,NX33=NX3*3)
      PARAMETER (LX3=2*NX3,LX38=2*NX38,LX383=2*NX383,NYZ=NY*NZ)
      PARAMETER (MXX=NX/2,MYY=NY/2,MZZ=NZ/2)
      INTEGER X,XTE
      COMMON/LATT/LL(4),LSVO(5),IP(NVOL,4),IM(NVOL,4)
      COMMON/PAR/HK,MINITER,MAXITER,PREC
      COMMON/ICS/X(NVOL16,16),XTE(NX38,8)
    
    
    
    
C            CHESS BOARD X COMPUTATION
    
    
      MX = 1
      MY = 1
      MZ = 1
      MT = 1
    
           ICS=1
    
      DO 70 IST=1,2
      DO 71 ISZ=1,2
      DO 72 ISY=1,2
      DO 73 ISX=1,2
    
      I = 1
    
      DO 79 IT = MT,NT,2
      DO 79 IZ = MZ,NZ,2
      DO 79 IY = MY,NY,2
      DO 79 IX = MX,NX,2
    
      X(I,ICS)=IX + LSVO(2)*(IY-1) + LSVO(3)*(IZ-1) + LSVO(4)*(IT-1)
    
 79   I = I + 1
    
      ICS=ICS+1
    
73    MX=MOD(MX,2)+1
72    MY=MOD(MY,2)+1
71    MZ=MOD(MZ,2)+1
70    MT=MOD(MT,2)+1
    
    
C            CHESS BOARD XTE (T=FIXED) COMPUTATION
    
    
      MX = 1
      MY = 1
      MZ = 1
    
           ICS=1
    
      DO 771 ISZ=1,2
      DO 772 ISY=1,2
      DO 773 ISX=1,2
    
      I = 1
    
      DO 779 IZ = MZ,NZ,2
      DO 779 IY = MY,NY,2
      DO 779 IX = MX,NX,2
    
      XTE(I,ICS)=IX + LSVO(2)*(IY-1) + LSVO(3)*(IZ-1)
    
 779   I = I + 1
    
      ICS=ICS+1
    
773    MX=MOD(MX,2)+1
772    MY=MOD(MY,2)+1
771    MZ=MOD(MZ,2)+1
      RETURN
      END
    

C**********************************************************************
      SUBROUTINE NORMA(U,NDIM,NMATR)
C**********************************************************************
C
C   Normalizza NMATR matrici U, solo le prime 2 righe.
C
      COMPLEX U(NDIM,NMATR)
      COMPLEX W1
C
      DO 100 I=1,NMATR 
      W1=U(4,I)*CONJG(U(1,I)) + U(5,I)*CONJG(U(2,I))
     &    +U(6,I)*CONJG(U(3,I))    
      W2=U(1,I)*CONJG(U(1,I)) + U(2,I)*CONJG(U(2,I))
     &    +U(3,I)*CONJG(U(3,I))    
      W1=-W1/W2     
      U(4,I)=U(4,I)+W1*U(1,I)    
      U(5,I)=U(5,I)+W1*U(2,I)    
      U(6,I)=U(6,I)+W1*U(3,I)    
      W3=U(4,I)*CONJG(U(4,I))+U(5,I)*CONJG(U(5,I))
     &    +U(6,I)*CONJG(U(6,I))
C
C   Ora le prime due righe sono ortogonali. Normalizziamole
C
      W3=1./SQRT(W3)
      W2=1./SQRT(W2)
      U(1,I)=U(1,I)*W2             
      U(2,I)=U(2,I)*W2             
      U(3,I)=U(3,I)*W2             
      U(4,I)=U(4,I)*W3             
      U(5,I)=U(5,I)*W3             
      U(6,I)=U(6,I)*W3             
 100  CONTINUE      
      RETURN        
      END
    
