Line data Source code
1 : !--------------------------------------------------------------------------------
2 : ! Copyright (c) 2016 Peter Grünberg Institut, Forschungszentrum Jülich, Germany
3 : ! This file is part of FLEUR and available as free software under the conditions
4 : ! of the MIT license as expressed in the LICENSE file in more detail.
5 : !--------------------------------------------------------------------------------
6 :
7 : module m_wann_readcenters
8 : use m_juDFT
9 : contains
10 0 : subroutine wann_readcenters(
11 : > nwfs,jspin,
12 0 : < centers,spreads)
13 : c******************************************************
14 : c Read the centers and spreads (optional) from the
15 : c file "WF"jspin".1"
16 : c Frank Freimuth
17 : c******************************************************
18 : implicit none
19 : integer,intent(in) :: nwfs,jspin
20 : real,intent(out) :: centers(3,nwfs)
21 : real,intent(out),optional :: spreads(nwfs)
22 :
23 : logical :: l_readspread
24 : character(len=3) :: spin12(2)
25 : data spin12/'WF1','WF2'/
26 : integer :: line,ios,linefinal
27 : integer :: wanind,wanindtmp
28 : character(len=30) :: task
29 :
30 0 : call timestart("wann_readcenters")
31 :
32 0 : line=0
33 0 : linefinal=0
34 0 : l_readspread=.false.
35 0 : if(present(spreads)) l_readspread=.true.
36 0 : open(100,file=spin12(jspin)//'.wout')
37 : do while(.true.)
38 0 : read(100,'(a)',iostat=ios)task
39 0 : if(ios.ne.0)exit
40 0 : line=line+1
41 0 : if(index(task,"Final State").ne.0)linefinal=line
42 : enddo
43 0 : IF(linefinal==0) CALL juDFT_error("Final State not found",calledby
44 0 : + ="wann_readcenters")
45 0 : rewind(100)
46 0 : line=0
47 : do while(.true.)
48 0 : read(100,'(a)',iostat=ios)task
49 0 : if(ios.ne.0)exit
50 0 : line=line+1
51 0 : if(line.eq.linefinal)exit
52 : enddo
53 : wanind=0
54 : do while(.true.)
55 0 : read(100,'(a)',iostat=ios)task
56 0 : if(ios.ne.0)exit
57 0 : if(index(task,"Sum of centres and spreads").ne.0)exit
58 0 : wanind=wanind+1
59 0 : backspace(100)
60 0 : IF(wanind>nwfs) CALL juDFT_error("wanind.gt.nwfs",calledby
61 0 : + ="wann_readcenters")
62 0 : if(l_readspread)then
63 0 : read(100,fmt=1000)wanindtmp,centers(:,wanind),spreads(wanind)
64 : else
65 0 : read(100,fmt=2000)wanindtmp,centers(:,wanind)
66 : endif
67 0 : IF(wanindtmp/=wanind) CALL juDFT_error("wanindtmp",calledby
68 0 : + ="wann_readcenters")
69 : enddo
70 0 : close(100)
71 : c do wanind=1,wanindtmp
72 : c print*,centres(:,wanind),spreads(wanind)
73 : c enddo
74 : 1000 format(22x,i5,3x,f10.6,1x,f10.6,1x,f10.6,2x,f15.8)
75 : 2000 format(22x,i5,3x,f10.6,1x,f10.6,1x,f10.6)
76 :
77 :
78 0 : call timestop("wann_readcenters")
79 0 : end subroutine wann_readcenters
80 : end module m_wann_readcenters
|