      FUNCTION potts_act2l(nlink,ha) ! Bernd Berg Oct 3 2006.
C Calculation of the mean action variable per link squared from 
C its histogram. Usefull for calculation of the specific heat.
      include '../ForLib/implicit.sta'
      include '../ForLib/constants.par'
      dimension ha(0:nlink)
      factor=one/nlink
      potts_act2l=0
      hsum=0
      do ilink=0,nlink
        potts_act2l=potts_act2l+(factor*ilink)**2*ha(ilink)
        hsum=hsum+ha(ilink)
      end do
      potts_act2l=potts_act2l/hsum ! (iact per link)**2.
      return
      end
