      integer*4 cw_sor  
c      common/dimes/ homolevl,maxgrids,maxmu,maxni,maxorb
c     &              lexchrecl  
      include 'commons8.inc'

c     common/lengths/length1,length2,length3,length4,length5,length6

c  IMPORTANT!

c     The number of subgrids and the maximum grid size are
c     determined by the user before the executable of the program is made.

c     no and nons denote the number of all the orbitals and number 
c     of non sigma type orbitals, respectively. ni and mu correspond to
c     the number of grid points in ni and mu variables.

c     Set these numbers in the parameter line below and relink the program.
c     Remember that 1<=no<=60, 31<=ni<=maxnip and 31<=mu<=maxmup and
c     maxnip and maxmup have to be smaller or equal then their corresponding
c     variables MAXMNI and MAXMU which are used during the instalation 
c     process (see prep_src). 
c
c     Set also the maximun number of subgrids. maxgridsp has to be less 
c     or equal MAXGRIDS variable defined during the installation process 
c     (see prep_src)

c     BF
      parameter (ni=169,mu=193,nop=6,nons=1,ngrid=ni*mu)  

c     TlF
c     parameter (ni=169,mu=193,nop=31,nons=14,ngrid=ni*mu)  
c
c     if iform=1 or 3 set length3p to
c     parameter (length3p=( nop*(nop+1)/2+nons*(nons+1)/2 )*ngrid)	
c
c     if iform=0 or 2 set length3p to
c     cw_exch has to contain at most (nop+nons) functions
c
c     parameter (length3p= (nop+nons)*ngrid)	 
c     
c     if HFS or OED method of calculation is chosen set length3p to

        parameter (length3p= ngrid)	 

c       Upon changing any of the above parameters this routine MUST be
c       recompiled and the program relinked

	parameter (ni8=ni+8,mu8=mu+8,ngrid8=ni8*mu8)    
	parameter (length1p=nop*ngrid,length2p=nop*ngrid)

	parameter (length4p=14*ngrid,length5p=10*ngrid8)	

	parameter (maxgridsp=3)  	 
        parameter (length6p=2*ngrid8+4*ni*(mu+16)+2*maxgridsp*(ni+mu))	  	 

        parameter (lexchreclp=ni*mu*8)

	dimension cw_orb  (length1p), 
     &		  cw_coul (length2p),
     &            cw_exch (length3p), 
     &            cw_suppl(length4p), 
     &		  cw_sctch(length5p),
     &            cw_sor  (length6p)     

        no=nop
        lexchrecl=lexchreclp

	length1=length1p
	length2=length2p
	length3=length3p
	length4=length4p
	length5=length5p
	length6=length6p

c       zeroise array

        call zeroarray (cw_orb,cw_coul,cw_exch,cw_suppl,
     &       cw_sctch,cw_sor)

c       read input data and echo input parameters
c       open input/output files

	call rinputd(idummy1,idummy2,idaummy3,idummy4,idummy5)

c       initialize arrays within common blocks, 
c       initialize arrays of variable length and check input data
c       prepare an environment for poisson's equation solving routines
c       prepare arrays determining ordering of mesh points

        call inisuppl (cw_suppl,cw_sor)

c       print out data defining the case

        call printall

c       initialize orbitals, Coulomb and exchange potentials

        call inifun (cw_orb,cw_coul,cw_exch,cw_suppl,cw_sctch)

c  perform scf

        call scf (cw_sor,cw_orb,cw_coul,cw_exch,cw_suppl,cw_sctch)




