********************************************************************************
*                                                                              *
*  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 ### inisuppl ###
c
c     Initializes various variables and arrays
c
      subroutine inisuppl (cw_suppl,cw_sor)
      implicit integer*4 (i-n)
      implicit real*8 (a-h,o-z)
      integer*4 cw_sor
      include 'commons8.inc'
      dimension cw_suppl(*),cw_sor(*)

c     initialize arrays within common blocks (except for differentiating 
c     arrays which are defined in prepdiff) and check input data

      call prepfix

c     employ input data to determine size and division of cw arrays
c     initialize address arrays

      call iniaddr

c     initialize arrays of variable length
c
c     i4b(1)=borb
c     i4b(2)=bpot
c     i4b(3)=d
c     i4b(4)=e
c     i4b(5)=f0
c     i4b(6)=f1
c     i4b(7)=f2
c     i4b(8)=f3
c     i4b(9)=f4
c     i4b(10)=g
c     i4b(11)=wjac1
c     i4b(12)=wjac2
c     i4b(13)=wgt1
c     i4b(14)=wgt2

      call prepvar (cw_suppl(i4b( 1)),cw_suppl(i4b( 2)), 
     &              cw_suppl(i4b( 3)),cw_suppl(i4b( 4)), 
     &              cw_suppl(i4b( 5)),cw_suppl(i4b( 6)), 
     &              cw_suppl(i4b( 7)),cw_suppl(i4b( 8)), 
     &              cw_suppl(i4b( 9)),cw_suppl(i4b(10)), 
     &              cw_suppl(i4b(11)),cw_suppl(i4b(12)), 
     &              cw_suppl(i4b(13)),cw_suppl(i4b(14)) )

      call prepdiff (cw_suppl(i4b( 1)),cw_suppl(i4b( 3)))

c     prepare meshes for all subgrids

      call prepmesh (cw_sor)
      
      return
      end
