anchor.diff:              do i=1,m%natoms
                   write(55,'(A4, 3F20.14)') syms(m%znum%ind(i)), m%xx%ind(i), m%yy%ind(i), m%zz%ind(i)
               enddo
  -            write(55,*)"-1"; close(55)
           endif
  -    endif ! Use HRMC
  +#endif
   
       call mpi_finalize(mpierr)
   
  
positive.code:             endif
  
          enddo !HRMC do loop
          if(myid.eq.0) then
          write(*,*) "Monte Carlo Finished!"
          endif
  
          ! The hrmc loop finished. Write final data.
          if(myid.eq.0)then
              ! Write to param_resume.in file
              open(unit=53,file=trim(paramfile_restart),form='formatted',status='unknown')
                  write(53,*) '# HRMC parameter file, generated to restart a sim ', trim(jobid(2:))
  
negative.code:                 m%xx%ind(w) = xx_cur
                  m%yy%ind(w) = yy_cur
                  m%zz%ind(w) = zz_cur
                  call random_move(m, w, xx_cur, yy_cur, zz_cur, xx_new, yy_new, zz_new, max_move)
              end do
              ! Update hutches, data for chi2, and chi2/del_chi
              call hutch_move_atom(m, w, xx_new, yy_new, zz_new)
      
              call eam_mc(m, w, xx_cur, yy_cur, zz_cur, xx_new, yy_new, zz_new, te2)
              te2 = te2/m%natoms
  
              ! Calculate a randnum for accept/reject
              randnum = ran2(iseed2)
  
              call fem_update(m, w, res, k, vk, v_background, scatfact_e, mpi_comm_world, istat, square_pixel)
  
              chi2_no_energy = chi_square(alpha, vk_exp, vk_exp_err, vk, scale_fac, nk)
              chi2_new = chi2_no_energy + te2
              del_chi = chi2_new - chi2_old
              call mpi_bcast(del_chi, 1, mpi_double, 0, mpi_comm_world, mpierr)
  
  