Line data Source code
1 : !!****m* ABINIT/m_invars1
2 : !! NAME
3 : !! m_invars1
4 : !!
5 : !! FUNCTION
6 : !!
7 : !!
8 : !! COPYRIGHT
9 : !! Copyright (C) 1998-2026 ABINIT group (DCA, XG, GMR, AR, MKV, FF, MM)
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_invars1
23 :
24 : use defs_basis
25 : use m_abicore
26 : use m_xmpi
27 : use m_errors
28 : use m_atomdata
29 : use m_dtset
30 : use m_nctk
31 : use m_xomp
32 : use netcdf
33 : use m_gwdefs
34 : #if defined DEV_YP_VDWXC
35 : use m_xc_vdw
36 : #endif
37 : #if defined HAVE_GPU
38 : use m_gpu_toolbox
39 : #endif
40 :
41 : use m_fstrings, only : inupper, itoa, endswith, strcat, sjoin, startswith
42 : use m_geometry, only : mkrdim, cart2spinaxis
43 : use m_parser, only : intagm, intagm_img, chkint_ge, ab_dimensions, geo_t, geo_from_abivar_string
44 : use m_inkpts, only : inkpts, inqpt
45 : use m_ingeo, only : ingeo, invacuum, checkspvec
46 : use m_matrix, only : mati3det
47 : use m_mep, only : MEP_SOLVER_STEEPEST,NEB_ALGO_IMPROVED_TAN,NEB_CELL_ALGO_NONE,STRING_ALGO_SIMPLIFIED_EQUAL
48 : use m_fftcore, only : get_cache_kb, fftalg_for_npfft
49 :
50 : implicit none
51 :
52 : private
53 : !!***
54 :
55 : public :: invars0
56 : public :: invars1
57 : public :: invars1m
58 : public :: indefo
59 : !!***
60 :
61 : contains
62 : !!***
63 :
64 : !!****f* ABINIT/invars0
65 : !! NAME
66 : !! invars0
67 : !!
68 : !! FUNCTION
69 : !! Initialisation phase: prepare the main input subroutine call by
70 : !! reading most of the NO MULTI variables, as well as natom, nimage, and ntypat,
71 : !! needed for allocating some input arrays in abinit, and also useri
72 : !! and userr. The variable usewvl is also read here for later reading
73 : !! of input path for the atomic orbital file (if required).
74 : !! Also initialize as soon as possible GPU related parameters
75 : !!
76 : !! INPUTS
77 : !! lenstr=actual length of string
78 : !! ndtset= number of datasets to be read; if 0, no multi-dataset mode
79 : !! ndtset_alloc=number of datasets, corrected for allocation of at least one data set.
80 : !! string*(*)=string of characters containing all input variables and data
81 : !! comm= MPI communicator
82 : !!
83 : !! OUTPUT
84 : !! dtsets(0:ndtset_alloc)=<type datafiles_type>contains all input variables,
85 : !! some of which are initialized here:
86 : !! cpus,jdtset,natom,nimage,npsp,ntypat,useri*,userr*
87 : !! istatr=repetition rate for status file
88 : !! istatshft=shift of the repetition rate for status file
89 : !! msym=maximal value of input msym for all the datasets
90 : !! mxnatom=maximal value of input natom for all the datasets
91 : !! mxnimage=maximal value of input nimage for all the datasets
92 : !! mxntypat=maximal value of input ntypat for all the datasets
93 : !! npsp=number of pseudopotentials
94 : !! pseudo_paths(npsp): List of paths to pseudopotential files as read from input file.
95 : !! List of empty strings if we are legacy "files file" mode. Allocated here, caller should free memory.
96 : !!
97 : !! SOURCE
98 :
99 1440 : subroutine invars0(dtsets, istatr, istatshft, lenstr, msym, mxnatom, mxnimage, mxntypat, ndtset, ndtset_alloc, &
100 : npsp, pseudo_paths, papiopt, timopt, string, comm)
101 :
102 : !Arguments ------------------------------------
103 : !scalars
104 : integer,intent(in) :: lenstr,ndtset,ndtset_alloc, comm
105 : integer,intent(out) :: istatr,istatshft,msym,mxnatom,mxnimage,mxntypat,npsp,papiopt
106 : integer,intent(inout) :: timopt
107 : character(len=*),intent(in) :: string
108 : !arrays
109 : type(dataset_type),intent(inout) :: dtsets(0:ndtset_alloc) !vz_i
110 : character(len=fnlen),allocatable,intent(out) :: pseudo_paths(:)
111 :
112 : !Local variables-------------------------------
113 : !scalars
114 : integer :: i1,i2,idtset,ii,jdtset,marr,multiplicity,tjdtset,tread,treadh,treadm
115 : integer :: tread_pseudos,cnt,tread_geo,tread_gpu_option,treads, idev,gpu_option
116 : real(dp) :: cpus
117 : character(len=500) :: msg
118 : character(len=fnlen) :: pp_dirpath,gpu_option_string
119 : character(len=20*fnlen) :: pseudos_string ! DO NOT decrease len
120 1440 : character(len=len(string)) :: geo_string
121 1440 : type(geo_t) :: geo
122 : !arrays
123 1440 : integer,allocatable :: intarr(:), sidx(:)
124 1440 : real(dp),allocatable :: dprarr(:)
125 : !******************************************************************
126 :
127 : !write(std_out,"(3a)")" m_invars1%invars0 : enter with string:", ch10, trim(string)
128 :
129 1440 : marr=max(9,ndtset_alloc,2)
130 4320 : ABI_MALLOC(dprarr,(marr))
131 4320 : ABI_MALLOC(intarr,(marr))
132 :
133 : ! Set up jdtset
134 1440 : if (ndtset/=0) then
135 : ! Default values
136 1027 : dtsets(0)%jdtset = -1 ! unused value
137 14137 : dtsets(1:ndtset_alloc)%jdtset=(/ (ii,ii=1,ndtset_alloc) /)
138 :
139 : ! Read explicitly the jdtset array
140 1027 : call intagm(dprarr,intarr,0,marr,ndtset,string(1:lenstr),'jdtset',tjdtset,'INT')
141 1549 : if(tjdtset==1) dtsets(1:ndtset)%jdtset=intarr(1:ndtset)
142 :
143 : ! Read the udtset array
144 1027 : call intagm(dprarr,intarr,0,marr,2,string(1:lenstr),'udtset',tread,'INT')
145 :
146 : ! jdtset and udtset cannot be defined together
147 1027 : if(tjdtset==1 .and. tread==1)then
148 : write(msg, '(3a)' )&
149 0 : 'jdtset and udtset cannot be defined both in the input file.',ch10,&
150 0 : 'Action: remove one of them from your input file.'
151 0 : ABI_ERROR(msg)
152 : end if
153 :
154 : ! Check values of udtset
155 1027 : if(tread==1)then
156 55 : if(intarr(1)<1 .or. intarr(1)>999)then
157 : write(msg, '(a,i0,3a)' )&
158 0 : 'udtset(1) must be between 1 and 999, but it is ',intarr(1),'.',ch10,&
159 0 : 'Action: change the value of udtset(1) in your input file.'
160 0 : ABI_ERROR(msg)
161 : end if
162 55 : if(intarr(2)<1 .or. intarr(2)>9)then
163 : write(msg, '(a,i0,3a)' )&
164 0 : 'udtset(2) must be between 1 and 9, but it is ',intarr(2),'.',ch10,&
165 0 : 'Action: change the value of udtset(2) in your input file.'
166 0 : ABI_ERROR(msg)
167 : end if
168 55 : if(intarr(1)*intarr(2) /= ndtset)then
169 : write(msg, '(3a,i0,3a,i0,a,i0,3a,i0,3a)' )&
170 0 : 'udtset(1)*udtset(2) must be equal to ndtset,',ch10,&
171 0 : 'but it is observed that udtset(1) = ',intarr(1),',',ch10,&
172 0 : 'and udtset(2) = ',intarr(2),' so that their product is ',intarr(1)*intarr(2),',',ch10,&
173 0 : 'while ndtset is ',ndtset,'.',ch10,&
174 0 : 'Action: change udtset or ndtset in your input file.'
175 0 : ABI_ERROR(msg)
176 : end if
177 55 : idtset=0
178 359 : do i1=1,intarr(1)
179 1219 : do i2=1,intarr(2)
180 860 : idtset=idtset+1
181 1164 : dtsets(idtset)%jdtset=i1*10+i2
182 : end do
183 : end do
184 : end if
185 :
186 : ! Final check on the jdtset values
187 7582 : do idtset=1,ndtset
188 7582 : if(dtsets(idtset)%jdtset<1 .or. dtsets(idtset)%jdtset>9999)then
189 : write(msg, '(3a,i0,a,i0,a,a)' )&
190 0 : 'The components of jdtset must be between 1 and 9999.',ch10,&
191 0 : 'However, the input value of the component ',idtset,' of jdtset is ',dtsets(idtset)%jdtset,ch10,&
192 0 : 'Action: correct jdtset in your input file.'
193 0 : ABI_ERROR(msg)
194 : end if
195 : end do
196 :
197 : else
198 413 : dtsets(1)%jdtset=0
199 : end if
200 :
201 1440 : papiopt = 0
202 1440 : call intagm(dprarr,intarr,0,1,1,string(1:lenstr),'papiopt',tread,'INT')
203 1440 : if(tread==1) papiopt=intarr(1)
204 :
205 : ! Read timopt and pass it to timab
206 1440 : call intagm(dprarr,intarr,0,1,1,string(1:lenstr),'timopt',tread,'INT')
207 1440 : if(tread==1) timopt=intarr(1)
208 :
209 1440 : istatr=0
210 1440 : dtsets(0)%istatr=istatr
211 1440 : call intagm(dprarr,intarr,0,marr,1,string(1:lenstr),'istatr',tread,'INT')
212 1440 : if(tread==1) istatr=intarr(1)
213 8408 : dtsets(1:)%istatr=istatr
214 :
215 1440 : istatshft=1
216 1440 : dtsets(0)%istatshft=istatshft
217 1440 : call intagm(dprarr,intarr,0,marr,1,string(1:lenstr),'istatshft',tread,'INT')
218 1440 : if(tread==1) istatshft=intarr(1)
219 8408 : dtsets(1:)%istatshft=istatshft
220 :
221 1440 : cpus=zero
222 1440 : call intagm(dprarr,intarr,0,marr,1,string(1:lenstr),'cpus ',treads,'DPR')
223 1440 : if(treads==1) cpus=dprarr(1)
224 1440 : call intagm(dprarr,intarr,0,marr,1,string(1:lenstr),'cpum ',treadm,'DPR')
225 1440 : if(treadm==1) cpus=dprarr(1)*60.0_dp
226 1440 : call intagm(dprarr,intarr,0,marr,1,string(1:lenstr),'cpuh ',treadh,'DPR')
227 :
228 1440 : if(treadh==1) cpus=dprarr(1)*3600.0_dp
229 1440 : if(treads+treadm+treadh>1)then
230 : write(msg, '(5a)' )&
231 0 : 'More than one input variable is used to defined the CPU time limit.',ch10,&
232 0 : 'This is not allowed.',ch10,&
233 0 : 'Action: in the input file, suppress either cpus, cpum or cpuh.'
234 0 : ABI_ERROR(msg)
235 : end if
236 9848 : dtsets(:)%cpus=cpus
237 :
238 : ! Default for natom, nimage, ntypat, useri and userr
239 9848 : dtsets(:)%natom=1
240 9848 : dtsets(:)%nimage=1
241 9848 : dtsets(:)%ntypat=1 ; dtsets(0)%ntypat=0 ! Will always echo ntypat
242 9848 : dtsets(:)%macro_uj=0
243 9848 : dtsets(:)%maxnsym=384
244 9848 : dtsets(:)%useria=0
245 9848 : dtsets(:)%userib=0
246 9848 : dtsets(:)%useric=0
247 9848 : dtsets(:)%userid=0
248 9848 : dtsets(:)%userie=0
249 9848 : dtsets(:)%userra=zero
250 9848 : dtsets(:)%userrb=zero
251 9848 : dtsets(:)%userrc=zero
252 9848 : dtsets(:)%userrd=zero
253 9848 : dtsets(:)%userre=zero
254 9848 : dtsets(:)%usewvl = 0
255 9848 : dtsets(:)%plowan_compute=0
256 :
257 : ! Loop on datasets, to find natom and mxnatom, as well as useri and userr
258 8408 : do idtset=1,ndtset_alloc
259 6968 : jdtset=dtsets(idtset)%jdtset ; if(ndtset==0)jdtset=0
260 :
261 : ! Generate the supercell if supercell_latt is specified and update string
262 27872 : dtsets(idtset)%supercell_latt(:) = 0
263 27872 : do ii=1,3
264 27872 : dtsets(idtset)%supercell_latt(ii) = 1
265 : end do
266 6968 : call intagm(dprarr,intarr,jdtset,marr,3,string(1:lenstr),"supercell_latt",tread,'INT')
267 6971 : if (tread==1) dtsets(idtset)%supercell_latt(:)=intarr(1:3)
268 : !This test should be update if in the future we allow non-diagonal supercell
269 27872 : if (any(dtsets(idtset)%supercell_latt(:) < tol10 )) then
270 : write(msg, '(5a)' )&
271 0 : 'supercell_latt must have positive parameters and diagonal part',ch10,&
272 0 : 'This is not allowed. ',ch10,&
273 0 : 'Action: modify supercell_latt in the input file.'
274 0 : ABI_ERROR(msg)
275 : end if
276 : ! Compute the multiplicity of the supercell
277 : multiplicity=dtsets(idtset)%supercell_latt(1) &
278 : & *dtsets(idtset)%supercell_latt(2) &
279 6968 : & *dtsets(idtset)%supercell_latt(3)
280 : ! call mati3det(dtsets(idtset)%supercell_latt,multiplicity)
281 :
282 : ! Read natom from string
283 6968 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'natom',tread,'INT')
284 :
285 : ! or get it from the structure variable
286 : call intagm(dprarr, intarr, jdtset, marr, 1, string(1:lenstr), 'structure', tread_geo, &
287 6968 : 'KEY', key_value=geo_string)
288 :
289 6968 : if (tread_geo /= 0) then
290 55 : geo = geo_from_abivar_string(geo_string, comm)
291 55 : if (tread /= 0) then
292 0 : ABI_CHECK(intarr(1) == geo%natom, "natom from variable and from structure do not agree with each other")
293 : end if
294 55 : intarr(1) = geo%natom
295 55 : tread = 1
296 : end if
297 :
298 : ! Might also initialize natom from XYZ file
299 6968 : if (tread==0) call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'_natom',tread,'INT')
300 :
301 6968 : if (tread==1) then
302 6968 : dtsets(idtset)%natom=intarr(1)
303 : else
304 : write(msg, '(a,i0,2a)' )&
305 0 : 'Input natom must be defined, but was absent for dataset ',jdtset,ch10,&
306 0 : 'Action: check the input file.'
307 0 : ABI_ERROR(msg)
308 : end if
309 :
310 : ! Check that natom is greater than 0
311 6968 : if (dtsets(idtset)%natom<=0) then
312 : write(msg, '(a,i0,2a,i0,3a)' )&
313 0 : 'Input natom must be > 0, but was ',dtsets(idtset)%natom,ch10,&
314 0 : 'for dataset ',jdtset,'. This is not allowed.',ch10,&
315 0 : 'Action: check the input file.'
316 0 : ABI_ERROR(msg)
317 : end if
318 :
319 6968 : if(multiplicity > 1)then
320 1 : dtsets(idtset)%natom = dtsets(idtset)%natom * multiplicity
321 : end if
322 :
323 6968 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'nimage',tread,'INT')
324 6968 : if(tread==1) dtsets(idtset)%nimage=intarr(1)
325 :
326 : ! Check that nimage is greater than 0
327 6968 : if (dtsets(idtset)%nimage<=0) then
328 : write(msg, '(a,i0,4a)' )&
329 0 : 'nimage must be > 0, but was ',dtsets(idtset)%nimage,ch10,&
330 0 : 'This is not allowed.',ch10,&
331 0 : 'Action: check the input file.'
332 0 : ABI_ERROR(msg)
333 : end if
334 :
335 6968 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'ntypat',tread,'INT')
336 6968 : if (tread==1) dtsets(idtset)%ntypat=intarr(1)
337 :
338 6968 : if (tread_geo /= 0) then
339 55 : if (tread == 1) then
340 0 : ABI_CHECK(geo%ntypat == dtsets(idtset)%ntypat, "ntypat and geo%ntypat do not agree with each other")
341 : end if
342 55 : dtsets(idtset)%ntypat = geo%ntypat
343 : end if
344 :
345 : ! Check that ntypat is greater than 0
346 6968 : if (dtsets(idtset)%ntypat<=0) then
347 : write(msg, '(a,i0,2a,i0,3a)' )&
348 0 : 'Input ntypat must be > 0, but was ',dtsets(idtset)%ntypat,ch10,&
349 0 : 'for dataset ',jdtset,'. This is not allowed.',ch10,&
350 0 : 'Action: check the input file.'
351 0 : ABI_ERROR(msg)
352 : end if
353 :
354 : ! Read msym from string
355 6968 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'maxnsym',tread,'INT')
356 6968 : if(tread==1)dtsets(idtset)%maxnsym=intarr(1)
357 : ! Check that maxnsym is greater than 1
358 6968 : if (dtsets(idtset)%maxnsym<1) then
359 : write(msg, '(a,i0,2a,i0,3a)' )&
360 0 : 'Input maxnsym must be > 1, but was ',dtsets(idtset)%maxnsym,ch10,&
361 0 : 'for dataset ',jdtset,'. This is not allowed.',ch10,&
362 0 : 'Action: check the input file.'
363 0 : ABI_ERROR(msg)
364 : end if
365 :
366 : ! Read plowan_compute
367 6968 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'plowan_compute',tread,'INT')
368 6968 : if(tread==1) dtsets(idtset)%plowan_compute=intarr(1)
369 :
370 : ! Read extfpmd calculations
371 6968 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'useextfpmd',tread,'INT')
372 6968 : if(tread==1) dtsets(idtset)%useextfpmd=intarr(1)
373 :
374 : ! Read user* variables
375 6968 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'useria',tread,'INT')
376 6968 : if(tread==1) dtsets(idtset)%useria=intarr(1)
377 6968 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'userib',tread,'INT')
378 6968 : if(tread==1) dtsets(idtset)%userib=intarr(1)
379 6968 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'useric',tread,'INT')
380 6968 : if(tread==1) dtsets(idtset)%useric=intarr(1)
381 6968 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'userid',tread,'INT')
382 6968 : if(tread==1) dtsets(idtset)%userid=intarr(1)
383 6968 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'userie',tread,'INT')
384 6968 : if(tread==1) dtsets(idtset)%userie=intarr(1)
385 :
386 6968 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'userra',tread,'DPR')
387 6968 : if(tread==1) dtsets(idtset)%userra=dprarr(1)
388 6968 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'userrb',tread,'DPR')
389 6968 : if(tread==1) dtsets(idtset)%userrb=dprarr(1)
390 6968 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'userrc',tread,'DPR')
391 6968 : if(tread==1) dtsets(idtset)%userrc=dprarr(1)
392 6968 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'userrd',tread,'DPR')
393 6968 : if(tread==1) dtsets(idtset)%userrd=dprarr(1)
394 6968 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'userre',tread,'DPR')
395 6968 : if(tread==1) dtsets(idtset)%userre=dprarr(1)
396 :
397 6968 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'usewvl',tread,'INT')
398 6968 : if(tread==1) dtsets(idtset)%usewvl=intarr(1)
399 :
400 8408 : call geo%free()
401 : end do ! idtset
402 :
403 : !mxnatom =maxval(dtsets(1:ndtset_alloc)%natom)
404 : !mxntypat =maxval(dtsets(1:ndtset_alloc)%ntypat)
405 : !msym =maxval(dtsets(1:ndtset_alloc)%maxnsym)
406 : !There is a bug in the HP compiler, the following should execute properly
407 1440 : mxnatom=dtsets(1)%natom ; mxnimage=dtsets(1)%nimage
408 1440 : mxntypat=dtsets(1)%ntypat ; msym=dtsets(1)%maxnsym
409 1440 : if(ndtset_alloc>1)then
410 6523 : do idtset=2,ndtset_alloc
411 5528 : mxnatom =max(dtsets(idtset)%natom,mxnatom)
412 5528 : mxnimage=max(dtsets(idtset)%nimage,mxnimage)
413 5528 : mxntypat=max(dtsets(idtset)%ntypat,mxntypat)
414 6523 : msym =max(dtsets(idtset)%maxnsym,msym)
415 : end do
416 : end if
417 :
418 1440 : if(mxnimage>1)then
419 51 : do idtset=2,ndtset_alloc
420 51 : if(mxnatom/=dtsets(idtset)%natom)then
421 : write(msg,'(5a,i0,a,i0,3a,i0,a)')&
422 0 : 'When there exist one dataset with more than one image,',ch10,&
423 0 : 'the number of atoms in each dataset must be the same.',ch10,&
424 0 : 'However, it has been found that for dataset= ',idtset,ch10,&
425 0 : 'natom= ',dtsets(idtset)%natom,' differs from the maximum number',ch10,&
426 0 : 'of atoms, mxnatom= ',mxnatom,&
427 0 : 'Action: check the input variables natom for different datasets.'
428 0 : ABI_ERROR(msg)
429 : end if
430 : end do
431 : end if
432 :
433 : ! Set up npsp
434 1440 : npsp=mxntypat ! Default value
435 1440 : call intagm(dprarr,intarr,0,marr,1,string(1:lenstr),'npsp',tread,'INT')
436 :
437 1440 : if(tread==1)then
438 29 : npsp=intarr(1)
439 : else
440 1411 : if(ndtset_alloc>1)then
441 7412 : do idtset=1,ndtset_alloc
442 6444 : if(dtsets(idtset)%ntypat/=mxntypat)then
443 : write(msg, '(5a,i0,a,i0,2a,i0,2a)' )&
444 0 : ' When npsp is not defined, the input variable ntypat must be',ch10,&
445 0 : ' the same for all datasets. However, it has been found that for',ch10,&
446 0 : ' jdtset: ',dtsets(idtset)%jdtset,', ntypat= ',dtsets(idtset)%ntypat,ch10,&
447 0 : ' differs from the maximum value of ntypat= ',mxntypat,ch10,&
448 0 : ' Action: check the input variables npsp and ntypat.'
449 0 : ABI_ERROR(msg)
450 : end if
451 7412 : if(dtsets(idtset)%ntypat>npsp)then
452 : write(msg, '(5a,i0,a,i0,a,i0,2a)' )&
453 0 : ' The number of pseudopotentials, npsp, must never be smaller than ntypat.',ch10,&
454 0 : ' However, it has been found that for',ch10,&
455 0 : ' jdtset: ',dtsets(idtset)%jdtset,', ntypat= ',dtsets(idtset)%ntypat,' and npsp=',npsp,ch10,&
456 0 : ' Action: check the input variables npsp and ntypat.'
457 0 : ABI_ERROR(msg)
458 : endif
459 : end do
460 : end if
461 : end if
462 1440 : dtsets(0)%npsp = mxntypat ! Default value
463 8408 : dtsets(1:ndtset_alloc)%npsp = npsp
464 :
465 : ! Read pseudopotential directory and pseudo paths from input.
466 : ! Remember that in "files file mode", this info is passed through the files file so these variables are optional
467 1440 : pp_dirpath = ""
468 1440 : call intagm(dprarr, intarr, 0, marr, 1, string(1:lenstr), 'pp_dirpath', tread, 'KEY', key_value=pp_dirpath)
469 1440 : if (tread == 1) then
470 1438 : if (.not. endswith(pp_dirpath, "/")) pp_dirpath = strcat(pp_dirpath, "/")
471 : end if
472 :
473 : ! String must be large enough to contain ntypat filepaths.
474 1440 : pseudos_string = ""
475 1440 : call intagm(dprarr, intarr, 0, marr, 1, string(1:lenstr), "pseudos", tread_pseudos, 'KEY', key_value=pseudos_string)
476 :
477 4320 : ABI_MALLOC(pseudo_paths, (npsp))
478 3390 : pseudo_paths = ""
479 :
480 1440 : if (tread_pseudos == 1) then
481 : ! Split pseudos_string using comma and transfer results to pseudos_paths
482 : ! Make sure string length is large enough and input string is consistent with npsp
483 : ! Lot of checks must be done here!
484 : !print *, "pseudos_string: ", trim(pseudos_string)
485 7698 : ABI_ICALLOC(sidx, (npsp + 1))
486 1438 : sidx(1) = 1; sidx(npsp + 1) = len(pseudos_string)
487 1438 : cnt = 1
488 11505438 : do ii=1,len(pseudos_string)
489 11505438 : if (pseudos_string(ii:ii) == ",") then
490 508 : pseudos_string(ii:ii) = " "
491 508 : cnt = cnt + 1
492 508 : sidx(cnt) = ii
493 508 : ABI_CHECK(cnt <= npsp, "Too many commas in pseudos string!")
494 : end if
495 : end do
496 1438 : if (cnt /= npsp) then
497 : write(msg,'(4a)')&
498 0 : "Not enough pseudopotentials in input `pseudos` string, expecting npsp: ",itoa(npsp),ch10,&
499 0 : "Perhaps the separator (=a comma) is missing between pseudopotentials in input `pseudos` string."
500 0 : ABI_ERROR(msg)
501 : end if
502 :
503 3384 : do ii=1,npsp
504 1946 : i1 = sidx(ii)
505 1946 : i2 = sidx(ii + 1)
506 1946 : cnt = len(adjustl(trim(pseudos_string(i1:i2))))
507 1946 : ABI_CHECK(cnt <= fnlen, "pseudo path too small, increase fnlen")
508 1946 : pseudo_paths(ii) = adjustl(trim(pseudos_string(i1:i2)))
509 3384 : if (len_trim(pp_dirpath) > 0) then
510 1946 : if (len_trim(pp_dirpath) + len_trim(pseudo_paths(ii)) > fnlen) then
511 0 : ABI_ERROR(sjoin("String of len fnlen:", itoa(fnlen), " too small to contain full pseudo path"))
512 : end if
513 1946 : pseudo_paths(ii) = strcat(pp_dirpath, pseudo_paths(ii))
514 : end if
515 : end do
516 1438 : ABI_FREE(sidx)
517 : !print *, "pp_dirpath: ", trim(pp_dirpath), "pseudos: ", trim(pseudos_string)
518 : end if
519 :
520 : ! KGB parallelism information (needed at this stage)
521 9848 : dtsets(:)%paral_kgb=0
522 8408 : do idtset=1,ndtset_alloc
523 6968 : jdtset=dtsets(idtset)%jdtset ; if(ndtset==0)jdtset=0
524 6968 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'paral_kgb',tread,'INT')
525 6968 : if(tread==1)dtsets(idtset)%paral_kgb=intarr(1)
526 :
527 8408 : if (dtsets(idtset)%paral_kgb<0 .or. dtsets(idtset)%paral_kgb>1) then
528 : write(msg,'(a,i0,2a,i0,3a)')&
529 0 : 'Input paral_kgb must be 0 or 1, but was ',dtsets(idtset)%paral_kgb,ch10,&
530 0 : 'for dataset ',jdtset,'. This is not allowed.',ch10,&
531 0 : 'Action: check the input file.'
532 0 : ABI_ERROR(msg)
533 : end if
534 : end do
535 :
536 : ! GPU related parameters
537 9848 : dtsets(:)%gpu_option=ABI_GPU_DISABLED
538 : #if defined HAVE_GPU
539 : call Get_ndevice(idev)
540 : if (idev>0) then
541 : do i1=1,ndtset_alloc
542 : dtsets(i1)%gpu_option=ABI_GPU_UNKNOWN
543 : end do
544 : end if
545 : #else
546 : ABI_UNUSED(idev)
547 : #endif
548 :
549 1440 : gpu_option=ABI_GPU_DISABLED
550 8408 : do idtset=1,ndtset_alloc
551 6968 : jdtset=dtsets(idtset)%jdtset ; if(ndtset==0)jdtset=0
552 :
553 6968 : gpu_option_string = "" ; intarr(1)=0
554 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),"gpu_option",tread_gpu_option,'INT_OR_KEY',&
555 6968 : key_value=gpu_option_string)
556 6968 : if (tread_gpu_option==1) then
557 1 : if (len(trim(gpu_option_string))>0) then
558 0 : call inupper(gpu_option_string)
559 0 : if (trim(gpu_option_string)=="GPU_DISABLED") dtsets(idtset)%gpu_option=ABI_GPU_DISABLED
560 0 : if (trim(gpu_option_string)=="GPU_LEGACY") dtsets(idtset)%gpu_option=ABI_GPU_LEGACY
561 0 : if (trim(gpu_option_string)=="GPU_KOKKOS") dtsets(idtset)%gpu_option=ABI_GPU_KOKKOS
562 0 : if (trim(gpu_option_string)=="GPU_OPENMP") dtsets(idtset)%gpu_option=ABI_GPU_OPENMP
563 : else
564 1 : dtsets(idtset)%gpu_option=intarr(1)
565 : end if
566 : end if
567 :
568 8408 : if (dtsets(idtset)%gpu_option/=ABI_GPU_DISABLED) gpu_option=dtsets(idtset)%gpu_option
569 : end do
570 :
571 1440 : if (gpu_option/=ABI_GPU_DISABLED) then
572 : #if defined HAVE_GPU
573 : if (idev<=0) then
574 : write(msg,'(5a)')&
575 : 'Input variable gpu_option is on (/=0),',ch10,&
576 : 'but no available GPU device has been detected !',ch10,&
577 : 'Action: change the input variable gpu_option.'
578 : ABI_ERROR(msg)
579 : end if
580 : if(gpu_option==ABI_GPU_OPENMP) then
581 : #if !defined HAVE_OPENMP_OFFLOAD
582 : write(msg,'(7a)')&
583 : 'Input variable gpu_option is set to use OpenMP GPU backend but abinit hasn''t been built',ch10,&
584 : 'with OpenMP GPU offloading enabled!',ch10,&
585 : 'Action: change the input variable gpu_option',ch10,&
586 : ' or re-compile ABINIT with OpenMP GPU offloading enabled.'
587 : ABI_ERROR(msg)
588 : #endif
589 : #if defined HAVE_OPENMP_OFFLOAD
590 : if(xomp_get_num_devices() == 0) then
591 : write(msg,'(13a)')&
592 : 'Input variable gpu_option is set to use OpenMP GPU backend ',ch10,&
593 : 'but no GPU is visible by OpenMP.',ch10,&
594 : 'It usually happens when env variable OMP_TARGET_OFFLOAD is set to DISABLED (not default) ',ch10,&
595 : 'or if there are inconsistencies between GPU driver and compiler ',ch10,&
596 : 'as to which CUDA version is supported.',ch10,&
597 : 'Action: check the value OMP_TARGET_OFFLOAD is not set to DISABLED,',ch10,&
598 : ' otherwise make sure CUDA/HIP version you use is supported by BOTH your driver and compiler.'
599 : ABI_ERROR(msg)
600 : end if
601 : #endif
602 : else if(gpu_option==ABI_GPU_KOKKOS) then
603 : #if !defined HAVE_KOKKOS || !defined HAVE_YAKL
604 : write(msg,'(7a)')&
605 : 'Input variable gpu_option is set to use Kokkos backend but abinit hasn''t been built',ch10,&
606 : 'with Kokkos and/or YAKL dependencies enabled!',ch10,&
607 : 'Action: change the input variable gpu_option',ch10,&
608 : ' or re-compile ABINIT with BOTH Kokkos and YAKL enabled.'
609 : ABI_ERROR(msg)
610 : #endif
611 : end if
612 : #else
613 : write(msg,'(7a)')&
614 0 : 'Input variable gpu_option is on',ch10,&
615 0 : 'but ABINIT hasn''t been built with GPU mode enabled!',ch10,&
616 0 : 'Action: change the input variable gpu_option',ch10,&
617 0 : ' or re-compile ABINIT with GPU enabled.'
618 0 : ABI_ERROR(msg)
619 : #endif
620 : end if
621 :
622 : !Set gpu_option default value
623 : !gpu_option=ABI_GPU_UNKNOWN means undetermined
624 8408 : do idtset=1,ndtset_alloc
625 8408 : if (dtsets(idtset)%gpu_option==ABI_GPU_UNKNOWN) then
626 : !FIXME We may want to have GPU enabled by default if a GPU device is available.
627 : ! Now, we use CPU to stay safe, as some code section aren't checked for GPU use yet.
628 :
629 : !#if defined HAVE_OPENMP_OFFLOAD
630 : ! dtsets(idtset)%gpu_option=ABI_GPU_OPENMP
631 : !#elif defined HAVE_KOKKOS && defined HAVE_YAKL
632 : ! dtsets(idtset)%gpu_option=ABI_GPU_KOKKOS
633 : !#elif defined HAVE_GPU_CUDA
634 : ! dtsets(idtset)%gpu_option=ABI_GPU_LEGACY
635 : !#else
636 0 : dtsets(idtset)%gpu_option=ABI_GPU_DISABLED
637 : !#endif
638 : end if
639 : end do
640 :
641 1440 : ABI_FREE(dprarr)
642 1440 : ABI_FREE(intarr)
643 :
644 : ! We allocate the internal array, depending on the computed values.
645 : ! WARNING: do not forget to deallocate these arrays in the routine dtset_free
646 : ! (should make a separate subroutine for allocating/deallocating these records)
647 9848 : do idtset=0,ndtset_alloc
648 25224 : ABI_MALLOC(dtsets(idtset)%acell_orig,(3,mxnimage))
649 25224 : ABI_MALLOC(dtsets(idtset)%algalch,(mxntypat))
650 33632 : ABI_MALLOC(dtsets(idtset)%amu_orig,(mxntypat,mxnimage))
651 25224 : ABI_MALLOC(dtsets(idtset)%atndlist,(3,mxnatom))
652 25224 : ABI_MALLOC(dtsets(idtset)%cellcharge,(mxnimage))
653 25224 : ABI_MALLOC(dtsets(idtset)%chrgat,(mxnatom))
654 16816 : ABI_MALLOC(dtsets(idtset)%constraint_kind,(mxntypat))
655 25224 : ABI_MALLOC(dtsets(idtset)%corecs,(mxntypat))
656 25224 : ABI_MALLOC(dtsets(idtset)%densty,(mxntypat,4))
657 25224 : ABI_MALLOC(dtsets(idtset)%dmft_nominal,(mxnatom))
658 16816 : ABI_MALLOC(dtsets(idtset)%dmft_orbital,(mxntypat))
659 16816 : ABI_MALLOC(dtsets(idtset)%dmft_shiftself,(mxnatom))
660 25224 : ABI_MALLOC(dtsets(idtset)%dynimage,(mxnimage))
661 25224 : ABI_MALLOC(dtsets(idtset)%iatfix,(3,mxnatom))
662 16816 : ABI_MALLOC(dtsets(idtset)%iatnd,(mxnatom))
663 16816 : ABI_MALLOC(dtsets(idtset)%f4of2_sla,(mxntypat))
664 16816 : ABI_MALLOC(dtsets(idtset)%f6of2_sla,(mxntypat))
665 25224 : ABI_MALLOC(dtsets(idtset)%jpawu,(mxntypat,mxnimage))
666 8408 : ABI_MALLOC(dtsets(idtset)%kberry,(3,20))
667 16816 : ABI_MALLOC(dtsets(idtset)%lambsig,(mxntypat))
668 16816 : ABI_MALLOC(dtsets(idtset)%lexexch,(mxntypat))
669 16816 : ABI_MALLOC(dtsets(idtset)%ldaminushalf,(mxntypat))
670 16816 : ABI_MALLOC(dtsets(idtset)%lpawu,(mxntypat))
671 42040 : ABI_MALLOC(dtsets(idtset)%mixalch_orig,(npsp,mxntypat,mxnimage))
672 16816 : ABI_MALLOC(dtsets(idtset)%mixesimgf,(mxnimage))
673 16816 : ABI_MALLOC(dtsets(idtset)%nucdipmom,(3,mxnatom))
674 16816 : ABI_MALLOC(dtsets(idtset)%pimass,(mxntypat))
675 16816 : ABI_MALLOC(dtsets(idtset)%ptcharge,(mxntypat))
676 16816 : ABI_MALLOC(dtsets(idtset)%prtatlist,(mxnatom))
677 16816 : ABI_MALLOC(dtsets(idtset)%quadmom,(mxntypat))
678 16816 : ABI_MALLOC(dtsets(idtset)%ratsph,(mxntypat))
679 25224 : ABI_MALLOC(dtsets(idtset)%rprim_orig,(3,3,mxnimage))
680 16816 : ABI_MALLOC(dtsets(idtset)%rprimd_orig,(3,3,mxnimage))
681 25224 : ABI_MALLOC(dtsets(idtset)%so_psp,(npsp))
682 16816 : ABI_MALLOC(dtsets(idtset)%spinat,(3,mxnatom))
683 16816 : ABI_MALLOC(dtsets(idtset)%spinat_cart,(3,mxnatom))
684 16816 : ABI_MALLOC(dtsets(idtset)%spinat_in,(3,mxnatom))
685 8408 : ABI_MALLOC(dtsets(idtset)%shiftk,(3,MAX_NSHIFTK))
686 16816 : ABI_MALLOC(dtsets(idtset)%typat,(mxnatom))
687 25224 : ABI_MALLOC(dtsets(idtset)%upawu,(mxntypat,mxnimage))
688 16816 : ABI_MALLOC(dtsets(idtset)%plowan_iatom,(mxnatom))
689 8408 : ABI_MALLOC(dtsets(idtset)%plowan_it,(100*3))
690 16816 : ABI_MALLOC(dtsets(idtset)%plowan_nbl,(mxnatom))
691 25224 : ABI_MALLOC(dtsets(idtset)%plowan_lcalc,(12*mxnatom))
692 16816 : ABI_MALLOC(dtsets(idtset)%plowan_projcalc,(12*mxnatom))
693 16816 : ABI_MALLOC(dtsets(idtset)%rcpaw_rctypat,(mxntypat))
694 16816 : ABI_MALLOC(dtsets(idtset)%rcpaw_sc,(mxntypat))
695 33632 : ABI_MALLOC(dtsets(idtset)%vel_orig,(3,mxnatom,mxnimage))
696 16816 : ABI_MALLOC(dtsets(idtset)%vel_cell_orig,(3,3,mxnimage))
697 25224 : ABI_MALLOC(dtsets(idtset)%xred_orig,(3,mxnatom,mxnimage))
698 16816 : ABI_MALLOC(dtsets(idtset)%ziontypat,(mxntypat))
699 26664 : ABI_MALLOC(dtsets(idtset)%znucl,(npsp))
700 : end do
701 :
702 : !write(std_out,*)' invars0 : nimage, mxnimage = ',dtsets(:)%nimage, mxnimage
703 : !write(std_out,*)' invars0 : natom = ',dtsets(:)%natom
704 : !write(std_out,*)' invars0 : mxnatom = ',mxnatom
705 : !write(std_out,*)' m_invars1%invars0 : exit '; call flush(std_out)
706 :
707 1440 : end subroutine invars0
708 : !!***
709 :
710 : !!****f* ABINIT/invars1m
711 : !! NAME
712 : !! invars1m
713 : !!
714 : !! FUNCTION
715 : !! Initialisation phase: prepare the main input subroutine call by
716 : !! reading all the NO MULTI variables, as well as the dimensions
717 : !! needed for allocating the input arrays in abinit.
718 : !!
719 : !! INPUTS
720 : !! iout=unit number of output file
721 : !! lenstr=actual length of string
722 : !! msym=default maximal number of symmetries
723 : !! mxnatom=maximal value of input natom for all the datasets
724 : !! mxnimage=maximal value of input nimage for all the datasets
725 : !! ndtset= number of datasets to be read; if 0, no multi-dataset mode
726 : !! ndtset_alloc=number of datasets, corrected for allocation of at least one data set.
727 : !! npsp= number of pseudopotential files
728 : !! string*(*)=string of characters containing all input variables and data
729 : !! zionpsp(npsp)= valence charge over all psps
730 : !! comm=MPI communicator
731 : !!
732 : !! OUTPUT
733 : !! dmatpuflag=flag controlling the use of an initial density matrix in PAW+U (max. value over datasets)
734 : !! mband_upper_(0:ndtset_alloc)=list of mband_upper values
735 : !!
736 : !! SIDE EFFECTS
737 : !! dtsets(0:ndtset_alloc)=<type datafiles_type>contains all input variables,
738 : !! some of which are initialized here (see invars1.f for more details on the initialized records)
739 : !! mx<ab_dimensions>=datatype storing the maximal dimensions. Partly initialized in input.
740 : !!
741 : !! SOURCE
742 :
743 1440 : subroutine invars1m(dmatpuflag, dtsets, iout, lenstr, mband_upper_, mx,&
744 1440 : msym, ndtset, ndtset_alloc, string, npsp, zionpsp, comm)
745 :
746 : !Arguments ------------------------------------
747 : !scalars
748 : integer,intent(in) :: iout,lenstr,msym,ndtset,ndtset_alloc,npsp, comm
749 : integer,intent(out) :: dmatpuflag
750 : character(len=*),intent(inout) :: string
751 : type(ab_dimensions),intent(inout) :: mx
752 : !arrays
753 : integer,intent(out) :: mband_upper_(0:ndtset_alloc)
754 : type(dataset_type),intent(inout) :: dtsets(0:ndtset_alloc)
755 : real(dp),intent(in) :: zionpsp(npsp)
756 :
757 : !Local variables-------------------------------
758 : !scalars
759 : integer :: idtset,ii,jdtset,lpawu,mband_upper,iatom,nat,nsp
760 : !arrays
761 1440 : integer,allocatable :: symafm_(:,:),symrel_(:,:,:,:), symafm(:),symrel(:,:,:)
762 1440 : real(dp),allocatable :: tnons_(:,:,:),tnons(:,:)
763 : !******************************************************************
764 :
765 : !write(std_out,'(a)')' m_invars1%invars1m : enter '; call flush(std_out)
766 :
767 : ! Here, allocation of the arrays that depend on msym.
768 5760 : ABI_MALLOC(symrel_,(3,3,msym,0:ndtset_alloc))
769 5760 : ABI_MALLOC(symafm_,(msym,0:ndtset_alloc))
770 5760 : ABI_MALLOC(tnons_,(3,msym,0:ndtset_alloc))
771 4320 : ABI_MALLOC(symafm,(msym))
772 4320 : ABI_MALLOC(symrel,(3,3,msym))
773 4320 : ABI_MALLOC(tnons,(3,msym))
774 :
775 : ! Set up default values (note that the default acell, amu mkmem, mkmem1,mkqmem, and nkpt must be overcome
776 9848 : do idtset=0,ndtset_alloc
777 9848 : call indefo1(dtsets(idtset))
778 : end do
779 :
780 : ! natom and nimage are already initialized in invars0
781 1440 : dtsets(0)%natom=-1
782 1440 : dtsets(0)%nimage=1
783 :
784 : !Initialization for parallelization data has changed
785 : !these lines aim to keep old original default values
786 1440 : dtsets(0)%npimage=1
787 1440 : dtsets(0)%np_spkpt=1
788 1440 : dtsets(0)%npspinor=1
789 1440 : dtsets(0)%npfft=1
790 1440 : dtsets(0)%npband=1
791 1440 : dtsets(0)%bandpp=1
792 1440 : dtsets(0)%nblock_lobpcg=1
793 :
794 554064 : symafm_(:,0)=1
795 7185552 : symrel_(:,:,:,0)=0
796 1662192 : symrel_(1,1,:,0)=1 ; symrel_(2,2,:,0)=1 ; symrel_(3,3,:,0)=1
797 2211936 : tnons_(:,:,0)=0.0_dp
798 :
799 : ! Loop on datasets
800 8395 : do idtset=1,ndtset_alloc
801 6968 : jdtset=dtsets(idtset)%jdtset ; if(ndtset==0)jdtset=0
802 6968 : write(std_out,'(2a)') ch10,'======================================================= '
803 6968 : write(std_out,'(a,i0)') ' invars1m : enter jdtset= ',jdtset
804 :
805 : ! Input default values
806 83616 : dtsets(idtset)%bravais(:)=0
807 2681672 : symafm(:)=symafm_(:,0)
808 34778120 : symrel(:,:,:)=symrel_(:,:,:,0)
809 10705784 : tnons(:,:)=tnons_(:,:,0)
810 :
811 : call invars1(dtsets(idtset)%bravais,dtsets(idtset),iout,jdtset,lenstr,&
812 6968 : mband_upper,msym,npsp,string,symafm,symrel,tnons,zionpsp, comm)
813 :
814 6955 : mband_upper_ (idtset)=mband_upper
815 2676667 : symafm_(:,idtset)=symafm(:)
816 34713211 : symrel_(:,:,:,idtset)=symrel(:,:,:)
817 10687230 : tnons_(:,:,idtset)=tnons(:,:)
818 : end do
819 :
820 8382 : mx%mband_upper = maxval(mband_upper_ (1:ndtset_alloc))
821 :
822 1427 : dmatpuflag = 0; mx%natpawu = 0; mx%lpawu = 0
823 1427 : mx%natsph = dtsets(1)%natsph
824 1427 : mx%natsph_extra = dtsets(1)%natsph_extra
825 1427 : mx%natvshift = dtsets(1)%natvshift
826 1427 : mx%nconeq = dtsets(1)%nconeq
827 1427 : mx%n_efmas_dirs=0
828 1427 : mx%ga_n_rules = dtsets(1)%ga_n_rules
829 1427 : mx%gw_nqlwl = dtsets(1)%gw_nqlwl
830 1427 : mx%nimfrqs = 0
831 1427 : mx%nfreqsp = 0
832 1427 : mx%n_projection_frequencies = 0
833 1427 : mx%nkpt = dtsets(1)%nkpt
834 1427 : mx%nkptgw = dtsets(1)%nkptgw
835 1427 : mx%nkpthf = dtsets(1)%nkpthf
836 1427 : mx%nnos = dtsets(1)%nnos
837 1427 : mx%nqptdm = dtsets(1)%nqptdm
838 1427 : mx%nspinor = dtsets(1)%nspinor
839 1427 : mx%nsppol = dtsets(1)%nsppol
840 1427 : mx%ntypat = dtsets(1)%ntypat
841 1427 : mx%nzchempot = dtsets(1)%nzchempot
842 1427 : mx%nberry = 20 ! This is presently a fixed value. Should be changed.
843 :
844 : ! Get MAX dimension over datasets
845 8382 : do ii=1,ndtset_alloc
846 6955 : mx%natsph = max(dtsets(ii)%natsph, mx%natsph)
847 6955 : mx%natsph_extra=max(dtsets(ii)%natsph_extra, mx%natsph_extra)
848 6955 : mx%nconeq=max(dtsets(ii)%nconeq, mx%nconeq)
849 6955 : mx%n_efmas_dirs = max(dtsets(ii)%efmas_n_dirs, mx%n_efmas_dirs)
850 6955 : mx%ga_n_rules = max(dtsets(ii)%ga_n_rules,mx%ga_n_rules)
851 6955 : mx%gw_nqlwl = max(dtsets(ii)%gw_nqlwl,mx%gw_nqlwl)
852 6955 : mx%nimfrqs = max(dtsets(ii)%cd_customnimfrqs, mx%nimfrqs)
853 6955 : mx%nfreqsp = max(dtsets(ii)%gw_customnfreqsp, mx%nfreqsp)
854 6955 : mx%n_projection_frequencies = max(dtsets(ii)%gwls_n_proj_freq, mx%n_projection_frequencies)
855 6955 : mx%nkpt = max(dtsets(ii)%nkpt, mx%nkpt)
856 6955 : mx%nkptgw = max(dtsets(ii)%nkptgw, mx%nkptgw)
857 6955 : mx%nkpthf = max(dtsets(ii)%nkpthf, mx%nkpthf)
858 6955 : mx%nnos = max(dtsets(ii)%nnos, mx%nnos)
859 6955 : mx%nqptdm = max(dtsets(ii)%nqptdm, mx%nqptdm)
860 6955 : mx%nspinor = max(dtsets(ii)%nspinor, mx%nspinor)
861 6955 : mx%nsppol = max(dtsets(ii)%nsppol, mx%nsppol)
862 6955 : mx%ntypat = max(dtsets(ii)%ntypat, mx%ntypat)
863 6955 : mx%nzchempot = max(dtsets(ii)%nzchempot, mx%nzchempot)
864 6955 : if (dtsets(ii)%usepawu/=0) then
865 153 : if (dtsets(ii)%usepawu>0.and.dtsets(ii)%usedmatpu/=0) dmatpuflag=1
866 386 : lpawu=maxval(dtsets(ii)%lpawu(:))
867 153 : mx%lpawu=max(lpawu,mx%lpawu)
868 : !dtsets(ii)%natpawu=count(dtsets(ii)%lpawu(dtsets(ii)%typat((/(i1,i1=1,dtsets(ii)%natom)/)))/=-1)
869 : ! Old fashion way that should do fine
870 153 : dtsets(ii)%natpawu = 0
871 496 : do iatom=1, dtsets(ii)%natom
872 496 : if (dtsets(ii)%lpawu(dtsets(ii)%typat(iatom)) /= -1 ) dtsets(ii)%natpawu = dtsets(ii)%natpawu + 1
873 : end do
874 153 : mx%natpawu = max(dtsets(ii)%natpawu, mx%natpawu)
875 153 : if (dtsets(ii)%macro_uj/=0) dtsets(ii)%natvshift=lpawu*2+1
876 : end if
877 8382 : mx%natvshift = max(dtsets(ii)%natvshift, mx%natvshift)
878 : end do
879 :
880 : !mx%nsym=maxval(dtsets(1:ndtset_alloc)%nsym) ! This might not work properly with HP compiler
881 1427 : mx%nsym=dtsets(1)%nsym
882 8382 : do idtset=1,ndtset_alloc
883 8382 : mx%nsym = max(dtsets(idtset)%nsym, mx%nsym)
884 : end do
885 :
886 9809 : do idtset=0,ndtset_alloc
887 41910 : ABI_MALLOC(dtsets(idtset)%atvshift, (mx%natvshift, mx%nsppol, mx%natom))
888 25146 : ABI_MALLOC(dtsets(idtset)%bs_loband,(mx%nsppol))
889 33528 : ABI_MALLOC(dtsets(idtset)%bdgw,(2, mx%nkptgw, mx%nsppol))
890 25146 : ABI_MALLOC(dtsets(idtset)%cd_imfrqs,(mx%nimfrqs))
891 33528 : ABI_MALLOC(dtsets(idtset)%chempot,(3, mx%nzchempot, mx%ntypat))
892 8382 : nsp = max(mx%nsppol, mx%nspinor); nat = mx%natpawu*dmatpuflag
893 58674 : ABI_MALLOC(dtsets(idtset)%dmatpawu,(2*mx%lpawu+1,2*mx%lpawu+1,nsp,nat, mx%nimage))
894 25146 : ABI_MALLOC(dtsets(idtset)%efmas_bands,(2, mx%nkpt))
895 25146 : ABI_MALLOC(dtsets(idtset)%efmas_dirs,(3, mx%n_efmas_dirs))
896 25146 : ABI_MALLOC(dtsets(idtset)%gw_freqsp, (mx%nfreqsp))
897 25146 : ABI_MALLOC(dtsets(idtset)%gwls_list_proj_freq, (mx%n_projection_frequencies))
898 25146 : ABI_MALLOC(dtsets(idtset)%gw_qlwl,(3,mx%gw_nqlwl))
899 25146 : ABI_MALLOC(dtsets(idtset)%kpt,(3, mx%nkpt))
900 25146 : ABI_MALLOC(dtsets(idtset)%kptgw,(3, mx%nkptgw))
901 16764 : ABI_MALLOC(dtsets(idtset)%kptns,(3, mx%nkpt))
902 25146 : ABI_MALLOC(dtsets(idtset)%kptns_hf,(3, mx%nkpthf))
903 25146 : ABI_MALLOC(dtsets(idtset)%iatsph,(mx%natsph))
904 25146 : ABI_MALLOC(dtsets(idtset)%istwfk, (mx%nkpt))
905 25146 : ABI_MALLOC(dtsets(idtset)%nband, (mx%nkpt*mx%nsppol))
906 33528 : ABI_MALLOC(dtsets(idtset)%occ_orig,(mx%mband_upper*mx%nkpt*mx%nsppol, mx%nimage))
907 25146 : ABI_MALLOC(dtsets(idtset)%qmass, (mx%nnos))
908 25146 : ABI_MALLOC(dtsets(idtset)%qptdm,(3, mx%nqptdm))
909 25146 : ABI_MALLOC(dtsets(idtset)%symafm, (mx%nsym))
910 25146 : ABI_MALLOC(dtsets(idtset)%symrel,(3,3,mx%nsym))
911 25146 : ABI_MALLOC(dtsets(idtset)%tnons,(3,mx%nsym))
912 33528 : ABI_MALLOC(dtsets(idtset)%wtatcon,(3,mx%natom, mx%nconeq))
913 25146 : ABI_MALLOC(dtsets(idtset)%wtk, (mx%nkpt))
914 25146 : ABI_MALLOC(dtsets(idtset)%xredsph_extra,(3, mx%natsph_extra))
915 2954611 : dtsets(idtset)%symrel(:,:,:)=symrel_(:,:,1:mx%nsym,idtset)
916 235015 : dtsets(idtset)%symafm(:) =symafm_(1:mx%nsym,idtset)
917 916341 : dtsets(idtset)%tnons (:,:) =tnons_ (:,1:mx%nsym,idtset)
918 : end do
919 :
920 1427 : ABI_FREE(symafm_)
921 1427 : ABI_FREE(symrel_)
922 1427 : ABI_FREE(tnons_)
923 1427 : ABI_FREE(symafm)
924 1427 : ABI_FREE(symrel)
925 1427 : ABI_FREE(tnons)
926 :
927 : !write(std_out,'(a)')' m_invars1%invars1m : exit '; call flush(std_out)
928 :
929 1427 : end subroutine invars1m
930 : !!***
931 :
932 : !!****f* ABINIT/indefo1
933 : !! NAME
934 : !! indefo1
935 : !!
936 : !! FUNCTION
937 : !! Initialisation phase: defaults values for a first batch of input variables
938 : !! (especially dimensions, needed to allocate other parts of dtsets, as well
939 : !! as other input variables whose existence is needed for other initialisations to proceed).
940 : !!
941 : !! INPUTS
942 : !!
943 : !! OUTPUT
944 : !! dtset=<type datafiles_type>contains all input variables for one dataset,
945 : !! some of which are given a default value here.
946 : !!
947 : !! SOURCE
948 :
949 8408 : subroutine indefo1(dtset)
950 :
951 : !Arguments ------------------------------------
952 : !scalars
953 : type(dataset_type),intent(inout) :: dtset
954 :
955 : !Local variables -------------------------------
956 : !scalars
957 : !integer :: ii
958 : !******************************************************************
959 :
960 : !Set up default values. All variables to be output in outvars.f
961 : !should have a default, even if a nonsensible one can be chosen to guarantee print in that routine.
962 :
963 : DBG_ENTER("COLL")
964 :
965 : !Use alphabetic order
966 :
967 : !A
968 43644 : dtset%acell_orig(:,:)=zero
969 18945 : dtset%algalch(:)=1
970 248532 : dtset%atndlist(:,:)=zero
971 28487 : dtset%amu_orig(:,:)=-one
972 8408 : dtset%autoparal=0
973 : !B
974 8408 : dtset%bandpp=1
975 8408 : dtset%berryopt=0
976 8408 : dtset%berrysav=0
977 33632 : dtset%bfield(:)=zero
978 : !C
979 8408 : dtset%cd_customnimfrqs=0
980 8408 : dtset%chkprim=1
981 68439 : dtset%chrgat(:)=zero
982 18945 : dtset%constraint_kind(:)=0
983 : !D
984 84188 : dtset%densty(:,:)=zero
985 33632 : dtset%dfield(:)=zero !!HONG
986 17217 : dtset%dynimage(:)=1
987 : !E
988 33632 : dtset%efield(:)=zero
989 8408 : dtset%efmas_calc_dirs=0
990 8408 : dtset%efmas_n_dirs=0
991 : !F
992 33632 : dtset%field_red(:)=zero
993 33632 : dtset%field_red_axial(:)=zero
994 : !G
995 8408 : dtset%ga_n_rules=1
996 8408 : dtset%gw_customnfreqsp=0
997 8408 : dtset%gw_nqlwl=0
998 8408 : dtset%gwls_n_proj_freq=0
999 : !H
1000 33632 : dtset%hspinfield(:)=zero
1001 33632 : dtset%hspinfield_cart(:)=zero
1002 33632 : dtset%hspinfield_in(:)=zero
1003 : !I
1004 248532 : dtset%iatfix(:,:)=0
1005 68439 : dtset%iatnd(:)=0
1006 8408 : dtset%icoulomb=0
1007 8408 : dtset%imgmov=0
1008 8408 : dtset%ivalence=0
1009 : !J
1010 8408 : dtset%jellslab=0
1011 33632 : dtset%jfielddir(:)=0
1012 : !K
1013 8408 : dtset%kptopt=0
1014 : !L
1015 18945 : dtset%lexexch(:)=-1
1016 18945 : dtset%ldaminushalf(:)=0
1017 18945 : dtset%lpawu(:)=-1
1018 : !M
1019 8408 : dtset%maxestep=0.005d0
1020 45158 : dtset%mixalch_orig(:,:,:)=zero
1021 8408 : dtset%mkmem=-1
1022 8408 : dtset%mkqmem=-1
1023 8408 : dtset%mk1mem=-1
1024 : !N
1025 8408 : dtset%natnd=0
1026 8408 : dtset%natpawu=0
1027 8408 : dtset%natsph=0
1028 8408 : dtset%natsph_extra=0
1029 8408 : dtset%natvshift=0
1030 8408 : dtset%nblock_lobpcg=1
1031 8408 : dtset%nconeq=0
1032 8408 : dtset%ndynimage=1
1033 8408 : dtset%ne_qFD=zero
1034 8408 : dtset%nh_qFD=zero
1035 8408 : dtset%nkpt=-1
1036 8408 : dtset%nkptgw=0
1037 8408 : dtset%nkpthf=0
1038 8408 : dtset%nnos=0
1039 8408 : dtset%npband=1
1040 8408 : dtset%npfft=1
1041 8408 : dtset%nphf=1
1042 8408 : dtset%npimage=1
1043 8408 : dtset%np_spkpt=1
1044 8408 : dtset%nppert=1
1045 8408 : dtset%npspalch=0
1046 8408 : dtset%npspinor=1
1047 8408 : dtset%np_slk=1000000
1048 8408 : dtset%nslice=2
1049 8408 : dtset%nstep_mixed=0
1050 8408 : dtset%nqptdm=0
1051 8408 : dtset%nspden=1
1052 8408 : dtset%nspinor=1
1053 8408 : dtset%nsppol=1
1054 8408 : dtset%nsym=0 ! Actually, this default value is not used : it is to be reimposed before each call to ingeo in invars1
1055 8408 : dtset%ntimimage=1
1056 8408 : dtset%ntypalch=0
1057 8408 : dtset%ntyppure=-1
1058 248532 : dtset%nucdipmom(:,:)=zero
1059 8408 : dtset%nzchempot=0
1060 : !O
1061 8408 : dtset%optdriver=0
1062 : !P
1063 8408 : dtset%paral_rf=0
1064 8408 : dtset%paral_slice=0
1065 : !dtset%paral_kgb ! Is even initialized earlier.
1066 8408 : dtset%pawspnorb=0 ! will be changed to 1 as soon as usepaw==1 and nspinor==2
1067 18945 : dtset%pimass(:)=-one
1068 : !Q
1069 33632 : dtset%qptn=zero
1070 : !R
1071 33632 : dtset%red_efield(:)=zero
1072 33632 : dtset%red_dfield(:)=zero
1073 33632 : dtset%red_efieldbar(:)=zero
1074 122925 : dtset%rprim_orig(:,:,:)=zero
1075 17217 : dtset%rprim_orig(1,1,:)=one
1076 17217 : dtset%rprim_orig(2,2,:)=one
1077 17217 : dtset%rprim_orig(3,3,:)=one
1078 : !S
1079 8408 : dtset%slabzbeg=zero
1080 8408 : dtset%slabzend=zero
1081 18973 : dtset%so_psp(:)=1
1082 248532 : dtset%spinat(:,:)=zero
1083 248532 : dtset%spinat_cart(:,:)=zero
1084 248532 : dtset%spinat_in(:,:)=zero
1085 25224 : dtset%spinaxis(1:2)=zero
1086 8408 : dtset%spinaxis(3)=1
1087 : !T
1088 8408 : dtset%tfkinfunc=0
1089 68439 : dtset%typat(:)=0 ! This init is important because dimension of typat is mx%natom (and not natom).
1090 : !U
1091 8408 : dtset%use_gbt=0
1092 8408 : dtset%usedmatpu=0
1093 8408 : dtset%usedmft=0
1094 8408 : dtset%useexexch=0
1095 8408 : dtset%usepawu=0
1096 8408 : dtset%usepotzero=0
1097 8408 : dtset%use_slk=0
1098 8408 : dtset%use_oldchi=1
1099 : !V
1100 261733 : dtset%vel_orig(:,:,:)=zero
1101 122925 : dtset%vel_cell_orig(:,:,:)=zero
1102 : !W
1103 8408 : dtset%wtq=zero
1104 8408 : if (dtset%usepaw==0) dtset%wfoptalg=0
1105 8408 : if (dtset%usepaw/=0) dtset%wfoptalg=10
1106 8408 : if (dtset%optdriver==RUNL_GSTATE.and.dtset%paral_kgb>0) dtset%wfoptalg=14
1107 8408 : dtset%wvl_bigdft_comp=1
1108 :
1109 : !X
1110 261733 : dtset%xred_orig(:,:,:)=zero
1111 : !Y
1112 : !Z
1113 8408 : dtset%zora=0
1114 :
1115 : DBG_EXIT("COLL")
1116 :
1117 8408 : end subroutine indefo1
1118 : !!***
1119 :
1120 : !!****f* ABINIT/invars1
1121 : !! NAME
1122 : !! invars1
1123 : !!
1124 : !! FUNCTION
1125 : !! Initialize the dimensions needed to allocate the input arrays
1126 : !! for one dataset characterized by jdtset, by taking from string the necessary data.
1127 : !! Perform some preliminary checks and echo these dimensions.
1128 : !!
1129 : !! INPUTS
1130 : !! iout=unit number of output file
1131 : !! jdtset=number of the dataset looked for
1132 : !! lenstr=actual length of string
1133 : !! msym=default maximal number of symmetries
1134 : !! npsp1= number of pseudopotential files
1135 : !! zionpsp(npsp1)= valence charge over all psps
1136 : !! comm= MPI communicator
1137 : !!
1138 : !! OUTPUT
1139 : !! mband_upper=estimation of the maximum number of bands for any k-point
1140 : !!
1141 : !! SIDE EFFECTS
1142 : !! Input/Output (the default value is given in the calling routine)
1143 : !! dtset=<type datafiles_type>contains all input variables,
1144 : !! some of which are initialized here, while other were already
1145 : !! initialized, while some others will still be initialized later.
1146 : !! The list of records of dtset initialized in the present routine is:
1147 : !!
1148 : !! acell_orig,chrgat,densty,iatfix,kptopt,kptrlatt,
1149 : !! mkmem,mkqmem,mk1mem,natsph,natvshift,nconeq,nkpt,nkptgw,nkpthf,
1150 : !! nqptdm,nshiftk,nucdipmom,nzchempot,optdriver,
1151 : !! rprim_orig,rprimd_orig,shiftk,
1152 : !! spgroup,spinat,typat,vel_orig,vel_cell_orig,xred_orig
1153 : !!
1154 : !! bravais(11)=characteristics of Bravais lattice (see symlatt.F90)
1155 : !! symafm(1:msym)=(anti)ferromagnetic part of symmetry operations
1156 : !! symrel(3,3,1:msym)=symmetry operations in real space in terms of primitive translations
1157 : !! tnons(3,1:msym)=nonsymmorphic translations for symmetry operations
1158 : !! string*(*)=string of characters containing all input variables and data
1159 : !!
1160 : !! NOTES
1161 : !! Must set up the geometry of the system, needed to compute k point grids in an automatic fashion.
1162 : !! Treat separately mband_upper, since fband, cellcharge and zionpsp must be known for being able to initialize it.
1163 : !!
1164 : !! Defaults are provided in the calling routine.
1165 : !! Defaults are also provided here for the following variables:
1166 : !!
1167 : !! mband_upper, occopt, fband, cellcharge
1168 : !!
1169 : !! They should be kept consistent with defaults of the same variables provided to the invars routines.
1170 : !!
1171 : !! SOURCE
1172 :
1173 6968 : subroutine invars1(bravais,dtset,iout,jdtset,lenstr,mband_upper,msym,npsp1,&
1174 6968 : & string,symafm,symrel,tnons,zionpsp, comm)
1175 :
1176 : !Arguments ------------------------------------
1177 : !scalars
1178 : integer,intent(in) :: iout,jdtset,lenstr,msym,npsp1, comm
1179 : integer,intent(out) :: mband_upper
1180 : character(len=*),intent(inout) :: string
1181 : type(dataset_type),intent(inout) :: dtset
1182 : !arrays
1183 : integer,intent(inout) :: bravais(11),symafm(msym),symrel(3,3,msym)
1184 : real(dp),intent(inout) :: tnons(3,msym)
1185 : real(dp),intent(in) :: zionpsp(npsp1)
1186 :
1187 : !Local variables-------------------------------
1188 : !scalars
1189 : integer,parameter :: master = 0
1190 : integer :: chksymbreak,expert_user,found,ierr,iatom,ii,ikpt,iimage,index_blank,index_lower, tread_geo
1191 : integer :: index_typsymb,index_upper,ipsp,iscf,intimage,itypat,leave,marr
1192 : integer :: natnd,natom,nkpt,nkpthf,npsp,npspalch, ncid
1193 : integer :: nqpt,nspinor,nsppol,ntypat,ntypalch,ntyppure,occopt,response
1194 : integer :: rfddk,rfelfd,rfphon,rfstrs,rf2_dkdk,rf2_dkde,rfmagn
1195 : integer :: tfband,tnband,tread,tread_alt,tread_cart, my_rank, nprocs
1196 : real(dp) :: cellcharge,cellcharge_min, fband,kptnrm,kptrlen,sum_spinat,zelect,zval
1197 : character(len=1) :: blank=' ',string1
1198 : character(len=2) :: string2,symbol
1199 : character(len=500) :: msg
1200 : type(atomdata_t) :: atom
1201 : !arrays
1202 : integer :: cond_values(4),vacuum(3), units(2)
1203 6968 : integer,allocatable :: iatfix(:,:),iatnd(:),intarr(:),istwfk(:),nband(:),typat(:)
1204 : real(dp) :: acell(3),rprim(3,3),field_loc(3),field_cart(3),hloc(3,1),hcart(3,1)
1205 6968 : real(dp),allocatable :: amu(:),atndlist(:,:),chrgat(:),dprarr(:),kpt(:,:),kpthf(:,:),mixalch(:,:)
1206 6968 : real(dp),allocatable :: nucdipmom(:,:),ratsph(:),reaalloc(:),spinat(:,:),spinat_cart(:,:)
1207 6968 : real(dp),allocatable :: vel(:,:),vel_cell(:,:),wtk(:),xred(:,:),znucl(:)
1208 : character(len=32) :: cond_string(4)
1209 : character(len=fnlen) :: key_value
1210 6968 : character(len=len(string)) :: geo_string
1211 6968 : type(geo_t) :: geo
1212 : !************************************************************************
1213 :
1214 : !write(std_out,'(a)')' m_invars1%invars1 : enter '; call flush(std_out)
1215 :
1216 6968 : my_rank = xmpi_comm_rank(comm); nprocs = xmpi_comm_size(comm)
1217 20904 : units = [std_out, ab_out]
1218 :
1219 : ! This counter is incremented when we find a non-critical error.
1220 : ! The code outputs a warning and stops at end.
1221 6968 : leave = 0
1222 :
1223 : ! Some initialisations
1224 6968 : ierr=0
1225 34840 : cond_string(1:4)=' '
1226 6968 : cond_values(1:4)=(/0,0,0,0/)
1227 :
1228 : ! Read parameters
1229 6968 : marr=dtset%npsp;if (dtset%npsp<3) marr=3
1230 6968 : marr=max(marr,dtset%nimage)
1231 20904 : ABI_MALLOC(intarr,(marr))
1232 20904 : ABI_MALLOC(dprarr,(marr))
1233 :
1234 : !---------------------------------------------------------------------------
1235 :
1236 6968 : rfddk=0; rfelfd=0; rfphon=0; rfmagn=0; rfstrs=0; rf2_dkdk=0; rf2_dkde=0
1237 6968 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'rfddk',tread,'INT')
1238 6968 : if(tread==1) rfddk=intarr(1)
1239 6968 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'rfelfd',tread,'INT')
1240 6968 : if(tread==1) rfelfd=intarr(1)
1241 6968 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'rfmagn',tread,'INT')
1242 6968 : if(tread==1) rfmagn=intarr(1)
1243 6968 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'rfphon',tread,'INT')
1244 6968 : if(tread==1) rfphon=intarr(1)
1245 6968 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'rfstrs',tread,'INT')
1246 6968 : if(tread==1) rfstrs=intarr(1)
1247 6968 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'rf2_dkdk',tread,'INT')
1248 6968 : if(tread==1) rf2_dkdk=intarr(1)
1249 6968 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'rf2_dkde',tread,'INT')
1250 6968 : if(tread==1) rf2_dkde=intarr(1)
1251 :
1252 6968 : response=0
1253 6968 : if(rfddk/=0.or.rf2_dkdk/=0.or.rf2_dkde/=0.or.rfelfd/=0.or.rfphon/=0.or.rfstrs/=0.or.rfmagn/=0)response=1
1254 :
1255 6968 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'optdriver',tread,'INT')
1256 6968 : if (tread==1) then
1257 630 : dtset%optdriver=intarr(1)
1258 : else
1259 : ! If optdriver was not read, while response=1, set optdriver to 1
1260 6338 : if(response==1)dtset%optdriver=1
1261 : end if
1262 :
1263 : !---------------------------------------------------------------------------
1264 : !For now, waiting express parallelisation for recursion
1265 6968 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'tfkinfunc',tread,'INT')
1266 6968 : if(tread==1) dtset%tfkinfunc=intarr(1)
1267 :
1268 : !---------------------------------------------------------------------------
1269 : ! wvl_bigdft_comp, done here since default values of nline, nwfshist and iscf depend on its value (see indefo)
1270 6968 : if(dtset%usewvl==1) then
1271 0 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'wvl_bigdft_comp',tread,'INT')
1272 0 : if(tread==1) dtset%wvl_bigdft_comp=intarr(1)
1273 : end if
1274 :
1275 : !---------------------------------------------------------------------------
1276 :
1277 6968 : natom=dtset%natom
1278 6968 : npsp=dtset%npsp
1279 6968 : ntypat=dtset%ntypat
1280 :
1281 : call intagm(dprarr, intarr, jdtset, marr, 1, string(1:lenstr), 'structure', tread_geo, &
1282 6968 : 'KEY', key_value=geo_string)
1283 :
1284 6968 : if (tread_geo == 0) then
1285 : ! No default value for znucl
1286 6913 : call intagm(dprarr,intarr,jdtset,marr,dtset%npsp,string(1:lenstr),'znucl',tread,'DPR')
1287 15414 : if(tread==1) dtset%znucl(1:dtset%npsp)=dprarr(1:dtset%npsp)
1288 :
1289 6913 : if(tread/=1)then
1290 : write(msg, '(3a)' )&
1291 0 : 'The array znucl MUST be initialized in the input file while this is not done.',ch10,&
1292 0 : 'Action: initialize znucl in your input file.'
1293 0 : ABI_ERROR(msg)
1294 : end if
1295 :
1296 : else
1297 55 : call wrtout(std_out, sjoin(" Initializing lattice and positions from:", geo_string))
1298 55 : geo = geo_from_abivar_string(geo_string, comm)
1299 169 : dtset%znucl(1:dtset%ntypat) = geo%znucl
1300 55 : call geo%free()
1301 : end if
1302 :
1303 : ! The default for ratsph has already been initialized
1304 6968 : call intagm(dprarr,intarr,jdtset,marr,dtset%ntypat,string(1:lenstr),'ratsph',tread,'LEN')
1305 6968 : if(tread==1)then
1306 151 : do ii=1,dtset%ntypat
1307 151 : dtset%ratsph(ii)=dprarr(ii)
1308 : end do
1309 : end if
1310 20904 : ABI_MALLOC(ratsph,(dtset%ntypat))
1311 15563 : do ii=1,dtset%ntypat
1312 15563 : ratsph(ii)=dtset%ratsph(ii)
1313 : end do
1314 :
1315 : !Special treatment of _TYPAX (from a XYZ file), taking into account
1316 : !the fact that znucl does NOT depend on the dataset
1317 : !Examine all occurrences of '_TYPAX'
1318 :
1319 : do
1320 6969 : index_typsymb=index(string(1:lenstr),'_TYPAX')
1321 6969 : if(index_typsymb==0)exit
1322 : ! Replace '_TYPAX' by '_TYPAT'
1323 1 : string(index_typsymb:index_typsymb+5)='_TYPAT'
1324 1 : index_upper=index_typsymb+5
1325 : ! Must start from the first blank after the tag (including possible dtset_char)
1326 1 : index_upper=index(string(index_upper:lenstr),blank)+index_upper-1
1327 1 : index_lower=index_upper
1328 :
1329 : ! Examine all atoms (the end of the symbol string is delimited by a XX )
1330 : do
1331 6 : index_blank=index(string(index_upper:lenstr),blank)+index_upper-1
1332 6 : string2=string(index_blank+1:index_blank+2)
1333 6 : if(string2=="XX")exit
1334 5 : found=0
1335 : ! Find the matching symbol
1336 15 : do ipsp=1,dtset%npsp
1337 10 : call atomdata_from_znucl(atom,dtset%znucl(ipsp))
1338 10 : symbol = atom%symbol
1339 10 : call inupper(symbol)
1340 10 : call inupper(string2)
1341 : ! write(std_out,'(a)')' invars1 : before test, trim(adjustl(symbol)),trim(adjustl(string2))'
1342 : ! write(std_out,'(5a)' )'"',trim(adjustl(symbol)),'","',trim(adjustl(string2)),'"'
1343 25 : if(trim(adjustl(symbol))==trim(adjustl(string2)))then
1344 5 : found=1
1345 5 : index_upper=index_blank+1
1346 : ! Cannot deal properly with more that 9 psps
1347 5 : if(ipsp>=10)then
1348 0 : ABI_ERROR('Need to use a pseudopotential with number larger than 9. Not allowed yet.')
1349 : end if
1350 :
1351 : ! write(std_out,*)' invars1 : found ipsp=',ipsp
1352 5 : write(string1,'(i1)')ipsp
1353 5 : string(index_lower:index_lower+1)=blank//string1
1354 5 : index_lower=index_lower+2
1355 : end if
1356 : end do ! ipsp
1357 : ! if not found ...
1358 6 : if(found==0)then
1359 : write(msg,'(6a)' )&
1360 0 : & 'Did not find matching pseudopotential for XYZ atomic symbol,',ch10,&
1361 0 : & 'with value ',string2,ch10,&
1362 0 : & 'Action: check that the atoms required by the XYZ file correspond to one psp file.'
1363 0 : ABI_ERROR(msg)
1364 : end if
1365 : end do ! Loop on atoms
1366 : ! One should find blanks after the last significant type value
1367 6969 : string(index_lower:index_blank+2)=blank
1368 : end do ! loop to identify _TYPAX
1369 :
1370 : !---------------------------------------------------------------------------
1371 :
1372 : ! Here, set up quantities that are related to geometrical description of the system (acell,rprim,xred), as well as
1373 : ! initial velocity(vel), cellcharge (to compute mband_upper) and spin of atoms (chrgat,spinat), nuclear dipole moments of atoms (nucdipmom),
1374 : ! the symmetries (symrel,symafm, and tnons) and the list of fixed atoms (iatfix,iatfixx,iatfixy,iatfixz).
1375 : ! Arrays have already been dimensioned thanks to the knowledge of msym and mx%natom
1376 :
1377 : !ji: We need to read the electric field before calling ingeo
1378 : !****** Temporary ******
1379 :
1380 6968 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'berryopt',tread,'INT')
1381 6968 : if(tread==1) dtset%berryopt=intarr(1)
1382 :
1383 6968 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'berrysav',tread,'INT')
1384 6968 : if(tread==1) dtset%berrysav=intarr(1)
1385 :
1386 6968 : call intagm(dprarr,intarr,jdtset,marr,3,string(1:lenstr),'bfield',tread,'DPR')
1387 7019 : if (tread==1) dtset%bfield(1:3) = dprarr(1:3)
1388 :
1389 6968 : call intagm(dprarr,intarr,jdtset,marr,3,string(1:lenstr),'dfield',tread,'DPR')
1390 6968 : if (tread==1) dtset%dfield(1:3) = dprarr(1:3)
1391 :
1392 6968 : call intagm(dprarr,intarr,jdtset,marr,3,string(1:lenstr),'efield',tread,'DPR')
1393 7055 : if (tread==1) dtset%efield(1:3) = dprarr(1:3)
1394 :
1395 6968 : call intagm(dprarr,intarr,jdtset,marr,3,string(1:lenstr),'red_dfield',tread,'DPR')
1396 6968 : if (tread==1) dtset%red_dfield(1:3) = dprarr(1:3)
1397 :
1398 6968 : call intagm(dprarr,intarr,jdtset,marr,3,string(1:lenstr),'red_efield',tread,'DPR')
1399 6968 : if (tread==1) dtset%red_efield(1:3) = dprarr(1:3)
1400 :
1401 6968 : call intagm(dprarr,intarr,jdtset,marr,3,string(1:lenstr),'red_efieldbar',tread,'DPR')
1402 6968 : if (tread==1) dtset%red_efieldbar(1:3) = dprarr(1:3)
1403 :
1404 6968 : call intagm(dprarr,intarr,jdtset,marr,3,string(1:lenstr),'jfielddir',tread,'INT')
1405 6968 : if(tread==1) dtset%jfielddir(1:3)=intarr(1:3)
1406 :
1407 : ! read in natnd and initialize iatnd, atndlist helper variables
1408 : ! these provide a simpler alternative to inputting the full nucdipmom list
1409 6968 : natnd=0
1410 6968 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'natnd',tread,'INT')
1411 6968 : if(tread==1) natnd=intarr(1)
1412 6968 : dtset%natnd=natnd
1413 20904 : ABI_MALLOC(iatnd,(natnd))
1414 20904 : ABI_MALLOC(atndlist,(3,natnd))
1415 7058 : iatnd(:)=0; atndlist(:,:)=zero
1416 :
1417 : ! We need to know nsppol/nspinor/nspden before calling ingeo
1418 6968 : nsppol=dtset%nsppol
1419 6968 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'nsppol',tread,'INT')
1420 6968 : if(tread==1) nsppol=intarr(1)
1421 :
1422 : !Alternate SIESTA definition of nsppol
1423 6968 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'SpinPolarized',tread_alt,'LOG')
1424 6968 : if(tread_alt==1)then
1425 1 : if(tread==1)then
1426 0 : msg = 'nsppol and SpinPolarized cannot be specified simultaneously for the same dataset.'
1427 0 : ABI_ERROR_NOSTOP(msg, leave)
1428 : else
1429 : ! Note that SpinPolarized is a logical input variable
1430 1 : nsppol=1
1431 1 : if(intarr(1)==1)nsppol=2
1432 : tread=1
1433 : end if
1434 : end if
1435 6968 : dtset%nsppol=nsppol
1436 :
1437 6968 : call intagm(dprarr,intarr,jdtset,marr,3,string(1:lenstr),'spinaxis',tread,'DPR')
1438 6974 : if (tread==1) dtset%spinaxis(1:3) = dprarr(1:3)
1439 :
1440 : ! here are ZORA, nspinor, pawspnorb flags
1441 : ! flag for ZORA (zeroth order regularized approximation for relativistic terms)
1442 6968 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'zora',tread,'INT')
1443 6968 : if (tread == 1) dtset%zora = intarr(1)
1444 :
1445 6968 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'nspinor',tread,'INT')
1446 6968 : if(tread==1) dtset%nspinor=intarr(1)
1447 :
1448 : !Has to read pawspnorb now, in order to adjust nspinor
1449 : !Also, if nspinor=2, turn on spin-orbit coupling by default, here for the PAW case. NC case is treated elsewhere.
1450 6968 : if (dtset%usepaw>0)then
1451 : ! Change the default value
1452 1177 : if(dtset%nspinor==2)dtset%pawspnorb=1
1453 1177 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'pawspnorb',tread,'INT')
1454 1177 : if(tread==1)then
1455 64 : dtset%pawspnorb=intarr(1)
1456 64 : if(dtset%pawspnorb>0) dtset%nspinor=2
1457 : else
1458 1113 : if(dtset%nspinor==2)then
1459 96 : write(msg, '(4a)' ) ch10,&
1460 96 : ' invars1: COMMENT -',ch10,&
1461 192 : ' With nspinor=2 and usepaw=1, pawspnorb=1 has been switched on by default.'
1462 96 : call wrtout(iout, msg,'COLL')
1463 : end if
1464 : end if
1465 : end if
1466 6968 : if ( (dtset%zora .GT. 1) .OR. (dtset%zora < 0) ) then
1467 14 : dtset%nspinor=2
1468 14 : dtset%pawspnorb=1
1469 : end if
1470 6968 : nspinor=dtset%nspinor
1471 :
1472 6968 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'nspden',tread,'INT')
1473 6968 : if(tread==1) then
1474 504 : dtset%nspden=intarr(1)
1475 : else
1476 6464 : dtset%nspden=dtset%nsppol
1477 : end if
1478 :
1479 6968 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'ntypalch',tread,'INT')
1480 6968 : if(tread==1) dtset%ntypalch=intarr(1)
1481 :
1482 6968 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'nzchempot',tread,'INT')
1483 6968 : if(tread==1) dtset%nzchempot=intarr(1)
1484 :
1485 6968 : ntypalch=dtset%ntypalch
1486 6968 : if(ntypalch>ntypat)then
1487 : write(msg, '(3a,i0,a,i0,a,a)' )&
1488 0 : 'The input variable ntypalch must be smaller than ntypat, while it is',ch10,&
1489 0 : 'ntypalch=',dtset%ntypalch,', and ntypat=',ntypat,ch10,&
1490 0 : 'Action: check ntypalch vs ntypat in your input file.'
1491 0 : ABI_ERROR(msg)
1492 : end if
1493 :
1494 6968 : ntyppure=ntypat-ntypalch
1495 6968 : dtset%ntyppure=ntyppure
1496 6968 : npspalch=npsp-ntyppure
1497 6968 : dtset%npspalch=npspalch
1498 6968 : if(npspalch<0)then
1499 : write(msg, '(a,i0,2a,i0,a,a)' )&
1500 0 : 'The number of available pseudopotentials, npsp=',npsp,ch10,&
1501 0 : 'is smaller than the requested number of types of pure atoms, ntyppure=',ntyppure,ch10,&
1502 0 : 'Action: check ntypalch versus ntypat and npsp in your input file.'
1503 0 : ABI_ERROR(msg)
1504 : end if
1505 :
1506 6968 : if(ntypalch>0)then
1507 20 : call intagm(dprarr,intarr,jdtset,marr,ntypalch,string(1:lenstr),'algalch',tread,'INT')
1508 23 : if(tread==1) dtset%algalch(1:ntypalch)=intarr(1:ntypalch)
1509 20 : if (tread_geo /= 0) then
1510 0 : ABI_ERROR("Alchemical mixing cannot be used with geo variable, use typat, znucl etc.")
1511 : end if
1512 : end if
1513 :
1514 : !Read the hspinfield
1515 6968 : field_loc(:) = zero; field_cart(:) = zero
1516 6968 : hloc(:,1) = zero; hcart(:,1) = zero
1517 6968 : call intagm(dprarr,intarr,jdtset,marr,3,string(1:lenstr),'hspinfield',tread,'BFI')
1518 6968 : if(tread==0) then
1519 6956 : call intagm(dprarr,intarr,jdtset,marr,3,string(1:lenstr),'zeemanfield',tread,'BFI')
1520 6956 : if (tread == 1) then
1521 : write(msg, '(3a)')&
1522 0 : 'Input variable "zeemanfield" is deprecated.', ch10, &
1523 0 : 'Its value has been assigned to "hspinfield", please update your input.'
1524 0 : ABI_COMMENT(msg)
1525 : end if
1526 : end if
1527 :
1528 6968 : if (tread == 1) then
1529 48 : field_loc(1:3) = dprarr(1:3)
1530 48 : dtset%hspinfield_in(1:3)=field_loc(1:3)
1531 : end if
1532 :
1533 6968 : call intagm(dprarr,intarr,jdtset,marr,3,string(1:lenstr),'hspinfield_cart',tread_cart,'BFI')
1534 6968 : if (tread_cart==1) then
1535 0 : field_cart(1:3) = dprarr(1:3)
1536 0 : dtset%hspinfield_cart(1:3) = field_cart(1:3)
1537 : end if
1538 :
1539 6968 : hloc(:,1) = field_loc(:); hcart(:,1) = field_cart(:)
1540 6968 : call checkspvec('hspinfield',1,dtset%spinaxis,tread,tread_cart,hloc,hcart)
1541 27872 : dtset%hspinfield(1:3) = hloc(:,1)
1542 6968 : if (tread == 0 .and. tread_cart == 1) dtset%hspinfield_in(1:3) = hloc(:,1)
1543 7004 : if (tread == 1 .and. tread_cart == 0) dtset%hspinfield_cart(1:3) = hcart(:,1)
1544 :
1545 6968 : if(tread==1 .or. tread_cart==1) then
1546 12 : if(dtset%nspden == 2)then
1547 : write(msg,'(7a)')&
1548 2 : 'A spin magnetic field (hspinfield) has been specified without noncollinear spins.',ch10,&
1549 4 : 'Only the z-component of the magnetic field will be used.'
1550 2 : ABI_WARNING(msg)
1551 10 : else if (dtset%nspden == 1)then
1552 : write(msg, '(a,a,a)' )&
1553 0 : 'A spin magnetic field (hspinfield) has been specified for a non-spin-polarized calculation.',ch10,&
1554 0 : 'Action: check the input file.'
1555 0 : ABI_ERROR(msg)
1556 : end if
1557 : end if
1558 :
1559 : !Initialize geometry of the system, for different images. Also initialize cellcharge_min to be used later for estimating mband_upper..
1560 20904 : ABI_MALLOC(amu,(ntypat))
1561 27872 : ABI_MALLOC(mixalch,(npspalch,ntypalch))
1562 20904 : ABI_MALLOC(vel,(3,natom))
1563 6968 : ABI_MALLOC(vel_cell,(3,3))
1564 13936 : ABI_MALLOC(xred,(3,natom))
1565 : !Only take into account negative cellcharge, to compute maximum number of bands, so initialize cellcharge_min to zero
1566 6968 : cellcharge_min=zero
1567 6968 : intimage=2 ; if(dtset%nimage==1)intimage=1
1568 14241 : do ii=1,dtset%nimage+1
1569 14196 : iimage=ii
1570 14196 : if(dtset%nimage==1 .and. ii==2)exit
1571 7278 : if(dtset%nimage==2 .and. ii==3)exit
1572 7273 : if(dtset%nimage> 2 .and. ii==intimage)cycle ! Will do the intermediate reference image at the last reading
1573 7228 : if(dtset%nimage>=2 .and. ii==dtset%nimage+1)iimage=intimage
1574 :
1575 7228 : if (dtset%nimage /= 1) call wrtout(std_out, sjoin(' invars1: treat image number: ',itoa(iimage)))
1576 :
1577 : ! Need to reset nsym to default value for each image
1578 7228 : dtset%nsym=0
1579 :
1580 : ! Call ingeo for each image in turn, with the possible default values
1581 28912 : acell=dtset%acell_orig(1:3,iimage)
1582 23523 : amu=dtset%amu_orig(1:ntypat,iimage)
1583 14534 : mixalch=dtset%mixalch_orig(1:npspalch,1:ntypalch,iimage)
1584 93964 : rprim=dtset%rprim_orig(1:3,1:3,iimage)
1585 169420 : vel=dtset%vel_orig(1:3,1:natom,iimage)
1586 101192 : vel_cell=dtset%vel_cell_orig(1:3,1:3,iimage)
1587 169420 : xred=dtset%xred_orig(1:3,1:natom,iimage)
1588 :
1589 : ! if getxred or getxcart we need to import xred before entering ingeo.
1590 : ! NB: xred/cart might be re-updated at runtime after running source dtset
1591 : ! call intagm(dprarr,intarr,source_dtset,marr,3,string(1:lenstr),'getxred',tread,'INT')
1592 : ! if (tread==1 .or. tread_geo==1)
1593 : ! source_dtset =
1594 : ! if (== -1) source_dtset = jdtset-1
1595 : ! end if
1596 : ! call intagm(dprarr,intarr,source_dtset,marr,3,string(1:lenstr),'getxcart',tread_geo,'INT')
1597 : !
1598 :
1599 21684 : ABI_MALLOC(chrgat,(natom))
1600 21684 : ABI_MALLOC(iatfix,(3,natom))
1601 21684 : ABI_MALLOC(nucdipmom,(3,natom))
1602 14456 : ABI_MALLOC(spinat,(3,natom))
1603 14456 : ABI_MALLOC(spinat_cart,(3,natom))
1604 21684 : ABI_MALLOC(typat,(natom))
1605 21684 : ABI_MALLOC(znucl,(dtset%npsp))
1606 45969 : chrgat(1:natom)=dtset%chrgat(1:natom)
1607 162192 : nucdipmom(1:3,1:natom)=dtset%nucdipmom(1:3,1:natom)
1608 162192 : spinat(1:3,1:natom)=dtset%spinat(1:3,1:natom)
1609 162192 : spinat_cart(1:3,1:natom)=dtset%spinat_cart(1:3,1:natom)
1610 16321 : znucl(1:dtset%npsp)=dtset%znucl(1:dtset%npsp)
1611 :
1612 : !write(std_out,'(a)')' m_invars1%invars1 : before ingeo '; call flush(std_out)
1613 :
1614 : call ingeo(acell,amu,atndlist,bravais,chrgat,dtset,dtset%field_red(1:3),&
1615 : dtset%field_red_axial(1:3),dtset%genafm(1:3),iatfix,&
1616 : iatnd,dtset%icoulomb,iimage,iout,jdtset,dtset%jellslab,lenstr,mixalch,&
1617 : msym,natnd,natom,dtset%nimage,dtset%npsp,npspalch,dtset%nspden,&
1618 : dtset%nsym,ntypalch,dtset%ntypat,nucdipmom,dtset%nzchempot,&
1619 : dtset%pawspnorb,dtset%ptgroupma,ratsph,&
1620 : rprim,dtset%slabzbeg,dtset%slabzend,dtset%spgroup,spinat,spinat_cart,&
1621 : string,dtset%supercell_latt,symafm,dtset%symmorphi,symrel,tnons,dtset%tolsym,&
1622 7228 : typat,vel,vel_cell,xred,znucl, comm)
1623 :
1624 : !write(std_out,'(a)')' m_invars1%invars1 : after ingeo '; call flush(std_out)
1625 :
1626 45969 : dtset%chrgat(1:natom)=chrgat(1:natom)
1627 162192 : dtset%iatfix(1:3,1:natom)=iatfix(1:3,1:natom)
1628 162192 : dtset%nucdipmom(1:3,1:natom)=nucdipmom(1:3,1:natom)
1629 162192 : dtset%spinat(1:3,1:natom)=spinat(1:3,1:natom)
1630 162192 : dtset%spinat_cart(1:3,1:natom)=spinat_cart(1:3,1:natom)
1631 45969 : dtset%typat(1:natom)=typat(1:natom)
1632 7228 : ABI_FREE(chrgat)
1633 7228 : ABI_FREE(iatfix)
1634 7228 : ABI_FREE(nucdipmom)
1635 7228 : ABI_FREE(spinat)
1636 7228 : ABI_FREE(spinat_cart)
1637 7228 : ABI_FREE(typat)
1638 7228 : ABI_FREE(znucl)
1639 28912 : dtset%acell_orig(1:3,iimage)=acell
1640 16295 : dtset%amu_orig(1:ntypat,iimage)=amu
1641 7306 : dtset%mixalch_orig(1:npspalch,1:ntypalch,iimage)=mixalch
1642 93964 : dtset%rprim_orig(1:3,1:3,iimage)=rprim
1643 162192 : dtset%vel_orig(1:3,1:natom,iimage)=vel
1644 93964 : dtset%vel_cell_orig(1:3,1:3,iimage)=vel_cell
1645 162192 : dtset%xred_orig(1:3,1:natom,iimage)=xred
1646 7228 : call mkrdim(dtset%acell_orig(1:3,iimage),dtset%rprim_orig(1:3,1:3,iimage),dtset%rprimd_orig(1:3,1:3,iimage))
1647 :
1648 7228 : if(allocated(dtset%iatnd)) then
1649 7228 : ABI_FREE(dtset%iatnd)
1650 : end if
1651 21684 : ABI_MALLOC(dtset%iatnd,(natnd))
1652 7246 : dtset%iatnd(1:natnd)=iatnd(1:natnd)
1653 7228 : if(allocated(dtset%atndlist)) then
1654 7228 : ABI_FREE(dtset%atndlist)
1655 : end if
1656 21684 : ABI_MALLOC(dtset%atndlist,(3,natnd))
1657 7300 : dtset%atndlist(1:3,1:natnd)=atndlist(1:3,1:natnd)
1658 :
1659 : ! Read cellcharge for each image, but use it only to initialize cellcharge_min
1660 : ! The old name 'charge' is still tolerated. Will be removed in due time.
1661 7228 : cellcharge=zero
1662 : ! Initialize cellcharge with the value for the first image
1663 7228 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'cellcharge',tread,'DPR')
1664 7228 : if(tread==1)then
1665 34 : cellcharge=dprarr(1)
1666 : else
1667 7194 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'charge',tread,'DPR')
1668 7194 : if(tread==1) cellcharge=dprarr(1)
1669 : endif
1670 : ! Possibly overwrite cellcharge from the first image with a specific value for the current image
1671 7228 : call intagm_img(dprarr,iimage,jdtset,lenstr,dtset%nimage,1,string,'cellcharge',tread_alt,'DPR')
1672 7228 : if(tread_alt==1)then
1673 4 : cellcharge=dprarr(1)
1674 : else
1675 7224 : call intagm_img(dprarr,iimage,jdtset,lenstr,dtset%nimage,1,string,'charge',tread_alt,'DPR')
1676 7224 : if(tread_alt==1) cellcharge=dprarr(1)
1677 : endif
1678 :
1679 6968 : if(cellcharge < cellcharge_min)cellcharge_min=cellcharge
1680 : end do
1681 :
1682 6968 : if(allocated(iatnd)) then
1683 6968 : ABI_FREE(iatnd)
1684 : end if
1685 6968 : if(allocated(atndlist)) then
1686 6968 : ABI_FREE(atndlist)
1687 : end if
1688 :
1689 6968 : ABI_FREE(amu)
1690 6968 : ABI_FREE(mixalch)
1691 6968 : ABI_FREE(vel)
1692 6968 : ABI_FREE(vel_cell)
1693 6968 : ABI_FREE(xred)
1694 :
1695 : ! Examine whether there is some vacuum space in the unit cell
1696 : call invacuum(jdtset,lenstr,natom,dtset%rprimd_orig(1:3,1:3,intimage),string,vacuum,&
1697 6968 : dtset%xred_orig(1:3,1:natom,intimage))
1698 :
1699 : !write(std_out,'(a)')' m_invars1%invars1 : after invacuum '; call flush(std_out)
1700 :
1701 : !write(std_out,*)' invars1: before inkpts, dtset%mixalch_orig(1:npspalch,1:ntypalch,:)=',&
1702 : !dtset%mixalch_orig(1:npspalch,1:ntypalch,1:dtset%nimage)
1703 :
1704 : !---------------------------------------------------------------------------
1705 :
1706 : !Set up k point grid number
1707 : !First, get additional information
1708 6968 : dtset%kptopt=1
1709 6968 : if(dtset%nspden==4)dtset%kptopt=4
1710 6968 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'kptopt',tread,'INT')
1711 6968 : if(tread==1) dtset%kptopt=intarr(1)
1712 :
1713 : ! In EPH we may want to change qptopt when generating the IBZ for phonons and DFPT potentials.
1714 : ! Typical example: we have a DDB/DDVB with q/-q and we want to reintroduce TR for testing purposes.
1715 : ! For this reason, the default value of qptopt is set to zero if RUNL_EPH.
1716 : ! EPH will use this value as sentinel to understand if qptopt should be set equal to kptopt
1717 : ! or if it should be taken from the input file.
1718 :
1719 6968 : dtset%qptopt=1
1720 6968 : if (dtset%optdriver == RUNL_EPH) dtset%qptopt = 0
1721 6968 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'qptopt',tread,'INT')
1722 6968 : if(tread==1) dtset%qptopt=intarr(1)
1723 :
1724 6968 : iscf=5
1725 6968 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'iscf',tread,'INT')
1726 6968 : if(tread==1) iscf=intarr(1)
1727 :
1728 6968 : dtset%natsph=dtset%natom
1729 6968 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'natsph',tread,'INT')
1730 6968 : if(tread==1) dtset%natsph=intarr(1)
1731 :
1732 6968 : dtset%natsph_extra=0
1733 6968 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'natsph_extra',tread,'INT')
1734 6968 : if(tread==1) dtset%natsph_extra=intarr(1)
1735 :
1736 6968 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'natvshift',tread,'INT')
1737 6968 : if(tread==1) dtset%natvshift=intarr(1)
1738 :
1739 6968 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'nconeq',tread,'INT')
1740 6968 : if(tread==1) dtset%nconeq=intarr(1)
1741 :
1742 6968 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'nkptgw',tread,'INT')
1743 6968 : if(tread==1) dtset%nkptgw=intarr(1)
1744 6968 : if (dtset%nkptgw<0) then
1745 : write(msg, '(a,i0,4a)' )&
1746 0 : 'Input nkptgw must be >= 0, but was ',dtset%nkptgw,ch10,&
1747 0 : 'This is not allowed.',ch10,'Action: check the input file.'
1748 0 : ABI_ERROR(msg)
1749 : end if
1750 :
1751 : ! Number of points for long wavelength limit. Default is dtset%gw_nqlwl=0
1752 6968 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'gw_nqlwl',tread,'INT')
1753 6968 : if(tread==1) dtset%gw_nqlwl=intarr(1)
1754 6968 : if (dtset%gw_nqlwl<0) then
1755 : write(msg, '(a,i0,4a)' )&
1756 0 : 'Input gw_nqlwl must be > 0, but was ',dtset%gw_nqlwl,ch10,&
1757 0 : 'This is not allowed.',ch10,'Action: check the input file.'
1758 0 : ABI_ERROR(msg)
1759 : end if
1760 :
1761 : ! Read number of k-points from input file (if specified)
1762 6968 : nkpt=0
1763 6968 : if(dtset%kptopt==0)nkpt=1
1764 6968 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'nkpt',tread,'INT')
1765 6968 : if(tread==1) nkpt=intarr(1)
1766 :
1767 : ! or from KERANGE file.
1768 6968 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr), "getkerange_filepath", tread, 'KEY', key_value=key_value)
1769 6968 : if (tread==1) dtset%getkerange_filepath = key_value
1770 :
1771 6968 : if (dtset%getkerange_filepath /= ABI_NOFILE) then
1772 : ! Get number of k-points in sigma_erange energy windows.
1773 : !dtset%kptopt = 0
1774 2 : if (my_rank == master) then
1775 2 : NCF_CHECK(nctk_open_read(ncid, dtset%getkerange_filepath, xmpi_comm_self))
1776 2 : NCF_CHECK(nctk_get_dim(ncid, "nkpt_inerange", nkpt, datamode=.True.))
1777 2 : NCF_CHECK(nf90_close(ncid))
1778 : end if
1779 2 : call xmpi_bcast(nkpt, master, comm, ierr)
1780 : end if
1781 :
1782 6968 : dtset%nkpt = nkpt
1783 :
1784 6968 : call chkint_ge(0,0,cond_string,cond_values,ierr,'nkpt',nkpt,0,iout)
1785 6968 : if (dtset%kptopt==0) then
1786 3180 : cond_string(1)='kptopt'; cond_values(1)=0
1787 3180 : call chkint_ge(1,1,cond_string,cond_values,ierr,'nkpt',nkpt,1,iout)
1788 : end if
1789 :
1790 6968 : nkpthf=nkpt
1791 6968 : dtset%nkpthf=nkpt
1792 :
1793 : ! Will compute the actual value of nkpt, if needed. Otherwise,
1794 : ! test that the value of nkpt is OK, if kptopt/=0
1795 : ! Set up dummy arrays istwfk, kpt, wtk
1796 :
1797 : !write(std_out,'(a)')' m_invars1%invars1 : before nkpt/=0 '; call flush(std_out)
1798 :
1799 6968 : if(nkpt/=0 .or. dtset%kptopt/=0)then
1800 20904 : ABI_MALLOC(istwfk,(nkpt))
1801 20904 : ABI_MALLOC(kpt,(3,nkpt))
1802 13936 : ABI_MALLOC(kpthf,(3,nkpthf))
1803 20904 : ABI_MALLOC(wtk,(nkpt))
1804 : ! Here, occopt is also a dummy argument
1805 90584 : occopt=1; dtset%nshiftk=1; dtset%kptrlatt(:,:)=0
1806 :
1807 21471 : kptrlen=20.0_dp ; wtk(:)=1.0_dp
1808 5860088 : dtset%shiftk(:,:)=half
1809 :
1810 6968 : nqpt=0
1811 6968 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'nqpt',tread,'INT')
1812 6968 : if(tread==1) nqpt=intarr(1)
1813 :
1814 6968 : expert_user=0
1815 6968 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'expert_user',tread,'INT')
1816 6968 : if (tread==1) expert_user=intarr(1)
1817 :
1818 : ! The default value of chksymbreak depends on expert_user but we still allow user to specify it.
1819 6968 : chksymbreak=1; if (expert_user > 0) chksymbreak = 0
1820 6968 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'chksymbreak',tread,'INT')
1821 6968 : if(tread==1) chksymbreak=intarr(1)
1822 :
1823 : ! Use the first image to predict k and/or q points, except if an intermediate image is available
1824 6968 : intimage=1; if(dtset%nimage>2)intimage=(1+dtset%nimage)/2
1825 :
1826 : !write(std_out,'(a)')' m_invars1%invars1 : before inqpt'; call flush(std_out)
1827 :
1828 : ! Find the q-point, if any.
1829 6968 : if(nqpt/=0)then
1830 : call inqpt(chksymbreak,std_out,jdtset,lenstr,msym,natom,dtset%qptn,dtset%wtq,&
1831 : dtset%rprimd_orig(1:3,1:3,intimage),dtset%spinat,string,dtset%typat,&
1832 713 : vacuum,dtset%xred_orig(1:3,1:natom,intimage),dtset%qptrlatt)
1833 : endif
1834 :
1835 : ! Find the k point grid
1836 : call inkpts(bravais,chksymbreak,dtset%fockdownsampling,iout,iscf,istwfk,jdtset,&
1837 : kpt,kpthf,dtset%kptopt,kptnrm,dtset%kptrlatt_orig,dtset%kptrlatt,kptrlen,lenstr,msym, dtset%getkerange_filepath, &
1838 : nkpt,nkpthf,nqpt,dtset%ngkpt,dtset%nshiftk,dtset%nshiftk_orig,dtset%shiftk_orig,dtset%nsym,&
1839 : occopt,dtset%qptn,response,dtset%rprimd_orig(1:3,1:3,intimage),dtset%shiftk,&
1840 6968 : string,symafm,symrel,vacuum,wtk,comm)
1841 :
1842 : !write(std_out,'(a)')' m_invars1%invars1 : after inkpts'; call flush(std_out)
1843 :
1844 6955 : ABI_FREE(istwfk)
1845 6955 : ABI_FREE(kpt)
1846 6955 : ABI_FREE(kpthf)
1847 6955 : ABI_FREE(wtk)
1848 :
1849 : ! nkpt and nkpthf have been computed, as well as the k point grid, if needed
1850 6955 : dtset%nkpt=nkpt
1851 6955 : dtset%nkpthf=nkpthf
1852 : end if
1853 :
1854 : !write(std_out,'(a)')' m_invars1%invars1 : after nkpt/=0 '; call flush(std_out)
1855 :
1856 6955 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'nqptdm',tread,'INT')
1857 6955 : if(tread==1) dtset%nqptdm=intarr(1)
1858 :
1859 6955 : if (dtset%nqptdm<-1) then
1860 : write(msg, '(a,i0,4a)' )&
1861 0 : 'Input nqptdm must be >= 0, but was ',dtset%nqptdm,ch10,&
1862 0 : 'This is not allowed.',ch10,'Action: check the input file.'
1863 0 : ABI_ERROR(msg)
1864 : end if
1865 :
1866 6955 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'nzchempot',tread,'INT')
1867 6955 : if(tread==1) dtset%nzchempot=intarr(1)
1868 :
1869 6955 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'cd_customnimfrqs',tread,'INT')
1870 6955 : if(tread==1) dtset%cd_customnimfrqs=intarr(1)
1871 :
1872 6955 : if (dtset%cd_customnimfrqs<0) then
1873 : write(msg, '(a,i0,4a)' )&
1874 0 : 'Input cd_customnimfrqs must be >= 0, but was ',dtset%cd_customnimfrqs,ch10,&
1875 0 : 'This is not allowed.',ch10,'Action: check the input file.'
1876 0 : ABI_ERROR(msg)
1877 : end if
1878 :
1879 6955 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'gw_customnfreqsp',tread,'INT')
1880 6955 : if(tread==1) dtset%gw_customnfreqsp=intarr(1)
1881 :
1882 6955 : if (dtset%gw_customnfreqsp<0) then
1883 : write(msg, '(a,i0,4a)' )&
1884 0 : 'Input gw_customnfreqsp must be >= 0, but was ',dtset%gw_customnfreqsp,ch10,&
1885 0 : 'This is not allowed.',ch10,'Action: check the input file.'
1886 0 : ABI_ERROR(msg)
1887 : end if
1888 :
1889 6955 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'gwls_n_proj_freq',tread,'INT')
1890 6955 : if(tread==1) dtset%gwls_n_proj_freq=intarr(1)
1891 :
1892 6955 : if (dtset%gwls_n_proj_freq<0) then
1893 : write(msg, '(a,i0,4a)' )&
1894 0 : 'Input gwls_n_proj_freq must be >= 0, but was ',dtset%gwls_n_proj_freq,ch10,&
1895 0 : 'This is not allowed.',ch10,'Action: check the input file.'
1896 0 : ABI_ERROR(msg)
1897 : end if
1898 :
1899 6955 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'efmas_calc_dirs',tread,'INT')
1900 6955 : if(tread==1) dtset%efmas_calc_dirs=intarr(1)
1901 :
1902 6955 : if (ABS(dtset%efmas_calc_dirs)>3) then
1903 : write(msg, '(a,i0,4a)' )&
1904 0 : 'Input efmas_calc_dirs must be between -3 and 3, but was ',dtset%efmas_calc_dirs,ch10,&
1905 0 : 'This is not allowed.',ch10,'Action: check the input file.'
1906 0 : ABI_ERROR(msg)
1907 : end if
1908 :
1909 6955 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'efmas_n_dirs',tread,'INT')
1910 6955 : if(tread==1) dtset%efmas_n_dirs=intarr(1)
1911 :
1912 6955 : if (dtset%efmas_n_dirs<0) then
1913 : write(msg, '(a,i0,4a)' )&
1914 0 : 'Input efmas_n_dirs must be >= 0, but was ',dtset%efmas_n_dirs,ch10,&
1915 0 : 'This is not allowed.',ch10,'Action: check the input file.'
1916 0 : ABI_ERROR(msg)
1917 : end if
1918 :
1919 : !---------------------------------------------------------------------------
1920 :
1921 : !write(std_out,'(a)')' m_invars1%invars1 : before nnos '; call flush(std_out)
1922 :
1923 6955 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'nnos',tread,'INT')
1924 6955 : if(tread==1) dtset%nnos=intarr(1)
1925 :
1926 6955 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'ga_n_rules',tread,'INT')
1927 6955 : if(tread==1) dtset%ga_n_rules=intarr(1)
1928 :
1929 : ! Perform the first checks
1930 : ! Check that nkpt is greater than 0
1931 6955 : if (nkpt<=0) then
1932 0 : write(msg, '(a,i0)' )'After inkpts, nkpt must be > 0, but was ',nkpt
1933 0 : ABI_ERROR_NOSTOP(msg, leave)
1934 : end if
1935 :
1936 : ! Check that nsppol is 1 or 2
1937 6955 : if (nsppol/=1 .and. nsppol/=2) then
1938 0 : write(msg, '(a,i0)' )'Input nsppol must be 1 or 2, but was ',nsppol
1939 0 : ABI_ERROR_NOSTOP(msg, leave)
1940 : end if
1941 :
1942 : ! Check that nspinor is 1 or 2
1943 6955 : if (nspinor/=1 .and. nspinor/=2) then
1944 0 : write(msg, '(a,i0)' )'Input nspinor must be 1 or 2, but was ',nspinor
1945 0 : ABI_ERROR_NOSTOP(msg, leave)
1946 : end if
1947 :
1948 : ! Check that nspinor and nsppol are not 2 together
1949 6955 : if (nsppol==2 .and. nspinor==2) then
1950 0 : ABI_ERROR_NOSTOP('nspinor and nsppol cannot be 2 together!', leave)
1951 : end if
1952 :
1953 : ! Here, leave if an error has been detected earlier
1954 6955 : if (leave /= 0) then
1955 0 : ABI_ERROR('Errors are present in the input file. See ABOVE messages')
1956 : end if
1957 :
1958 : ! Now, take care of mband_upper
1959 6955 : mband_upper=1
1960 6955 : occopt=1
1961 6955 : fband=0.5_dp
1962 :
1963 6955 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'occopt',tread,'INT')
1964 6955 : if(tread==1) occopt=intarr(1)
1965 :
1966 : ! Also read fband, that is an alternative to nband. The default
1967 : ! is different for occopt==1 and for metallic occupations.
1968 6955 : if(occopt==1)fband=0.125_dp
1969 6955 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'fband',tfband,'DPR')
1970 6955 : if(tfband==1)fband=dprarr(1)
1971 :
1972 : ! fband cannot be used when occopt==0 or occopt==2
1973 6955 : if(tfband==1 .and. (occopt==0 .or. occopt==2) )then
1974 : write(msg, '(3a)' )&
1975 0 : 'fband cannot be used if occopt==0 or occopt==2 ',ch10,&
1976 0 : 'Action: correct your input file, suppress fband, or change occopt.'
1977 0 : ABI_ERROR(msg)
1978 : end if
1979 :
1980 20865 : ABI_MALLOC(nband,(nkpt*nsppol))
1981 6955 : tnband=0
1982 :
1983 : ! Compute ziontypat
1984 : ! When the pseudo-atom is pure, simple copy
1985 6955 : if(ntyppure>0)then
1986 15507 : do itypat=1,ntyppure
1987 15507 : dtset%ziontypat(itypat)=zionpsp(itypat)
1988 : end do
1989 : end if
1990 :
1991 : ! When the pseudo-atom is alchemical, must make mixing
1992 6955 : if(ntypalch>0)then
1993 40 : do itypat=ntyppure+1,ntypat
1994 20 : dtset%ziontypat(itypat)=zero
1995 80 : do ipsp=ntyppure+1,npsp
1996 : dtset%ziontypat(itypat)=dtset%ziontypat(itypat) &
1997 60 : & +dtset%mixalch_orig(ipsp-ntyppure,itypat-ntyppure,1)*zionpsp(ipsp)
1998 : end do
1999 : end do
2000 : end if
2001 :
2002 6955 : if (occopt==0 .or. occopt==1 .or. (occopt>=3 .and. occopt<=9) ) then
2003 6741 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'nband',tnband,'INT')
2004 : ! Note: mband_upper is initialized, not nband
2005 6741 : if(tnband==1) mband_upper=intarr(1)
2006 :
2007 6741 : if(tfband==1 .and. tnband==1)then
2008 : write(msg, '(3a)' )&
2009 0 : 'fband and nband cannot be used together. ',ch10,&
2010 0 : 'Action: correct your input file, suppress either fband or nband.'
2011 0 : ABI_ERROR(msg)
2012 : end if
2013 :
2014 : ! In case nband was not read, use fband, either read, or the default,
2015 : ! to provide an upper limit for mband_upper
2016 6741 : if(tnband==0)then
2017 :
2018 : ! mband_upper=nspinor*((nint(zion_max)*natom+1)/2 - floor(cellcharge_min/2.0_dp)&
2019 : !& + ceiling(fband*natom-1.0d-10))
2020 2184 : zval=zero
2021 2184 : sum_spinat=zero
2022 29232 : do iatom=1,natom
2023 27048 : zval=zval+dtset%ziontypat(dtset%typat(iatom))
2024 29232 : sum_spinat=sum_spinat+dtset%spinat(3,iatom)
2025 : end do
2026 2184 : zelect=zval-cellcharge_min
2027 : mband_upper=nspinor * ((ceiling(zelect-tol10)+1)/2 + ceiling( fband*natom - tol10 )) &
2028 2184 : & + (nsppol-1)*(ceiling(half*(sum_spinat -tol10)))
2029 9032 : nband(:)=mband_upper
2030 :
2031 : ! write(std_out,*)' invars1 : zion_max,natom,fband,mband_upper '
2032 : ! write(std_out,*)zion_max,natom,fband,mband_upper
2033 : end if
2034 :
2035 123515 : nband(:)=mband_upper
2036 :
2037 214 : else if (occopt==2) then
2038 642 : ABI_MALLOC(reaalloc,(nkpt*nsppol))
2039 214 : call intagm(reaalloc,nband,jdtset,nkpt*nsppol,nkpt*nsppol,string(1:lenstr),'nband',tnband,'INT')
2040 214 : if(tnband==1)then
2041 728 : do ikpt=1,nkpt*nsppol
2042 728 : if (nband(ikpt)>mband_upper) mband_upper=nband(ikpt)
2043 : end do
2044 : end if
2045 214 : ABI_FREE(reaalloc)
2046 : else
2047 0 : write(msg, '(a,i0,3a)' )'occopt=',occopt,' is not an allowed value.',ch10,'Action: correct your input file.'
2048 0 : ABI_ERROR(msg)
2049 : end if
2050 :
2051 : ! Check that mband_upper is greater than 0
2052 6955 : if (mband_upper<=0) then
2053 : write(msg, '(a,i0,4a)' )&
2054 0 : 'Maximal nband must be > 0, but was ',mband_upper,ch10,&
2055 0 : 'This is not allowed.',ch10,'Action: check the input file.'
2056 0 : ABI_ERROR(msg)
2057 : end if
2058 :
2059 : ! The following 3 values are needed to dimension the parallelism over images
2060 6955 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'imgmov',tread,'INT')
2061 6955 : if(tread==1) dtset%imgmov=intarr(1)
2062 6955 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'ntimimage',tread,'INT')
2063 6955 : if(tread==1) dtset%ntimimage=intarr(1)
2064 6955 : call intagm(dprarr,intarr,jdtset,marr,dtset%nimage,string(1:lenstr),'dynimage',tread,'INT')
2065 6955 : if(tread==1)then
2066 292 : dtset%dynimage(1:dtset%nimage)=intarr(1:dtset%nimage)
2067 6918 : else if (dtset%imgmov==2.or.dtset%imgmov==5) then
2068 0 : dtset%dynimage(1)=0;dtset%dynimage(dtset%nimage)=0
2069 : end if
2070 14170 : dtset%ndynimage=count(dtset%dynimage(1:dtset%nimage)/=0)
2071 :
2072 6955 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'wfoptalg',tread,'INT')
2073 6955 : if(tread==1) then
2074 353 : dtset%wfoptalg=intarr(1)
2075 : else
2076 6602 : if (dtset%usepaw==0) dtset%wfoptalg=0
2077 6602 : if (dtset%usepaw/=0) dtset%wfoptalg=10
2078 6602 : if (dtset%optdriver==RUNL_GSTATE) then
2079 5288 : if (dtset%paral_kgb/=0) dtset%wfoptalg=14
2080 : end if
2081 : end if
2082 :
2083 : ! Read use_gbt
2084 6955 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'use_gbt',tread,'INT')
2085 6955 : if (tread==1) dtset%use_gbt=intarr(1)
2086 :
2087 : !---------------------------------------------------------------------------
2088 : !Some PAW+DMFT keywords
2089 6955 : dtset%usedmft=0
2090 6955 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'usedmft',tread,'INT')
2091 6955 : if(tread==1) dtset%usedmft=intarr(1)
2092 :
2093 : !Some ucrpa keywords
2094 6955 : dtset%ucrpa=0
2095 6955 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'ucrpa',tread,'INT')
2096 6955 : if(tread==1) dtset%ucrpa=intarr(1)
2097 :
2098 6955 : if (dtset%ucrpa > 0 .and. (dtset%usedmft > 0 .and. dtset%usedmft /= 10)) then
2099 : write(msg, '(9a)' )&
2100 0 : 'usedmft and ucrpa are both activated in the input file ',ch10,&
2101 0 : 'In the following, abinit assume you are doing a ucrpa calculation and ',ch10,&
2102 0 : 'you define Wannier functions as in DFT+DMFT calculation',ch10,&
2103 0 : 'If instead, you want to do a full dft+dmft calculation and not only the Wannier construction, use ucrpa=0',ch10,&
2104 0 : 'This keywords are depreciated, please use the new keywords to perform cRPA calculation'
2105 0 : ABI_WARNING(msg)
2106 : end if
2107 :
2108 : !Some PAW+U keywords
2109 6955 : dtset%usepawu=0
2110 6955 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'usepawu',tread,'INT')
2111 6955 : if(tread==1) dtset%usepawu=intarr(1)
2112 : !if(dtset%usedmft>0.and.(dtset%usepawu==14.or.dtset%usepawu==4)) then
2113 : ! dtset%usepawu=14
2114 : !else if(dtset%usedmft>0.and.dtset%usepawu>=0) then
2115 : ! dtset%usepawu=1
2116 : !endif
2117 :
2118 :
2119 6955 : dtset%usedmatpu=0
2120 15537 : dtset%lpawu(1:dtset%ntypat)=-1
2121 6955 : dtset%optdcmagpawu=3
2122 6955 : if (dtset%usepawu/=0.or.(dtset%usedmft>0.and.dtset%usedmft/=10)) then
2123 153 : call intagm(dprarr,intarr,jdtset,marr,dtset%ntypat,string(1:lenstr),'lpawu',tread,'INT')
2124 386 : if(tread==1) dtset%lpawu(1:dtset%ntypat)=intarr(1:dtset%ntypat)
2125 :
2126 153 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'usedmatpu',tread,'INT')
2127 153 : if(tread==1) dtset%usedmatpu=intarr(1)
2128 153 : if (dtset%nspden==4) then
2129 25 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'optdcmagpawu',tread,'INT')
2130 25 : if(tread==1) dtset%optdcmagpawu=intarr(1)
2131 : end if
2132 : end if
2133 :
2134 : !Some PAW+Exact exchange keywords
2135 6955 : dtset%useexexch=0
2136 6955 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'useexexch',tread,'INT')
2137 6955 : if(tread==1) dtset%useexexch=intarr(1)
2138 :
2139 15537 : dtset%lexexch(1:dtset%ntypat)=-1
2140 :
2141 6955 : if (dtset%useexexch/=0) then
2142 1 : call intagm(dprarr,intarr,jdtset,marr,dtset%ntypat,string(1:lenstr),'lexexch',tread,'INT')
2143 3 : if(tread==1) dtset%lexexch(1:dtset%ntypat)=intarr(1:dtset%ntypat)
2144 : end if
2145 :
2146 : !LDA minus half keyword
2147 6955 : call intagm(dprarr,intarr,jdtset,marr,dtset%ntypat,string(1:lenstr),'ldaminushalf',tread,'INT')
2148 6956 : if(tread==1) dtset%ldaminushalf(1:dtset%ntypat)=intarr(1:dtset%ntypat)
2149 :
2150 : !Some plowan data
2151 6955 : dtset%plowan_natom=0
2152 6955 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'plowan_natom',tread,'INT')
2153 6955 : if(tread==1) dtset%plowan_natom=intarr(1)
2154 :
2155 6955 : dtset%plowan_nt=0
2156 6955 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'plowan_nt',tread,'INT')
2157 6955 : if(tread==1) dtset%plowan_natom=intarr(1)
2158 :
2159 : !if (dtset%ucrpa > 0 .and. dtset%plowan_compute==0) then
2160 : !dtset%plowan_natom=1
2161 : !dtset%plowan_nt=1
2162 : !endif
2163 :
2164 : !PAW potential zero keyword
2165 6955 : dtset%usepotzero=0
2166 6955 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'usepotzero',tread,'INT')
2167 6955 : if(tread==1) dtset%usepotzero=intarr(1)
2168 :
2169 : !Macro_uj (determination of U in PAW+U), governs also allocation of atvshift
2170 6955 : dtset%macro_uj = 0
2171 6955 : call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'macro_uj',tread,'INT')
2172 6955 : if(tread==1) dtset%macro_uj=intarr(1)
2173 :
2174 : !Constraint DFT keyword
2175 6955 : call intagm(dprarr,intarr,jdtset,marr,dtset%ntypat,string(1:lenstr),'constraint_kind',tread,'INT')
2176 7029 : if(tread==1) dtset%constraint_kind(1:dtset%ntypat)=intarr(1:dtset%ntypat)
2177 :
2178 : !Some special cases are not compatible with GPU implementation
2179 : !Warn user if value is changed at runtime.
2180 : !We don't stop the code because we may want to run the test suite in GPU mode.
2181 6955 : if (all(dtset%optdriver /= [RUNL_GSTATE, RUNL_RESPFN, RUNL_GWR, RUNL_EPH])) then
2182 489 : if (dtset%gpu_option /= ABI_GPU_DISABLED) then
2183 0 : call wrtout(units, "- WARNING: GPU only compatible with GS, RESPFN, GWR, EPH. gpu_option has been set to 0!")
2184 : end if
2185 489 : dtset%gpu_option=ABI_GPU_DISABLED
2186 : end if
2187 6955 : if (dtset%optdriver==RUNL_RESPFN .and. dtset%gpu_option/=ABI_GPU_OPENMP) then
2188 716 : if (dtset%gpu_option /= ABI_GPU_DISABLED) then
2189 0 : call wrtout(units, "- WARNING: RESPFN on GPU only implemented with OpenMP. gpu_option has been set to 0!")
2190 : end if
2191 716 : dtset%gpu_option=ABI_GPU_DISABLED
2192 : end if
2193 6955 : if (dtset%tfkinfunc/=0) dtset%gpu_option=ABI_GPU_DISABLED ! Recursion method has its own GPU implementation
2194 6955 : if (dtset%nspinor/=1) then
2195 348 : if (dtset%gpu_option/=ABI_GPU_DISABLED .and. dtset%gpu_option/=ABI_GPU_OPENMP) then
2196 0 : dtset%gpu_option=ABI_GPU_DISABLED
2197 0 : call wrtout(units, "- WARNING: nspinor=2 not supported outside of CPU and OpenMP GPU. gpu_option has been set to 0!")
2198 : end if
2199 : end if
2200 :
2201 6955 : ABI_FREE(nband)
2202 6955 : ABI_FREE(ratsph)
2203 6955 : ABI_FREE(intarr)
2204 6955 : ABI_FREE(dprarr)
2205 :
2206 : !write(std_out,'(a)')' m_invars1%invars1 : exit '; call flush(std_out)
2207 :
2208 6955 : end subroutine invars1
2209 : !!***
2210 :
2211 : !!****f* ABINIT/indefo
2212 : !! NAME
2213 : !! indefo
2214 : !!
2215 : !! FUNCTION
2216 : !! Initialisation phase: default values for most input variables
2217 : !! (some are initialized earlier, see indefo1 routine, or even
2218 : !! at the definition of the input variables (m_dtset.F90))
2219 : !!
2220 : !! INPUTS
2221 : !! ndtset_alloc=number of datasets, corrected for allocation of at least one data set.
2222 : !! nprocs=Number of MPI processors available.
2223 : !!
2224 : !! OUTPUT
2225 : !! dtsets(0:ndtset_alloc)=<type datafiles_type>contains all input variables,
2226 : !! some of which are given a default value here.
2227 : !! The dataset with number 0 should be the reference default value in the remaining of the code.
2228 : !!
2229 : !! NOTES
2230 : !! The outputs of this routine are the defaults values of input
2231 : !! variables, stored at the index 0 of the last dimension of their multi-dataset representation.
2232 : !!
2233 : !! NOTE that Scalars and static arrays can be initialized directly at the level of the datatype declaration
2234 : !! provided the value does not depend on runtime conditions.
2235 : !!
2236 : !! SOURCE
2237 :
2238 1427 : subroutine indefo(dtsets, ndtset_alloc, nprocs)
2239 :
2240 : !Arguments ------------------------------------
2241 : !scalars
2242 : integer,intent(in) :: ndtset_alloc,nprocs
2243 : !arrays
2244 : type(dataset_type),intent(inout) :: dtsets(0:ndtset_alloc)
2245 :
2246 : !Local variables -------------------------------
2247 : !scalars
2248 : integer :: idtset,ii,jdtset,paral_atom_default
2249 : logical :: wvl_bigdft
2250 : #if defined DEV_YP_VDWXC
2251 : type(xc_vdw_type) :: vdw_defaults
2252 : #endif
2253 : !******************************************************************
2254 :
2255 : DBG_ENTER("COLL")
2256 :
2257 : !Set up default values. All variables to be output in outvars.f
2258 : !should have a default, even if a nonsensible one can be chosen to guarantee print in that routine.
2259 : !Some default values are also set at the definition of the input variables (m_dtset.F90).
2260 :
2261 : !These variables have already been initialized, for idtset/=0
2262 1427 : dtsets(0)%istatr=0
2263 1427 : dtsets(0)%istatshft=1
2264 18551 : dtsets(0)%kptrlatt(1:3,1:3)=0
2265 : !dtsets(0)%kptrlatt_orig=0
2266 18551 : dtsets(0)%qptrlatt(1:3,1:3)=0
2267 1427 : dtsets(0)%ptgroupma=0
2268 1427 : dtsets(0)%spgroup=0
2269 1200107 : dtsets(0)%shiftk(:,:)=half
2270 : !XG20200801 Changed the default value. This default value is also defined in m_ingeo.F90 . Must be coherent !
2271 : !dtsets(0)%tolsym=tol8
2272 1427 : dtsets(0)%tolsym=tol5
2273 3364 : dtsets(0)%znucl(:)=zero
2274 1427 : dtsets(0)%ucrpa=0
2275 1427 : dtsets(0)%usedmft=0
2276 :
2277 1427 : paral_atom_default=0
2278 9809 : if (nprocs>1.and.maxval(dtsets(:)%usepaw)>0) paral_atom_default=1
2279 :
2280 : !WARNING: set default in all datasets, including idtset=0 !!!
2281 : !Use alphabetic order
2282 :
2283 9809 : do idtset=0,ndtset_alloc
2284 8382 : jdtset=dtsets(idtset)%jdtset
2285 :
2286 8382 : wvl_bigdft=.false.
2287 8382 : if(dtsets(idtset)%usewvl==1 .and. dtsets(idtset)%wvl_bigdft_comp==1) wvl_bigdft=.true.
2288 :
2289 : ! A
2290 : ! Here we change the default value of iomode according to the configuration options.
2291 : ! Ideally, all the sequential tests should pass independently of the default value.
2292 : ! The parallel tests may require IO_MODE_MPI or, alternatively, IO_MODE_ETSF with HDF5 support.
2293 : ! MG FIXME Sun Sep 6 2015: Many tests fail if IO_MODE_MPI is used as default. IO errors in v1, v2 ...
2294 : ! with np=1 and wonderful deadlocks if np>1.
2295 :
2296 : ! Note that this default value might be overridden for specific datasets later, in case of parallelism
2297 : dtsets(idtset)%iomode=IO_MODE_FORTRAN
2298 : #ifdef HAVE_NETCDF_DEFAULT
2299 8382 : dtsets(idtset)%iomode=IO_MODE_ETSF
2300 : #endif
2301 : #ifdef HAVE_MPI_IO_DEFAULT
2302 : dtsets(idtset)%iomode=IO_MODE_MPI
2303 : #endif
2304 :
2305 8382 : dtsets(idtset)%adpimd=0
2306 8382 : dtsets(idtset)%adpimd_gamma=one
2307 8382 : dtsets(idtset)%accuracy=0
2308 8382 : dtsets(idtset)%asr=1
2309 152766 : dtsets(idtset)%atvshift(:,:,:)=zero
2310 8382 : dtsets(idtset)%auxc_ixc=11
2311 8382 : dtsets(idtset)%auxc_scal=one
2312 : ! B
2313 41910 : dtsets(idtset)%bdberry(1:4)=0
2314 8382 : dtsets(idtset)%bdeigrf=-1
2315 23451 : dtsets(idtset)%bdgw=0
2316 8382 : dtsets(idtset)%berrystep=1
2317 8382 : dtsets(idtset)%bmass=ten
2318 33528 : dtsets(idtset)%boxcenter(1:3)=half
2319 8382 : dtsets(idtset)%boxcutmin=two
2320 8382 : dtsets(idtset)%brvltt=0
2321 8382 : dtsets(idtset)%bs_nstates=0
2322 8382 : dtsets(idtset)%bs_hayd_term=1
2323 8382 : dtsets(idtset)%builtintest=0
2324 8382 : dtsets(idtset)%bxctmindg=two
2325 : ! C
2326 8382 : dtsets(idtset)%cd_halfway_freq=3.674930883_dp !(100 eV)
2327 8398 : dtsets(idtset)%cd_imfrqs(:) = zero
2328 8382 : dtsets(idtset)%cd_max_freq=36.74930883_dp !(1000 eV)
2329 25146 : dtsets(idtset)%cd_subset_freq(1:2)=0
2330 8382 : dtsets(idtset)%cd_frqim_method=1
2331 8382 : dtsets(idtset)%cd_full_grid=0
2332 17165 : dtsets(idtset)%cellcharge(:)=zero
2333 8382 : dtsets(idtset)%chebfi_oracle=0
2334 19149 : dtsets(idtset)%chempot(:,:,:)=zero
2335 8382 : dtsets(idtset)%chkdilatmx=1
2336 8382 : dtsets(idtset)%chkexit=0
2337 8382 : dtsets(idtset)%chkparal=1
2338 8382 : dtsets(idtset)%chksymbreak=1
2339 8382 : dtsets(idtset)%chksymtnons=1
2340 8382 : dtsets(idtset)%chneut=1
2341 8382 : dtsets(idtset)%cineb_start=7
2342 18893 : dtsets(idtset)%corecs(:) = zero
2343 8382 : dtsets(idtset)%cprj_in_memory=0
2344 8382 : dtsets(idtset)%cprj_update_lvl=3
2345 : ! D
2346 8382 : dtsets(idtset)%ddamp=0.1_dp
2347 8382 : dtsets(idtset)%delayperm=0
2348 8382 : dtsets(idtset)%densfor_pred=2
2349 8382 : if (dtsets(idtset)%paral_kgb>0.and.idtset>0) dtsets(idtset)%densfor_pred=6 ! Recommended for band-FFT parallelism
2350 8382 : dtsets(idtset)%dfpt_sciss=zero
2351 8382 : dtsets(idtset)%diecut=2.2_dp
2352 8382 : dtsets(idtset)%dielng=1.0774841_dp
2353 8382 : dtsets(idtset)%diemac=1.0d6
2354 8382 : if (dtsets(idtset)%usepaw==0) then
2355 6819 : dtsets(idtset)%diemix=one
2356 : else
2357 1563 : dtsets(idtset)%diemix=0.7_dp
2358 : end if
2359 8382 : dtsets(idtset)%diemixmag=dtsets(idtset)%diemix
2360 8382 : dtsets(idtset)%diegap=0.1_dp
2361 8382 : dtsets(idtset)%dielam=half
2362 8382 : dtsets(idtset)%diismemory=8
2363 8382 : dtsets(idtset)%dilatmx=one
2364 8382 : dtsets(idtset)%dmatpuopt=2
2365 11202 : if (size(dtsets(idtset)%dmatpawu,4)>0) dtsets(idtset)%dmatpawu=-10._dp
2366 8382 : dtsets(idtset)%dmatudiag=0
2367 8382 : dtsets(idtset)%dmft_charge_prec=tol6
2368 8382 : dtsets(idtset)%dmft_dc=1
2369 8382 : dtsets(idtset)%dmft_entropy=0
2370 8382 : dtsets(idtset)%dmft_fermi_step=0.02_dp
2371 8382 : dtsets(idtset)%dmft_hybri_limit=0
2372 8382 : dtsets(idtset)%dmft_iter=10
2373 8382 : dtsets(idtset)%dmft_kspectralfunc=0
2374 8382 : dtsets(idtset)%dmft_magnfield=0
2375 : if (dtsets(idtset)%dmft_magnfield .gt. 0) dtsets(idtset)%dmft_magnfield_b=0.0_dp
2376 8382 : dtsets(idtset)%dmft_mxsf=0.6_dp
2377 8382 : dtsets(idtset)%dmft_nlambda=6
2378 68381 : dtsets(idtset)%dmft_nominal(:)=0
2379 8382 : dtsets(idtset)%dmft_nwli=0
2380 8382 : dtsets(idtset)%dmft_nwlo=0
2381 8382 : dtsets(idtset)%dmft_occnd_imag=1
2382 18893 : dtsets(idtset)%dmft_orbital(:)=1
2383 8382 : dtsets(idtset)%dmft_prt_maxent=1
2384 8382 : dtsets(idtset)%dmft_prtself=0
2385 8382 : dtsets(idtset)%dmft_prtwan=0
2386 8382 : dtsets(idtset)%dmft_read_occnd=0
2387 8382 : dtsets(idtset)%dmft_rslf=1
2388 68381 : dtsets(idtset)%dmft_shiftself(:)=0.0_dp
2389 8382 : dtsets(idtset)%dmft_solv=5
2390 8382 : if(dtsets(idtset)%ucrpa>0.and.dtsets(idtset)%usedmft==1) dtsets(idtset)%dmft_solv=0
2391 8382 : dtsets(idtset)%dmft_t2g=0
2392 8382 : dtsets(idtset)%dmft_tolfreq=tol4
2393 8382 : dtsets(idtset)%dmft_tollc=tol5
2394 8382 : dtsets(idtset)%dmft_triqs_basis=-1
2395 8382 : dtsets(idtset)%dmft_triqs_chiloc=0
2396 : if (dtsets(idtset)%dmft_triqs_chiloc > 0 ) dtsets(idtset)%dmft_triqs_chiloc_ins = 10
2397 8382 : dtsets(idtset)%dmft_triqs_compute_integral=1
2398 8382 : dtsets(idtset)%dmft_triqs_det_init_size=100
2399 8382 : dtsets(idtset)%dmft_triqs_det_n_operations_before_check=10000
2400 8382 : dtsets(idtset)%dmft_triqs_det_precision_error=1.0d-5
2401 8382 : dtsets(idtset)%dmft_triqs_det_precision_warning=1.0d-8
2402 8382 : dtsets(idtset)%dmft_triqs_det_singular_threshold=-1.0_dp
2403 8382 : dtsets(idtset)%dmft_triqs_dlr_epsilon=-1.0_dp
2404 8382 : dtsets(idtset)%dmft_triqs_dlr_wmax=-1.0_dp
2405 8382 : dtsets(idtset)%dmft_triqs_entropy=0
2406 8382 : dtsets(idtset)%dmft_triqs_gaussorder=-1
2407 8382 : dtsets(idtset)%dmft_triqs_imag_threshold=1.0d-13
2408 8382 : dtsets(idtset)%dmft_triqs_length_cycle=0
2409 8382 : dtsets(idtset)%dmft_triqs_loc_n_min=0
2410 8382 : dtsets(idtset)%dmft_triqs_loc_n_max=huge(0)
2411 8382 : dtsets(idtset)%dmft_triqs_measure_density_matrix=1
2412 8382 : dtsets(idtset)%dmft_triqs_measure_g_l=0
2413 8382 : dtsets(idtset)%dmft_triqs_move_double=0
2414 8382 : dtsets(idtset)%dmft_triqs_move_shift=1
2415 8382 : dtsets(idtset)%dmft_triqs_n_cycles=0
2416 8382 : dtsets(idtset)%dmft_triqs_n_iw=0
2417 8382 : dtsets(idtset)%dmft_triqs_n_l=0
2418 8382 : dtsets(idtset)%dmft_triqs_n_tau=0
2419 8382 : dtsets(idtset)%dmft_triqs_n_warmup_cycles_init=-1
2420 8382 : dtsets(idtset)%dmft_triqs_n_warmup_cycles_restart=-1
2421 8382 : dtsets(idtset)%dmft_triqs_nsubdivisions=0
2422 8382 : dtsets(idtset)%dmft_triqs_off_diag=-1
2423 8382 : dtsets(idtset)%dmft_triqs_pauli_prob=0.8
2424 8382 : dtsets(idtset)%dmft_triqs_prt_entropy=0
2425 8382 : dtsets(idtset)%dmft_triqs_random_seed_a=34788
2426 8382 : dtsets(idtset)%dmft_triqs_random_seed_b=928374
2427 8382 : dtsets(idtset)%dmft_triqs_read_ctqmcdata=1
2428 8382 : dtsets(idtset)%dmft_triqs_shift_mu=0.0_dp
2429 8382 : dtsets(idtset)%dmft_triqs_time_invariance=1
2430 8382 : dtsets(idtset)%dmft_triqs_tol_block=tol12
2431 8382 : dtsets(idtset)%dmft_triqs_use_norm_as_weight=1
2432 8382 : dtsets(idtset)%dmft_full_chipsi=0
2433 8382 : dtsets(idtset)%dmft_wanorthnorm=3
2434 8382 : dtsets(idtset)%dmft_wanrad=-1.0_dp
2435 8382 : dtsets(idtset)%dmft_x2my2d=0
2436 8382 : dtsets(idtset)%dmft_yukawa_epsilon=-1.0_dp
2437 8382 : dtsets(idtset)%dmft_yukawa_lambda=-1.0_dp
2438 8382 : dtsets(idtset)%dmft_yukawa_param=1
2439 8382 : dtsets(idtset)%dmftbandf=0
2440 8382 : dtsets(idtset)%dmftbandi=0
2441 8382 : dtsets(idtset)%dmftcheck=0
2442 8382 : dtsets(idtset)%dmftctqmc_basis=1
2443 8382 : dtsets(idtset)%dmftctqmc_check=0
2444 8382 : dtsets(idtset)%dmftctqmc_correl=0
2445 8382 : dtsets(idtset)%dmftctqmc_gmove=0
2446 8382 : dtsets(idtset)%dmftctqmc_grnns=0
2447 8382 : dtsets(idtset)%dmftctqmc_localprop=0
2448 8382 : dtsets(idtset)%dmftctqmc_meas=1
2449 8382 : dtsets(idtset)%dmftctqmc_mov=0
2450 8382 : dtsets(idtset)%dmftctqmc_mrka=0
2451 8382 : dtsets(idtset)%dmftctqmc_chains=xomp_get_max_threads()
2452 8382 : dtsets(idtset)%dmftctqmc_order=0
2453 8382 : dtsets(idtset)%dmftqmc_l=0
2454 8382 : dtsets(idtset)%dmftqmc_n=0.0_dp
2455 8382 : dtsets(idtset)%dmftqmc_seed=jdtset
2456 8382 : dtsets(idtset)%dmftqmc_therm=0
2457 8382 : dtsets(idtset)%dosdeltae=0.0
2458 8382 : dtsets(idtset)%dtion=100.0_dp
2459 8382 : dtsets(idtset)%dtele=0.1_dp
2460 25146 : dtsets(idtset)%d3e_pert1_atpol(1:2)=-1
2461 33528 : dtsets(idtset)%d3e_pert1_dir(1:3)=1
2462 8382 : dtsets(idtset)%d3e_pert1_elfd=0
2463 25146 : dtsets(idtset)%d3e_pert1_magat(1:2)=-1
2464 33528 : dtsets(idtset)%d3e_pert1_magdir(1:3)=1
2465 8382 : dtsets(idtset)%d3e_pert1_magn=0
2466 8382 : dtsets(idtset)%d3e_pert1_phon=0
2467 25146 : dtsets(idtset)%d3e_pert2_atpol(1:2)=-1
2468 33528 : dtsets(idtset)%d3e_pert2_dir(1:3)=1
2469 8382 : dtsets(idtset)%d3e_pert2_elfd=0
2470 25146 : dtsets(idtset)%d3e_pert2_magat(1:2)=-1
2471 33528 : dtsets(idtset)%d3e_pert2_magdir(1:3)=1
2472 8382 : dtsets(idtset)%d3e_pert2_magn=0
2473 8382 : dtsets(idtset)%d3e_pert2_phon=0
2474 8382 : dtsets(idtset)%d3e_pert2_strs=0
2475 25146 : dtsets(idtset)%d3e_pert3_atpol(1:2)=-1
2476 33528 : dtsets(idtset)%d3e_pert3_dir(1:3)=1
2477 8382 : dtsets(idtset)%d3e_pert3_elfd=0
2478 8382 : dtsets(idtset)%d3e_pert3_phon=0
2479 : ! E
2480 8382 : dtsets(idtset)%ecut=-one
2481 8382 : dtsets(idtset)%ecuteps=zero
2482 8382 : dtsets(idtset)%ecutsigx=zero ! If ecutsigx is not defined explicitly, npwsigx will be initialized from ecutwfn.
2483 8382 : dtsets(idtset)%ecutsm=zero
2484 8382 : dtsets(idtset)%ecutwfn=zero ! The true default value is ecut. This is defined in invars2.F90
2485 8382 : dtsets(idtset)%effmass_free=one
2486 8382 : dtsets(idtset)%efmas=0
2487 638949 : dtsets(idtset)%efmas_bands=0 ! The true default is nband. This is defined in invars2.F90
2488 8382 : dtsets(idtset)%efmas_deg=1
2489 8382 : dtsets(idtset)%efmas_deg_tol=tol5
2490 8382 : dtsets(idtset)%efmas_dim=3
2491 9398 : dtsets(idtset)%efmas_dirs=zero
2492 8382 : dtsets(idtset)%efmas_ntheta=1000
2493 8382 : dtsets(idtset)%elph2_imagden=zero
2494 8382 : dtsets(idtset)%enunit=0
2495 8382 : dtsets(idtset)%eshift=zero
2496 8382 : dtsets(idtset)%esmear=0.01_dp
2497 8382 : dtsets(idtset)%exchn2n3d=0
2498 8382 : dtsets(idtset)%extrapwf=0
2499 8382 : dtsets(idtset)%exchmix=quarter
2500 8382 : dtsets(idtset)%expert_user=0
2501 : ! F
2502 8382 : dtsets(idtset)%focktoldfe=zero
2503 8382 : dtsets(idtset)%fockoptmix=0
2504 33528 : dtsets(idtset)%fockdownsampling(:)=1
2505 8382 : dtsets(idtset)%fock_icutcoul=0 ! Spherical-cutoff for legacy reasons
2506 8382 : dtsets(idtset)%fock_rcut=zero ! Spencer-Alavi by default
2507 8382 : dtsets(idtset)%freqim_alpha=five
2508 8382 : dtsets(idtset)%friction=0.001_dp
2509 8382 : dtsets(idtset)%frictionbar=0.001_dp
2510 8382 : dtsets(idtset)%frzfermi=0
2511 8382 : dtsets(idtset)%fxcartfactor=one ! Should be adjusted to the H2 conversion factor
2512 : ! G
2513 8382 : dtsets(idtset)%ga_algor =1
2514 8382 : dtsets(idtset)%ga_fitness =1
2515 8382 : dtsets(idtset)%ga_opt_percent =0.2_dp
2516 259842 : dtsets(idtset)%ga_rules(:) =1
2517 8382 : dtsets(idtset)%geoopt = "none"
2518 8382 : dtsets(idtset)%ggtrcut=0.001_dp
2519 8382 : dtsets(idtset)%goprecon =0
2520 33528 : dtsets(idtset)%goprecprm(:)=0
2521 108966 : dtsets(idtset)%gpu_devices=(/-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1/)
2522 8382 : dtsets(idtset)%gpu_nfft_blocks=0
2523 8382 : dtsets(idtset)%gpu_kokkos_nthrd=xomp_get_max_threads()
2524 8382 : dtsets(idtset)%gpu_linalg_limit=2000000
2525 8382 : dtsets(idtset)%gpu_nl_distrib=0
2526 8382 : dtsets(idtset)%gpu_nl_splitsize=0
2527 8382 : dtsets(idtset)%gpu_thread_limit=0
2528 8382 : if(dtsets(idtset)%gpu_option/=ABI_GPU_DISABLED) then
2529 0 : dtsets(idtset)%gpu_thread_limit=min(4,xomp_get_max_threads())
2530 : end if
2531 8397 : if (dtsets(idtset)%gw_customnfreqsp/=0) dtsets(idtset)%gw_freqsp(:) = zero
2532 8382 : if ( dtsets(idtset)%gw_nqlwl > 0 ) then
2533 5 : dtsets(idtset)%gw_qlwl(:,:)=zero
2534 1 : dtsets(idtset)%gw_qlwl(1,1)=0.00001_dp
2535 1 : dtsets(idtset)%gw_qlwl(2,1)=0.00002_dp
2536 1 : dtsets(idtset)%gw_qlwl(3,1)=0.00003_dp
2537 : end if
2538 8382 : dtsets(idtset)%gw_frqim_inzgrid=0
2539 8382 : dtsets(idtset)%gw_frqre_inzgrid=0
2540 8382 : dtsets(idtset)%gw_frqre_tangrid=0
2541 8382 : dtsets(idtset)%gw_invalid_freq=0
2542 8382 : dtsets(idtset)%gw_icutcoul=6
2543 8382 : dtsets(idtset)%gw_qprange=0
2544 8382 : dtsets(idtset)%gw_rcut=zero ! Spencer-Alavi value by default
2545 8382 : dtsets(idtset)%gw_sigxcore=0
2546 8382 : dtsets(idtset)%gwls_stern_kmax=1
2547 8382 : dtsets(idtset)%gwls_model_parameter=1.0_dp
2548 8382 : dtsets(idtset)%gwls_npt_gauss_quad=10
2549 8382 : dtsets(idtset)%gwls_diel_model=2
2550 8382 : dtsets(idtset)%gwls_print_debug=0
2551 8382 : if (dtsets(idtset)%gwls_n_proj_freq/=0) dtsets(idtset)%gwls_list_proj_freq(:) = zero
2552 8382 : dtsets(idtset)%gwls_nseeds=1
2553 8382 : dtsets(idtset)%gwls_recycle=2
2554 8382 : dtsets(idtset)%gwls_kmax_complement=1
2555 8382 : dtsets(idtset)%gwls_kmax_poles=4
2556 8382 : dtsets(idtset)%gwls_kmax_analytic=8
2557 8382 : dtsets(idtset)%gwls_kmax_numeric=16
2558 8382 : dtsets(idtset)%gwls_band_index=1
2559 8382 : dtsets(idtset)%gwls_exchange=1
2560 8382 : dtsets(idtset)%gwls_correlation=3
2561 8382 : dtsets(idtset)%gwls_first_seed=0
2562 : ! H
2563 8382 : dtsets(idtset)%hmcsst=3
2564 8382 : dtsets(idtset)%hmctt=4
2565 8382 : dtsets(idtset)%hyb_mixing=-999.0_dp
2566 8382 : dtsets(idtset)%hyb_mixing_sr=-999.0_dp
2567 8382 : dtsets(idtset)%hyb_range_dft=-999.0_dp
2568 8382 : dtsets(idtset)%hyb_range_fock=-999.0_dp
2569 : ! I
2570 8382 : if(dtsets(idtset)%natsph/=0) then
2571 : ! do not use iatsph(:) but explicit boundaries
2572 : ! to avoid to read to far away in the built array (/ ... /)
2573 83013 : dtsets(idtset)%iatsph(1:dtsets(idtset)%natsph)=(/ (ii,ii=1,dtsets(idtset)%natsph) /)
2574 : else
2575 6657 : dtsets(idtset)%iatsph(:)=0
2576 : end if
2577 8382 : dtsets(idtset)%iboxcut=0
2578 8382 : dtsets(idtset)%icutcoul=3
2579 8382 : dtsets(idtset)%ieig2rf=0
2580 8382 : dtsets(idtset)%imgwfstor=0
2581 8382 : dtsets(idtset)%intxc=0
2582 : ! if (dtsets(idtset)%paral_kgb>0.and.idtset>0) dtsets(idtset)%intxc=0
2583 8382 : dtsets(idtset)%invovl_blksliced=1
2584 8382 : if(dtsets(idtset)%gpu_option/=ABI_GPU_DISABLED.and.dtsets(idtset)%gpu_option/=ABI_GPU_LEGACY) then
2585 0 : if (dtsets(idtset)%usepaw==1) dtsets(idtset)%invovl_blksliced=0
2586 : end if
2587 8382 : dtsets(idtset)%ionmov=0
2588 8382 : dtsets(idtset)%densfor_pred=2
2589 8382 : if (dtsets(idtset)%paral_kgb>0.and.idtset>0) dtsets(idtset)%densfor_pred=6 ! Recommended for band-FFT parallelism
2590 8382 : dtsets(idtset)%iprcel=0
2591 8382 : dtsets(idtset)%iprcfc=0
2592 8382 : dtsets(idtset)%irandom=3
2593 : !iscf
2594 8382 : if(wvl_bigdft) then
2595 0 : dtsets(idtset)%iscf=0
2596 : else
2597 8382 : if(dtsets(idtset)%usepaw==0) then
2598 6819 : dtsets(idtset)%iscf=7
2599 : else
2600 1563 : dtsets(idtset)%iscf=17
2601 : end if
2602 : end if
2603 8382 : dtsets(idtset)%isecur=0
2604 8382 : dtsets(idtset)%istatimg = 1
2605 218571 : dtsets(idtset)%istwfk(:)=0
2606 8382 : dtsets(idtset)%ixc=1
2607 8382 : dtsets(idtset)%ixc_sigma=1
2608 8382 : dtsets(idtset)%ixcpositron=1
2609 8382 : dtsets(idtset)%ixcrot=1
2610 : ! J
2611 18893 : dtsets(idtset)%f4of2_sla(:)=-one
2612 18893 : dtsets(idtset)%f6of2_sla(:)=-one
2613 28409 : dtsets(idtset)%jpawu(:,:)=zero
2614 : ! K
2615 678942 : dtsets(idtset)%kberry(1:3,:)=0
2616 849138 : dtsets(idtset)%kpt(:,:)=zero
2617 14342 : dtsets(idtset)%kptgw(:,:)=zero
2618 8382 : dtsets(idtset)%kptnrm=one
2619 5576310 : dtsets(idtset)%kptns_hf(:,:)=zero
2620 8382 : dtsets(idtset)%kptopt=1
2621 8382 : if(dtsets(idtset)%nspden==4)dtsets(idtset)%kptopt=4
2622 8382 : dtsets(idtset)%kptrlen=30.0_dp
2623 : ! L
2624 :
2625 : #if defined HAVE_LOTF
2626 : dtsets(idtset)%lotf_classic=5
2627 : dtsets(idtset)%lotf_nitex=10
2628 : dtsets(idtset)%lotf_nneigx=40
2629 : dtsets(idtset)%lotf_version=2
2630 : #endif
2631 18893 : dtsets(idtset)%lambsig(:) = zero
2632 8382 : dtsets(idtset)%lw_qdrpl=0
2633 8382 : dtsets(idtset)%lw_flexo=0
2634 8382 : dtsets(idtset)%lw_natopt=0
2635 : ! M
2636 8382 : dtsets(idtset)%magconon = 0
2637 8382 : dtsets(idtset)%magcon_lambda = 0.01_dp
2638 8382 : dtsets(idtset)%magpen = zero
2639 8382 : dtsets(idtset)%mband = -1
2640 25146 : dtsets(idtset)%mdtemp(:)=300.0_dp
2641 8382 : dtsets(idtset)%mdeg_filter = 6
2642 8382 : dtsets(idtset)%mdwall=10000_dp
2643 8382 : dtsets(idtset)%mep_mxstep=100._dp
2644 8382 : dtsets(idtset)%mep_solver=MEP_SOLVER_STEEPEST
2645 8382 : dtsets(idtset)%mffmem=1
2646 8382 : dtsets(idtset)%mgfft = -1
2647 8382 : dtsets(idtset)%mgfftdg = -1
2648 17165 : dtsets(idtset)%mixesimgf(:)=zero
2649 25146 : dtsets(idtset)%mpatpol(1:2)=-1
2650 33528 : dtsets(idtset)%mpdir(1:3)=0
2651 8382 : dtsets(idtset)%moldyn = "none"
2652 8382 : dtsets(idtset)%mpw = -1
2653 8382 : dtsets(idtset)%mqgrid=0
2654 8382 : dtsets(idtset)%mqgriddg=0
2655 : ! N
2656 8382 : dtsets(idtset)%natrd = -1
2657 225276 : dtsets(idtset)%nband(:)=0
2658 8382 : dtsets(idtset)%nbandhf=0
2659 8382 : dtsets(idtset)%nbdblock=1
2660 8382 : dtsets(idtset)%nbdbuf=0
2661 8382 : dtsets(idtset)%nberry=1
2662 8382 : if (dtsets(idtset)%usepaw == 0) then
2663 6819 : dtsets(idtset)%nc_xccc_gspace = 0
2664 : else
2665 1563 : dtsets(idtset)%nc_xccc_gspace = 1
2666 : end if
2667 8382 : dtsets(idtset)%nctime = 0
2668 8382 : dtsets(idtset)%ncout = 1
2669 8382 : dtsets(idtset)%ndtset = -1
2670 8382 : dtsets(idtset)%neb_algo = NEB_ALGO_IMPROVED_TAN
2671 8382 : dtsets(idtset)%neb_cell_algo = NEB_CELL_ALGO_NONE
2672 25146 : dtsets(idtset)%neb_spring(1:2) = (/0.05_dp,0.05_dp/)
2673 8382 : dtsets(idtset)%nfft = -1
2674 8382 : dtsets(idtset)%nfftdg = -1
2675 :
2676 8382 : dtsets(idtset)%npulayit=7
2677 :
2678 : ! ngfft is a special case
2679 75438 : dtsets(idtset)%ngfft(1:8)=0
2680 8382 : dtsets(idtset)%ngfft(7) = fftalg_for_npfft(1)
2681 : ! fftcache=ngfft(8) is machine-dependent.
2682 8382 : dtsets(idtset)%ngfft(8) = get_cache_kb()
2683 :
2684 159258 : dtsets(idtset)%ngfftdg(:)=dtsets(idtset)%ngfft(:)
2685 : !
2686 : !nline
2687 8382 : dtsets(idtset)%nline=4
2688 : !For Chebyshev filtering algo, nline is the degree of the Chebyshev polynomial
2689 8382 : if (mod(dtsets(idtset)%wfoptalg,10) == 1) then
2690 199 : dtsets(idtset)%nline = dtsets(idtset)%mdeg_filter
2691 : end if
2692 : !Specific value for wavelets
2693 8382 : if(dtsets(idtset)%usewvl==1 .and. .not. wvl_bigdft) then
2694 0 : if(dtsets(idtset)%usepaw==1) dtsets(idtset)%nline=4
2695 0 : if(dtsets(idtset)%usepaw/=1) dtsets(idtset)%nline=2
2696 : end if
2697 :
2698 : ! nloalg is also a special case
2699 8382 : dtsets(idtset)%nloalg(1)=4
2700 8382 : dtsets(idtset)%nloalg(2)=1
2701 8382 : dtsets(idtset)%nloalg(3)=dtsets(idtset)%usepaw
2702 : !if (dtsets(idtset)%optdriver == RUNL_EPH) dtsets(idtset)%nloalg(3) = 1
2703 33528 : dtsets(idtset)%ngkpt=0
2704 8382 : dtsets(idtset)%nnsclo=0
2705 8382 : dtsets(idtset)%nnsclohf=0
2706 8382 : dtsets(idtset)%nonlinear_info=0
2707 8382 : dtsets(idtset)%noseinert=1.0d5
2708 8382 : dtsets(idtset)%npvel=0
2709 8382 : dtsets(idtset)%nqpt=0
2710 8382 : dtsets(idtset)%nscforder=16
2711 8382 : dtsets(idtset)%nshiftk=1
2712 8382 : dtsets(idtset)%nshiftk_orig=1
2713 8382 : dtsets(idtset)%nstep=30
2714 8382 : dtsets(idtset)%ntime=1
2715 8382 : dtsets(idtset)%nwfshist=0
2716 8382 : if(dtsets(idtset)%usewvl==1 .and. .not. wvl_bigdft) then
2717 0 : if(dtsets(idtset)%usepaw==1) then
2718 0 : dtsets(idtset)%nwfshist=4
2719 : else
2720 0 : dtsets(idtset)%nwfshist=2
2721 : end if
2722 : end if
2723 : ! O
2724 8382 : dtsets(idtset)%occopt=1
2725 1816480 : dtsets(idtset)%occ_orig(:,:)=zero
2726 8382 : dtsets(idtset)%optcell=0
2727 8382 : dtsets(idtset)%optforces=2
2728 8382 : if(dtsets(idtset)%usedmft>0 .and. dtsets(idtset)%usedmft/=0) dtsets(idtset)%optforces=0
2729 8382 : dtsets(idtset)%optstress=1
2730 8382 : dtsets(idtset)%optnlxccc=1
2731 8382 : dtsets(idtset)%oracle_factor=0.1_dp
2732 8382 : dtsets(idtset)%oracle_min_occ=0.0001_dp
2733 8382 : dtsets(idtset)%orbmag=0
2734 8382 : if (dtsets(idtset)%usepaw==0) then
2735 6819 : dtsets(idtset)%ortalg=2
2736 : else
2737 1563 : dtsets(idtset)%ortalg=-2
2738 : end if
2739 : ! P
2740 8382 : dtsets(idtset)%paral_atom=paral_atom_default
2741 8382 : dtsets(idtset)%paw_add_core=0
2742 8382 : dtsets(idtset)%pawcpxocc=1
2743 8382 : dtsets(idtset)%pawcross=0
2744 8382 : dtsets(idtset)%pawecutdg=-one
2745 8382 : dtsets(idtset)%pawfatbnd=0
2746 8382 : dtsets(idtset)%pawlcutd=10
2747 8382 : dtsets(idtset)%pawlmix=10
2748 8382 : dtsets(idtset)%pawmixdg=0 ! Will be set to 1 when npfft>1
2749 8382 : dtsets(idtset)%pawnhatxc=1
2750 8382 : dtsets(idtset)%pawntheta=12
2751 8382 : dtsets(idtset)%pawnphi=13
2752 8382 : dtsets(idtset)%pawnzlm=1
2753 8382 : dtsets(idtset)%pawoptmix=0
2754 8382 : dtsets(idtset)%pawoptosc=0
2755 8382 : dtsets(idtset)%pawovlp=5._dp
2756 8382 : dtsets(idtset)%pawprtdos=0
2757 8382 : dtsets(idtset)%pawprtvol=0
2758 8382 : dtsets(idtset)%pawprtwf=0
2759 8382 : dtsets(idtset)%pawprt_k=0
2760 8382 : dtsets(idtset)%pawprt_b=0
2761 8382 : dtsets(idtset)%pawstgylm=1
2762 8382 : dtsets(idtset)%pawsushat=0
2763 8382 : dtsets(idtset)%pawujat=1
2764 8382 : dtsets(idtset)%pawujrad=20.0_dp
2765 8382 : dtsets(idtset)%pawujv=0.1_dp/Ha_eV
2766 8382 : dtsets(idtset)%pawusecp=1
2767 8382 : dtsets(idtset)%pawxcdev=1
2768 8382 : dtsets(idtset)%pimd_constraint=0
2769 8382 : dtsets(idtset)%pitransform=0
2770 18893 : dtsets(idtset)%ptcharge(:) = zero
2771 : !dtsets(idtset)%plowan_compute=0
2772 8382 : dtsets(idtset)%plowan_bandi=0
2773 8382 : dtsets(idtset)%plowan_bandf=0
2774 : !if(dtsets(idtset)%plowan_compute>0) then
2775 2522982 : dtsets(idtset)%plowan_it(:)=0
2776 68381 : dtsets(idtset)%plowan_iatom(:)=0
2777 728370 : dtsets(idtset)%plowan_lcalc(:)=-1
2778 728370 : dtsets(idtset)%plowan_projcalc(:)=0
2779 68381 : dtsets(idtset)%plowan_nbl(:)=0
2780 : !end if
2781 8382 : dtsets(idtset)%plowan_natom=0
2782 8382 : dtsets(idtset)%plowan_nt=0
2783 8382 : dtsets(idtset)%plowan_realspace=0
2784 33528 : dtsets(idtset)%pol(:)=zero
2785 33528 : dtsets(idtset)%polcen(:)=zero
2786 8382 : dtsets(idtset)%posdoppler=0
2787 8382 : dtsets(idtset)%positron=0
2788 8382 : dtsets(idtset)%posnstep=50
2789 8382 : dtsets(idtset)%posocc=one
2790 8382 : dtsets(idtset)%postoldfe=0.000001_dp
2791 8382 : dtsets(idtset)%postoldff=zero
2792 8382 : dtsets(idtset)%precon_in_memory=1
2793 8382 : dtsets(idtset)%precon_ls_maxite=20
2794 8382 : dtsets(idtset)%precon_ls_rtol=tol6
2795 8382 : dtsets(idtset)%precon_tsmear=0.01_dp
2796 8382 : dtsets(idtset)%precon_verbose=0
2797 8382 : dtsets(idtset)%prepalw=0
2798 8382 : dtsets(idtset)%prepanl=0
2799 8382 : dtsets(idtset)%prtcurrent=0
2800 8382 : dtsets(idtset)%prtden=1 ; if (dtsets(idtset)%nimage>1) dtsets(idtset)%prtden=0
2801 8382 : dtsets(idtset)%prtebands=1 ; if (dtsets(idtset)%nimage>1) dtsets(idtset)%prtebands=0
2802 8382 : dtsets(idtset)%prteig=1 ; if (dtsets(idtset)%nimage>1) dtsets(idtset)%prteig=0
2803 8382 : dtsets(idtset)%prtevk=0
2804 8382 : dtsets(idtset)%prtgsr=1 ; if (dtsets(idtset)%nimage>1) dtsets(idtset)%prtgsr=0
2805 8382 : dtsets(idtset)%prtkpt = -1
2806 8382 : dtsets(idtset)%prt1mag = 0
2807 8382 : dtsets(idtset)%prtocc=0
2808 8382 : dtsets(idtset)%prtwf=1 ; if (dtsets(idtset)%nimage>1) dtsets(idtset)%prtwf=0
2809 : !if (dtsets%(idtset)%optdriver == RUNL_RESPFN and all(dtsets(:)%optdriver /= RUNL_NONLINEAR) dtsets(idtset)%prtwf = -1
2810 46439 : do ii=1,dtsets(idtset)%natom,1
2811 46439 : dtsets(idtset)%prtatlist(ii)=ii
2812 : end do
2813 8382 : dtsets(idtset)%pulayhiststore=0
2814 33528 : dtsets(idtset)%pvelmax(:)=one
2815 8382 : dtsets(idtset)%pw_unbal_thresh=40._dp
2816 : ! Q
2817 8438 : dtsets(idtset)%qmass(:)=ten
2818 8382 : dtsets(idtset)%qgbt(3)=zero
2819 8382 : dtsets(idtset)%qgbt_cart(3)=zero
2820 33528 : dtsets(idtset)%qprtrb(1:3)=0
2821 8442 : dtsets(idtset)%qptdm(:,:)=zero
2822 18893 : dtsets(idtset)%quadmom(:) = zero
2823 : ! R
2824 8382 : dtsets(idtset)%random_atpos=0
2825 8382 : dtsets(idtset)%ratopt=1
2826 8382 : dtsets(idtset)%ratsm=zero
2827 16894 : if (any(dtsets(idtset)%constraint_kind(1:dtsets(idtset)%ntypat)>0)) dtsets(idtset)%ratsm=0.05_dp
2828 8382 : dtsets(idtset)%ratsph_extra=two
2829 8382 : dtsets(idtset)%recefermi=zero
2830 8382 : dtsets(idtset)%recgratio=1
2831 8382 : dtsets(idtset)%recnpath=500
2832 8382 : dtsets(idtset)%recnrec=10
2833 8382 : dtsets(idtset)%recrcut=zero
2834 8382 : dtsets(idtset)%recptrott=0
2835 8382 : dtsets(idtset)%rectesteg=0
2836 8382 : dtsets(idtset)%rectolden=zero
2837 18893 : dtsets(idtset)%rcpaw_sc(:)=two
2838 18893 : dtsets(idtset)%rcpaw_rctypat(:)=1
2839 8382 : dtsets(idtset)%rcut=zero
2840 8382 : dtsets(idtset)%restartxf=0
2841 : ! dtsets(idtset)%rfasr=0
2842 25146 : dtsets(idtset)%rfatpol(1:2)=-1
2843 8382 : dtsets(idtset)%rfddk=0
2844 33528 : dtsets(idtset)%rfdir(1:3)=1
2845 8382 : dtsets(idtset)%rfelfd=0
2846 8382 : dtsets(idtset)%rfeta=zero
2847 8382 : dtsets(idtset)%rfmagn=0
2848 8382 : dtsets(idtset)%rfmeth=1
2849 8382 : dtsets(idtset)%rfomega=zero
2850 8382 : dtsets(idtset)%rfphon=0
2851 8382 : dtsets(idtset)%rfstrs=0
2852 8382 : dtsets(idtset)%rfstrs_ref=0
2853 8382 : dtsets(idtset)%rf2_dkdk=0
2854 8382 : dtsets(idtset)%rf2_dkde=0
2855 33528 : dtsets(idtset)%rf2_pert1_dir(1:3)=1
2856 33528 : dtsets(idtset)%rf2_pert2_dir(1:3)=1
2857 8382 : dtsets(idtset)%rhoqpmix=one
2858 : ! S
2859 7049262 : dtsets(idtset)%shiftk_orig(:,:)=one
2860 8382 : dtsets(idtset)%signperm=1
2861 8382 : dtsets(idtset)%slabwsrad=zero
2862 8382 : dtsets(idtset)%slk_rankpp=1000
2863 8382 : dtsets(idtset)%smdelta=0
2864 8382 : dtsets(idtset)%spbroad=0.1_dp
2865 8382 : dtsets(idtset)%spgaxor = -1
2866 8382 : dtsets(idtset)%spgorig = -1
2867 8382 : dtsets(idtset)%spinmagntarget=-99.99_dp
2868 8382 : dtsets(idtset)%spnorbscl=one
2869 8382 : dtsets(idtset)%stmbias=zero
2870 8382 : dtsets(idtset)%strfact=100.0_dp
2871 8382 : dtsets(idtset)%string_algo=STRING_ALGO_SIMPLIFIED_EQUAL
2872 8382 : dtsets(idtset)%strprecon=one
2873 58674 : dtsets(idtset)%strtarget(1:6)=zero
2874 : ! T
2875 8382 : dtsets(idtset)%td_exp_order=4
2876 8382 : dtsets(idtset)%td_maxene=zero
2877 8382 : dtsets(idtset)%td_mexcit=0
2878 8382 : dtsets(idtset)%td_scnmax=6
2879 8382 : dtsets(idtset)%td_prtstr=1
2880 8382 : dtsets(idtset)%td_restart=0
2881 8382 : dtsets(idtset)%td_propagator=0
2882 8382 : dtsets(idtset)%td_scthr=1e-7_dp
2883 8382 : dtsets(idtset)%td_ef_type=0
2884 8382 : dtsets(idtset)%td_ef_induced_vecpot=0
2885 8382 : dtsets(idtset)%td_ef_tzero=zero
2886 8382 : dtsets(idtset)%td_ef_tau=1.0_dp
2887 33528 : dtsets(idtset)%td_ef_pol=[1.0_dp,0.0_dp,0.0_dp]
2888 8382 : dtsets(idtset)%td_ef_lambda=10000.0_dp
2889 8382 : dtsets(idtset)%td_ef_ezero=0.1_dp
2890 8382 : dtsets(idtset)%tfw_toldfe=0.000001_dp
2891 8382 : dtsets(idtset)%timdisp=0
2892 8382 : dtsets(idtset)%tim1rev = 1
2893 8382 : dtsets(idtset)%tl_nprccg = 30
2894 8382 : dtsets(idtset)%tl_radius = zero
2895 8382 : dtsets(idtset)%tphysel=zero
2896 8382 : dtsets(idtset)%toldfe=zero
2897 8382 : dtsets(idtset)%tolmxde=zero
2898 8382 : dtsets(idtset)%toldff=zero
2899 8382 : dtsets(idtset)%toldmag=zero
2900 8382 : dtsets(idtset)%tolimg=5.0d-5
2901 8382 : dtsets(idtset)%tolrde=0.005_dp
2902 8382 : dtsets(idtset)%tolrff=zero
2903 8382 : dtsets(idtset)%tolmxf=5.0d-5
2904 8382 : dtsets(idtset)%tolvrs=zero
2905 8382 : dtsets(idtset)%tolwfr=zero
2906 8382 : dtsets(idtset)%tolwfr_diago=zero
2907 :
2908 8382 : dtsets(idtset)%tsmear=0.01_dp
2909 : ! U
2910 25146 : dtsets(idtset)%ucrpa_bands(:)=-1
2911 25146 : dtsets(idtset)%ucrpa_window(:)=-1.0_dp
2912 28409 : dtsets(idtset)%upawu(:,:)=zero
2913 8382 : dtsets(idtset)%usepead=1
2914 8382 : dtsets(idtset)%usefock=0
2915 8382 : dtsets(idtset)%usekden=0
2916 8382 : dtsets(idtset)%use_gemm_nonlop=0
2917 8382 : dtsets(idtset)%use_nonscf_gkk=0 !1 ! deactivate by default, for now 6 Oct 2013
2918 8382 : dtsets(idtset)%userec=0
2919 8382 : dtsets(idtset)%usexcnhat_orig=-1
2920 8382 : dtsets(idtset)%useylm=0
2921 : ! V
2922 8382 : dtsets(idtset)%vacnum = -1
2923 8382 : dtsets(idtset)%vcutgeo(3)=zero
2924 8382 : dtsets(idtset)%vdw_nfrag = 1
2925 : #if defined DEV_YP_VDWXC
2926 : dtsets(idtset)%vdw_df_acutmin = vdw_defaults%acutmin
2927 : dtsets(idtset)%vdw_df_aratio = vdw_defaults%aratio
2928 : dtsets(idtset)%vdw_df_damax = vdw_defaults%damax
2929 : dtsets(idtset)%vdw_df_damin = vdw_defaults%damin
2930 : dtsets(idtset)%vdw_df_dcut = vdw_defaults%dcut
2931 : dtsets(idtset)%vdw_df_dratio = vdw_defaults%dratio
2932 : dtsets(idtset)%vdw_df_dsoft = vdw_defaults%dsoft
2933 : dtsets(idtset)%vdw_df_gcut = vdw_defaults%gcut
2934 : dtsets(idtset)%vdw_df_ndpts = vdw_defaults%ndpts
2935 : dtsets(idtset)%vdw_df_ngpts = vdw_defaults%ngpts
2936 : dtsets(idtset)%vdw_df_nqpts = vdw_defaults%nqpts
2937 : dtsets(idtset)%vdw_df_nrpts = vdw_defaults%nrpts
2938 : dtsets(idtset)%vdw_df_nsmooth = vdw_defaults%nsmooth
2939 : dtsets(idtset)%vdw_df_phisoft = vdw_defaults%phisoft
2940 : dtsets(idtset)%vdw_df_qcut = vdw_defaults%qcut
2941 : dtsets(idtset)%vdw_df_qratio = vdw_defaults%qratio
2942 : dtsets(idtset)%vdw_df_rcut = vdw_defaults%rcut
2943 : dtsets(idtset)%vdw_df_rsoft = vdw_defaults%rsoft
2944 : dtsets(idtset)%vdw_df_tolerance = vdw_defaults%tolerance
2945 : dtsets(idtset)%vdw_df_tweaks = vdw_defaults%tweaks
2946 : dtsets(idtset)%vdw_df_zab = vdw_defaults%zab
2947 : dtsets(idtset)%vdw_df_threshold = 1.0d-2
2948 : #endif
2949 33528 : dtsets(idtset)%vdw_supercell(:) = 0
2950 8382 : dtsets(idtset)%vdw_tol = tol10
2951 8382 : dtsets(idtset)%vdw_tol_3bt = -1
2952 846582 : dtsets(idtset)%vdw_typfrag(:) = 1
2953 8382 : dtsets(idtset)%vdw_xc = 0
2954 8382 : dtsets(idtset)%vis=100.0_dp
2955 25146 : dtsets(idtset)%vprtrb(1:2)=zero
2956 : ! W
2957 8552 : dtsets(idtset)%wtatcon(:,:,:)=zero
2958 8382 : dtsets(idtset)%wfmix=one
2959 8382 : dtsets(idtset)%wfk_task=0
2960 218571 : dtsets(idtset)%wtk=one
2961 8382 : dtsets(idtset)%wvl_crmult = 6._dp
2962 8382 : dtsets(idtset)%wvl_frmult = 10._dp
2963 8382 : dtsets(idtset)%wvl_hgrid = 0.5_dp
2964 25146 : dtsets(idtset)%wvl_ngauss =(/1,100/)
2965 8382 : dtsets(idtset)%wvl_nprccg = 10
2966 8382 : dtsets(idtset)%w90iniprj = 1
2967 8382 : dtsets(idtset)%w90prtunk = 0
2968 8382 : dtsets(idtset)%write_files = "default"
2969 : ! X
2970 8382 : dtsets(idtset)%xclevel = 0
2971 8382 : dtsets(idtset)%xg_nonlop_option = 0
2972 8382 : dtsets(idtset)%xc_denpos = tol14
2973 8382 : dtsets(idtset)%xc_taupos = tol14
2974 8382 : dtsets(idtset)%xc_tb09_c = 99.99_dp
2975 8478 : dtsets(idtset)%xredsph_extra(:,:)=zero
2976 : ! Y
2977 : ! Z
2978 8382 : dtsets(idtset)%zcut=3.67493260d-03 ! = 0.1eV
2979 8382 : if(dtsets(idtset)%optdriver == RUNL_GWLS) dtsets(idtset)%zcut=zero
2980 : !if(dtsets(idtset)%optdriver == RUNL_EPH) dtsets(idtset)%zcut = 0.01 * eV_Ha
2981 18893 : dtsets(idtset)%ziontypat(:)=zero
2982 :
2983 20342 : dtsets(idtset)%bs_loband=0
2984 :
2985 : !dtsets(idtset)%eph_restart = 0
2986 : !print *, dtsets(idtset)%optdriver
2987 : !print *, dtsets(idtset)%eph_task
2988 : !if (dtsets(idtset)%optdriver == RUNL_EPH) then
2989 : ! if (any(dtsets(idtset)%eph_task == [13, -13])) then
2990 : ! ! In VARPEQ, restart must be activated explicitly.
2991 : ! dtsets(idtset)%eph_restart = 0
2992 : ! stop "hello"
2993 : ! end if
2994 : ! !dtsets(idtset)%mixprec = 1
2995 : ! !dtsets(idtset)%boxcutmin = 1.1_dp
2996 : !end if
2997 : end do
2998 : !stop
2999 :
3000 : DBG_EXIT("COLL")
3001 :
3002 1427 : end subroutine indefo
3003 : !!***
3004 :
3005 : end module m_invars1
3006 : !!***
|