mirror of https://gitlab.com/QEF/q-e.git
pw2wannier90: Cleanup SCDM
This commit is contained in:
parent
c824589e20
commit
e77f20633e
|
@ -3772,18 +3772,16 @@ SUBROUTINE compute_amn_with_scdm
|
||||||
USE mp_pools, ONLY : intra_pool_comm, inter_pool_comm, my_pool_id, &
|
USE mp_pools, ONLY : intra_pool_comm, inter_pool_comm, my_pool_id, &
|
||||||
me_pool, root_pool
|
me_pool, root_pool
|
||||||
USE wvfct, ONLY : nbnd, et, npwx
|
USE wvfct, ONLY : nbnd, et, npwx
|
||||||
USE gvecw, ONLY : gcutw
|
|
||||||
USE control_flags, ONLY : gamma_only
|
USE control_flags, ONLY : gamma_only
|
||||||
USE wavefunctions, ONLY : evc, psic, psic_nc
|
USE wavefunctions, ONLY : evc, psic, psic_nc
|
||||||
USE io_files, ONLY : nwordwfc, iunwfc
|
USE io_files, ONLY : nwordwfc, iunwfc
|
||||||
USE wannier
|
USE wannier
|
||||||
USE klist, ONLY : nkstot, xk, ngk, igk_k, nks
|
USE klist, ONLY : nkstot, xk, ngk, igk_k, nks
|
||||||
USE gvect, ONLY : g, ngm, mill
|
USE gvect, ONLY : g, mill
|
||||||
USE fft_base, ONLY : dffts
|
USE fft_base, ONLY : dffts
|
||||||
USE scatter_mod, ONLY : gather_grid
|
USE scatter_mod, ONLY : gather_grid
|
||||||
USE fft_interfaces, ONLY : invfft
|
USE fft_interfaces, ONLY : invfft
|
||||||
USE noncollin_module,ONLY : noncolin, npol
|
USE noncollin_module,ONLY : noncolin, npol
|
||||||
USE fft_types, ONLY : fft_index_to_3d
|
|
||||||
USE cell_base, ONLY : at
|
USE cell_base, ONLY : at
|
||||||
USE ions_base, ONLY : ntyp => nsp, tau
|
USE ions_base, ONLY : ntyp => nsp, tau
|
||||||
USE uspp, ONLY : okvan
|
USE uspp, ONLY : okvan
|
||||||
|
@ -3791,23 +3789,25 @@ SUBROUTINE compute_amn_with_scdm
|
||||||
!
|
!
|
||||||
IMPLICIT NONE
|
IMPLICIT NONE
|
||||||
!
|
!
|
||||||
LOGICAL :: offrange
|
INTEGER :: ik, npw, ibnd, iw, nrtot, info, lcwork, locibnd, ib, gamma_idx, &
|
||||||
COMPLEX(DP), ALLOCATABLE :: phase(:), nowfc(:,:), psi_gamma(:,:), &
|
minmn, minmn2, ig, ipool_gamma, ik_gamma_loc, i, j, k, ik_g_w90, &
|
||||||
qr_tau(:), cwork(:), cwork2(:), Umat(:,:), VTmat(:,:), Amat(:,:) ! vv: complex arrays for the SVD factorization
|
nxxs, count_piv_spin_up
|
||||||
COMPLEX(DP), ALLOCATABLE :: phase_g(:,:) ! jml
|
REAL(DP):: norm_psi, focc, arg, tpi_r_dot_g, xk_cry(3), rpos_cart(3)
|
||||||
REAL(DP), ALLOCATABLE :: rwork(:), rwork2(:), singval(:), rpos(:,:) ! vv: Real array for the QR factorization and SVD
|
COMPLEX(DP) :: tmp_cwork(2)
|
||||||
|
COMPLEX(DP) :: nowfc_tmp
|
||||||
INTEGER, ALLOCATABLE :: piv(:)
|
INTEGER, ALLOCATABLE :: piv(:)
|
||||||
!! vv: Pivot array in the QR factorization
|
!! vv: Pivot array in the QR factorization
|
||||||
INTEGER, ALLOCATABLE :: piv_pos(:)
|
INTEGER, ALLOCATABLE :: piv_pos(:)
|
||||||
!! Position of the pivot points
|
!! Position of the pivot points
|
||||||
INTEGER, ALLOCATABLE :: piv_spin(:)
|
INTEGER, ALLOCATABLE :: piv_spin(:)
|
||||||
!! Spin index of the pivot points. 1 for spin up, 2 for spin down.
|
!! Spin index of the pivot points. 1 for spin up, 2 for spin down.
|
||||||
COMPLEX(DP) :: tmp_cwork(2)
|
REAL(DP), ALLOCATABLE :: rwork(:), rwork2(:), singval(:), rpos(:,:)
|
||||||
COMPLEX(DP) :: nowfc_tmp ! jml
|
!! vv: Real array for the QR factorization and SVD
|
||||||
REAL(DP):: norm_psi, focc, arg, tpi_r_dot_g, xk_cry(3), rpos_cart(3)
|
COMPLEX(DP), ALLOCATABLE :: phase(:), nowfc(:,:), psi_gamma(:,:), &
|
||||||
INTEGER :: ik, npw, ibnd, iw, nrtot, info, lcwork, locibnd, &
|
qr_tau(:), cwork(:), Umat(:,:), VTmat(:,:), Amat(:,:)
|
||||||
ib, gamma_idx, minmn, minmn2, maxmn2, &
|
!! vv: complex arrays for the SVD factorization
|
||||||
ig, ipool_gamma, ik_gamma_loc, i, j, k, ik_g_w90, nxxs, count_piv_spin_up ! jml
|
COMPLEX(DP), ALLOCATABLE :: phase_g(:,:)
|
||||||
|
!! exp(iGr) phase for pivot positions. Used for slow Fourier transformation.
|
||||||
COMPLEX(DP), ALLOCATABLE :: psic_all(:, :)
|
COMPLEX(DP), ALLOCATABLE :: psic_all(:, :)
|
||||||
!
|
!
|
||||||
INTEGER, EXTERNAL :: global_kpoint_index
|
INTEGER, EXTERNAL :: global_kpoint_index
|
||||||
|
@ -3845,13 +3845,12 @@ SUBROUTINE compute_amn_with_scdm
|
||||||
ALLOCATE(rwork(2*npol*nrtot))
|
ALLOCATE(rwork(2*npol*nrtot))
|
||||||
piv(:) = 0
|
piv(:) = 0
|
||||||
rwork(:) = 0.0_DP
|
rwork(:) = 0.0_DP
|
||||||
|
!
|
||||||
ALLOCATE(nowfc(n_wannier,num_bands))
|
ALLOCATE(nowfc(n_wannier,num_bands))
|
||||||
ALLOCATE(psi_gamma(npol*nrtot,num_bands))
|
ALLOCATE(psi_gamma(npol*nrtot,num_bands))
|
||||||
minmn2 = MIN(num_bands,n_wannier)
|
minmn2 = MIN(num_bands,n_wannier)
|
||||||
maxmn2 = MAX(num_bands,n_wannier)
|
|
||||||
ALLOCATE(rwork2(5*minmn2))
|
ALLOCATE(rwork2(5*minmn2))
|
||||||
|
!
|
||||||
ALLOCATE(piv_pos(n_wannier))
|
ALLOCATE(piv_pos(n_wannier))
|
||||||
ALLOCATE(piv_spin(n_wannier))
|
ALLOCATE(piv_spin(n_wannier))
|
||||||
ALLOCATE(rpos(3, n_wannier))
|
ALLOCATE(rpos(3, n_wannier))
|
||||||
|
@ -4105,7 +4104,7 @@ SUBROUTINE compute_amn_with_scdm
|
||||||
! spin collinear
|
! spin collinear
|
||||||
nowfc_tmp = SUM( evc(1:npw, ibnd) * phase_g(1:npw, iw) )
|
nowfc_tmp = SUM( evc(1:npw, ibnd) * phase_g(1:npw, iw) )
|
||||||
ENDIF
|
ENDIF
|
||||||
nowfc(iw,locibnd) = nowfc_tmp * phase(iw) * focc / norm_psi
|
nowfc(iw, locibnd) = nowfc_tmp * phase(iw) * focc / norm_psi
|
||||||
ENDDO
|
ENDDO
|
||||||
!
|
!
|
||||||
ENDDO
|
ENDDO
|
||||||
|
|
Loading…
Reference in New Issue