      SUBROUTINE POTTS_Z0LN(nq,ns,nlink,namin,ndel_muca,b,ha,hasum,
     &                      Zln_dif)
C Copyright Bernd Berg, May 10 2000.
C Potts model, normalization of the partition function Z at beta=0.
      include 'implicit.sta'
      include 'constants.par'
      dimension b(0:nlink),ha(0:nlink),hasum(0:nlink)
      dimension ndel_muca(0:nlink) ! Eliminate in the final version!
C
      beta=zero
      Z0ln=ns*LOG(ONE*nq)
      if(namin.le.0) stop "POTTS_ZLN: namin false."
      ilink_min=nlink
      iact_next=namin+ndel_muca(namin) ! For test purposes only.
      do ilink=0,nlink
        ha_ilink=hasum(ilink)-ha(ilink) ! Jackknife histogram.
        if(ha_ilink.gt.half) then
          iact=ilink-namin
          if(ilink_min.gt.ilink) then
            ilink_min=ilink
            a=zero
            Zln=log(ha_ilink)+two*(beta-b(ilink))*iact
            Zln1_max=Zln
          else
            if(ilink.eq.namin) a=b(namin)*iact_old
            if(ilink.gt.namin) then
              a=a+(b(ilink)-b(ilink_old))*iact_old
              if(ilink.ne.iact_next) then
                print'(" ilink,_next,has:",2I10,2G15.6)',
     &                   ilink,iact_next,hasum(ilink),ha(ilink)
c               stop "POTTS_Z0LN: iact_next problem."
                if(ilink.eq.nlink) stop "POTTS_Z0LN."
              end if
              iact_next=ilink+ndel_muca(ilink)
            end if
            Zln1=log(ha_ilink)+two*((beta-b(ilink))*iact+a)
            Zln1_max=max(Zln1_max,Zln1)
            Zln=addln(Zln,Zln1)
            iact_old=iact
            ilink_old=ilink
          end if
        end if
      end do
      Zln_dif=Z0ln-Zln
C
      return
      end
