anchor.diff:      end do
       !ij = 0
   do ii = 1, num_T_para 
  -    write(cha,'(i2)') ii
  +    write(cha,*) ii
       open(unit = ii+20, file = 'energy'//adjustl(trim(cha))//'.out' ) 
  +    open( unit = ii+120, file = 'lattice'//adjustl(trim(cha))//'.out' )
       write(*,*) num_T_para-ii
       Tc = T_para(ii)*J_H
       beta = 1/Tc
  
positive.code: 
      end do
      close(ii+20)
  end do
  !energy = energy/aver_num
  !open(18,file = 'energy.out')
  
negative.code:         end if
          d = dd
          !write(*,*) i/(num_MC/100)
          !if (ii == num_T_para .AND. i > num_MC-aver_num*N ) then
          if ( i > num_MC-aver_num*N ) then
              if ( mod(i+aver_num*N-num_MC, N) == 0 ) then
                  !energy = energy+V
                  !ij = ij+1
                  !write(13,*) ij
                  do j = 1, N
                      write(ii+120,*) theta(d,j), fai(d,j)
                  end do
              end if
          end if
  