Using the yambo-4.5.3, I output the DIP_P by adding the following code at the end of the file DIPOLE_driver.F.
Code: Select all
enddo
!
enddo
if (myid==0) then !lyzhao
!~ write dip
open(300,file='YBDIPP.BIN',form='UNFORMATTED',action='WRITE')
write(300) Dip%ib(1),Dip%ib_lim(1),Dip%ib_lim(2),Dip%ib(2)
write(300) DIP_P
close(300)
endif
!
end subroutine DIPOLES_ppredux_and_symmetrize
!
end subroutine
Code: Select all
.......
complex(4), allocatable :: pmat(:,:,:,:,:) ! use single precision, as the same as yambo
integer ib1,ib2,ib3,ib4
.........
if(allocated(pmat)) deallocate(pmat); allocate(pmat(3,nbands,nbands,nkptr,1)); pmat=0.0
open(50,file='YBDIPP.BIN',action='READ',form='UNFORMATTED',status='OLD',iostat=ios)
read(50) ib1,ib2,ib3,ib4
read(50) pmat ! (:,ib,ib,ik,i_spin)
but for the large number of bands (e.g. nbands=200), I got the following error :
At line 70 of file getpmat.f90 (unit = 50, file = 'YBDIPP.BIN')
Fortran runtime error: I/O past end of record on unformatted file
Note that "read(50) ib1,ib2,ib3,ib4" can run correctly for both nbands, error occurs at "read(50) pmat ! (:,ib,ib,ik,i_spin)".
Any help will be appreciated.