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_make_dos
8 : USE m_juDFT
9 : !
10 : !-- now write cdninf for all kpts if on T3E
11 : !-- now read data from tmp_dos and write to vacdos&dosinp .. dw
12 : !
13 : CONTAINS
14 15 : SUBROUTINE make_dos(kpts,atoms,vacuum,input,banddos,&
15 5 : sliceplot,noco,sym,cell,results,eigdos,juPhon )
16 : USE m_types
17 : USE m_constants
18 : USE m_cdn_io
19 : USE m_unfold_band_kpts
20 : USE m_cdninf
21 : USE m_types_eigdos
22 : #ifdef CPP_HDF
23 : use m_hdf_tools
24 : #endif
25 : use m_banddos_io
26 : IMPLICIT NONE
27 :
28 :
29 :
30 : TYPE(t_banddos),INTENT(IN) :: banddos
31 : TYPE(t_sliceplot),INTENT(IN) :: sliceplot
32 : TYPE(t_input),INTENT(IN) :: input
33 : TYPE(t_vacuum),INTENT(IN) :: vacuum
34 : TYPE(t_noco),INTENT(IN) :: noco
35 : TYPE(t_sym),INTENT(IN) :: sym
36 : TYPE(t_cell),INTENT(IN) :: cell
37 : TYPE(t_kpts),INTENT(IN) :: kpts
38 : TYPE(t_atoms),INTENT(IN) :: atoms
39 : TYPE(t_results),INTENT(IN) :: results
40 : CLASS(t_eigdos_list),INTENT(IN) :: eigdos(:)
41 :
42 : TYPE(t_juPhon),OPTIONAL,INTENT(IN) :: juPhon
43 :
44 : ! locals
45 : INTEGER :: ne,ikpt,kspin,j,i,n
46 : LOGICAL :: l_error
47 : real :: eFermiPrev, eFermi
48 : logical :: l_dfpt
49 : #ifdef CPP_HDF
50 : INTEGER(HID_t):: banddosFile_id
51 : #else
52 : INTEGER :: banddosFile_id
53 : #endif
54 5 : l_dfpt = PRESENT(juPhon)
55 5 : CALL readPrevEFermi(eFermiPrev,l_error)
56 :
57 5 : IF (.NOT.l_dfpt) eFermi = results%ef
58 :
59 5 : IF(banddos%band) THEN
60 2 : IF(results%bandgap.GE.8.0*input%tkb*hartree_to_ev_const) THEN
61 0 : WRITE(*,*) 'Fermi energy correction for insulators:'
62 0 : IF(.NOT.l_error) THEN
63 0 : eFermi = MAX(eFermi,eFermiPrev)
64 0 : WRITE(*,*) 'Fermi energy in bands.* files has been set to the maximal'
65 0 : WRITE(*,*) 'value determined in the band structure calculation and'
66 0 : WRITE(*,*) 'the calculation of the underlying density, respectively.'
67 : ELSE
68 0 : WRITE(*,*) 'No automatic correction of the Fermi energy has been performed.'
69 : END IF
70 : ELSE
71 2 : WRITE(*,*) 'Fermi energy correction for metals:'
72 2 : IF(.NOT.l_error) THEN
73 2 : eFermi = eFermiPrev
74 2 : WRITE(*,*) 'Fermi energy is automatically corrected in bands.* files.'
75 2 : WRITE(*,*) 'It is consistent with last calculated density!'
76 2 : WRITE(*,*) 'No manual correction (e.g. in band.gnu file) required.'
77 : ELSE
78 0 : WRITE(*,*) 'Fermi energy in bands.* files may not be consistent with last density.'
79 0 : WRITE(*,*) 'Please correct it manually (e.g. in band.gnu file).'
80 : END IF
81 : END IF
82 : END IF
83 :
84 : #ifdef CPP_HDF
85 5 : CALL openBandDOSFile(banddosFile_id,input,atoms,cell,kpts,sym,banddos,eFermi)
86 : #endif
87 12 : DO n=1,size(eigdos)
88 12 : call eigdos(n)%p%sym_weights()
89 : ENDDO
90 5 : IF (banddos%band) THEN
91 : ! CALL writeBandDOSData(banddosFile_id,input,atoms,cell,kpts,results,banddos,dos,vacuum)
92 4 : DO n=1,size(eigdos)
93 4 : call eigdos(n)%p%write_band(kpts,input%comment,cell,banddosFile_id,eFermi,banddos)
94 : enddo
95 2 : IF (banddos%unfoldband) THEN
96 : #ifdef CPP_HDF
97 1947 : CALL writeBandData(banddosFile_id,kpts,'Local','unfolding',REAL(results%unfolding_weights))
98 : #endif
99 1 : CALL write_band_sc(banddos,cell,kpts,results,eFermi)
100 : END IF
101 2 : WRITE(*,*) ""
102 2 : WRITE(*,*) "Note: Band structure data (together with different weights) is also stored in the banddos.hdf file."
103 2 : WRITE(*,*) " A convenient way of extracting and plotting the data from that file is by making use of the"
104 2 : WRITE(*,*) " masci-tools (https://pypi.org/project/masci-tools/)."
105 : ENDIF
106 :
107 5 : IF (input%cdinf) then
108 0 : call cdninf(input,sym,noco,atoms,vacuum,cell,kpts,eigdos)
109 : endif
110 :
111 5 : IF (banddos%dos) THEN
112 8 : DO n=1,size(eigdos)
113 5 : print *,"Makedos:",n
114 5 : call eigdos(n)%p%make_dos(kpts,input,banddos,eFermi)
115 5 : print *,"Smooth:",n
116 5 : call eigdos(n)%p%smooth(banddos)
117 5 : print *,"WriteDos:",n
118 8 : call eigdos(n)%p%write_dos(banddosFile_id)
119 : END DO
120 3 : IF (banddos%l_storeEVData) THEN
121 8 : DO n=1,size(eigdos)
122 8 : call eigdos(n)%p%write_EVData(banddosFile_id)
123 : END DO
124 : END IF
125 3 : WRITE(*,*) ""
126 3 : WRITE(*,*) "Note: DOS data (together with different weights) is also stored in the banddos.hdf file."
127 3 : WRITE(*,*) " A convenient way of extracting and plotting the data from that file is by making use of the"
128 3 : WRITE(*,*) " masci-tools (https://pypi.org/project/masci-tools/)."
129 : END IF
130 : #ifdef CPP_HDF
131 5 : CALL closeBandDOSFile(banddosFile_id)
132 : #endif
133 :
134 5 : RETURN
135 : END SUBROUTINE make_dos
136 : END MODULE m_make_dos
|