Line data Source code
1 : !!****m* ABINIT/m_chkinp
2 : !! NAME
3 : !! m_chkinp
4 : !!
5 : !! FUNCTION
6 : !! Check consistency of Abinit input data against itself.
7 : !!
8 : !! COPYRIGHT
9 : !! Copyright (C) 1998-2026 ABINIT group (DCA, XG, GMR, MKV, DRH, MVer, MG)
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_chkinp
23 :
24 : use defs_basis
25 : use m_gwdefs
26 : use m_abicore
27 : use m_errors
28 : use m_xmpi
29 : use m_xomp
30 : use libxc_functionals
31 : use m_dtset
32 :
33 : use defs_datatypes, only : pspheader_type
34 : use defs_abitypes, only : MPI_type
35 : use m_numeric_tools, only : iseven, isdiagmat, wrap2_zero_one
36 : use m_symtk, only : sg_multable, chkorthsy, symmetrize_xred
37 : use m_fstrings, only : string_in, sjoin, itoa
38 : use m_geometry, only : metric
39 : use m_fftcore, only : fftalg_has_mpi
40 : use m_exit, only : get_timelimit
41 : use m_parser, only : chkdpr, chkint, chkint_eq, chkint_ge, chkint_le, chkint_ne
42 : use m_mep
43 :
44 : implicit none
45 :
46 : private
47 : !!***
48 :
49 : public :: chkinp
50 : !!***
51 :
52 : contains
53 : !!***
54 :
55 : !!****f* ABINIT/chkinp
56 : !! NAME
57 : !! chkinp
58 : !!
59 : !! FUNCTION
60 : !! Check consistency of input data against itself.
61 : !! Please: use the alphabetic order
62 : !! Please: use the routines chkint_eq, chkint_ne, chkint_ge, chkint_le, and chkdpr
63 : !!
64 : !! INPUTS
65 : !! dtsets(0:ndtset_alloc)=<type datafiles_type>contains all input variables
66 : !! iout=unit number for output file
67 : !! mpi_enregs(0:ndtset_alloc)=information about MPI parallelization
68 : !! ndtset=number of datasets
69 : !! ndtset_alloc=number of datasets, corrected for allocation of at least one data set.
70 : !! npsp=number of pseudopotentials
71 : !! pspheads(npsp)=<type pspheader_type>all the important information from the
72 : !! pseudopotential file header, as well as the psp file name
73 : !! comm: MPI communicator (MPI_COMM_WORLD)
74 : !!
75 : !! OUTPUT
76 : !!
77 : !! SOURCE
78 :
79 1427 : subroutine chkinp(dtsets, iout, mpi_enregs, ndtset, ndtset_alloc, npsp, pspheads, comm)
80 :
81 : !Arguments ------------------------------------
82 : !scalars
83 : integer,intent(in) :: iout,ndtset,ndtset_alloc,npsp, comm
84 : type(MPI_type),intent(in) :: mpi_enregs(0:ndtset_alloc)
85 : !arrays
86 : type(dataset_type),intent(in) :: dtsets(0:ndtset_alloc)
87 : type(pspheader_type),intent(in) :: pspheads(npsp)
88 :
89 : !Local variables-------------------------------
90 : !scalars
91 : integer :: bantot,fixed_mismatch,ia,iatom,ib,iband,idtset,ierr,iexit,ii,iimage,ikpt,intimage,ierrgrp!,ilang
92 : integer :: ipsp,isppol,isym,itypat,iz,jdtset,jj,kk,lpawu,maxiatsph,maxidyn,minplowan_iatom,maxplowan_iatom
93 : integer :: mband,miniatsph,minidyn,mod10,mpierr,all_nprocs
94 : integer :: mu,natom,nfft,nfftdg,nkpt,nloc_mem,nlpawu
95 : integer :: nproc,nthreads,nspden,nspinor,nsppol,optdriver,mismatch_fft_tnons,response !,so_psp
96 : integer :: fftalg,fftalga,usepaw,usewvl
97 : integer :: ttoldfe,ttoldff,ttolrff,ttolvrs,ttolwfr,ttoldmag
98 : logical :: test,twvl,allowed,berryflag
99 : logical :: wvlbigdft=.false.
100 : logical :: xc_is_lda,xc_is_gga,xc_is_mgga,xc_is_hybrid,xc_is_pot_only,xc_need_kden
101 : real(dp) :: dotval,dz,norm_spinat,norm_spinaxis,sumalch,summix,sumocc,ucvol,wvl_hgrid,zatom,zval
102 : character(len=1000) :: msg
103 182656 : type(dataset_type) :: dt
104 : !arrays
105 : integer :: cond_values(4)!,nprojmax(0:3)
106 : integer :: gpu_devices(12)=(/-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2/)
107 1427 : integer,allocatable :: ierr_dtset(:)
108 : real(dp) :: gmet(3,3),gprimd(3,3),rmet(3,3),rprimd(3,3)
109 1427 : real(dp),allocatable :: frac(:,:),tnons_new(:,:),xred(:,:), my_xred(:,:), xshift(:,:)
110 : character(len=32) :: cond_string(4)
111 : character(len=32) :: input_name
112 4281 : type(libxc_functional_type) :: xcfunc(2)
113 : ! *************************************************************************
114 :
115 : DBG_ENTER("COLL")
116 :
117 1427 : all_nprocs = xmpi_comm_size(comm)
118 :
119 : !Some initialisations
120 7135 : cond_string(1:4)='#####'
121 1427 : cond_values(1:4)=(/0,0,0,0/)
122 4281 : ABI_MALLOC(ierr_dtset,(ndtset_alloc))
123 8385 : ierr_dtset=0
124 :
125 : !Do loop on idtset (allocate statements are present)
126 8385 : do idtset=1,ndtset_alloc
127 6958 : if(mpi_enregs(idtset)%me<0) cycle
128 6958 : jdtset=dtsets(idtset)%jdtset
129 6958 : if(ndtset==0)jdtset=0
130 6958 : ierr=0
131 :
132 6958 : if(jdtset/=0)then
133 6559 : write(msg, '(a,a,a,i4,a)' ) ch10,' chkinp: Checking input parameters for consistency,',' jdtset=',jdtset,'.'
134 : else
135 399 : write(msg, '(a,a)' ) ch10,' chkinp: Checking input parameters for consistency.'
136 : end if
137 6958 : call wrtout(iout,msg)
138 6958 : call wrtout(std_out,msg)
139 :
140 : ! Will test directly on the dataset "dt"
141 6958 : dt = dtsets(idtset)%copy()
142 :
143 : ! count nominal valence electrons according to ziontypat
144 6958 : zval=zero
145 44916 : do iatom=1,dt%natom
146 44916 : zval=zval+dt%ziontypat(dt%typat(iatom))
147 : end do
148 :
149 : ! Copy or initialize locally a few input dataset values
150 6958 : fftalg =dt%ngfft(7)
151 6958 : fftalga =fftalg/100!; fftalgc=mod(fftalg,10)
152 : nthreads = xomp_get_num_threads(.true.)
153 6958 : natom =dt%natom
154 6958 : nkpt =dt%nkpt
155 6958 : nspden =dt%nspden
156 6958 : nspinor =dt%nspinor
157 6958 : nsppol =dt%nsppol
158 6958 : optdriver=dt%optdriver
159 6958 : usepaw =dt%usepaw
160 6958 : usewvl =dt%usewvl
161 6958 : intimage=1 ; if(dtsets(idtset)%nimage>2)intimage=2
162 90454 : rprimd(:,:)=dtsets(idtset)%rprimd_orig(:,:,intimage) ! For the purpose of checking symmetries
163 6958 : response=0
164 : if(dt%rfelfd/=0.or.dt%rfphon/=0.or.dt%rfstrs/=0.or.dt%rfddk/=0 &
165 : & .or.dt%rf2_dkdk/=0.or.dt%rf2_dkde/=0.or.dt%rfmagn/=0.or.dt%d3e_pert1_elfd/=0 &
166 : & .or.dt%d3e_pert2_elfd/=0.or.dt%d3e_pert3_elfd/=0.or.dt%d3e_pert1_phon/=0 &
167 6958 : & .or.dt%d3e_pert2_phon/=0.or.dt%d3e_pert3_phon/=0) response=1
168 6958 : call metric(gmet,gprimd,-1,rmet,rprimd,ucvol)
169 6958 : nproc=mpi_enregs(idtset)%nproc
170 :
171 : ! Some properties of the XC functional
172 6958 : if (dt%ixc>=0) then
173 5802 : xc_is_lda=((dt%ixc>=1.and.dt%ixc<=10).or.dt%ixc==50)
174 5802 : xc_is_gga=((dt%ixc>=11.and.dt%ixc<=16).or.(dt%ixc>=23.and.dt%ixc<=39))
175 5802 : xc_is_mgga=(dt%ixc>=31.and.dt%ixc<=35)
176 5802 : xc_is_pot_only=.false.
177 5802 : xc_is_hybrid=(dt%ixc==40.or.dt%ixc==41.or.dt%ixc==42)
178 5802 : xc_need_kden=(dt%ixc==31.or.dt%ixc==34.or.dt%ixc==35)
179 : else
180 1156 : call libxc_functionals_init(dt%ixc,nspden,xc_functionals=xcfunc,xc_tb09_c=dt%xc_tb09_c)
181 1156 : xc_is_lda=libxc_functionals_islda(xc_functionals=xcfunc)
182 1156 : xc_is_gga=libxc_functionals_isgga(xc_functionals=xcfunc)
183 1156 : xc_is_mgga=libxc_functionals_ismgga(xc_functionals=xcfunc)
184 1156 : xc_is_pot_only=libxc_functionals_is_potential_only(xc_functionals=xcfunc)
185 1156 : xc_is_hybrid=libxc_functionals_is_hybrid(xc_functionals=xcfunc)
186 1156 : xc_need_kden=libxc_functionals_needs_tau(xc_functionals=xcfunc)
187 1156 : call libxc_functionals_end(xc_functionals=xcfunc)
188 : end if
189 :
190 : ! =====================================================================================================
191 : ! Check the values of variables, using alphabetical order
192 : ! PLEASE: use the routines chkint_eq, chkint_ne, chkint_ge, chkint_le, chkdpr
193 :
194 : ! iomode Must be one of 0, 1, 3
195 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'iomode',dt%iomode,3, [IO_MODE_FORTRAN,IO_MODE_MPI,IO_MODE_ETSF],iout)
196 : ! However, if mpi_io is not enabled, must be one of 0, 3.
197 : if(xmpi_mpiio==0)then
198 : cond_string(1)='enable_mpi_io' ; cond_values(1)=0
199 : ! Make sure that iomode is 0 or 3
200 : call chkint_eq(1,1,cond_string,cond_values,ierr,'iomode',dt%iomode,2,[IO_MODE_FORTRAN,IO_MODE_ETSF],iout)
201 : end if
202 6958 : if (dt%iomode == IO_MODE_NETCDF .and. dt%npspinor == 2) then
203 0 : ABI_ERROR_NOSTOP("npspinor == 2 not compatible with netcdf", ierr)
204 : end if
205 :
206 : ! accuracy
207 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'accuracy',dt%accuracy,7,(/0,1,2,3,4,5,6/),iout)
208 :
209 : ! adpimd
210 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'accuracy',dt%adpimd,2,(/0,1/),iout)
211 :
212 : ! amu Check that atomic masses are > 0 if ionmov = 1
213 14176 : do iimage=1,dt%nimage
214 14176 : if (dt%ionmov==1) then
215 14 : do itypat=1,dt%ntypat
216 8 : cond_string(1)='ionmov' ; cond_values(1)=dt%ionmov
217 8 : write(input_name,'(a4,i2,a1,i2,a1)')'amu(',itypat,',',iimage,')'
218 14 : call chkdpr(1,1,cond_string,cond_values,ierr,input_name,dt%amu_orig(itypat,iimage),1,tol8,iout)
219 : end do
220 : end if
221 : end do
222 :
223 : ! autoparal
224 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'autoparal',dt%autoparal,5,(/0,1,2,3,4/),iout)
225 6958 : if(dt%chkparal/=0.and.(dt%autoparal/=0.and.dt%optdriver/=RUNL_GSTATE)) then
226 0 : cond_string(1)='optdriver' ; cond_values(1)=dt%optdriver
227 0 : cond_string(2)='chkparal' ; cond_values(2)=dt%chkparal
228 0 : call chkint_eq(2,2,cond_string,cond_values,ierr,'autoparal',dt%autoparal,1,(/0/),iout)
229 : end if
230 6958 : if (dt%gpu_option/=ABI_GPU_DISABLED) then ! At present (v10.8.1), autoparal is not available with GPU
231 0 : cond_string(1)='gpu_option' ; cond_values(1)=dt%gpu_option
232 0 : call chkint_eq(1,1,cond_string,cond_values,ierr,'autoparal',dt%autoparal,1,(/0/),iout)
233 0 : if(dt%autoparal/=0) then
234 : write(msg,'(3a)')&
235 0 : "autoparal is not supported with GPU enabled.",ch10,&
236 0 : "Action: remove 'autoparal' from input and set 'np_spkpt' and 'npband' accordingly."
237 0 : ABI_ERROR_NOSTOP(msg, ierr)
238 : end if
239 : end if
240 :
241 :
242 : ! auxc_scal
243 6958 : call chkdpr(0,0,cond_string,cond_values,ierr,'auxc_scal',dt%auxc_scal,1,0.0_dp,iout)
244 :
245 : ! bdberry
246 : if(dt%berryopt>0.and.dt%nberry>0.and.&
247 : dt%berryopt/= 4.and.dt%berryopt/= 6.and.dt%berryopt/= 7.and.&
248 6958 : dt%berryopt/=14.and.dt%berryopt/=16.and.dt%berryopt/=17) then
249 0 : do ii=1,2*nsppol
250 0 : cond_string(1)='berryopt' ; cond_values(1)=dt%berryopt
251 0 : cond_string(2)='nberry' ; cond_values(2)=dt%nberry
252 0 : write(input_name,'(a4,i1,a1)')'bdberry(',ii,')'
253 0 : call chkint_ge(2,2,cond_string,cond_values,ierr,input_name,dt%bdberry(ii),1,iout)
254 : end do
255 : ! bdberry(2) must be greater than bdberry(1)
256 0 : cond_string(1)='berryopt' ; cond_values(1)=dt%berryopt
257 0 : cond_string(2)='nberry' ; cond_values(2)=dt%nberry
258 0 : cond_string(3)='bdberry(1)' ; cond_values(3)=dt%bdberry(1)
259 0 : call chkint_ge(3,3,cond_string,cond_values,ierr,'bdberry(2)',dt%bdberry(2),dt%bdberry(1),iout)
260 0 : if(nsppol==2)then
261 : ! bdberry(4) must be greater than bdberry(3)
262 0 : cond_string(1)='berryopt' ; cond_values(1)=dt%berryopt
263 0 : cond_string(2)='nberry' ; cond_values(2)=dt%nberry
264 0 : cond_string(3)='bdberry(3)' ; cond_values(3)=dt%bdberry(3)
265 0 : call chkint_ge(3,3,cond_string,cond_values,ierr,'bdberry(4)',dt%bdberry(4),dt%bdberry(3),iout)
266 : end if
267 : ! Make sure all nband(nkpt) are >= bdberry
268 0 : do isppol=1,nsppol
269 0 : do ikpt=1,nkpt
270 0 : if (dt%nband(ikpt+(isppol-1)*nkpt)<=dt%bdberry(2*isppol)) then
271 0 : cond_string(1)='ikpt' ; cond_values(1)=ikpt
272 0 : cond_string(2)='isppol' ; cond_values(2)=isppol
273 0 : cond_string(3)='nband' ; cond_values(3)=dt%nband(ikpt+(isppol-1)*nkpt)
274 : call chkint_le(0,3,cond_string,cond_values,ierr,&
275 0 : 'bdberry',dt%bdberry(2*isppol),dt%nband(ikpt+(isppol-1)*nkpt),iout)
276 0 : if(ierr==1)exit
277 : end if
278 : end do
279 : end do
280 : end if
281 :
282 : ! berryopt must be between -3 to +4, 6,7,14,16,17
283 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'berryopt',dt%berryopt,13,(/-3,-2,-1,0,1,2,3,4,6,7,14,16,17/),iout)
284 : ! berryopt must be positive when mkmem==0
285 6958 : if(dt%mkmem==0)then
286 0 : cond_string(1)='mkmem' ; cond_values(1)=dt%mkmem
287 0 : call chkint_ge(1,1,cond_string,cond_values,ierr,'berryopt',dt%berryopt,0,iout)
288 : end if
289 : ! berryopt must be positive when occopt/=1
290 6958 : if(dt%occopt/=1)then
291 2997 : cond_string(1)='occopt' ; cond_values(1)=dt%occopt
292 2997 : call chkint_ge(1,1,cond_string,cond_values,ierr,'berryopt',dt%berryopt,0,iout)
293 : end if
294 : ! berryopt cannot be 4,6,7,14,16,17 when toldfe, tolvrs, toldff and tolrff are zero (or negative)
295 48550 : if (any(dt%berryopt== [4,6,7,14,16,17] ) ) then
296 26 : cond_string(1)='berryopt' ; cond_values(1)=dt%berryopt
297 : call chkdpr(1,1,cond_string,cond_values,ierr,'max(toldfe,toldff,tolrff,tolvrs,toldmag)',&
298 26 : max(dt%toldfe,dt%toldff,dt%tolrff,dt%tolvrs,dt%toldmag),1,tol16*tol16,iout)
299 : endif
300 : ! Non-zero berryopt and usepaw==1 cannot be done unless response==0
301 6958 : if (usepaw==1.and.dt%berryopt/=0) then
302 30 : cond_string(1)='usepaw' ; cond_values(1)=usepaw
303 30 : cond_string(2)='berryopt' ; cond_values(2)=dt%berryopt
304 30 : call chkint_eq(1,2,cond_string,cond_values,ierr,'response',response,1,(/0/),iout)
305 : end if
306 : ! Non-zero berryopt and usepaw==1 and kptopt/=3 cannot be done unless symmorphi=0
307 : ! (that is, nonsymmorphic symmetries do not work yet
308 : ! Update MT 2017-05-31: nonsymmorphic symmetries seem also to be an issue for NCPP
309 6958 : if (usepaw==1.and.dt%berryopt/=0.and.dt%kptopt/=3) then
310 : !if (clldt%berryopt/=0.and.dt%kptopt/=3) then
311 26 : cond_string(1)='usepaw'; cond_values(1)=usepaw
312 26 : cond_string(2)='berryopt'; cond_values(2)=dt%berryopt
313 26 : cond_string(3)='kptopt'; cond_values(3)=dt%kptopt
314 26 : call chkint_eq(1,3,cond_string,cond_values,ierr,'symmorphi',dt%symmorphi,1,(/0/),iout)
315 : end if
316 : ! Restrictions for berryopt=4,6,7,14,16,17
317 6958 : if (usepaw==1.and.&
318 : (dt%berryopt== 4.or.dt%berryopt== 6.or.dt%berryopt== 7.or.&
319 : dt%berryopt==14.or.dt%berryopt==16.or.dt%berryopt==17)) then
320 : ! if (nsppol==2.and.nproc>1) then
321 : ! write(msg,'(3a)') &
322 : !& 'For berryopt = 4,6,7,14,16,17 and nsppol=2, nproc must = 1 ',ch10,&
323 : !& 'Action: change number of processes'
324 : ! ABI_ERROR_NOSTOP(msg, ierr)
325 : ! end if
326 : end if
327 : ! berryopt.GE.4 and usepaw==1 and kpt // requires nproc to be a divisor of nkpt
328 6958 : if (usepaw==1 .and. dt%berryopt.GE.4 .and. nproc>1 .and. mod(dt%nkpt,nproc)/=0) then
329 : write(msg, '(3a)' )&
330 0 : 'For berryopt >= 4 with PAW in parallel, nproc must be a divisor of nkpt ',ch10,&
331 0 : 'Action: change number of processes or kpts such that nproc divides nkpt evenly'
332 0 : ABI_ERROR_NOSTOP(msg, ierr)
333 : end if
334 :
335 : ! Finite electric/displacement field checks
336 6958 : if (dt%berryopt==4) then
337 : if (maxval(abs(dt%dfield(1:3)))>tiny(0.0_dp).or.&
338 : maxval(abs(dt%red_dfield(1:3)))>tiny(0.0_dp).or.&
339 442 : maxval(abs(dt%red_efield(1:3)))>tiny(0.0_dp).or.&
340 : maxval(abs(dt%red_efieldbar(1:3)))>tiny(0.0_dp)) then
341 : write(msg,'(5a)' ) &
342 0 : 'When berryopt==4, only efield is needed, other input field',ch10,&
343 0 : '(dfield,red_dfield,red_efield,red_efieldbar) should be zero.',ch10,&
344 0 : 'Action: delete unneeded field in input file.'
345 0 : ABI_ERROR_NOSTOP(msg, ierr)
346 : end if
347 : end if
348 6958 : if (dt%berryopt==14) then
349 : if (maxval(abs(dt%dfield(1:3)))>tiny(0.0_dp).or.&
350 : maxval(abs(dt%red_dfield(1:3)))>tiny(0.0_dp).or.&
351 0 : maxval(abs(dt%red_efield(1:3)))>tiny(0.0_dp).or.&
352 : maxval(abs(dt%efield(1:3)))>tiny(0.0_dp)) then
353 : write(msg,'(5a)') &
354 0 : 'When berryopt==14, only red_efieldbar is needed, other input field',ch10,&
355 0 : '(dfield,red_dfield,efield,red_efield) should be zero.',ch10,&
356 0 : 'Action: delete unneeded field in input file.'
357 0 : ABI_ERROR_NOSTOP(msg, ierr)
358 : end if
359 : end if
360 6958 : if (dt%berryopt==6) then
361 : if (maxval(abs(dt%red_dfield(1:3)))>tiny(0.0_dp).or.&
362 0 : maxval(abs(dt%red_efield(1:3)))>tiny(0.0_dp).or.&
363 : maxval(abs(dt%red_efieldbar(1:3)))>tiny(0.0_dp)) then
364 : write(msg,'(5a)') &
365 0 : 'When berryopt==6, only dfield and efield are needed, other input field',ch10,&
366 0 : '(red_dfield,red_efield,red_efieldbar) should be zero.',ch10,&
367 0 : 'Action: delete unneeded field in input file.'
368 0 : ABI_ERROR_NOSTOP(msg, ierr)
369 : end if
370 : end if
371 6958 : if (dt%berryopt==16) then
372 : if (maxval(abs(dt%dfield(1:3)))>tiny(0.0_dp).or.&
373 0 : maxval(abs(dt%efield(1:3)))>tiny(0.0_dp).or.&
374 : maxval(abs(dt%red_efieldbar(1:3)))>tiny(0.0_dp)) then
375 : write(msg,'(5a)') &
376 0 : 'When berryopt==16, only red_dfield and red_efield are needed, other input field',ch10,&
377 0 : '(dfield,efield,red_efieldbar) should be zero.',ch10,&
378 0 : 'Action: delete unneeded field in input file.'
379 0 : ABI_ERROR_NOSTOP(msg, ierr)
380 : end if
381 : end if
382 6958 : if (dt%berryopt==17) then
383 : if (maxval(abs(dt%dfield(1:3)))>tiny(0.0_dp).or.&
384 0 : maxval(abs(dt%efield(1:3)))>tiny(0.0_dp).or.&
385 : maxval(abs(dt%red_efield(1:3)))>tiny(0.0_dp)) then
386 : write(msg,'(5a)') &
387 0 : 'When berryopt==17, only red_dfield and red_efieldbar are needed, other input field',ch10,&
388 0 : '(dfield,efield,red_efield) should be zero.',ch10,&
389 0 : 'Action: delete unneeded field in input file.'
390 0 : ABI_ERROR_NOSTOP(msg, ierr)
391 : end if
392 : if ((dt%jfielddir(1)/=1.and.dt%jfielddir(1)/=2).or.&
393 0 : (dt%jfielddir(2)/=1.and.dt%jfielddir(2)/=2).or.&
394 : (dt%jfielddir(3)/=1 .and.dt%jfielddir(3)/=2)) then
395 : write(msg,'(5a)') &
396 0 : 'When berryopt==17, jfielddir can only be 1 or 2 to controls whether reduced electric field',ch10,&
397 0 : '(jfielddir=1) or reduced electric displacement field (jfielddir=2) is chosen to be fixed', ch10,&
398 0 : 'Action: change jfielddir to be 1 or 2 in input file.'
399 0 : ABI_ERROR_NOSTOP(msg, ierr)
400 : end if
401 : end if
402 :
403 : ! berrystep
404 6958 : call chkint_ge(0,0,cond_string,cond_values,ierr,'berrystep',dt%berrystep,1,iout)
405 6958 : if(nproc>1)then
406 1226 : cond_string(1)='nproc'; cond_values(1)=mpi_enregs(idtset)%nproc
407 1226 : call chkint_eq(1,1,cond_string,cond_values,ierr,'berrystep',dt%berrystep,1,(/1/),iout)
408 : end if
409 :
410 : ! boxcutmin
411 : ! if(response==1)then
412 : ! cond_string(1)='response' ; cond_values(1)=response
413 : ! call chkdpr(1,1,cond_string,cond_values,ierr,'boxcutmin',dt%boxcutmin,1,two,iout)
414 : ! end if
415 :
416 : ! builtintest
417 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'builtintest',dt%builtintest,8,(/0,1,2,3,4,5,6,7/),iout)
418 :
419 : ! cellcharge
420 : ! The value of cellcharge cannot change between images, except when imgmov=6 and (occopt=0 or occopt=2)
421 6958 : if(dt%imgmov/=6 .or. (dt%occopt/=0 .and. dt%occopt/=2))then
422 14158 : do iimage=1,dt%nimage
423 14164 : if(abs(dt%cellcharge(iimage)-dt%cellcharge(1))>tol8)then
424 0 : write(msg, '(2a,i4,a,i4,2a,es12.4,a,i4,es12.4)' )ch10,&
425 0 : ' chkinp : imgmov=',dt%imgmov,', occopt=',dt%occopt,ch10,&
426 0 : ' chkinp : cellcharge(1)=',dt%cellcharge(1),', while for image=',iimage,', cellcharge=',dt%cellcharge(iimage)
427 0 : call wrtout(iout,msg)
428 0 : call wrtout(std_out, msg)
429 : write(msg, '(a,i4,2a,i4,2a,f8.2,4a)' )&
430 0 : ' This is not allowed: cellcharge is allowed to vary only when imgmov=6 and occopt=0 or 2.',ch10,&
431 0 : ' Action: check the content of the input variables cellcharge, imgmov anf occopt.'
432 0 : ABI_ERROR_NOSTOP(msg, ierr)
433 : end if
434 : end do
435 : end if
436 :
437 : ! chebfi_oracle: must be 0,1,2
438 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'chebfi_oracle',dt%chebfi_oracle,3,(/0,1,2/),iout)
439 6958 : if (dt%gpu_option/=ABI_GPU_DISABLED) then ! At present (v10.2.2), chebfi oracle is not available with GPU
440 0 : cond_string(1)='gpu_option' ; cond_values(1)=dt%gpu_option
441 0 : call chkint_eq(1,1,cond_string,cond_values,ierr,'chebfi_oracle',dt%chebfi_oracle,1,(/0/),iout)
442 : end if
443 :
444 : ! oracle_factor: must be > 1e-30 and below 1
445 6958 : call chkdpr(0,0,cond_string,cond_values,ierr,'oracle_factor',dt%oracle_factor,1,tol30,iout)
446 6958 : call chkdpr(0,0,cond_string,cond_values,ierr,'oracle_factor',dt%oracle_factor,-1,0.99_dp,iout)
447 :
448 : ! oracle_min_occ: must be > 1e-10 and below 1
449 6958 : call chkdpr(0,0,cond_string,cond_values,ierr,'oracle_min_occ',dt%oracle_factor,1,tol10,iout)
450 6958 : call chkdpr(0,0,cond_string,cond_values,ierr,'oracle_min_occ',dt%oracle_factor,-1,0.99_dp,iout)
451 :
452 : ! chkdilatmx
453 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'chkdilatmx',dt%chkdilatmx,2,(/0,1/),iout)
454 :
455 : ! chkparal
456 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'chkparal',dt%chkparal,2,(/0,1/),iout)
457 :
458 : ! chksymbreak
459 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'chksymbreak',dt%chksymbreak,2,(/0,1/),iout)
460 :
461 : ! chksymtnons
462 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'chksymtnons',dt%chksymtnons,4,(/0,1,2,3/),iout)
463 :
464 6958 : if(dt%chksymtnons>0)then
465 : ! Check the values of tnons
466 19302 : ABI_MALLOC(tnons_new,(3,dt%nsym))
467 19302 : ABI_MALLOC(xred,(3,dt%natom))
468 153930 : xred(:,:)=dt%xred_orig(:,1:dt%natom,1)
469 : ! Use the largest significant value of tolsym, namely, one.
470 : call symmetrize_xred(dt%natom,dt%nsym,dt%symrel,dt%tnons,xred,&
471 6434 : fixed_mismatch=fixed_mismatch,mismatch_fft_tnons=mismatch_fft_tnons,tnons_new=tnons_new,tolsym=one)
472 6434 : ABI_FREE(tnons_new)
473 :
474 6434 : if(mismatch_fft_tnons/=0)then
475 2 : if(fixed_mismatch==1)then
476 2 : write(msg, '(2a)' ) ch10,' chkinp: COMMENT -'
477 2 : call wrtout(std_out,msg)
478 : write(msg, '(4a,3es20.10)' ) &
479 2 : ' Found potentially symmetry-breaking value of tnons (see input variable chksymtnons). ', ch10,&
480 2 : ' The following shift of all reduced symmetry-corrected atomic positions might possibly remove this problem:',ch10,&
481 10 : xred(:,1)-dt%xred_orig(:,1,1)
482 2 : call wrtout(std_out,msg)
483 2 : call wrtout(iout,msg)
484 2 : write(msg, '(4a)' ) ch10,&
485 2 : ' For your convenience, you might cut+paste the shifted new atomic positions (for image 1 only):',ch10,&
486 4 : ' xred'
487 2 : call wrtout(std_out,msg)
488 2 : call wrtout(iout,msg)
489 19 : do iatom=1,dt%natom
490 17 : write(msg,'(a,3es20.10)') ' ',xred(:,iatom)
491 17 : call wrtout(std_out,msg)
492 19 : call wrtout(iout,msg)
493 : enddo
494 2 : call wrtout(std_out,' ')
495 : endif
496 :
497 2 : if(dt%chksymtnons==1 .or. dt%chksymtnons==3)then
498 0 : write(msg, '(8a,i4,2a,9i3,2a,3es20.10,11a)' ) ch10,&
499 0 : ' chkinp: ERROR -',ch10,&
500 0 : ' Chksymtnons=1 or 3 . Found potentially symmetry-breaking value of tnons, ', ch10,&
501 0 : ' which is neither a rational fraction in 1/8th nor in 1/12th (1/9th and 1/10th are tolerated also):', ch10,&
502 0 : ' for the symmetry number ',mismatch_fft_tnons,ch10,&
503 0 : ' symrel is ',dt%symrel(1:3,1:3,mismatch_fft_tnons),ch10,&
504 0 : ' tnons is ',dt%tnons(1:3,mismatch_fft_tnons),ch10,&
505 0 : ' So, your atomic positions are not aligned with the FFT grid.',ch10,&
506 0 : ' Please, read the description of the input variable chksymtnons.',ch10,&
507 0 : ' If you are planning cDFT, GW or BSE calculations, such tnons value is very problematic.',ch10,&
508 0 : ' Otherwise, you might set chksymtnons=0.',&
509 0 : ' But do not be surprised if ABINIT does not converge for cDFT, or crashes for GW or BSE.',ch10,&
510 0 : ' Better solution: you might shift your atomic positions to better align the FFT grid and the symmetry axes.'
511 0 : call wrtout(std_out,msg)
512 0 : if(fixed_mismatch==1)then
513 : write(msg, '(a)' )&
514 0 : ' ABINIT has detected such a possible shift. See the suggestion given in the COMMENT above (or in output or log file).'
515 0 : call wrtout(std_out,msg, do_flush=.True.)
516 : endif
517 0 : ierr=ierr+1 ! Previously a warning: for slab geometries arbitrary tnons can appear along the vacuum direction.
518 : ! But then simply set chksymtnons=0 ...
519 : endif
520 : endif
521 6434 : ABI_FREE(xred)
522 : end if
523 :
524 : ! constraint_kind
525 15543 : do itypat=1,dt%ntypat
526 8585 : cond_string(1)='itypat';cond_values(1)=itypat
527 : call chkint_eq(0,1,cond_string,cond_values,ierr,'constraint_kind',dt%constraint_kind(itypat),&
528 8585 : 10,(/0,1,2,3,4,10,11,12,13,14/),iout)
529 : !Only potential self-consistency is currently allowed with constrained_dft
530 8585 : if (dt%iscf>10) then
531 1504 : cond_string(1)='itypat';cond_values(1)=itypat
532 1504 : cond_string(2)='iscf';cond_values(2)=dt%iscf
533 1504 : call chkint_eq(2,2,cond_string,cond_values,ierr,'constraint_kind',dt%constraint_kind(itypat),1,(/0/),iout)
534 : endif
535 8585 : if (dt%ionmov==4) then
536 6 : cond_string(1)='itypat';cond_values(1)=itypat
537 6 : cond_string(2)='ionmov';cond_values(2)=dt%ionmov
538 6 : call chkint_eq(2,2,cond_string,cond_values,ierr,'constraint_kind',dt%constraint_kind(itypat),1,(/0/),iout)
539 : endif
540 8585 : if (dt%nspden==2) then
541 1921 : cond_string(1)='itypat';cond_values(1)=itypat
542 1921 : cond_string(2)='nspden';cond_values(2)=dt%nspden
543 1921 : call chkint_eq(2,2,cond_string,cond_values,ierr,'constraint_kind',dt%constraint_kind(itypat),8,(/0,1,2,3,10,11,12,13/),iout)
544 : endif
545 15543 : if (dt%chksymtnons==1 .or. dt%chksymtnons==2) then
546 7903 : cond_string(1)='itypat';cond_values(1)=itypat
547 7903 : cond_string(2)='chksymtnons';cond_values(2)=dt%chksymtnons
548 7903 : call chkint_eq(2,2,cond_string,cond_values,ierr,'constraint_kind',dt%constraint_kind(itypat),1,(/0/),iout)
549 : endif
550 :
551 : enddo
552 :
553 : ! cprj_in_memory
554 6958 : if (dt%cprj_in_memory/=0) then
555 162 : if (dt%optdriver/=RUNL_GSTATE) then
556 0 : ABI_ERROR_NOSTOP('cprj_in_memory/=0 is implemented only for ground state (optdriver=0).',ierr)
557 : else
558 162 : if (dt%useylm /= 1) then
559 0 : ABI_ERROR_NOSTOP('cprj_in_memory/=0 requires the input variable "useylm" to be 1',ierr)
560 : end if
561 162 : ABI_CHECK(dt%gpu_option==0,"cprj_in_memory/=0 is not implemented for GPUs. Change cprj_in_memory or gpu_option.")
562 162 : write(msg,'(a)') "cprj_in_memory/=0 is not compatible with use_gemm_nonlop/=0. Change cprj_in_memory or use_gemm_nonlop."
563 162 : ABI_CHECK(dt%use_gemm_nonlop==0,msg)
564 162 : test = dt%wfoptalg==10 .or. dt%wfoptalg==114 .or. dt%wfoptalg==111 .or. dt%wfoptalg==112
565 162 : write(msg,'(a)') "With cprj_in_memory/=0, only wfoptalg==10,114,112 or 111 are implemented. Change cprj_in_memory or wfoptalg."
566 162 : ABI_CHECK(test,msg)
567 162 : ABI_CHECK(dt%rmm_diis==0, "With cprj_in_memory/=0, rmm_diis/=0 is not implemented. Change cprj_in_memory or rmm_diis.")
568 162 : ABI_CHECK(dt%berryopt==0, "With cprj_in_memory/=0, berryopt/=0 is not implemented. Change cprj_in_memory or berryopt.")
569 162 : ABI_CHECK(dt%usefock==0, "With cprj_in_memory/=0, usefock/=0 is not implemented. Change cprj_in_memory or usefock.")
570 1618 : test = sum(abs(dt%nucdipmom))<tol16
571 162 : ABI_CHECK(test,"With cprj_in_memory/=0, nuclear dipolar moments are not implemented. Change cprj_in_memory or nucdipmom.")
572 : !
573 162 : test=dt%cprj_in_memory==0.or.dt%cprj_in_memory==1.or.dt%cprj_in_memory==2
574 162 : write(msg,'(a)') "cprj_in_memory must 0 (not used), 1 (LOBPCG or Chebfi) or 2 (Conjugate Gradient). Change cprj_in_memory."
575 162 : ABI_CHECK(test,msg)
576 162 : test = dt%usepaw==1.or.dt%nspinor==1
577 162 : write(msg,'(a,a)') "With cprj_in_memory/=0, nspinor=2 is not available with Norm-Concerving pseudo-potentials.",&
578 324 : " Use nspinor=1, or PAW pseudos, or set cprj_in_memory to 0."
579 162 : ABI_CHECK(test,msg)
580 162 : if (dt%cprj_in_memory==1.and.dt%wfoptalg==10) then
581 0 : ABI_ERROR_NOSTOP('cprj_in_memory must be 2 for Conjugate Gradient (not 1).',ierr)
582 : end if
583 162 : if (dt%cprj_in_memory==2.and.(dt%wfoptalg==114.or.dt%wfoptalg==111)) then
584 0 : dt%cprj_in_memory=1
585 0 : ABI_ERROR_NOSTOP('cprj_in_memory must be 1 for LOBPCG or Chebfi (not 2).',ierr)
586 : end if
587 162 : if (dt%wfoptalg/=111.and.dt%xg_nonlop_option/=0) then
588 0 : dt%xg_nonlop_option=0
589 0 : ABI_ERROR_NOSTOP('xg_nonlop_option/=0 is useful only for Chebfi (wfoptalg=111).',ierr)
590 : end if
591 : end if
592 : end if
593 :
594 : ! spectrum slicing
595 6958 : if (dt%wfoptalg/=112 .and. dt%paral_slice/=0) then
596 0 : ABI_ERROR_NOSTOP("paral_slice is useful only for Spectrum Slicing (wfoptalg=112).", ierr)
597 : end if
598 :
599 : ! d3e_pert1_atpol
600 6958 : call chkint_ge(0,0,cond_string,cond_values,ierr,'d3e_pert1_atpol(1)',dt%d3e_pert1_atpol(1),1,iout)
601 6958 : cond_string(1)='natom' ; cond_values(1)=natom
602 6958 : call chkint_le(1,1,cond_string,cond_values,ierr,'d3e_pert1_atpol(2)',dt%d3e_pert1_atpol(2),natom,iout)
603 :
604 : ! d3e_pert2_atpol
605 6958 : call chkint_ge(0,0,cond_string,cond_values,ierr,'d3e_pert2_atpol(1)',dt%d3e_pert2_atpol(1),1,iout)
606 6958 : cond_string(1)='natom' ; cond_values(1)=natom
607 6958 : call chkint_le(1,1,cond_string,cond_values,ierr,'d3e_pert2_atpol(2)',dt%d3e_pert2_atpol(2),natom,iout)
608 :
609 : ! d3e_pert3_atpol
610 6958 : call chkint_ge(0,0,cond_string,cond_values,ierr,'d3e_pert3_atpol(1)',dt%d3e_pert3_atpol(1),1,iout)
611 6958 : cond_string(1)='natom' ; cond_values(1)=natom
612 6958 : call chkint_le(1,1,cond_string,cond_values,ierr,'d3e_pert3_atpol(2)',dt%d3e_pert3_atpol(2),natom,iout)
613 :
614 : ! d3e_pert1_magat
615 6958 : call chkint_ge(0,0,cond_string,cond_values,ierr,'d3e_pert1_magat(1)',dt%d3e_pert1_magat(1),1,iout)
616 6958 : cond_string(1)='natom' ; cond_values(1)=natom
617 6958 : call chkint_le(1,1,cond_string,cond_values,ierr,'d3e_pert1_magat(2)',dt%d3e_pert1_magat(2),natom,iout)
618 :
619 : ! d3e_pert2_magat
620 6958 : call chkint_ge(0,0,cond_string,cond_values,ierr,'d3e_pert2_magat(1)',dt%d3e_pert2_magat(1),1,iout)
621 6958 : cond_string(1)='natom' ; cond_values(1)=natom
622 6958 : call chkint_le(1,1,cond_string,cond_values,ierr,'d3e_pert2_magat(2)',dt%d3e_pert2_magat(2),natom,iout)
623 :
624 : ! densfor_pred
625 6958 : if(dt%iscf>0)then
626 6247 : cond_string(1)='iscf';cond_values(1)=dt%iscf
627 6247 : call chkint_le(0,1,cond_string,cond_values,ierr,'densfor_pred',dt%densfor_pred,6,iout)
628 6247 : call chkint_ge(0,1,cond_string,cond_values,ierr,'densfor_pred',dt%densfor_pred,-6,iout)
629 6247 : if (dt%densfor_pred<0.and.mod(dt%iprcel,100)>=61.and.(dt%iprcel<71.or.dt%iprcel>79)) then
630 0 : cond_string(1)='iscf';cond_values(1)=dt%iscf
631 0 : cond_string(2)='iprcel';cond_values(2)=dt%iprcel
632 0 : call chkint_ge(1,2,cond_string,cond_values,ierr,'densfor_pred',dt%densfor_pred,0,iout)
633 : end if
634 : ! densfor_pred<0 not valid for mGGA
635 : ! Yet it is but contribution from Laplacian and/or kin. ene. density are not taken into account
636 : !if(dt%densfor_pred<0.and.xc_is_mgga.and.dt%iscf>=10)then
637 : ! msg='densfor_pred<0 (full correction for forces) is not allowed for density mixing and meta-GGA XC!'
638 : ! ABI_ERROR_NOSTOP(msg, ierr)
639 : !end if
640 : end if
641 :
642 : ! diecut
643 6958 : if(dt%iscf==-1)then
644 22 : cond_string(1)='iscf' ; cond_values(1)=dt%iscf
645 22 : cond_string(2)='4*ecut==diecut' ; cond_values(2)=0
646 : ! Checks that presently diecut is 4*ecut
647 22 : call chkdpr(1,2,cond_string,cond_values,ierr,'diecut',dt%diecut,0,4*dt%ecut,iout)
648 : end if
649 :
650 : ! diemac
651 6958 : call chkdpr(0,0,cond_string,cond_values,ierr,'diemac',dt%diemac,1,0.01_dp,iout)
652 :
653 : ! dilatmx
654 6958 : call chkdpr(0,0,cond_string,cond_values,ierr,'dilatmx',dt%dilatmx,1,zero,iout)
655 6958 : if(dt%chkdilatmx==1)then
656 6916 : cond_string(1)='chkdilatmx' ; cond_values(1)=dt%chkdilatmx
657 : ! Checks that presently chkdilatmx is smaller than 1.15
658 6916 : call chkdpr(1,1,cond_string,cond_values,ierr,'dilatmx',dt%dilatmx,-1,1.15_dp,iout)
659 : end if
660 6958 : if (dt%optdriver/=RUNL_GSTATE) then
661 1318 : cond_string(1)='optdriver' ; cond_values(1)=dt%optdriver
662 : ! Checks that presently dilatmx is 1 if optdriver is not GSTATE
663 1318 : call chkdpr(1,1,cond_string,cond_values,ierr,'dilatmx',dt%dilatmx,0,1._dp,iout)
664 : end if
665 : ! Warn the user if dilatmx > 1 and optcell == 0.
666 6958 : if (dt%dilatmx>one.and.dt%optcell==0) then
667 : write(msg, "(a)") 'dilatmx > 1 and optcell=0, this is a waste of resources (computational time and memory). &
668 86 : & You should set dilatmx to 1.'
669 86 : ABI_WARNING(msg)
670 : end if
671 :
672 : ! dmatpuopt
673 6958 : if (dt%usepawu>0) then
674 142 : cond_string(1)='usepawu' ; cond_values(1)=dt%usepawu
675 142 : call chkint_eq(0,1,cond_string,cond_values,ierr,'dmatpuopt',dt%dmatpuopt,10,(/1,2,3,4,5,6,7,8,9,10/),iout)
676 : end if
677 :
678 : ! dmatudiag
679 6958 : if (dt%usepawu>0) then
680 142 : cond_string(1)='usepawu' ; cond_values(1)=dt%usepawu
681 142 : call chkint_eq(0,1,cond_string,cond_values,ierr,'dmatudiag',dt%dmatudiag,3,(/0,1,2/),iout)
682 : end if
683 :
684 :
685 : ! dmftbandi, dmftbandf
686 6958 : if (dt%usedmft>0.and.dt%usedmft/=10) then
687 43 : cond_string(1)='usedmft' ; cond_values(1)=dt%usedmft
688 43 : call chkint_eq(0,1,cond_string,cond_values,ierr,'dmftcheck',dt%dmftcheck,4,(/-1,0,1,2/),iout)
689 43 : if(dt%dmftcheck/=-1) then
690 :
691 42 : cond_string(1)='usedmft' ; cond_values(1)=dt%usedmft
692 42 : call chkint_eq(1,1,cond_string,cond_values,ierr,'occopt',dt%occopt,1,(/3/),iout)
693 :
694 42 : cond_string(1)='usedmft' ; cond_values(1)=dt%usedmft
695 42 : call chkint_ge(0,1,cond_string,cond_values,ierr,'dmftbandi',dt%dmftbandi,1,iout)
696 42 : cond_string(1)='usedmft' ; cond_values(1)=dt%usedmft
697 42 : call chkint_ge(0,1,cond_string,cond_values,ierr,'dmftbandf',dt%dmftbandf,dt%dmftbandi,iout)
698 :
699 42 : cond_string(1)='mband' ; cond_values(1)=dt%mband
700 42 : call chkint_le(0,1,cond_string,cond_values,ierr,'dmftbandi',dt%dmftbandi,dt%mband,iout)
701 42 : cond_string(1)='mband' ; cond_values(1)=dt%mband
702 42 : call chkint_le(0,1,cond_string,cond_values,ierr,'dmftbandf',dt%dmftbandf,dt%mband,iout)
703 :
704 42 : cond_string(1)='usedmft' ; cond_values(1)=dt%usedmft
705 42 : call chkint_ge(0,1,cond_string,cond_values,ierr,'dmft_entropy',dt%dmft_entropy,0,iout)
706 42 : cond_string(1)='usedmft' ; cond_values(1)=dt%usedmft
707 42 : call chkint_ge(0,1,cond_string,cond_values,ierr,'dmft_iter',dt%dmft_iter,0,iout)
708 42 : cond_string(1)='usedmft' ; cond_values(1)=dt%usedmft
709 42 : call chkint_eq(0,1,cond_string,cond_values,ierr,'dmft_kspectralfunc',dt%dmft_kspectralfunc,2,(/0,1/),iout)
710 :
711 42 : if(dt%dmft_kspectralfunc==1) then
712 4 : cond_string(1)='dmft_kspectralfunc' ; cond_values(1)=dt%dmft_kspectralfunc
713 4 : call chkint_eq(0,1,cond_string,cond_values,ierr,'iscf',dt%iscf,2,(/-2,-3/),iout)
714 : endif
715 :
716 42 : call chkint_eq(0,1,cond_string,cond_values,ierr,'dmft_magnfield',dt%dmft_magnfield,3,(/0,1,2/),iout)
717 :
718 42 : if(dt%dmft_magnfield .gt. 0) then
719 13 : cond_string(1)='dmft_magnfield' ; cond_values(1)=dt%dmft_magnfield
720 13 : call chkdpr(0,1,cond_string,cond_values,ierr,'dmft_magnfield_b',dt%dmft_magnfield_b,1,0.0_dp,iout)
721 : endif
722 :
723 42 : if(dt%ucrpa==0.and.dt%dmft_solv/=9.and.dt%dmft_solv/=6.and.dt%dmft_solv/=7) then
724 42 : cond_string(1)='usedmft' ; cond_values(1)=dt%usedmft
725 42 : call chkint_ge(0,1,cond_string,cond_values,ierr,'dmft_nwlo',dt%dmft_nwlo,1,iout)
726 42 : cond_string(1)='usedmft' ; cond_values(1)=dt%usedmft
727 42 : call chkint_ge(0,1,cond_string,cond_values,ierr,'dmft_nwli',dt%dmft_nwli,1,iout)
728 : end if
729 :
730 42 : cond_string(1)='usedmft' ; cond_values(1)=dt%usedmft
731 42 : call chkint_eq(0,1,cond_string,cond_values,ierr,'dmft_read_occnd',dt%dmft_read_occnd,3,(/0,1,2/),iout)
732 42 : cond_string(1)='usedmft' ; cond_values(1)=dt%usedmft
733 42 : call chkint_eq(0,1,cond_string,cond_values,ierr,'dmft_occnd_imag',dt%dmft_occnd_imag,2,(/0,1/),iout)
734 42 : cond_string(1)='usedmft' ; cond_values(1)=dt%usedmft
735 42 : call chkint_eq(0,1,cond_string,cond_values,ierr,'dmft_prt_maxent',dt%dmft_prt_maxent,2,(/0,1/),iout)
736 42 : cond_string(1)='usedmft' ; cond_values(1)=dt%usedmft
737 42 : call chkint_eq(0,1,cond_string,cond_values,ierr,'dmft_prtself',dt%dmft_prtself,2,(/0,1/),iout)
738 42 : cond_string(1)='usedmft' ; cond_values(1)=dt%usedmft
739 42 : call chkint_eq(0,1,cond_string,cond_values,ierr,'dmft_prtwan',dt%dmft_prtwan,2,(/0,1/),iout)
740 42 : cond_string(1)='usedmft' ; cond_values(1)=dt%usedmft
741 42 : call chkint_eq(0,1,cond_string,cond_values,ierr,'dmft_rslf',dt%dmft_rslf,3,(/-1,0,1/),iout)
742 42 : cond_string(1)='usedmft' ; cond_values(1)=dt%usedmft
743 42 : call chkdpr(0,1,cond_string,cond_values,ierr,'dmft_fermi_step',dt%dmft_fermi_step,1,zero,iout)
744 42 : cond_string(1)='usedmft' ; cond_values(1)=dt%usedmft
745 42 : call chkdpr(0,1,cond_string,cond_values,ierr,'dmft_mxsf',dt%dmft_mxsf,1,zero,iout)
746 42 : cond_string(1)='usedmft' ; cond_values(1)=dt%usedmft
747 42 : call chkdpr(0,1,cond_string,cond_values,ierr,'dmft_mxsf',dt%dmft_mxsf,-1,one,iout)
748 42 : cond_string(1)='usedmft' ; cond_values(1)=dt%usedmft
749 42 : call chkint_eq(0,1,cond_string,cond_values,ierr,'dmft_solv',dt%dmft_solv,11,(/-2,-1,0,1,2,5,6,7,8,9,10/),iout)
750 42 : cond_string(1)='usedmft' ; cond_values(1)=dt%usedmft
751 42 : call chkdpr(0,1,cond_string,cond_values,ierr,'dmft_tolfreq',dt%dmft_tolfreq,-1,0.01_dp,iout)
752 42 : cond_string(1)='usedmft' ; cond_values(1)=dt%usedmft
753 42 : call chkdpr(0,1,cond_string,cond_values,ierr,'dmft_tollc',dt%dmft_tollc,-1,tol5,iout)
754 42 : cond_string(1)='usedmft' ; cond_values(1)=dt%usedmft
755 42 : call chkdpr(0,1,cond_string,cond_values,ierr,'dmft_charge_prec',dt%dmft_charge_prec,-1,tol4,iout)
756 42 : cond_string(1)='usedmft' ; cond_values(1)=dt%usedmft
757 42 : call chkdpr(0,1,cond_string,cond_values,ierr,'dmft_charge_prec',dt%dmft_charge_prec,1,tol20,iout)
758 42 : cond_string(1)='usedmft' ; cond_values(1)=dt%usedmft
759 42 : call chkint_eq(0,1,cond_string,cond_values,ierr,'dmft_dc',dt%dmft_dc,6,(/1,2,5,6,7,8/),iout)
760 42 : cond_string(1)='usedmft' ; cond_values(1)=dt%usedmft
761 42 : call chkint_eq(0,1,cond_string,cond_values,ierr,'dmft_full_chipsi',dt%dmft_full_chipsi,2,(/0,1/),iout)
762 42 : cond_string(1)='usedmft' ; cond_values(1)=dt%usedmft
763 42 : call chkint_eq(0,1,cond_string,cond_values,ierr,'dmft_wanorthnorm',dt%dmft_wanorthnorm,2,(/2,3/),iout)
764 42 : if(dt%getwfk==0.and.dt%irdwfk==0.and.dt%irdden==0.and.dt%getden==0.and.dt%ucrpa==0) then
765 : write(msg,'(3a,i3,a,i3,a,i3,a,i3,a)' )&
766 0 : 'When usedmft==1, A WFK file or a DEN file has to be read. In the current calculation:',ch10, &
767 0 : ' getwfk =',dt%getwfk, &
768 0 : ' irdwfk =',dt%irdwfk, &
769 0 : ' getden =',dt%getden, &
770 0 : ' irdden =',dt%irdden, &
771 0 : ' Action: use a restart density or WFK file'
772 0 : if(dt%iscf>0) ABI_ERROR(msg)
773 : end if
774 42 : cond_string(1)='usedmft' ; cond_values(1)=dt%usedmft
775 42 : call chkint_eq(0,1,cond_string,cond_values,ierr,'dmft_t2g',dt%dmft_t2g,2,(/0,1/),iout)
776 42 : cond_string(1)='usedmft' ; cond_values(1)=dt%usedmft
777 42 : call chkint_eq(0,1,cond_string,cond_values,ierr,'dmft_x2my2d',dt%dmft_x2my2d,2,(/0,1/),iout)
778 42 : if (dt%dmft_solv>=5.and.dt%ucrpa==0.and.dt%dmft_solv/=9.and.dt%dmft_solv/=6.and.dt%dmft_solv/=7) then
779 26 : cond_string(1)='usedmft' ; cond_values(1)=dt%usedmft
780 26 : call chkint_ge(0,1,cond_string,cond_values,ierr,'dmftqmc_l',dt%dmftqmc_l,1,iout)
781 26 : cond_string(1)='usedmft' ; cond_values(1)=dt%usedmft
782 26 : call chkdpr(0,1,cond_string,cond_values,ierr,'dmftqmc_n',dt%dmftqmc_n,1,one,iout)
783 26 : cond_string(1)='usedmft' ; cond_values(1)=dt%usedmft
784 26 : call chkint_ge(0,1,cond_string,cond_values,ierr,'dmftqmc_seed',dt%dmftqmc_seed,0,iout)
785 26 : cond_string(1)='usedmft' ; cond_values(1)=dt%usedmft
786 26 : call chkint_ge(0,1,cond_string,cond_values,ierr,'dmftqmc_therm',dt%dmftqmc_therm,1,iout)
787 : end if
788 42 : cond_string(1)='usepawu' ; cond_values(1)=dt%usepawu
789 42 : if (dt%usepawu==14) then
790 17 : call chkint_eq(0,1,cond_string,cond_values,ierr,'dmft_dc',dt%dmft_dc,4,(/5,6,7,8/),iout)
791 : else
792 25 : call chkint_eq(0,1,cond_string,cond_values,ierr,'dmft_dc',dt%dmft_dc,2,(/1,2/),iout)
793 : endif
794 42 : if (dt%dmft_dc==8) then
795 0 : cond_string(1)='dmft_dc' ; cond_values(1)=dt%dmft_dc
796 0 : call chkint_eq(0,1,cond_string,cond_values,ierr,'ixc',dt%ixc,4,(/7,-1012,11,-101130/),iout)
797 0 : cond_string(1)='dmft_dc' ; cond_values(1)=dt%dmft_dc
798 0 : call chkint_eq(0,1,cond_string,cond_values,ierr,'dmft_solv',dt%dmft_solv,10,(/-2,0,1,2,5,6,7,8,9,10/),iout)
799 0 : cond_string(1)='dmft_dc' ; cond_values(1)=dt%dmft_dc
800 0 : call chkint_eq(0,1,cond_string,cond_values,ierr,'dmft_t2g',dt%dmft_t2g,1,(/0/),iout)
801 0 : cond_string(1)='dmft_dc' ; cond_values(1)=dt%dmft_dc
802 0 : call chkint_eq(0,1,cond_string,cond_values,ierr,'dmft_x2my2d',dt%dmft_x2my2d,1,(/0/),iout)
803 0 : cond_string(1)='dmft_dc' ; cond_values(1)=dt%dmft_dc
804 0 : call chkint_eq(0,1,cond_string,cond_values,ierr,'dmft_yukawa_param',dt%dmft_yukawa_param,4,(/1,2,3,4/),iout)
805 0 : if (dt%dmft_yukawa_param==4) then
806 0 : cond_string(1)='dmft_yukawa_param' ; cond_values(1)=dt%dmft_yukawa_param
807 0 : call chkdpr(0,1,cond_string,cond_values,ierr,'dmft_yukawa_lambda',dt%dmft_yukawa_lambda,1,zero,iout)
808 0 : cond_string(1)='dmft_yukawa_param' ; cond_values(1)=dt%dmft_yukawa_param
809 0 : call chkdpr(0,1,cond_string,cond_values,ierr,'dmft_yukawa_epsilon',dt%dmft_yukawa_epsilon,1,zero,iout)
810 : end if
811 : end if
812 :
813 42 : if (dt%dmft_solv .eq. 10 .and. dt%nspinor .eq. 1) then
814 0 : write(msg,'(2a)') "dmft_solv == 10 is not implemented for nspinor == 1 "
815 0 : ABI_ERROR(msg)
816 : endif
817 :
818 42 : if (dt%dmft_solv .eq. 10) then
819 0 : cond_string(1)='usedmft' ; cond_values(1)=dt%usedmft
820 0 : call chkint_eq(0,1,cond_string,cond_values,ierr,'dmft_hybri_limit',dt%dmft_hybri_limit,2,(/0,1/),iout)
821 : endif
822 :
823 108 : do itypat=1,dt%ntypat
824 66 : if (dt%lpawu(itypat)==-1) cycle
825 84 : if (dt%dmft_orbital(itypat)<=0.and.dt%dmft_orbital_filepath==ABI_NOFILE) then
826 0 : write(msg,'(2a)') "You need to provide a filename for the DMFT orbital", &
827 0 : & " with dmft_orbital_filepath"
828 0 : ABI_ERROR(msg)
829 : end if
830 : end do
831 :
832 : !if (dt%dmft_prtwan==1) then
833 : ! cond_string(1)='dmft_prtwan' ; cond_values(1)=dt%dmft_prtwan
834 : ! call chkint_eq(0,1,cond_string,cond_values,ierr,'dmft_solv',dt%dmft_solv,2,(/6,7/),iout)
835 : !end if
836 :
837 42 : if (dt%dmft_solv>=5.and.dt%dmft_solv/=6.and.dt%dmft_solv/=7) then
838 26 : cond_string(1)='dmft_solv' ; cond_values(1)=dt%dmft_solv
839 : if (dt%dmft_solv == 6 .or. dt%dmft_solv == 7 ) then
840 : call chkint_eq(0,1,cond_string,cond_values,ierr,'dmftctqmc_basis',dt%dmftctqmc_basis,5,(/0,1,2,3,4/),iout)
841 : if (dt%dmftctqmc_basis == 4) then
842 : cond_string(1)='dmftctqmc_basis' ; cond_values(1)=dt%dmftctqmc_basis
843 : call chkint_eq(0,1,cond_string,cond_values,ierr,'nspinor',dt%nspinor,1,(/2/),iout)
844 : end if
845 : else
846 26 : call chkint_eq(0,1,cond_string,cond_values,ierr,'dmftctqmc_basis',dt%dmftctqmc_basis,4,(/0,1,2,4/),iout)
847 26 : if (dt%dmftctqmc_basis == 4) then
848 0 : cond_string(1)='dmftctqmc_basis' ; cond_values(1)=dt%dmftctqmc_basis
849 0 : call chkint_eq(0,1,cond_string,cond_values,ierr,'nspinor',dt%nspinor,1,(/2/),iout)
850 : end if
851 : end if
852 26 : cond_string(1)='dmft_solv' ; cond_values(1)=dt%dmft_solv
853 26 : call chkint_eq(0,1,cond_string,cond_values,ierr,'dmftctqmc_check',dt%dmftctqmc_check,4,(/0,1,2,3/),iout)
854 26 : cond_string(1)='dmft_solv' ; cond_values(1)=dt%dmft_solv
855 26 : call chkint_ge(0,1,cond_string,cond_values,ierr,'dmftctqmc_gmove',dt%dmftctqmc_gmove,0,iout)
856 26 : cond_string(1)='dmft_solv' ; cond_values(1)=dt%dmft_solv
857 26 : call chkint_ge(0,1,cond_string,cond_values,ierr,'dmftctqmc_meas',dt%dmftctqmc_meas,1,iout)
858 : #if defined HAVE_TRIQS_v2_0 || defined HAVE_TRIQS_v1_4
859 : if (dt%dmft_solv==9) then
860 : call chkint_ge(0,1,cond_string,cond_values,ierr,'dmftqmc_l',dt%dmftqmc_l,2*dt%dmft_nwli+1,iout)
861 : cond_string(1)='usedmft' ; cond_values(1)=dt%usedmft
862 : call chkint_ge(0,1,cond_string,cond_values,ierr,'dmft_triqs_n_l',dt%dmft_triqs_n_l,1,iout)
863 : end if
864 : #endif
865 : #if !defined HAVE_PYTHON_INVOCATION
866 26 : if (dt%dmft_solv==9) then
867 : write(msg,'(2a)')&
868 0 : 'ABINIT must have been compiled with the flag enable_python_invocation="yes" in order to allow', &
869 0 : ' dmft_solv==9. You need to recompile ABINIT or change the value of dmft_solv.'
870 0 : ABI_ERROR(msg)
871 : end if
872 : #endif
873 : end if
874 :
875 42 : if (dt%dmft_solv==5) then
876 26 : cond_string(1)='dmft_solv' ; cond_values(1)=dt%dmft_solv
877 26 : call chkint_eq(0,1,cond_string,cond_values,ierr,'dmftctqmc_correl',dt%dmftctqmc_correl,2,(/0,1/),iout)
878 26 : call chkint_eq(0,1,cond_string,cond_values,ierr,'dmftctqmc_grnns',dt%dmftctqmc_grnns,2,(/0,1/),iout)
879 26 : call chkint_ge(0,1,cond_string,cond_values,ierr,'dmftctqmc_mrka',dt%dmftctqmc_mrka,0,iout)
880 26 : call chkint_eq(0,1,cond_string,cond_values,ierr,'dmftctqmc_mov',dt%dmftctqmc_mov,2,(/0,1/),iout)
881 26 : call chkint_ge(0,1,cond_string,cond_values,ierr,'dmftctqmc_order',dt%dmftctqmc_order,0,iout)
882 26 : call chkint_ge(0,1,cond_string,cond_values,ierr,'dmft_nwlo',dt%dmft_nwlo,2*dt%dmftqmc_l,iout)
883 : end if
884 42 : cond_string(1)='dmft_solv' ; cond_values(1)=dt%dmft_solv
885 42 : call chkint_eq(0,1,cond_string,cond_values,ierr,'dmftctqmc_localprop',dt%dmftctqmc_localprop,4,(/0,1,2,3/),iout)
886 42 : if (dt%dmft_entropy>=1) then
887 3 : cond_string(1)='dmft_entropy' ; cond_values(1)=dt%dmft_entropy
888 3 : call chkint_ge(0,1,cond_string,cond_values,ierr,'dmft_nlambda',dt%dmft_nlambda,3,iout)
889 3 : call chkint_le(0,1,cond_string,cond_values,ierr,'dmft_entropy',dt%dmft_entropy,dt%dmft_nlambda,iout)
890 3 : call chkint_eq(0,1,cond_string,cond_values,ierr,'dmft_dc',dt%dmft_dc,1,(/1/),iout)
891 3 : if (dt%dmft_solv /= 5) then
892 : write(msg,'(3a,i3,a,i3,a,i3,a,i3,a)' )&
893 0 : 'When dmft_entropy>=1, the impurity solver has to be currently dmft_solv=5:',ch10, &
894 0 : 'Action: change your dmft_solv input'
895 0 : ABI_ERROR(msg)
896 : end if
897 : end if
898 42 : if (dt%nspinor==2.and.dt%nspden==1) ABI_ERROR(' nspinor=2, nspden=1 and usedmft=1 is not implemented')
899 479 : if (maxval(abs(dt%nband(1:dt%nkpt)-dt%nband(1)))>0) ABI_ERROR("Every kpt needs to have the same number of bands in DMFT")
900 134 : do iatom=1,natom
901 92 : lpawu = dt%lpawu(dt%typat(iatom))
902 92 : if (lpawu==-1) cycle
903 48 : if (dt%dmft_t2g==1.and.lpawu/=2) ABI_ERROR("lpawu/=2 and dmft_t2g=1 are not compatible")
904 48 : if (dt%dmft_x2my2d==1.and.lpawu/=2) ABI_ERROR("lpawu/=2 and dmft_x2my2d=1 are not compatible")
905 48 : if (dt%dmft_dc==7.and.dt%dmft_nominal(iatom)<1) ABI_ERROR("Please set a physical value for nominal occupancies with dmft_nominal")
906 90 : if (lpawu==0.and.dt%dmft_triqs_basis==4) ABI_ERROR("lpawu must be >0 in order to use JmJ basis")
907 : end do
908 : end if
909 : end if
910 :
911 : ! Use of Wannier90 and TRIQS. Could use a new variable name instead. w90dmft?
912 : #if !defined HAVE_WANNIER90
913 : if(dt%usedmft==10) then
914 : write(msg, '(5a)') &
915 : ' usedmft == 10 is only relevant with Wannier90. This ABINIT was not',ch10,&
916 : ' compiled with Wannier90.',ch10,&
917 : ' Action: check compilation options to link Wannier90.'
918 : ABI_ERROR(msg)
919 : endif
920 : #else
921 6958 : if(dt%usedmft==10) then
922 0 : if(dt%prtwant /=2) then
923 : write(msg, '(4a,i0,a)' )&
924 0 : ' In DMFT with Wannier90 orbital, you have to use the Wannier90 interface,',ch10,&
925 0 : ' which requires that you use the prtwant = 2 keyword. It was instead found to be ',ch10,&
926 0 : dt%prtwant, '. Please look at the tutorial on Wannier90.'
927 0 : ABI_ERROR(msg)
928 : end if
929 0 : if(dt%w90iniprj /=2) then
930 : write(msg, '(5a,i0,2a)' )&
931 0 : ' In DMFT with Wannier90 orbital, the only valid value for w90iniprj is 2,',ch10,&
932 0 : ' meaning that the Wannier90 initial projection are defined in a .win file.',ch10,&
933 0 : ' For this calculation, it was found to be ', dt%w90iniprj,ch10,&
934 0 : ' Action: check the values of w90iniprj and the .win file.'
935 0 : ABI_ERROR(msg)
936 : end if
937 : endif
938 : #endif
939 :
940 : #if !defined HAVE_TRIQS_INTERNAL && !defined HAVE_TRIQS_v3_2
941 6958 : if(dt%dmft_solv>=6.and.dt%dmft_solv<=7) then
942 : write(msg,'(3a)') &
943 0 : & ' dmft_solv=6, or 7 is only relevant if the TRIQS library v3.2>= is linked',ch10,&
944 0 : & ' Action: check compilation options'
945 0 : ABI_ERROR(msg)
946 : end if
947 : #endif
948 :
949 6958 : if(dt%dmft_solv==6.or.dt%dmft_solv==7) then
950 0 : cond_string(1)='dmft_solv' ; cond_values(1)=dt%dmft_solv
951 0 : call chkint_ge(0,1,cond_string,cond_values,ierr,'dmft_triqs_length_cycle',dt%dmft_triqs_length_cycle,1,iout)
952 0 : cond_string(1)='dmft_solv' ; cond_values(1)=dt%dmft_solv
953 0 : call chkint_eq(0,1,cond_string,cond_values,ierr,'dmft_triqs_basis',dt%dmft_triqs_basis,5,(/0,1,2,3,4/),iout)
954 0 : if (dt%dmft_triqs_basis == 4) then
955 0 : cond_string(1)='dmft_triqs_basis' ; cond_values(1)=dt%dmft_triqs_basis
956 0 : call chkint_eq(0,1,cond_string,cond_values,ierr,'nspinor',dt%nspinor,1,(/2/),iout)
957 : end if
958 0 : call chkint_eq(0,1,cond_string,cond_values,ierr,'dmft_triqs_chiloc',dt%dmft_triqs_chiloc,3,(/0,1,2/),iout)
959 0 : if (dt%dmft_triqs_chiloc > 0) then
960 0 : cond_string(1)='dmft_triqs_chiloc' ; cond_values(1)=dt%dmft_triqs_chiloc
961 0 : call chkint_ge(0,1,cond_string,cond_values,ierr,'dmft_triqs_chiloc_ins',dt%dmft_triqs_chiloc_ins,1,iout)
962 : end if
963 0 : cond_string(1)='dmft_solv' ; cond_values(1)=dt%dmft_solv
964 0 : call chkint_ge(0,1,cond_string,cond_values,ierr,'dmft_triqs_n_warmup_cycles_init',dt%dmft_triqs_n_warmup_cycles_init,0,iout)
965 0 : cond_string(1)='dmft_solv' ; cond_values(1)=dt%dmft_solv
966 0 : call chkint_ge(0,1,cond_string,cond_values,ierr,'dmft_triqs_n_cycles',dt%dmft_triqs_n_cycles,1,iout)
967 0 : cond_string(1)='dmft_solv' ; cond_values(1)=dt%dmft_solv
968 0 : call chkint_ge(0,1,cond_string,cond_values,ierr,'dmft_triqs_n_tau',dt%dmft_triqs_n_tau,1,iout)
969 0 : cond_string(1)='dmft_solv' ; cond_values(1)=dt%dmft_solv
970 0 : call chkint_ge(0,1,cond_string,cond_values,ierr,'dmft_triqs_n_iw',dt%dmft_triqs_n_iw,1,iout)
971 0 : cond_string(1)='dmft_solv' ; cond_values(1)=dt%dmft_solv
972 0 : call chkint_eq(0,1,cond_string,cond_values,ierr,'dmft_triqs_compute_integral',dt%dmft_triqs_compute_integral,2,(/0,1/),iout)
973 0 : cond_string(1)='dmft_solv' ; cond_values(1)=dt%dmft_solv
974 0 : call chkint_eq(0,1,cond_string,cond_values,ierr,'dmft_triqs_prt_entropy',dt%dmft_triqs_prt_entropy,2,(/0,1/),iout)
975 0 : cond_string(1)='dmft_solv' ; cond_values(1)=dt%dmft_solv
976 0 : call chkint_ge(0,1,cond_string,cond_values,ierr,'dmft_triqs_det_init_size',dt%dmft_triqs_det_init_size,1,iout)
977 0 : cond_string(1)='dmft_solv' ; cond_values(1)=dt%dmft_solv
978 0 : call chkint_ge(0,1,cond_string,cond_values,ierr,'dmft_triqs_det_n_operations_before_check',dt%dmft_triqs_det_n_operations_before_check,1,iout)
979 0 : cond_string(1)='dmft_solv' ; cond_values(1)=dt%dmft_solv
980 0 : call chkint_eq(0,1,cond_string,cond_values,ierr,'dmft_triqs_entropy',dt%dmft_triqs_entropy,2,(/0,1/),iout)
981 0 : cond_string(1)='dmft_solv' ; cond_values(1)=dt%dmft_solv
982 0 : call chkint_eq(0,1,cond_string,cond_values,ierr,'dmft_triqs_measure_g_l',dt%dmft_triqs_measure_g_l,2,(/0,1/),iout)
983 0 : cond_string(1)='dmft_solv' ; cond_values(1)=dt%dmft_solv
984 0 : call chkint_ge(0,1,cond_string,cond_values,ierr,'dmft_triqs_loc_n_min',dt%dmft_triqs_loc_n_min,0,iout)
985 0 : cond_string(1)='dmft_solv' ; cond_values(1)=dt%dmft_solv
986 0 : call chkint_ge(0,1,cond_string,cond_values,ierr,'dmft_triqs_loc_n_max',dt%dmft_triqs_loc_n_max,dt%dmft_triqs_loc_n_min,iout)
987 0 : cond_string(1)='dmft_solv' ; cond_values(1)=dt%dmft_solv
988 0 : call chkint_eq(0,1,cond_string,cond_values,ierr,'dmft_triqs_measure_density_matrix',dt%dmft_triqs_measure_density_matrix,2,(/0,1/),iout)
989 0 : cond_string(1)='dmft_solv' ; cond_values(1)=dt%dmft_solv
990 0 : call chkint_eq(0,1,cond_string,cond_values,ierr,'dmft_triqs_move_double',dt%dmft_triqs_move_double,2,(/0,1/),iout)
991 0 : cond_string(1)='dmft_solv' ; cond_values(1)=dt%dmft_solv
992 0 : call chkint_eq(0,1,cond_string,cond_values,ierr,'dmft_triqs_move_shift',dt%dmft_triqs_move_shift,2,(/0,1/),iout)
993 0 : cond_string(1)='dmft_solv' ; cond_values(1)=dt%dmft_solv
994 0 : call chkint_eq(0,1,cond_string,cond_values,ierr,'dmft_triqs_off_diag',dt%dmft_triqs_off_diag,2,(/0,1/),iout)
995 0 : cond_string(1)='dmft_solv' ; cond_values(1)=dt%dmft_solv
996 0 : call chkdpr(0,1,cond_string,cond_values,ierr,'dmft_triqs_pauli_prob',dt%dmft_triqs_pauli_prob,1,zero,iout)
997 0 : cond_string(1)='dmft_solv' ; cond_values(1)=dt%dmft_solv
998 0 : call chkdpr(0,1,cond_string,cond_values,ierr,'dmft_triqs_pauli_prob',dt%dmft_triqs_pauli_prob,-1,one,iout)
999 0 : cond_string(1)='dmft_solv' ; cond_values(1)=dt%dmft_solv
1000 0 : call chkint_eq(0,1,cond_string,cond_values,ierr,'dmft_triqs_read_ctqmcdata',dt%dmft_triqs_read_ctqmcdata,2,(/0,1/),iout)
1001 : #if defined HAVE_TRIQS_INTERNAL
1002 : cond_string(1)='dmft_solv' ; cond_values(1)=dt%dmft_solv
1003 : call chkint_ge(0,1,cond_string,cond_values,ierr,'dmft_triqs_n_warmup_cycles_restart',dt%dmft_triqs_n_warmup_cycles_restart,0,iout)
1004 : #endif
1005 0 : cond_string(1)='dmft_solv' ; cond_values(1)=dt%dmft_solv
1006 0 : call chkint_eq(0,1,cond_string,cond_values,ierr,'dmft_triqs_time_invariance',dt%dmft_triqs_time_invariance,2,(/0,1/),iout)
1007 0 : cond_string(1)='dmft_solv' ; cond_values(1)=dt%dmft_solv
1008 0 : call chkint_eq(0,1,cond_string,cond_values,ierr,'dmft_triqs_use_norm_as_weight',dt%dmft_triqs_use_norm_as_weight,2,(/0,1/),iout)
1009 0 : cond_string(1)='dmft_solv' ; cond_values(1)=dt%dmft_solv
1010 0 : call chkdpr(0,1,cond_string,cond_values,ierr,'dmft_triqs_det_precision_error',dt%dmft_triqs_det_precision_error,1,zero,iout)
1011 0 : cond_string(1)='dmft_solv' ; cond_values(1)=dt%dmft_solv
1012 0 : call chkdpr(0,1,cond_string,cond_values,ierr,'dmft_triqs_det_precision_warning',dt%dmft_triqs_det_precision_warning,1,zero,iout)
1013 0 : cond_string(1)='dmft_solv' ; cond_values(1)=dt%dmft_solv
1014 0 : call chkdpr(0,1,cond_string,cond_values,ierr,'dmft_triqs_det_precision_error',dt%dmft_triqs_det_precision_error,1,dt%dmft_triqs_det_precision_warning,iout)
1015 0 : cond_string(1)='dmft_solv' ; cond_values(1)=dt%dmft_solv
1016 0 : call chkdpr(0,1,cond_string,cond_values,ierr,'dmft_triqs_imag_threshold',dt%dmft_triqs_imag_threshold,1,zero,iout)
1017 0 : if (dt%dmft_triqs_time_invariance==1) then
1018 0 : cond_string(1)='dmft_triqs_time_invariance' ; cond_values(1)=dt%dmft_triqs_time_invariance
1019 0 : call chkint_eq(0,1,cond_string,cond_values,ierr,'dmft_triqs_measure_density_matrix',dt%dmft_triqs_measure_density_matrix,1,(/1/),iout)
1020 : end if
1021 0 : if (dt%dmft_triqs_measure_density_matrix == 1) then
1022 0 : cond_string(1)='dmft_triqs_measure_density' ; cond_values(1)=dt%dmft_triqs_measure_density_matrix
1023 0 : call chkint_eq(0,1,cond_string,cond_values,ierr,'dmft_triqs_use_norm_as_weight',dt%dmft_triqs_use_norm_as_weight,1,(/1/),iout)
1024 : end if
1025 0 : cond_string(1)='dmft_solv' ; cond_values(1)=dt%dmft_solv
1026 0 : cond_string(2)='dmft_triqs_measure_g_l' ; cond_values(2)=dt%dmft_triqs_measure_g_l
1027 0 : if (dt%dmft_triqs_measure_g_l==0) then
1028 0 : call chkdpr(0,2,cond_string,cond_values,ierr,'dmft_triqs_dlr_wmax',dt%dmft_triqs_dlr_wmax,1,zero,iout)
1029 0 : cond_string(1)='dmft_solv' ; cond_values(1)=dt%dmft_solv
1030 0 : cond_string(2)='dmft_triqs_measure_g_l' ; cond_values(2)=dt%dmft_triqs_measure_g_l
1031 0 : call chkdpr(0,2,cond_string,cond_values,ierr,'dmft_triqs_dlr_epsilon',dt%dmft_triqs_dlr_epsilon,1,zero,iout)
1032 : else
1033 0 : call chkint_ge(0,2,cond_string,cond_values,ierr,'dmft_triqs_n_l',dt%dmft_triqs_n_l,1,iout)
1034 : end if
1035 0 : if (dt%dmft_triqs_off_diag==1) then
1036 0 : cond_string(1)='dmft_triqs_off_diag' ; cond_values(1)=dt%dmft_triqs_off_diag
1037 0 : call chkint_eq(0,1,cond_string,cond_values,ierr,'dmft_triqs_measure_density_matrix',dt%dmft_triqs_measure_density_matrix,1,(/0/),iout)
1038 : end if
1039 0 : if (dt%dmft_triqs_compute_integral==1.and.dt%dmft_triqs_entropy==1) then
1040 0 : cond_string(1)='dmft_triqs_compute_integral' ; cond_values(1)=dt%dmft_triqs_compute_integral
1041 0 : cond_string(2)='dmft_triqs_entropy' ; cond_values(2)=dt%dmft_triqs_entropy
1042 0 : call chkint_eq(0,2,cond_string,cond_values,ierr,'dmft_triqs_measure_density_matrix',dt%dmft_triqs_measure_density_matrix,1,(/1/),iout)
1043 0 : cond_string(1)='dmft_triqs_compute_integral' ; cond_values(1)=dt%dmft_triqs_compute_integral
1044 0 : cond_string(2)='dmft_triqs_entropy' ; cond_values(2)=dt%dmft_triqs_entropy
1045 0 : call chkint_ge(0,2,cond_string,cond_values,ierr,'dmft_triqs_gaussorder',dt%dmft_triqs_gaussorder,0,iout)
1046 0 : cond_string(1)='dmft_triqs_compute_integral' ; cond_values(1)=dt%dmft_triqs_compute_integral
1047 0 : cond_string(2)='dmft_triqs_entropy' ; cond_values(2)=dt%dmft_triqs_entropy
1048 0 : call chkint_ge(0,2,cond_string,cond_values,ierr,'dmft_triqs_nsubdivisions',dt%dmft_triqs_nsubdivisions,1,iout)
1049 : end if
1050 0 : if (dt%dmft_t2g==1) then
1051 0 : cond_string(1)='dmft_t2g' ; cond_values(1)=dt%dmft_t2g
1052 0 : call chkint_eq(0,1,cond_string,cond_values,ierr,'dmft_triqs_basis',dt%dmft_triqs_basis,1,(/0/),iout)
1053 : end if
1054 0 : if (dt%dmft_x2my2d==1) then
1055 0 : cond_string(1)='dmft_x2my2d' ; cond_values(1)=dt%dmft_x2my2d
1056 0 : call chkint_eq(0,1,cond_string,cond_values,ierr,'dmft_triqs_basis',dt%dmft_triqs_basis,1,(/0/),iout)
1057 : end if
1058 : end if
1059 :
1060 : ! dosdeltae
1061 6958 : call chkdpr(0,0,cond_string,cond_values,ierr,'dosdeltae',dt%dosdeltae,1,0.0_dp,iout)
1062 :
1063 : ! dynimage between 0 and 1
1064 14197 : maxidyn=maxval(dt%dynimage(:))
1065 14197 : minidyn=minval(dt%dynimage(:))
1066 6958 : call chkint_ge(0,0,cond_string,cond_values,ierr,'dynimage',minidyn,0,iout)
1067 6958 : call chkint_le(0,0,cond_string,cond_values,ierr,'dynimage',maxidyn,1,iout)
1068 :
1069 : ! ecut
1070 : ! With planewaves, one must use positive ecut
1071 6958 : if(usewvl==0)then
1072 6958 : if (dt%ecut < tol2) then
1073 : write(msg, '(3a)' )&
1074 0 : 'The input keyword "ecut" is compulsory !',ch10,&
1075 0 : 'Action: add a value for "ecut" in the input file.'
1076 0 : ABI_ERROR_NOSTOP(msg, ierr)
1077 : else
1078 6958 : cond_string(1)='usewvl' ; cond_values(1)=usewvl
1079 6958 : call chkdpr(1,1,cond_string,cond_values,ierr,'ecut',dt%ecut,1,tol8,iout)
1080 : end if
1081 : end if
1082 :
1083 : ! pawecutdg (placed here to stop before ngfftdg)
1084 6958 : if (usepaw==1) then
1085 1180 : if(usewvl==0) then
1086 1180 : call chkdpr(1,0,cond_string,cond_values,ierr,'pawecutdg',dt%pawecutdg,1,tol8,iout)
1087 1180 : cond_string(1)='pawecutdg>=ecut' ; cond_values(1)=0
1088 1180 : call chkdpr(1,1,cond_string,cond_values,ierr,'pawecutdg',dt%pawecutdg,1,dt%ecut,iout)
1089 : else
1090 0 : if(dt%pawecutdg > tol8) then
1091 0 : ABI_ERROR('In PAW+WVL do not use pawecutdg')
1092 : end if
1093 : end if
1094 : end if
1095 :
1096 : ! ecuteps
1097 6958 : if (any(optdriver == [RUNL_SCREENING]) )then
1098 148 : call chkdpr(0,0,cond_string,cond_values,ierr,'ecuteps',dt%ecuteps,1,0.0_dp,iout)
1099 148 : if (dt%ecuteps <= 0) then
1100 0 : ABI_ERROR_NOSTOP("ecuteps must be > 0 if optdriver == 3", ierr)
1101 : end if
1102 148 : if(dt%fftgw<20 .and. dt%fftgw/=0)then
1103 12 : if(dt%ecutwfn<dt%ecuteps-tol8)then
1104 : write(msg,'(a,es16.6,a,es16.6,a,6a)')&
1105 0 : 'The values of ecutwfn and ecuteps are ', dt%ecutwfn,' and ',dt%ecuteps,ch10,&
1106 0 : 'With fftgw lower than 20, one expect ecuteps to be smaller or equal to ecutwfn.',ch10,&
1107 0 : 'Indeed, one is wasting memory without gaining CPU time or accuracy.',ch10,&
1108 0 : 'Action: use another value of fftgw (e.g. 21), or adjust ecutwfn with ecuteps.'
1109 0 : ABI_ERROR_NOSTOP(msg, ierr)
1110 : end if
1111 : end if
1112 148 : if (any(dt%gw_icutcoul == [14, 15, 16])) then
1113 0 : msg = "Monte-carlo integration method should not be used when computing the screening. Please change gw_icutcoul."
1114 0 : ABI_ERROR_NOSTOP(msg, ierr)
1115 : end if
1116 : end if
1117 :
1118 : ! ecutsigx
1119 : ! @MG FIXME reinstate this check, after having rewritten FFT treatment in GW
1120 6958 : if( ANY( optdriver == [RUNL_SIGMA] ) .and..FALSE.)then
1121 : call chkdpr(0,0,cond_string,cond_values,ierr,'ecutsigx',dt%ecutsigx,1,0.0_dp,iout)
1122 : if(dt%fftgw<20)then
1123 : if(dt%ecutwfn<dt%ecutsigx-tol8)then
1124 : write(msg,'(a,es16.6,a,es16.6,a,6a)')&
1125 : 'The values of ecutwfn and ecutsigx are ', dt%ecutwfn,' and ',dt%ecutsigx,ch10,&
1126 : 'With fftgw lower than 20, one expect ecutsigx to be smaller or equal to ecutwfn.',ch10,&
1127 : 'Indeed, one is wasting memory without gaining CPU time or accuracy.',ch10,&
1128 : 'Action: use another value of fftgw (e.g. 21), or adjust ecutwfn with ecutsigx.'
1129 : ABI_ERROR_NOSTOP(msg, ierr)
1130 : end if
1131 : end if
1132 : end if
1133 :
1134 6958 : if (optdriver == RUNL_BSE) then
1135 : ! Check for BSE calculations that are not implemented.
1136 29 : if (dt%nspinor == 2) then
1137 0 : ABI_ERROR_NOSTOP("BSE with nspinor 2 not implemented", ierr)
1138 : end if
1139 : end if
1140 :
1141 : ! ecutsigx
1142 :
1143 : ! Check for GW calculations that are not implemented.
1144 6958 : if (ANY(optdriver == [RUNL_SCREENING, RUNL_SIGMA])) then
1145 349 : if (dt%nspinor == 2) then
1146 9 : if (dt%usepaw == 1) then
1147 0 : ABI_ERROR_NOSTOP("GW with PAW and nspinor 2 not implemented", ierr)
1148 : end if
1149 : !if (optdriver == RUNL_SCREENING .and. dt%symchi == 1) then
1150 : ! ABI_ERROR_NOSTOP("Screening with symchi 1 and nspinor 2 not implemented", ierr)
1151 : !end if
1152 : !if (optdriver == RUNL_SIGMA .and. dt%symsigma == 1) then
1153 : ! ABI_ERROR_NOSTOP("Self-energy with symsigma 1 and nspinor 2 not implemented", ierr)
1154 : !end if
1155 7 : if (optdriver == RUNL_SIGMA .and. &
1156 9 : any(mod(dt%gwcalctyp, 10) == [SIG_QPGW_PPM, SIG_QPGW_CD])) then
1157 0 : ABI_ERROR_NOSTOP("model GW with nspinor 2 are not implemented", ierr)
1158 : end if
1159 : !if (optdriver == RUNL_SIGMA .and. mod(dt%gwcalctyp, 100) >= 10) then
1160 : ! ABI_ERROR_NOSTOP("Self-consistent GW with nspinor == 2 not implemented", ierr)
1161 : !end if
1162 9 : if (optdriver == RUNL_SIGMA .and. dt%symsigma > 0 .and. dt%gwcalctyp >= 20) then
1163 0 : ABI_ERROR_NOSTOP("gwcalctyp >= 0 requires symsigma == 0 in input. New default in Abinit9 is symsigma 1!", ierr)
1164 : end if
1165 9 : if (optdriver == RUNL_SIGMA .and. dt%symsigma > 0 .and. dt%ucrpa > 0) then
1166 0 : ABI_ERROR_NOSTOP("ucrpa requires symsigma == 0 in input. New default in Abinit9 is symsigma 1!", ierr)
1167 : end if
1168 9 : if (dt%gwcomp /= 0) then
1169 0 : ABI_ERROR_NOSTOP("gwcomp /= 0 with nspinor 2 not implemented", ierr)
1170 : end if
1171 : end if ! nspinor 2
1172 :
1173 2424 : if (maxval(abs(dt%istwfk(1:nkpt))) > 1 .and. mod(dt%gwcalctyp, 100) >= 20) then
1174 0 : write(msg, "(3a)")"Self-consistent GW with istwfk > 1 not supported.",ch10, &
1175 0 : "Please regenerate your WFK file with istwfk *1"
1176 0 : ABI_ERROR_NOSTOP(msg, ierr)
1177 : end if
1178 :
1179 : ! Avoid wasting CPUs if nsppol==2.
1180 349 : if (dt%nsppol == 2 .and. .not. iseven(nproc) .and. nproc > 1) then
1181 0 : write(msg,'(3a)') "Spin-polarized GW calculations should be run with an even number of processors ",ch10,&
1182 0 : " for achieving an optimal distribution of memory and CPU load. Please change the number of processors."
1183 0 : ABI_ERROR_NOSTOP(msg, ierr)
1184 : end if
1185 : end if
1186 :
1187 : ! ecutsm
1188 6958 : call chkdpr(0,0,cond_string,cond_values,ierr,'ecutsm',dt%ecutsm,1,0.0_dp,iout)
1189 :
1190 : ! With non-zero optcell, one must use non-zero ecutsm
1191 : !if(dt%optcell/=0 )then
1192 : ! cond_string(1)='optcell' ; cond_values(1)=dt%optcell
1193 : ! call chkdpr(1,1,cond_string,cond_values,ierr,'ecutsm',dt%ecutsm,1,tol8,iout)
1194 : !end if
1195 : ! At present (v10.2.2), Chebyshev filtering algorithm (wfoptalg=1 or 111) cannot be used with ecutsm>0.
1196 : ! So we allow ecutsm=0 but with a warning.
1197 6958 : if(dt%optcell/=0 .and. dt%ecutsm < tol8 .and. dt%wfoptalg/=1 .and. dt%wfoptalg/=111) then
1198 3 : write(msg, "(2a)") 'For optcell > 0, it is highly recommended to set ecutsm > 0 to have better precision on stress',&
1199 6 : & ' (available only if wfoptalg is neither 1 nor 111).'
1200 3 : ABI_WARNING(msg)
1201 : end if
1202 :
1203 : ! ecutwfn <= ecut. This is also needed for the correct evaluation
1204 : ! of the Kleynman-Bylander form factors as the spline in Psps% is done with ecut
1205 : ! while we need |q+G| up to ecut. enlargement due to the q is already
1206 : ! taken into account by enlarging the spline mesh by around 20%.
1207 6958 : if ( ANY(optdriver == [RUNL_SCREENING, RUNL_SIGMA, RUNL_BSE]) ) then
1208 378 : call chkdpr(0,0,cond_string,cond_values,ierr,'ecutwfn',dt%ecuteps,1,0.0_dp,iout)
1209 378 : if(dt%ecut<dt%ecutwfn-tol8)then
1210 : write(msg,'(a,es16.6,a,es16.6,a,6a)')&
1211 0 : 'The values of ecut and ecutwfn are ', dt%ecut,' and ',dt%ecutwfn,ch10,&
1212 0 : 'One expects ecutwfn to be smaller or equal to ecut.',ch10,&
1213 0 : 'Action: adjust ecutwfn with ecut.'
1214 0 : ABI_ERROR_NOSTOP(msg, ierr)
1215 : end if
1216 : end if
1217 :
1218 : ! Check variables used to specify k-points in self-energy.
1219 20745 : if (dt%nkptgw /= 0 .and. (any(dt%sigma_erange > tol8 .or. dt%gw_qprange /= 0))) then
1220 0 : ABI_ERROR_NOSTOP("nkptw cannot be used with sigma_erange or gw_qprange", ierr)
1221 : end if
1222 20851 : if (any(dt%sigma_erange > tol8) .and. dt%gw_qprange /= 0) then
1223 0 : ABI_ERROR_NOSTOP("sigma_erange and gw_qprange are mutually exclusive", ierr)
1224 : end if
1225 41721 : if (any(dt%sigma_erange < -tol8) .and. any(dt%sigma_erange > tol8)) then
1226 0 : ABI_ERROR_NOSTOP("Found negative sigma_erange entry (metals) with another positive entry (semiconductors)!", ierr)
1227 : end if
1228 :
1229 : ! effmass_free
1230 6958 : if(abs(dt%effmass_free-one)>tol8.and.dt%ixc/=31.and.dt%ixc/=35.and.xc_is_mgga)then
1231 : write(msg, '(5a)' )&
1232 0 : 'A modified electronic effective mass is not usable with a meta-GGA XC functional!',ch10,&
1233 0 : 'Except with some fake metaGGAs (ixc=31 or ixc=35).',ch10,&
1234 0 : 'effmass should be included in kinetic energy density (tau).'
1235 0 : ABI_ERROR_NOSTOP(msg, ierr)
1236 : end if
1237 :
1238 : ! efmas
1239 6958 : if(optdriver==RUNL_RESPFN) then !.and.usepaw==1)then
1240 716 : cond_string(1)='optdriver' ; cond_values(1)=RUNL_RESPFN
1241 716 : cond_string(2)='usepaw' ; cond_values(2)=dt%usepaw !usepaw
1242 716 : cond_string(3)='ieig2rf' ; cond_values(3)=dt%ieig2rf
1243 716 : cond_string(4)='nsym' ; cond_values(4)=dt%nsym
1244 716 : call chkint_eq(1,4,cond_string,cond_values,ierr,'efmas',dt%efmas,2,(/0,1/),iout)
1245 716 : if (dt%paral_rf==1) then
1246 26 : cond_string(1)='paral_rf' ; cond_values(1)=dt%paral_rf
1247 26 : call chkint_eq(1,1,cond_string,cond_values,ierr,'efmas',dt%efmas,1,(/0/),iout)
1248 : end if
1249 : end if
1250 :
1251 6958 : if (dt%efmas==1) then
1252 : ! Consistency check for efmas calculations.
1253 17 : call chkint_eq(0,0,cond_string,cond_values,ierr,'efmas_calc_dirs',dt%efmas_calc_dirs,7,[-3,-2,-1,0,1,2,3],iout)
1254 :
1255 17 : call chkint_eq(0,0,cond_string,cond_values,ierr,'efmas_deg',dt%efmas_deg,2,[0,1],iout)
1256 :
1257 17 : call chkdpr(0,0,cond_string,cond_values,ierr,'efmas_deg_tol',dt%efmas_deg_tol,1,0.0_dp,iout)
1258 :
1259 17 : call chkint_eq(0,0,cond_string,cond_values,ierr,'efmas_dim',dt%efmas_dim,3,[1,2,3],iout)
1260 :
1261 17 : call chkint_ge(0,0,cond_string,cond_values,ierr,'efmas_n_dirs',dt%efmas_n_dirs,0,iout)
1262 :
1263 17 : call chkint_ge(0,0,cond_string,cond_values,ierr,'efmas_ntheta',dt%efmas_ntheta,1,iout)
1264 :
1265 17 : ABI_CHECK_NOSTOP(all_nprocs == 1, "efmas 1 is not compatible with MPI. Use 1 processor", ierr)
1266 : end if
1267 :
1268 : ! enable_mpi_io
1269 6958 : if(dt%iomode==IO_MODE_MPI) then
1270 28 : cond_string(1)='iomode' ; cond_values(1)=dt%iomode
1271 28 : call chkint_eq(1,1,cond_string,cond_values,ierr,'enable_mpi_io',xmpi_mpiio,1,(/1/),iout)
1272 : end if
1273 :
1274 : ! ========
1275 : ! eph code
1276 : ! ========
1277 6958 : if (optdriver == RUNL_EPH) then
1278 109 : cond_string(1)='optdriver'; cond_values(1)=optdriver
1279 : call chkint_eq(1,1,cond_string,cond_values,ierr,'eph_task',dt%eph_task, &
1280 109 : 28, [0, 1, 2, -2, 3, 4, -4, 5, -5, 6, 7, -7, 8, 9, 10, 11, -12, 13, -13, 14, 15, -15, 16, 17, 18, 19, 20, 24], iout)
1281 :
1282 436 : if (any(dt%ddb_ngqpt <= 0)) then
1283 0 : ABI_ERROR_NOSTOP("ddb_ngqpt must be specified when performing EPH calculations.", ierr)
1284 : end if
1285 :
1286 : ! TODO: Activate this check and update the two EPH tests that started to failed
1287 : ! We need "enough" valence states to compute the mu(T) in semiconductors
1288 : if ((dt%nsppol == 1 .and. dt%nspinor == 1 .and. dt%nband(1) <= zval/two) .or. &
1289 109 : (dt%nsppol == 2 .and. dt%nband(1) <= zval) .or. & ! Magnetic semiconductors are not easy to predict!
1290 : (dt%nspinor == 2 .and. dt%nband(1) <= zval)) then
1291 : !ABI_ERROR_NOSTOP("Please add enough conduction bands (including degenerate states) to compute the Fermi level.", ierr)
1292 3 : ABI_WARNING("Please add enough conduction bands (including degenerate states) to compute the Fermi level.")
1293 : end if
1294 :
1295 109 : if (dt%eph_task == 1 .and. dt%ph_nqpath <= 0) then
1296 0 : ABI_ERROR("When eph_task == 1, the q-path for the linewidth must be specified via ph_nqpath and ph_qpath")
1297 : end if
1298 109 : if (dt%eph_task == 1 .and. dt%nshiftk <= 0) then
1299 0 : ABI_ERROR_NOSTOP('phgamma does not work with multiple k-shifts', ierr)
1300 : end if
1301 109 : if (dt%eph_task == 1 .and. .not. isdiagmat(dt%kptrlatt)) then
1302 0 : ABI_ERROR_NOSTOP("kptrlatt must be diagonal in phgamma.", ierr)
1303 : end if
1304 : if (dt%eph_task == 2 .and. dt%irdwfk == 0 .and. &
1305 109 : dt%getwfk == 0 .and. dt%getwfk_filepath == ABI_NOFILE) then
1306 0 : ABI_ERROR_NOSTOP('Neither getwfk, irdwfk, getwfk_filepath were given in order to compute the gkk', ierr)
1307 : end if
1308 109 : if (any(dt%eph_task == [-5])) then
1309 1 : ABI_CHECK(dt%ph_nqpath > 0, "ph_nqpath must be specified when eph_task == -5")
1310 : end if
1311 :
1312 109 : if (any(dt%eph_task == [18])) then
1313 2 : if (dt%tolwfr == zero) then
1314 0 : ABI_ERROR_NOSTOP("tolwfr must be specified when eph_stern /= 0", ierr)
1315 : end if
1316 2 : if (dt%eph_fix_korq == "k") then
1317 1 : ABI_CHECK(dt%ph_nqpath > 0, "ph_nqpath must be specified when elh_fix_kord = 'k' with eph_task == -5")
1318 : end if
1319 2 : if (dt%eph_fix_korq == "q") then
1320 1 : ABI_CHECK(dt%nkpath > 0, "nkpath and kptbounds must be specified when eph_fix_kord = 'q' with eph_task == -5")
1321 1 : ABI_CHECK(allocated(dt%kptbounds), "kptbounds must be specified when eph_fix_kord = 'q' with eph_task == -5")
1322 : end if
1323 : end if
1324 :
1325 109 : if (dt%eph_task == 13) then
1326 9 : msg = "electron, hole"
1327 9 : if (.not. string_in(dt%vpq_pkind, msg)) then
1328 0 : ABI_ERROR_NOSTOP(sjoin("Invalid vpq_pkind: `", dt%vpq_pkind, "`, must be among:", msg), ierr)
1329 : end if
1330 9 : msg = "polaron, hopping, debug_dw"
1331 9 : if (.not. string_in(dt%vpq_mode, msg)) then
1332 0 : ABI_ERROR_NOSTOP(sjoin("Invalid vpq_mode: `", dt%vpq_mode, "`, must be among:", msg), ierr)
1333 : end if
1334 9 : if (dt%vpq_aseed == "localize" .and. (dt%vpq_atloc < 1 .or. dt%vpq_atloc > dt%natom)) then
1335 0 : ABI_ERROR_NOSTOP(sjoin("vpq_atloc must be from 1 to natom if vpq_aseed = `", dt%vpq_aseed, "`"), ierr)
1336 : end if
1337 : end if
1338 : !if (dt%eph_task == -4 .and. dt%occopt /= 3) then
1339 : ! ABI_ERROR_NOSTOP("eph_task -4 requires occopt 3 in the input file (Fermi-Dirac with physical Temperature!", ierr)
1340 : !end if
1341 109 : if (dt%eph_fermie /= zero .and. nint(dt%tmesh(3)) /= 1) then
1342 0 : ABI_ERROR_NOSTOP("eph_fermie does not support multiple temperatures in tmesh !", ierr)
1343 : end if
1344 109 : if (dt%eph_fermie /= zero .and. dt%eph_extrael /= zero) then
1345 0 : ABI_ERROR_NOSTOP("eph_fermie and (eph_extrael|eph_doping) are mutually exclusive", ierr)
1346 : end if
1347 :
1348 109 : cond_string(1)='optdriver' ; cond_values(1)=optdriver
1349 109 : call chkint_eq(1,1,cond_string,cond_values,ierr,'eph_frohlichm',dt%eph_frohlichm,2,[0,1],iout)
1350 :
1351 109 : if (dt%eph_stern /= 0) then
1352 : ! Check requirements for Sternheimer.
1353 25 : if (dt%tolwfr == zero) then
1354 0 : ABI_ERROR_NOSTOP("tolwfr must be specified when eph_stern /= 0", ierr)
1355 : end if
1356 25 : if (dt%getpot_filepath == ABI_NOFILE) then
1357 0 : ABI_ERROR_NOSTOP("getpot_filepath is required when eph_stern /= 0", ierr)
1358 : end if
1359 25 : if (all(dt%sigma_bsum_range /= 0)) then
1360 0 : ABI_ERROR_NOSTOP("sigma_bsum_range cannot be used when eph_stern /= 0", ierr)
1361 : end if
1362 : end if
1363 :
1364 418 : if (dt%ibte_prep /= 0 .and. any(dt%sigma_ngkpt /= 0)) then
1365 0 : ABI_ERROR_NOSTOP("sigma_ngkpt cannot be used to downsample the k-mesh when ibte_prep is used.", ierr)
1366 : end if
1367 :
1368 : ! Additional checks for GWPT
1369 109 : if (dt%eph_task == 17) then
1370 3 : call chkdpr(0,0,cond_string,cond_values,ierr,'ecuteps',dt%ecuteps,1,0.0_dp,iout)
1371 3 : if (dt%ecuteps <= 0) then
1372 0 : ABI_ERROR_NOSTOP("ecuteps must be specified if GWPT is activated", ierr)
1373 : end if
1374 3 : if (dt%ecutsigx <= 0) then
1375 0 : ABI_ERROR_NOSTOP("ecutsigx must be specified if GWPT is activated", ierr)
1376 : end if
1377 3 : if (any(dt%ppmodel == [3, 4])) then
1378 0 : ABI_ERROR_NOSTOP("GWPT does not support ppmodel 3 or 4", ierr)
1379 : end if
1380 : end if
1381 :
1382 109 : if (dt%eph_task == 18) then
1383 : ! Compute e-ph matrix elements along q-path.
1384 2 : if (dt%nbdbuf == 0) then
1385 0 : msg = "nbdbuf > 0 is required for NSCF. Adjust nband and nbdbuf to converge only the bands of interests"
1386 0 : ABI_ERROR_NOSTOP(msg, ierr)
1387 : end if
1388 : end if
1389 :
1390 : end if ! RUNL_EPH
1391 :
1392 41748 : if (any(dt%eph_np_pqbks /= 0)) then
1393 : ! Perform basic consistency check for MPI grid.
1394 : ! (q-points and k-points will be computed at runtime so cannot perform checks at this level.
1395 0 : if (product(dt%eph_np_pqbks) /= all_nprocs) then
1396 : write(msg, "(a,i0,3a, 6(a,1x,i0))") &
1397 0 : "Cannot create 5d Cartesian grid with nprocs: ", all_nprocs, ch10, &
1398 0 : "Idle processes are not supported. The product of the `nproc_*` vars should be equal to nproc.", ch10, &
1399 0 : "nprocs_pert (", dt%eph_np_pqbks(1), ") x nprocs_qpt (", dt%eph_np_pqbks(2), &
1400 0 : ") x nprocs_bsum (", dt%eph_np_pqbks(3), ") x nprocs_kcalc (", dt%eph_np_pqbks(4), &
1401 0 : ") x nprocs_spin (", dt%eph_np_pqbks(5), ") != ", all_nprocs
1402 0 : ABI_ERROR_NOSTOP(msg, ierr)
1403 : end if
1404 :
1405 : ! Check spin
1406 0 : if (all(dt%eph_np_pqbks(5) /= [0, 1])) then
1407 0 : if (dt%nspinor == 2) then
1408 0 : ABI_ERROR_NOSTOP("Spin parallelism cannot be used when nspinor == 2", ierr)
1409 0 : else if (dt%nspinor == 1 .and. dt%eph_np_pqbks(5) > dt%nsppol) then
1410 0 : ABI_ERROR_NOSTOP("nproc for spin parallelism cannot be greater than nsppol", ierr)
1411 : end if
1412 : end if
1413 :
1414 0 : if (dt%eph_np_pqbks(1) /= 0 .and. dt%eph_np_pqbks(1) > 3 * dt%natom ) then
1415 0 : ABI_ERROR_NOSTOP("nproc for pert parallelism cannot be greater than 3 * natom", ierr)
1416 : end if
1417 :
1418 0 : if (mod(3 * dt%natom, dt%eph_np_pqbks(1)) /= 0) then
1419 0 : ABI_ERROR_NOSTOP("nproc for pert parallelism must divide 3 * natom.", ierr)
1420 : end if
1421 :
1422 : #ifndef HAVE_NETCDF_MPI
1423 : if (abs(dt%eph_task) == 4 .and. (dt%eph_np_pqbks(4) /= 1 .or. dt%eph_np_pqbks(5) /= 1)) then
1424 : ABI_ERROR_NOSTOP("k-point and/or spin parallelism in EPH code requires Netcdf4 with MPI-IO support!", ierr)
1425 : end if
1426 : #endif
1427 : end if
1428 :
1429 : ! exchmix
1430 6958 : call chkdpr(0,0,cond_string,cond_values,ierr,'exchmix',dt%exchmix,1,0.0_dp,iout)
1431 :
1432 : ! extrapwf
1433 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'extrapwf',dt%extrapwf,3, [0,1,2], iout)
1434 6958 : if (dt%extrapwf>0.and.dt%densfor_pred<5) then
1435 : write(msg,'(3a)')&
1436 0 : 'extrapwf keyword (extrapolation of WF) is only compatible with',ch10,&
1437 0 : 'densfor_pred=5 or 6; please change densfor_pred value.'
1438 0 : ABI_ERROR_NOSTOP(msg,ierr)
1439 : ! MT oct 14: Should use chkint_eq but the msg is not clear enough
1440 : end if
1441 :
1442 : ! expert_user
1443 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'expert_user',dt%expert_user,4, [0,1,2,3],iout)
1444 :
1445 : ! fermie_nest
1446 6958 : call chkdpr(0,0,cond_string,cond_values,ierr,'fermie_nest',dt%fermie_nest,1,0.0_dp,iout)
1447 :
1448 : ! ffnl_lw
1449 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'ffnl_lw',dt%ffnl_lw,2,(/0,1/),iout)
1450 :
1451 : ! fftgw
1452 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'fftgw',dt%fftgw,8, [00,01,10,11,20,21,30,31],iout)
1453 :
1454 : ! fockoptmix
1455 : call chkint_eq(0,0,cond_string,cond_values,ierr,'fockoptmix',&
1456 6958 : dt%fockoptmix,12,[0,1,11,201,211,301,401,501,601,701,801,901],iout)
1457 :
1458 6958 : if (dt%paral_kgb/=0) then
1459 624 : cond_string(1)='paral_kgb' ; cond_values(1)=dt%paral_kgb
1460 : ! Make sure that dt%fockoptmix is 0, 1 or 11 (wfmixalg==0)
1461 624 : call chkint_eq(1,1,cond_string,cond_values,ierr,'fockoptmix',dt%fockoptmix,3,(/0,1,11/),iout)
1462 : end if
1463 :
1464 : ! fock_icutcoul ! FBruneval: I have forbidden values 1, 2, 4 since they are buggy
1465 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'fock_icutcoul',dt%fock_icutcoul,3,[0,3,5],iout)
1466 :
1467 : ! frzfermi
1468 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'frzfermi',dt%frzfermi,2,[0,1],iout)
1469 :
1470 : ! fxcartfactor
1471 6958 : call chkdpr(0,0,cond_string,cond_values,ierr,'fxcartfactor',dt%fxcartfactor,1,zero,iout)
1472 :
1473 : ! ga_algor
1474 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'ga_algor',dt%ga_algor,3,[1,2,3],iout)
1475 :
1476 : ! ga_fitness
1477 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'ga_fitness',dt%ga_fitness,3,[1,2,3],iout)
1478 :
1479 : ! ga_opt_percent
1480 6958 : call chkdpr(0,0,cond_string,cond_values,ierr,'ga_opt_percent',dt%ga_opt_percent,1,tol8,iout)
1481 :
1482 : ! getxred
1483 6958 : if(dt%getxcart/=0)then
1484 30 : cond_string(1)='getxcart' ; cond_values(1)=dt%getxcart
1485 : ! Make sure that dt%getxred is 0. NB: this has already been checked elsewhere:
1486 : ! that only one of xred xcart xrandom getxred getxcart are set
1487 30 : call chkint_eq(1,1,cond_string,cond_values,ierr,'getxred',dt%getxred,1,[0],iout)
1488 : end if
1489 :
1490 : ! goprecon
1491 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'goprecon',dt%goprecon,4,[0,1,2,3],iout)
1492 :
1493 : ! gpu_devices
1494 6958 : if (dt%gpu_option/=ABI_GPU_DISABLED) then
1495 0 : if (all(gpu_devices(:)==-2)) then
1496 0 : gpu_devices(:)=dt%gpu_devices(:)
1497 0 : else if (any(dt%gpu_devices(:)/=gpu_devices(:))) then
1498 : write(msg,'(3a)')&
1499 0 : 'GPU device(s) selection cannot be different from one dataset to another!',ch10,&
1500 0 : 'Action: change gpu_devices in input file.'
1501 0 : ABI_ERROR_NOSTOP(msg, ierr)
1502 : end if
1503 : end if
1504 :
1505 : ! gpu_nfft_blocks
1506 6958 : call chkint_ge(0,0,cond_string,cond_values,ierr,'gpu_nfft_blocks',dt%gpu_nfft_blocks,0,iout)
1507 6958 : if (dt%gpu_option/=ABI_GPU_OPENMP .and. dt%gpu_nfft_blocks/=0) then
1508 0 : ABI_WARNING('gpu_nfft_blocks is ignored outside of OpenMP GPU (gpu_option 2)!')
1509 : end if
1510 :
1511 : ! gpu_kokkos_nthrd
1512 6958 : call chkint_ge(0,0,cond_string,cond_values,ierr,'gpu_kokkos_nthrd',dt%gpu_kokkos_nthrd,1,iout)
1513 :
1514 : ! gpu_nl_distrib
1515 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'gpu_nl_distrib',dt%gpu_nl_distrib,2,(/0,1/),iout)
1516 6958 : if (dt%gpu_option/=ABI_GPU_OPENMP .and. dt%gpu_nl_distrib==1) then
1517 0 : ABI_WARNING('gpu_nl_distrib is ignored outside of OpenMP GPU (gpu_option 2)!')
1518 : end if
1519 :
1520 : ! gpu_nl_splitsize
1521 6958 : call chkint_ge(0,0,cond_string,cond_values,ierr,'gpu_nl_splitsize',dt%gpu_nl_splitsize,0,iout)
1522 6958 : if (dt%gpu_option/=ABI_GPU_OPENMP .and. dt%gpu_nl_splitsize/=0) then
1523 0 : ABI_WARNING('gpu_nl_splitsize is ignored outside of OpenMP GPU (gpu_option 2)!')
1524 : end if
1525 :
1526 : ! gpu_option
1527 : call chkint_eq(0,0,cond_string,cond_values,ierr,'gpu_option',dt%gpu_option,4, &
1528 6958 : & (/ABI_GPU_DISABLED,ABI_GPU_LEGACY,ABI_GPU_OPENMP,ABI_GPU_KOKKOS/),iout)
1529 6958 : if (dt%gpu_option/=ABI_GPU_DISABLED) then
1530 : ! if (dt%nspinor==2) then
1531 : ! write(msg,'(3a)')&
1532 : !& 'Use of GPU is not allowed when nspinor==2 !',ch10,&
1533 : !& 'Action: impose gpu_option=0 in your input file.'
1534 : ! ABI_ERROR_NOSTOP(msg, ierr)
1535 : ! end if
1536 : ! if (dt%optdriver==RUNL_GSTATE.and.mod(dt%wfoptalg,10)/=4) then
1537 : ! write(msg,'(6a)') ch10,&
1538 : ! & ' chkinp: ERROR -',ch10,&
1539 : ! & ' When GPU is in use (gpu_option>0), wfoptalg must be 4 or 14 !',ch10,&
1540 : ! & ' Action: change wfoptalg in your input file.'
1541 : ! call wrtout(std_out,msg)
1542 : ! ierr=ierr+1
1543 : ! end if
1544 0 : if (dt%useylm == 0 .and. dt%optdriver /= RUNL_GWR) then
1545 : write(msg,'(3a)')&
1546 0 : 'Use of GPU is not allowed when useylm==0 !',ch10,&
1547 0 : 'Action: impose useylm=1 in your input file.'
1548 0 : ABI_ERROR_NOSTOP(msg, ierr)
1549 : end if
1550 0 : if (dt%tfkinfunc>0) then
1551 : write(msg,'(5a)')&
1552 0 : 'gpu_option/=0 (use of GPU) is not allowed when tfkinfunc>0 !',ch10,&
1553 0 : 'Action: suppress gpu_option from your input file',ch10,&
1554 0 : ' (GPU will be used but with another mechanism)'
1555 0 : ABI_ERROR_NOSTOP(msg, ierr)
1556 : end if
1557 0 : if (dt%ngfft(4)/=dt%ngfft(1).or.dt%ngfft(5)/=dt%ngfft(2).or.dt%ngfft(6)/=dt%ngfft(3)) then
1558 : write(msg,'(3a)')&
1559 0 : 'When GPU is in use (gpu_option/=0), ngfft(4:6) must be equal to ngfft(1:3) !',ch10,&
1560 0 : 'Action: suppress ngfft in input file or change it.'
1561 0 : ABI_ERROR_NOSTOP(msg, ierr)
1562 : end if
1563 : #ifndef HAVE_GPU
1564 0 : write(msg,'(6a)') ch10,&
1565 0 : ' invars0: ERROR -',ch10,&
1566 0 : ' Input variable gpu_option is on but abinit hasn''t been built with GPU mode enabled !',ch10,&
1567 0 : ' Action: suppress the input variable gpu_option or re-compile ABINIT with GPU enabled.'
1568 0 : call wrtout(std_out,msg)
1569 0 : ierr=ierr+1
1570 : #endif
1571 : !#ifndef HAVE_GPU_CUDA_DP
1572 : ! write(msg,'(10a)') ch10,&
1573 : !& ' invars0: ERROR -',ch10,&
1574 : !& ' Input variable gpu_option is on but abinit hasn''t been built',ch10,&
1575 : !& ' with GPU mode in DOUBLE PRECISION enabled !',ch10,&
1576 : !& ' Action: suppress input variable gpu_option',ch10,&
1577 : !& ' or re-compile ABINIT with double precision GPU enabled.'
1578 : ! call wrtout(std_out,msg)
1579 : ! ierr=ierr+1
1580 : !#endif
1581 : end if
1582 :
1583 : ! gpu_thread_limit
1584 6958 : call chkint_ge(0,0,cond_string,cond_values,ierr,'gpu_thread_limit',dt%gpu_thread_limit,0,iout)
1585 :
1586 : ! RT-TDDFT
1587 6958 : if (dt%optdriver == RUNL_RTTDDFT) then
1588 : ! getwfk / getwfk_filepath / irdwfk
1589 50 : if (dt%getwfk == 0 .and. dt%irdwfk == 0 .and. dt%getwfk_filepath==ABI_NOFILE .and. dt%td_restart==0) then
1590 : write(msg, '(3a)' ) &
1591 0 : 'Initial KS orbitals need to be read in WFK file for RT-TDDFT runs!',ch10,&
1592 0 : 'Action: set irdwfk or getwfk /= 0 or specify the WFK filename using getwfk_filepath.'
1593 0 : ABI_ERROR_NOSTOP(msg, ierr)
1594 : endif
1595 : ! usewvl
1596 50 : if (dt%usewvl /= 0) then
1597 0 : ABI_ERROR_NOSTOP('RT-TDDFT and wavelets are not compatible, set usewvl to 0.', ierr)
1598 : endif
1599 : ! nimage
1600 50 : if (dt%nimage > 1) then
1601 0 : ABI_ERROR_NOSTOP('RT-TDDFT and multiple images are not compatible, set nimage to 1.', ierr)
1602 : endif
1603 : ! tfkinfunc
1604 50 : if (dt%tfkinfunc == 2) then
1605 0 : ABI_ERROR_NOSTOP('RT-TDDFT and Thomas-Fermi functionals are not compatible, set tfkinfunc to 0.', ierr)
1606 : endif
1607 : ! positron
1608 50 : if (dt%positron /= 0) then
1609 0 : ABI_ERROR_NOSTOP('RT-TDDFT and Positron are not compatible, set positron to 0.', ierr)
1610 : endif
1611 : ! usefock
1612 50 : if (dt%usefock==1) then
1613 0 : ABI_ERROR_NOSTOP('RT-TDDFT and Exact exchange are not compatible, set usefock to 0.', ierr)
1614 : end if
1615 : ! usedmft
1616 50 : if (dt%usedmft /= 0) then
1617 0 : ABI_ERROR_NOSTOP('RT-TDDFT and DMFT are not compatible, set usedmft to 0.', ierr)
1618 : endif
1619 : ! usepawu
1620 50 : if (dt%usepawu /= 0) then
1621 0 : ABI_ERROR_NOSTOP('RT-TDDFT with DFT+U has not been tested yet, set usepawu to 0.', ierr)
1622 : endif
1623 : ! usekden
1624 50 : if (xc_is_mgga) then
1625 0 : ABI_ERROR_NOSTOP('RT-TDDFT with mGGA has not been tested yet and is thus not available.', ierr)
1626 : end if
1627 : ! vdw_xc
1628 50 : if (dt%vdw_xc /= 0) then
1629 0 : ABI_ERROR_NOSTOP('RT-TDDFT with VDW corrected functionals has not been tested yet, set vdw_xc to 0.', ierr)
1630 : endif
1631 : ! ecutsm
1632 50 : if (dt%ecutsm > 0.0) then
1633 0 : ABI_ERROR_NOSTOP('RT-TDDFT is not compatible with ecutsm, set ecutsm to 0.', ierr)
1634 : end if
1635 : !TODO FB: Should probably be made possible later
1636 : ! useextfpmd
1637 50 : if (dt%useextfpmd /= 0) then
1638 0 : write(msg,'(a)') 'RT-TDDFT and extFPMD has not been tested yet, set useextfpmd to 0.'
1639 0 : ABI_ERROR_NOSTOP(msg, ierr)
1640 : endif
1641 : ! Magnetic case and spin-orbit
1642 : ! nsspol, nspden, spinor
1643 50 : if (dt%nsppol /= 1 .or. dt%nspden /= 1 .or. dt%nspinor /=1) then
1644 : write(msg,'(a)') 'RT-TDDFT has not been tested yet for magnetic cases nor with spin-orbit coupling, &
1645 0 : & set nsppol, nspden and nspinor to 1.'
1646 0 : ABI_ERROR_NOSTOP(msg, ierr)
1647 : endif
1648 : endif
1649 :
1650 : ! gw_invalid_freq
1651 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'gw_invalid_freq',dt%gw_invalid_freq,3,[0,1,2],iout)
1652 :
1653 : ! gw_icutcoul
1654 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'gw_icutcoul',dt%gw_icutcoul,11,[0,1,2,3,4,5,6,7,14,15,16],iout)
1655 :
1656 : ! gw_sigxcore
1657 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'gw_sigxcore',dt%gw_sigxcore,2,[0,1],iout)
1658 :
1659 : ! gwcomp
1660 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'gwcomp',dt%gwcomp,3,[0,1,2],iout)
1661 :
1662 6958 : if (dt%gwcomp/=0) then
1663 40 : if (optdriver==RUNL_SCREENING .and. (dt%awtr /=1 .or. dt%spmeth /=0)) then
1664 : write(msg,'(3a)' )&
1665 0 : 'When gwcomp /= 0, the Adler-Wiser formula with time-reversal should be used',ch10,&
1666 0 : 'Action: set awtr to 1 or/and spmeth to 0'
1667 0 : ABI_ERROR_NOSTOP(msg, ierr)
1668 : end if
1669 :
1670 : ! Extrapolar trick with HF, SEX and COHSEX is meaningless for Sigma
1671 40 : if(optdriver == RUNL_SIGMA) then
1672 19 : mod10=MOD(dt%gwcalctyp,10)
1673 19 : if ( ANY(mod10 == [SIG_HF, SIG_SEX, SIG_COHSEX]) ) then
1674 : write(msg,'(3a)' )&
1675 0 : 'gwcomp/=0, is meaningless in the case of HF, SEX or COHSEX calculations. ',ch10,&
1676 0 : 'Action: set gwcomp to 0 or change gwcalctyp'
1677 0 : ABI_ERROR_NOSTOP(msg, ierr)
1678 : end if
1679 : end if
1680 40 : if (optdriver==RUNL_SIGMA .and. ALL( dt%ppmodel /= [0,1,2] )) then
1681 : write(msg,'(a,i0,a)')&
1682 0 : 'The completeness trick cannot be used when ppmodel is ',dt%ppmodel,'. It should be set to 0, 1 or 2. '
1683 0 : ABI_ERROR_NOSTOP(msg, ierr)
1684 : end if
1685 : end if
1686 :
1687 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'gwmem',dt%gwmem,4,[0,1,10,11],iout)
1688 :
1689 : ! gwpara
1690 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'gwpara',dt%gwpara,3,[0,1,2],iout)
1691 :
1692 : ! gwrpacorr
1693 6958 : if(dt%gwrpacorr>0) then
1694 5 : mod10=MOD(dt%gwcalctyp,10)
1695 5 : if (optdriver /= RUNL_SCREENING) then
1696 : write(msg,'(3a)' )&
1697 0 : 'gwrpacorr>0 can only be used when calculating the screening',ch10,&
1698 0 : 'Action: set gwrpacorr to 0 or optdriver to 3'
1699 0 : ABI_ERROR_NOSTOP(msg, ierr)
1700 : end if
1701 5 : if( mod10 /= SIG_GW_AC ) then
1702 : write(msg,'(3a)' )&
1703 0 : 'gwrpacorr > 0 can only be used with purely imaginary frequencies',ch10,&
1704 0 : 'Action: set gwrpacorr to 0 or change gwcalctyp'
1705 0 : ABI_ERROR_NOSTOP(msg, ierr)
1706 : end if
1707 : end if
1708 : ! gwgmcorr
1709 6958 : if(dt%gwgmcorr==1 .and. dt%gwrpacorr==0) then
1710 : write(msg,'(3a)' )&
1711 0 : 'gwgmcorr=1 can only be used with gwrpacorr/=0',ch10,&
1712 0 : 'Action: set gwgmcorr to 0 or gwrpacorr > 0'
1713 0 : ABI_ERROR_NOSTOP(msg, ierr)
1714 : end if
1715 :
1716 : ! gwls_stern_kmax
1717 6958 : call chkint_ge(0,0,cond_string,cond_values,ierr,'gwls_stern_kmax',dt%gwls_stern_kmax,1,iout)
1718 :
1719 : ! gwls_npt_gauss_quad
1720 6958 : call chkint_ge(0,0,cond_string,cond_values,ierr,'gwls_npt_gauss_quad',dt%gwls_npt_gauss_quad,1,iout)
1721 :
1722 : ! gwls_diel_model
1723 6958 : call chkint_ge(0,0,cond_string,cond_values,ierr,'gwls_diel_model',dt%gwls_diel_model,1,iout)
1724 6958 : call chkint_le(0,0,cond_string,cond_values,ierr,'gwls_diel_model',dt%gwls_diel_model,3,iout)
1725 :
1726 : ! gwls_model_parameter
1727 6958 : call chkdpr(0,0,cond_string,cond_values,ierr,'gwls_model_parameter',dt%gwls_model_parameter,1,zero,iout)
1728 :
1729 : ! gwls_print_debug
1730 6958 : call chkint_ge(0,0,cond_string,cond_values,ierr,'gwls_print_debug',dt%gwls_print_debug,0,iout)
1731 :
1732 : ! gwls_nseeds
1733 6958 : call chkint_ge(0,0,cond_string,cond_values,ierr,'gwls_nseeds',dt%gwls_nseeds,1,iout)
1734 :
1735 : ! gwls_kmax_complement
1736 6958 : call chkint_ge(0,0,cond_string,cond_values,ierr,'gwls_kmax_complement',dt%gwls_kmax_complement,0,iout)
1737 :
1738 : ! gwls_kmax_poles
1739 6958 : call chkint_ge(0,0,cond_string,cond_values,ierr,'gwls_kmax_poles',dt%gwls_kmax_poles,0,iout)
1740 :
1741 : ! gwls_kmax_analytic
1742 6958 : call chkint_ge(0,0,cond_string,cond_values,ierr,'gwls_kmax_analytic',dt%gwls_kmax_analytic,0,iout)
1743 :
1744 : ! gwls_kmax_numeric
1745 6958 : call chkint_ge(0,0,cond_string,cond_values,ierr,'gwls_kmax_numeric',dt%gwls_kmax_numeric,0,iout)
1746 :
1747 : ! gwls_band_index
1748 6958 : call chkint_ge(0,0,cond_string,cond_values,ierr,'gwls_band_index',dt%gwls_band_index,1,iout)
1749 :
1750 : ! gwls_exchange
1751 6958 : call chkint_ge(0,0,cond_string,cond_values,ierr,'gwls_exchange',dt%gwls_exchange,0,iout)
1752 :
1753 : ! gwls_correlation
1754 6958 : call chkint_ge(0,0,cond_string,cond_values,ierr,'gwls_correlation',dt%gwls_correlation,0,iout)
1755 :
1756 : ! gwls_first_seed
1757 6958 : call chkint_ge(0,0,cond_string,cond_values,ierr,'gwls_first_seed',dt%gwls_first_seed,1,iout)
1758 :
1759 : ! gwls_recycle
1760 6958 : call chkint_ge(0,0,cond_string,cond_values,ierr,'gwls_recycle',dt%gwls_recycle,0,iout)
1761 6958 : call chkint_le(0,0,cond_string,cond_values,ierr,'gwls_recycle',dt%gwls_recycle,2,iout)
1762 :
1763 : ! iatsph must between 1 and natom
1764 44888 : maxiatsph=maxval(dt%iatsph(1:dt%natsph))
1765 44888 : miniatsph=minval(dt%iatsph(1:dt%natsph))
1766 6958 : call chkint_ge(0,0,cond_string,cond_values,ierr,'iatsph',miniatsph,1,iout)
1767 6958 : call chkint_le(0,0,cond_string,cond_values,ierr,'iatsph',maxiatsph,natom,iout)
1768 :
1769 : ! icoulomb
1770 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'icoulomb',dt%icoulomb,3,[0,1,2],iout)
1771 6958 : if (dt%nspden > 2) then
1772 174 : cond_string(1)='nspden' ; cond_values(1)=nspden
1773 174 : call chkint_eq(1,1,cond_string,cond_values,ierr,'icoulomb',dt%icoulomb,1,[0],iout)
1774 : end if
1775 :
1776 : ! icutcoul
1777 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'icutcoul',dt%icutcoul,13,[0,1,2,3,4,5,6,7,14,15,16,22,55],iout)
1778 :
1779 6958 : if(optdriver/=RUNL_RESPFN.and.dt%icutcoul==55)then
1780 : write(msg, '(3a)' ) &
1781 0 : 'The PCM short-circuit Coulomb cutoff is only available for linear-esponse calculations',ch10,&
1782 0 : 'Action: set icutcoul /= 55 .'
1783 0 : ABI_ERROR_NOSTOP(msg, ierr)
1784 : end if
1785 :
1786 : ! ieig2rf
1787 6958 : if(optdriver==RUNL_RESPFN.and.usepaw==1)then
1788 112 : cond_string(1)='optdriver' ; cond_values(1)=optdriver
1789 112 : cond_string(2)='usepaw' ; cond_values(2)=usepaw
1790 112 : call chkint_eq(1,2,cond_string,cond_values,ierr,'ieig2rf',dt%ieig2rf,1,[0],iout)
1791 : end if
1792 6958 : if(optdriver==RUNL_RESPFN.and.dt%paral_rf==1)then
1793 26 : cond_string(1)='paral_rf' ; cond_values(1)=dt%paral_rf
1794 26 : call chkint_eq(1,1,cond_string,cond_values,ierr,'ieig2rf',dt%ieig2rf,1,[0],iout)
1795 : end if
1796 :
1797 : ! imgmov
1798 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'imgmov',dt%imgmov,9,(/0,1,2,4,5,6,9,10,13/),iout)
1799 6958 : if (dt%imgmov>0 .and. dt%imgmov/=6) then ! when imgmov>0, except imgmov==6, allow only ionmov=0 and optcell=0
1800 37 : cond_string(1)='imgmov' ; cond_values(1)=dt%imgmov
1801 37 : call chkint_eq(1,1,cond_string,cond_values,ierr,'ionmov',dt%ionmov,1,(/0/),iout)
1802 37 : cond_string(1)='imgmov' ; cond_values(1)=dt%imgmov
1803 37 : call chkint_eq(1,1,cond_string,cond_values,ierr,'optcell',dt%optcell,1,(/0/),iout)
1804 : end if
1805 :
1806 : ! imgwfstor
1807 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'imgwfstor',dt%imgwfstor,2,(/0,1/),iout)
1808 6958 : if (dt%extrapwf/=0) then ! extrapwf/=0 not allowed presently with imgwfstor
1809 1 : cond_string(1)='extrapwf' ; cond_values(1)=dt%extrapwf
1810 1 : call chkint_eq(1,1,cond_string,cond_values,ierr,'imgwfstor',dt%imgwfstor,1,(/0/),iout)
1811 : endif
1812 6958 : if (dt%ntimimage<=1) then ! imgwfstor activate only when there is more than one time step for images
1813 6915 : cond_string(1)='ntimimage' ; cond_values(1)=dt%ntimimage
1814 6915 : call chkint_eq(1,1,cond_string,cond_values,ierr,'imgwfstor',dt%imgwfstor,1,(/0/),iout)
1815 : endif
1816 :
1817 : ! inclvkb
1818 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'inclvkb',dt%inclvkb,2,(/0,2/),iout)
1819 :
1820 : ! intxc
1821 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'intxc',dt%intxc,2,(/0,1/),iout)
1822 6958 : if(dt%iscf==-1)then
1823 22 : cond_string(1)='iscf' ; cond_values(1)=dt%iscf
1824 : ! Make sure that dt%intxc is 0
1825 22 : call chkint_eq(1,1,cond_string,cond_values,ierr,'intxc',dt%intxc,1,(/0/),iout)
1826 : end if
1827 : ! TEMPORARY
1828 6958 : if(optdriver==RUNL_RESPFN)then ! Make sure that dt%intxc is 0
1829 716 : cond_string(1)='optdriver' ; cond_values(1)=optdriver
1830 716 : call chkint_eq(1,1,cond_string,cond_values,ierr,'intxc',dt%intxc,1,(/0/),iout)
1831 : end if
1832 :
1833 : ! ionmov
1834 : call chkint_eq(0,0,cond_string,cond_values,ierr,'ionmov',&
1835 6958 : dt%ionmov,25, [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,20,21,22,23,24,25,26,28],iout)
1836 :
1837 : ! When optcell/=0, ionmov must be 2, 3, 13, 22 or 25, 28 (except if imgmov>0)
1838 6958 : if(dt%optcell/=0)then
1839 97 : if (dt%imgmov==0) then
1840 97 : cond_string(1)='optcell' ; cond_values(1)=dt%optcell
1841 97 : call chkint_eq(1,1,cond_string,cond_values,ierr,'ionmov',dt%ionmov,8,[2,3,13,15,16,22,25,28],iout)
1842 : else
1843 0 : cond_string(1)='optcell' ; cond_values(1)=dt%optcell
1844 0 : call chkint_eq(1,1,cond_string,cond_values,ierr,'ionmov',dt%ionmov,1,(/0/),iout)
1845 : end if
1846 : end if
1847 6958 : if (dt%ionmov == 13) then
1848 5 : cond_string(1)='ionmov' ; cond_values(1)=dt%ionmov
1849 : ! Make sure that nnos is not null
1850 5 : call chkint_ge(1,1,cond_string,cond_values,ierr,'nnos',dt%nnos,1,iout)
1851 : end if
1852 :
1853 : ! iprcel
1854 6958 : call chkint(0,0,cond_string,cond_values,ierr,'iprcel',dt%iprcel,1,(/0/),1,21,iout)
1855 : if(nsppol==2 .and. (dt%occopt>=3 .and. dt%occopt<=9).and.mod(dt%iprcel,10)>49 )then
1856 : write(msg,'(5a)')&
1857 : 'For spin-polarized metallic systems (occopt>3),',ch10,&
1858 : 'only RPA dielectric matrix can be evaluated) !',ch10,&
1859 : 'Action: change iprcel value in input file (mod(iprcel,100)<50) !'
1860 : ABI_ERROR_NOSTOP(msg, ierr)
1861 : end if
1862 6958 : if(dt%npspinor>1.and.dt%iprcel>0)then
1863 : write(msg,'(5a)')&
1864 0 : 'When parallelization over spinorial components is activated (npspinor>1),',ch10,&
1865 0 : 'only model dielectric function is allowed (iprcel=0) !',ch10,&
1866 0 : 'Action: change iprcel value in input file !'
1867 0 : ABI_ERROR_NOSTOP(msg, ierr)
1868 : end if
1869 6958 : if(dt%iprcel>=200 .and. dt%iprcel<300) then
1870 :
1871 2 : cond_string(1)='iprcel' ; cond_values(1)=dt%iprcel
1872 : !Implemented models for chi0-based preconditioning are 200, 201, 202, [203, 210, 211, 212, 299]
1873 2 : call chkint_eq(1, 1, cond_string, cond_values(1), ierr, 'iprcel', dt%iprcel, 8, [200, 201, 202, 203, 210, 211, 212, 299], iout)
1874 : !chi0-based preconditioning (iprcel=2**) incompatible with fft-grid parallelization.
1875 2 : call chkint_eq(1, 1, cond_string, cond_values, ierr, 'npfft', dt%npfft, 1, [1], iout)
1876 : !chi0-based preconditioning (iprcel=2**) needs a smooth smearing.
1877 2 : call chkint_eq(1, 1, cond_string, cond_values, ierr, 'occopt', dt%occopt, 5, [3, 4, 5, 6, 7], iout)
1878 : !chi0-based preconditioning (iprcel=2**) only implemented on the fine grid (PAW).
1879 2 : if (usepaw==1) then
1880 0 : call chkint_eq(1, 1, cond_string, cond_values, ierr, 'pawmixdg', dt%pawmixdg, 1, [1], iout)
1881 : end if
1882 : !chi0-based preconditioning without RPA (iprcel=201/2/3) incompatible with non-collinear magnetism and non-LDA functionals.
1883 2 : if (dt%iprcel>=201 .and. dt%iprcel<=203) then
1884 1 : if (.not. xc_is_lda) then
1885 1 : cond_string(2)='ixc' ; cond_values(2)=dt%ixc
1886 1 : call chkint_ne(1, 2, cond_string, cond_values, ierr, 'nspden', dt%nspden, 1, [4], iout)
1887 : end if
1888 : end if
1889 : !Hybrid preconditioning (iprcel=202/3)
1890 2 : if (dt%iprcel>=202 .and. dt%iprcel<=203) then
1891 : !Hybrid preconditioning (iprcel=202/3) not (yet) implemented with band parallelisation and non-collinear magnetism.
1892 1 : if (dt%nspden>2) then
1893 0 : cond_string(2)='nspden' ; cond_values(2)=dt%nspden
1894 0 : call chkint_eq(1, 2, cond_string, cond_values, ierr, 'npband', dt%npband, 1, [1], iout)
1895 : end if
1896 : !Hybrid preconditioning (iprcel=202/3) needs nsppol=2 => nspden=2 and nspinor=2 => nspden=4
1897 1 : if (dt%nsppol==2) then
1898 1 : cond_string(2)='nsppol' ; cond_values(2)=dt%nsppol
1899 1 : call chkint_eq(1, 2, cond_string, cond_values, ierr, 'nspden', dt%nspden, 1, [2], iout)
1900 : end if
1901 1 : if (dt%nspinor==2) then
1902 0 : cond_string(2)='nspinor' ; cond_values(2)=dt%nspinor
1903 0 : call chkint_eq(1, 2, cond_string, cond_values, ierr, 'nspden', dt%nspden, 1, [4], iout)
1904 : end if
1905 : !Hybrid preconditioning (iprcel=202/3) needs precon_in_memory=1 with band parallelization.
1906 1 : if (dt%npband>1) then
1907 0 : cond_string(2)='npband' ; cond_values(2)=dt%npband
1908 0 : call chkint_eq(1, 2, cond_string, cond_values, ierr, 'precon_in_memory', dt%precon_in_memory, 1, [1], iout)
1909 : end if
1910 : end if
1911 :
1912 : end if
1913 :
1914 : ! irandom
1915 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'irandom',dt%irandom,3, [1,2,3], iout)
1916 :
1917 : ! iscf
1918 6958 : if (usewvl ==0) then
1919 : call chkint_eq(0,0,cond_string,cond_values,ierr,&
1920 6958 : 'iscf',dt%iscf,18, [-3,-2,-1,1,2,3,4,5,6,7,11,12,13,14,15,16,17,22], iout)
1921 : else
1922 : ! If usewvl: wvlbigdft indicates that the BigDFT workflow will be followed
1923 0 : wvlbigdft=(dt%usewvl==1.and.dt%wvl_bigdft_comp==1)
1924 0 : cond_string(1)='wvl_bigdft_comp' ; cond_values(1)=dt%wvl_bigdft_comp
1925 0 : if(wvlbigdft) then
1926 : call chkint_eq(1,1,cond_string,cond_values,ierr,&
1927 0 : 'iscf',dt%iscf,15,(/0,1,2,3,4,5,6,7,11,12,13,14,15,16,17/),iout)
1928 : else
1929 : call chkint_eq(1,1,cond_string,cond_values,ierr,&
1930 0 : 'iscf',dt%iscf,18,(/-3,-2,-1,1,2,3,4,5,6,7,11,12,13,14,15,16,17,22/),iout)
1931 : end if
1932 : ! If wvl+metal, iscf cannot be 0
1933 0 : if (dt%occopt>2) then
1934 0 : cond_string(1)='occopt' ; cond_values(1)=dt%occopt
1935 : call chkint_eq(1,1,cond_string,cond_values,ierr,&
1936 0 : 'iscf',dt%iscf,18,(/-3,-2,-1,1,2,3,4,5,6,7,11,12,13,14,15,16,17,22/),iout)
1937 : end if
1938 : end if
1939 :
1940 : ! If ionmov==4, iscf must be 2, 12, 5 or 6.
1941 6958 : if(dt%ionmov==4)then
1942 6 : cond_string(1)='ionmov' ; cond_values(1)=dt%ionmov
1943 6 : call chkint_eq(1,1,cond_string,cond_values,ierr,'iscf',dt%iscf,4,(/2,12,5,6/),iout)
1944 : end if
1945 : ! If PAW, iscf cannot be -1, 11
1946 6958 : if (usepaw==1 .and. usewvl==0) then
1947 1180 : cond_string(1)='usepaw' ; cond_values(1)=usepaw
1948 1180 : call chkint_eq(1,1,cond_string,cond_values,ierr,'iscf',dt%iscf,11,(/-3,-2,2,3,4,7,12,13,14,17,22/),iout)
1949 : end if
1950 : ! Mixing on density is only allowed for GS calculations or for drivers where it is not used.
1951 59080 : if(optdriver /= RUNL_GSTATE .and. all(optdriver /= [RUNL_SCREENING,RUNL_SIGMA,RUNL_BSE,RUNL_EPH, &
1952 : RUNL_WFK,RUNL_NONLINEAR,RUNL_RTTDDFT, RUNL_GWR])) then
1953 741 : cond_string(1)='optdriver' ; cond_values(1)=optdriver
1954 741 : call chkint_le(1,1,cond_string,cond_values,ierr,'iscf',dt%iscf,9,iout)
1955 : end if
1956 : ! When pawoptmix=1 and nspden=4, iscf must be >=10
1957 6958 : if(dt%pawoptmix/=0.and.nspden==4)then
1958 0 : cond_string(1)='nspden' ; cond_values(1)=nspden
1959 0 : cond_string(2)='pawoptmix' ; cond_values(2)=dt%pawoptmix
1960 0 : call chkint_ge(2,2,cond_string,cond_values,ierr,'iscf',dt%iscf,10,iout)
1961 : end if
1962 :
1963 : ! istatimg
1964 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'istatimg',dt%istatimg,2,(/0,1/),iout)
1965 6958 : if (dt%string_algo==STRING_ALGO_SIMPLIFIED_ENERGY) then
1966 0 : cond_string(1)='string_algo' ; cond_values(1)=dt%string_algo
1967 0 : call chkint_eq(1,1,cond_string,cond_values,ierr,'istatimg',dt%istatimg,1,(/1/),iout)
1968 : end if
1969 :
1970 : ! istwfk
1971 120263 : if(dt%usefock==1 .and. dt%optdriver/=RUNL_SIGMA .and. mod(dt%wfoptalg,10)/=5 .and. maxval(abs(dt%istwfk(1:nkpt)-1)) > 0 .and. nkpt > 1 ) then
1972 : write(msg,'(3a)' )&
1973 0 : 'When usefock==1 and several k-points, unless sigma calculation, all the components of istwfk must be 1.',ch10,&
1974 0 : 'Action: set istwfk to 1 for all k-points'
1975 0 : ABI_ERROR_NOSTOP(msg, ierr)
1976 : end if
1977 :
1978 120263 : if(dt%usewvl==1 .and. maxval( abs(dt%istwfk(1:nkpt)-1) ) >0)then
1979 : write(msg,'(3a)' )&
1980 0 : 'When usewvl==1, all the components of istwfk must be 1.',ch10,&
1981 0 : 'Action: set istwfk to 1 for all k-points'
1982 0 : ABI_ERROR_NOSTOP(msg, ierr)
1983 : end if
1984 :
1985 120263 : if(response==1 .and. maxval( abs(dt%istwfk(1:nkpt)-1) ) >0)then
1986 : ! Force istwfk to be 1 for RF calculations
1987 : ! Other choices cannot be realized yet, because of the ddk perturbation.
1988 : write(msg,'(5a)' )&
1989 0 : 'When response==1, all the components of istwfk must be 1.',ch10,&
1990 0 : 'Not yet programmed for time-reversal symmetry.',ch10,&
1991 0 : 'Action: set istwfk to 1 for all k-points'
1992 0 : ABI_ERROR_NOSTOP(msg, ierr)
1993 : end if
1994 120263 : if(dt%nbandkss/=0 .and. dt%kssform/=3 .and. maxval( abs(dt%istwfk(1:nkpt)-1) ) >0)then
1995 : write(msg,'(5a)' )&
1996 0 : 'When nbandkss/=0 and kssform/=3 all the components of istwfk must be 1.',ch10,&
1997 0 : 'Not yet programmed for time-reversal symmetry.',ch10,&
1998 0 : 'Action: set istwfk to 1 for all k-points'
1999 0 : ABI_ERROR_NOSTOP(msg, ierr)
2000 : end if
2001 172524 : if(dt%berryopt/=0 .and. maxval(dt%istwfk(:))/=1)then
2002 : write(msg,'(5a)' )&
2003 0 : 'When berryopt/=0, all the components of istwfk must be 1.',ch10,&
2004 0 : 'Not yet programmed for time-reversal symmetry.',ch10,&
2005 0 : 'Action: set istwfk to 1 for all k-points'
2006 0 : ABI_ERROR_NOSTOP(msg, ierr)
2007 : end if
2008 120263 : if ( dt%gpu_option/=0 .and. dt%gpu_option/=2 .and. maxval( abs(dt%istwfk(1:nkpt)-1) ) > 0 ) then
2009 : write(msg,'(3a)' )&
2010 0 : 'When gpu_option is neither 0 nor 2, all the components of istwfk must be 1.',ch10,&
2011 0 : 'Action: set istwfk to 1 for all k-points or change gpu_option.'
2012 0 : ABI_ERROR_NOSTOP(msg, ierr)
2013 : end if
2014 :
2015 108376 : if ( dt%npfft>1 .and. any( dt%istwfk(1:nkpt) > 2 ) ) then
2016 : write(msg,'(3a)' )&
2017 0 : 'When npfft>1, all the components of istwfk must be 1 or 2.',ch10,&
2018 0 : 'Action: set "npfft 1" or set "istwfk *1" in the input file. If only one k-point which is "0 0 0" then set "istwfk 2".'
2019 0 : ABI_ERROR_NOSTOP(msg, ierr)
2020 : end if
2021 :
2022 : ! ixc
2023 : call chkint(0,0,cond_string,cond_values,ierr,&
2024 6958 : & 'ixc',dt%ixc,36,(/0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,20,21,22,23,24,26,27,31,32,33,34,35,40,41,42,50,51,60/),-1,0,iout) ! One of the values, or negative
2025 6958 : if(dt%iscf==-1)then
2026 22 : cond_string(1)='iscf' ; cond_values(1)=dt%iscf
2027 : ! Make sure that ixc is 1, 7, 8, 20, 21 or 22 (native functionals only for TDDFT - LibXC functionals have not been tested !)
2028 22 : call chkint(1,1,cond_string,cond_values,ierr,'ixc',dt%ixc,6,(/1,7,8,20,21,22/),0,0,iout)
2029 : end if
2030 6958 : if(response==1)then
2031 750 : cond_string(1)='response' ; cond_values(1)=response
2032 : ! Make sure that ixc is between 0 and 9, or 11, 12, 14, 15, 23 or 24 or negative
2033 : call chkint(1,1,cond_string,cond_values,ierr,&
2034 750 : 'ixc',dt%ixc,17,(/0,1,2,3,4,5,6,7,8,9,11,12,14,15,23,24,51/),-1,0,iout)
2035 : end if
2036 6958 : if(nspden/=1)then
2037 1963 : cond_string(1)='nspden' ; cond_values(1)=nspden
2038 : ! Make sure that ixc is 0, 1 , the gga, or Fermi-Amaldi, or negative
2039 : call chkint(1,1,cond_string,cond_values,ierr,&
2040 1963 : 'ixc',dt%ixc,25,(/0,1,7,8,9,11,12,13,14,15,16,17,20,23,24,26,27,31,32,33,34,35,40,41,42/),-1,0,iout)
2041 : end if
2042 6958 : if (dt%usepaw>0.and.(dt%ixc==-427.or.dt%ixc==-428)) then
2043 4 : ABI_WARNING('Range-separated Hybrid Functionals have not been extensively tested in PAW!!!')
2044 : end if
2045 6958 : allowed=((xc_is_lda.and.dt%ixc<0).or.dt%ixc==0.or.dt%ixc==3.or.dt%ixc==7.or.dt%ixc==8)
2046 : if(.not.allowed)then
2047 5444 : cond_string(1)='ixc' ; cond_values(1)=dt%ixc
2048 5444 : call chkint_ne(1,1,cond_string,cond_values,ierr,'optdriver',dt%optdriver,1,(/RUNL_NONLINEAR/),iout)
2049 : end if
2050 6958 : if (xc_is_mgga) then
2051 : ! mGGA not allowed for different drivers
2052 59 : cond_string(1)='ixc' ; cond_values(1)=dt%ixc
2053 : call chkint_ne(1,1,cond_string,cond_values,ierr,'optdriver',dt%optdriver,5, &
2054 59 : [RUNL_SCREENING,RUNL_SIGMA,RUNL_BSE,RUNL_NONLINEAR,RUNL_LONGWAVE, RUNL_GWR, RUNL_EPH], iout)
2055 : end if
2056 :
2057 : ! ixcpositron
2058 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'ixcpositron',dt%ixcpositron,8,(/0,-1,1,11,2,3,31,4/),iout)
2059 :
2060 : ! ixcrot
2061 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'ixcrot',dt%ixcrot,3,(/1,2,3/),iout)
2062 6958 : if(dt%rfmagn/=0)then
2063 12 : if(dt%ixcrot/=3)then
2064 2 : cond_string(1)='rfmagn' ; cond_values(1)=dt%rfmagn
2065 2 : cond_string(2)='ixcrot' ; cond_values(2)=dt%ixcrot
2066 2 : call chkdpr(1,2,cond_string,cond_values,ierr,'qptn(1)',dt%qptn(1),0,zero,iout)
2067 2 : call chkdpr(1,2,cond_string,cond_values,ierr,'qptn(2)',dt%qptn(2),0,zero,iout)
2068 2 : call chkdpr(1,2,cond_string,cond_values,ierr,'qptn(3)',dt%qptn(3),0,zero,iout)
2069 : end if
2070 : endif
2071 :
2072 : ! tim1rev
2073 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'tim1rev',dt%tim1rev,2,(/0,1/),iout)
2074 :
2075 : ! kptnrm and kpt
2076 : ! Coordinates components must be between -1 and 1.
2077 6958 : if(dt%kptnrm<1.0-1.0d-10)then
2078 : write(msg, '(a,es22.14,a,a,a)' )&
2079 0 : 'The input variable kptnrm is',dt%kptnrm,' while it must be >=1.0_dp.',ch10,&
2080 0 : 'Action: change the input variable kptnrm.'
2081 0 : ABI_ERROR_NOSTOP(msg, ierr)
2082 : end if
2083 120263 : do ikpt=1,nkpt
2084 460178 : do mu=1,3
2085 453220 : if ( abs(dt%kpt(mu,ikpt))> dt%kptnrm*1.0000001_dp ) then
2086 : write(msg, '(a,i5,a,a,a,a,3es22.14,a,a,a,a)' )&
2087 0 : 'For k point number',ikpt,' the reduced coordinates',ch10,&
2088 0 : 'generated by the input variables kpt and kptnrm are',ch10,&
2089 0 : dt%kpt(1,ikpt)/dt%kptnrm,dt%kpt(2,ikpt)/dt%kptnrm,dt%kpt(3,ikpt)/dt%kptnrm,ch10,&
2090 0 : 'while they must be between -1.0_dp and 1.0_dp (included).',ch10,&
2091 0 : 'Action: check kpt and kptnrm in the input file.'
2092 0 : ABI_ERROR_NOSTOP(msg, ierr)
2093 : end if
2094 : end do
2095 : end do
2096 :
2097 : ! jellslab
2098 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'jellslab',dt%jellslab,2,(/0,1/),iout)
2099 :
2100 6958 : if (dt%jellslab==1) then
2101 6 : if(dt%nimage>1)then
2102 0 : cond_string(1)='nimage' ; cond_values(1)=dt%nimage
2103 0 : call chkint_eq(1,1,cond_string,cond_values,ierr,'jellslab',dt%jellslab,1,(/0/),iout)
2104 : end if
2105 : ! slabwsrad must be positive
2106 6 : cond_string(1)='jellslab' ; cond_values(1)=dt%jellslab
2107 6 : call chkdpr(1,1,cond_string,cond_values,ierr,'slabwsrad',dt%slabwsrad,1,zero,iout)
2108 : ! slabzbeg must be positive
2109 6 : call chkdpr(1,1,cond_string,cond_values,ierr,'slabzbeg',dt%slabzbeg,1,zero,iout)
2110 : ! slabzend must be bigger than slabzbeg
2111 6 : call chkdpr(1,1,cond_string,cond_values,ierr,'slabzend',dt%slabzend,1,dt%slabzbeg,iout)
2112 : ! rprimd(3,3) must be bigger than slabzend
2113 6 : call chkdpr(1,1,cond_string,cond_values,ierr,'rprimd33',rprimd(3,3),1,dt%slabzend,iout)
2114 : ! Third real space primitive translation has to be orthogonal to the other ones,
2115 : ! actually, for convenience it is useful that rprimd is something like:
2116 : ! a b 0
2117 : ! c d 0
2118 : ! 0 0 e
2119 6 : if(abs(rprimd(1,3))+abs(rprimd(2,3))+abs(rprimd(3,1))+abs(rprimd(3,2))>tol12) then
2120 : write(msg,'(3a)')&
2121 0 : 'Third real space vector is not orthogonal to the other ones,',ch10,&
2122 0 : 'this is needed to use jellium'
2123 0 : ABI_ERROR_NOSTOP(msg, ierr)
2124 : end if
2125 :
2126 : ! Atoms have to be placed in the vacuum space
2127 12 : do iatom=1,natom
2128 6 : zatom=(dt%xred_orig(3,iatom,intimage)-anint(dt%xred_orig(3,iatom,intimage)-half+tol6))*rprimd(3,3)
2129 6 : if(abs(zatom-dt%slabzbeg)<tol8 .or. abs(zatom-dt%slabzend)<tol8) then
2130 2 : if(dt%znucl(dt%typat(iatom))>tol6) then
2131 0 : write(msg,'(a,i0,a)')'atom number=',iatom,' lies precisely on the jellium edge !'
2132 0 : ABI_WARNING(msg)
2133 : end if
2134 : cycle
2135 : end if
2136 10 : if(zatom>dt%slabzbeg .and. zatom<dt%slabzend) then
2137 0 : write(msg,'(a,i0,a)')' atom number=',iatom,' is inside the jellium slab.'
2138 0 : ABI_ERROR_NOSTOP(msg, ierr)
2139 : end if
2140 : end do
2141 : end if
2142 :
2143 : ! kptopt
2144 6958 : call chkint_le(0,0,cond_string,cond_values,ierr,'kptopt',dt%kptopt,4,iout)
2145 : ! If kptopt < 0, it is only valid when iscf = -2
2146 6958 : if (dt%iscf/=-2) then
2147 6464 : cond_string(1)='iscf' ; cond_values(1)=dt%iscf
2148 6464 : call chkint_ge(1,1,cond_string,cond_values,ierr,'kptopt',dt%kptopt,0,iout)
2149 : end if
2150 : ! If hspinfield is applied, only kptopt = 0, 3, 4 are allowed
2151 27814 : if (any(abs(dt%hspinfield)>tol8)) then
2152 12 : cond_string(1) = 'hspinfield(x)' ; cond_values(1) = dt%hspinfield(1)
2153 12 : cond_string(2) = 'hspinfield(y)' ; cond_values(2) = dt%hspinfield(2)
2154 12 : cond_string(3) = 'hspinfield(z)' ; cond_values(3) = dt%hspinfield(3)
2155 12 : call chkint_eq(3,3,cond_string,cond_values,ierr,'kptopt',dt%kptopt,3,(/0,3,4/),iout)
2156 : end if
2157 :
2158 : ! kssform
2159 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'kssform',dt%kssform,3,(/0,1,3/),iout)
2160 :
2161 6958 : if (dt%kssform/=0 .and. dt%nbandkss/=0) then ! Check for outkss limitations.
2162 6 : call wrtout(std_out," Checking if input is consistent with KSS generation")
2163 6 : call chkint_eq(0,0,cond_string,cond_values,ierr,'paral_kgb',dt%paral_kgb,1,(/0/),iout)
2164 6 : call chkint_eq(0,0,cond_string,cond_values,ierr,'iomode',dt%iomode,2,(/IO_MODE_FORTRAN,IO_MODE_ETSF/),iout)
2165 : end if
2166 :
2167 : ! localrdwf
2168 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'localrdwf',dt%localrdwf,2,(/0,1/),iout)
2169 6958 : if(dt%mkmem==0)then
2170 0 : cond_string(1)='mkmem' ; cond_values(1)=dt%mkmem
2171 0 : call chkint_eq(1,1,cond_string,cond_values,ierr,'localrdwf',dt%localrdwf,1,(/1/),iout)
2172 : end if
2173 6958 : if(dt%mkqmem==0)then
2174 0 : cond_string(1)='mkqmem' ; cond_values(1)=dt%mkqmem
2175 0 : call chkint_eq(1,1,cond_string,cond_values,ierr,'localrdwf',dt%localrdwf,1,(/1/),iout)
2176 : end if
2177 6958 : if(dt%mk1mem==0)then
2178 0 : cond_string(1)='mk1mem' ; cond_values(1)=dt%mk1mem
2179 0 : call chkint_eq(1,1,cond_string,cond_values,ierr,'localrdwf',dt%localrdwf,1,(/1/),iout)
2180 : end if
2181 6958 : if(dt%iomode==IO_MODE_MPI)then
2182 28 : cond_string(1)='iomode' ; cond_values(1)=dt%iomode
2183 28 : call chkint_eq(1,1,cond_string,cond_values,ierr,'localrdwf',dt%localrdwf,1,(/1/),iout)
2184 : end if
2185 :
2186 :
2187 : ! LOTF
2188 : #if defined HAVE_LOTF
2189 : if (dt%ionmov==23) then
2190 : write(msg, '(a,a)' ) ch10, '=== LOTF METHOD ================================================================'
2191 : call wrtout(ab_out,msg)
2192 : cond_string(1)='ionmov' ; cond_values(1)=dt%ionmov
2193 : call chkint_eq(0,1,cond_string,cond_values,ierr,'lotf_classic',dt%lotf_classic,1,(/5/),iout)
2194 : call chkint_ge(0,1,cond_string,cond_values,ierr,'lotf_nitex',dt%lotf_nitex,1,iout)
2195 : call chkint_ge(0,1,cond_string,cond_values,ierr,'lotf_nneigx',dt%lotf_nneigx,2,iout)
2196 : call chkint_eq(0,1,cond_string,cond_values,ierr,'lotf_version',dt%lotf_version,1,(/2/),iout)
2197 : end if
2198 : #endif
2199 :
2200 : ! lw_flexo
2201 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'lw_flexo',dt%lw_flexo,5,(/0,1,2,3,4/),iout)
2202 6958 : if(dt%lw_flexo/=0)then
2203 3 : cond_string(1)='lw_flexo' ; cond_values(1)=dt%lw_flexo
2204 3 : call chkint_eq(1,1,cond_string,cond_values,ierr,'optdriver',dt%optdriver,1,(/RUNL_LONGWAVE/),iout)
2205 : end if
2206 :
2207 : ! lw_qdrpl
2208 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'lw_qdrpl',dt%lw_qdrpl,2,(/0,1/),iout)
2209 6958 : if(dt%lw_qdrpl/=0)then
2210 7 : cond_string(1)='lw_qdrpl' ; cond_values(1)=dt%lw_qdrpl
2211 7 : call chkint_eq(1,1,cond_string,cond_values,ierr,'optdriver',dt%optdriver,1,(/RUNL_LONGWAVE/),iout)
2212 : end if
2213 :
2214 : ! lw_natopt
2215 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'lw_natopt',dt%lw_natopt,2,(/0,1/),iout)
2216 6958 : if(dt%lw_natopt/=0)then
2217 1 : cond_string(1)='lw_natopt' ; cond_values(1)=dt%lw_natopt
2218 1 : call chkint_eq(1,1,cond_string,cond_values,ierr,'optdriver',dt%optdriver,1,(/RUNL_LONGWAVE/),iout)
2219 : end if
2220 :
2221 : ! magconon
2222 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'magconon',dt%magconon,3,(/0,1,2/),iout)
2223 : !! impose nspden 4 for the moment and spinors
2224 : ! if (dt%magconon == 1) then
2225 : ! if (dt%nspinor /= 2 .or. dt%nspden /= 4) then
2226 : ! write (msg, '(4a)') &
2227 : !& ' magnetization direction constraint is only compatible with non-collinear calculations', ch10,&
2228 : !& ' Action: set nspinor 2 and nspden 4 in the input file.'
2229 : ! ABI_ERROR_NOSTOP(msg,ierr)
2230 : ! end if
2231 : ! end if
2232 :
2233 : ! magpen
2234 6958 : if(dt%magpen/=zero)then
2235 7 : cond_string(1)='magpen' ; cond_values(1)=dt%magpen
2236 7 : call chkint_eq(1,1,cond_string,cond_values,ierr,'nspden',dt%nspden,1,(/4/),iout)
2237 : end if
2238 :
2239 : ! macro_uj
2240 6958 : if(dt%macro_uj/=0) then
2241 10 : if (dt%ionmov/=0) then
2242 : write(msg, '(3a,i2,2a,i2,3a)' )&
2243 0 : 'Determination of U can not be combined with ionic movements.',ch10,&
2244 0 : 'Here ionmov= ',dt%ionmov,ch10,&
2245 0 : 'and macro_uj=',dt%macro_uj,'.',ch10,&
2246 0 : 'Action: change ionmov in input file.'
2247 0 : ABI_ERROR_NOSTOP(msg, ierr)
2248 10 : else if (dt%nstep<3) then
2249 : write(msg, '(3a,i1,2a,i2,3a)' )&
2250 0 : 'Determination of U needs at least 3 scf steps:',ch10,&
2251 0 : ' nstep = ',dt%nstep,ch10,&
2252 0 : ' and macro_uj=',dt%macro_uj,'.',ch10,&
2253 0 : 'Action: increase nstep in input file.'
2254 0 : ABI_ERROR_NOSTOP(msg, ierr)
2255 130 : else if ((dt%pawujv==0.0d0).or.(sum(abs(dt%atvshift(1:dt%natvshift,1:dt%nsppol,dt%pawujat)))<1.0d-9)) then
2256 : write(msg,'(5a)')&
2257 0 : 'pawujv and/or atvshift found to be 0.0d0.',ch10,&
2258 0 : 'When engaging the linear response procedure, the perturbation strength',ch10,&
2259 0 : 'must be non-zero. Action: change pawujv and/or atvshift to a non-zero value.'
2260 0 : ABI_ERROR(msg)
2261 : end if
2262 : end if
2263 :
2264 : ! mep_solver
2265 : call chkint_eq(0,0,cond_string,cond_values,ierr,'mep_solver',dt%mep_solver,&
2266 41748 : & 5,(/MEP_SOLVER_STEEPEST,MEP_SOLVER_QUICKMIN,MEP_SOLVER_LBFGS,MEP_SOLVER_GBFGS,MEP_SOLVER_RK4/),iout)
2267 : ! String method
2268 6958 : if(dt%imgmov==2) then
2269 24 : cond_string(1)='imgmov' ; cond_values(1)=dt%imgmov
2270 : ! Some restriction for the solver
2271 24 : if(dt%string_algo==STRING_ALGO_ORIGINAL)then
2272 0 : cond_string(2)='string_algo' ; cond_values(2)=dt%string_algo
2273 : call chkint_eq(1,1,cond_string,cond_values,ierr,'mep_solver',dt%mep_solver,&
2274 0 : & 1,(/MEP_SOLVER_STEEPEST/),iout)
2275 : end if
2276 24 : if(dt%string_algo==STRING_ALGO_SIMPLIFIED_EQUAL.or.&
2277 : & dt%string_algo==STRING_ALGO_SIMPLIFIED_ENERGY)then
2278 24 : cond_string(2)='string_algo' ; cond_values(2)=dt%string_algo
2279 : call chkint_eq(1,1,cond_string,cond_values,ierr,'mep_solver',dt%mep_solver,&
2280 72 : & 2,(/MEP_SOLVER_STEEPEST,MEP_SOLVER_RK4/),iout)
2281 : end if
2282 : end if
2283 : ! NEB
2284 6958 : if(dt%imgmov==5)then
2285 4 : cond_string(1)='imgmov' ; cond_values(1)=dt%imgmov
2286 : ! Some restriction for the solver
2287 : call chkint_eq(0,0,cond_string,cond_values,ierr,'mep_solver',dt%mep_solver,&
2288 20 : & 4,(/MEP_SOLVER_STEEPEST,MEP_SOLVER_QUICKMIN,MEP_SOLVER_LBFGS,MEP_SOLVER_GBFGS/),iout)
2289 : ! Only steepest descent for variable-cell NEB
2290 4 : if (dt%neb_cell_algo/=NEB_CELL_ALGO_NONE.and.dt%mep_solver/=MEP_SOLVER_STEEPEST) then
2291 : write(msg, '(5a)' )&
2292 0 : 'When using NEB with variable cell, you can only use',ch10,&
2293 0 : ' steepest-descent algorithm (i.e. mep_solver=steepest-descent)!',ch10,&
2294 0 : 'Action: change mep_solver to 0.'
2295 0 : ABI_ERROR_NOSTOP(msg, ierr)
2296 : end if
2297 : ! Static image energy is needed if spring constant is variable
2298 4 : if (abs(dt%neb_spring(1)-dt%neb_spring(2))>=tol8.and.dt%istatimg==0) then
2299 : write(msg, '(7a)' )&
2300 0 : 'When using variable NEB spring constants (which is the default for CI-NEB),',ch10,&
2301 0 : 'all the energies of the cell images are needed (including static images!).',ch10,&
2302 0 : 'You cannot use istatimg=0!',ch10,&
2303 0 : 'Action: put istatimg=1 in input file.'
2304 0 : ABI_ERROR_NOSTOP(msg, ierr)
2305 : end if
2306 : ! Static image energy is needed for CI-NEB or improved tangent
2307 4 : if ((dt%neb_algo==NEB_ALGO_IMPROVED_TAN.or.dt%neb_algo==NEB_ALGO_CINEB).and.dt%istatimg==0) then
2308 : write(msg, '(7a)' )&
2309 0 : 'When using Improved-tangent-NEB or CI-NEB,',ch10,&
2310 0 : 'all the energies of the cell images are needed (including static images!).',ch10,&
2311 0 : 'You cannot use istatimg=0!',ch10,&
2312 0 : 'Action: put istatimg=1 in input file.'
2313 0 : ABI_ERROR_NOSTOP(msg, ierr)
2314 : end if
2315 : end if
2316 :
2317 : ! mffmem
2318 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'mffmem',dt%mffmem,2,(/0,1/),iout)
2319 :
2320 : ! mixalch_orig
2321 : ! For each type of atom, the sum of the psp components must be one.
2322 14176 : do iimage=1,dt%nimage
2323 14176 : if(dt%ntypalch>0)then
2324 52 : do itypat=1,dt%ntypalch
2325 94 : sumalch=sum(dt%mixalch_orig(:,itypat,iimage))
2326 52 : if(abs(sumalch-one)>tol10)then
2327 0 : if(dt%npspalch<=6)then
2328 0 : write(msg, '(2a,6es12.4)' )ch10,' chkinp: mixalch(:,itypat,iimage)=',dt%mixalch_orig(:,itypat,iimage)
2329 : end if
2330 0 : call wrtout(iout,msg)
2331 0 : call wrtout(std_out, msg)
2332 : write(msg, '(a,i4,2a,i4,2a,f8.2,4a)' )&
2333 0 : 'For the alchemical atom number',itypat,ch10,&
2334 0 : 'image number',iimage,ch10,&
2335 0 : 'the sum of the pseudopotential coefficients is',sumalch,ch10,&
2336 0 : 'while it should be one.',ch10,&
2337 0 : 'Action: check the content of the input variable mixalch.'
2338 0 : ABI_ERROR_NOSTOP(msg, ierr)
2339 : end if
2340 : end do
2341 : end if
2342 : end do
2343 :
2344 : ! mixesimgf
2345 : ! The sum of the mixing image factors must be one
2346 6958 : if(dt%imgmov==6)then
2347 18 : summix=sum(dt%mixesimgf(1:dt%nimage))
2348 6 : if(abs(summix-one)>tol10)then
2349 0 : write(msg, '(2a,20es12.4)' )ch10,' chkinp: mixesimgf(1:dt%nimage)=',dt%mixesimgf(1:dt%nimage)
2350 0 : call wrtout(iout,msg)
2351 0 : call wrtout(std_out, msg)
2352 : write(msg, '(a,es12.4,4a)' )&
2353 0 : 'The sum of the mixing image factors is',summix,ch10,&
2354 0 : 'while it should be one.',ch10,&
2355 0 : 'Action: check the content of the input variable mixesimgf.'
2356 0 : ABI_ERROR_NOSTOP(msg, ierr)
2357 : end if
2358 : end if
2359 :
2360 : ! mpatpol
2361 6958 : call chkint_ge(0,0,cond_string,cond_values,ierr,'mpatpol(1)',dt%mpatpol(1),1,iout)
2362 6958 : cond_string(1)='natom' ; cond_values(1)=natom
2363 6958 : call chkint_le(1,1,cond_string,cond_values,ierr,'mpatpol(2)',dt%mpatpol(2),natom,iout)
2364 :
2365 : ! natom
2366 6958 : if(dt%prtgeo>0)then
2367 53 : cond_string(1)='prtgeo' ; cond_values(1)=dt%prtgeo
2368 53 : call chkint_le(1,1,cond_string,cond_values,ierr,'natom',natom,9999,iout)
2369 : end if
2370 :
2371 : ! nband
2372 : ! Make sure all nband(nkpt) are > 0
2373 15668 : do isppol=1,nsppol
2374 133067 : do ikpt=1,nkpt
2375 126109 : if (dt%nband(ikpt+(isppol-1)*nkpt)<=0) then
2376 0 : cond_string(1)='ikpt' ; cond_values(1)=ikpt
2377 0 : cond_string(2)='isppol' ; cond_values(2)=isppol
2378 0 : call chkint_ge(0,2,cond_string,cond_values,ierr,'nband',dt%nband(ikpt+(isppol-1)*nkpt),1,iout)
2379 : end if
2380 : end do
2381 : end do
2382 6958 : if(nproc/=1.and.nsppol==2.and.usewvl==0)then
2383 752 : do ikpt=1,nkpt
2384 752 : if (dt%nband(ikpt)/=dt%nband(ikpt+nkpt)) then
2385 : write(msg, '(5a,i4,a,2i5,a)' )&
2386 0 : 'the number of bands in the spin up case must be equal to',ch10,&
2387 0 : 'the number of bands in the spin down case.',ch10,&
2388 0 : 'This is not the case for the k point number:',ikpt,&
2389 0 : 'The number of bands spin up and down are:',dt%nband(ikpt),dt%nband(ikpt+nkpt),&
2390 0 : 'Action: change nband, or use the sequential version of ABINIT.'
2391 0 : ABI_ERROR_NOSTOP(msg, ierr)
2392 : end if
2393 : end do
2394 : end if
2395 :
2396 : ! nbdbuf
2397 : ! At this stage, nbdbuf Must be greater or equal to 0, or take the special value -101.
2398 : ! Note that other negative values are permitted in input, but immediately
2399 : ! transformed to a fraction of the number of bands hence a positive number.
2400 6958 : call chkint_ge(0,0,cond_string,cond_values,ierr,'nbdbuf',dt%nbdbuf,-101,iout)
2401 6958 : if(dt%nbdbuf/=-101)then
2402 6943 : cond_string(1)='nbdbuf' ; cond_values(1)=dt%nbdbuf
2403 6943 : call chkint_ge(1,1,cond_string,cond_values,ierr,'nbdbuf',dt%nbdbuf,0,iout)
2404 : endif
2405 :
2406 :
2407 : ! nbandkss
2408 : ! Must be greater or equal to -1
2409 6958 : call chkint_ge(0,0,cond_string,cond_values,ierr,'nbandkss',dt%nbandkss,-1,iout)
2410 : ! When ionmov/=0
2411 6958 : if(dt%ionmov/=0 .and. dt%nbandkss/=0)then
2412 : write(msg,'(11a)')&
2413 0 : 'Ions (or cell) are allowed to move (ionmov/=0),',ch10,&
2414 0 : 'and a _KSS file is requested (nbandkss/=0).',ch10,&
2415 0 : 'A _KSS file will be created at each geometry-optimisation step.',ch10,&
2416 0 : 'Note that this is time consuming !',ch10,&
2417 0 : 'Action: use datasets (one for geometry optimisation,',ch10,&
2418 0 : ' one for states output).'
2419 0 : ABI_WARNING(msg)
2420 : end if
2421 :
2422 : ! nbdblock
2423 : ! Must be greater or equal to 1
2424 6958 : call chkint_ge(0,0,cond_string,cond_values,ierr,'nbdblock',dt%nbdblock,1,iout)
2425 : ! When wfoptalg==0, nbdblock must be 1
2426 6958 : if(mod(dt%wfoptalg,10)==0)then
2427 6264 : cond_string(1)='wfoptalg' ; cond_values(1)=dt%wfoptalg
2428 6264 : call chkint_eq(1,1,cond_string,cond_values,ierr,'nbdblock',dt%nbdblock,1,(/1/),iout)
2429 : end if
2430 : ! When wfoptalg==2, nbdblock must be 1
2431 6958 : if(dt%wfoptalg==2)then
2432 0 : cond_string(1)='wfoptalg' ; cond_values(1)=dt%wfoptalg
2433 0 : call chkint_eq(1,1,cond_string,cond_values,ierr,'nbdblock',dt%nbdblock,1,(/1/),iout)
2434 : end if
2435 : ! When wfoptalg==3, nbdblock must be 1, and iscf must be -2
2436 6958 : if(dt%wfoptalg==3)then
2437 2 : cond_string(1)='wfoptalg' ; cond_values(1)=dt%wfoptalg
2438 2 : call chkint_eq(1,1,cond_string,cond_values,ierr,'nbdblock',dt%nbdblock,1,(/1/),iout)
2439 2 : call chkint_eq(1,1,cond_string,cond_values,ierr,'iscf',dt%iscf,1,(/-2/),iout)
2440 : end if
2441 : ! When wfoptalg==4, nbdblock must be a divisor of nband
2442 6958 : if(mod(dt%wfoptalg,10)==4.and.dt%optdriver==RUNL_GSTATE)then
2443 988 : do isppol=1,nsppol
2444 3570 : do ikpt=1,nkpt
2445 3090 : if(mod(dt%nband(ikpt+(isppol-1)*nkpt),dt%nbdblock)/=0) then
2446 : write(msg, '(5a)' )&
2447 0 : 'For the moment, when wfoptalg=4,',ch10,&
2448 0 : 'nband must be a multiple of nbdblock.',ch10,&
2449 0 : 'Action: check the value of the input variable nbdblock.'
2450 0 : ABI_ERROR_NOSTOP(msg, ierr)
2451 : end if
2452 : end do
2453 : end do
2454 : end if
2455 :
2456 : ! nberry
2457 : ! must be between 0 and 20
2458 6958 : if(dt%berryopt/=0)then
2459 83 : call chkint_ge(0,0,cond_string,cond_values,ierr,'nberry',dt%nberry,0,iout)
2460 83 : call chkint_le(0,0,cond_string,cond_values,ierr,'nberry',dt%nberry,20,iout)
2461 : if(xmpi_paral==1)then
2462 : ! MPI Parallel case
2463 : if (dt%nberry/=0.and.dt%berryopt>0.and.&
2464 : dt%berryopt/= 4.and.dt%berryopt/= 5.and.dt%berryopt/= 6.and.dt%berryopt/= 7.and.&
2465 83 : dt%berryopt/=14.and.dt%berryopt/=15.and.dt%berryopt/=16.and.dt%berryopt/=17) then
2466 : write(msg,'(a,a,a,a,a,i4,a,a,a)')&
2467 0 : 'Berry phase calculation of polarisation with positive berryopt is not',ch10,&
2468 0 : 'allowed in the parallel version of ABINIT.',ch10,&
2469 0 : 'So, the value of nberry=',dt%nberry,' is not allowed,',ch10,&
2470 0 : 'Action: change berryopt to negative values or change nberry, or use the sequential version.'
2471 0 : ABI_ERROR_NOSTOP(msg, ierr)
2472 : end if
2473 : end if
2474 : end if
2475 :
2476 6958 : if (dt%optcell /=0 .and. dt%berryopt == 4) then
2477 0 : write(msg,'(a,a,a,a,a,a,a,a,a,a,a,a,a)') ch10,&
2478 0 : ' chkinp : WARNING -',ch10,&
2479 0 : ' Constant unreduced E calculation with relaxation of cell parameters is allowed.',ch10,&
2480 0 : ' But we strongly recommend users to use reduced ebar calculation (berryopt=14)',ch10,&
2481 0 : ' with the relaxation of cell parameters, for internal consistency purpose.',ch10, &
2482 0 : ' For more information, please refer to "M. Stengel, N.A. Spaldin and D.Vanderbilt,', ch10, &
2483 0 : ' Nat. Phys., 5, 304,(2009)" and its supplementary notes.', ch10 ! [[cite:Stengel2009]]
2484 0 : call wrtout(ab_out,msg)
2485 0 : call wrtout(std_out,msg)
2486 : end if
2487 :
2488 6958 : if (dt%optcell /=0 .and. (dt%berryopt == 6 )) then
2489 0 : write(msg,'(12a)') ch10,&
2490 0 : ' chkinp : WARNING -',ch10,&
2491 0 : ' Constant unreduced D calculation with relaxation of cell parameters is allowed.',ch10,&
2492 0 : ' But we strongly recommend users to use reduced d calculation (berryopt=16)',ch10,&
2493 0 : ' with the relaxation of cell parameters, for internal consistency purpose.',ch10, &
2494 0 : ' For more information, please refer to "M. Stengel, N.A. Spaldin and D.Vanderbilt,', ch10, &
2495 0 : ' Nat. Phys., 5, 304,(2009)" and its supplementary notes.' ! [[cite:Stengel2009]]
2496 0 : call wrtout(ab_out,msg)
2497 0 : call wrtout(std_out,msg)
2498 : end if
2499 :
2500 : ! ndynimage
2501 : ! Must be greater or equal to 1
2502 6958 : call chkint_ge(0,0,cond_string,cond_values,ierr,'ndynimage',dt%ndynimage,1,iout)
2503 :
2504 : ! neb_algo
2505 : call chkint_eq(0,0,cond_string,cond_values,ierr,'neb_algo',dt%neb_algo,&
2506 27832 : & 3,(/NEB_ALGO_STANDARD,NEB_ALGO_IMPROVED_TAN,NEB_ALGO_CINEB/),iout)
2507 :
2508 : ! neb_cell_algo
2509 : call chkint_eq(0,0,cond_string,cond_values,ierr,'neb_cell_algo',dt%neb_cell_algo,&
2510 27832 : & 3,(/NEB_CELL_ALGO_NONE,NEB_CELL_ALGO_GSSNEB,NEB_CELL_ALGO_VCNEB/),iout)
2511 : !Forbid fixed atoms for variable-cell NEB
2512 6958 : if (dt%neb_cell_algo/=NEB_CELL_ALGO_NONE) then
2513 9 : if (any(dt%iatfix(:,:)==1)) then
2514 : write(msg,'(3a)') &
2515 0 : & 'Having fixed atoms is forbidden when performing variable-cell',ch10,&
2516 0 : & 'mimimum energy path searching (NEB) (imgmov=5)!'
2517 0 : ABI_ERROR_NOSTOP(msg, ierr)
2518 : end if
2519 : end if
2520 :
2521 : ! nfft and nfftdg
2522 : ! Must have nfft<=nfftdg
2523 6958 : if (usepaw==1) then
2524 1180 : nfft =dt%ngfft(1) *dt%ngfft(2) *dt%ngfft(3)
2525 1180 : nfftdg=dt%ngfftdg(1)*dt%ngfftdg(2)*dt%ngfftdg(3)
2526 1180 : cond_string(1)='nfft' ; cond_values(1)=nfft
2527 1180 : call chkint(1,1,cond_string,cond_values,ierr,'nfftdg',nfftdg,1,(/0/),1,nfft,iout) ! Must be 0 or nfft
2528 : end if
2529 :
2530 : ! diismemory
2531 : ! Must be greater or equal to 1
2532 6958 : call chkint_ge(0,0,cond_string,cond_values,ierr,'diismemory',dt%diismemory,1,iout)
2533 :
2534 : ! nimage
2535 : ! Must be greater or equal to 1
2536 6958 : call chkint_ge(0,0,cond_string,cond_values,ierr,'nimage',dt%nimage,1,iout)
2537 6958 : if (usewvl==1) then
2538 0 : cond_string(1)='usewvl' ; cond_values(1)=usewvl
2539 0 : call chkint_eq(1,1,cond_string,cond_values,ierr,'nimage',dt%nimage,1,(/1/),iout)
2540 : end if
2541 6958 : if (optdriver/=RUNL_GSTATE) then
2542 1318 : cond_string(1)='optdriver' ; cond_values(1)=optdriver
2543 1318 : call chkint_eq(1,1,cond_string,cond_values,ierr,'nimage',dt%nimage,1,(/1/),iout)
2544 : end if
2545 6958 : if (dt%tfkinfunc==2) then
2546 6 : cond_string(1)='tfkinfunc' ; cond_values(1)=dt%tfkinfunc
2547 6 : call chkint_eq(1,1,cond_string,cond_values,ierr,'nimage',dt%nimage,1,(/1/),iout)
2548 : end if
2549 6958 : if (dt%prtxml==1) then
2550 1 : cond_string(1)='prtxml' ; cond_values(1)=dt%prtxml
2551 1 : call chkint_eq(1,1,cond_string,cond_values,ierr,'nimage',dt%nimage,1,(/1/),iout)
2552 : end if
2553 6958 : if (dt%imgmov==9.or.dt%imgmov==13) then
2554 7 : if (dt%pitransform==1.and.(mod(dt%nimage,2)/=0)) then
2555 0 : write(msg,'(6a)')ch10,&
2556 0 : 'Path-Integral Molecular Dynamics (imgmov=9,13)',ch10,&
2557 0 : 'in normal mode transformation (pitransform=1).',ch10,&
2558 0 : 'requires nimage to be even!'
2559 0 : ABI_ERROR_NOSTOP(msg, ierr)
2560 : end if
2561 : end if
2562 6958 : if (dt%imgmov==10.and.dt%pitransform>0) then
2563 0 : write(msg,'(4a)')ch10,&
2564 0 : 'Path-Integral Molecular Dynamics (imgmov=10) with QTB',ch10,&
2565 0 : 'requires primitive coordinates (pitransform=0).'
2566 0 : ABI_ERROR_NOSTOP(msg, ierr)
2567 : end if
2568 :
2569 : ! nkpt
2570 : ! Must be greater or equal to 1
2571 6958 : call chkint_ge(0,0,cond_string,cond_values,ierr,'nkpt',nkpt,1,iout)
2572 : ! If prtdos>=2, nkpt must be greater or equal to 2
2573 6958 : if(dt%prtdos>=2)then
2574 48 : cond_string(1)='prtdos' ; cond_values(1)=dt%prtdos
2575 48 : call chkint_ge(1,1,cond_string,cond_values,ierr,'nkpt',nkpt,2,iout)
2576 : end if
2577 : ! Must be smaller than 50 if iscf=-2 (band structure)
2578 : ! while prteig=0 and prtvol<2, except if kptopt>0
2579 6958 : if(dt%iscf==-2 .and. dt%prteig==0 .and. dt%prtvol<2 .and. dt%kptopt<=0)then
2580 0 : cond_string(1)='iscf' ; cond_values(1)=dt%iscf
2581 0 : cond_string(2)='prteig' ; cond_values(2)=dt%prteig
2582 0 : cond_string(3)='prtvol' ; cond_values(3)=dt%prtvol
2583 0 : call chkint_le(1,3,cond_string,cond_values,ierr,'nkpt',nkpt,50,iout)
2584 : end if
2585 :
2586 : ! nline
2587 : ! Must be equal to mdeg_filter for filtering algorithms
2588 6958 : if (mod(dt%wfoptalg,10) == 1) then
2589 199 : if (dt%nline/=dt%mdeg_filter) then
2590 : write(msg,'(5a)') &
2591 0 : "If you use a subspace filtering algorithm to optimize wavefunctions,",ch10,&
2592 0 : "the degree of the polynomial filter (i.e. mdeg_filter) must be equal to",ch10,&
2593 0 : "the value of nline parameter (which is obsolete for filtering algorithms)!"
2594 0 : ABI_ERROR_NOSTOP(msg, ierr)
2595 : end if
2596 : end if
2597 :
2598 : ! nloalg(1)= nloc_alg
2599 6958 : if(dt%useylm==0) then
2600 : ! Must be 2, 3, 4
2601 5642 : call chkint_eq(0,0,cond_string,cond_values,ierr,'nloc_alg',dt%nloalg(1),3,(/2,3,4/),iout)
2602 : else
2603 : ! Must be between 2 and 10
2604 1316 : call chkint_eq(0,0,cond_string,cond_values,ierr,'nloc_alg',dt%nloalg(1),9,(/2,3,4,5,6,7,8,9,10/),iout)
2605 : end if
2606 :
2607 : ! nloc_mem= nloalg(2)*(nloalg(3)+1)
2608 : ! nloalg(2) must be -1 or 1 ; nloalg(3) is 0 or 1.
2609 6958 : nloc_mem=dt%nloalg(2)*(dt%nloalg(3)+1)
2610 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'nloc_mem',nloc_mem,4,(/-2,-1,1,2/),iout)
2611 :
2612 : ! npband
2613 : ! Must be greater or equal to 1
2614 6958 : call chkint_ge(0,0,cond_string,cond_values,ierr,'npband',dt%npband,1,iout)
2615 :
2616 : ! npfft
2617 : ! Must be greater or equal to 1
2618 6958 : call chkint_ge(0,0,cond_string,cond_values,ierr,'npfft',dt%npfft,1,iout)
2619 :
2620 : ! If usepaw==1 and pawmixdg==0, npfft must be equal to 1
2621 6958 : if(usepaw==1 .and. dt%pawmixdg==0)then
2622 991 : cond_string(1)='usepaw ' ; cond_values(1)=usepaw
2623 991 : cond_string(2)='pawmixdg' ; cond_values(2)=dt%pawmixdg
2624 991 : call chkint_eq(1,2,cond_string,cond_values,ierr,'npfft',dt%npfft,1,(/1/),iout)
2625 : end if
2626 : #ifdef HAVE_OPENMP
2627 : if (dt%wfoptalg==114 .or. dt%wfoptalg==1 .or. dt%wfoptalg==111 .or. dt%wfoptalg==112) then
2628 : if ( nthreads > 1 ) then
2629 : if ( dt%npfft > 1 ) then
2630 : write(msg,'(4a,i4,a,i4,a)') "Using LOBPCG algorithm (wfoptalg=114), the FFT parallelization is not ",&
2631 : "compatible with multiple threads.",ch10,"Please set npfft to 1 (currently npfft=",dt%npfft,&
2632 : ") or export OMP_NUM_THREADS=1 (currently: the number of threads is ",nthreads,")"
2633 : ABI_ERROR_NOSTOP(msg, ierr)
2634 : end if
2635 : if ( dt%npspinor > 1 ) then
2636 : write(msg,'(4a,i1,a,i4,a)') "Using LOBPCG algorithm (wfoptalg=114), the parallelization on spinorial components is not",&
2637 : " compatible with multiple threads.",ch10,"Please set npspinor to 1 (currently npspinor=",dt%npspinor,&
2638 : ") or export OMP_NUM_THREADS=1 (currently: the number of threads is ",nthreads,")"
2639 : ABI_ERROR_NOSTOP(msg, ierr)
2640 : end if
2641 : if ( dt%bandpp>1.and.fftalga==FFT_SG ) then
2642 : write(msg,'(4a,i1,a,i4,a)') "To use bandpp > 1 and nthreads > 1 is not possible with S. Goedecker FFT (fftalg=1XX).",ch10,&
2643 : "Change nthreads, bandpp, or fftalg (for example fftalg=401)."
2644 : ABI_ERROR_NOSTOP(msg, ierr)
2645 : end if
2646 : end if
2647 : end if
2648 : #endif
2649 : !Not yet implemented
2650 6958 : if ((dt%wfoptalg==111 .or. dt%wfoptalg==112) .and. dt%npfft > 1) then
2651 0 : write(msg,'(5a,i3,5a)') "The FFT parallelization (npfft>1) is not compatible ",&
2652 0 : & "with Chebyshev filtering algorithm (wfoptalg=111)!",ch10,&
2653 0 : & "Please use multithreading instead (export OMP_NUM_THREADS=...)",&
2654 0 : & " and set npfft to 1 (currently npfft=",dt%npfft,&
2655 : #ifdef HAVE_OPENMP
2656 : & ")."
2657 : #else
2658 0 : & ").",ch10,"But for that, you need to recompile ABINIT for multithreading,",ch10,&
2659 0 : & "setting --enable-openmp at configure stage."
2660 : #endif
2661 0 : ABI_ERROR_NOSTOP(msg, ierr)
2662 : end if
2663 :
2664 : ! npimage
2665 : ! Must be greater or equal to 1
2666 6958 : call chkint_ge(0,0,cond_string,cond_values,ierr,'npimage',dt%npimage,1,iout)
2667 : ! At present, parallelism over images is not coded ...
2668 : ! call chkint_eq(0,0,cond_string,cond_values,ierr,'npimage',dt%npimage,1,(/1/),iout)
2669 :
2670 : ! np_spkpt
2671 : ! Must be greater or equal to 1
2672 6958 : call chkint_ge(0,0,cond_string,cond_values,ierr,'np_spkpt',dt%np_spkpt,1,iout)
2673 :
2674 : ! nppert
2675 6958 : call chkint_ge(0,0,cond_string,cond_values,ierr,'nppert',dt%nppert,1,iout)
2676 :
2677 : ! nproc
2678 6958 : if (response==1.and.nsppol==2.and.nproc>1.and.modulo(nproc,2)>0) then
2679 : write(msg,'(3a)' ) &
2680 0 : 'For DFPT parallel calculations on spin-polarized systems (nsppol=2),',ch10,&
2681 0 : 'the number of processors must be even!'
2682 0 : ABI_ERROR_NOSTOP(msg, ierr)
2683 : end if
2684 :
2685 : ! nproj
2686 : ! If there is more than one projector for some angular momentum channel of some pseudopotential
2687 : ! do ilang=0,3
2688 : ! nprojmax(ilang)=pspheads(1)%nproj(ilang)
2689 : ! if(npsp>=2)then
2690 : ! do ii=2,npsp
2691 : ! nprojmax(ilang)=max(pspheads(ii)%nproj(ilang),nprojmax(ilang))
2692 : ! end do
2693 : ! end if
2694 : ! end do
2695 :
2696 : ! npspinor
2697 : ! Must be equal to 1 or 2
2698 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'npspinor',dt%npspinor,2,(/1,2/),iout)
2699 : ! If nspinor==1, npspinor must be equal to 1
2700 6958 : if(dt%nspinor==1 )then
2701 6610 : cond_string(1)='nspinor' ; cond_values(1)=dt%nspinor
2702 6610 : call chkint_eq(0,1,cond_string,cond_values,ierr,'npspinor',dt%npspinor,1,(/1/),iout)
2703 : end if
2704 : ! When NC+SOC with useylm=1 (nonlop_ylm pathway), spinor parallelism (npspinor>1) is incompatible
2705 6958 : if (dt%nspinor==2 .and. dt%usepaw==0 .and. dt%useylm==1 .and. dt%npspinor>1) then
2706 0 : write(msg,'(3a)') 'NC+SOC with useylm=1 (nonlop_ylm pathway) does not support spinor parallelism.',ch10,&
2707 0 : & 'Action: set npspinor=1 (or use useylm=0, or use PAW pseudopotentials).'
2708 0 : ABI_ERROR_NOSTOP(msg, ierr)
2709 : end if
2710 :
2711 : ! npvel (must be positive)
2712 6958 : call chkint_ge(0,0,cond_string,cond_values,ierr,'npvel',dt%npvel,0,iout)
2713 :
2714 : ! npwkss
2715 : ! Must be greater or equal to -1
2716 6958 : call chkint_ge(0,0,cond_string,cond_values,ierr,'npwkss',dt%npwkss,-1,iout)
2717 :
2718 : ! nqpt
2719 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'nqpt',dt%nqpt,2,(/0,1/),iout)
2720 :
2721 : ! nscforder
2722 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'nscforder',dt%nscforder,10,(/8,14,16,20,24,30,40,50,60,100/),iout)
2723 :
2724 : ! nshiftk
2725 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'nshiftk',dt%nshiftk,8,(/1,2,3,4,5,6,7,8/),iout)
2726 : ! If chksymbreak=1, nshiftk must be equal to 1, 2, 4.
2727 6958 : if(dt%chksymbreak==1 )then
2728 6717 : cond_string(1)='chksymbreak' ; cond_values(1)=dt%chksymbreak
2729 6717 : call chkint_eq(0,1,cond_string,cond_values,ierr,'nshiftk',dt%nshiftk,3,(/1,2,4/),iout)
2730 : end if
2731 :
2732 : ! nspden
2733 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'nspden',nspden,3,(/1,2,4/),iout)
2734 :
2735 6958 : if(nsppol==2)then ! When nsppol=2, nspden must be 2
2736 1752 : cond_string(1)='nsppol' ; cond_values(1)=nsppol
2737 1752 : call chkint_eq(1,1,cond_string,cond_values,ierr,'nspden',nspden,1,(/2/),iout)
2738 : end if
2739 6958 : if(nspden==2 .and. nsppol==1 .and. response==1)then
2740 : write(msg,'(13a)')&
2741 0 : 'nspden==2 together with nsppol==1 is not allowed',ch10,&
2742 0 : 'for response function calculations.',ch10,&
2743 0 : 'For antiferromagnetic materials, use nspden==2 and nsppol=2.',ch10,&
2744 0 : 'In this case, Shubnikov symmetries will be used to decrease',ch10,&
2745 0 : 'the number of perturbations. In a future version, it will also be',ch10,&
2746 0 : 'used to decrease the number of spin components (to be coded).',ch10,&
2747 0 : 'Action: change nsppol to 1, or check nspden.'
2748 0 : ABI_ERROR_NOSTOP(msg, ierr)
2749 : end if
2750 6958 : if(nspden==4.and.response==1)then
2751 : write(msg,'(3a)')&
2752 24 : 'nspden==4 allowed in response formalism.',ch10,&
2753 48 : 'BUT Non collinear magnetism under development in perturbative treatment.'
2754 24 : ABI_WARNING(msg)
2755 : end if
2756 : ! TR symmetry not allowed for NC magnetism, in the present version
2757 : ! (to be investigated further)
2758 6958 : if (nspden==4.and.(dt%kptopt==1.or.dt%kptopt==2)) then
2759 0 : write(msg, '(8a)' ) ch10,&
2760 0 : 'When non-collinear magnetism is activated (nspden=4),',ch10,&
2761 0 : 'time-reversal symmetry cannot be used in the present',ch10,&
2762 0 : 'state of the code (to be checked and validated).',ch10,&
2763 0 : 'Action: choose kptopt different from 1 or 2.'
2764 0 : ABI_ERROR_NOSTOP(msg, ierr)
2765 : end if
2766 : ! When densfor_pred<0 or 3, nspden must be 1 or 2
2767 6958 : if(dt%densfor_pred<0.or.dt%densfor_pred==3)then
2768 2 : cond_string(1)='densfor_pred' ; cond_values(1)=dt%densfor_pred
2769 2 : call chkint_eq(1,1,cond_string,cond_values,ierr,'nspden',nspden,2,(/1,2/),iout)
2770 : end if
2771 : ! When ionmov=4 and iscf>10, nspden must be 1 or 2
2772 6958 : if(dt%ionmov==4.and.dt%iscf>10)then
2773 0 : cond_string(1)='ionmov' ; cond_values(1)=dt%ionmov
2774 0 : cond_string(2)='iscf' ; cond_values(2)=dt%iscf
2775 0 : call chkint_eq(1,2,cond_string,cond_values,ierr,'nspden',nspden,2,(/1,2/),iout)
2776 : end if
2777 : ! When iprcel>49, nspden must be 1 or 2
2778 6958 : if(mod(dt%iprcel,100)>49)then
2779 5 : cond_string(1)='iprcel' ; cond_values(1)=dt%iprcel
2780 5 : call chkint_eq(1,1,cond_string,cond_values,ierr,'nspden',nspden,2,(/1,2/),iout)
2781 : end if
2782 6958 : if(xc_is_mgga.and.nspden==4)then
2783 : write(msg, '(3a)' )&
2784 0 : 'The meta-GGA XC kernel is not yet implemented for non-colinear magnetism case',ch10, &
2785 0 : 'Please use "nspden=1 or 2".'
2786 0 : ABI_ERROR(msg)
2787 : end if
2788 : ! When abs(usepawu) is not 0, 1, 4, 10 or 14, nspden must be 1 or 2
2789 : if (abs(dt%usepawu)/=0 .and. abs(dt%usepawu)/=1 .and. abs(dt%usepawu)/=4 .and. &
2790 6958 : abs(dt%usepawu)/=10 .and. abs(dt%usepawu)/=14 )then
2791 6 : cond_string(1)='usepawu' ; cond_values(1)=dt%usepawu
2792 6 : call chkint_eq(1,1,cond_string,cond_values,ierr,'nspden',nspden,2,(/1,2/),iout)
2793 : end if
2794 :
2795 : ! nspinor
2796 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'nspinor',nspinor,2,(/1,2/),iout)
2797 6958 : if(nspden==2)then ! When nspden=2, nspinor must be 1
2798 1789 : cond_string(1)='nspden' ; cond_values(1)=nspden
2799 1789 : call chkint_eq(1,1,cond_string,cond_values,ierr,'nspinor',nspinor,1,(/1/),iout)
2800 : end if
2801 :
2802 6958 : if(nspden==4)then ! When nspden=4, nspinor must be 2
2803 174 : cond_string(1)='nspden' ; cond_values(1)=nspden
2804 174 : call chkint_eq(1,1,cond_string,cond_values,ierr,'nspinor',nspinor,1,(/2/),iout)
2805 : end if
2806 : ! When iscf=-1, nspinor must be 1
2807 6958 : if(dt%iscf==-1)then
2808 22 : cond_string(1)='iscf' ; cond_values(1)=dt%iscf
2809 : ! Make sure that nsppol is 1
2810 22 : call chkint_eq(1,1,cond_string,cond_values,ierr,'nspinor',nspinor,1,(/1/),iout)
2811 : end if
2812 : ! spin-orbit is not implemented for the strain perturbation
2813 6958 : if(dt%rfstrs/=0)then
2814 37 : cond_string(1)='rfstrs' ; cond_values(1)=dt%rfstrs
2815 37 : call chkint_eq(1,1,cond_string,cond_values,ierr,'nspinor',nspinor,1,(/1/),iout)
2816 : end if
2817 : ! When usepawu=2 or -2, nspinor must be 1
2818 6958 : if(abs(dt%usepawu)==2)then
2819 6 : cond_string(1)='usepawu' ; cond_values(1)=dt%usepawu
2820 : ! Make sure that nspinor is 1
2821 6 : call chkint_eq(1,1,cond_string,cond_values,ierr,'nspinor',nspinor,1,(/1/),iout)
2822 : end if
2823 :
2824 : ! nsppol
2825 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'nsppol',nsppol,2,(/1,2/),iout)
2826 :
2827 : ! nstep
2828 6958 : call chkint_ge(0,0,cond_string,cond_values,ierr,'nstep',dt%nstep,0,iout)
2829 6958 : if(dt%nstep==0)then
2830 : ! nstep==0 computation of energy not yet implemented with Fock term, see m_energy.F90
2831 36 : cond_string(1)='usefock' ; cond_values(1)=dt%usefock
2832 36 : if(dt%usefock/=1) then
2833 36 : call chkint_eq(1,1,cond_string,cond_values,ierr,'usefock',dt%usefock,1,(/0/),iout)
2834 : else
2835 : write(msg,'(a)')&
2836 0 : 'For usefock=1 and nstep=0, the Fock energy is not available and will not be computed.'
2837 0 : ABI_WARNING(msg)
2838 : endif
2839 : endif
2840 :
2841 : ! nsym
2842 6958 : call chkint_ge(0,0,cond_string,cond_values,ierr,'nsym',dt%nsym,1,iout)
2843 : ! check if nsym=1 in phonon calculation in finite electric field
2844 6958 : if (response==1.and.&
2845 : (dt%berryopt== 4.or.dt%berryopt== 6.or.dt%berryopt== 7.or.&
2846 : dt%berryopt==14.or.dt%berryopt==16.or.dt%berryopt==17)) then
2847 1 : cond_string(1)='response' ; cond_values(1)=response
2848 1 : cond_string(2)='berryopt' ; cond_values(2)=dt%berryopt
2849 1 : call chkint_eq(1,2,cond_string,cond_values,ierr,'nsym',dt%nsym,1,(/1/),iout)
2850 : end if
2851 :
2852 : ! ntime
2853 6958 : call chkint_ge(0,0,cond_string,cond_values,ierr,'ntime',dt%ntime,0,iout)
2854 :
2855 : ! ntimimage
2856 6958 : call chkint_ge(0,0,cond_string,cond_values,ierr,'ntimimage',dt%ntimimage,1,iout)
2857 :
2858 : ! ntypalch
2859 6958 : if (usepaw==1) then
2860 1180 : cond_string(1)='usepaw' ; cond_values(1)=dt%usepaw
2861 1180 : call chkint_eq(1,1,cond_string,cond_values,ierr,'ntypalch',dt%ntypalch,1,(/0/),iout)
2862 : end if
2863 :
2864 : ! nucdipmom
2865 :
2866 225442 : if (any(abs(dt%nucdipmom)>tol8)) then
2867 :
2868 : ! !nucdipmom requires PAW
2869 : !if(usepaw/=1)then
2870 : ! write(msg, '(3a)' )&
2871 : ! 'Nuclear dipole moments (variable nucdipmom or atndlist) input as nonzero but PAW not activated => stop',ch10,&
2872 : ! 'Action: re-run with PAW '
2873 : ! ABI_ERROR_NOSTOP(msg, ierr)
2874 : !end if
2875 :
2876 : ! paral_atom not allowed at present
2877 40 : call chkint_eq(1,1,cond_string,cond_values,ierr,'paral_atom',dt%paral_atom,1,(/0/),iout)
2878 :
2879 : ! nucdipmom with PAW requires complex rhoij
2880 40 : if((usepaw.EQ.1).AND.(dt%pawcpxocc.NE.2))then
2881 : write(msg, '(3a)' )&
2882 0 : 'Nuclear dipole moments (variable nucdipmom or atndlist) require complex rhoij => stop',ch10,&
2883 0 : 'Action: re-run with pawcpxocc = 2 '
2884 0 : ABI_ERROR_NOSTOP(msg, ierr)
2885 : end if
2886 :
2887 : ! nucdipmom requires no force or stress calculation
2888 40 : if(dt%optforces/=0 .OR. dt%optstress/=0)then
2889 : write(msg, '(3a)' )&
2890 0 : 'Nuclear dipole moments (variable nucdipmom or atndlist) cannot be used with force or stress calculations => stop',ch10,&
2891 0 : 'Action: re-run with optforces = 0 and optstress = 0 '
2892 0 : ABI_ERROR_NOSTOP(msg, ierr)
2893 : end if
2894 :
2895 : ! nucdipmom requires kptopt 0, 3, or 4 (no time reversal symmetry allowed)
2896 40 : if( (dt%kptopt .EQ. 1) .OR. (dt%kptopt .EQ. 2) ) then
2897 : write(msg, '(a,i4,a,a,a)' )&
2898 0 : ' Nuclear dipole moments (variable nucdipmom or atndlist) break time reversal symmetry but kptopt = ',dt%kptopt,&
2899 0 : ' => stop ',ch10,&
2900 0 : 'Action: re-run with kptopt of 0, 3 or 4'
2901 0 : ABI_ERROR_NOSTOP(msg, ierr)
2902 : end if
2903 :
2904 : !! nucdipmom is not currently compatible with spinat (this is necessary because both are used in symfind)
2905 : !if( any(abs(dt%spinat) > tol8) ) then
2906 : ! write(msg, '(3a)' )&
2907 : ! ' Nuclear dipole moments (variable nucdipmom or atndlist) input as nonzero but spinat is also nonzero => stop',ch10,&
2908 : ! 'Action: re-run with spinat zero '
2909 : ! ABI_ERROR_NOSTOP(msg, ierr)
2910 : !end if
2911 :
2912 : end if
2913 :
2914 : ! nzchempot
2915 6958 : call chkint_ge(0,0,cond_string,cond_values,ierr,'nzchempot',dt%nzchempot,0,iout)
2916 : ! Cannot be used with response functions at present
2917 6958 : if (response==1) then
2918 750 : cond_string(1)='response' ; cond_values(1)=response
2919 750 : call chkint_eq(1,1,cond_string,cond_values,ierr,'nzchempot',dt%nzchempot,1,(/0/),iout)
2920 : end if
2921 6958 : if(dt%nzchempot>0)then
2922 21 : do itypat=1,dt%ntypat
2923 28 : do iz=2,dt%nzchempot
2924 14 : dz=dt%chempot(1,iz,itypat)-dt%chempot(1,iz-1,itypat)
2925 28 : if(dz<-tol12)then
2926 : write(msg, '(a,2i6,a,a,d17.10,a,a, a,d17.10,a,a, a,a,a)' )&
2927 0 : ' For izchempot,itypat=',iz,itypat,ch10,&
2928 0 : ' chempot(1,izchempot-1,itypat) = ',dt%chempot(1,iz-1,itypat),' and', ch10,&
2929 0 : ' chempot(1,izchempot ,itypat) = ',dt%chempot(1,iz ,itypat),',',ch10,&
2930 0 : ' while they should be ordered in increasing values =>stop',ch10,&
2931 0 : 'Action: correct chempot(1,*,itypat) in input file.'
2932 0 : ABI_ERROR_NOSTOP(msg, ierr)
2933 : end if
2934 : end do
2935 14 : dz=dt%chempot(1,dt%nzchempot,itypat)-dt%chempot(1,1,itypat)
2936 21 : if(dz>one)then
2937 : write(msg, '(a,2i6,a,a,d17.10,a,a, a,d17.10,a,a, a,a,a)' )&
2938 0 : ' For nzchempot,itypat=',dt%nzchempot,itypat,ch10,&
2939 0 : ' chempot(1,1,itypat) = ',dt%chempot(1,1,itypat),' and', ch10,&
2940 0 : ' chempot(1,nzchempot ,itypat) = ',dt%chempot(1,dt%nzchempot,itypat),'.',ch10,&
2941 0 : ' However, the latter should, at most, be one more than the former =>stop',ch10,&
2942 0 : 'Action: correct chempot(1,nzchempot,itypat) in input file.'
2943 0 : ABI_ERROR_NOSTOP(msg, ierr)
2944 : end if
2945 : end do
2946 : end if
2947 :
2948 : ! occ
2949 : ! Do following tests only for occopt==0 or 2, when occupation numbers are needed
2950 6958 : if ((dt%iscf>0.or.dt%iscf==-1.or.dt%iscf==-3) .and. (dt%occopt==0 .or. dt%occopt==2) ) then
2951 919 : do iimage=1,dt%nimage
2952 : ! make sure occupation numbers (occ(n)) were defined:
2953 463 : sumocc=zero
2954 463 : bantot=0
2955 1163 : do isppol=1,nsppol
2956 2286 : do ikpt=1,nkpt
2957 11414 : do iband=1,dt%nband(ikpt+(isppol-1)*nkpt)
2958 9591 : bantot=bantot+1
2959 9591 : sumocc=sumocc+dt%occ_orig(bantot,iimage)
2960 10714 : if (dt%occ_orig(bantot,iimage)<-tol8) then
2961 : write(msg, '(a,3i6,a,e20.10,a,a,a)' )&
2962 0 : 'iband,ikpt,iimage=',iband,ikpt,iimage,' has negative occ=',dt%occ_orig(bantot,iimage),' =>stop',ch10,&
2963 0 : 'Action: correct this occupation number in input file.'
2964 0 : ABI_ERROR_NOSTOP(msg, ierr)
2965 : end if
2966 : end do
2967 : end do
2968 : end do
2969 919 : if (sumocc<=1.0d-8) then
2970 : write(msg, '(a,1p,e20.10,a,a,a)')&
2971 0 : 'Sum of occ=',sumocc, ' =>occ not defined => stop',ch10,&
2972 0 : 'Action: correct the array occ in input file.'
2973 0 : ABI_ERROR_NOSTOP(msg, ierr)
2974 : end if
2975 : enddo
2976 : end if
2977 :
2978 : ! occopt
2979 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'occopt',dt%occopt,10,(/0,1,2,3,4,5,6,7,8,9/),iout)
2980 : ! When prtdos==1 or 4, occopt must be between 3 and 8
2981 6958 : if(dt%prtdos==1.or.dt%prtdos==4)then
2982 9 : cond_string(1)='prtdos' ; cond_values(1)=dt%prtdos
2983 : ! Make sure that occopt is 3,4,5,6,7, or 8
2984 9 : call chkint_eq(1,1,cond_string,cond_values,ierr,'occopt',dt%occopt,7,(/3,4,5,6,7,8,9/),iout)
2985 : end if
2986 : ! When nsppol==2 and spinmagntarget is the default value (-99.99d0), occopt cannot be 1.
2987 6958 : if(nsppol==2.and.dt%occopt==1.and.abs(dt%spinmagntarget+99.99d0)<tol8)then
2988 8 : if(natom/=1 .or. abs(dt%znucl(dt%typat(1))-one)>tol8)then
2989 : write(msg,'(a,i3,2a,i3,4a,f7.2,7a)' )&
2990 0 : 'This is a calculation with spin-up and spin-down wavefunctions, ... nsppol=',nsppol,ch10,&
2991 0 : 'in which the occupation numbers are to be determined automatically. ... occopt=',dt%occopt,ch10,&
2992 0 : 'However, in this case, the target total spin magnetization',ch10,&
2993 0 : 'must be specified, while the default value is observed. ... spinmagntarget=',dt%spinmagntarget,ch10,&
2994 0 : 'Action: if you are doing an antiferromagnetic calculation, please use nsppol=1 with nspden=2;',ch10,&
2995 0 : 'on the other hand, if you are doing a ferromagnetic calculation, either specify your own spinmagntarget,',ch10,&
2996 0 : 'or let the code determine the total spin-polarization, by using a metallic value for occopt (e.g. 7 or 4 ...).'
2997 0 : ABI_ERROR_NOSTOP(msg, ierr)
2998 : end if
2999 : end if
3000 :
3001 : ! optcell
3002 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'optcell',dt%optcell,10,(/0,1,2,3,4,5,6,7,8,9/),iout)
3003 : ! With dt%berryopt=4, one must have optcell==0
3004 : ! if(dt%berryopt==4)then
3005 : ! cond_string(1)='berryopt' ; cond_values(1)=dt%berryopt
3006 : ! call chkint_eq(1,1,cond_string,cond_values,ierr,'optcell',dt%optcell,1,(/0/),iout)
3007 : ! end if
3008 :
3009 : ! optdcmagpawu
3010 6958 : if (dt%usepawu/=0.and.dt%nspden==4) then
3011 25 : call chkint_eq(0,0,cond_string,cond_values,ierr,'optdcmagpawu',dt%optdcmagpawu,3,(/1,2,3/),iout)
3012 : end if
3013 :
3014 : ! Check the value of optdriver
3015 : call chkint_eq(0, 0, cond_string, cond_values, ierr, 'optdriver', optdriver, 12,&
3016 : [RUNL_GSTATE,RUNL_RESPFN,RUNL_SCREENING,RUNL_SIGMA,RUNL_NONLINEAR,RUNL_GWR, RUNL_BSE, &
3017 6958 : RUNL_GWLS, RUNL_WFK,RUNL_EPH,RUNL_LONGWAVE,RUNL_RTTDDFT], iout)
3018 :
3019 6958 : if (response==1.and.all(dt%optdriver/=[RUNL_RESPFN,RUNL_NONLINEAR,RUNL_LONGWAVE])) then
3020 : write(msg,'(a,i3,3a,13(a,i2),4a)' )&
3021 0 : 'The input variable optdriver=',dt%optdriver,ch10,&
3022 0 : 'This is in conflict with the values of the other input variables,',ch10,&
3023 0 : 'rfphon=',dt%rfphon,' rfddk=',dt%rfddk,' rf2_dkdk=',dt%rf2_dkdk,' rf2_dkde=',dt%rf2_dkde,&
3024 0 : ' rfelfd=',dt%rfelfd,' rfmagn=',dt%rfmagn,' rfstrs=',dt%rfstrs,&
3025 0 : ' d3e_pert1_elfd=',dt%d3e_pert1_elfd,' d3e_pert2_elfd=',dt%d3e_pert2_elfd,' d3e_pert3_elfd=',dt%d3e_pert3_elfd,&
3026 0 : ' d3e_pert1_phon=',dt%d3e_pert1_phon,' d3e_pert2_phon=',dt%d3e_pert2_phon,' d3e_pert3_phon=',dt%d3e_pert3_phon,ch10,&
3027 0 : 'Action: check the values of optdriver, rfphon, rfddk, rf2dkdk, rf2dkde, rfelfd, rfmagn, rfstrs,',ch10,&
3028 0 : 'd3e_pert1_elfd, d3e_pert2_elfd, d3e_pert3_elfd, d3e_pert1_phon, d3e_pert2_phon, and d3e_pert3_phon in your input file.'
3029 0 : ABI_ERROR_NOSTOP(msg, ierr)
3030 : end if
3031 27832 : if (response==1 .and. (sum(dt%qptn(:)**2)>tol12 .or. nspden==4) .and. &
3032 : .not.(dt%kptopt==3 .or. dt%kptopt==0 .or. dt%nsym==1 .or. dt%iscf<0)) then
3033 : write(msg,'(a,i3,2a,a,3f16.6,2a,2a,a)' )&
3034 0 : 'The input variable optdriver=',dt%optdriver,' which implies response functions.',ch10,&
3035 0 : 'Also qptn=',dt%qptn(:),' that is non-zero, or one has a calculation with non-collinear magnetism.',ch10,&
3036 0 : 'This requires kptopt 3 (or 0 for expert users) or nsym=1, or non-self-consistent calculation (iscf<0).',ch10,&
3037 0 : 'Set kptopt to 3 to let the code reduce the k with the correct small group of symmetries.'
3038 0 : ABI_ERROR_NOSTOP(msg, ierr)
3039 : end if
3040 27832 : if (response==1 .and. (sum(dt%qptn(:)**2)<tol12 .and. nspden/=4) .and. &
3041 : .not.(dt%kptopt==3 .or. dt%kptopt==0 .or. dt%kptopt==2 .or. dt%nsym==1 .or. dt%iscf<0)) then
3042 : write(msg,'(a,i3,2a,2a,2a,a)' )&
3043 0 : 'The input variable optdriver=',dt%optdriver,' which implies response functions.',ch10,&
3044 0 : 'Also qptn is null, and there is no non-collinear magnetism.',ch10,&
3045 0 : 'This requires kptopt 3 or 2 (or 0 for expert users) or nsym=1, or non-self-consistent calculation (iscf<0).',ch10,&
3046 0 : 'Set kptopt to 2 to let the code reduce the k with the correct small group of symmetries.'
3047 0 : ABI_ERROR_NOSTOP(msg, ierr)
3048 : end if
3049 6958 : if(usepaw==1)then
3050 : ! Is optdriver compatible with PAW?
3051 1180 : cond_string(1)='usepaw' ; cond_values(1)=usepaw
3052 : call chkint_eq(1,1,cond_string,cond_values,ierr,'optdriver',optdriver,9,&
3053 1180 : [RUNL_GSTATE,RUNL_RESPFN,RUNL_SCREENING,RUNL_SIGMA,RUNL_BSE,RUNL_WFK,RUNL_NONLINEAR,RUNL_RTTDDFT,RUNL_GWR],iout)
3054 : end if
3055 :
3056 : ! Linear and Non-linear response calculations
3057 : ! Non-linear response not compatible with spinors
3058 6958 : if(nspinor/=1)then
3059 348 : cond_string(1)='nspinor' ; cond_values(1)=nspinor
3060 348 : call chkint_ne(1,1,cond_string,cond_values,ierr,'optdriver',dt%optdriver,1,(/RUNL_NONLINEAR/),iout)
3061 : end if
3062 : ! Non-linear response only for insulators
3063 6958 : if(dt%occopt/=1 .and. dt%occopt/=2)then
3064 2783 : cond_string(1)='occopt' ; cond_values(1)=dt%occopt
3065 2783 : call chkint_ne(1,1,cond_string,cond_values,ierr,'optdriver',dt%optdriver,2,(/RUNL_NONLINEAR,RUNL_LONGWAVE/),iout)
3066 : end if
3067 : ! Non-linear response not compatible with mkmem=0
3068 6958 : if(dt%mkmem==0)then
3069 0 : cond_string(1)='mkmem' ; cond_values(1)=dt%mkmem
3070 0 : call chkint_ne(1,1,cond_string,cond_values,ierr,'optdriver',dt%optdriver,1,(/RUNL_NONLINEAR/),iout)
3071 : end if
3072 : ! Longwave needs all k-points
3073 6958 : if(dt%kptopt==1 .or. dt%kptopt==4) then
3074 2313 : cond_string(1)='kptopt' ; cond_values(1)=dt%kptopt
3075 2313 : call chkint_ne(1,1,cond_string,cond_values,ierr,'optdriver',dt%optdriver,1,(/RUNL_LONGWAVE/),iout)
3076 : end if
3077 :
3078 : ! dkdk and dkde non-linear response only for occopt=1 (insulators)
3079 6958 : if (dt%rf2_dkdk==1 .or. dt%rf2_dkdk==2 .or. dt%rf2_dkdk==3) then
3080 18 : cond_string(1)='rf2_dkdk' ; cond_values(1)=dt%rf2_dkdk
3081 18 : call chkint_eq(1,1,cond_string,cond_values,ierr,'occopt',dt%occopt,1,(/1/),iout)
3082 : end if
3083 6958 : if (dt%rf2_dkdk/=0) then
3084 18 : cond_string(1)='rf2_dkdk' ; cond_values(1)=dt%rf2_dkdk
3085 18 : call chkint_eq(1,1,cond_string,cond_values,ierr,'useylm',dt%useylm,1,(/1/),iout)
3086 : end if
3087 :
3088 6958 : if (dt%rf2_dkde==1) then
3089 7 : cond_string(1)='rf2_dkde' ; cond_values(1)=dt%rf2_dkde
3090 7 : call chkint_eq(1,1,cond_string,cond_values,ierr,'occopt',dt%occopt,1,(/1/),iout)
3091 : end if
3092 6958 : if (dt%rf2_dkde/=0) then
3093 7 : cond_string(1)='rf2_dkde' ; cond_values(1)=dt%rf2_dkde
3094 7 : call chkint_eq(1,1,cond_string,cond_values,ierr,'useylm',dt%useylm,1,(/1/),iout)
3095 : end if
3096 :
3097 : ! PEAD non-linear response only for occopt=1 (insulators)
3098 6958 : if(dt%usepead==0.and.dt%optdriver==RUNL_NONLINEAR)then
3099 7 : cond_string(1)='usepead' ; cond_values(1)=dt%usepead
3100 7 : cond_string(2)='optdriver' ; cond_values(2)=dt%optdriver
3101 7 : call chkint_eq(1,2,cond_string,cond_values,ierr,'occopt',dt%occopt,1,(/1/),iout)
3102 : end if
3103 : ! PAW non-linear response only with DFPT (PEAD not allowed)
3104 6958 : if(usepaw==1.and.dt%optdriver==RUNL_NONLINEAR)then
3105 4 : cond_string(1)='usepaw' ; cond_values(1)=usepaw
3106 4 : cond_string(2)='optdriver' ; cond_values(2)=dt%optdriver
3107 4 : call chkint_eq(1,2,cond_string,cond_values,ierr,'usepead',dt%usepead,1,(/0/),iout)
3108 4 : cond_string(1)='usepaw' ; cond_values(1)=usepaw
3109 4 : cond_string(2)='optdriver' ; cond_values(2)=dt%optdriver
3110 4 : call chkint_eq(1,2,cond_string,cond_values,ierr,'pawxcdev',dt%pawxcdev,1,(/0/),iout)
3111 : end if
3112 : ! Non-linear response not compatible with autoparal
3113 6958 : if(dt%optdriver==RUNL_NONLINEAR)then
3114 28 : cond_string(1)='optdriver' ; cond_values(1)=dt%optdriver
3115 28 : call chkint_eq(1,1,cond_string,cond_values,ierr,'autoparal',dt%autoparal,1,(/0/),iout)
3116 : end if
3117 : ! !Linear Response function only for LDA/GGA
3118 : ! allowed=((xc_is_lda.or.xc_is_gga.or.dt%ixc==0).and.dt%ixc/=50)
3119 : ! if(.not.allowed)then
3120 : ! cond_string(1)='ixc' ; cond_values(1)=dt%ixc
3121 : ! call chkint_ne(1,1,cond_string,cond_values,ierr,'optdriver',dt%optdriver,1,(/RUNL_RESPFN/),iout)
3122 : ! end if
3123 : !PAW+Linear Response+GGA function restricted to pawxcdev=0
3124 : !PAW+response_to_strain only allowed for LDA
3125 6958 : if (dt%usepaw==1.and.dt%optdriver==RUNL_RESPFN) then
3126 112 : if( xc_is_gga.and. &
3127 : (dt%rfphon/=0.or.dt%rfelfd==1.or.dt%rfelfd==3.or.dt%rfstrs/=0.or.dt%rf2_dkde/=0) ) then
3128 6 : if (dt%pawxcdev/=0)then
3129 : write(msg,'(7a)' )&
3130 0 : 'You are performing a DFPT+PAW calculation using a GGA XC functional:',ch10,&
3131 0 : ' This is restricted to pawxcdev = 0!',ch10,&
3132 0 : ' Action: change pawxcdev value in your input file!',ch10,&
3133 0 : ' and be careful to run the preparatory Ground-State calculations also with pawxcdev = 0!'
3134 0 : ABI_ERROR_NOSTOP(msg, ierr)
3135 : else
3136 : write(msg,'(5a)' )&
3137 6 : 'You are performing a DFPT+PAW calculation using a GGA XC functional:',ch10,&
3138 6 : ' - This is restricted to pawxcdev = 0!',ch10,&
3139 12 : ' - Be careful to run the preparatory Ground-State calculations also with pawxcdev = 0!'
3140 6 : ABI_WARNING(msg)
3141 : end if
3142 6 : if (dt%rfstrs/=0) then
3143 : write(msg,'(3a)' )&
3144 0 : 'You are performing a DFPT+PAW calculation using a GGA XC functional:',ch10,&
3145 0 : ' Response to strain perturbation is not yet available!'
3146 0 : ABI_ERROR_NOSTOP(msg, ierr)
3147 : end if
3148 : end if
3149 : end if
3150 : !PAW+mGGA function restricted to pawxcdev=0
3151 6958 : if (dt%usepaw==1.and.xc_is_mgga.and.dt%pawxcdev/=0) then
3152 : write(msg,'(5a)' ) &
3153 0 : 'You are performing a PAW calculation using a meta-GGA XC functional:',ch10,&
3154 0 : ' This is restricted to pawxcdev = 0!',ch10,&
3155 0 : ' Action: change pawxcdev value in your input file!'
3156 0 : ABI_ERROR_NOSTOP(msg, ierr)
3157 : end if
3158 : !Non linear Response function only for LDA (restricted to ixc=3/7/8)
3159 6958 : allowed=((xc_is_lda.and.dt%ixc<0).or.dt%ixc==0.or.dt%ixc==3.or.dt%ixc==7.or.dt%ixc==8)
3160 : if(.not.allowed)then
3161 5444 : cond_string(1)='ixc' ; cond_values(1)=dt%ixc
3162 5444 : call chkint_ne(1,1,cond_string,cond_values,ierr,'optdriver',dt%optdriver,1,(/RUNL_NONLINEAR/),iout)
3163 : end if
3164 : !Longwave not compatible with spinors
3165 6958 : if(nspinor/=1.and.dt%timdisp==0)then
3166 342 : cond_string(1)='nspinor' ; cond_values(1)=nspinor
3167 342 : call chkint_ne(1,1,cond_string,cond_values,ierr,'optdriver',dt%optdriver,1,(/RUNL_LONGWAVE/),iout)
3168 : end if
3169 : !Longwave calculation only compatible with nonlinear core corrections for quadrupoles and NOA
3170 6958 : if(dt%optdriver==RUNL_LONGWAVE.and.dt%timdisp==0.and.dt%lw_flexo/=0)then
3171 6 : do ipsp=1,npsp
3172 : ! Check that xccc is zero
3173 6 : if (pspheads(ipsp)%xccc/=0) then
3174 : write(msg, '(5a,i0,3a)' )&
3175 0 : 'For a longwave calculation of flexoelectric properties it is not possible',ch10,&
3176 0 : 'to use norm-conserving pseudopotentials with a non-linear core correction.',ch10,&
3177 0 : 'However, for pseudopotential number ',ipsp,', there is such a core correction.',ch10,&
3178 0 : 'Action: change this pseudopotential file.'
3179 0 : ABI_ERROR_NOSTOP(msg, ierr)
3180 : end if
3181 : end do
3182 : end if
3183 : ! Longwave calculation function only for useylm=1
3184 6958 : if(dt%optdriver==RUNL_LONGWAVE.and.dt%useylm/=1.and.(dt%lw_qdrpl/=0.or.dt%lw_flexo/=0))then
3185 : write(msg, '(3a,2a,2a)' )&
3186 0 : 'A longwave calculation can only be run with the input variable useylm/=1',ch10 ,&
3187 0 : 'for lw_natopt=1, while this seems not to be the case in your input,',ch10,&
3188 0 : 'where lw_qdrpl/= and/or lw_flexo/=0.',ch10,&
3189 0 : 'Action: change "useylm" value in your input file.'
3190 0 : ABI_ERROR_NOSTOP(msg, ierr)
3191 : end if
3192 : ! Longwave calculation not compatible with PAW
3193 6958 : if(dt%optdriver==RUNL_LONGWAVE)then
3194 17 : cond_string(1)='optdriver' ; cond_values(1)=dt%optdriver
3195 17 : call chkint_eq(1,1,cond_string,cond_values,ierr,'usepaw',dt%usepaw,1,(/0/),iout)
3196 : endif
3197 : !Longwave calculation not compatible with spin-dependent calculations
3198 6958 : if((dt%nsppol/=1.or.dt%nspden/=1).and.dt%timdisp==0)then
3199 1957 : cond_string(1)='nsppol' ; cond_values(1)=dt%nsppol
3200 1957 : cond_string(2)='nspden' ; cond_values(2)=dt%nspden
3201 1957 : call chkint_ne(1,2,cond_string,cond_values,ierr,'optdriver',dt%optdriver,1,(/RUNL_LONGWAVE/),iout)
3202 : end if
3203 :
3204 : !
3205 :
3206 : ! optforces
3207 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'optforces',dt%optforces,3,(/0,1,2/),iout)
3208 : ! When ionmov>0, optforces must be >0
3209 6958 : if(dt%ionmov>0)then
3210 327 : cond_string(1)='ionmov' ; cond_values(1)=dt%ionmov
3211 327 : call chkint_eq(1,1,cond_string,cond_values,ierr,'optforces',dt%optforces,2,(/1,2/),iout)
3212 : end if
3213 : ! When imgmov>0, optforces must be >0
3214 6958 : if(dt%imgmov>0)then
3215 43 : cond_string(1)='imgmov' ; cond_values(1)=dt%imgmov
3216 43 : call chkint_eq(1,1,cond_string,cond_values,ierr,'optforces',dt%optforces,2,(/1,2/),iout)
3217 : end if
3218 : ! When iscf=22, optforces must be 0 or 2
3219 6958 : if(dt%iscf==22)then
3220 0 : cond_string(1)='iscf' ; cond_values(1)=dt%iscf
3221 0 : call chkint_eq(1,1,cond_string,cond_values,ierr,'optforces',dt%optforces,2,(/0,2/),iout)
3222 : end if
3223 : ! When usedmft=1, optforces must be 0
3224 6958 : if(dt%usedmft==1.or.dt%usedmft==10)then
3225 43 : cond_string(1)='usedmft' ; cond_values(1)=dt%usedmft
3226 43 : call chkint_eq(1,1,cond_string,cond_values,ierr,'optforces',dt%optforces,1,(/0/),iout)
3227 : end if
3228 :
3229 : ! optstress
3230 : ! Por mGGA, optstress not yet allowed (temporary, hopefully)
3231 : ! if(dt%optstress>0.and.xc_is_mgga)then
3232 : ! msg='Computation of stress tensor is not yet implemented for meta-GGA XC functionals!'
3233 : ! ABI_ERROR_NOSTOP(msg, ierr)
3234 : ! end if
3235 : ! When optcell>0, optstress must be >0
3236 6958 : if(dt%optcell>0)then
3237 97 : cond_string(1)='optcell' ; cond_values(1)=dt%optcell
3238 97 : call chkint_eq(1,1,cond_string,cond_values,ierr,'optstress',dt%optstress,1,(/1/),iout)
3239 : end if
3240 : ! TB09 XC functional cannot provide forces/stresses
3241 6958 : if((dt%optforces/=0.or.dt%optstress/=0).and.xc_is_pot_only)then
3242 : write(msg, '(7a)' ) &
3243 0 : 'When the selected XC functional is a potential-only functional (Becke-Johnson or Tran-Blaha),',ch10,&
3244 0 : 'calculations cannot be self-consistent with respect to the total energy.',ch10,&
3245 0 : 'For that reason, neither forces nor stresses can be computed.',ch10,&
3246 0 : 'You should set optforces and optstress to 0!'
3247 0 : ABI_WARNING(msg)
3248 : end if
3249 :
3250 : ! orbmag
3251 : ! only values of -3..4 are allowed. 0 is the default.
3252 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'orbmag',dt%orbmag,8,(/-3,-2,-1,0,1,2,3,4/),iout)
3253 6958 : if(dt%orbmag .NE. 0) then
3254 17 : cond_string(1)='orbmag';cond_values(1)=dt%orbmag
3255 : ! only kptopt 3 or 0 are allowed, because ddk cannot use spatial symmetries and
3256 : ! nucdipmom breaks time reversal symmetry
3257 17 : call chkint_eq(1,1,cond_string,cond_values,ierr,'kptopt',dt%kptopt,2,(/0,3/),iout)
3258 : ! only kpt parallelism is allowed at present
3259 17 : call chkint_eq(1,1,cond_string,cond_values,ierr,'paral_kgb',dt%paral_kgb,1,(/0/),iout)
3260 17 : if (dt%usepaw.EQ.1) then
3261 : ! if PAW, require usexcnhat 0
3262 16 : call chkint_eq(1,1,cond_string,cond_values,ierr,'usexcnhat',dt%usexcnhat_orig,1,(/0/),iout)
3263 : ! if PAW, require paral_atom 0
3264 16 : call chkint_eq(1,1,cond_string,cond_values,ierr,'paral_atom',dt%paral_atom,1,(/0/),iout)
3265 : end if
3266 : end if
3267 6958 : if(dt%orbmag .LT. 0) then
3268 : ! berryopt -2 ddk is required
3269 1 : call chkint_eq(1,1,cond_string,cond_values,ierr,'berryopt',dt%berryopt,1,(/-2/),iout)
3270 : end if
3271 6958 : if((dt%orbmag.GT.0).AND.(dt%rfddk.NE.1).AND.(dt%rfelfd.LT.2)) then
3272 : write(msg, '(3a)' )&
3273 0 : 'Positive values of orbmag require DFPT DDK wavefunctions',ch10,&
3274 0 : 'Action: rerun calculation using rfddk 1 or rfelfd 2.'
3275 0 : ABI_ERROR_NOSTOP(msg, ierr)
3276 : end if
3277 :
3278 : ! paral_atom
3279 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'paral_atom',dt%paral_atom,2,(/0,1/),iout)
3280 6958 : if (dt%paral_atom/=0) then
3281 474 : if (dt%optdriver/=RUNL_GSTATE.and.dt%optdriver/=RUNL_RESPFN) then
3282 : write(msg, '(5a)' )&
3283 0 : 'Parallelisation over atoms is only compatible with',ch10,&
3284 0 : 'ground-state or response function calculations !',ch10,&
3285 0 : 'Action: change paral_atom in input file.'
3286 0 : ABI_ERROR_NOSTOP(msg, ierr)
3287 : end if
3288 474 : if (dt%optdriver==RUNL_NONLINEAR) then
3289 0 : cond_string(1)='optdriver' ; cond_values(1)=dt%optdriver
3290 0 : call chkint_eq(1,1,cond_string,cond_values,ierr,'paral_atom',dt%paral_atom,1,(/0/),iout)
3291 : end if
3292 474 : if (dt%usedmft==1.or.dt%usedmft==10) then
3293 0 : cond_string(1)='usedmft' ; cond_values(1)=dt%usedmft
3294 0 : call chkint_eq(1,1,cond_string,cond_values,ierr,'paral_atom',dt%paral_atom,1,(/0/),iout)
3295 : end if
3296 474 : if (dt%prtden>1.and.dt%paral_kgb==0) then
3297 0 : cond_string(1)='paral_kgb' ; cond_values(1)=dt%paral_kgb
3298 0 : cond_string(2)='prtden' ; cond_values(2)=dt%prtden
3299 0 : call chkint_eq(1,2,cond_string,cond_values,ierr,'paral_atom',dt%paral_atom,1,(/0/),iout)
3300 : end if
3301 : end if
3302 :
3303 : ! paral_kgb
3304 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'paral_kgb',dt%paral_kgb,2,(/0,1/),iout)
3305 : ! Warning
3306 6958 : if(dt%paral_kgb==1.and.dt%iomode/=IO_MODE_MPI) then
3307 : write(msg,'(11a)' )&
3308 596 : 'When k-points/bands/FFT parallelism is activated',ch10,&
3309 596 : '(paral_kgb=1), only MPI-IO input/output is allowed !',ch10,&
3310 596 : 'iomode/=1 in your input file',ch10,&
3311 1192 : 'You will not be able to perform input/output !'
3312 596 : ABI_WARNING(msg)
3313 : end if
3314 :
3315 6958 : if(dt%paral_kgb==1.and.dt%nstep==0) then
3316 0 : ABI_ERROR_NOSTOP('When k-points/bands/FFT parallelism is activated, nstep=0 is not allowed!', ierr)
3317 : end if
3318 6958 : if(dt%paral_kgb==1.and.dt%usefock>0) then
3319 0 : ABI_ERROR_NOSTOP('Hartree-Fock or Hybrid Functionals are not compatible with bands/FFT parallelism!', ierr)
3320 : end if
3321 6958 : if(dt%chkparal/=0.and.(dt%paral_kgb/=0.and.(dt%optdriver/=RUNL_GSTATE .and. dt%optdriver/=RUNL_GWLS .and. &
3322 : dt%optdriver/=RUNL_RTTDDFT))) then
3323 0 : cond_string(1)='optdriver' ; cond_values(1)=dt%optdriver
3324 0 : cond_string(2)='chkparal' ; cond_values(2)=dt%chkparal
3325 0 : call chkint_eq(2,2,cond_string,cond_values,ierr,'paral_kgb',dt%paral_kgb,1,(/0/),iout)
3326 : end if
3327 :
3328 : ! paral_rf
3329 6958 : if (response==0 .and. dt%paral_rf/=0) then
3330 : write(msg,'(a,i3,3a,13(a,i2),4a)' )&
3331 0 : 'The input variable optdriver=',dt%optdriver,ch10,&
3332 0 : 'This is in conflict with the values of the other input variables,',ch10,&
3333 0 : 'rfphon=',dt%rfphon,' rfddk=',dt%rfddk,' rf2_dkdk=',dt%rf2_dkdk,' rf2_dkde=',dt%rf2_dkde,&
3334 0 : ' rfelfd=',dt%rfelfd,' rfmagn=',dt%rfmagn,' rfstrs=',dt%rfstrs,&
3335 0 : ' d3e_pert1_elfd=',dt%d3e_pert1_elfd,' d3e_pert2_elfd=',dt%d3e_pert2_elfd,' d3e_pert3_elfd=',dt%d3e_pert3_elfd,&
3336 0 : ' d3e_pert1_phon=',dt%d3e_pert1_phon,' d3e_pert2_phon=',dt%d3e_pert2_phon,' d3e_pert3_phon=',dt%d3e_pert3_phon,ch10,&
3337 0 : 'Action: check the values of optdriver, rfphon, rfddk, rf2dkdk, rf2dkde, rfelfd, rfmagn, rfstrs,',ch10,&
3338 0 : 'd3e_pert1_elfd, d3e_pert2_elfd, d3e_pert3_elfd, d3e_pert1_phon, d3e_pert2_phon, and d3e_pert3_phon in your input file.'
3339 0 : ABI_ERROR_NOSTOP(msg, ierr)
3340 : end if
3341 :
3342 : ! paw_add_core
3343 6958 : if (usepaw==1) then
3344 1180 : call chkint_eq(0,0,cond_string,cond_values,ierr,'paw_add_core',dt%paw_add_core,2,(/0,1/),iout)
3345 2092 : if (dt%paw_add_core==1.and.any(pspheads(1:npsp)%pspcod/=17)) then
3346 : write(msg, '(5a)' )&
3347 0 : 'paw_add_core input variable can only be used PAW datasets in XML format.',ch10,&
3348 0 : 'However one of your PAW atomic dataset is not in PAW-XML format!',ch10,&
3349 0 : 'Action: change your pseudopotential file to a PAW-XML one '
3350 0 : ABI_ERROR_NOSTOP(msg,ierr)
3351 : end if
3352 : endif
3353 :
3354 : ! pawcpxocc
3355 6958 : if (usepaw==1) then
3356 1180 : call chkint_eq(0,0,cond_string,cond_values,ierr,'pawcpxocc',dt%pawcpxocc,2,(/1,2/),iout)
3357 1180 : if (dt%usepawu/=0.and.nspinor==2.and.dt%pawcpxocc==1) then
3358 : write(msg, '(5a)' )&
3359 0 : 'When non-collinear magnetism is activated ,',ch10,&
3360 0 : 'and DFT+U activated ',ch10,&
3361 0 : 'PAW occupancies must be complex !'
3362 0 : ABI_ERROR_NOSTOP(msg, ierr)
3363 1180 : else if (dt%pawspnorb==1.and.(dt%kptopt==0.or.dt%kptopt>=3).and.dt%pawcpxocc==1) then
3364 1 : if (optdriver==RUNL_GSTATE.and.dt%iscf<10) then
3365 : write(msg, '(11a)' )&
3366 0 : 'When spin-orbit coupling is activated (pawspnorb=1),',ch10,&
3367 0 : 'and time-reversal symmetry is broken (kptopt/=1 and kptopt/=2)',ch10,&
3368 0 : 'PAW occupancies are complex !',ch10,&
3369 0 : 'Their imaginary part is used to evaluate total energy by direct',ch10,&
3370 0 : 'scheme, needed here because SCF potential mixing has been chosen (iscf<10).',ch10,&
3371 0 : 'Action: put pawcpxocc=2 in input file, or choose SCF density mixing (iscf>=10).'
3372 0 : ABI_ERROR_NOSTOP(msg, ierr)
3373 1 : else if (optdriver==RUNL_GSTATE.and.dt%iscf>=10) then
3374 : write(msg, '(11a)' )&
3375 1 : 'When spin-orbit coupling is activated (pawspnorb=1),',ch10,&
3376 1 : 'and time-reversal symmetry is broken (kptopt/=1 and kptopt/=2)',ch10,&
3377 1 : 'PAW occupancies are complex !',ch10,&
3378 1 : 'By setting pawcpxocc=1 in input file, their imaginary part',ch10,&
3379 1 : 'is not computed. As a consequence, total energy computed',ch10,&
3380 2 : 'is not available. Put pawcpxocc=2 in input file if you want it.'
3381 1 : ABI_WARNING(msg)
3382 : else
3383 : write(msg, '(11a)' )&
3384 0 : 'When spin-orbit coupling is activated (pawspnorb=1),',ch10,&
3385 0 : 'and time-reversal symmetry is broken (kptopt/=1 and kptopt/=2)',ch10,&
3386 0 : 'PAW occupancies are complex !',ch10,&
3387 0 : 'Action: put pawcpxocc=2 in input file to compute their imaginary part.'
3388 0 : ABI_ERROR_NOSTOP(msg, ierr)
3389 : end if
3390 : end if
3391 1180 : if (dt%pawspnorb==1.and.dt%kptopt==0) then
3392 : write(msg, '(7a)' )&
3393 16 : 'When spin-orbit coupling is activated (pawspnorb=1),',ch10,&
3394 16 : 'time-reversal symmetry might be broken.',ch10,&
3395 16 : 'Using kptopt=0 might be risky: if (kx,ky,kz) is present in k-points list,',ch10,&
3396 32 : '(-kx,-ky,-kz) (or equivalent) should also be present.'
3397 16 : ABI_WARNING(msg)
3398 : end if
3399 : end if
3400 :
3401 : ! pawcross
3402 6958 : if (usepaw==1) then
3403 1180 : call chkint_eq(0,0,cond_string,cond_values,ierr,'pawcross',dt%pawcross,2,(/0,1/),iout)
3404 : endif
3405 :
3406 : ! pawfatbnd
3407 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'pawfatbnd',dt%pawfatbnd,3,(/0,1,2/),iout)
3408 6958 : if(usepaw/=1.and.dt%pawfatbnd>1) then
3409 0 : ABI_ERROR_NOSTOP('pawfatbnd without PAW is not possible', ierr)
3410 : end if
3411 6958 : if(dt%prtdosm==1.and.dt%pawfatbnd>0)then
3412 0 : ABI_ERROR_NOSTOP('pawfatbnd>0 and prtdosm=1 are not compatible', ierr)
3413 : end if
3414 : ! for the moment pawfatbnd is not compatible with fft or band parallelization
3415 : !if (dt%pawfatbnd > 0 .and. (dt%npfft > 1 .or. dt%npband > 1)) then
3416 : ! msg = 'pawfatbnd and FFT or band parallelization are not compatible yet. Set pawfatbnd to 0 '
3417 : ! ABI_ERROR_NOSTOP(msg,ierr)
3418 : !end if
3419 :
3420 : ! pawlcutd
3421 6958 : if (usepaw==1) then
3422 1180 : call chkint_ge(0,0,cond_string,cond_values,ierr,'pawlcutd',dt%pawlcutd,0,iout)
3423 : endif
3424 :
3425 : ! pawlmix
3426 6958 : if (usepaw==1) then
3427 1180 : call chkint_ge(0,0,cond_string,cond_values,ierr,'pawlmix',dt%pawlmix,0,iout)
3428 : endif
3429 :
3430 : ! pawmixdg
3431 6958 : if (usepaw==1) then
3432 1180 : if(dt%ionmov==4)then
3433 0 : cond_string(1)='ionmov' ; cond_values(1)=dt%ionmov
3434 0 : call chkint_eq(1,1,cond_string,cond_values,ierr,'pawmixdg',dt%pawmixdg,1,(/1/),iout)
3435 : end if
3436 1180 : if(dt%iscf==5.or.dt%iscf==6.or.dt%iscf==15.or.dt%iscf==16)then
3437 0 : cond_string(1)='iscf' ; cond_values(1)=dt%iscf
3438 0 : call chkint_eq(1,1,cond_string,cond_values,ierr,'pawmixdg',dt%pawmixdg,1,(/1/),iout)
3439 : end if
3440 1180 : if(usewvl==1)then
3441 0 : cond_string(1)='usewvl' ; cond_values(1)=usewvl
3442 0 : call chkint_eq(1,1,cond_string,cond_values,ierr,'pawmixdg',dt%pawmixdg,1,(/1/),iout)
3443 : end if
3444 : end if
3445 :
3446 : ! pawnhatxc
3447 6958 : if (usepaw==1) then
3448 1180 : call chkint_eq(0,0,cond_string,cond_values,ierr,'pawnhatxc',dt%pawnhatxc,2,(/0,1/),iout)
3449 : endif
3450 :
3451 : ! pawnzlm
3452 6958 : if (usepaw==1) then
3453 1180 : call chkint_eq(0,0,cond_string,cond_values,ierr,'pawnzlm',dt%pawnzlm,2,(/0,1/),iout)
3454 : endif
3455 :
3456 : ! pawoptmix
3457 6958 : if (usepaw==1) then
3458 1180 : call chkint_eq(0,0,cond_string,cond_values,ierr,'pawoptmix',dt%pawoptmix,2,(/0,1/),iout)
3459 : endif
3460 :
3461 : ! pawprtdos
3462 6958 : if (usepaw==1) then
3463 1180 : call chkint_eq(0,0,cond_string,cond_values,ierr,'pawprtdos',dt%pawprtdos,3,(/0,1,2/),iout)
3464 : endif
3465 :
3466 : ! pawprtvol
3467 6958 : if (usepaw==1) then
3468 1180 : call chkint_eq(0,0,cond_string,cond_values,ierr,'pawprtvol',dt%pawprtvol,7,(/-3,-2,-1,0,1,2,3/),iout)
3469 : endif
3470 :
3471 : ! pawspnorb
3472 6958 : if (usepaw==1) then
3473 1180 : call chkint_eq(0,0,cond_string,cond_values,ierr,'pawspnorb',dt%pawspnorb,2,(/0,1/),iout)
3474 1180 : if (dt%pawspnorb==1.and.(dt%kptopt==1.or.dt%kptopt==2)) then
3475 : write(msg, '(7a)' )&
3476 0 : 'When spin-orbit coupling is activated (pawspnorb=1),',ch10,&
3477 0 : 'time-reversal symmetry is broken; k-points cannot',ch10,&
3478 0 : 'be generated using TR-symmetry.',ch10,&
3479 0 : 'Action: choose kptopt different from 1 or 2.'
3480 0 : ABI_ERROR_NOSTOP(msg, ierr)
3481 : end if
3482 : end if
3483 :
3484 : ! pawstgylm, pawsushat
3485 6958 : if (usepaw==1) then
3486 1180 : call chkint_eq(0,0,cond_string,cond_values,ierr,'pawstgylm',dt%pawstgylm,2,(/0,1/),iout)
3487 1180 : call chkint_eq(0,0,cond_string,cond_values,ierr,'pawsushat',dt%pawstgylm,2,(/0,1/),iout)
3488 : end if
3489 :
3490 : ! pawusecp
3491 6958 : if (usepaw==1) then
3492 1180 : call chkint_eq(0,0,cond_string,cond_values,ierr,'pawusecp',dt%pawusecp,2,(/0,1/),iout)
3493 : ! if (dt%mkmem/=0)then
3494 : ! cond_string(1)='mkmem' ; cond_values(1)=dt%mkmem
3495 : ! call chkint_eq(1,1,cond_string,cond_values,ierr,'pawusecp',dt%pawusecp,1,(/1/),iout)
3496 : ! end if
3497 : ! if (dt%mk1mem/=0)then
3498 : ! cond_string(1)='mk1mem' ; cond_values(1)=dt%mk1mem
3499 : ! call chkint_eq(1,1,cond_string,cond_values,ierr,'pawusecp',dt%pawusecp,1,(/1/),iout)
3500 : ! end if
3501 : ! if (dt%mkqmem/=0)then
3502 : ! cond_string(1)='mkqmem' ; cond_values(1)=dt%mkqmem
3503 : ! call chkint_eq(1,1,cond_string,cond_values,ierr,'pawusecp',dt%pawusecp,1,(/1/),iout)
3504 : ! end if
3505 : end if
3506 :
3507 : ! pawxcdev
3508 6958 : if (usepaw==1) then
3509 1180 : call chkint_eq(0,0,cond_string,cond_values,ierr,'pawxcdev',dt%pawxcdev,3,(/0,1,2/),iout)
3510 : endif
3511 :
3512 : ! pimass
3513 : ! Check that masses are > 0 if imgmov = 9 or 13
3514 6958 : if (dt%imgmov==9.or.dt%imgmov==13) then
3515 14 : do itypat=1,dt%ntypat
3516 7 : cond_string(1)='imgmov' ; cond_values(1)=dt%imgmov
3517 7 : write(input_name,'(a4,i1,a1)')'pimass(',itypat,')'
3518 14 : call chkdpr(1,1,cond_string,cond_values,ierr,input_name,dt%pimass(itypat),1,tol8,iout)
3519 : end do
3520 : end if
3521 :
3522 : ! pimd_constraint
3523 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'pimd_constraint',dt%pimd_constraint,2,(/0,1/),iout)
3524 6958 : if(dt%pimd_constraint==1.and.dt%nconeq>1 )then
3525 0 : cond_string(1)='pimd_constraint' ; cond_values(1)=dt%pimd_constraint
3526 : ! Make sure that nconeq=1
3527 0 : call chkint_eq(1,1,cond_string,cond_values,ierr,'nconeq',dt%nconeq,1,(/1/),iout)
3528 : end if
3529 :
3530 : ! pitransform
3531 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'pitransform',dt%pitransform,3,(/0,1,2/),iout)
3532 : ! When imgmov is not one of 9 or 13, pitransform must be 0
3533 6958 : if(dt%imgmov/=9 .and. dt%imgmov/=13 )then
3534 6951 : cond_string(1)='imgmov' ; cond_values(1)=dt%imgmov
3535 : ! Make sure that pitransform=0
3536 6951 : call chkint_eq(1,1,cond_string,cond_values,ierr,'pitransform',dt%pitransform,1,(/0/),iout)
3537 : end if
3538 6958 : if(dt%pimd_constraint/=0 )then
3539 1 : cond_string(1)='pimd_constraint' ; cond_values(1)=dt%pimd_constraint
3540 : ! Make sure that pitransform=0
3541 1 : call chkint_eq(1,1,cond_string,cond_values,ierr,'pitransform',dt%pitransform,1,(/0/),iout)
3542 : end if
3543 :
3544 : ! plowan_compute
3545 6958 : cond_string(1)='usepaw' ; cond_values(1)=usepaw
3546 6958 : call chkint_eq(1,1,cond_string,cond_values,ierr,'plowan_compute',dt%plowan_compute,4,(/0,1,2,10/),iout)
3547 6958 : if(dt%plowan_compute>0) then
3548 : ! plowan_bandi/plowan_bandf
3549 : !call chkint_ge(0,0,cond_string,cond_values,ierr,'plowan_bandi',dt%plowan_bandi, 1,iout)
3550 : !call chkint_ge(0,0,cond_string,cond_values,ierr,'plowan_bandf',dt%plowan_bandf,dt%plowan_bandi,iout)
3551 :
3552 : !call chkint_le(0,0,cond_string,cond_values,ierr,'plowan_bandi',dt%plowan_bandi,dt%plowan_bandf,iout)
3553 : !call chkint_le(0,0,cond_string,cond_values,ierr,'plowan_bandi',dt%plowan_bandf,dt%mband ,iout)
3554 :
3555 0 : call chkint_ge(0,0,cond_string,cond_values,ierr,'plowan_natom',dt%plowan_natom, 0,iout)
3556 :
3557 0 : maxplowan_iatom=maxval(dt%plowan_iatom(1:dt%plowan_natom))
3558 0 : minplowan_iatom=minval(dt%plowan_iatom(1:dt%plowan_natom))
3559 0 : call chkint_ge(0,0,cond_string,cond_values,ierr,'plowan_iatom',minplowan_iatom, 1,iout)
3560 0 : call chkint_le(0,0,cond_string,cond_values,ierr,'plowan_iatom',maxplowan_iatom, natom,iout)
3561 :
3562 0 : kk=0
3563 0 : do jj = 1, dt%plowan_natom
3564 0 : do ii = 1, dt%plowan_nbl(jj)
3565 0 : kk=kk+1
3566 0 : cond_string(1)='usepaw' ; cond_values(1)=usepaw
3567 0 : call chkint_eq(1,1,cond_string,cond_values,ierr,'plowan_lcalc',dt%plowan_lcalc(kk),4,(/0,1,2,3/),iout)
3568 : end do
3569 : end do
3570 :
3571 0 : call chkint_ge(0,0,cond_string,cond_values,ierr,'plowan_nt' ,dt%plowan_nt, 0,iout)
3572 0 : cond_string(1)='usepaw' ; cond_values(1)=usepaw
3573 0 : call chkint_eq(1,1,cond_string,cond_values,ierr,'plowan_realspace',dt%plowan_realspace,3,(/0,1,2/),iout)
3574 : end if
3575 :
3576 : ! posdoppler
3577 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'posdoppler',dt%posdoppler,2,(/0,1/),iout)
3578 :
3579 : ! positron
3580 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'positron',dt%positron,7,(/-20,-10,-2,-1,0,1,2/),iout)
3581 6958 : if ((dt%positron==2.or.dt%positron<0).and.(dt%ixcpositron==3.or.dt%ixcpositron==31)) then
3582 0 : if ((dt%ixc<11.or.dt%ixc>17).and.dt%ixc/=23.and.dt%ixc/=26.and.dt%ixc/=27) then
3583 : write(msg, '(7a)' )&
3584 0 : 'For the electronic ground-state calculation in presence of a positron,',ch10,&
3585 0 : 'when GGA is selected for electron-positron correlation (ixcpositron=3 or 31),',ch10,&
3586 0 : 'electron-electron XC must also be GGA !',ch10,&
3587 0 : 'Action: choose another psp file.'
3588 0 : ABI_ERROR_NOSTOP(msg, ierr)
3589 : end if
3590 : end if
3591 6958 : if (dt%positron/=0.and.xc_is_mgga) then
3592 0 : msg='Electron-positron calculation is not compatible with meta-GGA XC functional!'
3593 0 : ABI_ERROR_NOSTOP(msg, ierr)
3594 : end if
3595 6958 : if (dt%positron/=0.and.dt%ionmov==5) then
3596 0 : cond_string(1)='ionmov' ; cond_values(1)=dt%ionmov
3597 0 : call chkint_eq(1,1,cond_string,cond_values,ierr,'positron',dt%positron,1,(/0/),iout)
3598 : end if
3599 6958 : if (dt%positron<0.and.usepaw==0) then
3600 : write(msg, '(5a)' )&
3601 0 : 'You cannot use positron<0 (automatic two-component DFT)',ch10,&
3602 0 : 'with norm-conserving pseudopotentials !',ch10,&
3603 0 : 'Action: choose PAW.'
3604 0 : ABI_ERROR_NOSTOP(msg, ierr)
3605 : end if
3606 6958 : if ((dt%positron==1.or.dt%positron<0).and.dt%iscf<10.and.dt%tolvrs>tiny(one)) then
3607 : write(msg, '(7a)' )&
3608 0 : 'You cannot perform a positronic ground-state calculation (positron=1 or <0)',ch10,&
3609 0 : 'using SCF potential mixing (iscf<10) and tolvrs !',ch10,&
3610 0 : '(in that case, the potential is constant)',ch10,&
3611 0 : 'Action: change iscf or select another convergence criterion.'
3612 0 : ABI_ERROR_NOSTOP(msg, ierr)
3613 : end if
3614 :
3615 : ! posocc
3616 6958 : call chkdpr(0,0,cond_string,cond_values,ierr,'posocc',dt%posocc,-1,one,iout)
3617 :
3618 : ! postoldfe, postoldff
3619 6958 : call chkdpr(0,0,cond_string,cond_values,ierr,'postoldff',dt%postoldff,1,zero,iout)
3620 6958 : if (dt%positron<0) then
3621 8 : if ( (abs(dt%postoldfe)> tiny(0.0_dp).and.abs(dt%postoldff)> tiny(0.0_dp)).or.&
3622 8 : (abs(dt%postoldfe)<=tiny(0.0_dp).and.abs(dt%postoldff)<=tiny(0.0_dp))) then
3623 : write(msg,'(5a)' )&
3624 0 : 'One and only one of the input tolerance criteria postoldfe or postoldff',ch10,&
3625 0 : 'must differ from zero !',ch10,&
3626 0 : 'Action: change postoldfe or postldff in input file.'
3627 0 : ABI_ERROR_NOSTOP(msg, ierr)
3628 : end if
3629 8 : if (abs(dt%postoldff)>tiny(0.0_dp).and.dt%optforces/=1)then
3630 : write(msg,'(3a)' )&
3631 0 : 'When postoldff is set to a non-zero value, optforces must be set to 1 !',ch10,&
3632 0 : 'Action: change your input file.'
3633 0 : ABI_ERROR_NOSTOP(msg, ierr)
3634 : end if
3635 : end if
3636 :
3637 : ! prepalw
3638 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'prepalw',dt%prepalw,5,(/0,1,2,3,4/),iout)
3639 :
3640 : ! prepanl
3641 : ! Must have prtden=1 to prepare a nonlinear calculation
3642 6958 : if (dt%prepanl==1.and.(dt%rfelfd/=0.or.dt%rfphon/=0)) then
3643 24 : cond_string(1)='rfelfd' ; cond_values(1)=dt%rfelfd
3644 24 : cond_string(2)='rfphon' ; cond_values(2)=dt%rfphon
3645 24 : cond_string(3)='prepanl' ; cond_values(3)=dt%prepanl
3646 24 : call chkint_eq(1,3,cond_string,cond_values,ierr,'prtden',dt%prtden,1,(/1/),iout)
3647 : end if
3648 :
3649 : ! prtbbb
3650 : ! Not allowed for PAW
3651 6958 : if(usepaw==1.and.dt%prtbbb==1)then
3652 0 : cond_string(1)='usepaw' ; cond_values(1)=usepaw
3653 0 : call chkint_eq(1,1,cond_string,cond_values,ierr,'prtbbb',dt%prtbbb,1,(/0/),iout)
3654 : end if
3655 :
3656 : ! prtden
3657 6958 : if (usepaw==1) then
3658 1180 : call chkint_le(0,0,cond_string,cond_values,ierr,'prtden',dt%prtden,7,iout)
3659 : else
3660 5778 : call chkint_le(0,0,cond_string,cond_values,ierr,'prtden',dt%prtden,1,iout)
3661 : end if
3662 :
3663 : ! prtdensph
3664 6958 : if (usepaw==1) then
3665 1180 : call chkint_eq(0,0,cond_string,cond_values,ierr,'prtdensph',dt%prtdensph,2,(/0,1/),iout)
3666 : endif
3667 :
3668 : ! prt_lorbmag
3669 6958 : if (usepaw==1) call chkint_eq(0,0,cond_string,cond_values,ierr,'prt_lorbmag',dt%prt_lorbmag,2,(/0,1/),iout)
3670 :
3671 : ! prtdos
3672 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'prtdos',dt%prtdos,6,(/0,1,2,3,4,5/),iout)
3673 :
3674 : ! for the moment prtdos 3,4,5 are not compatible with fft or band parallelization
3675 6958 : if (dt%prtdos > 4 .and. (dt%npfft > 1 .or. dt%npband > 1)) then
3676 0 : ABI_ERROR_NOSTOP('prtdos>4 and FFT or band parallelization are not compatible yet. Set prtdos <= 4', ierr)
3677 : end if
3678 :
3679 : ! prtdos 5 only makes sense for nspinor == 2. Otherwise reset to prtdos 2
3680 6958 : if (dt%prtdos == 5 .and. dt%nspinor /= 2) then
3681 0 : dt%prtdos = 2
3682 0 : ABI_WARNING('prtdos==5 is only useful for nspinor 2. Has been reset to 2')
3683 : end if
3684 6958 : if (dt%prtdos == 5 .and. dt%npspinor /= 1) then
3685 0 : ABI_ERROR_NOSTOP('prtdos==5 not available with npspinor==2', ierr)
3686 : end if
3687 : ! Consistency check for prtdos 5 with PAW
3688 6958 : if (dt%prtdos == 5 .and. dt%usepaw == 1) then
3689 0 : if (dt%pawprtdos == 2) then
3690 0 : ABI_ERROR_NOSTOP('prtdos==5 is not compatible with pawprtdos 2', ierr)
3691 : end if
3692 0 : ABI_ERROR_NOSTOP('prtdos==5 is not available with PAW', ierr)
3693 : end if
3694 :
3695 : ! prtdosm
3696 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'prtdosm',dt%prtdosm,3,(/0,1,2/),iout)
3697 6958 : if(usepaw==1.and.dt%pawprtdos==1)then
3698 0 : cond_string(1)='pawprtdos' ; cond_values(1)=dt%pawprtdos
3699 0 : call chkint_eq(1,1,cond_string,cond_values,ierr,'prtdosm',dt%prtdosm,1,(/0/),iout)
3700 : end if
3701 6958 : if(usepaw==1.and.dt%prtdosm>=1)then
3702 1 : cond_string(1)='prtdosm' ; cond_values(1)=dt%prtdosm
3703 1 : call chkint_eq(1,1,cond_string,cond_values,ierr,'prtdos',dt%prtdos,1,(/3/),iout)
3704 : end if
3705 6958 : if(dt%prtdosm==2.and.dt%pawprtdos/=2)then
3706 0 : ABI_ERROR(' pawprtdos/=2 and prtdosm=2 are not compatible')
3707 : end if
3708 :
3709 : ! prtefmas
3710 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'prtefmas',dt%prtefmas,2,(/0,1/),iout)
3711 : !if(optdriver/=RUNL_RESPFN)then
3712 : ! cond_string(1)='optdriver' ; cond_values(1)=optdriver
3713 : ! call chkint_eq(0,1,cond_string,cond_values,ierr,'prtefmas',dt%prtefmas,1,(/0/),iout)
3714 : !end if
3715 :
3716 : ! prtelf
3717 6958 : call chkint_ge(0,0,cond_string,cond_values,ierr,'prtelf',dt%prtkden,0,iout)
3718 6958 : if(optdriver/=RUNL_GSTATE)then
3719 1318 : cond_string(1)='optdriver' ; cond_values(1)=optdriver
3720 1318 : call chkint_eq(0,1,cond_string,cond_values,ierr,'prtelf',dt%prtelf,1,(/0/),iout)
3721 : end if
3722 6958 : if(usepaw/=0)then
3723 1180 : cond_string(1)='usepaw' ; cond_values(1)=usepaw
3724 1180 : call chkint_eq(0,1,cond_string,cond_values,ierr,'prtelf',dt%prtelf,1,(/0/),iout)
3725 : end if
3726 :
3727 : ! prtevk
3728 : ! Not compatible with parallelization over perturbations if netcdf doesn't have MPI
3729 : if (dt%prtevk==1.and.dt%paral_rf==1) then
3730 : #ifndef HAVE_NETCDF_MPI
3731 : write(msg,'(8a)')ch10,&
3732 : 'prtevk=1 (printing of EVK file) is not compatible with parallelization over',ch10, &
3733 : ' perturbations when netCDF/HDF5 is not parallel (MPI)!',ch10,&
3734 : 'Action: suppress parallelization over perturbations (paral_rf)',ch10,&
3735 : ' or link ABINIT with a MPI-compatible netCDF'
3736 : ABI_ERROR_NOSTOP(msg, ierr)
3737 : #endif
3738 : end if
3739 :
3740 : ! prtfsurf only one shift allowed (gamma)
3741 6958 : if (dt%prtfsurf == 1) then
3742 :
3743 2 : if (.not. isdiagmat(dt%kptrlatt)) then
3744 0 : write(msg,'(4a)')ch10,&
3745 0 : 'prtfsurf does not work with non-diagonal kptrlatt ', ch10,&
3746 0 : 'Action: set nshift 1 and shiftk 0 0 0'
3747 0 : ABI_ERROR_NOSTOP(msg, ierr)
3748 : end if
3749 2 : if (dt%nshiftk > 1) then
3750 0 : ABI_ERROR_NOSTOP('prtfsurf does not work with multiple kpt shifts ', ierr)
3751 : end if
3752 10 : if (sum(abs(dt%shiftk(:,1:dt%nshiftk))) > tol8) then
3753 0 : write(msg,'(4a)')ch10,&
3754 0 : 'prtfsurf does not work with non-zero k-shifts ',ch10,&
3755 0 : 'Action: set nshift 1 and shiftk 0 0 0'
3756 0 : ABI_ERROR_NOSTOP(msg, ierr)
3757 : end if
3758 :
3759 : ! Occcupations, Fermi level and k weights have to be calculated correctly.
3760 2 : if (.not.(dt%iscf>1.or.dt%iscf==-3)) then
3761 0 : write(msg,'(4a)')ch10,&
3762 0 : 'prtfsurf==1 requires either iscf>1 or iscf==-3 ',ch10,&
3763 0 : 'Action: change iscf in the input file. '
3764 0 : ABI_ERROR_NOSTOP(msg, ierr)
3765 : end if
3766 :
3767 : ! Make sure all nband are equal (well it is always enforced for metals)
3768 160 : if (any(dt%nband(1:nkpt*nsppol) /= maxval(dt%nband(1:nkpt*nsppol)) )) then
3769 : write(msg,'(3a)')&
3770 0 : 'The number of bands has to be constant for the output of the Fermi surface.',ch10,&
3771 0 : 'Action: set all the nbands to the same value in your input file'
3772 0 : ABI_ERROR_NOSTOP(msg,ierr)
3773 : end if
3774 : end if ! prtfsurf==1
3775 :
3776 : ! prtgden
3777 6958 : call chkint(0,0,cond_string,cond_values,ierr,'prtgden',dt%prtgden,1,(/0/),1,0,iout)
3778 6958 : if(optdriver/=RUNL_GSTATE)then
3779 1318 : cond_string(1)='optdriver' ; cond_values(1)=optdriver
3780 1318 : call chkint(0,1,cond_string,cond_values,ierr,'prtgden',dt%prtgden,1,(/0/),0,0,iout)
3781 : end if
3782 6958 : if(usepaw/=0)then
3783 1180 : cond_string(1)='usepaw' ; cond_values(1)=usepaw
3784 1180 : call chkint(0,1,cond_string,cond_values,ierr,'prtgden',dt%prtgden,1,(/0/),0,0,iout)
3785 : end if
3786 :
3787 : ! prtkden
3788 : ! call chkint_ge(0,0,cond_string,cond_values,ierr,'prtkden',dt%prtkden,0,iout)
3789 : ! if(optdriver/=RUNL_GSTATE)then
3790 : ! cond_string(1)='optdriver' ; cond_values(1)=optdriver
3791 : ! call chkint_eq(0,1,cond_string,cond_values,ierr,'prtkden',dt%prtkden,1,(/0/),iout)
3792 : !end if
3793 : !if(usepaw/=0)then
3794 : ! cond_string(1)='usepaw' ; cond_values(1)=usepaw
3795 : ! call chkint_eq(0,1,cond_string,cond_values,ierr,'prtkden',dt%prtkden,1,(/0/),iout)
3796 : !end if
3797 :
3798 : ! prtlden
3799 6958 : call chkint(0,0,cond_string,cond_values,ierr,'prtlden',dt%prtlden,1,(/0/),1,0,iout)
3800 6958 : if(optdriver/=RUNL_GSTATE)then
3801 1318 : cond_string(1)='optdriver' ; cond_values(1)=optdriver
3802 1318 : call chkint(0,1,cond_string,cond_values,ierr,'prtlden',dt%prtlden,1,(/0/),0,0,iout)
3803 : end if
3804 : !if(usepaw/=0)then
3805 : ! cond_string(1)='usepaw' ; cond_values(1)=usepaw
3806 : ! call chkint(0,1,cond_string,cond_values,ierr,'prtlden',dt%prtlden,1,(/0/),0,0,iout)
3807 : !end if
3808 :
3809 : ! prt1mag
3810 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'prt1mag',dt%prt1mag,3,(/0,1,2/),iout)
3811 :
3812 : ! prtstm
3813 6958 : call chkint_le(0,0,cond_string,cond_values,ierr,'prtstm',dt%prtstm,1,iout)
3814 6958 : call chkint_ge(0,0,cond_string,cond_values,ierr,'prtstm',dt%prtstm,-dt%mband,iout)
3815 6958 : if(optdriver/=RUNL_GSTATE)then
3816 1318 : cond_string(1)='optdriver' ; cond_values(1)=optdriver
3817 1318 : call chkint_eq(0,1,cond_string,cond_values,ierr,'prtstm',dt%prtstm,1,(/0/),iout)
3818 : end if
3819 6958 : if(dt%occopt/=7)then
3820 5051 : cond_string(1)='occopt' ; cond_values(1)=dt%occopt
3821 5051 : call chkint_eq(1,1,cond_string,cond_values,ierr,'prtstm',dt%prtstm,1,(/0/),iout)
3822 : end if
3823 6958 : if(dt%nstep/=1)then
3824 4799 : cond_string(1)='nstep' ; cond_values(1)=dt%nstep
3825 4799 : call chkint_eq(1,1,cond_string,cond_values,ierr,'prtstm',dt%prtstm,1,(/0/),iout)
3826 : end if
3827 6958 : if(dt%ionmov/=0)then
3828 327 : cond_string(1)='ionmov' ; cond_values(1)=dt%ionmov
3829 327 : call chkint_eq(1,1,cond_string,cond_values,ierr,'prtstm',dt%prtstm,1,(/0/),iout)
3830 : end if
3831 : ! tolwfr must be 0 to make a problem (another tol variable is used). Here, check that it is very very small.
3832 6958 : if(abs(dt%tolwfr)<tol16*tol16)then
3833 4861 : cond_string(1)='prtstm' ; cond_values(1)=dt%prtstm
3834 4861 : call chkdpr(1,1,cond_string,cond_values,ierr,'tolwfr',dt%tolwfr,1,tol16*tol16,iout)
3835 : end if
3836 6958 : if(dt%prtden/=0)then
3837 5952 : cond_string(1)='prtden' ; cond_values(1)=dt%prtden
3838 5952 : call chkint_eq(1,1,cond_string,cond_values,ierr,'prtstm',dt%prtstm,1,(/0/),iout)
3839 : end if
3840 :
3841 : ! prtnabla
3842 6958 : if(dt%prtnabla>0)then
3843 52 : cond_string(1)='prtnabla' ; cond_values(1)=dt%prtnabla
3844 52 : call chkint_eq(1,1,cond_string,cond_values,ierr,'prtstm',dt%prtstm,1,(/0/),iout)
3845 52 : if(dt%npspinor>1.and.(dt%prtnabla==1.or.dt%prtnabla==2).and.dt%pawspnorb==1)then
3846 0 : msg='Parallelization over spinorial components not allowed with prtnabla=(1 or 2) and SOC!'
3847 0 : ABI_ERROR_NOSTOP(msg, ierr)
3848 : end if
3849 : end if
3850 :
3851 6958 : if(dt%prtvxc>0)then
3852 58 : cond_string(1)='prtvxc' ; cond_values(1)=dt%prtvxc
3853 58 : call chkint_eq(1,1,cond_string,cond_values,ierr,'prtstm',dt%prtstm,1,(/0/),iout)
3854 : end if
3855 6958 : if(dt%prtvha>0)then
3856 61 : cond_string(1)='prtvha' ; cond_values(1)=dt%prtvha
3857 61 : call chkint_eq(1,1,cond_string,cond_values,ierr,'prtstm',dt%prtstm,1,(/0/),iout)
3858 : end if
3859 6958 : if(dt%prtvhxc>0)then
3860 60 : cond_string(1)='prtvhxc' ; cond_values(1)=dt%prtvhxc
3861 60 : call chkint_eq(1,1,cond_string,cond_values,ierr,'prtstm',dt%prtstm,1,(/0/),iout)
3862 : end if
3863 :
3864 : ! prtvclmb - needs prtvha as well
3865 6958 : if(dt%prtvclmb > 0)then
3866 59 : cond_string(1)='prtvclmb' ; cond_values(1)=dt%prtvclmb
3867 59 : call chkint_eq(1,1,cond_string,cond_values,ierr,'prtvha',dt%prtvha,1,(/1/),iout)
3868 : end if
3869 :
3870 : ! prtvolimg
3871 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'prtvolimg',dt%prtvolimg,3,(/0,1,2/),iout)
3872 :
3873 : ! prtwant
3874 6958 : if (dt%prtwant/=0) then
3875 17 : cond_string(1)='prtwant' ; cond_values(1)=dt%prtwant
3876 : ! wannier function output is not available with paral_kgb algorithm
3877 17 : call chkint_eq(0,0,cond_string,cond_values,ierr,'paral_kgb',dt%paral_kgb,1,(/0/),iout)
3878 : ! wannier function output is not available with PAW
3879 17 : if (usepaw == 1 .and. dt%wfk_task == WFK_TASK_WANNIER) then
3880 : write(msg, '(a,a,a)' )&
3881 0 : ' prtwant does not function with PAW and wfk_task = wannier',ch10,&
3882 0 : ' Action: use norm conserving pseudopotentials'
3883 0 : ABI_ERROR(msg)
3884 : end if
3885 : end if
3886 : #if !defined HAVE_WANNIER90
3887 : if(dt%prtwant==2) then
3888 : write(msg, '(a,a,a)' )&
3889 : ' prtwant==2 is only relevant if wannier90 library is linked',ch10,&
3890 : ' Action: check compilation options'
3891 : ABI_ERROR_NOSTOP(msg,ierr)
3892 : end if
3893 : #endif
3894 :
3895 : ! prtwf
3896 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'prtwf',dt%prtwf,5,[-1,0,1,2,3],iout)
3897 :
3898 6958 : if (dt%prtkbff == 1 .and. dt%useylm /= 0) then
3899 0 : ABI_ERROR_NOSTOP("prtkbff == 1 requires useylm == 0", ierr)
3900 : end if
3901 :
3902 : ! prtwf_full
3903 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'prtwf_full',dt%prtwf_full,2,[0,1],iout)
3904 6958 : if (dt%prtwf==0) then
3905 987 : cond_string(1)='prtwf' ; cond_values(1)=dt%prtwf
3906 987 : call chkint_eq(1,1,cond_string,cond_values,ierr,'prtwf_full',dt%prtwf_full,1,(/0/),iout)
3907 : end if
3908 :
3909 : ! pulayhiststore
3910 : call chkint_eq(0,0,cond_string,cond_values,ierr,'pulayhiststore', &
3911 6958 : & dt%pulayhiststore,2,(/0,1/),iout)
3912 :
3913 : ! random_atpos
3914 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'random_atpos',dt%random_atpos,5,(/0,1,2,3,4/),iout)
3915 :
3916 : ! ratopt
3917 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'ratopt',dt%ratopt,2,(/1,2/),iout)
3918 :
3919 : ! ratsph
3920 : ! If PAW and (prtdos==3 or dt%prtdensph==1), must be greater than PAW radius
3921 6958 : if(usepaw==1.and.(dt%prtdos==3.or.dt%prtdensph==1))then
3922 2956 : do itypat=1,dt%ntypat
3923 8734 : if (pspheads(itypat)%pawheader%rpaw>dt%ratsph(itypat)) then
3924 : write(msg, '(7a,i2,a,f15.12,3a)' )&
3925 0 : 'Projected DOS/density is required in the framework of PAW !',ch10,&
3926 0 : 'The radius of spheres in which DOS/density has to be projected',ch10,&
3927 0 : 'must be greater or equal than the (max.) PAW radius !',ch10,&
3928 0 : 'Rpaw(atom_type ',itypat,')= ',pspheads(itypat)%pawheader%rpaw,' au',ch10,&
3929 0 : 'Action: modify value of ratsph in input file.'
3930 0 : ABI_ERROR_NOSTOP(msg, ierr)
3931 : end if
3932 : end do
3933 : end if
3934 :
3935 : ! rcpaw_frocc
3936 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'rcpaw_frocc',dt%rcpaw_frocc,2,(/0,1/),iout)
3937 :
3938 : ! rcpaw_rctypat
3939 15543 : do itypat=1,dt%ntypat
3940 15543 : call chkint_eq(0,0,cond_string,cond_values,ierr,'rcpaw_rctypat',dt%rcpaw_rctypat(itypat),2,(/0,1/),iout)
3941 : enddo
3942 :
3943 : ! recgratio
3944 6958 : if (dt%tfkinfunc==2) then
3945 6 : write(msg, '(a,a)' ) ch10,'=== RECURSION METHOD ==========================================================='
3946 6 : call wrtout(ab_out,msg)
3947 6 : cond_string(1)='tfkinfunc' ; cond_values(1)=dt%tfkinfunc
3948 6 : call chkint_ge(0,1,cond_string,cond_values,ierr,'recgratio',dt%recgratio,1,iout)
3949 6 : if(dt%recgratio>1) then
3950 1 : write(msg, '(a,a)' )'=== Coarse Grid is used in recursion ==========================================='
3951 1 : call wrtout(ab_out,msg)
3952 1 : write(msg, '(a,i3,a,a,i3,a,i3,a,i3)' ) 'grid ratio =',dt%recgratio,&
3953 2 : ch10,'fine grid = ',dt%ngfft(1),' ',dt%ngfft(2),' ',dt%ngfft(3)
3954 1 : call wrtout(ab_out,msg)
3955 1 : write(msg, '(a,i2,a,i2,a,i2)' ) 'coarse grid = ',&
3956 2 : dt%ngfft(1)/dt%recgratio,' ',dt%ngfft(2)/dt%recgratio,' ',dt%ngfft(3)/dt%recgratio
3957 1 : call wrtout(ab_out,msg)
3958 : else
3959 5 : write(msg, '(a,i2,a,i2,a,i2)' ) 'fine grid = ',dt%ngfft(1),' ',dt%ngfft(2),' ',dt%ngfft(3)
3960 5 : call wrtout(ab_out,msg)
3961 : end if
3962 : end if
3963 :
3964 : ! restartxf
3965 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'restartxf',dt%restartxf,4,(/0,-1,-2,-3/),iout)
3966 :
3967 : ! rfatpol
3968 6958 : call chkint_ge(0,0,cond_string,cond_values,ierr,'rfatpol(1)',dt%rfatpol(1),1,iout)
3969 6958 : cond_string(1)='natom' ; cond_values(1)=natom
3970 6958 : call chkint_le(1,1,cond_string,cond_values,ierr,'rfatpol(2)',dt%rfatpol(2),natom,iout)
3971 :
3972 : ! rfmeth
3973 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'rfmeth',dt%rfmeth,6,(/-3,-2,-1,1,2,3/),iout)
3974 :
3975 : ! rfomega
3976 6958 : if(dt%rfomega/=zero)then
3977 2 : cond_string(1)='rfomega' ; cond_values(1)=dt%rfomega
3978 2 : call chkint_eq(1,1,cond_string,cond_values,ierr,'tim1rev',dt%tim1rev,1,(/0/),iout)
3979 : end if
3980 :
3981 : ! rfeta
3982 6958 : if(dt%rfeta/=zero)then
3983 0 : cond_string(1)='rfeta' ; cond_values(1)=dt%rfeta
3984 0 : call chkint_eq(1,1,cond_string,cond_values,ierr,'tim1rev',dt%tim1rev,1,(/0/),iout)
3985 : end if
3986 :
3987 : ! rprimd
3988 : ! With optcell beyond 4, one has constraints on rprimd.
3989 6958 : cond_string(1)='optcell' ; cond_values(1)=dt%optcell
3990 6958 : if( dt%optcell==7 )then
3991 1 : call chkdpr(1,1,cond_string,cond_values,ierr,'rprimd(1,2)',rprimd(1,2),0,0.0_dp,iout)
3992 1 : call chkdpr(1,1,cond_string,cond_values,ierr,'rprimd(1,3)',rprimd(1,3),0,0.0_dp,iout)
3993 1 : call chkdpr(1,1,cond_string,cond_values,ierr,'rprimd(2,1)',rprimd(2,1),0,0.0_dp,iout)
3994 1 : call chkdpr(1,1,cond_string,cond_values,ierr,'rprimd(3,1)',rprimd(3,1),0,0.0_dp,iout)
3995 6957 : else if( dt%optcell==8 )then
3996 0 : call chkdpr(1,1,cond_string,cond_values,ierr,'rprimd(2,1)',rprimd(2,1),0,0.0_dp,iout)
3997 0 : call chkdpr(1,1,cond_string,cond_values,ierr,'rprimd(2,3)',rprimd(2,3),0,0.0_dp,iout)
3998 0 : call chkdpr(1,1,cond_string,cond_values,ierr,'rprimd(1,2)',rprimd(1,2),0,0.0_dp,iout)
3999 0 : call chkdpr(1,1,cond_string,cond_values,ierr,'rprimd(3,2)',rprimd(3,2),0,0.0_dp,iout)
4000 6957 : else if( dt%optcell==9 )then
4001 1 : call chkdpr(1,1,cond_string,cond_values,ierr,'rprimd(3,1)',rprimd(3,1),0,0.0_dp,iout)
4002 1 : call chkdpr(1,1,cond_string,cond_values,ierr,'rprimd(3,2)',rprimd(3,2),0,0.0_dp,iout)
4003 1 : call chkdpr(1,1,cond_string,cond_values,ierr,'rprimd(1,3)',rprimd(1,3),0,0.0_dp,iout)
4004 1 : call chkdpr(1,1,cond_string,cond_values,ierr,'rprimd(2,3)',rprimd(2,3),0,0.0_dp,iout)
4005 : end if
4006 :
4007 6958 : if (dt%rmm_diis /= 0) then
4008 : ! Check for calculations that are not implemented with RMM-DIIS
4009 30 : ABI_CHECK(dt%usefock == 0, "RMM-DIIS with Hartree-Fock or Hybrid Functionals is not implemented")
4010 30 : ABI_CHECK(dt%wfoptalg /= 1, "RMM-DIIS with Chebyshev is not supported.")
4011 : !ABI_CHECK(dt%gpu_option == ABI_GPU_DISABLED, "RMM-DIIS does not support GPUs.")
4012 210 : berryflag = any(dt%berryopt == [4, 14, 6, 16, 7, 17])
4013 30 : ABI_CHECK(.not. berryflag, "RMM-DIIS with Electric field is not supported.")
4014 : end if
4015 :
4016 : ! so_psp
4017 6958 : if(usepaw==0)then
4018 12607 : do ipsp=1,npsp
4019 : ! Check that so_psp is between 0 and 3
4020 6829 : if ( dt%so_psp(ipsp)<0 .or. dt%so_psp(ipsp)>3 ) then
4021 : write(msg, '(a,i3,a,i3,a,a,a,a,a)' )&
4022 0 : 'so_psp(',ipsp,' ) was input as ',dt%so_psp(ipsp),' .',ch10,&
4023 0 : 'Input value must be 0, 1, 2, or 3.',ch10,&
4024 0 : 'Action: modify value of so_psp (old name: so_typat) in input file.'
4025 0 : ABI_ERROR_NOSTOP(msg, ierr)
4026 : end if
4027 : ! If nspinor=1, the spin-orbit contribution cannot be taken into account
4028 6829 : if ( nspinor==1 .and. (dt%so_psp(ipsp)==2 .or. dt%so_psp(ipsp)==3) ) then
4029 : write(msg, '(a,i2,a,i3,a,a,a,a,a)' )&
4030 0 : 'so_psp(',ipsp,') was input as ',dt%so_psp(ipsp),', with nspinor=1 and usepaw=0.',ch10,&
4031 0 : 'When nspinor=1, so_psp cannot be required to be 2 or 3.',ch10,&
4032 0 : 'Action: modify value of so_psp (old name: so_typat) or nspinor in input file.'
4033 0 : ABI_ERROR_NOSTOP(msg, ierr)
4034 : end if
4035 : ! If nspinor=2, the spin-orbit contribution should be present in the pseudopotentials,
4036 : ! unless the user explicitly allows not to treat it.
4037 12607 : if ( nspinor==2 .and. dt%so_psp(ipsp)/=0 .and. pspheads(ipsp)%pspso==0 ) then
4038 : write(msg, '(2(a,i0),9a)' )&
4039 0 : 'so_psp(',ipsp,') was input as ',dt%so_psp(ipsp),', with nspinor=2 and usepaw=0.',ch10,&
4040 0 : 'This requires a treatment of the spin-orbit interaction. However, it has been detected ',ch10,&
4041 0 : 'that the pseudopotential that you want to use does not specify the spin-orbit coupling.',ch10,&
4042 0 : 'Action: choose a pseudopotential that contains information about the spin-orbit interaction,',ch10,&
4043 0 : 'or deliberately switch off the spin-orbit interaction by setting so_psp=0 for that pseudopotential in the input file.'
4044 0 : ABI_ERROR_NOSTOP(msg, ierr)
4045 : end if
4046 : end do ! ipsp
4047 : end if ! usepaw==0
4048 :
4049 : ! spinat
4050 : ! Not allowed with nspden=1 (PAW)
4051 : !if(any(abs(dt%spinat)>tol8).and.nspden==1.and.usepaw==1) then
4052 : ! write(msg, '(3a)' )&
4053 : ! 'A spinat/=0 is not allowed when magnetization is forced to zero (nspden=1)!',ch10,&
4054 : ! 'Action: re-run with spinat zero '
4055 : ! ABI_ERROR_NOSTOP(msg, ierr)
4056 : !end if
4057 :
4058 : ! prevent the running if the spinat is not 0 0 0 when nspden=1 nsppol=1
4059 137919 : if(any(abs(dt%spinat)>tol8).and.nspden==1.and.nsppol==1) then
4060 : write(msg, '(3a)')&
4061 0 : 'A spinat/=0 is not allowed when nspden=1 and nsppol=1!',ch10,&
4062 0 : 'Action: re-run with spinat zero '
4063 0 : ABI_ERROR_NOSTOP(msg,ierr)
4064 : end if
4065 :
4066 : ! spinaxis: only avaliable for SOC/cDFT/hspinfield
4067 27832 : norm_spinaxis = sqrt(dot_product(dt%spinaxis, dt%spinaxis))
4068 6958 : ABI_CHECK_NOSTOP(norm_spinaxis > tol8, 'Spinaxis must be a non-zero vector', ierr)
4069 6958 : if (dt%nspden == 2) then
4070 20046 : do iatom = 1, dt%natom
4071 : ! use Cartesian spinat for consistency with spinaxis
4072 73028 : norm_spinat = sqrt(dot_product(dt%spinat_cart(:,iatom),dt%spinat_cart(:,iatom)))
4073 18257 : if (norm_spinat < tol8) cycle
4074 70604 : dotval = dot_product(dt%spinat_cart(:,iatom), dt%spinaxis)
4075 19440 : if (abs(abs(dotval) - norm_spinat*norm_spinaxis) > tol8*norm_spinat*norm_spinaxis) then
4076 : write(msg, '(3a)')&
4077 0 : 'In collinear (nspden=2) calculation, spinat (Cartesian) must be parallel to spin quantization axis',ch10,&
4078 0 : 'Action: modify spinat(_cart) or spinaxis in your input file '
4079 0 : ABI_ERROR_NOSTOP(msg,ierr)
4080 : end if
4081 : end do
4082 : end if
4083 :
4084 6958 : if (dt%spinaxis(1)**2 + dt%spinaxis(2)**2 > tol8*tol8 ) then
4085 : if(all(dt%so_psp(1:dt%ntypat)/=1) .and. &
4086 6 : all(abs(dt%hspinfield(:))<tol8) .and. &
4087 : all(dt%constraint_kind(1:dt%ntypat)==0)) then
4088 0 : ABI_WARNING("Spinaxis is defined but no SOC, hspinfield or cDFT is active. spinaxis will not affect the calculation.")
4089 : end if
4090 : end if
4091 :
4092 : ! spinmagntarget
4093 6958 : if(abs(dt%spinmagntarget+99.99d0)>tol8 .and. abs(dt%spinmagntarget)>tol8)then
4094 26 : if(nsppol==1)then
4095 : write(msg, '(a,f8.2,4a)' )&
4096 0 : 'spinmagntarget was input as ',dt%spinmagntarget,ch10,&
4097 0 : 'When nsppol=1, spinmagntarget is required to be 0.0d0 or the default value.',ch10,&
4098 0 : 'Action: modify value spinmagntarget or nsppol in input file.'
4099 0 : ABI_ERROR_NOSTOP(msg, ierr)
4100 : end if
4101 26 : if(optdriver==RUNL_RESPFN)then
4102 : write(msg, '(a,f8.2,8a)' )&
4103 0 : 'spinmagntarget was input as ',dt%spinmagntarget,ch10,&
4104 0 : 'For a response function run, spinmagntarget is required to be 0.0d0 or the default value.',ch10,&
4105 0 : 'A spin-polarized response function calculation for a ferromagnetic insulator needs occopt=0, 1 or 2',ch10,&
4106 0 : 'the default value of spinmagntarget, and explicit definition of occ. ',ch10,&
4107 0 : 'Action: modify spinmagntarget, occopt or nsppol in your input file.'
4108 0 : ABI_ERROR_NOSTOP(msg, ierr)
4109 : end if
4110 26 : if(dt%prtdos==1)then
4111 : write(msg, '(a,f8.2,8a)' )&
4112 0 : 'spinmagntarget was input as ',dt%spinmagntarget,ch10,&
4113 0 : 'When prtdos==1, spinmagntarget is required to be 0.0d0 or the default value.',ch10,&
4114 0 : 'A spin-polarized DOS calculation for a ferromagnetic insulator needs occopt=0, 1 or 2',ch10,&
4115 0 : 'the default value of spinmagntarget, and explicit definition of occ.',ch10,&
4116 0 : 'Action: modify spinmagntarget, occopt or nsppol in your input file.'
4117 0 : ABI_ERROR_NOSTOP(msg, ierr)
4118 : end if
4119 : end if
4120 : ! If nsppol==2 and spinmagntarget==0.0 , suggest to use anti-ferromagnetic capability of ABINIT.
4121 6958 : if(nsppol==2.and.abs(dt%spinmagntarget)<tol8)then
4122 : write(msg,'(a,i3,2a,f7.2,6a)' )&
4123 123 : ' This is a calculation with spin-up and spin-down wavefunctions, ... nsppol=',nsppol,ch10,&
4124 123 : ' in which the target spin-polarization is zero. ... spinmagntarget=',dt%spinmagntarget,ch10,&
4125 123 : ' Tip ... It might be possible that the ground state is either non-spin-polarized, or antiferromagnetic.',ch10,&
4126 123 : ' In the former case, it is advantageous to use nsppol=1 and nspden=1,',ch10,&
4127 246 : ' while in the latter case, it is advantageous to use nsppol=1 and nspden=2.'
4128 123 : call wrtout(iout,msg)
4129 : end if
4130 :
4131 : ! stmbias
4132 6958 : cond_string(1)='prtstm' ; cond_values(1)=dt%prtstm
4133 6958 : if(dt%prtstm/=0)then
4134 : ! If non-zero prtstm, stmbias cannot be zero: test is positive or zero
4135 3 : if(dt%stmbias>-tol10)then
4136 : ! Then, enforce positive
4137 2 : call chkdpr(1,1,cond_string,cond_values,ierr,'stmbias',dt%stmbias,1,2*tol10,iout)
4138 : end if
4139 : else
4140 6955 : call chkdpr(1,1,cond_string,cond_values,ierr,'stmbias',dt%stmbias,0,zero,iout)
4141 : end if
4142 :
4143 : ! string_algo
4144 : call chkint_eq(0,0,cond_string,cond_values,ierr,'string_algo',dt%string_algo,&
4145 20874 : 2, [STRING_ALGO_SIMPLIFIED_EQUAL,STRING_ALGO_SIMPLIFIED_ENERGY],iout)
4146 :
4147 : ! symafm
4148 6958 : if(nsppol==1 .and. nspden==2)then
4149 : ! At least one of the symmetry operations must be antiferromagnetic
4150 1045 : if(minval(dt%symafm(1:dt%nsym))/=-1)then
4151 : write(msg, '(5a)' )&
4152 0 : 'When nsppol==1 and nspden==2, at least one of the symmetry operations',ch10,&
4153 0 : 'must be anti-ferromagnetic (symafm=-1), in order to deduce the spin-down density',ch10,&
4154 0 : 'from the spin-up density.'
4155 0 : call wrtout(iout,msg)
4156 0 : call wrtout(std_out, msg)
4157 : write(msg, '(7a)' ) &
4158 0 : 'However, it is observed that none of the symmetry operations is anti-ferromagnetic.',ch10,&
4159 0 : 'Action: Check the atomic positions, the input variables spinat, symrel, tnons, symafm.',ch10,&
4160 0 : ' In case your system is not antiferromagnetic (it might be ferrimagnetic ...),',ch10,&
4161 0 : ' you must use nsppol=2 with nspden=2 (the latter being the default when nsppol=2).'
4162 0 : ABI_ERROR_NOSTOP(msg,ierr)
4163 : end if
4164 : end if
4165 :
4166 : ! symrel and tnons
4167 : ! Check the point group closure
4168 6958 : call sg_multable(dt%nsym,dt%symafm,dt%symrel,ierrgrp, tnons=dt%tnons, tnons_tol=tol5)
4169 6958 : if (ierrgrp==1) ierr=ierr+1
4170 :
4171 : ! Check the orthogonality of the symmetry operations
4172 : ! (lengths and absolute values of scalar products should be preserved)
4173 6958 : iexit=0
4174 :
4175 6958 : call chkorthsy(gprimd,iexit,dt%nsym,rmet,rprimd,dt%symrel,tol8)
4176 :
4177 : ! symchi
4178 6958 : if (all(dt%symchi /= [0, 1])) then
4179 0 : write(msg, '(a,i0,2a)' )'symchi was input as ',dt%symchi,ch10,'Input value must be 0, 1.'
4180 0 : ABI_ERROR_NOSTOP(msg, ierr)
4181 : end if
4182 :
4183 : ! symsigma
4184 6958 : if (all(dt%symsigma /= [0, 1, -1])) then
4185 : write(msg, '(a,i0,4a)' )&
4186 0 : 'symsigma was input as ',dt%symsigma,ch10,&
4187 0 : 'Input value must be 0, 1, or -1.',ch10,&
4188 0 : 'Action: modify value of symsigma in input file.'
4189 0 : ABI_ERROR_NOSTOP(msg, ierr)
4190 : end if
4191 :
4192 : ! MG now it is possible to perform a GW calculation with non-symmorphic operations if required by the user
4193 : ! tnons
4194 6958 : if (dt%symmorphi==0) then
4195 93 : if(dt%nbandkss/=0)then
4196 0 : do isym=1,dt%nsym
4197 0 : if(sum(dt%tnons(:,isym)**2)>tol6)then
4198 : write(msg, '(3a,i3,a,3f8.4,3a)' )&
4199 0 : 'When nbandkss/=0, all the components of tnons must be zero.',ch10,&
4200 0 : 'However, for the symmetry operation number ',isym,', tnons =',dt%tnons(:,isym),'.',ch10,&
4201 0 : 'Action: use the symmetry finder (nsym=0) with symmorphi==0.'
4202 0 : ABI_ERROR_NOSTOP(msg,ierr)
4203 : end if
4204 : end do
4205 : end if
4206 93 : if (ANY(optdriver == [RUNL_SCREENING, RUNL_SIGMA])) then
4207 331 : do isym=1,dt%nsym
4208 1279 : if (sum(dt%tnons(:,isym)**2)>tol6) then
4209 : write(msg,'(3a,i3,a,3f8.4,3a)')&
4210 0 : 'When optdriver==RUNL_SCREENING or RUNL_SIGMA, all the components of tnons must be zero.',ch10,&
4211 0 : 'However, for the symmetry operation number ',isym,', tnons =',dt%tnons(:,isym),'.',ch10,&
4212 0 : 'Action: use the symmetry finder (nsym=0) with symmorphi==0.'
4213 0 : ABI_ERROR_NOSTOP(msg, ierr)
4214 : end if
4215 : end do
4216 : end if
4217 : end if !of symmorphi
4218 :
4219 : ! tfkinfunc
4220 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'tfwkinfunc',dt%tfkinfunc,5,(/0,1,2,11,12/),iout)
4221 6958 : if(dt%ionmov==4)then
4222 6 : cond_string(1)='ionmov' ; cond_values(1)=dt%ionmov
4223 6 : call chkint_eq(1,1,cond_string,cond_values,ierr,'tkinfunc',dt%tfkinfunc,1,(/0/),iout)
4224 : end if
4225 6958 : if(dt%tfkinfunc==2)then
4226 6 : cond_string(1)='tfkinfunc' ; cond_values(1)=dt%tfkinfunc
4227 6 : call chkint_eq(1,1,cond_string,cond_values,ierr,'useylm',dt%useylm,1,(/1/),iout)
4228 6 : cond_string(1)='prtwf' ; cond_values(1)=dt%prtwf
4229 6 : call chkint_eq(1,1,cond_string,cond_values,ierr,'prtwf',dt%prtwf,1,(/0/),iout)
4230 : end if
4231 :
4232 : ! timdisp
4233 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'timdisp',dt%timdisp,2,(/0,1/),iout)
4234 6958 : if(dt%timdisp/=0)then
4235 6 : cond_string(1)='timdisp' ; cond_values(1)=dt%timdisp
4236 6 : call chkint_eq(1,1,cond_string,cond_values,ierr,'optdriver',dt%optdriver,1,(/RUNL_LONGWAVE/),iout)
4237 : end if
4238 :
4239 : ! tolmxde
4240 6958 : call chkdpr(0,0,cond_string,cond_values,ierr,'tolmxde',dt%tolmxde,1,zero,iout)
4241 :
4242 : ! toldff
4243 6958 : call chkdpr(0,0,cond_string,cond_values,ierr,'toldff',dt%toldff,1,zero,iout)
4244 :
4245 : ! tolimg
4246 6958 : call chkdpr(0,0,cond_string,cond_values,ierr,'tolimg',dt%tolimg,1,zero,iout)
4247 :
4248 : ! tolrde
4249 6958 : call chkdpr(0,0,cond_string,cond_values,ierr,'tolrde',dt%tolrde,1,zero,iout)
4250 :
4251 : ! tolrff
4252 6958 : call chkdpr(0,0,cond_string,cond_values,ierr,'tolrff',dt%tolrff,1,zero,iout)
4253 :
4254 : ! tolwfr
4255 6958 : call chkdpr(0,0,cond_string,cond_values,ierr,'tolwfr',dt%tolwfr,1,zero,iout)
4256 :
4257 : !! tolwfr
4258 6958 : call chkdpr(0,0,cond_string,cond_values,ierr,'toldmag',dt%tolwfr,1,zero,iout)
4259 :
4260 : ! tsmear
4261 6958 : call chkdpr(0,0,cond_string,cond_values,ierr,'tsmear',dt%tsmear,1,zero,iout)
4262 : ! Check that tsmear is non-zero positive for metallic occupation functions
4263 6958 : if(3<=dt%occopt .and. dt%occopt<=9)then
4264 2531 : cond_string(1)='occopt' ; cond_values(1)=dt%occopt
4265 2531 : call chkdpr(1,1,cond_string,cond_values,ierr,'tsmear',dt%tsmear,1,tol8,iout)
4266 : end if
4267 :
4268 : ! ucrpa
4269 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'ucrpa',dt%ucrpa,5,(/0,1,2,3,4/),iout)
4270 6958 : if (dt%ucrpa>=1) then
4271 0 : cond_string(1)='ucrpa' ; cond_values(1)=dt%ucrpa
4272 0 : call chkint_eq(1,1,cond_string,cond_values,ierr,'nspinor',dt%nspinor,1,(/1/),iout)
4273 : end if
4274 :
4275 : ! usedmatpu
4276 6958 : if (usepaw==1.and.dt%usepawu>0) then
4277 142 : cond_string(1)='nstep' ; cond_values(1)=dt%nstep
4278 142 : call chkint_le(1,1,cond_string,cond_values,ierr,'abs(usedmatpu)',abs(dt%usedmatpu),dt%nstep,iout)
4279 : ! lpawu must be constant or -1
4280 142 : if (dt%usedmatpu/=0) then
4281 42 : do itypat=1,dt%ntypat
4282 93 : if (dt%lpawu(itypat)/=-1.and.dt%lpawu(itypat)/=maxval(dt%lpawu(:))) then
4283 : write(msg, '(3a)' )&
4284 0 : 'When usedmatpu/=0 (use of an initial density matrix for DFT+U),',ch10,&
4285 0 : 'lpawu must be equal for all types of atoms on which +U is applied !'
4286 0 : ABI_ERROR_NOSTOP(msg,ierr)
4287 : end if
4288 : end do
4289 : end if
4290 : end if
4291 : !usedmatpu not allowed with experimental usepawu<0
4292 6958 : if (usepaw==1.and.dt%usepawu<0) then
4293 11 : cond_string(1)='usepawu' ; cond_values(1)=dt%usepawu
4294 11 : call chkint_eq(1,1,cond_string,cond_values,ierr,'usedmatpu',dt%usedmatpu,1,(/0/),iout)
4295 : end if
4296 : !usedmatpu only allowed for GS
4297 6958 : if (usepaw==1.and.dt%usedmatpu/=0.and.dt%optdriver/=RUNL_GSTATE) then
4298 0 : ABI_ERROR_NOSTOP('usedmatpu/=0 is only allowed for Ground-State calculations!', ierr)
4299 : end if
4300 :
4301 : ! usedmft
4302 6958 : if (dt%usedmft>0) then
4303 43 : cond_string(1)='usedmft' ; cond_values(1)=dt%usedmft
4304 43 : call chkint_eq(0,1,cond_string,cond_values,ierr,'usedmft',dt%usedmft,3,(/0,1,10/),iout)
4305 43 : if (dt%paral_kgb>0) then
4306 4 : cond_string(1)='usedmft' ; cond_values(1)=dt%usedmft
4307 4 : call chkint_eq(1,1,cond_string,cond_values,ierr,'npspinor',dt%npspinor,1,(/1/),iout)
4308 : end if
4309 : ! call chkint_eq(1,1,cond_string,cond_values,ierr,'paral_kgb',dt%paral_kgb,1,(/0/),iout)
4310 : end if
4311 :
4312 : ! useexexch and lexexch
4313 : ! Local exact-exchange and restrictions
4314 6958 : if(dt%useexexch/=0)then
4315 1 : cond_string(1)='useexexch' ; cond_values(1)=dt%useexexch
4316 1 : call chkint_eq(1,1,cond_string,cond_values,ierr,'useexexch',dt%useexexch,1,(/1/),iout)
4317 1 : call chkint_eq(1,1,cond_string,cond_values,ierr,'usepaw',usepaw,1,(/1/),iout)
4318 1 : call chkint_eq(1,1,cond_string,cond_values,ierr,'pawxcdev',dt%pawxcdev,2,(/1,2/),iout)
4319 1 : call chkint_eq(1,1,cond_string,cond_values,ierr,'ixc',dt%ixc,2,(/11,23/),iout)
4320 3 : do itypat=1,dt%ntypat
4321 2 : cond_string(1)='lexexch' ; cond_values(1)=dt%lexexch(itypat)
4322 3 : call chkint_eq(1,1,cond_string,cond_values,ierr,'lexexch',dt%lexexch(itypat),5,(/-1,0,1,2,3/),iout)
4323 : end do
4324 : end if
4325 :
4326 : ! usefock and restrictions
4327 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'usefock',dt%usefock,2,(/0,1/),iout)
4328 :
4329 6958 : if (dt%use_gemm_nonlop == 1) then
4330 29 : if (dt%useylm /= 1) then
4331 0 : ABI_ERROR_NOSTOP('use_gemm_nonlop requires the input variable "useylm" to be 1',ierr)
4332 : end if
4333 : end if
4334 :
4335 : ! usekden
4336 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'usekden',dt%usekden,2,(/0,1/),iout)
4337 : ! The following test is only a way to practically prevent the usage of mGGA with nspden=4 (not allowed yet),
4338 : ! while allowing to have usekden=1 with nspden=4. Indeed, while mGGA is not allowed for the non-collinear case,
4339 : ! the computation of the kinetic energy density in the non-collinear spin case is working, and there are tests of this ...
4340 : ! What should be done: modify the definition of xclevel, to index differently GGAs and mGGAs, etc, and test on xclevel instead of usekden.
4341 6958 : if(dt%nspden==4 .and. dt%prtkden==0)then
4342 166 : cond_string(1)='nspden' ; cond_values(1)=dt%nspden
4343 166 : cond_string(1)='prtkden' ; cond_values(2)=dt%prtkden
4344 166 : call chkint_eq(1,2,cond_string,cond_values,ierr,'usekden',dt%usekden,1,(/0/),iout)
4345 : endif
4346 6958 : if(dt%usekden==0)then
4347 6882 : cond_string(1)='usekden' ; cond_values(1)=dt%usekden
4348 6882 : call chkint_eq(1,1,cond_string,cond_values,ierr,'prtkden',dt%prtkden,1,(/0/),iout)
4349 6882 : if(xc_need_kden.and.dt%usekden<1)then
4350 : write(msg, '(3a)' )&
4351 0 : 'The functional is a MGGA using kinetic energy density, but the kinetic energy density',ch10, &
4352 0 : 'is not present. Please set "usekden 1" in the input file.'
4353 0 : ABI_ERROR(msg)
4354 : end if
4355 : else if(dt%usekden/=0)then
4356 76 : cond_string(1)='usekden' ; cond_values(1)=dt%usekden
4357 76 : call chkint_eq(1,1,cond_string,cond_values,ierr,'usewvl',usewvl,1,(/0/),iout)
4358 : ! call chkint_eq(1,1,cond_string,cond_values,ierr,'usepaw',usepaw,1,(/0/),iout)
4359 76 : call chkint_eq(1,1,cond_string,cond_values,ierr,'intxc',dt%intxc,1,(/0/),iout)
4360 160 : do ipsp=1,npsp
4361 : ! Check that xccc is zero (NCPP metaGGAs cannot be used at present with non-linear core corrections)
4362 160 : if (pspheads(ipsp)%xccc/=0.and.usepaw==0) then
4363 : write(msg, '(5a,i0,3a)' )&
4364 5 : 'When usekden/=0, it is not possible to use norm-conserving pseudopotentials',ch10,&
4365 5 : 'with a non-linear core correction.',ch10,&
4366 5 : 'However, for pseudopotential number ',ipsp,', there is such a core correction.',ch10,&
4367 10 : 'Action: either set usekden=0 in input file, or change this pseudopotential file.'
4368 : !ABI_ERROR_NOSTOP(msg, ierr)
4369 5 : ABI_WARNING(msg)
4370 : end if
4371 : end do
4372 : end if
4373 :
4374 : ! usepawu and lpawu
4375 : ! PAW+U and restrictions
4376 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'usepawu',dt%usepawu,11,(/-4,-3,-2,-1,0,1,2,3,4,10,14/),iout)
4377 6958 : if(dt%usedmft==1)then
4378 43 : cond_string(1)='usedmft' ; cond_values(1)=dt%usedmft
4379 43 : call chkint_eq(1,1,cond_string,cond_values,ierr,'usepawu',dt%usepawu,2,(/10,14/),iout)
4380 : end if
4381 6958 : if(dt%usedmft==0)then
4382 6915 : cond_string(1)='usedmft' ; cond_values(1)=dt%usedmft
4383 6915 : call chkint_eq(1,1,cond_string,cond_values,ierr,'usepawu',dt%usepawu,9,(/-4,-3,-2,-1,0,1,2,3,4/),iout)
4384 : end if
4385 6958 : if(dt%usepawu/=0)then
4386 153 : cond_string(1)='usepawu' ; cond_values(1)=dt%usepawu
4387 153 : call chkint_eq(1,1,cond_string,cond_values,ierr,'usepaw',dt%usepaw,1,(/1/),iout)
4388 386 : do itypat=1,dt%ntypat
4389 233 : cond_string(1)='lpawu' ; cond_values(1)=dt%lpawu(itypat)
4390 386 : call chkint_eq(1,1,cond_string,cond_values,ierr,'lpawu',dt%lpawu(itypat),5,(/-1,0,1,2,3/),iout)
4391 : end do
4392 153 : if(dt%pawspnorb>0) then
4393 26 : write(msg,'(3a)' ) 'DFT+U+SpinOrbit is still on test ',ch10,'(not yet in production)'
4394 26 : ABI_WARNING(msg)
4395 : end if
4396 : end if
4397 :
4398 : ! usepawu and response: q must be zero
4399 6958 : if(dt%usepawu/=0.and.response==1) then
4400 0 : cond_string(1)='usepawu' ; cond_values(1)=dt%usepawu
4401 0 : call chkdpr(1,1,cond_string,cond_values,ierr,'norm(qpt)',sum(dt%qptn(:)**2),0,zero,iout)
4402 : end if
4403 :
4404 : ! useexexch AND usepawu
4405 : ! Restriction when use together
4406 6958 : if(dt%useexexch/=0.and.dt%usepawu/=0)then
4407 0 : do itypat=1,dt%ntypat
4408 0 : if (dt%lpawu(itypat)/=dt%lexexch(itypat).and.dt%lpawu(itypat)/=-1.and.dt%lexexch(itypat)/=-1) then
4409 : write(msg, '(5a,i2,3a)' )&
4410 0 : 'When PAW+U (usepawu/=0) and local exact-exchange (useexexch/=0)',ch10,&
4411 0 : 'are selected together, they must apply on the same',ch10,&
4412 0 : 'angular momentum (lpawu/=lexexch forbidden, here for typat=',itypat,') !',ch10,&
4413 0 : 'Action: correct your input file.'
4414 0 : ABI_ERROR_NOSTOP(msg,ierr)
4415 : end if
4416 : end do
4417 : end if
4418 :
4419 : ! usedmft/usepawu and lpawu
4420 : ! Restriction when use together
4421 6958 : if((dt%usedmft>0.and.dt%usedmft/=10).or.dt%usepawu/=0)then
4422 153 : nlpawu=0
4423 386 : do itypat=1,dt%ntypat
4424 386 : if (dt%lpawu(itypat)/=-1) then
4425 165 : nlpawu=nlpawu+1
4426 : end if
4427 : end do
4428 153 : if(nlpawu==0) then
4429 : write(msg, '(6a)' )&
4430 0 : 'When DFT+U or DFT+DMFT is used',ch10,&
4431 0 : 'at least one value of lpawu should be different from -1',ch10,&
4432 0 : 'Action: correct your input file.'
4433 0 : ABI_ERROR(msg)
4434 : end if
4435 : end if
4436 :
4437 : ! usepotzero
4438 6958 : if(dt%usepotzero/=0)then
4439 2 : if(dt%iscf<10) then
4440 : write(msg, '(3a)' )&
4441 0 : 'usepotzero can only be used with density mixing (not implemented yet)',ch10,&
4442 0 : 'Action: choose iscf > 10 '
4443 0 : ABI_ERROR_NOSTOP(msg,ierr)
4444 : end if
4445 : end if
4446 :
4447 : ! use_rcpaw
4448 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'use_rcpaw',dt%use_rcpaw,2,(/0,1/),iout)
4449 6958 : if(dt%use_rcpaw==1) then
4450 : if((dt%npfft/=1).or.(dt%occopt<3).or.(dt%occopt>8).or.&
4451 : (dt%stmbias/=zero).or.(dt%spinmagntarget/=-99.99_dp).or.&
4452 : (dt%usewvl==1).or.(dt%positron/=0).or.(dt%icoulomb/=0).or.(dt%iscf<12).or.&
4453 3 : (dt%usepaw/=1).or.(dt%usepawu==1).or.(dt%usedmft==1)) then
4454 0 : ABI_ERROR('RCPAW: work in progress')
4455 : endif
4456 6 : if (any(pspheads(1:npsp)%pspcod/=17)) then
4457 : write(msg, '(5a)' )&
4458 0 : 'Relaxed-core PAW (use_rcpaw=1) can only be used PAW datasets in XML format.',ch10,&
4459 0 : 'However one of your PAW atomic dataset is not in PAW-XML format!',ch10,&
4460 0 : 'Action: change your pseudopotential file to a PAW-XML one '
4461 0 : ABI_ERROR_NOSTOP(msg,ierr)
4462 : end if
4463 : endif
4464 :
4465 : ! usexcnhat
4466 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'usexcnhat',dt%usexcnhat_orig,3,(/-1,0,1/),iout)
4467 :
4468 : ! useylm
4469 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'useylm',dt%useylm,2,(/0,1/),iout)
4470 6958 : if (usepaw==1) then
4471 1180 : cond_string(1)='usepaw' ; cond_values(1)=usepaw
4472 1180 : cond_string(2)='usewvl' ; cond_values(2)=usewvl
4473 1180 : if(usewvl==0) then
4474 1180 : call chkint_eq(1,1,cond_string,cond_values,ierr,'useylm',dt%useylm,1,(/1/),iout)
4475 : else
4476 0 : call chkint_eq(1,1,cond_string,cond_values,ierr,'useylm',dt%useylm,1,(/0/),iout)
4477 : end if
4478 : end if
4479 :
4480 : ! use_slk
4481 6958 : if (dt%paral_kgb==1) then
4482 624 : call chkint_eq(0,0,cond_string,cond_values,ierr,'use_slk',dt%use_slk,2,(/0,1/),iout)
4483 : end if
4484 :
4485 : ! use_oldchi
4486 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'use_oldchi',dt%use_oldchi,2,(/0,1/),iout)
4487 :
4488 : ! vdw_xc
4489 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'vdw_xc',dt%vdw_xc,9,(/0,1,2,5,6,7,10,11,14/),iout)
4490 6958 : if (dt%usepaw==1.and.(.not.(dt%vdw_xc==0.or.dt%vdw_xc==5.or.dt%vdw_xc==6.or.dt%vdw_xc==7))) then
4491 0 : write(msg,'(a,i2,a)')'vdw_xc=',dt%vdw_xc,' is not yet available with Projector Augmented-Wave (PAW) formalism!'
4492 0 : ABI_ERROR_NOSTOP(msg, ierr)
4493 : end if
4494 :
4495 : ! vdw DFT-D2
4496 6958 : if (dt%vdw_xc==5.or.dt%vdw_xc==6.or.dt%vdw_xc==7) then
4497 : ! Only for GS or RF calculations
4498 8 : if(optdriver/=RUNL_GSTATE.and.optdriver/=RUNL_RESPFN) then
4499 0 : cond_string(1)='vdw_xc' ; cond_values(1)=dt%vdw_xc
4500 0 : call chkint_ne(1,1,cond_string,cond_values,ierr,'optdriver',optdriver,2,(/RUNL_GSTATE,RUNL_RESPFN/),iout)
4501 : end if
4502 : ! Restriction for DFT-D2
4503 8 : if (dt%vdw_xc==5) then
4504 : ! Only with PBE, BP86 or BLYP GGA XC
4505 : if(dt%ixc/=11.and.dt%ixc/=-101130.and.dt%ixc/=-130101.and. &
4506 : dt%ixc/=18.and.dt%ixc/=-106131.and.dt%ixc/=-131106.and. &
4507 : dt%ixc/=19.and.dt%ixc/=-106132.and.dt%ixc/=-132106.and. &
4508 1 : dt%ixc/=-202231.and.dt%ixc/=-231202) then
4509 0 : write(msg,'(6a)') ch10,&
4510 0 : 'Van der Waals DFT-D2 correction (vdw_xc=5) only available for the following XC functionals:',ch10,&
4511 0 : ' GGA-PBE, GGA-BLYP, GGA-BP86, mGGA-TPSS',ch10,&
4512 0 : 'Action: change your pseudopotential file.'
4513 0 : call wrtout(std_out,msg)
4514 0 : ierr=ierr+1
4515 : end if
4516 : ! Only for the first 5 lines of the periodic table
4517 2 : do itypat=1,dt%ntypat
4518 2 : if (dt%znucl(itypat)<0.or.dt%znucl(itypat)>54) then
4519 0 : write(msg,'(4a,f5.1,a)') ch10,&
4520 0 : ' chkinp: ERROR -',ch10,&
4521 0 : ' Van der Waals DFT-D2 correction (vdw_xc=5) not available for atom type Z=',dt%znucl(itypat),' !'
4522 0 : call wrtout(std_out,msg)
4523 0 : ierr=ierr+1
4524 : end if
4525 : end do
4526 : end if
4527 : ! Restriction for DFT-D3/DFT-D3(BJ)
4528 8 : if (dt%vdw_xc==6.or.dt%vdw_xc==7) then
4529 : ! Only with PBE, BP86 or BLYP GGA XC
4530 : if(dt%ixc/=11.and.dt%ixc/=-101130.and.dt%ixc/=-130101.and. &
4531 : dt%ixc/=18.and.dt%ixc/=-106131.and.dt%ixc/=-131106.and. &
4532 : dt%ixc/=19.and.dt%ixc/=-106132.and.dt%ixc/=-132106.and. &
4533 : dt%ixc/=-202231.and.dt%ixc/=-231202.and.&
4534 : dt%ixc/=14.and.dt%ixc/=-102130.and.dt%ixc/=-130102.and. &
4535 7 : dt%ixc/=-170.and.dt%ixc/=41.and.dt%ixc/=-406) then
4536 : write(msg,'(a,i0,5a)') &
4537 0 : 'Van der Waals DFT-D correction (vdw_xc=',dt%vdw_xc,') only available for the following XC functionals:',ch10,&
4538 0 : ' GGA-PBE, GGA-BLYP, GGA-BP86, mGGA-TPSS, GGA-RevPBE, PBE0',ch10,&
4539 0 : 'Action: change your pseudopotential file.'
4540 0 : ABI_CHECK_NOSTOP(.False., msg, ierr)
4541 : end if
4542 : ! Only up to chemical species 96
4543 16 : do itypat=1,dt%ntypat
4544 16 : if (dt%znucl(itypat)<0.or.dt%znucl(itypat)>96) then
4545 : write(msg,'(a,i0,1a,f5.1,a)')&
4546 0 : 'Van der Waals DFT-D correction (vdw_xc=',dt%vdw_xc,') not available for atom type Z=',dt%znucl(itypat),' !'
4547 9 : ABI_CHECK_NOSTOP(.False., msg, ierr)
4548 : end if
4549 : end do
4550 : end if
4551 : end if
4552 :
4553 : ! wfoptalg
4554 : ! Must be greater or equal to 0
4555 6958 : call chkint_ge(0,0,cond_string,cond_values,ierr,'wfoptalg',dt%wfoptalg,0,iout)
4556 : ! wfoptalg==0,1,4,10,14,111,112 or 114 if PAW
4557 6958 : if (usepaw==1) then
4558 1180 : cond_string(1)='usepawu' ; cond_values(1)=dt%usepawu
4559 1180 : call chkint_eq(0,1,cond_string,cond_values,ierr,'wfoptalg',dt%wfoptalg,8,(/0,1,4,10,14,111,112,114/),iout)
4560 : end if
4561 : ! wfoptalg/=114 if PAW+Fock
4562 6958 : if (usepaw==1 .and. dt%usefock==1) then
4563 15 : cond_string(1)='usepawu' ; cond_values(1)=dt%usepawu
4564 15 : cond_string(2)='usefock' ; cond_values(2)=dt%usefock
4565 15 : call chkint_ne(1,2,cond_string,cond_values,ierr,'wfoptalg',dt%wfoptalg,1,(/114/),iout)
4566 : end if
4567 :
4568 : ! Check if FFT library supports MPI-FFT.
4569 6958 : if (dt%npfft > 1 .and..not. fftalg_has_mpi(fftalg)) then
4570 0 : write(msg,"(a,i0,a)")"fftalg: ",fftalg," cannot be used in MPI-FFT mode (npfft > 1)"
4571 0 : ABI_ERROR_NOSTOP(msg,ierr)
4572 : end if
4573 :
4574 : ! Chebyshev and Spectrum Slicing
4575 6958 : if(dt%wfoptalg == 1 .or. dt%wfoptalg == 111 .or. dt%wfoptalg == 112) then
4576 208 : if(dt%nspinor > 1 .and. dt%wfoptalg == 1) then
4577 0 : msg='Nspinor > 1 not yet compatible with wfoptalg 1. Use chebfi V2 instead (wfoptalg=111).'
4578 0 : ABI_ERROR_NOSTOP(msg, ierr)
4579 : end if
4580 208 : if(dt%usefock > 0) then
4581 0 : ABI_ERROR_NOSTOP('Fock not yet compatible with wfoptalg 1 (use Fock-level parallelism)', ierr)
4582 : end if
4583 1683 : if(dt%wfoptalg==1.and.maxval(abs(dt%istwfk(1:nkpt))) > 2) then
4584 0 : ABI_ERROR_NOSTOP('Istwfk > 2 not compatible with wfoptalg 1. Use chebfi V2 instead (wfoptalg=111).', ierr)
4585 : end if
4586 208 : if(dt%ecutsm > 0) then
4587 0 : ABI_ERROR_NOSTOP('ecutsm > 0 not yet compatible with wfoptalg 1', ierr)
4588 : end if
4589 : end if
4590 :
4591 : ! np_slk
4592 6958 : call chkint_ge(0,0,cond_string,cond_values,ierr,'np_slk',dt%np_slk,0,iout)
4593 6958 : if (dt%np_slk>0 .and. dt%wfoptalg /= 114 ) then
4594 6499 : if(dt%np_slk <= dt%npfft*dt%npband*dt%npspinor .and. MOD(dt%npfft*dt%npband*dt%npspinor, dt%np_slk) /= 0) then
4595 0 : ABI_ERROR_NOSTOP('np_slk must divide npfft*npband*npspinor.',ierr)
4596 : end if
4597 : end if
4598 : ! slk_rankpp
4599 6958 : call chkint_ge(0,0,cond_string,cond_values,ierr,'slk_rankpp',dt%slk_rankpp,0,iout)
4600 :
4601 : ! wtk
4602 : ! Check that no k point weight is < 0:
4603 120263 : do ikpt=1,nkpt
4604 120263 : if (dt%wtk(ikpt)< -tiny(0.0_dp) ) then
4605 : write(msg, '(a,i5,a,1p,e12.4,a,a,a)' )&
4606 0 : 'At k point number',ikpt,' wtk=',dt%wtk(ikpt),' <0.',ch10,&
4607 0 : 'Action: check wtk in input file. Each wtk must be >=0.'
4608 0 : ABI_ERROR_NOSTOP(msg,ierr)
4609 : end if
4610 : end do
4611 :
4612 : ! w90prtunk
4613 6958 : call chkint_ge(0,0,cond_string,cond_values,ierr,'w90prtunk',dt%w90prtunk,0,iout)
4614 :
4615 : ! xc_denpos
4616 6958 : call chkdpr(0,0,cond_string,cond_values,ierr,'xc_denpos',dt%xc_denpos,1,tiny(one),iout)
4617 :
4618 : ! xc_taupos
4619 : ! Allow for negative value of xc_taupos (to deactivate it)
4620 : ! call chkdpr(0,0,cond_string,cond_values,ierr,'xc_taupos',dt%xc_taupos,1,tiny(one),iout)
4621 :
4622 : ! xc_tb09_c
4623 6958 : call chkdpr(0,0,cond_string,cond_values,ierr,'xc_tb09_c',dt%xc_tb09_c,1,0.0_dp,iout)
4624 : !if (dt%xc_tb09_c>99._dp.and.dt%iscf==22) then
4625 : ! write(msg, '(a,i4,a,i4,a,a,a,a,a,a)' )&
4626 : !& 'TB09 XC functional with variable c is not compatible with ODA mixing (iscf=22)!'
4627 : ! ABI_ERROR_NOSTOP(msg,ierr)
4628 : !end if
4629 :
4630 : ! xred
4631 : ! Check that two atoms are not on top of each other
4632 14176 : do iimage=1,dt%nimage
4633 14176 : if(natom>1)then
4634 17682 : ABI_MALLOC(frac,(3,natom))
4635 43196 : do ia=1,natom
4636 : ! Map reduced coordinate xred(mu,ia) into [0,1)
4637 37302 : frac(1,ia)=dt%xred_orig(1,ia,iimage)-aint(dt%xred_orig(1,ia,iimage))+0.5_dp-sign(0.5_dp,dt%xred_orig(1,ia,iimage))
4638 37302 : frac(2,ia)=dt%xred_orig(2,ia,iimage)-aint(dt%xred_orig(2,ia,iimage))+0.5_dp-sign(0.5_dp,dt%xred_orig(2,ia,iimage))
4639 43196 : frac(3,ia)=dt%xred_orig(3,ia,iimage)-aint(dt%xred_orig(3,ia,iimage))+0.5_dp-sign(0.5_dp,dt%xred_orig(3,ia,iimage))
4640 : end do
4641 37302 : do ia=1,natom-1
4642 398306 : do ib=ia+1,natom
4643 : if (abs(frac(1,ia)-frac(1,ib))<1.0d-6 .and. &
4644 361004 : abs(frac(2,ia)-frac(2,ib))<1.0d-6 .and. &
4645 31408 : abs(frac(3,ia)-frac(3,ib))<1.0d-6 ) then
4646 0 : if(iimage>1)then
4647 0 : write(msg,'(2a,i5)') ch10,' The following was observed for image=',iimage
4648 0 : call wrtout(iout,msg)
4649 0 : call wrtout(std_out,msg)
4650 : end if
4651 : write(msg, '(a,i0,a,i0,6a)') &
4652 0 : 'Atoms number',ia,' and',ib,' are located at the same point',' of the unit cell',ch10,&
4653 0 : '(periodic images are taken into account).',ch10,&
4654 0 : 'Action: change the coordinate of one of these atoms in the input file.'
4655 0 : ABI_ERROR_NOSTOP(msg,ierr)
4656 : end if
4657 : end do
4658 : end do
4659 5894 : ABI_FREE(frac)
4660 : end if
4661 : end do
4662 :
4663 : ! znucl
4664 : ! Check that znucl and znuclpsp agree
4665 15563 : do ipsp=1,npsp
4666 15563 : if (abs(dt%znucl(ipsp)-pspheads(ipsp)%znuclpsp)> tol12 ) then
4667 : write(msg, '(a,i0,a,es12.4,a,a,es12.4,2a)' )&
4668 0 : 'For pseudopotential ',ipsp,' znucl from user input file= ',dt%znucl(ipsp),ch10,&
4669 0 : 'while znucl from pseudopotential file=',pspheads(ipsp)%znuclpsp,ch10,&
4670 0 : 'Action: check znucl in input file, or check psp file. They must agree.'
4671 0 : ABI_ERROR_NOSTOP(msg,ierr)
4672 : end if
4673 : end do
4674 :
4675 : ! ZORA
4676 : ! only values of -3,-2,-1,0,1,2,3 are allowed. 0 is the default.
4677 6958 : call chkint_eq(0,0,cond_string,cond_values,ierr,'zora',dt%zora,7,(/-3,-2,-1,0,1,2,3/),iout)
4678 6958 : if(dt%zora .NE. 0) then
4679 16 : cond_string(1)='zora';cond_values(1)=dt%zora
4680 : ! require PAW
4681 16 : call chkint_eq(1,1,cond_string,cond_values,ierr,'usepaw',dt%usepaw,1,(/1/),iout)
4682 : end if
4683 6958 : if(dt%zora .NE. 0 .and. dt%zora .NE. 1) then
4684 14 : cond_string(1)='zora';cond_values(1)=dt%zora
4685 : ! require nspinor 2
4686 14 : call chkint_eq(1,1,cond_string,cond_values,ierr,'nspinor',dt%nspinor,1,(/2/),iout)
4687 : end if
4688 :
4689 : ! bandFFT
4690 6958 : if(dt%paral_kgb==1.and.dt%optdriver==RUNL_GSTATE) then
4691 588 : if (mod(dt%wfoptalg,10) /= 4 .and. mod(dt%wfoptalg,10) /= 2 .and. mod(dt%wfoptalg,10) /= 1) then
4692 : write(msg,'(a,i0,a,a,a,a)')&
4693 0 : & 'The value of wfoptalg is found to be ',dt%wfoptalg,ch10,&
4694 0 : & 'This is not allowed in the case of band-FFT parallelization.',ch10,&
4695 0 : & 'Action: put wfoptalg = 4, 14 or 112, 114 in your input file'
4696 0 : ABI_ERROR_NOSTOP(msg,ierr)
4697 : end if
4698 : ! Make sure all nband are equal
4699 7460 : if (any(dt%nband(1:nkpt*nsppol) /= maxval(dt%nband(1:nkpt*nsppol)) )) then
4700 : write(msg,'(a,a,a)')&
4701 0 : 'The number of bands have to remain constant in the case of band-FFT parallelization.',ch10,&
4702 0 : 'Action: set all the nbands to the same value in your input file'
4703 0 : ABI_ERROR_NOSTOP(msg,ierr)
4704 : end if
4705 588 : if (dt%mkmem == 0) then
4706 : write(msg,'(a,i0,a,a,a,a)')&
4707 0 : 'The value of mkmem is found to be ',dt%mkmem,ch10,&
4708 0 : 'An out-of-core solution can''t be used in the case of band-FFT parallelization.',ch10,&
4709 0 : 'Action: put mkmem = nkpt in your input file'
4710 0 : ABI_ERROR_NOSTOP(msg,ierr)
4711 : end if
4712 : end if
4713 :
4714 : ! WVL - wavelets checks and limitations
4715 6958 : if(dt%usewvl == 1) then
4716 0 : if (dt%wvl_hgrid <= 0) then
4717 : write(msg,'(a,i0,a,a,a,a)')&
4718 0 : 'The value of wvl_hgrid is found to be ',dt%wvl_hgrid,ch10,&
4719 0 : 'This value is mandatory and must be positive.',ch10,&
4720 0 : 'Action: put wvl_hgrid to a positive value in your input file'
4721 0 : ABI_ERROR_NOSTOP(msg,ierr)
4722 : end if
4723 0 : if (dt%nsym /= 1 .and. dt%icoulomb == 1) then
4724 : write(msg,'(a,i0,a,a,a,a)')&
4725 0 : 'The value of nsym is found to be ',dt%nsym,ch10,&
4726 0 : 'No symmetry operations are allowed for isolated systems.',ch10,&
4727 0 : 'Action: put nsym = 1 in your input file'
4728 0 : ABI_ERROR_NOSTOP(msg,ierr)
4729 : end if
4730 0 : if (dt%optstress > 0) then
4731 : write(msg,'(a,i0,a,a,a,a)')&
4732 0 : 'The value of optstress is found to be ', dt%optstress, ch10,&
4733 0 : 'There is no stress computation available with the wavelet code.',ch10,&
4734 0 : 'Action: put optstress = 0 in your input file'
4735 0 : ABI_ERROR_NOSTOP(msg,ierr)
4736 : end if
4737 0 : if (usepaw == 1) then
4738 0 : ABI_WARNING('WVL+PAW is under development')
4739 : end if
4740 0 : if (dt%nspden > 2) then
4741 : write(msg,'(a,i0,a,a,a,a)')&
4742 0 : 'The value of nspden is found to be ', dt%nspden, ch10, &
4743 0 : 'The wavelet computation is not allowed with non-colinear spin.',ch10,&
4744 0 : 'Action: put nspden = 1 or 2 in your input file'
4745 0 : ABI_ERROR_NOSTOP(msg,ierr)
4746 : end if
4747 0 : if (dt%nspden /= dt%nsppol) then
4748 : write(msg,'(a,i0,2a,i0,2a)')&
4749 0 : 'The value of nspden is found to be ', dt%nspden, ch10, &
4750 0 : 'and the one of nsppol is found to be ', dt%nsppol, ch10, &
4751 0 : 'In wavelet computation, nspden and nsppol must be equal.'
4752 0 : ABI_ERROR_NOSTOP(msg,ierr)
4753 : end if
4754 : ! We check the consistency of occupation, empty bands are not allowed.
4755 0 : if (dt%nsppol == 2) then
4756 0 : mband = dt%nelect
4757 : else
4758 0 : mband = dt%mband
4759 : end if
4760 0 : do iimage=1,dt%nimage
4761 0 : do ii = 1, mband, 1
4762 0 : if (dt%occ_orig(ii,iimage) < tol8 .and. dt%iscf == 0) then
4763 : write(msg,'(a,f7.4,6a)')&
4764 0 : 'One value of occ is found to be ', dt%occ_orig(ii,iimage), ch10, &
4765 0 : 'The direct minimization is not allowed with empty bands.',ch10,&
4766 0 : 'Action: use occopt = 1 for automatic band filling or', ch10, &
4767 0 : 'change occ value in your input file'
4768 0 : ABI_ERROR_NOSTOP(msg,ierr)
4769 : end if
4770 : end do
4771 : enddo
4772 0 : if (npsp /= dt%ntypat) then
4773 0 : write(msg, '(a,a,a,a,I0,a,I0,a,a,a)' ) ch10,&
4774 0 : 'consistency checks failed,', ch10, &
4775 0 : 'dtset%npsp (', npsp, ') /= dtset%ntypat (', dt%ntypat, ').', ch10, &
4776 0 : 'No alchemy pseudo are allowed with wavelets.'
4777 0 : ABI_ERROR_NOSTOP(msg,ierr)
4778 : end if
4779 : end if
4780 :
4781 : ! Test on tolerances (similar tests are performed in scprqt, so keep the two versions in synch)
4782 6958 : if (any(optdriver == [RUNL_GSTATE, RUNL_RESPFN])) then
4783 6356 : ttolwfr=0 ; ttoldff=0 ; ttoldfe=0 ; ttolvrs=0; ttolrff=0; ttoldmag=0
4784 6356 : if(abs(dt%tolwfr)>tiny(zero))ttolwfr=1
4785 6356 : if(abs(dt%toldff)>tiny(zero))ttoldff=1
4786 6356 : if(abs(dt%tolrff)>tiny(zero))ttolrff=1
4787 6356 : if(abs(dt%toldfe)>tiny(zero))ttoldfe=1
4788 6356 : if(abs(dt%tolvrs)>tiny(zero))ttolvrs=1
4789 6356 : if(abs(dt%toldmag)>tiny(zero))ttoldmag=1
4790 :
4791 : ! If non-scf calculations, tolwfr must be defined
4792 6356 : if(ttolwfr /= 1 .and. ((dt%iscf<0 .and. dt%iscf/=-3) .or. dt%rf2_dkdk/=0 .or. dt%rf2_dkde/=0))then
4793 : write(msg,'(a,a,a,es14.6,a,a)')&
4794 0 : 'When iscf < 0 and /= -3, or when rf2_dkdk /= 0 or rf2_dkde /= 0, tolwfr must be strictly',ch10,&
4795 0 : 'positive as this is the only convergence criterion that can be used, while it is: ',dt%tolwfr,ch10,&
4796 0 : 'Action: use tolwfr in your input file and resubmit the job.'
4797 0 : ABI_ERROR_NOSTOP(msg, ierr)
4798 : end if
4799 : ! toldff only allowed when prtfor==1
4800 : !if((ttoldff == 1 .or. ttolrff == 1) .and. dt%prtfor==0 )then
4801 : ! ABI_ERROR_NOSTOP('toldff only allowed when prtfor=1!', ierr)
4802 : !end if
4803 :
4804 : ! If SCF calculations, one and only one of these can differ from zero
4805 6356 : if ( (dt%iscf>0 .or. dt%iscf==-3) .and. &
4806 : & ( (ttolwfr==1.and.ttoldff+ttoldfe+ttolvrs+ttolrff+ttoldmag>1) .or. (ttolwfr==0.and.ttoldff+ttoldfe+ttolvrs+ttolrff+ttoldmag/=1) ) ) then
4807 : write(msg,'(6a,es14.6,a,es14.6,a,es14.6,a,a,es14.6,a,es14.6,a,i0,2a)' )&
4808 0 : 'For the SCF case, one and only one of the input tolerance criteria ',ch10,&
4809 0 : 'toldff, tolrff, toldfe, toldmag or tolvrs ','must differ from zero, while they are',ch10,&
4810 0 : 'toldff=',dt%toldff,', tolrff=',dt%tolrff,', toldfe=',dt%toldfe,ch10,&
4811 0 : 'toldmag=',dt%toldmag,'and tolvrs=',dt%tolvrs,' for idtset: ', idtset, ch10,&
4812 0 : 'Action: change your input file and resubmit the job.'
4813 0 : ABI_ERROR_NOSTOP(msg, ierr)
4814 : end if
4815 :
4816 6356 : if (ttolwfr==1.and.dt%tolwfr_diago>dt%tolwfr) then
4817 : write(msg, '(2a,2(a,es14.6),a)' )&
4818 0 : ' tolwfr_diago cannot be bigger than tolwfr !',ch10,&
4819 0 : ' tolwfr=',dt%tolwfr,' and tolwfr_diago=',dt%tolwfr_diago,&
4820 0 : ' Action: change the value of tolwfr or tolwfr_diago in the input file.'
4821 0 : ABI_ERROR_NOSTOP(msg, ierr)
4822 : end if
4823 :
4824 : end if
4825 :
4826 6958 : if (optdriver == RUNL_GWR) then
4827 0 : msg = "G0W0, HDIAGO, HDIAGO_FULL, RPA_ENERGY, EGEW, EGW0, G0EW, G0V, CC4S, CC4S_FULL, CC4S_FROM_WFK, GAMMA_GW, CHI0"
4828 0 : if (.not. string_in(dt%gwr_task, msg)) then
4829 0 : ABI_ERROR_NOSTOP(sjoin("Invalid gwr_task:`", dt%gwr_task, "`, must be among:", msg), ierr)
4830 : end if
4831 : #ifndef HAVE_LINALG_SCALAPACK
4832 0 : ABI_ERROR("GWR code requires scalapack library")
4833 : #endif
4834 :
4835 : ! Avoid wasting CPUs if nsppol==2.
4836 : !if (dt%nsppol == 2 .and. .not. iseven(nproc) .and. nproc > 1) then
4837 : ! write(msg,'(3a)') "Spin-polarized GW calculations should be run with an even number of processors ",ch10,&
4838 : ! " for achieving an optimal distribution of memory and CPU load. Please change the number of processors."
4839 : ! ABI_ERROR_NOSTOP(msg, ierr)
4840 : !end if
4841 0 : if (dt%usepaw == 1 .and. .not. string_in(dt%gwr_task, "HDIAGO, HDIAGO_FULL, CC4S, CC4S_FULL, CC4S_FROM_WFK")) then
4842 0 : ABI_ERROR_NOSTOP("GWR with PAW not yet implemented", ierr)
4843 : end if
4844 : !if (dt%nshiftk /= 1 .or. any(abs(dt%shiftk(:,1)) > tol6)) then
4845 : ! ABI_ERROR_NOSTOP('GWR requires Gamma-centered k-meshes', ierr)
4846 : !end if
4847 : !if (dt%nspinor == 2 .and. .not. string_in(dt%gwr_task, "HDIAGO, HDIAGO_FULL")) then
4848 : ! ABI_ERROR_NOSTOP('GWR does not support nspinor == 2', ierr)
4849 : !end if
4850 : end if
4851 :
4852 : ! ===========================================================
4853 : ! Write COMMENTs if some combination of input vars look weird
4854 : ! ===========================================================
4855 37024 : if (optdriver == RUNL_EPH .and. dt%dipdip /= 0 .and. any(dt%occopt == [3, 4, 5, 6, 7])) then
4856 31 : ABI_COMMENT("dipdip can be set to 0 in case of metals whereas dipdip 1 should be used in polar materials.")
4857 : end if
4858 :
4859 : ! Check features that are not compatible with the generalized Bloch theorem.
4860 6958 : if (dt%use_gbt /= 0) then
4861 8 : ABI_CHECK_NOSTOP(optdriver == RUNL_GSTATE, 'GBT can only be used in GS calculations', ierr)
4862 8 : ABI_CHECK_NOSTOP(dt%usepaw == 0, 'GBT does not support PAW', ierr)
4863 8 : ABI_CHECK_NOSTOP(dt%paral_kgb == 0, 'GBT does not support paral_kgb 1', ierr)
4864 8 : ABI_CHECK_NOSTOP(dt%wfoptalg == 0, 'GBT is only coded for wfoptalg 0', ierr)
4865 8 : ABI_CHECK_NOSTOP(dt%nsym == 1, 'GBT cannot exploit spatial symmetries, please use nsym 1', ierr)
4866 8 : ABI_CHECK_NOSTOP(dt%kptopt == 4, 'GBT requires kptopt 4', ierr)
4867 8 : ABI_CHECK_NOSTOP(dt%useylm == 0, 'GBT requires useylm 0', ierr)
4868 8 : ABI_CHECK_NOSTOP(dt%gpu_option == ABI_GPU_DISABLED, 'GBT is not compatible with GPUs', ierr)
4869 8 : ABI_CHECK_NOSTOP(dt%nspinor == 2, 'GBT requires nspinor 2', ierr)
4870 8 : ABI_CHECK_NOSTOP(dt%nspden == 4, 'GBT requires nspden 4', ierr)
4871 72 : ABI_CHECK_NOSTOP(all(dt%istwfk(1:nkpt) == 1), 'GBT requires istwfk == 1', ierr)
4872 8 : ABI_CHECK_NOSTOP(dt%usefock == 0, 'GBT with Fock is not coded', ierr)
4873 8 : ABI_CHECK_NOSTOP(.not. xc_is_mgga, 'GBT with meta-GGA is not coded', ierr)
4874 : ! ABI_CHECK_NOSTOP(dt%ionmov == 0, 'GBT and atomic relaxation not tested', ierr)
4875 : ! ABI_CHECK_NOSTOP(dt%optcell == 0, 'GBT and cell relaxation not coded', ierr)
4876 8 : if (all(abs(dt%spinat(1:2, 1:dt%natom)) < tol8)) then
4877 0 : ABI_CHECK_NOSTOP(.False., 'at least one spinat(:,iat) should have non-zero x or y components', ierr)
4878 : end if
4879 8 : if(dt%use_gbt == 1) then
4880 14 : ABI_CHECK_NOSTOP(all(dt%so_psp(1:npsp) == 0), 'use_gbt = 1 requires so_psp == 0', ierr)
4881 : end if
4882 :
4883 : ! in calcdenmagsph we wrap the atoms in the first unit cell assuming the magnetization is periodic
4884 : ! but this is not the case when GBT is used. So make sure all atomic sites are in the first unit cell.
4885 24 : ABI_MALLOC(my_xred, (3, dt%natom))
4886 16 : ABI_MALLOC(xshift, (3, dt%natom))
4887 52 : call wrap2_zero_one(dt%xred_orig(:,1:dt%natom,1), my_xred, xshift)
4888 :
4889 52 : if (any(abs(dt%xred_orig(:,1:dt%natom,1) - my_xred) > tol6)) then
4890 0 : ABI_CHECK_NOSTOP(.False., "GBT requires fractional coordinates to be in the unit cell when computing mx, my!", ierr)
4891 : end if
4892 :
4893 8 : ABI_FREE(my_xred)
4894 8 : ABI_FREE(xshift)
4895 : end if
4896 :
4897 : ! Consistency check for GSTORE input variables.
4898 6958 : if (dt%gstore_kzone == "ibz" .and. dt%gstore_qzone == "ibz") then
4899 0 : ABI_CHECK_NOSTOP(.False., "gstore_kzone and gstore_qzone cannot be both in the 'ibz' ", ierr)
4900 : end if
4901 6958 : if (dt%gstore_use_lgk /= 0 .and. dt%gstore_qzone /= "bz") then
4902 0 : ABI_CHECK_NOSTOP(.False., "when gstore_use_lgk /= 0, gstore_qzone must be 'bz' ", ierr)
4903 : end if
4904 6958 : if (dt%gstore_use_lgq /= 0 .and. dt%gstore_kzone /= "bz") then
4905 0 : ABI_CHECK_NOSTOP(.False., "when gstore_use_lgq /= 0, gstore_kzone must be 'bz' ", ierr)
4906 : end if
4907 6958 : if (dt%gstore_sym /= 0 .and. dt%gstore_sym /= 1 .and. dt%gstore_sym /= 2) then
4908 0 : ABI_CHECK_NOSTOP(.False., "gstore_sym must be 0, 1, or 2 ", ierr)
4909 : end if
4910 6958 : if (dt%gstore_sym /= 0 .and. .not. (dt%gstore_kzone == "bz" .and. dt%gstore_qzone == "bz")) then
4911 6958 : ABI_CHECK_NOSTOP(.False., "gstore_sym /= 0 requires gstore_kzone == 'bz' and gstore_qzone == 'bz' ", ierr)
4912 : end if
4913 : !if (dt%gstore_sym == 2 .and. dt%gstore_use_lgk == 0) then
4914 : ! ABI_CHECK_NOSTOP(.False., "gstore_sym == 2 requires gstore_use_lgk == 1 ", ierr)
4915 : !end if
4916 6958 : if (dt%gstore_sym /= 0 .and. nspinor == 2) then
4917 0 : ABI_CHECK_NOSTOP(.False., "gstore_sym /= 0 is not compatible with nspinor 2 ", ierr)
4918 : end if
4919 :
4920 : ! If molecular dynamics or structural optimization is being done
4921 : ! (dt%ionmov>0), make sure not all atoms are fixed
4922 : ! if (dt%ionmov > 0) then
4923 : ! if (natfix == natom) then
4924 : ! write(msg, '(a,a,a,a,i4,a,i5,a,a,i5,a,a,a,a,a,a)' ) ch10,&
4925 : ! & ' setup1: ERROR -',ch10,&
4926 : ! & ' ionmov is ',dt%ionmov,' and number of fixed atoms is ',natfix,ch10,&
4927 : ! & ' while number of atoms natom is ',natom,'.',ch10,&
4928 : ! & ' Thus all atoms are fixed and option ionmov to move atoms',&
4929 : ! & ' is inconsistent.',ch10,&
4930 : ! & ' Action: change ionmov or natfix and iatfix in input file and resubmit.'
4931 : ! call wrtout(std_out,msg)
4932 : ! ierr = ierr + 1
4933 : ! end if
4934 : ! end if
4935 :
4936 : ! Should check that the symmetry operations are consistent with iatfixx,
4937 : ! iatfixy and iatfixz (diagonal symmetry operations)
4938 :
4939 : ! Should check values of fftalg
4940 :
4941 : ! Must have nqpt=1 for rfphon=1
4942 :
4943 : ! Here ends the checking section **************************************
4944 6958 : call dt%free()
4945 8385 : ierr_dtset(idtset)=ierr
4946 : end do ! idtset
4947 :
4948 9812 : if (maxval(dtsets(:)%usewvl) > 0) then
4949 0 : write(msg,'(4a)') ch10,&
4950 0 : ' Comparison between wvl_hgrid and ecut',ch10,&
4951 0 : ' real-space mesh | eq. Ec around atoms | eq. Ec further from atoms'
4952 0 : ABI_COMMENT(msg)
4953 0 : wvl_hgrid = zero
4954 0 : twvl = .false.
4955 0 : do idtset=1,ndtset_alloc
4956 : ! Give an indication to the equivalent ecut corresponding to given hgrid.
4957 0 : if (dtsets(idtset)%usewvl == 1 .and. wvl_hgrid /= dtsets(idtset)%wvl_hgrid) then
4958 : write(msg,'(F11.3,A,F16.1,A,F16.1,A)') &
4959 0 : dtsets(idtset)%wvl_hgrid, " bohr |", &
4960 0 : two * pi * pi / (dtsets(idtset)%wvl_hgrid ** 2), " Ht | ", &
4961 0 : half * pi * pi / (dtsets(idtset)%wvl_hgrid ** 2), " Ht"
4962 0 : call wrtout(std_out,msg)
4963 0 : wvl_hgrid = dtsets(idtset)%wvl_hgrid
4964 : end if
4965 0 : twvl = twvl .or. (dtsets(idtset)%usewvl == 1 .and. dtsets(idtset)%iomode /= IO_MODE_ETSF)
4966 : end do
4967 0 : if (twvl) then
4968 : write(msg,'(5a)') &
4969 0 : 'Restart files from wavelets in non ETSF format does not follow', ch10, &
4970 0 : 'the ABINIT standards.', ch10, &
4971 0 : 'Set iomode to 3 to use ETSF restart files.'
4972 0 : ABI_WARNING(msg)
4973 : end if
4974 : end if
4975 :
4976 : ! If there was a problem, then stop.
4977 1427 : call xmpi_sum(ierr_dtset, comm, mpierr)
4978 8385 : ierr=sum(ierr_dtset(1:ndtset_alloc)/mpi_enregs(1:ndtset_alloc)%nproc)
4979 :
4980 1427 : if (ierr==1) then
4981 0 : write(msg,'(6a)')ch10,&
4982 0 : 'Checking consistency of input data against itself revealed some problem(s).',ch10,&
4983 0 : 'So, stopping. The details of the problem(s) are given in the error file or the standard output file (= "log" file).',ch10,&
4984 0 : 'In parallel, the details might not even be printed there. Then, try running in sequential to see the details.'
4985 0 : call wrtout(iout,msg)
4986 : write(msg,'(a,i0,5a)')&
4987 0 : 'Checking consistency of input data against itself gave ',ierr,' inconsistency.',ch10,&
4988 0 : 'The details of the problem can be FOUND ABOVE (or in output or log file).',ch10,&
4989 0 : 'In parallel, the details might not even be printed there. Then, try running in sequential to see the details.'
4990 0 : ABI_ERROR(msg)
4991 : end if
4992 1427 : if (ierr > 1) then
4993 : write(msg,'(a,i0,7a)')&
4994 0 : 'Checking consistency of input data against itself gave ',ierr,' inconsistencies.',ch10,&
4995 0 : 'The details of the problems can be FOUND ABOVE (or in output or log file), in an earlier WARNING.',ch10,&
4996 0 : 'In parallel, the details might not even be printed there. Then, try running in sequential to see the details.',ch10,&
4997 0 : "Also, try to run abinit in sequential in dry-run mode with e.g., `abinit INPUT -d` to detect problems in the INPUT."
4998 0 : ABI_ERROR(msg)
4999 : end if
5000 :
5001 1427 : ABI_FREE(ierr_dtset)
5002 :
5003 1427 : if (ndtset_alloc /= 1 .and. get_timelimit() > zero) then
5004 0 : ABI_ERROR("--timelimit option cannot be used when ndtset > 1")
5005 : end if
5006 :
5007 : DBG_EXIT("COLL")
5008 :
5009 2854 : end subroutine chkinp
5010 : !!***
5011 :
5012 : end module m_chkinp
5013 : !!***
|