c c c Hydrogen-like functions c c c

Hydrogen-like functions

This little program produces values of hydrogen-like functions c
       Character * 80 allstr(20),allnam(20), anlz, funcfile
c
779    format( '# produces hydrogen radial functions')
       write(*,779) 
       write(*,778) 
778    format('# Give the power of X**ifunc * hydrad(n,l,x)')
       read(*,*) ifunc
       write(*,777) ifunc
775    format('# Give the  Z value of the nucleus')
       write(*,775)
       read(*,*) Z
c
       write(allstr(1),'(f3.1,a)') z,'hyd10.d'
       write(allstr(2),'(f3.1,a)') z,'hyd20.d' 
       write(allstr(3),'(f3.1,a)') z,'hyd21.d' 
       write(allstr(4),'(f3.1,a)') z,'hyd30.d' 
       write(allstr(5),'(f3.1,a)') z,'hyd31.d' 
       write(allstr(6),'(f3.1,a)') z,'hyd32.d' 
       write(allstr(7),'(f3.1,a)') z,'hyd40.d'
       write(allstr(8),'(f3.1,a)') z,'hyd41.d'
       write(allstr(9),'(f3.1,a)') z,'hyd42.d'
       write(allstr(10),'(f3.1,a)') z,'hyd43.d'
       write(allstr(11),'(f3.1,a))') z,'pot.hyd'
       if (z.gt.9.999) then
       write(allstr(1),'(f4.1,a))') z,'hyd10.d'
       write(allstr(2),'(f4.1,a))') z,'hyd20.d'
       write(allstr(3),'(f4.1,a))') z,'hyd21.d'
       write(allstr(4),'(f4.1,a))') z,'hyd30.d'
       write(allstr(5),'(f4.1,a))') z,'hyd31.d'
       write(allstr(6),'(f4.1,a))') z,'hyd32.d'
       write(allstr(7),'(f4.1,a))') z,'hyd40.d'
       write(allstr(8),'(f4.1,a))') z,'hyd41.d'
       write(allstr(9),'(f4.1,a))') z,'hyd42.d'
       write(allstr(10),'(f4.1,a))') z,'hyd43.d'
       write(allstr(11),'(f4.1,a))') z,'pot.hyd'
       endif
777    format('#  Hydrogenic functions  r**',i2,' * R(n,l,r) z,')
776    format('#  n=',i2,' l=',i2,' Z=', f4.2)
c
       open(14,file=allstr(11))
       write(14,879) Z
879    format('#  Hydrogen-like potential for Z=',f5.2)
c       
       do 10 n=1,4
          do 20 ll=1,n
            l=ll-1            
            if(n.eq.1 .and. l.eq.0) write(funcfile,'(A)') allstr(1) 
            if(n.eq.2 .and. l.eq.0) write(funcfile,'(A)') allstr(2) 
            if(n.eq.2 .and. l.eq.1) write(funcfile,'(A)') allstr(3) 
            if(n.eq.3 .and. l.eq.0) write(funcfile,'(A)') allstr(4) 
            if(n.eq.3 .and. l.eq.1) write(funcfile,'(A)') allstr(5) 
            if(n.eq.3 .and. l.eq.2) write(funcfile,'(A)') allstr(6) 
            if(n.eq.4 .and. l.eq.0) write(funcfile,'(A)') allstr(7) 
            if(n.eq.4 .and. l.eq.1) write(funcfile,'(A)') allstr(8) 
            if(n.eq.4 .and. l.eq.2) write(funcfile,'(A)') allstr(9) 
            if(n.eq.4 .and. l.eq.3) write(funcfile,'(A)') allstr(10) 
c
            open(13,file=funcfile)
c
            write(13,777) ifunc
            write(13,776) n,l , Z
            dr = 1.0/Z*float(n)* 10.0/300.0
            do 1 k=1,300
              xx=dr*float(k) 
              yy=Z*sqrt(Z)*hydrad(n,l,xx,Z,ifunc)
              if(ifunc.gt.0) yy= xx**ifunc * yy 
              write(13,*) xx,yy
1           continue
            close(13)
20        continue
          yy=-Z**2/(float(n)*float(n))
          xx=0.0
          write(14,*) xx,yy
          xx=10.0
          write(14,*) xx,yy
          write(14,*)
10     continue
c
c      hydrogen-like potential
c 
       dr = 10.0/300.0
c
       dr = (alog(10.0)+4.0*alog(Z)+5.0 )/(400.0)
        write(14,879) z
            do 9 k=1,400
              xx=exp( -(4.0*alog(Z)+5.0)+dr*float(k)) 
              yy=-Z*2.0/xx
              write(14,*) xx,yy
9           continue
       close(14)
      do 4433 kkk=1,11
          if (z.lt.10.0) then 
             write(*,8978) allstr(kkk)
          else
             write(*,8979) allstr(kkk)
          end if   
4433  continue
8978  format('plot "',A10,'" wi linespoints')   
8979  format('plot "',A11,'" wi linespoints')  
       end
       real function hydrad(n,l,r,Z,ifunc)
       x=r*Z 
       if(n.eq.1 .and. l.eq.0) then 
       ANS=(-2.)/EXP(X)
       endif
       if(n.eq.2 .and. l.eq.0) then 
       ANS=(X-2.)/(2.*EXP(X/2.)*SQRT(2.))
       endif
       if(n.eq.2 .and. l.eq.1) then 
       ANS=(-X)/(2.*EXP(X/2.)*SQRT(6.))
       endif
       if(n.eq.3 .and. l.eq.0) then 
       ANS=(2.*(-2.*X**2+18.*X-27.))/(81.*EXP(X/3.)*SQRT(3.
     . ))
       endif
       if(n.eq.3 .and. l.eq.1) then 
       ANS=(4.*X*(X-6.))/(81.*EXP(X/3.)*SQRT(6.))
       endif
       if(n.eq.3 .and. l.eq.2) then 
       ANS=(-4.*X**2)/(81.*EXP(X/3.)*SQRT(30.))
       endif
       if(n.eq.4 .and. l.eq.0) then 
       ANS=(X**3-24.*X**2+144.*X-192.)/(768.*EXP(X/4.))
       endif
       if(n.eq.4 .and. l.eq.1) then 
       ANS=(X*(-X**2+20.*X-80.))/(256.*EXP(X/4.)*SQRT(15.))
       endif
       if(n.eq.4 .and. l.eq.2) then 
       ANS=(X**2*(X-12.))/(768.*EXP(X/4.)*SQRT(5.))
       endif
       if(n.eq.4 .and. l.eq.3) then 
       ANS=(-X**3)/(768.*EXP(X/4.)*SQRT(35.))
       endif
       hydrad= - ANS
       return
       end