      subroutine sprint(nb)
      implicit none
      include 'pimc.par'
      integer k,l,nb,nsl,intv,kp
      real*8 a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a31,a32,a33,a61,a1a,r2
      real*8 cnorm,a62,sang
      include 'pimc.cm'
c output file (2)
      write (*,1011) int(anorm(1))
      write (2,1011) int(anorm(1))
1011  format ('############## block',i5,' completed ################')
c     write (2,*)
c     if (int(anorm(1)).eq.1) 
c    & write(4,'(2h# ,20(2h ",a10,2h" ))')(qname(i),i=1,naver)
      
      cnorm=max(anorm(1)-1.d0,1.d0)
      a1=dsqrt(max(av(ikin+1),0.d0)/cnorm)
      a2=dsqrt(av(iepot+1)/cnorm)
      a3=dsqrt(av(iepot+3)/cnorm)
      a31=dsqrt(av(iepot+5)/cnorm)
      a32=dsqrt(av(iepot+7)/cnorm)
      a33=dsqrt(av(iepot+9)/cnorm)
      a4=dsqrt(av(ietot+1)/cnorm)
      a5=dsqrt(av(ietot+3)/cnorm)
      a10=dsqrt(av(ietot+5)/cnorm)
      a6=dsqrt(max(av(irg+1)/cnorm,0.d0))
      a61=dsqrt(av(irg+3)/cnorm)
      a62=dsqrt(av(ilind+1)/cnorm)

      if (nalg.eq.2) then

       a7=-dlog(avp(ietot+1))/beta
       a8=-dlog(av(ietot+2))/beta
       a5=a5/av(ietot+2)/beta
       write(2,'(18Hexc. free energy :,3g20.10)')a7,a8,a5

      else

       write(2,'(18Hkinetic energy   :,3g20.10)')avp(ikin),av(ikin),a1
       a9=dsqrt(max(av(iev+1)/cnorm,0.d0))
       if (alpha.ne.0.0) then
        if (ncumtr.eq.0) then
         write(2,'(18Hvirial kin. en.  :,3g20.10)')avp(iev),av(iev),a9
         write(2,'(18Hintram. pot. en. :,3g20.10)')
     &                                   avp(iepot+1),av(iepot+2),a3
         if (np.gt.1) 
     &               write(2,'(18Hinterm. pot. en. :,3g20.10)')
     &                     avp(iepot+2),av(iepot+4),a31
        endif
       endif
       if (charge.ne.0.0.and.np.gt.1) then
        if (alpha.eq.0) 
     &   write(2,'(18Hvirial kin. en.  :,3g20.10)')avp(iev),av(iev),a9
        write(2,'(18Hcoulomb pot. en. :,3g20.10)')
     &                                  avp(iepot+3),av(iepot+6),a32
       endif
       if (ncumtr.eq.0) then
       write(2,'(18Hpotential energy :,3g20.10)')avp(iepot),av(iepot),a2
       write(2,'(18Htotal   energy   :,3g20.10)')avp(ietot),av(ietot),a4
       write(2,'(18Hvir tot energy   :,3g20.10)')
     &                                 avp(ietot+2),av(ietot+4),a10
       elseif(ncumtr.eq.1) then
        write(2,'(18Hexcess action 1  :,3g20.10)')
     &                                   avp(ietot),av(ietot),a4
        write(2,'(18Hexcess action 2  :,3g20.10)')
     &                                   avp(ietot+2),av(ietot+4),a10
       endif
        if(av(irg).ne.0.d0)
     &  write(2,'(18Hgiration radius  :,3g20.10)')dsqrt(avp(irg)),
     &             dsqrt(av(irg)),a6/2/dsqrt(abs(av(irg)))
       if (np.eq.2) 
     &            write(2,'(18Hc.of.m. distance :,3g20.10)')
     &                                 avp(irg+1),av(irg+2),a61

       if (jlindem.ne.0) 
     &            write(2,'(18Hmean square displ:,3g20.10)')
     &            dsqrt(avp(ilind))/rnn,dsqrt(av(ilind))/rnn
     &            ,a62/2.d0/rnn/dsqrt(av(ilind))
      endif

      write(2,'(18Hexcess action    :,3g20.10)')
     &      avp(iepot+4)+costact,av(iepot+8)+costact,a33
      mratio=1.0
      if (ntry.gt.0) mratio = real(nacc) / real(ntry)
      write(2,'(18HAcceptance levy  :,1g20.10)') mratio
      if (gammadsp.gt.0.0) then
       if(ntrydsp.ne.0)mratio = real(naccdsp) / real(ntrydsp)
       write(2,'(18HAcceptance displ :,1g20.10)') mratio
      endif
      call flush(2)

c effective mass file (10)
      k=ieff-1
      intv=2**(level-1)
      nsl=nslices/intv
      do l=1,nsl/2
       k=k+2
       a1=dsqrt(max(av(k)/cnorm,0.d0))
       write(10,'(3g20.10)') l*intv*tau,av(k-1),a1
      enddo
      call flush(10)
      rewind(10)
c g(r) (20) 
!     if (np.gt.1) then
       k=igr-1
       do l=1,lptable
        k=k+2
        if (av(k).lt.0.d0) then
         if (dabs(av(k)).gt.1.d-6) then
          write(*,*) k,av(k-1),av(k)
          stop 'error in error of g(r) (sprint)'
         endif
         av(k)=0.d0
        endif
        a1=dsqrt(av(k)/cnorm)
        write(20,'(3g20.10)') dr*(l-.5d0),av(k-1),a1
       enddo
       call flush(20)
       rewind(20)
!     endif

      return
      end
