Line data Source code
1 : c************************c
2 : c routine to write the c
3 : c composite overlaps c
4 : c************************c
5 : module m_wann_gwf_write_mmnk
6 : use m_juDFT
7 : contains
8 0 : subroutine wann_gwf_write_mmnk(mmnk_filename,
9 : > nkpts,nntot,
10 0 : > nbnd,bpt,gb,mmnk,l_unformat)
11 :
12 : implicit none
13 : character(len=*),intent(in) :: mmnk_filename
14 : integer, intent(in) :: nkpts,nntot,nbnd
15 : integer, intent(in) :: bpt(nntot,nkpts),gb(4,nntot,nkpts)
16 : complex, intent(inout) :: mmnk(nbnd,nbnd,nntot,nkpts)
17 : logical, intent(in) :: l_unformat
18 :
19 : integer :: ikpt,i,j
20 : integer :: ikpt_b
21 :
22 0 : call timestart("wann_gwf_write_mmnk")
23 :
24 0 : if(.not.l_unformat)then
25 :
26 0 : open (305,file=trim(mmnk_filename)//'.mmn')
27 0 : write (305,*) 'Overlaps at neighboring (k,q)-points'
28 0 : write (305,'(i5,i7,i5)') nbnd,nkpts,nntot
29 0 : do ikpt = 1,nkpts
30 0 : do ikpt_b = 1,nntot
31 0 : write (305,'(i7,i7,3x,4i4)') ikpt,bpt(ikpt_b,ikpt),
32 0 : & gb(1:4,ikpt_b,ikpt)
33 0 : do i = 1,nbnd
34 0 : do j = 1,nbnd
35 : write (305,'(2f24.18)')
36 0 : & real(mmnk(j,i,ikpt_b,ikpt)),-aimag(mmnk(j,i,ikpt_b,ikpt))
37 : enddo
38 : enddo
39 : enddo
40 : enddo !ikpt
41 0 : close (305)
42 :
43 : else
44 :
45 0 : open(305,file=trim(mmnk_filename)//'.mmn',form='unformatted')
46 0 : write(305) nbnd,nkpts,nntot
47 0 : do ikpt = 1,nkpts
48 0 : do ikpt_b = 1,nntot
49 0 : write (305) ikpt,bpt(ikpt_b,ikpt),
50 0 : & gb(1:4,ikpt_b,ikpt)
51 0 : write (305) ((conjg(mmnk(j,i,ikpt_b,ikpt)),
52 0 : & j=1,nbnd),i=1,nbnd)
53 : enddo
54 : enddo !ikpt
55 0 : close (305)
56 :
57 : endif !l_unformat
58 :
59 :
60 0 : call timestop("wann_gwf_write_mmnk")
61 0 : end subroutine wann_gwf_write_mmnk
62 :
63 : end module m_wann_gwf_write_mmnk
|