Branch data Line data Source code
1 : : !!****m* ABINIT/m_gwdefs
2 : : !! NAME
3 : : !! m_gwdefs
4 : : !!
5 : : !! FUNCTION
6 : : !! This module contains definitions for a number of named constants used in the GW part of abinit
7 : : !!
8 : : !! COPYRIGHT
9 : : !! Copyright (C) 2008-2026 ABINIT group (MG, FB, GMR, VO, LR, RWG)
10 : : !! This file is distributed under the terms of the
11 : : !! GNU General Public License, see ~abinit/COPYING
12 : : !! or http://www.gnu.org/copyleft/gpl.txt .
13 : : !!
14 : : !! SOURCE
15 : :
16 : : #if defined HAVE_CONFIG_H
17 : : #include "config.h"
18 : : #endif
19 : :
20 : : #include "abi_common.h"
21 : :
22 : : module m_gwdefs
23 : :
24 : : use defs_basis
25 : : use m_abicore
26 : : use m_errors
27 : :
28 : : use m_fstrings, only : sjoin, itoa
29 : : use m_nctk, only : etsfio_charlen
30 : :
31 : : implicit none
32 : :
33 : : private
34 : :
35 : : ! Unit number for formatted files produced by GW calculations.
36 : : ! These files are not supposed to be read by abinit therefore
37 : : ! their names and unit numbers are not defined in the Dtfil% structure.
38 : : integer,public,parameter :: unt_gw = 21 ! GW corrections
39 : : integer,public,parameter :: unt_sig = 22 ! Self-energy as a function of frequency
40 : : integer,public,parameter :: unt_sgr = 23 ! Derivative wrt omega of the Self-energy
41 : : integer,public,parameter :: unt_sgm = 20 ! Sigma on the Matsubara axis
42 : : integer,public,parameter :: unt_sigc = 24 ! Sigma_c as a function of (epsilon_i) MRM
43 : : integer,public,parameter :: unt_gwdiag = 40 ! GW diagonal
44 : :
45 : : real(dp),public,parameter :: GW_TOLQ =0.0001_dp
46 : : ! Tolerance below which two BZ points are considered equal within a RL vector:
47 : : ! for each red. direct. the abs value of the difference btw the two coord must be smaller that tolq.
48 : :
49 : : real(dp),public,parameter :: GW_TOLQ0=0.001_dp
50 : : ! Tolerance below which a q-point is treated as zero (long wavelength limit)
51 : :
52 : : real(dp),public,parameter :: GW_TOL_DOCC=0.01_dp
53 : : ! Tolerance on the difference between two occupation numbers.
54 : : ! below this value, the contribution of the transition is neglected in the evaluation of chi0
55 : :
56 : : real(dp),public,parameter :: GW_TOL_W0=0.001_dp
57 : : ! Tolerance on the real part of the frequency appearing in the denominator of the
58 : : ! non-interacting Green function G0. Above this value, a small purely imaginary
59 : : ! complex shift is added to the denominator during the evaluation of chi0.
60 : :
61 : : real(gwp),public,parameter :: one_gw = 1._gwp
62 : : real(gwp),public,parameter :: zero_gw = 0._gwp
63 : :
64 : : complex(gwp),public,parameter :: czero_gw = (0._gwp,0._gwp)
65 : : complex(gwp),public,parameter :: cone_gw = (1._gwp,0._gwp)
66 : : complex(gwp),public,parameter :: j_gw = (0._gwp,1._gwp)
67 : :
68 : : !arrays
69 : : real(dp),public,parameter :: GW_Q0_DEFAULT(3) = [0.00001_dp, 0.00002_dp, 0.00003_dp]
70 : :
71 : : ! Weights and nodes for Gauss-Kronrod integration rules
72 : : ! Gauss 7 Kronrod 15
73 : : real(dp),public,parameter :: Kron15N(15) = (/-0.991455371120812639206854697526328516642040_dp, &
74 : : & -0.949107912342758524526189684047851262400770_dp,-0.864864423359769072789712788640926201210972_dp, &
75 : : & -0.741531185599394439863864773280788407074150_dp,-0.586087235467691130294144838258729598436780_dp, &
76 : : & -0.405845151377397166906606412076961463347382_dp,-0.207784955007898467600689403773244913479780_dp, &
77 : : & 0.000000000000000000000000000000000000000000_dp, 0.207784955007898467600689403773244913479780_dp, &
78 : : & 0.405845151377397166906606412076961463347382_dp, 0.586087235467691130294144838258729598436780_dp, &
79 : : & 0.741531185599394439863864773280788407074150_dp, 0.864864423359769072789712788640926201210972_dp, &
80 : : & 0.949107912342758524526189684047851262400770_dp, 0.991455371120812639206854697526328516642040_dp/)
81 : :
82 : : real(dp),public,parameter :: Kron15W(15) = (/0.022935322010529224963732008058969591993561_dp, &
83 : : & 0.063092092629978553290700663189204286665070_dp,0.104790010322250183839876322541518017443757_dp, &
84 : : & 0.140653259715525918745189590510237920399890_dp,0.169004726639267902826583426598550284106245_dp, &
85 : : & 0.190350578064785409913256402421013682826078_dp,0.204432940075298892414161999234649084716518_dp, &
86 : : & 0.209482141084727828012999174891714263697760_dp,0.204432940075298892414161999234649084716518_dp, &
87 : : & 0.190350578064785409913256402421013682826078_dp,0.169004726639267902826583426598550284106245_dp, &
88 : : & 0.140653259715525918745189590510237920399890_dp,0.104790010322250183839876322541518017443757_dp, &
89 : : & 0.063092092629978553290700663189204286665070_dp,0.022935322010529224963732008058969591993561_dp/)
90 : :
91 : : real(dp),public,parameter :: Gau7W(7) = (/0.12948496616886969327061143267908201832859_dp, &
92 : : & 0.279705391489276667901467771423779582486925_dp,0.38183005050511894495036977548897513387837_dp, &
93 : : & 0.417959183673469387755102040816326530612245_dp,0.38183005050511894495036977548897513387837_dp, &
94 : : & 0.279705391489276667901467771423779582486925_dp,0.12948496616886969327061143267908201832859_dp/)
95 : :
96 : : ! Gauss 11 Kronrod 23
97 : : real(dp),public,parameter :: Kron23N(23) = (/-0.996369613889542634360164573335160773367030_dp, &
98 : : & -0.978228658146056992803938001122857390771420_dp,-0.941677108578067946455396730352134962188750_dp, &
99 : : & -0.887062599768095299075157769303927266631680_dp,-0.816057456656220942392261355192625879277860_dp, &
100 : : & -0.730152005574049324093416252031153458049643_dp,-0.630599520161965092168263312405390318822425_dp, &
101 : : & -0.519096129206811815925725669458609554480227_dp,-0.397944140952377573675073943298232277259112_dp, &
102 : : & -0.269543155952344972331531985400861524679620_dp,-0.136113000799361815798364355994952934344660_dp, &
103 : : & 0.000000000000000000000000000000000000000000_dp, 0.136113000799361815798364355994952934344660_dp, &
104 : : & 0.269543155952344972331531985400861524679620_dp, 0.397944140952377573675073943298232277259112_dp, &
105 : : & 0.519096129206811815925725669458609554480227_dp, 0.630599520161965092168263312405390318822425_dp, &
106 : : & 0.730152005574049324093416252031153458049643_dp, 0.816057456656220942392261355192625879277860_dp, &
107 : : & 0.887062599768095299075157769303927266631680_dp, 0.941677108578067946455396730352134962188750_dp, &
108 : : & 0.978228658146056992803938001122857390771420_dp, 0.996369613889542634360164573335160773367030_dp/)
109 : :
110 : : real(dp),public,parameter :: Kron23W(23) = (/0.00976544104596075802247917260964352216369_dp, &
111 : : & 0.027156554682104262051721401617851679412810_dp,0.04582937856442641598526161637154832107050_dp, &
112 : : & 0.063097424750374906584540530495371467781318_dp,0.07866457193222732928421712412387330212537_dp, &
113 : : & 0.092953098596900827769293667912429161939839_dp,0.10587207448138939648189189823198112055496_dp, &
114 : : & 0.116739502461047270810811060893282832324909_dp,0.125158799100319505060067189609770147044437_dp, &
115 : : & 0.131280684229805644255977537339957161670610_dp,0.135193572799884533184261853141533217156135_dp, &
116 : : & 0.136577794711118301018953895305516133510830_dp,0.135193572799884533184261853141533217156135_dp, &
117 : : & 0.131280684229805644255977537339957161670610_dp,0.125158799100319505060067189609770147044437_dp, &
118 : : & 0.116739502461047270810811060893282832324909_dp,0.10587207448138939648189189823198112055496_dp, &
119 : : & 0.092953098596900827769293667912429161939839_dp,0.07866457193222732928421712412387330212537_dp, &
120 : : & 0.063097424750374906584540530495371467781318_dp,0.04582937856442641598526161637154832107050_dp, &
121 : : & 0.027156554682104262051721401617851679412810_dp,0.00976544104596075802247917260964352216369_dp/)
122 : :
123 : : real(dp),public,parameter :: Gau11W(11) = (/0.0556685671161736664827537204425485787285_dp, &
124 : : & 0.125580369464904624634694299223940100197616_dp,0.186290210927734251426097641431655891691285_dp, &
125 : : & 0.233193764591990479918523704843175139431800_dp,0.262804544510246662180688869890509195372765_dp, &
126 : : & 0.272925086777900630714483528336342189156042_dp,0.262804544510246662180688869890509195372765_dp, &
127 : : & 0.233193764591990479918523704843175139431800_dp,0.186290210927734251426097641431655891691285_dp, &
128 : : & 0.125580369464904624634694299223940100197616_dp,0.055668567116173666482753720442548578728500_dp/)
129 : :
130 : : ! Gauss 15 Kronrod 31
131 : : real(dp),public,parameter :: Kron31N(31) = (/-0.998002298693397060285172840152271209073410_dp, &
132 : : & -0.987992518020485428489565718586612581146970_dp,-0.967739075679139134257347978784337225283360_dp, &
133 : : & -0.937273392400705904307758947710209471244000_dp,-0.897264532344081900882509656454495882831780_dp, &
134 : : & -0.848206583410427216200648320774216851366260_dp,-0.790418501442465932967649294817947346862140_dp, &
135 : : & -0.724417731360170047416186054613938009630900_dp,-0.650996741297416970533735895313274692546948_dp, &
136 : : & -0.570972172608538847537226737253910641238390_dp,-0.485081863640239680693655740232350612866339_dp, &
137 : : & -0.394151347077563369897207370981045468362750_dp,-0.299180007153168812166780024266388962661603_dp, &
138 : : & -0.201194093997434522300628303394596207812836_dp,-0.101142066918717499027074231447392338787451_dp, &
139 : : & 0.000000000000000000000000000000000000000000_dp, 0.101142066918717499027074231447392338787451_dp, &
140 : : & 0.201194093997434522300628303394596207812836_dp, 0.299180007153168812166780024266388962661603_dp, &
141 : : & 0.394151347077563369897207370981045468362750_dp, 0.485081863640239680693655740232350612866339_dp, &
142 : : & 0.570972172608538847537226737253910641238390_dp, 0.650996741297416970533735895313274692546948_dp, &
143 : : & 0.724417731360170047416186054613938009630900_dp, 0.790418501442465932967649294817947346862140_dp, &
144 : : & 0.848206583410427216200648320774216851366260_dp, 0.897264532344081900882509656454495882831780_dp, &
145 : : & 0.937273392400705904307758947710209471244000_dp, 0.967739075679139134257347978784337225283360_dp, &
146 : : & 0.987992518020485428489565718586612581146970_dp, 0.998002298693397060285172840152271209073410_dp/)
147 : :
148 : : real(dp),public,parameter :: Kron31W(31) = (/0.0053774798729233489877920514301276498183100_dp, &
149 : : & 0.0150079473293161225383747630758072680946390_dp, 0.0254608473267153201868740010196533593972700_dp, &
150 : : & 0.0353463607913758462220379484783600481226300_dp, 0.0445897513247648766082272993732796902232570_dp, &
151 : : & 0.0534815246909280872653431472394302967715500_dp, 0.0620095678006706402851392309608029321904000_dp, &
152 : : & 0.0698541213187282587095200770991474757860450_dp, 0.0768496807577203788944327774826590067221100_dp, &
153 : : & 0.0830805028231330210382892472861037896015540_dp, 0.0885644430562117706472754436937743032122700_dp, &
154 : : & 0.0931265981708253212254868727473457185619300_dp, 0.0966427269836236785051799076275893351366570_dp, &
155 : : & 0.0991735987217919593323931734846031310595673_dp, 0.1007698455238755950449466626175697219163500_dp, &
156 : : & 0.1013300070147915490173747927674925467709270_dp, 0.1007698455238755950449466626175697219163500_dp, &
157 : : & 0.0991735987217919593323931734846031310595673_dp, 0.0966427269836236785051799076275893351366570_dp, &
158 : : & 0.0931265981708253212254868727473457185619300_dp, 0.0885644430562117706472754436937743032122700_dp, &
159 : : & 0.0830805028231330210382892472861037896015540_dp, 0.0768496807577203788944327774826590067221100_dp, &
160 : : & 0.0698541213187282587095200770991474757860450_dp, 0.0620095678006706402851392309608029321904000_dp, &
161 : : & 0.0534815246909280872653431472394302967715500_dp, 0.0445897513247648766082272993732796902232570_dp, &
162 : : & 0.0353463607913758462220379484783600481226300_dp, 0.0254608473267153201868740010196533593972700_dp, &
163 : : & 0.0150079473293161225383747630758072680946390_dp, 0.0053774798729233489877920514301276498183100_dp/)
164 : :
165 : : real(dp),public,parameter :: Gau15W(15) = (/0.030753241996117268354628393577204417721700_dp, &
166 : : 0.070366047488108124709267416450667338466710_dp, 0.107159220467171935011869546685869303415544_dp, &
167 : : 0.139570677926154314447804794511028322520850_dp, 0.166269205816993933553200860481208811130900_dp, &
168 : : 0.186161000015562211026800561866422824506226_dp, 0.198431485327111576456118326443839324818693_dp, &
169 : : 0.202578241925561272880620199967519314838662_dp, 0.198431485327111576456118326443839324818693_dp, &
170 : : 0.186161000015562211026800561866422824506226_dp, 0.166269205816993933553200860481208811130900_dp, &
171 : : 0.139570677926154314447804794511028322520850_dp, 0.107159220467171935011869546685869303415544_dp, &
172 : : 0.070366047488108124709267416450667338466710_dp, 0.030753241996117268354628393577204417721700_dp/)
173 : :
174 : :
175 : : ! Flags for self-consistent GW calculations used in gw_driver and for parsing the input file.
176 : : integer,public,parameter :: GWSC_one_shot =1
177 : : integer,public,parameter :: GWSC_only_W =2
178 : : integer,public,parameter :: GWSC_only_G =3
179 : : integer,public,parameter :: GWSC_both_G_and_W =4
180 : :
181 : : ! Flags defining the approximation used for the self-energy (used in csigme).
182 : : integer,public,parameter :: SIG_GW_PPM =0 ! standard GW with PPM
183 : : integer,public,parameter :: SIG_GW_AC =1 ! standard GW without PPM (analytical continuation)
184 : : integer,public,parameter :: SIG_GW_CD =2 ! standard GW without PPM (contour deformation)
185 : : integer,public,parameter :: SIG_HF =5 ! Hartree-Fock calculation
186 : : integer,public,parameter :: SIG_SEX =6 ! Screened Exchange calculation
187 : : integer,public,parameter :: SIG_COHSEX =7 ! COHSEX calculation
188 : : integer,public,parameter :: SIG_QPGW_PPM =8 ! model GW with PPM
189 : : integer,public,parameter :: SIG_QPGW_CD =9 ! model GW without PPM
190 : :
191 : : public :: sigma_type_from_key
192 : : public :: g0g0w
193 : :
194 : : ! Private variables
195 : : integer,private,parameter :: STR_LEN=500
196 : : !!***
197 : :
198 : : !----------------------------------------------------------------------
199 : :
200 : : !!****t* m_gwdefs/em1params_t
201 : : !! NAME
202 : : !! em1params_t
203 : : !!
204 : : !! FUNCTION
205 : : !! For the GW part of ABINIT, the em1params_t structured datatype
206 : : !! gather different parameters used to calculate the inverse dielectric matrix in SCREENING
207 : : !!
208 : : !! SOURCE
209 : :
210 : : type,public :: em1params_t
211 : :
212 : : !scalars
213 : : integer :: awtr ! If 1 the Adler-Wiser expression for Chi_0 is evaluated
214 : : ! taking advantage of time-reversal symmetry
215 : : integer :: gwcalctyp ! Calculation type (see input variable)
216 : : integer :: gwcomp ! 1 if extrapolar technique is used. 0 otherwise.
217 : : integer :: inclvkb ! Integer flag related to the evaluation of the commutator for q-->0
218 : : integer :: spmeth ! Method used to approximate the delta function in the expression for Im Chi_0
219 : : integer :: nI ! Number of components (rows) in the chi0 matrix.
220 : : integer :: nJ ! Number of components (columns) in the chi0 matrix.
221 : : integer :: npwvec ! Max between npwe and npwwfn, used to pass the dimension of arrays e.g gvec
222 : : integer :: npwwfn ! Number of planewaves for wavefunctions
223 : : integer :: npwe ! Number of planewaves for $\tilde \epsilon$
224 : : integer :: npwepG0 ! Number of planewaves in the enlarged sphere G-G0, to account for umklapp G0 vectors
225 : : integer :: nbnds ! Number of bands used to evaluate $\tilde \epsilon$
226 : : integer :: nkibz ! Number of k-points in the IBZ
227 : : integer :: nsppol ! 1 for spin unpolarized, 2 for collinear spin polarized
228 : : integer :: nqcalc ! Number of q-points that are calculated (subset of qibz)
229 : : integer :: nqibz ! Number of q-points in the IBZ
230 : : integer :: nqlwl ! Number of directions to analyze the non analytical behavior for q-->0
231 : : integer :: nomega ! Number of frequencies where evaluate $\tilde \epsilon (\omega)$
232 : : integer :: nomegaer,nomegaei ! Number of real and imaginary frequencies, respectively
233 : : integer :: nomegaec ! Number of frequencies on a grid in the complex plane nomegaec = nomegaei*(nomegaer-1)
234 : : integer :: nomegasf ! Number of frequencies used for the spectral function
235 : : integer :: symchi ! 0 ==> do not use symmetries to reduce the k-points summed over in chi0
236 : : ! 1 ==> take advantage of point group symmetries as well as time-reversal
237 : :
238 : : real(dp) :: gwencomp ! Extrapolar energy used if gwcomp==1.
239 : : real(dp) :: omegaermin ! Minimum real frequency used in the contour deformation method
240 : : real(dp) :: omegaermax ! Maximum real frequency used in the contour deformation method
241 : : real(dp) :: mbpt_sciss ! Scissor energy used in chi0
242 : : real(dp) :: spsmear ! Smearing of the delta in case of spmeth==2
243 : : real(dp) :: zcut ! Small imaginary shift to avoid poles in chi0
244 : :
245 : : logical :: analytic_continuation ! if true calculate chi0 only along the imaginary axis
246 : : logical :: contour_deformation ! if true calculate chi0 both along the real and the imaginary axis
247 : : logical :: plasmon_pole_model ! if true a plasmonpole model is used (only 1 or 2 frequencies are calculated)
248 : :
249 : : !arrays
250 : : integer :: mG0(3)
251 : : ! For each reduced direction gives the max G0 component to account for umklapp processes
252 : :
253 : : real(dp),allocatable :: qcalc(:,:)
254 : : ! (3,nqcalc)
255 : : ! q-points that are explicitely calculated (subset of qibz).
256 : :
257 : : real(dp),allocatable :: qibz(:,:)
258 : : ! (3,nqibz)
259 : : ! q-points in the IBZ.
260 : :
261 : : real(dp),allocatable :: qlwl(:,:)
262 : : ! (3,nqlwl)
263 : : ! q-points used for the long-wavelength limit.
264 : :
265 : : real(dp),allocatable :: omegasf(:)
266 : : ! (nomegasf)
267 : : ! real frequencies used to calculate the imaginary part of chi0.
268 : :
269 : : complex(dp),allocatable :: omega(:)
270 : : ! (nomega)
271 : : ! real and imaginary frequencies in chi0, epsilon and epsilonm1.
272 : :
273 : : real(dp),allocatable :: omega_wgs(:)
274 : : ! (nomega)
275 : : ! Weights for numerical integration, used for instance for minimax meshes.
276 : :
277 : : character(len=etsfio_charlen) :: iw_mesh_type="None", rw_mesh_type="None", cw_mesh_type="None"
278 : : ! String defining the kind of sampling for imaginary (iw), real (rw) and complex (cw) frequencies
279 : :
280 : : contains
281 : : procedure :: free => em1params_free
282 : : end type em1params_t
283 : : !!***
284 : :
285 : : type,public :: sigij_col_t
286 : : integer :: size1
287 : : integer,allocatable :: bidx(:)
288 : : end type sigij_col_t
289 : :
290 : : type,public :: sigijtab_t
291 : : type(sigij_col_t),allocatable :: col(:)
292 : : end type sigijtab_t
293 : :
294 : : public :: sigijtab_free
295 : :
296 : : !----------------------------------------------------------------------
297 : :
298 : : !!****t* m_gwdefs/sigparams_t
299 : : !! NAME
300 : : !! sigparams_t
301 : : !!
302 : : !! FUNCTION
303 : : !! For the GW part of ABINIT, the sigparams_t structured datatype
304 : : !! gather different parameters that characterize the calculation of the matrix
305 : : !! elements of the self-energy operator.
306 : : !!
307 : : !! SOURCE
308 : :
309 : : type,public :: sigparams_t
310 : :
311 : : integer :: gwcalctyp ! Calculation type
312 : :
313 : : integer :: gwgamma ! If 1 include vertex correction (GWGamma)
314 : : integer :: gwcomp ! 1 if the extrapolar technique is used.
315 : :
316 : : integer :: minbdgw,maxbdgw ! Minimum and maximum band index (considering the spin) defining
317 : : ! The set of bands where GW corrections are evaluated
318 : :
319 : : integer :: mG0(3) ! For each reduced direction gives the max G0 component
320 : : ! to account for umklapp processes
321 : :
322 : : integer :: npwvec ! Max betwenn npwe and npwwfn, used to pass the dimension of arrays e.g gvec
323 : : integer :: npwwfn ! No. of planewaves for wavefunctions
324 : : integer :: npwx ! No. of planewaves for $\Sigma_x$
325 : : integer :: npwc ! No. of planewaves for $\Sigma_c$ and W
326 : : integer :: nbnds ! No. of bands summed over.
327 : : integer :: nomegasr ! No. of frequencies on the real axis to evaluate the spectral function
328 : : integer :: nomegasrd ! No. of frequencies on the real axis to evaluate $\Sigma(E)$
329 : : integer :: nomegasi ! No. of frequencies along the imaginary axis for Sigma in case of AC
330 : : integer :: nsig_ab ! No. of components in the self-energy operator (1 if nspinor==1, 4 if nspinor==2)
331 : : integer :: nspinor ! No. of spinorial components.
332 : : integer :: nsppol ! 1 for unpolarized, 2 for spin-polarized calculation
333 : : integer :: nkptgw ! No. of k-points where GW corrections have been calculated
334 : : integer :: ppmodel ! Integer defining the plasmon pole model used, 0 for None.
335 : : integer :: symsigma ! 0 ==> do not use symmetries to reduce the k-points summed over in sigma
336 : : ! 1 ==> take advantage of space group symmetries as well as time-reversal
337 : : integer :: use_sigxcore ! 1 if core contribution to sigma is estimated by using Hartree-Fock
338 : :
339 : : real(dp) :: deltae ! Energy step used to evaluate numerically the derivative of the self energy
340 : : ! $\frac{\partial \Re \Sigma(E)}{\partial E_o}$
341 : : real(dp) :: ecutwfn ! cutoff energy for the wavefunctions.
342 : : real(dp) :: ecutsigx ! cutoff energy for the the exchange parth of Sigma.
343 : : real(dp) :: ecuteps ! cutoff energy for W
344 : :
345 : : real(dp) :: gwencomp ! Extrapolar energy used if gwcomp==1.
346 : :
347 : : real(dp) :: mbpt_sciss ! Scissor energy used in G0
348 : :
349 : : real(dp) :: minomega_r ! Minimum real frequency for the evaluation of the spectral function
350 : : real(dp) :: maxomega_r ! Maximum real frequency for the evaluation of the spectral function
351 : : real(dp) :: maxomega4sd ! Maximum displacement around the KS energy where evaluate the diagonal
352 : : ! Elements of $ \Sigma(E)$
353 : : real(dp) :: omegasimax ! Max omega for Sigma along the imag axis in case of analytic continuation
354 : : real(dp) :: omegasimin ! min omega for Sigma along the imag axis in case of analytic continuation
355 : :
356 : : real(dp) :: sigma_mixing ! Global factor that multiplies Sigma to give the final matrix element.
357 : : ! Usually one, except for the hybrid functionals.
358 : :
359 : : real(dp) :: zcut ! Value of $\delta$ used to avoid the divergences (see related input variable)
360 : :
361 : : integer,allocatable :: kptgw2bz(:)
362 : : ! (nkptgw)
363 : : ! For each k-point where GW corrections are calculated, the corresponding index in the BZ.
364 : :
365 : : integer,allocatable :: minbnd(:,:), maxbnd(:,:)
366 : : ! (nkptgw, nsppol)
367 : : ! For each k-point at which GW corrections are calculated, the min and Max band index considered
368 : : ! (see also input variable dtset%bdgw).
369 : :
370 : : real(dp),allocatable :: kptgw(:,:)
371 : : ! (3, nkptgw)
372 : : ! k-points for the GW corrections in reduced coordinates.
373 : :
374 : : !TODO should be removed, everything should be in Sr%
375 : :
376 : : complex(dp),allocatable :: omegasi(:)
377 : : ! (nomegasi)
378 : : ! Frequencies along the imaginary axis used for the analytical continuation.
379 : :
380 : : complex(dp),allocatable :: omega_r(:)
381 : : ! (nomegasr)
382 : : ! Frequencies used to evaluate the spectral function.
383 : :
384 : : type(sigijtab_t),allocatable :: Sigcij_tab(:,:)
385 : : ! (nkptgw, nsppol)%col(kb)%bidx(ii) gives the index of the left wavefunction.
386 : : ! in the <i,kgw,s|\Sigma_c|j,kgw,s> matrix elements that has to be calculated in cisgme.
387 : : ! in the case of self-consistent GW on wavefunctions.
388 : :
389 : : type(sigijtab_t),allocatable :: Sigxij_tab(:,:)
390 : : ! Save as Sigcij_tab but for the Hermitian \Sigma_x where only the upper triangle is needed.
391 : :
392 : : contains
393 : : procedure :: free => sigparams_free
394 : : procedure :: is_herm => sigma_is_herm
395 : : procedure :: needs_w => sigma_needs_w
396 : : procedure :: needs_ppm => sigma_needs_ppm
397 : : end type sigparams_t
398 : : !!***
399 : :
400 : : CONTAINS !==============================================================================
401 : : !!***
402 : :
403 : : !----------------------------------------------------------------------
404 : :
405 : : !!****f* m_gwdefs/em1params_free
406 : : !! NAME
407 : : !! em1params_free
408 : : !!
409 : : !! FUNCTION
410 : : !! Free dynamic memory allocated in the structure.
411 : : !!
412 : : !! SOURCE
413 : :
414 : 148 : subroutine em1params_free(Ep)
415 : :
416 : : !Arguments ------------------------------------
417 : : class(em1params_t),intent(inout) :: Ep
418 : : ! *************************************************************************
419 : :
420 : : !real
421 [ + - ]: 148 : ABI_SFREE(Ep%qcalc)
422 [ + - ]: 148 : ABI_SFREE(Ep%qibz)
423 [ + - ]: 148 : ABI_SFREE(Ep%qlwl)
424 [ - + ]: 148 : ABI_SFREE(Ep%omegasf)
425 [ + - ]: 148 : ABI_SFREE(Ep%omega_wgs)
426 : :
427 : : !complex
428 [ + - ]: 148 : ABI_SFREE(Ep%omega)
429 : :
430 : 148 : end subroutine em1params_free
431 : : !!***
432 : :
433 : : !----------------------------------------------------------------------
434 : :
435 : : !!****f* m_gwdefs/sigijtab_free
436 : : !! NAME
437 : : !! sigijtab_free
438 : : !!
439 : : !! FUNCTION
440 : : !! deallocate all memory in a sigijtab_t datatype.
441 : : !!
442 : : !! SOURCE
443 : :
444 [ - + ]: 402 : subroutine sigijtab_free(Sigijtab)
445 : :
446 : : !Arguments ------------------------------------
447 : : !scalars
448 : : type(sigijtab_t),intent(inout) :: Sigijtab(:,:)
449 : :
450 : : !Local variables
451 : : integer :: ii,jj,kk,ilow,iup
452 : : ! *************************************************************************
453 : :
454 : : !@sigijtab_t
455 [ + + ]: 812 : do jj=1,SIZE(Sigijtab,DIM=2)
456 [ + + ]: 2106 : do ii=1,SIZE(Sigijtab,DIM=1)
457 : :
458 [ + - ]: 1294 : ilow=LBOUND(Sigijtab(ii,jj)%col,DIM=1)
459 [ + - ]: 1294 : iup =UBOUND(Sigijtab(ii,jj)%col,DIM=1)
460 [ + + ]: 12196 : do kk=ilow,iup
461 [ - + ]: 12196 : ABI_FREE(Sigijtab(ii,jj)%col(kk)%bidx)
462 : : end do
463 [ + - + + : 12606 : ABI_FREE(Sigijtab(ii,jj)%col)
- + - + ]
464 : :
465 : : end do
466 : : end do
467 : :
468 : 402 : end subroutine sigijtab_free
469 : : !!***
470 : :
471 : : !----------------------------------------------------------------------
472 : :
473 : : !!****f* m_gwdefs/sigparams_free
474 : : !! NAME
475 : : !! sigparams_free
476 : : !!
477 : : !! FUNCTION
478 : : !! Free dynamic memory allocated in the structure.
479 : : !!
480 : : !! SOURCE
481 : :
482 : 201 : subroutine sigparams_free(Sigp)
483 : :
484 : : !Arguments ------------------------------------
485 : : class(sigparams_t),intent(inout) :: Sigp
486 : : ! *************************************************************************
487 : :
488 : : !integer
489 [ + - ]: 201 : ABI_SFREE(Sigp%kptgw2bz)
490 [ + - ]: 201 : ABI_SFREE(Sigp%minbnd)
491 [ + - ]: 201 : ABI_SFREE(Sigp%maxbnd)
492 : : !real
493 [ - + ]: 201 : ABI_FREE(Sigp%kptgw)
494 : : !complex
495 [ + + ]: 201 : ABI_SFREE(Sigp%omegasi)
496 [ + + ]: 201 : ABI_SFREE(Sigp%omega_r)
497 : :
498 [ + - ]: 201 : if (allocated(Sigp%Sigcij_tab)) then
499 : 201 : call sigijtab_free(Sigp%Sigcij_tab)
500 [ + - + + : 848 : ABI_FREE(Sigp%Sigcij_tab)
- + - - -
- - + ]
501 : : end if
502 : :
503 [ + - ]: 201 : if (allocated(Sigp%Sigxij_tab)) then
504 : 201 : call sigijtab_free(Sigp%Sigxij_tab)
505 [ + - + + : 848 : ABI_FREE(Sigp%Sigxij_tab)
- + - - -
- - + ]
506 : : end if
507 : :
508 : 201 : end subroutine sigparams_free
509 : : !!***
510 : :
511 : : !----------------------------------------------------------------------
512 : :
513 : : !!****f* m_gwdefs/sigma_type_from_key
514 : : !! NAME
515 : : !! sigma_type_from_key
516 : : !!
517 : : !! FUNCTION
518 : : !! Return a string definining the particular approximation used for the self-energy.
519 : : !! Stops if the key is not in the list of allowed possibilities.
520 : : !!
521 : : !! INPUTS
522 : : !! key=Integer
523 : : !!
524 : : !! OUTPUT
525 : : !!
526 : : !! SOURCE
527 : :
528 : 656 : character(len=STR_LEN) function sigma_type_from_key(key) result(sigma_type)
529 : :
530 : : !Arguments ------------------------------------
531 : : integer,intent(in) :: key
532 : : !************************************************************************
533 : :
534 : 656 : sigma_type = "None"
535 [ + + ]: 656 : if (key==SIG_GW_PPM ) sigma_type = ' standard GW with PPM'
536 [ + + ]: 656 : if (key==SIG_GW_AC ) sigma_type = ' standard GW without PPM (analytical continuation)'
537 [ + + ]: 656 : if (key==SIG_GW_CD ) sigma_type = ' standard GW without PPM (contour deformation)'
538 [ + + ]: 656 : if (key==SIG_HF ) sigma_type = ' Hartree-Fock calculation'
539 [ + + ]: 656 : if (key==SIG_SEX ) sigma_type = ' Screened Exchange calculation'
540 [ + + ]: 656 : if (key==SIG_COHSEX ) sigma_type = ' COHSEX calculation'
541 [ + + ]: 656 : if (key==SIG_QPGW_PPM) sigma_type = ' model GW with PPM'
542 [ + + ]: 656 : if (key==SIG_QPGW_CD ) sigma_type = ' model GW without PPM'
543 : :
544 [ - + ]: 656 : if (sigma_type == "None") then
545 : 0 : ABI_ERROR(sjoin("Unknown value for key: ", itoa(key)))
546 : : end if
547 : :
548 : 656 : end function sigma_type_from_key
549 : : !!***
550 : :
551 : : !----------------------------------------------------------------------
552 : :
553 : : !!****f* m_gwdefs/sigma_is_herm
554 : : !! NAME
555 : : !! sigma_is_herm
556 : : !!
557 : : !! FUNCTION
558 : : !! Return .TRUE. if the approximated self-energy is hermitian.
559 : : !!
560 : : !! INPUTS
561 : : !! Sigp<sigparams_t>=datatype gathering data and info on the self-energy run.
562 : : !!
563 : : !! SOURCE
564 : :
565 : 201 : pure logical function sigma_is_herm(Sigp)
566 : :
567 : : !Arguments ------------------------------
568 : : class(sigparams_t),intent(in) :: Sigp
569 : :
570 : : !Local variables ------------------------------
571 : : integer :: mod10
572 : : !************************************************************************
573 : :
574 : 201 : mod10 = MOD(Sigp%gwcalctyp,10)
575 : 201 : sigma_is_herm = ANY(mod10 == [SIG_HF, SIG_SEX, SIG_COHSEX])
576 : :
577 : 201 : end function sigma_is_herm
578 : : !!***
579 : :
580 : : !----------------------------------------------------------------------
581 : :
582 : : !!****f* m_gwdefs/sigma_needs_w
583 : : !! NAME
584 : : !! sigma_needs_w
585 : : !!
586 : : !! FUNCTION
587 : : !! Return .TRUE. if self-energy requires the screened interaction W.
588 : : !! For example HF does not need the SCR file.
589 : : !!
590 : : !! INPUTS
591 : : !! Sigp<sigparams_t>=datatype gathering data and info on the self-energy run.
592 : : !!
593 : : !! SOURCE
594 : :
595 : 575 : pure logical function sigma_needs_w(Sigp)
596 : :
597 : : !Arguments ------------------------------
598 : : class(sigparams_t),intent(in) :: Sigp
599 : :
600 : : !Local variables ------------------------------
601 : : integer :: mod10
602 : : !************************************************************************
603 : :
604 : 575 : mod10=MOD(Sigp%gwcalctyp,10)
605 : 575 : sigma_needs_w = (mod10/=SIG_HF)
606 : :
607 : 575 : end function sigma_needs_w
608 : : !!***
609 : :
610 : : !----------------------------------------------------------------------
611 : :
612 : : !!****f* m_gwdefs/sigma_needs_ppm
613 : : !! NAME
614 : : !! sigma_needs_ppm
615 : : !!
616 : : !! FUNCTION
617 : : !! Return .TRUE. if the self-energy run requires a plasmon-pole model.
618 : : !!
619 : : !! INPUTS
620 : : !! Sigp<sigparams_t>=datatype gathering data and info on the self-energy run.
621 : : !!
622 : : !! SOURCE
623 : :
624 : 40169 : pure logical function sigma_needs_ppm(Sigp)
625 : :
626 : : !Arguments ------------------------------
627 : : class(sigparams_t),intent(in) :: Sigp
628 : :
629 : : !Local variables ------------------------------
630 : : integer :: mod10
631 : : !************************************************************************
632 : :
633 : 40169 : mod10=MOD(Sigp%gwcalctyp,10)
634 : : sigma_needs_ppm = (ANY(mod10 == [SIG_GW_PPM, SIG_QPGW_PPM]) .or. &
635 : : Sigp%gwcomp==1 &
636 [ + + - + ]: 40169 : )
637 : :
638 : 40169 : end function sigma_needs_ppm
639 : : !!***
640 : :
641 : : !----------------------------------------------------------------------
642 : :
643 : : !!****f* m_gwdefs/g0g0w
644 : : !! NAME
645 : : !! g0g0w
646 : : !!
647 : : !! FUNCTION
648 : : !! Calculates the frequency-dependent part of the RPA polarizability G0G0.
649 : : !!
650 : : !! INPUTS
651 : : !!
652 : : !! OUTPUT
653 : : !!
654 : : !! SOURCE
655 : :
656 : 5110683 : complex(dp) function g0g0w(omega, numerator, delta_ene, zcut, TOL_W0, opt_poles)
657 : :
658 : : !Arguments ------------------------------------
659 : : !scalars
660 : : integer,intent(in):: opt_poles
661 : : real(dp),intent(in) :: TOL_W0,delta_ene,numerator,zcut
662 : : complex(dp),intent(in) :: omega
663 : :
664 : : !Local variables ------------------------------
665 : : !scalars
666 : : real(dp) :: sgn
667 : : character(len=500) :: msg
668 : : !************************************************************************
669 : :
670 [ + + ]: 5110683 : if (delta_ene**2 > tol14) then
671 : 5108335 : sgn = SIGN(1.0_dp,delta_ene)
672 : :
673 [ + + ]: 5108335 : if (opt_poles == 2) then
674 : : ! Resonant and anti-resonant contributions.
675 [ + + ]: 3975713 : if (DABS(REAL(omega)) > TOL_W0) then
676 : : ! omega on the real axis
677 : : g0g0w = numerator / (omega + delta_ene - j_dpc*sgn*zcut) &
678 : 921910 : -numerator / (omega - delta_ene + j_dpc*sgn*zcut)
679 : : else
680 : : ! omega on the imag axis (g0g0w is purely real)
681 : : g0g0w = numerator / (omega + delta_ene) &
682 : 3053803 : -numerator / (omega - delta_ene)
683 : : end if
684 : :
685 [ + - ]: 1132622 : else if (opt_poles == 1) then
686 : : ! Only resonant contribution is included.
687 [ + + ]: 1132622 : if (DABS(REAL(omega)) > TOL_W0) then
688 : 426848 : g0g0w = numerator / (omega + delta_ene - j_dpc*sgn*zcut)
689 : : else
690 : 705774 : g0g0w = numerator / (omega + delta_ene)
691 : : end if
692 : :
693 : : else
694 : 0 : write(msg,'(a,i0)')" Wrong value for opt_poles: ",opt_poles
695 : 0 : ABI_ERROR(msg)
696 : : end if ! opt_poles
697 : :
698 : : else
699 : : ! delta_ene**2 < tol14
700 : : g0g0w = czero
701 : : end if
702 : :
703 : 5110683 : end function g0g0w
704 : : !!***
705 : :
706 [ # # # # : 0 : end module m_gwdefs
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# # # # ]
707 : : !!***
|