C======= MAIN PROGRAM FOR gamma0 ========
C======= for s-subshell (q=0)=======
C----- for endohedral atoms--
C------in FRPAE and GFRPAE------------
C=======   PHOTO(s-p)*(-1)=d1 
C=======   GOS(s-d)/(2/15)=q2
C===    DEL0 from G00- (s-s)--------
      INTEGER NE, RPAE,LL
      REAL*8 K,D1,D2,LAM,EPHRY(200),EPHEV,
     * GAMMAC,GAMMA,ETA,EELRY(200),
     * DM1(200),GM2(200),GAMMA1(200),
     * ETA1(200),GAMMAIN,ETAIN,
     * RE1(200),IM1(200),
     * RE2(200),IM2(200),
     * DEL1(200),DEL2(200),DEL0(200),
     * AM1(200),AM2(200),PH1(200),PH2(200),
     * GD(200),FD(200)

C----------------------
      NAMELIST/GAMFUL0/NE,LL,RPAE,LAM,
     *  EELRY,DEL1,DEL2,DEL0,RE1,RE2,IM1,IM2,
     *  AM1,AM2,PH1,PH2,GD,FD

      OPEN(5,FILE='SYS$INPU',STATUS='OLD')
      READ(5,GAMFUL0)
      OPEN(6,FILE='SYS$OUTP',STATUS='NEW')
C-------LL=0--------------------------------
      IF(LL.EQ.0)THEN
	IF(RPAE.EQ.1)THEN
        WRITE(6,4)
   4    FORMAT('         RPAE with reflection ')
        ELSE
        WRITE(6,5)
   5    FORMAT('          HF with reflection ')
        END IF
	IF(GD(1).NE.1)THEN
        WRITE(6,6)
   6    FORMAT('           with polarization ')
        END IF
      WRITE(6,11)                        
  11  FORMAT(' ANGULAR ANIZOTROPY PARAMETERS L=0, q=0'/
     *   '  EPHRy',7X,'RE1',7X,'IM1',7X,'DEL1',
     *   7X,'RE2',7X,'IM2',7X,'DEL2')                 
      DO 15 I=1,NE
       EPHRY(I)=EELRY(I)+LAM
      WRITE(6,20)EPHRY(I),RE1(I),IM1(I),DEL1(I),
     *           RE2(I),IM2(I),DEl2(I)
  20  FORMAT(7F10.4)  
  15  CONTINUE
       WRITE(6,12)                        
  12  FORMAT('  F-factor and its argument '/         
     * '    EPHRy',7X,'AM1',7X,'PH1',7X,'AM2',7X,'PH2')                 
      DO 13 I=1,NE
      WRITE(6,14)EPHRY(I),AM1(I),PH1(I),AM2(I),PH2(I)
  14  FORMAT(5F10.4)       
  13  CONTINUE 
       WRITE(6,16)                        
  16  FORMAT('  G-factor and its argument   '/
     *    'No',7X,'EpheV',13X,'Gd',11X,'Fd')                 
      DO 17 I=1,NE
      WRITE(6,18)I,EPHRY(I),GD(I),FD(I)
  18  FORMAT(I4,3E15.8)       
  17  CONTINUE 
      WRITE(6,30)                                                 
  30  FORMAT(6X,'EPHRy',5X,'GAMMAC',10X,'GAMMA(1)',8X,'ETA(1)',
     *           8X,'GAMMAIN',7X,'ETAIN')
      DO 40 I=1,NE
      K=(-6.*15./2.)*EPHRY(I)/137.04/2.
	IF (RPAE.EQ.1) THEN
      GAMMAC=K*AM1(I)*AM2(I)/
     *  (RE1(I)**2+IM1(I)**2)/
     *  AM1(I)/AM1(I)/GD(I)*
     * ((RE2(I)*RE1(I)+IM2(I)*IM1(I))*
     *  COS(DEL2(I)+PH2(I)-DEL1(I)-PH1(I)-FD(I))-
     *  (IM2(I)*RE1(I)-RE2(I)*IM1(I))*
     *  SIN(DEL2(I)+PH2(I)-DEL1(I)-PH1(I)-FD(I)))      
	ELSE
      GAMMAC=K*RE2(I)/RE1(I)*COS(DEL2(I)-DEL1(I))
	END IF
       GAMMA=GAMMAC*137.04*2./5./EPHRY(I)
	       ETA=-GAMMA
        D1=DATAN2(IM1(I),RE1(I))
        D2=DATAN2(IM2(I),RE2(I))
        DEL1(I)=DEL1(I)+D1+PH1(I)+FD(I)
        DEL2(I)=DEL2(I)+D2+PH2(I)
        DEL0(I)=DEL0(I)+D2
        DM1(I)=DSQRT(RE1(I)**2+IM1(I)**2)*AM1(I)
        GM2(I)=DSQRT(RE2(I)**2+IM2(I)**2)*AM2(I)
            GAMMA1(I)=(-15./2.)*6./5.*
     *    GM2(I)/DM1(I)/GD(I)*DCOS(DEL1(I)-DEL2(I))
            ETA1(I)=-GAMMA1(I)
       GAMMAIN=(-15./2.)*2.*GM2(I)/DM1(I)/GD(I)*
     *  (0.8*DCOS(DEL1(I)-DEL2(I))-DCOS(DEL0(I)-DEL1(I)))
       ETAIN=(-15./2.)*2.4*GM2(I)/DM1(I)*DCOS(DEL1(I)-DEL2(I))
      WRITE(6,50) EPHRY(I),GAMMAC,GAMMA,ETA,GAMMAIN,ETAIN
  50  FORMAT(F10.5,5E15.5)
  40  CONTINUE
      WRITE(6,60)                                                 
  60  FORMAT(4X,'EPHRy',6X,'EPHEV',6X,'EELRY',8X,'GAMMA(2)',
     *           8X,'ETA(2)')
      DO 70 I=1,NE
       EPHEV=EPHRY(I)*13.6057
      WRITE(6,80) EPHRY(I),EPHEV,EELRY(I),GAMMA1(I),ETA1(I)
  80  FORMAT(3F10.5,2E15.5)
  70  CONTINUE 
       END IF
      STOP
      END