Skip to content

Commit

Permalink
Merge pull request wannier-developers#146 from stepan-tsirkin/uHuform…
Browse files Browse the repository at this point in the history
…atted-bugfix

bugfix for formatted uHu file read
  • Loading branch information
jryates authored Dec 2, 2017
2 parents b18b9bb + 6539e28 commit a68d704
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
13 changes: 9 additions & 4 deletions src/parameters.F90
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ module w90_parameters
!! Read the wvfn from fortran formatted file
logical, public, save :: spn_formatted
!! Read the spin from fortran formatted file
logical, public, save :: berry_uHu_formatted
logical, public, save :: uHu_formatted
!! Read the uHu from fortran formatted file
integer, public, save :: spin
!! Spin up=1 down=2
Expand Down Expand Up @@ -545,8 +545,8 @@ subroutine param_read ( )
spn_formatted = .false. ! formatted or "binary" file
call param_get_keyword('spn_formatted',found,l_value=spn_formatted)

berry_uHu_formatted = .false. ! formatted or "binary" file
call param_get_keyword('berry_uHu_formatted',found,l_value=berry_uHu_formatted)
uHu_formatted = .false. ! formatted or "binary" file
call param_get_keyword('uhu_formatted',found,l_value=uHu_formatted)

spin=1
call param_get_keyword('spin',found,c_value=spin_str)
Expand Down Expand Up @@ -2613,6 +2613,11 @@ subroutine param_postw90_write
else
write(stdout,'(1x,a46,7x,a11,13x,a1)') '| Spn file-type :','unformatted','|'
endif
if(uHu_formatted) then
write(stdout,'(1x,a46,9x,a9,13x,a1)') '| uHu file-type :','formatted','|'
else
write(stdout,'(1x,a46,7x,a11,13x,a1)') '| uHu file-type :','unformatted','|'
endif
end if

if (size(fermi_energy_list) == 1) then
Expand Down Expand Up @@ -5428,7 +5433,7 @@ subroutine param_dist
call comms_bcast(length_unit,1)
call comms_bcast(wvfn_formatted,1)
call comms_bcast(spn_formatted,1)
call comms_bcast(berry_uHu_formatted,1)
call comms_bcast(uHu_formatted,1)
call comms_bcast(spin,1)
call comms_bcast(num_dump_cycles,1)
call comms_bcast(num_print_cycles,1)
Expand Down
8 changes: 4 additions & 4 deletions src/postw90/get_oper.F90
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ subroutine get_CC_R
use w90_parameters, only : num_kpts,nntot,nnlist,num_wann,&
num_bands,ndimwin,wb,bk,&
have_disentangled,timing_level,&
scissors_shift, berry_uHu_formatted
scissors_shift, uHu_formatted
use w90_postw90_common, only : nrpts,v_matrix
use w90_io, only : stdout,io_error,io_stopwatch,io_file_unit,&
seedname
Expand Down Expand Up @@ -713,7 +713,7 @@ subroutine get_CC_R
enddo

uHu_in=io_file_unit()
if (berry_uHu_formatted) then
if (uHu_formatted) then
open(unit=uHu_in, file=trim(seedname)//".uHu",form='formatted',&
status='old',action='read',err=105)
write(stdout,'(/a)',advance='no')&
Expand Down Expand Up @@ -752,10 +752,10 @@ subroutine get_CC_R
! Read from .uHu file the matrices <u_{q+b1}|H_q|u_{q+b2}>
! between the original ab initio eigenstates
!
if (berry_uHu_formatted) then
if (uHu_formatted) then
do m=1,num_bands
do n=1,num_bands
read(uHu_in,'(2ES20.10)',err=106,end=106) c_real,c_img
read(uHu_in,*,err=106,end=106) c_real,c_img
Ho_qb1_q_qb2(n,m) = cmplx(c_real,c_img,dp)
end do
end do
Expand Down

0 comments on commit a68d704

Please sign in to comment.