default.txt 1020 B

12345678910111213141516171819202122232425262728293031323334353637
  1. BEGIN_PROVIDER [ integer(bit_kind), psi_det_sorted_bit, (N_int,2,psi_det_size) ]
  2. &BEGIN_PROVIDER [ double precision, psi_coef_sorted_bit, (psi_det_size,N_states) ]
  3. implicit none
  4. BEGIN_DOC
  5. ! Determinants on which we apply <i|H|psi> for perturbation.
  6. ! They are sorted by determinants interpreted as integers. Useful
  7. ! to accelerate the search of a random determinant in the wave
  8. ! function.
  9. END_DOC
  10. integer :: i,j,k
  11. integer, allocatable :: iorder(:)
  12. integer*8, allocatable :: bit_tmp(:)
  13. integer*8, external :: det_search_key
  14. allocate ( iorder(N_det), bit_tmp(N_det) )
  15. do i=1,N_det
  16. iorder(i) = i
  17. !DIR$ FORCEINLINE
  18. bit_tmp(i) = det_search_key(psi_det(1,1,i),N_int)
  19. enddo
  20. call isort(bit_tmp,iorder,N_det)
  21. !DIR$ IVDEP
  22. do i=1,N_det
  23. do j=1,N_int
  24. psi_det_sorted_bit(j,1,i) = psi_det(j,1,iorder(i))
  25. psi_det_sorted_bit(j,2,i) = psi_det(j,2,iorder(i))
  26. enddo
  27. do k=1,N_states
  28. psi_coef_sorted_bit(i,k) = psi_coef(iorder(i),k)
  29. enddo
  30. enddo
  31. deallocate(iorder, bit_tmp)
  32. END_PROVIDER