Skip to content

Commit

Permalink
making allocatable, in the routine sitesym_dis_extract_symmetry (site…
Browse files Browse the repository at this point in the history
…sym.F90), the following variables:

umatnew, ZU, deltaU, carr. This is in direction of issue #439.
  • Loading branch information
mikibonacci committed Feb 15, 2024
1 parent 05bdab5 commit 3ac85d6
Showing 1 changed file with 30 additions and 5 deletions.
35 changes: 30 additions & 5 deletions src/sitesym.F90
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ subroutine sitesym_dis_extract_symmetry(sitesym, lambda, umat, zmat, ik, n, num_
!================================================!

use w90_wannier90_types, only: sitesym_type
use w90_error, only: w90_error_type, set_error_fatal
use w90_error, only: w90_error_type, set_error_fatal, set_error_alloc

implicit none

Expand All @@ -579,15 +579,40 @@ subroutine sitesym_dis_extract_symmetry(sitesym, lambda, umat, zmat, ik, n, num_
complex(kind=dp), intent(inout) :: umat(:, :) !(num_bands, num_wann)

! local variables
complex(kind=dp) :: umatnew(num_bands, num_wann) !jj normally don't we alloc explicitly?
complex(kind=dp) :: ZU(num_bands, num_wann)
complex(kind=dp) :: deltaU(num_bands, num_wann), carr(num_bands)
complex(kind=dp), allocatable :: umatnew(:,:) !(num_bands, num_wann)
complex(kind=dp), allocatable :: ZU(:,:) !(num_bands, num_wann)
complex(kind=dp), allocatable :: deltaU(:,:) !(num_bands, num_wann)
complex(kind=dp), allocatable :: carr(:) !(num_bands)
integer :: i, m, INFO, IFAIL(2), IWORK(5*2)
complex(kind=dp) :: HP(3), SP(3), V(2, 2), CWORK(2*2)
real(kind=dp) :: W(2), RWORK(7*2), sp3
integer :: iter
integer :: iter, ierr
integer, parameter :: niter = 50

allocate (umatnew(num_bands, num_wann), stat=ierr)
if (ierr /= 0) then
call set_error_alloc(error, 'Error in allocating umatnew in sitesym_dis_extract_symmetry', comm)
return
endif

allocate (ZU(num_bands, num_wann), stat=ierr)
if (ierr /= 0) then
call set_error_alloc(error, 'Error in allocating ZU in sitesym_dis_extract_symmetry', comm)
return
endif

allocate (deltaU(num_bands, num_wann), stat=ierr)
if (ierr /= 0) then
call set_error_alloc(error, 'Error in allocating deltaU in sitesym_dis_extract_symmetry', comm)
return
endif

allocate (carr(num_bands), stat=ierr)
if (ierr /= 0) then
call set_error_alloc(error, 'Error in allocating carr in sitesym_dis_extract_symmetry', comm)
return
endif

do iter = 1, niter
! Z*U
call zgemm('N', 'N', n, num_wann, n, cmplx_1, zmat, num_bands, umat, num_bands, cmplx_0, ZU, &
Expand Down

0 comments on commit 3ac85d6

Please sign in to comment.