      subroutine clusiz (icomp,cel,cosi,itotat,dmax,alatom,iortho,t,lv, CLUS001
     &iatom,nexp,imult,iucell,ucell,incel,iclust,ialdim,istor,iat,
     &ialsym)                                                           CLUS002
c ----------------------------------------------------------------------CLUS003
c     This program module is part of the author's X-ray Library         CLUS004
c     and may not be sold or reproduced for commercial purposes.        CLUS005
c     Although it has been tested carefully, there is no warranty       CLUS006
c     regarding accuracy or freedom from side-effects.                  CLUS007
c                   (C) 1986-1994 Bernhard Rupp                         CLUS008
c ----------------------------------------------------------------------CLUS009
c     CLUSIZ computes number of expansion cycles, cluster size, atoms   CLUS010
c     to be calculated, and prints computing statistics                 CLUS011
c ----------------------------------------------------------------------CLUS012
                                                                        CLUS013
      character lv,icomp*4
      integer*2 ialsym(iclust*10,4)                                     SEXI120
      dimension t(3,3),ucell(istor,incel),imult(iat)                        CLUS015
      dimension alatom(iclust*10,ialdim)                                CLUS016
                                                                        CLUS017
      xmax=t(1,1)                                                       CLUS018
      ymax=t(2,1)                                                       CLUS019
      zmax=t(3,1)                                                       CLUS020
                                                                        CLUS021
      xymax=t(1,2)                                                      CLUS022
      yymax=t(2,2)                                                      CLUS023
      zymax=t(3,2)                                                      CLUS024
                                                                        CLUS025
      if (xymax.gt.xmax) xmax=xymax                                     CLUS026
      if (yymax.gt.ymax) ymax=yymax                                     CLUS027
      if (zymax.gt.zmax) zmax=zymax                                     CLUS028
                                                                        CLUS029
      xzmax=t(1,3)                                                      CLUS030
      yzmax=t(2,3)                                                      CLUS031
      zzmax=t(3,3)                                                      CLUS032
                                                                        CLUS033
      if (xzmax.gt.xmax) xmax=xzmax                                     CLUS034
      if (yzmax.gt.ymax) ymax=yzmax                                     CLUS035
      if (zzmax.gt.zmax) zmax=zzmax                                     CLUS036
      xyzmin=xmax                                                       CLUS037
      if (ymax.lt.xyzmin) xyzmin=ymax                                   CLUS038
      if (zmax.lt.xyzmin) xyzmin=zmax                                   CLUS039
                                                                        CLUS040
      nexp=int(dmax/xyzmin)+1                                           CLUS041
      iexpan=(2*nexp+1)**3                                              CLUS042
                                                                        CLUS043
      iucell=0                                                          CLUS044
      do 0001 i=1,iatom                                                 CLUS045
              iucell=iucell+imult(i)                                    CLUS046
 0001 continue                                                          CLUS047
                                                                        CLUS048
c --- set print flag                                                    CLUS049
      iprint=1                                                          CLUS050
      if (iprint.eq.1) then                                             CLUS051
      do 0002 ipr=6,7                                                   CLUS052
      call frames (ipr,1,icomp)                                         CLUS053
      write(ipr,'(1x,a1,1x,a,50x,a1)')lv,'Computational Statistics  ',lvCLUS054
      call frames (ipr,2,icomp)                                         CLUS055
      write(ipr,'(1x,a1,1x,a,3 f9.4, 4x,a1)')lv,'Cell dimensions reducedCLUS056
     & to cartesian X,Y,Z : ',xmax,ymax,zmax,lv                         CLUS057
      write(ipr,'(1x,a1,1x,a,i2,9x,a1)')lv,'Number of unit cell cluster CLUS058
     &expansion cycles needed :            ',nexp,lv                    CLUS059
      write(ipr,'(1x,a1,1x,a,i4, 9x,a1)')lv,'Number of unit cells in expCLUS060
     &anded cluster :                     ',iexpan,lv                   CLUS061
      write(ipr,'(1x,a1,1x,a,i5, 9x,a1)')lv,'Number of non equivalent atCLUS062
     &oms in asymmetric unit (motif) :   ',iatom,lv                     CLUS063
      write(ipr,'(1x,a1,1x,a,i6, 9x,a1)')lv,'Total number of atoms in unCLUS064
     &it cell :                         ',iucell,lv                     CLUS065
      write(ipr,'(1x,a1,1x,a,i8, 9x,a1)')lv,'Total number of atoms in exCLUS066
     &panded unit cell cluster :      ',iucell*iexpan,lv                CLUS067
                                                                        CLUS068
c --- now do the actual calculation of search radius and store all atomsCLUS069
c     in array alatom(iclust*10,ialdim)                                 CLUS070
      call cluster(iatom,cel,cosi,itotat,dmax,alatom,iortho,t,radius,   CLUS071
     &   nexp,ucell,incel,imult,iucell,istor,iat,iclust,ialdim,ialsym)     CLUS072
                                                                        CLUS073
      write(ipr,'(1x,a1,1x,a,f8.3,9x,a1)')lv,'Size of search radius arouCLUS074
     &nd unit cell center       :      ',radius,lv                      CLUS075
      write(ipr,'(1x,a1,1x,a,i8, 9x,a1)')lv,'Actual number of atoms in eCLUS076
     &xpanded unit cell cluster :     ',itotat,lv                       CLUS077
      call frames (ipr,3,icomp)                                         CLUS078
                                                                        CLUS079
 0002 continue                                                          CLUS080
      end if                                                            CLUS081
                                                                        CLUS082
c      print*,'ucell follows'                                           CLUS083
c      do 8802 i=1,iucell                                               CLUS084
c         print*,(ucell(i,j),j=1,3)                                     CLUS085
c 8802 continue                                                         CLUS086
c      pause                                                            CLUS087
                                                                        CLUS088
      return                                                            CLUS089
      end                                                               CLUS090
