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