Branch data Line data Source code
1 : : !!****m* ABINIT/m_scfcv
2 : : !! NAME
3 : : !! m_scfcv
4 : : !!
5 : : !! FUNCTION
6 : : !! FIXME: add description.
7 : : !!
8 : : !! COPYRIGHT
9 : : !! Copyright (C) 2014-2026 ABINIT group (JB)
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_scfcv
23 : :
24 : : use defs_basis
25 : : use defs_wvltypes
26 : : use defs_rectypes
27 : : use m_abicore
28 : : use m_errors
29 : : use m_wffile
30 : : use m_rec
31 : : use m_efield
32 : : use m_entropyDMFT
33 : : use m_hdr
34 : : use m_rcpaw
35 : : use m_extfpmd
36 : : use m_dtfil
37 : : use m_xg_nonlop
38 : :
39 : : use defs_datatypes, only : pseudopotential_type
40 : : use defs_abitypes, only : MPI_type
41 : : use m_scf_history, only : scf_history_type
42 : : use m_results_gs , only : results_gs_type
43 : : use m_electronpositron, only : electronpositron_type
44 : : use m_pawang, only : pawang_type
45 : : use m_pawrad, only : pawrad_type
46 : : use m_pawtab, only : pawtab_type
47 : : use m_pawcprj, only : pawcprj_type
48 : : use m_pawrhoij, only : pawrhoij_type
49 : : use m_pawfgr, only : pawfgr_type
50 : : use m_paw_dmft, only : paw_dmft_type
51 : : use m_paw_uj, only : macro_uj_type
52 : : use m_data4entropyDMFT, only : data4entropyDMFT_t, data4entropyDMFT_init, data4entropyDMFT_destroy
53 : : use m_scfcv_core, only : scfcv_core
54 : :
55 : : implicit none
56 : :
57 : : private
58 : :
59 : : public :: scfcv_init
60 : : public :: scfcv_destroy
61 : : public :: scfcv_run
62 : : !!***
63 : :
64 : : ! *************************************************************************
65 : :
66 : : !!****t* m_scfcv/scfcv_t
67 : : !! NAME
68 : : !! scfcv_t
69 : : !!
70 : : !! FUNCTION
71 : : !! This structured datatype contains the necessary data
72 : : !!
73 : : !! SOURCE
74 : :
75 : : type, public :: scfcv_t
76 : : !scalars
77 : : integer,pointer :: mcg => null()
78 : : integer,pointer :: mcprj => null()
79 : : integer,pointer :: my_natom => null()
80 : : integer,pointer :: ndtpawuj => null()
81 : : integer,pointer :: pwind_alloc => null()
82 : : integer,pointer :: initialized => null()
83 : : integer,pointer :: nfftf => null()
84 : : real(dp),pointer :: cpus => null()
85 : : real(dp),pointer :: ecore => null()
86 : : real(dp),pointer :: fatvshift => null()
87 : : type(pawang_type),pointer :: pawang => null()
88 : : type(pseudopotential_type),pointer :: psps => null()
89 : : type(MPI_type),pointer :: mpi_enreg => null()
90 : : type(datafiles_type),pointer :: dtfil => null()
91 : : type(dataset_type),pointer :: dtset => null()
92 : : type(efield_type),pointer :: dtefield => null()
93 : : type(electronpositron_type),pointer :: electronpositron => null()
94 : : type(hdr_type),pointer :: hdr => null()
95 : : type(extfpmd_type),pointer :: extfpmd => null()
96 : : type(rcpaw_type),pointer :: rcpaw => null()
97 : : type(pawfgr_type),pointer :: pawfgr => null()
98 : : type(recursion_type),pointer :: rec_set => null()
99 : : type(results_gs_type),pointer :: results_gs => null()
100 : : type(scf_history_type),pointer :: scf_history => null()
101 : : type(wffile_type),pointer :: wffnew => null()
102 : : type(wffile_type),pointer :: wffnow => null()
103 : : type(wvl_data),pointer :: wvl => null()
104 : : type(paw_dmft_type), pointer :: paw_dmft => null()
105 : : type(xg_nonlop_t),pointer :: xg_nonlop => null()
106 : :
107 : : !arrays
108 : : integer,pointer :: atindx(:) => null()
109 : : integer,pointer :: atindx1(:) => null()
110 : : integer, pointer :: irrzon(:,:,:) => null()
111 : : integer, pointer :: symrec(:,:,:) => null()
112 : : integer,pointer :: indsym(:,:,:) => null()
113 : : !no_abirules
114 : : integer, pointer :: kg(:,:) => null()
115 : : integer, pointer :: nattyp(:) => null()
116 : : integer, pointer :: npwarr(:) => null()
117 : : integer, pointer :: pwind(:,:,:) => null()
118 : : real(dp), pointer :: dmatpawu(:,:,:,:) => null()
119 : : real(dp), pointer :: phnons(:,:,:) => null()
120 : : real(dp), pointer :: pwnsfac(:,:) => null()
121 : : real(dp), pointer :: ylm(:,:) => null()
122 : : real(dp), pointer :: ylmgr(:,:,:) => null()
123 : : real(dp), pointer :: cg(:,:) => null()
124 : : real(dp), pointer :: eigen(:) => null()
125 : : real(dp), pointer :: occ(:) => null()
126 : : !real(dp), pointer :: rprimd(:,:) => null()
127 : : !real(dp), pointer :: rhog(:,:) => null()
128 : : !real(dp), pointer :: rhor(:,:) => null()
129 : : real(dp), pointer :: taug(:,:) => null()
130 : : real(dp), pointer :: taur(:,:) => null()
131 : : real(dp), pointer :: resid(:) => null()
132 : : type(pawrad_type), pointer :: pawrad(:) => null()
133 : : type(pawtab_type), pointer :: pawtab(:) => null()
134 : : type(macro_uj_type),pointer :: dtpawuj(:) => null()
135 : : type(pawrhoij_type), pointer :: pawrhoij(:) => null()
136 : : type(pawcprj_type),pointer :: cprj(:,:) => null()
137 : : ! PRIVATE ATTRIBUTS
138 : : type(entropyDMFT_t), private :: entropyDMFT
139 : : end type scfcv_t
140 : : !!***
141 : :
142 : : ! *************************************************************************
143 : :
144 : : contains
145 : : !!***
146 : :
147 : :
148 : : !!****f* ABINIT/m_scfcv/scfcv_init
149 : : !! NAME
150 : : !! scfcv_init
151 : : !!
152 : : !! FUNCTION
153 : : !! FIXME: add description.
154 : : !!
155 : : !! INPUTS
156 : : !! scfcv=structure of scfcv
157 : : !! argin(sizein)=description
158 : : !!
159 : : !! OUTPUT
160 : : !!
161 : : !! SOURCE
162 : :
163 : 5664 : subroutine scfcv_init(this,atindx,atindx1,cg,cprj,cpus,&
164 : 11328 : & dmatpawu,dtefield,dtfil,dtpawuj,dtset,ecore,eigen,hdr,extfpmd,rcpaw,&
165 : 11328 : & indsym,initialized,irrzon,kg,mcg,mcprj,mpi_enreg,my_natom,nattyp,ndtpawuj,&
166 : 11328 : & nfftf,npwarr,occ,pawang,pawfgr,pawrad,pawrhoij,&
167 : 5664 : & pawtab,phnons,psps,pwind,pwind_alloc,pwnsfac,rec_set,&
168 : 5664 : & resid,results_gs,scf_history,fatvshift,&
169 [ - + ]: 5664 : & symrec,taug,taur,wvl,ylm,ylmgr,paw_dmft,wffnew,wffnow,xg_nonlop)
170 : :
171 : :
172 : : !Arguments ------------------------------------
173 : : !scalars
174 : : type(scfcv_t), intent(inout) :: this
175 : : integer,intent(in),target :: mcg,mcprj,my_natom,ndtpawuj,pwind_alloc
176 : : integer,intent(in),target :: initialized,nfftf
177 : : real(dp),intent(in),target :: cpus,ecore
178 : : real(dp),intent(in),target :: fatvshift
179 : : type(MPI_type),intent(in),target :: mpi_enreg
180 : : type(datafiles_type),intent(in),target :: dtfil
181 : : type(dataset_type),intent(in),target :: dtset
182 : : type(efield_type),intent(in),target :: dtefield
183 : : ! type(electronpositron_type),pointer :: electronpositron
184 : : type(hdr_type),intent(in),target :: hdr
185 : : type(extfpmd_type),intent(in),pointer :: extfpmd
186 : : type(rcpaw_type),intent(in),pointer :: rcpaw
187 : : type(pawang_type),intent(in),target :: pawang
188 : : type(pawfgr_type),intent(in),target :: pawfgr
189 : : type(pseudopotential_type),intent(in),target :: psps
190 : : type(recursion_type),intent(in),target :: rec_set
191 : : type(results_gs_type),intent(in),target :: results_gs
192 : : type(scf_history_type),intent(in),target :: scf_history
193 : : ! type(wffile_type),intent(in),target :: wffnew,wffnow
194 : : type(wvl_data),intent(in),target :: wvl
195 : : !arrays
196 : : integer,intent(in),target :: atindx(dtset%natom),atindx1(dtset%natom)
197 : : integer,intent(in),target :: indsym(4,dtset%nsym,dtset%natom)
198 : : !no_abirules
199 : : integer, intent(in),target :: irrzon(dtset%nfft**(1-1/dtset%nsym),2,(dtset%nspden/dtset%nsppol)-3*(dtset%nspden/4))
200 : : integer, intent(in),target :: kg(3,dtset%mpw*dtset%mkmem)
201 : : integer, intent(in),target :: nattyp(psps%ntypat),npwarr(dtset%nkpt),pwind(pwind_alloc,2,3)
202 : : integer, intent(in),target :: symrec(3,3,dtset%nsym)
203 : : real(dp), intent(in),target :: cg(2,mcg),dmatpawu(:,:,:,:)
204 : : real(dp), intent(in),target :: eigen(dtset%mband*dtset%nkpt*dtset%nsppol)
205 : : real(dp), intent(in),target :: occ(dtset%mband*dtset%nkpt*dtset%nsppol)
206 : : real(dp), intent(in),target :: phnons(2,dtset%nfft**(1-1/dtset%nsym),(dtset%nspden/dtset%nsppol)-3*(dtset%nspden/4))
207 : : real(dp), intent(in),target :: pwnsfac(2,pwind_alloc)
208 : : ! real(dp), intent(in),target :: rprimd(3,3)
209 : : ! real(dp), pointer :: rhog(:,:),rhor(:,:)
210 : : real(dp), pointer :: taug(:,:),taur(:,:)
211 : : real(dp), intent(in),target :: resid(dtset%mband*dtset%nkpt*dtset%nsppol)
212 : : ! real(dp), intent(in),target :: xred(3,dtset%natom),xred_old(3,dtset%natom)
213 : : real(dp), intent(in),target :: ylm(dtset%mpw*dtset%mkmem,psps%mpsang*psps%mpsang*psps%useylm)
214 : : real(dp), intent(in),target :: ylmgr(dtset%mpw*dtset%mkmem,3,psps%mpsang*psps%mpsang*psps%useylm)
215 : : type(macro_uj_type),intent(in),target :: dtpawuj(0:ndtpawuj)
216 : : type(pawrhoij_type), intent(in),target :: pawrhoij(my_natom*psps%usepaw)
217 : : type(pawrad_type), intent(in),target :: pawrad(psps%ntypat*psps%usepaw)
218 : : type(pawtab_type), intent(in),target :: pawtab(psps%ntypat*psps%usepaw)
219 : : !type(dataset_type),intent(in),target :: dtset
220 : : ! type(electronpositron_type),intent(in),target :: electronpositron
221 : : type(paw_dmft_type), intent(in),target :: paw_dmft
222 : : type(wffile_type),intent(in),target :: wffnew,wffnow
223 : : type(pawcprj_type), allocatable,intent(in),target :: cprj(:,:)
224 : : type(xg_nonlop_t),intent(inout),target :: xg_nonlop
225 : : !Local variables -------------------------
226 : : !scalars
227 : : logical :: DEBUG=.FALSE.
228 : : ! *************************************************************************
229 : :
230 : : DBG_ENTER("COLL")
231 : :
232 [ - + ]: 5664 : if (DEBUG) then
233 : 0 : write(std_out,*) 'INTENT(IN) ARGUMENTS ON SCFCV'
234 : : ! write(std_out,*) 'atindx=',ab_scfcv_in%atindx
235 : : ! write(std_out,*) 'atindx1=',ab_scfcv_in%atindx1
236 : : ! write(std_out,*) 'cpus=',ab_scfcv_in%cpus
237 : : ! write(std_out,*) 'ecore=',ab_scfcv_in%ecore
238 : : ! write(std_out,*) 'fatvshift=',ab_scfcv_in%fatvshift
239 : : ! write(std_out,*) 'indsym=',ab_scfcv_in%indsym
240 : : ! write(std_out,*) 'kg=',ab_scfcv_in%kg
241 : : ! write(std_out,*) 'my_natom=',ab_scfcv_in%my_natom
242 : : ! write(std_out,*) 'nattyp=',ab_scfcv_in%nattyp
243 : : ! write(std_out,*) 'ndtpawuj=',ab_scfcv_in%ndtpawuj
244 : : ! write(std_out,*) 'npwarr=',ab_scfcv_in%npwarr
245 : : ! write(std_out,*) 'phnons=',ab_scfcv_in%phnons
246 : : ! write(std_out,*) 'pwind=',ab_scfcv_in%pwind
247 : : ! write(std_out,*) 'pwind_alloc=',ab_scfcv_in%pwind_alloc
248 : : ! write(std_out,*) 'pwnsfac=',ab_scfcv_in%pwnsfac
249 : : ! write(std_out,*) 'ylm=',ab_scfcv_in%ylm
250 : : ! write(std_out,*) 'ylmgr=',ab_scfcv_in%ylmgr
251 : : !! write(std_out,*) 'pawang=',ab_scfcv_in%pawang
252 : : !! write(std_out,*) 'pawrad=',ab_scfcv_in%pawrad
253 : : !! write(std_out,*) 'pawtab=',ab_scfcv_in%pawtab
254 : : !! write(std_out,*) 'psps=',ab_scfcv_in%psps
255 : : end if
256 : :
257 : 5664 : this%atindx=>atindx
258 : 5664 : this%atindx1=>atindx1
259 : 5664 : this%cpus=>cpus
260 : 5664 : this%ecore=>ecore
261 : 5664 : this%fatvshift=>fatvshift
262 : 5664 : this%indsym=>indsym
263 : 5664 : this%kg=>kg
264 : 5664 : this%mcg=>mcg
265 : 5664 : this%mcprj=>mcprj
266 : 5664 : this%my_natom=>my_natom
267 : 5664 : this%nattyp=>nattyp
268 : 5664 : this%ndtpawuj=>ndtpawuj
269 : 5664 : this%npwarr=>npwarr
270 : 5664 : this%pawang=>pawang
271 : 5664 : this%pawrad=>pawrad
272 : 5664 : this%pawtab=>pawtab
273 : 5664 : this%phnons=>phnons
274 : 5664 : this%psps=>psps
275 : 5664 : this%pwind=>pwind
276 : 5664 : this%pwind_alloc=>pwind_alloc
277 : 5664 : this%pwnsfac=>pwnsfac
278 : 5664 : this%ylm=>ylm
279 : 5664 : this%ylmgr=>ylmgr
280 : :
281 : 5664 : this%cg=>cg
282 : 5664 : this%cprj=>cprj
283 : 5664 : this%dmatpawu=>dmatpawu
284 : 5664 : this%dtefield=>dtefield
285 : 5664 : this%dtfil=>dtfil
286 : 5664 : this%dtpawuj=>dtpawuj
287 : 5664 : this%eigen=>eigen
288 : 5664 : this%hdr=>hdr
289 : 5664 : this%extfpmd=>extfpmd
290 : 5664 : this%rcpaw=>rcpaw
291 : 5664 : this%initialized=>initialized
292 : 5664 : this%irrzon=>irrzon
293 : 5664 : this%mpi_enreg=>mpi_enreg
294 : 5664 : this%nfftf=>nfftf
295 : 5664 : this%occ=>occ
296 : 5664 : this%pawfgr=>pawfgr
297 : 5664 : this%pawrhoij=>pawrhoij
298 : 5664 : this%pawtab=>pawtab
299 : 5664 : this%rec_set=>rec_set
300 : 5664 : this%resid=>resid
301 : 5664 : this%results_gs=>results_gs
302 : 5664 : this%scf_history=>scf_history
303 : 5664 : this%symrec=>symrec
304 : 5664 : this%taug=>taug
305 : 5664 : this%taur=>taur
306 : 5664 : this%wvl=>wvl
307 : :
308 : 5664 : this%dtset=>dtset
309 : : !this%electronpositron=>electronpositron
310 : 5664 : this%paw_dmft=>paw_dmft
311 : : !this%rhog=>rhog
312 : : !this%rhor=>rhor
313 : : !this%rprimd=>rprimd
314 : 5664 : this%wffnew=>wffnew
315 : 5664 : this%wffnow=>wffnow
316 : : !this%xred=>xred
317 : : !this%xred_old=>xred_old
318 : 5664 : this%xg_nonlop=>xg_nonlop
319 : :
320 : :
321 : : !!!!!!!!! INITIALIZE or REINITIALIZE parallelization here !!
322 : : ! TODO at next step
323 : : !if ( this%dtset%usedmft /= 0 ) then
324 : : ! call data4entropyDMFT_init(this%paw_dmft%forentropyDMFT,&
325 : : ! this%dtset%natom,&
326 : : ! this%dtset%typat,&
327 : : ! this%dtset%lpawu,&
328 : : ! this%dtset%dmft_t2g==1, &
329 : : ! this%dtset%upawu,& !!! Should use this%pawtab%upawu
330 : : ! this%dtset%jpawu) !!! Should use this%pawtab%jpawu
331 : : !end if
332 : :
333 : : !call entropyDMFT_init(this%entropyDMFT,this%dtset,this%pawtab,this%mpi_enreg%comm_cell,this%dtfil%filnam_ds(3),this%dtfil%filnam_ds(4)) ! Do something only if DMFT and dmft_entropy = 1
334 : :
335 : : DBG_EXIT("COLL")
336 : :
337 : 5664 : end subroutine scfcv_init
338 : : !!***
339 : :
340 : :
341 : : !!****f* ABINIT/m_scfcv/scfcv_destroy
342 : : !! NAME
343 : : !! scfcv_destroy
344 : : !!
345 : : !! FUNCTION
346 : : !! FIXME: add description.
347 : : !!
348 : : !! INPUTS
349 : : !! scfcv=structure of scfcv
350 : : !!
351 : : !! SOURCE
352 : :
353 : 5708 : subroutine scfcv_destroy(this)
354 : :
355 : : !Arguments ------------------------------------
356 : : type(scfcv_t), intent(inout) :: this
357 : :
358 : : !Local variables-------------------------------
359 : :
360 : : ! *************************************************************************
361 : :
362 : : DBG_ENTER("COLL")
363 : :
364 : : !scalars
365 : 5708 : this%mcg => null()
366 : 5708 : this%mcprj => null()
367 : 5708 : this%my_natom => null()
368 : 5708 : this%ndtpawuj => null()
369 : 5708 : this%pwind_alloc => null()
370 : 5708 : this%initialized => null()
371 : 5708 : this%nfftf => null()
372 : 5708 : this%cpus => null()
373 : 5708 : this%ecore => null()
374 : 5708 : this%fatvshift => null()
375 : 5708 : this%pawang => null()
376 : 5708 : this%psps => null()
377 : 5708 : this%mpi_enreg => null()
378 : 5708 : this%dtfil => null()
379 : 5708 : this%dtset => null()
380 : 5708 : this%dtefield => null()
381 : 5708 : this%electronpositron => null()
382 : 5708 : this%hdr => null()
383 : 5708 : this%extfpmd => null()
384 : 5708 : this%rcpaw=>null()
385 : 5708 : this%pawfgr => null()
386 : 5708 : this%rec_set => null()
387 : 5708 : this%results_gs => null()
388 : 5708 : this%scf_history => null()
389 : 5708 : this%wffnew => null()
390 : 5708 : this%wffnow => null()
391 : 5708 : this%wvl => null()
392 : 5708 : this%paw_dmft => null()
393 : :
394 : : !arrays
395 : 5708 : this%atindx => null()
396 : 5708 : this%atindx1 => null()
397 : 5708 : this%irrzon => null()
398 : 5708 : this%symrec => null()
399 : 5708 : this%indsym => null()
400 : : !no_abirules
401 : 5708 : this%kg => null()
402 : 5708 : this%nattyp => null()
403 : 5708 : this%npwarr => null()
404 : 5708 : this%pwind => null()
405 : 5708 : this%phnons => null()
406 : 5708 : this%pwnsfac => null()
407 : 5708 : this%ylm => null()
408 : 5708 : this%ylmgr => null()
409 : 5708 : this%cg => null()
410 : 5708 : this%cprj => null()
411 : 5708 : this%dmatpawu => null()
412 : 5708 : this%eigen => null()
413 : 5708 : this%occ => null()
414 : : !this%rprimd
415 : : !this%rhog => null()
416 : : !this%rhor => null()
417 : 5708 : this%taug => null()
418 : 5708 : this%taur => null()
419 : 5708 : this%resid => null()
420 : 5708 : this%pawrad => null()
421 : 5708 : this%pawtab => null()
422 : 5708 : this%dtpawuj => null()
423 : 5708 : this%pawrhoij => null()
424 : 5708 : this%xg_nonlop=>null()
425 : :
426 : : ! This call should be done inside destroy_sc_dmft
427 : : !if ( this%dtset%usedmft /= 0 ) then
428 : : ! call data4entropyDMFT_destroy(this%paw_dmft%forentropyDMFT)
429 : : !end if
430 : : !call entropyDMFT_destroy(this%entropyDMFT)
431 : :
432 : : DBG_EXIT("COLL")
433 : :
434 : 5708 : end subroutine scfcv_destroy
435 : : !!***
436 : :
437 : : !!****f* ABINIT/m_scfcv/scfcv_run
438 : : !! NAME
439 : : !! scfcv_run
440 : : !!
441 : : !! FUNCTION
442 : : !! FIXME: add description.
443 : : !!
444 : : !! INPUTS
445 : : !! itimes(2)=itime array, contain itime=itimes(1) and itimimage_gstate=itimes(2) from outer loops
446 : : !! scfcv=structure of scfcv
447 : : !!
448 : : !! OUTPUT
449 : : !!
450 : : !! SOURCE
451 : :
452 : 6947 : subroutine scfcv_run(this, electronpositron, itimes, rhog, rhor, rprimd, xred, xred_old, conv_retcode)
453 : :
454 : : !Arguments ------------------------------------
455 : : type(scfcv_t), intent(inout) :: this
456 : : integer,intent(in) :: itimes(2)
457 : : type(electronpositron_type),pointer:: electronpositron
458 : : real(dp), intent(inout) :: rprimd(3,3)
459 : : real(dp), intent(inout) :: xred(3,this%dtset%natom)
460 : : real(dp), intent(inout) :: xred_old(3,this%dtset%natom)
461 : : real(dp), pointer, intent(inout) :: rhog(:,:)
462 : : real(dp), pointer, intent(inout) :: rhor(:,:)
463 : : integer ,intent(out) :: conv_retcode
464 : :
465 : : !Local variables-------------------------------
466 : :
467 : : ! *************************************************************************
468 : :
469 : : DBG_ENTER("COLL")
470 : :
471 : : !!! Should be changed if special parallelization.
472 : :
473 : : ! Moved inside mover.F90 before this call
474 : : !call scfcv_reformatWFK(this,rhog, rhor, rprimd, xred, xred_old)
475 : :
476 : : ! First initialize the datatype to gather information
477 : :
478 : : !debug purpose
479 : : !this%electronpositron => electronpositron
480 [ + + ]: 6947 : if ( this%dtset%dmft_entropy == 0 ) then
481 : 6944 : call scfcv_scfcv(this, electronpositron, itimes, rhog, rhor, rprimd, xred, xred_old, conv_retcode)
482 [ + - ]: 3 : elseif ( this%dtset%dmft_entropy >=1 ) then
483 : 3 : call scfcv_runWEntropyDMFT(this, electronpositron,itimes, rhog,rhor,rprimd,xred,xred_old,conv_retcode)
484 : : end if
485 : :
486 : : DBG_EXIT("COLL")
487 : :
488 : 6947 : end subroutine scfcv_run
489 : : !!***
490 : :
491 : :
492 : : !!!!****f* ABINIT/m_scfcv/scfcv_reformatWFK
493 : : !!!! NAME
494 : : !!!! scfcv_reformatWFK
495 : : !!!!
496 : : !!!! FUNCTION
497 : : !!!! FIXME: add description.
498 : : !!!!
499 : : !!!! INPUTS
500 : : !!!! scfcv=structure of scfcv
501 : : !!!! argin(sizein)=description
502 : : !!!!
503 : : !!!! OUTPUT
504 : : !!!! argout(sizeout)=description
505 : : !!!!
506 : : !!!! SIDE EFFECTS
507 : : !!!!
508 : : !!!! NOTES
509 : : !!!!
510 : : !!!! SOURCE
511 : : !!
512 : : !!subroutine scfcv_reformatWFK(this,rhog, rhor, rprimd, xred, xred_old)
513 : : !!
514 : : !!
515 : : !! type(scfcv_t), intent(inout) :: this
516 : : !! real(dp), intent(inout) :: xred(3,this%dtset%natom)
517 : : !! real(dp), intent(inout) :: xred_old(3,this%dtset%natom)
518 : : !! real(dp), intent(inout) :: rprimd(3,3)
519 : : !! real(dp), pointer, intent(inout) :: rhog(:,:)
520 : : !! real(dp), pointer, intent(inout) :: rhor(:,:)
521 : : !!
522 : : !!!WVL - reformat the wavefunctions in the case of xred != xred_old
523 : : !! if (this%dtset%usewvl == 1 .and. maxval(xred_old - xred) > zero) then
524 : : !!! WVL - Before running scfcv, on non-first geometry step iterations,
525 : : !!! we need to reformat the wavefunctions, taking into acount the new
526 : : !!! coordinates.
527 : : !!! We prepare to change rhog (to be removed) and rhor.
528 : : !! ABI_FREE(rhog)
529 : : !! ABI_FREE(rhor)
530 : : !!
531 : : !! call wvl_wfsinp_reformat(this%dtset, this%mpi_enreg,&
532 : : !!& this%psps, rprimd, this%wvl, xred, xred_old)
533 : : !! this%nfftf = this%dtset%nfft
534 : : !!
535 : : !! ABI_MALLOC(rhog,(2, this%dtset%nfft))
536 : : !! ABI_MALLOC(rhor,(2, this%dtset%nfft))
537 : : !! call wvl_mkrho(this%dtset, this%irrzon, this%mpi_enreg,&
538 : : !!& this%phnons, rhor,this%wvl%wfs,this%wvl%den)
539 : : !! end if
540 : : !!
541 : : !!end subroutine scfcv_reformatWFK
542 : : !!!!***
543 : :
544 : : !!****f* ABINIT/m_scfcv/scfcv_runWEntropyDMFT
545 : : !! NAME
546 : : !! scfcv_runWEntropyDMFT
547 : : !!
548 : : !! FUNCTION
549 : : !! FIXME: add description.
550 : : !!
551 : : !! INPUTS
552 : : !! itimes(2)=itime array, contain itime=itimes(1) and itimimage_gstate=itimes(2) from outer loops
553 : : !! scfcv=structure of scfcv
554 : : !! argin(sizein)=description
555 : : !!
556 : : !! OUTPUT
557 : : !! argout(sizeout)=description
558 : : !!
559 : : !! SIDE EFFECTS
560 : : !!
561 : : !! NOTES
562 : : !!
563 : : !! SOURCE
564 : :
565 : 3 : subroutine scfcv_runWEntropyDMFT(this,electronpositron,itimes,rhog,rhor,rprimd,xred,xred_old,conv_retcode)
566 : :
567 : :
568 : : !Arguments ------------------------------------
569 : : type(scfcv_t), intent(inout) :: this
570 : : integer,intent(in) :: itimes(2)
571 : : type(electronpositron_type),pointer :: electronpositron
572 : : real(dp), intent(inout) :: rprimd(3,3)
573 : : real(dp), intent(inout) :: xred(3,this%dtset%natom)
574 : : real(dp), intent(inout) :: xred_old(3,this%dtset%natom)
575 : : real(dp), pointer, intent(inout) :: rhog(:,:)
576 : : real(dp), pointer, intent(inout) :: rhor(:,:)
577 : : integer , intent(out) :: conv_retcode
578 : :
579 : : !Local variables-------------------------------
580 : :
581 : : ! *************************************************************************
582 : :
583 : : DBG_ENTER("COLL")
584 : :
585 : : !if ( this%dtset%usedmft /= 0 ) then
586 : : ! call data4entropyDMFT_init(this%paw_dmft%forentropyDMFT,&
587 : : ! this%dtset%natom,&
588 : : ! this%dtset%typat,&
589 : : ! this%dtset%lpawu,&
590 : : ! this%dtset%dmft_t2g==1, &
591 : : ! this%dtset%upawu,& !!! Should use this%pawtab%upawu
592 : : ! this%dtset%jpawu) !!! Should use this%pawtab%jpawu
593 : : !end if
594 : :
595 : : call entropyDMFT_init(this%entropyDMFT,this%dtset,this%pawtab,this%mpi_enreg%comm_cell,&
596 : 3 : & this%dtfil%filnam_ds(3),this%dtfil%filnam_ds(4)) ! Do something only if DMFT and dmft_entropy = 1
597 : :
598 : : ! Start loop over all integration points (lambda)
599 : : ! TODO WORK ON PARALLELISATION HERE
600 [ + + ]: 12 : do while (entropyDMFT_nextLambda(this%entropyDMFT,this%dtset,this%pawtab,this%pawang,this%pawrad))
601 : :
602 : : !-----------------------------------------------------
603 : 9 : call scfcv_scfcv(this, electronpositron,itimes,rhog,rhor,rprimd,xred,xred_old,conv_retcode)
604 : : !-----------------------------------------------------
605 : 9 : call entropyDMFT_addIntegrand(this%entropyDMFT,this%dtset, this%results_gs%energies,this%paw_dmft%forentropyDMFT)
606 : :
607 : : end do !!! End loop for entropy DMFT
608 : :
609 : : ! GATHER DATA HERE OR INSIDE THE NEXT CALL ?
610 : 3 : call entropyDMFT_computeEntropy(this%entropyDMFT,this%results_gs%energies%entropy_ks)
611 : : !-----------------------------------------------------
612 : : ! This call should be done inside destroy_sc_dmft
613 : : !if ( this%dtset%usedmft /= 0 ) then
614 : : ! call data4entropyDMFT_destroy(this%paw_dmft%forentropyDMFT)
615 : : !end if
616 : 3 : call entropyDMFT_destroy(this%entropyDMFT)
617 : :
618 : : DBG_EXIT("COLL")
619 : :
620 : 3 : end subroutine scfcv_runWEntropyDMFT
621 : : !!***
622 : :
623 : : !!****f* ABINIT/m_scfcv/scfcv_scfcv
624 : : !! NAME
625 : : !! scfcv_scfcv
626 : : !!
627 : : !! FUNCTION
628 : : !! FIXME: add description.
629 : : !!
630 : : !! INPUTS
631 : : !! scfcv=structure of scfcv
632 : : !! itimes(2)=itime array, contain itime=itimes(1) and itimimage_gstate=itimes(2) from outer loops
633 : : !!
634 : : !! NOTES
635 : : !! Wrapper to scfcv to avoid circular dependencies ...
636 : : !!
637 : : !! SOURCE
638 : :
639 : 6953 : subroutine scfcv_scfcv(this, electronpositron, itimes, rhog, rhor, rprimd, xred, xred_old, conv_retcode)
640 : :
641 : : type(scfcv_t), intent(inout) :: this
642 : : integer,intent(in) :: itimes(2)
643 : : type(electronpositron_type),pointer :: electronpositron
644 : : real(dp), intent(inout) :: rprimd(3,3)
645 : : real(dp), intent(inout) :: xred(3,this%dtset%natom)
646 : : real(dp), intent(inout) :: xred_old(3,this%dtset%natom)
647 : : real(dp), pointer, intent(inout) :: rhog(:,:)
648 : : real(dp), pointer, intent(inout) :: rhor(:,:)
649 : : integer , intent(out) :: conv_retcode
650 : :
651 : : call scfcv_core(this%atindx,this%atindx1,this%cg,this%cprj,this%cpus,this%dmatpawu,this%dtefield,this%dtfil,&
652 : : this%dtpawuj,&
653 : : this%dtset,this%ecore,this%eigen,electronpositron,this%fatvshift,this%hdr,this%extfpmd,this%rcpaw,this%indsym,&
654 : : this%initialized,this%irrzon,itimes,this%kg,this%mcg,this%mcprj,this%mpi_enreg,this%my_natom,this%nattyp,this%ndtpawuj,&
655 : : this%nfftf,this%npwarr,&
656 : : this%occ,this%paw_dmft,this%pawang,this%pawfgr,this%pawrad,this%pawrhoij,this%pawtab,this%phnons,this%psps,this%pwind,&
657 : : this%pwind_alloc,this%pwnsfac,this%rec_set,this%resid,this%results_gs,rhog,rhor,rprimd,&
658 : : this%scf_history,this%symrec,this%taug,this%taur,this%wffnew,this%wvl,this%xg_nonlop,xred,xred_old,this%ylm,this%ylmgr,&
659 [ + - - - : 6953 : conv_retcode)
- - + - -
- - - + -
- - - - -
- + - - -
- - + - -
- - - + -
- - - - -
- - - + -
- - - - -
- - - + -
- - - - -
- + - - -
- - + - -
- - - + -
- - - - +
- - - - -
+ - - - -
- + - - -
- - + - -
- - - - -
- - + - -
- - - - -
- - + - -
- - - - -
+ - - - -
- + - - -
- - - - -
- + - - -
- - - - +
- - - - -
- - - - -
+ - + - +
- - - - -
+ - - - -
- - - - -
- - - - -
- - - + -
- - + - +
- + - + -
+ - + - -
- + - + -
- - - - -
- - - - -
- - - - +
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - +
- + - + -
+ - - - +
- + - + ]
660 : :
661 : 6953 : end subroutine scfcv_scfcv
662 : :
663 [ # # # # : 0 : end module m_scfcv
# # # # #
# # # # #
# # # # #
# # # # #
# # # # ]
664 : : !!***
|