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_types_misc
8 :
9 : IMPLICIT NONE
10 :
11 : !*************************************************************
12 : ! This module contains definitions for all kind of types
13 : !*************************************************************
14 :
15 : ! Type for the HF total energy
16 : TYPE t_energy_hf
17 : REAL :: valence
18 : REAL :: core
19 : END TYPE t_energy_hf
20 :
21 : TYPE t_results
22 : REAL, ALLOCATABLE :: force(:,:,:) !< Forces calculated on all atoms (for each spin)
23 : REAL, ALLOCATABLE :: force_vdw(:,:) !< vdw-Forces calculated on all atoms (for each spin)
24 : REAL, ALLOCATABLE :: force_old(:,:) !< Forces on all atoms from last iteration
25 : REAL :: ef !<Fermie energy
26 : REAL :: seigc !<sum of the core eigenvalues
27 : REAL :: seigv !<weighted sum of the occupied valence eigenvalues
28 : REAL :: ts !<entropy contribution to the free energy
29 : REAL :: te_vcoul !<charge density-coulomb potential integral
30 : REAL :: te_veff !<charge density-effective potential integral
31 : REAL :: te_exc !<charge density-ex-corr.energy density integral
32 : REAL :: e_ldau !<total energy contribution of LDA+U
33 : REAL :: e_ldaopc !<total energy contribution of LDA+OP
34 : REAL :: e_vdw=0.0
35 : REAL :: tote
36 : REAL :: last_distance
37 : REAL :: last_mmpMatdistance !Distance measure for LDA+HIA
38 : REAL :: last_occdistance !Distance measure for LDA+HIA
39 : REAL :: bandgap
40 : COMPLEX, ALLOCATABLE :: unfolding_weights(:,:,:) !weights for unfolding a supercell bandstructure
41 : TYPE(t_energy_hf) :: te_hfex
42 : REAL :: te_hfex_loc(2)
43 : REAL, ALLOCATABLE :: w_iks(:,:,:)
44 : REAL, ALLOCATABLE :: w_iksRDMFT(:,:,:)
45 : REAL, ALLOCATABLE :: eig(:,:,:)
46 : INTEGER, ALLOCATABLE :: neig(:,:) ! neig(nkpts,jspins) number of calculated eigenvalues for each k point, spin
47 : REAL :: tkb_loc
48 :
49 : CONTAINS
50 : PROCEDURE,PASS :: init => results_init
51 : PROCEDURE :: reset_results
52 : END TYPE t_results
53 :
54 : TYPE t_zMat
55 : LOGICAL :: l_real
56 : INTEGER :: nbasfcn
57 : INTEGER :: nbands
58 : REAL, ALLOCATABLE :: z_r(:,:) ! z_r(nbasfcn,nbands)
59 : COMPLEX, ALLOCATABLE :: z_c(:,:) ! z_c(nbasfcn,nbands)
60 :
61 : CONTAINS
62 : PROCEDURE,PASS :: init => zMat_init
63 : END TYPE t_zMat
64 :
65 : TYPE t_hamOvlp
66 : LOGICAL :: l_real
67 : INTEGER :: matsize
68 : REAL, ALLOCATABLE :: a_r(:), b_r(:)
69 : COMPLEX, ALLOCATABLE :: a_c(:), b_c(:)
70 : END TYPE t_hamOvlp
71 :
72 : CONTAINS
73 :
74 0 : SUBROUTINE zMat_init(thisZMat,l_real,nbasfcn,nbands)
75 :
76 : IMPLICIT NONE
77 :
78 : CLASS(t_zMat), INTENT(INOUT) :: thisZMat
79 : LOGICAL, INTENT(IN) :: l_real
80 : INTEGER, INTENT(IN) :: nbasfcn,nbands
81 :
82 0 : thisZMat%l_real = l_real
83 0 : thisZMat%nbasfcn = nbasfcn
84 0 : thisZMat%nbands = nbands
85 :
86 0 : IF (ALLOCATED(thisZMat%z_r)) DEALLOCATE(thisZMat%z_r)
87 0 : IF (ALLOCATED(thisZMat%z_c)) DEALLOCATE(thisZMat%z_c)
88 0 : IF (l_real) THEN
89 0 : ALLOCATE(thisZMat%z_r(nbasfcn,nbands))
90 0 : thisZMat%z_r = 0.0
91 : ELSE
92 0 : ALLOCATE(thisZMat%z_c(nbasfcn,nbands))
93 0 : thisZMat%z_c = CMPLX(0.0,0.0)
94 : END IF
95 :
96 0 : END SUBROUTINE zMat_init
97 :
98 162 : SUBROUTINE results_init(thisResults,input,atoms,kpts,noco)
99 :
100 : USE m_types_atoms
101 : USE m_types_input
102 : USE m_types_noco
103 : USE m_types_kpts
104 : USE m_types_lapw
105 : IMPLICIT NONE
106 :
107 : CLASS(t_results), INTENT(INOUT) :: thisResults
108 :
109 : TYPE(t_input), INTENT(IN) :: input
110 : TYPE(t_atoms), INTENT(IN) :: atoms
111 : TYPE(t_kpts), INTENT(IN) :: kpts
112 : TYPE(t_noco), INTENT(IN) :: noco
113 :
114 : INTEGER :: neigd2
115 :
116 162 : thisResults%seigc = 0.0
117 162 : thisResults%seigv = 0.0
118 162 : thisResults%e_ldau = 0.0
119 162 : thisResults%ts = 0.0
120 :
121 162 : thisResults%te_vcoul = 0.0
122 162 : thisResults%te_veff = 0.0
123 162 : thisResults%te_exc = 0.0
124 162 : thisResults%te_hfex%valence = 0.0
125 162 : thisResults%te_hfex%core = 0.0
126 486 : thisResults%te_hfex_loc = 0.0
127 :
128 162 : thisResults%tote = 0.0
129 162 : thisResults%last_distance = -1.0
130 162 : thisResults%last_mmpMatdistance = -1.0
131 162 : thisResults%last_occdistance = -1.0
132 162 : thisResults%bandgap = 0.0
133 162 : thisResults%ef = 0.0
134 162 : thisResults%tkb_loc = 0.0
135 :
136 162 : neigd2 = MIN(input%neig,lapw_dim_nbasfcn)
137 : ! neigd2 = input%neig
138 162 : IF (noco%l_soc.AND.(.NOT.noco%l_noco)) neigd2 = 2*neigd2
139 :
140 2760 : ALLOCATE (thisResults%force(3,atoms%ntype,input%jspins));thisResults%force=0.0
141 1622 : ALLOCATE (thisResults%force_old(3,atoms%ntype));thisResults%force_old=0.0
142 810 : ALLOCATE (thisResults%w_iks(neigd2,kpts%nkpt,input%jspins))
143 648 : ALLOCATE (thisResults%neig(kpts%nkpt,input%jspins))
144 648 : ALLOCATE (thisResults%eig(neigd2,kpts%nkpt,input%jspins))
145 810 : ALLOCATE (thisResults%unfolding_weights(neigd2,kpts%nkpt,input%jspins))
146 :
147 2274 : thisResults%force = 0.0
148 1298 : thisResults%force_old = 0.0
149 111598 : thisResults%w_iks = 0.0
150 2716 : thisResults%neig = 0
151 111598 : thisResults%eig = 0.0
152 :
153 162 : IF(input%l_rdmft) THEN
154 0 : ALLOCATE (thisResults%w_iksRDMFT(neigd2,kpts%nkpt,input%jspins))
155 0 : thisResults%w_iksRDMFT = 0.0
156 : END IF
157 :
158 162 : END SUBROUTINE results_init
159 :
160 0 : SUBROUTINE reset_results(thisResults, input)
161 : USE m_types_input
162 :
163 : IMPLICIT NONE
164 :
165 : CLASS(t_results), INTENT(INOUT) :: thisResults
166 :
167 : TYPE(t_input), INTENT(IN) :: input
168 :
169 0 : thisResults%seigc = 0.0
170 0 : thisResults%seigv = 0.0
171 0 : thisResults%e_ldau = 0.0
172 0 : thisResults%ts = 0.0
173 :
174 0 : thisResults%te_vcoul = 0.0
175 0 : thisResults%te_veff = 0.0
176 0 : thisResults%te_exc = 0.0
177 0 : thisResults%te_hfex%valence = 0.0
178 0 : thisResults%te_hfex%core = 0.0
179 0 : thisResults%te_hfex_loc = 0.0
180 :
181 0 : thisResults%tote = 0.0
182 0 : thisResults%last_distance = -1.0
183 0 : thisResults%last_mmpMatdistance = -1.0
184 0 : thisResults%last_occdistance = -1.0
185 0 : thisResults%bandgap = 0.0
186 0 : thisResults%ef = 0.0
187 :
188 0 : thisResults%force = 0.0
189 0 : thisResults%force_old = 0.0
190 0 : thisResults%w_iks = 0.0
191 0 : thisResults%neig = 0
192 0 : thisResults%eig = 0.0
193 0 : thisResults%tkb_loc = 0.0
194 :
195 : ! Irrelevant
196 0 : IF(input%l_rdmft) THEN
197 0 : thisResults%w_iksRDMFT = 0.0
198 : END IF
199 :
200 0 : END SUBROUTINE
201 :
202 0 : END MODULE m_types_misc
|