Obtain possible permutation in ordering of b-vectors at different kpoints
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in) | :: | bvec(:,:,:) | |||
| real(kind=dp), | intent(in) | :: | bref(:,:) | |||
| integer, | intent(in) | :: | num_kpt | |||
| integer, | intent(in) | :: | num_bvec | |||
| integer, | intent(inout) | :: | perm(:,:) | |||
| integer, | intent(inout) | :: | invperm(:,:) | |||
| integer, | intent(inout) | :: | revind(:,:) | |||
| type(w90_error_type), | intent(out), | allocatable | :: | error | ||
| type(w90_comm_type), | intent(in) | :: | comm |
subroutine kmesh_bvectors_perm(bvec, bref, num_kpt, num_bvec, perm, invperm, revind, error, comm) !================================================ ! !! Obtain possible permutation in ordering of b-vectors at different kpoints ! !================================================ implicit none ! arguments real(kind=dp), intent(in) :: bvec(:, :, :) ! set of bvecs for each k, possibly permuted, size (3,num_bvec,num_kpt) real(kind=dp), intent(in) :: bref(:, :) ! reference vector ordering, size (3,num_bvec) integer, intent(in) :: num_kpt, num_bvec integer, intent(inout) :: perm(:, :) ! assumed allocated integer, intent(inout) :: invperm(:, :) ! assumed allocated integer, intent(inout) :: revind(:, :) type(w90_error_type), allocatable, intent(out) :: error type(w90_comm_type), intent(in) :: comm ! local variables real(kind=dp), parameter :: tol = 1d-7 ! this should not be smaller than the k-point precision in the .win file integer :: ik, n, m logical :: found, found2 do ik = 1, num_kpt do n = 1, num_bvec found = .false. found2 = .false. do m = 1, num_bvec if (all(abs(bvec(:, m, ik) - bref(:, n)) < tol)) then found = .true. perm(n, ik) = m invperm(m, ik) = n ! inverse mapping, used in postw90 cycle end if if (all(abs(bvec(:, m, ik) + bref(:, n)) < tol)) then found2 = .true. revind(n, ik) = m cycle end if end do if (.not. found .or. .not. found2) then call set_error_fatal(error, & 'Unable to identify bk-vector permutation (kmesh_bvectors_perm); consider k-point precision', & comm) return end if end do end do end subroutine kmesh_bvectors_perm