********************************************************************************
*                                                                              *
*  2DHF version 1-2003                                                         *
*  Copyright (C) 1996  Jacek Kobus, Leif Laaksonen, Dage Sundholm              *
*                                                                              *
*  This software may be used and distributed according to the terms            *
*  of the GNU General Public License, see README and COPYING.                  *
*                                                                              *
********************************************************************************
c ### printall ###
c
c     This routine can be used to check if input data have been
c     correctly transformed into values of numerous variable used by the
c     program.
c
      subroutine printall
      implicit integer*4 (i-n)
      implicit real*8 (a-h,o-z)
      include 'commons8.inc'
      character*1 str(80)
      equivalence(datetime,str(1))

      call banner

      call  getdatetime(datetime)
      imax=0
      call  clrstring(imax,str)
      write(*,'(1x,80a1)') (str(i),i=1,imax)

c     calculate the total length of working arrays (in bytes)

c     system under consideration

      izz1=nint(z1)
      izz2=nint(z2)
      write(iout6,*) 
      write(iout6,*) '  molecular system: '
      write(iout6,*) 
      write(iout6,1000) element(izz1), z1, element(izz2), z2 ,
     &                  r,r*0.529177249d0

      if     (ifermi.eq.1) then 
         write(iout6,1401) z1atmass,element(izz1),
     &        z2atmass,element(izz2)

      elseif (ifermi.eq.2) then
         write(iout6,1402) z1atmass,element(izz1),
     &        z2atmass,element(izz2)
      endif
         
      write(iout6,*) 
      if (imethod.eq.1) write(iout6,*) '  method: HF'
      if (imethod.eq.2) write(iout6,*) '  method: OED'
      if (imethod.eq.3) write(iout6,1002) alphaf

      if (ifefield.eq.1) write(iout6,1300) ffield

c     its electronic configuration

      write(iout6,*) 
      write(iout6,*) '  electronic configuration:'
      write(iout6,*) 

      nsigma=0
      nsigmag=0
      nsigmau=0
      npi   =0
      ndelta=0
      nphi  =0
      do iorb=1,norb
         if (orbsym(iorb).eq.'sigma') nsigma=nsigma+1
c        if (orbsym(iorb).eq.'sigma g') nsigmag=nsigmag+1
c        if (orbsym(iorb).eq.'sigma u') nsigmau=nsigmau+1
         if (orbsym(iorb).eq.'pi'   ) npi   =npi   +1
         if (orbsym(iorb).eq.'delta') ndelta=ndelta+1
         if (orbsym(iorb).eq.'phi'  ) nphi  =nphi  +1
      enddo

      iorbr=0
      do iorb=1,norb
         if (iorbr.eq.0.and.orbsym(iorb).eq.'sigma') iorbr=nsigma
c        if (iorbr.eq.0.and.orbsym(iorb).eq.'sigma g') iorbr=nsigmag
c        if (iorbr.eq.0.and.orbsym(iorb).eq.'sigma u') iorbr=nsigmau
         if (iorbr.eq.0.and.orbsym(iorb).eq.'pi') iorbr=npi
         if (iorbr.eq.0.and.orbsym(iorb).eq.'delta') iorbr=ndelta
         if (iorbr.eq.0.and.orbsym(iorb).eq.'phi') iorbr=nphi
         nspins=4
         if (orbsym(iorb).eq.'sigma') nspins=2
         iput=4*(iorb-1)
         write(iout6,1020) iorbr, orbsym(iorb),gut(iorb),
     &        (spin(i+iput),i=1,nspins)  
         iorbr=iorbr-1
      enddo

c     number of electrons and total charge

      write(iout6,*) 
      write(iout6,1010) nel, izz1+izz2-nel

      if (ini.eq.1.or.ini.eq.4) then
         write(iout6,*) 
         write(iout6,*) '  LCAO via hydrogenic functions:'
         write(iout6,*) 
         write(iout6,1030)
         
         iorbr=0
         do iorb=1,norb
            if (iorbr.eq.0.and.orbsym(iorb).eq.'sigma') iorbr=nsigma
            if (iorbr.eq.0.and.orbsym(iorb).eq.'pi') iorbr=npi
            if (iorbr.eq.0.and.orbsym(iorb).eq.'delta') iorbr=ndelta
            if (iorbr.eq.0.and.orbsym(iorb).eq.'phi') iorbr=nphi
            
            iput=4*(iorb-1)
            write(iout6,1032) iorbr, orbsym(iorb),gut(iorb),
     &           mgx(1,iorb),mgx(2,iorb),
     &           eza1(iorb),co1(iorb),
     &           mgx(4,iorb),mgx(5,iorb),
     &           eza2(iorb),co2(iorb)
            iorbr=iorbr-1
         enddo
      endif

      write(iout6,*) 
      write(iout6,*) '  grid:'
      if (ngrids.eq.1) then
         write(iout6,1040) nni,hni,nmu(ngrids),hmu(ngrids),
     &        rinf 
      else
         write(iout6,1042) nni,hni,mxnmu,rinf 
         write(iout6,*)
         write(iout6,*) '     subgrid   nni   nmu    hni      hmu',
     &        '      rb     heta     hxib     hxie'
         rinf=r*vxi(iemu(ngrids))/2.d0
         heta=abs(veta(nni)-veta(nni-1))
         ib=1
         do ig=1,ngrids
            rinfig=r*vxi(iemu(ig))/2.d0
            ie=iemu(ig)
            hxibeg=vxi(ib+1)-vxi(ib)
            hxiend=vxi(ie)-vxi(ie-1)
            write(iout6,1045) ig,nni,nmu(ig),hni,hmu(ig),rinfig,
     &           heta,hxibeg,hxiend
            ib=ie
         enddo
      endif

      write(iout6,*) 
      write(iout6,*) '  scf:'
      if (abs(facmul).lt.100.d0) then
         write(iout6,1049) maxscf,nobckup,ienterm,inoterm,facmul
      else
         write(iout6,1050) maxscf,nobckup,ienterm,inoterm,facmul
      endif

      write(iout6,*) 
      if       (exlorb.eq.0.d0) then
         write (iout6,1051) 
      else
         write (iout6,1052) 
      endif
      if       (exlcoul.eq.0.d0) then
         write (iout6,1053)
      else
         write (iout6,1054)
      endif
      if (imethod.eq.1) then
         if     (exlexp.eq.0.d0) then
            write (iout6,1055) 
         elseif (exlexp.eq.2.d0) then
            write (iout6,1056)
         else
            write (iout6,1057) 
         endif
      endif

      write(iout6,*) 
      write(iout6,*) '  (mc)sor:'

      if     (ipoiss.eq.1) then
         write(iout6,*) '         SOR method used for relaxing ',
     &        'orbitals and potentials'  
      elseif (ipoiss.eq.2) then
         write(iout6,*) '         MCSOR method used for relaxing ',
     &        'orbitals and potentials'  
      elseif (ipoiss.eq.3) then
         write(iout6,*) '         SOR method used for relaxing ',
     &        'orbitals and MCSOR for potentials'     
      endif


      write(iout6,*) 
c      write(iout6,1060) maxsor2, maxsor1
      write(iout6,1060) maxsor2, maxsor2/lsor
      
      write(iout6,*) 
      if (ngrids.eq.1) then
         ior=iorder(ngrids)
         if (ior.eq.1) write(iout6,1071)
         if (ior.eq.2) write(iout6,1072)
         if (ior.eq.3) write(iout6,1073)
         if (ior.eq.4) write(iout6,1074)
      else
         do ig=1,ngrids
            ior=iorder(ig)
            if (ior.eq.1) write(iout6,1081) ig
            if (ior.eq.2) write(iout6,1082) ig
            if (ior.eq.3) write(iout6,1083) ig
            if (ior.eq.4) write(iout6,1084) ig
         enddo
      endif

      write(iout6,*) 
      write(iout6,1090)
      do ig=1,ngrids
         write(iout6,1092) ig,ovforb(ig),ovfcoul(ig),ovfexch(ig)
      enddo
      
      if (alphaf.ne.0.d0) then
         write(iout6,*) 
         write(iout6,1100) alphaf, sltthr
      endif

      if (iplot.eq.1) then
         write(iout6,*) 
         write(iout6,1105)
      elseif (iplot.eq.2) then
         write(iout6,*) 
         write(iout6,1106)
      endif

      if (ifermi.eq.1) call fermi(1)

      write(iout6,*) 
      write(iout6,1110)

c     Text segment of the program has about 3.2MB.
      
c     The amount of 'statically' allocated memeory (i.e. for a given choice
c     of $MAXMU and $MAXNI values) is primarily due to common block FOCKPOT 
c     and several other arrays depending on the current value of $MAXMU and 
c     $MAXNI. 

      length0=8*(2*maxfock+26*maxmu+32*maxni+1800*maxorb+
     &     66*maxnpbasis+100000)
      lengtht=8*(length1+length2+length3+length4+length5)+
     &          4*(length6)

      if (imethod.eq.2.or.imethod.eq.3) then
         nexch=1 
      endif

      write(*,1200) length0/1048576.0,lengtht/1048576.0

c     write(*,1202) 2*maxfock*8/1.0e6 
      
      mm3=2*norb*mxsize+nexch*mxsize
      if (idbg(550).ne.0) mm3=3*mxsize
      write(*,1210) norb,norb,nexch,i1e(norb),i1e(norb)*8/1.e6,
     &     i2e(norb),i2e(norb)*8/1.e6,
     &     nexch*mxsize,nexch*mxsize*8/1.e6,mm3,mm3*8/1.e6
      write(*,'("//////////////////////////////////////////////",
     &     "//////////////////////////////////")')

 1000 format(10x,a2,'(',f5.2,')',3x,a2,' (',f5.2,')',
     &     3x,'R =',f9.5,' bohr =',f8.5,' angstroms')
 1401 format(/3x,'finite nuclei (Fermi nuclear charge distribution):',
     &     /10x,'atomic masses:', f7.1,
     &     ' ( ',a2,')',f7.1,' ( ',a2,')')
 1402 format(/3x,'finite nuclei (Gauss nuclear charge distribution):',
     &     /10x,'atomic masses:', f7.1,
     &     ' ( ',a2,')',f7.1,' ( ',a2,')')
 1002 format(10x,'method: HFS (alpha = ',f4.2,')')
 1010 format(10x,'number of electrons =',i5/
     &     10x,'total charge        =',i5 )
 1020 format(10x,i2,2x,a8,a1,2x,4a2)
 1030 format(10x,' orbital           n1 l1   Z1    c1',
     &     '       n2 l2   Z2    c2 '/)
 1032 format(10x,i2,2x,a8,a1,5x,2i3,2f6.2,5x,2i3,2f6.2)
 1040 format(10x,'nu (h_nu) ',i6,'    (',f7.5,')'/
     &     10x,'mu (h_mu) ',i6,'    (',f7.5,')'/,
     &     10x,'R_infinity   ',f6.2)
 1042 format(10x,'nu (h_nu) ',i6,'    (',f7.5,')'/
     &     10x,'mu (h_mu) ',i6,'              '/,
     &     10x,'R_infinity   ',f6.2)
 1045 format(10x,i2,3x,i4,2x,i4,2f9.5,f8.3,3f9.5)
 1049 format(10x,'maxscf  =',i5/
     &     10x,'nobckup =',i5/
     &     10x,'ienterm =',i5/
     &     10x,'inoterm =',i5/
     &     10x,'facmul  =',f8.2)
 1050 format(10x,'maxscf  =',i5/
     &     10x,'nobckup =',i5/
     &     10x,'ienterm =',i5/
     &     10x,'inoterm =',i5/
     &     10x,'facmul  =',d8.1)
 1051 format(10x,'orbitals are relaxed')
 1052 format(10x,'orbitals are kept frozen')
 1053 format(/10x,'Coulomb potentials are relaxed')
 1054 format(/10x,'Coulomb potentials are kept frozen')
 1055 format(/10x,'the exchange potential for each pair ',
     &     'of orbitals is relaxed',/10x,'each time any ',
     &     'of the oritals is updated')
 1056 format(/10x,'exchange potential for each pair of orbitals is',
     &     ' relaxed only'/10x,'once per single scf ',
     &     'iteration (default)')
 1057 format(/10x,'exchange potentials are kept frozen')
c 1060 format(10x,i2,' (mc)sor iterations on a (sub)grid without',
c     &     ' boundary values',/,10x,'being updated (default 10)',
c     &     //10x,i2,' iteration(s) of the group of (mc)sor iterations',
c     &     ' (as defined above);'/10x,'between these iterations boundary ',
c     &     'values are recalculated')

 1060 format(10x,i2,' (mc)sor iterations for orbitals (default 10)',
     &      /10x,i2,' (mc)sor iterations for potentials (default 10)')

 1071 format(10x, 'grid points ordering: natural column-wise')
 1072 format(10x, 'grid points ordering: middle (default)')
 1073 format(10x, 'grid points ordering: natural row-wise')
 1074 format(10x, 'grid points ordering: reversed natural row-wise')
 1081 format(10x, 'ordering of points on subgrid',i3,': ',
     &     ' natural column-wise')
 1082 format(10x,'ordering of points on subgrid',i3,': ',
     &     'middle (default)')
 1083 format(10x, 'ordering of points on subgrid',i3,': ',
     &     ' natural row-wise')
 1084 format(10x, 'ordering of points on subgrid',i3,': ',
     &     ' reverse natural row-wise')
 1090 format(10x, 'overrelaxation parameters:'/13x,
     &     'subgrid      orbitals       potentials ')
 1092 format(13x,2x,i2,10x,f5.3,6x,f5.3,6x,f5.3)
 1100 format(3x,'Xalpha approximation:'/10x,'alpha = ',f4.2,5x/,10x,
     &     'if maximum orbital energy error drops below ',
     &     e7.2,' the full exchange'/10x,'is turned on ',
     &     'and until then exchange potential is not relaxed')
 1105 format(3x,'Plot:'/,10x,'orbital values exported in (x,z) ',
     &     'cartesian coordinates')
 1106 format(3x,'Plot:'/,10x,'orbital values exported in (ni,mu) ',
     &     'prolate spheroidal coordinates')
 1110 format(3x,'memory usage:')
 1200 format(10x,'text                                ',14x,' 0.3 MB '/,
     &     10x,'data                                ',12x,f6.1,' MB'/,
     &     10x,'dynamical allocation                ',12x,f6.1,' MB ')
 1210 format(
     &     /10x,'number of orbitals                    ',i10,
     &     /10x,'number of Coulomb potentials          ',i10,
     &     /10x,'number of exchange potentials         ',i10,
     &     /10x,'orbital array length                  ',i10,'',f6.1,' MB',
     &     /10x,'Coulomb potential array length        ',i10,'',f6.1,' MB',
     &     /10x,'exchange potential array length       ',i10,'',f6.1,' MB',
     &     /10x,'total                                 ',i10,'',f6.1,' MB'//)
 1300 format(11x,'finite electric field: ',f8.5,' au')
      return
      end

