LCOV - code coverage report
Current view: top level - src/57_iovars - m_invars2.F90 (source / functions) Coverage Total Hit
Test: coverage.info Lines: 87.4 % 2916 2549
Test Date: 2026-11-09 23:40:40 Functions: 100.0 % 2 2
Branches: 73.8 % 3824 2823

             Branch data     Line data    Source code
       1                 :             : !!****m* ABINIT/m_invars2
       2                 :             : !! NAME
       3                 :             : !!  m_invars2
       4                 :             : !!
       5                 :             : !! FUNCTION
       6                 :             : !!
       7                 :             : !!
       8                 :             : !! COPYRIGHT
       9                 :             : !!  Copyright (C) 1999-2026 ABINIT group (XG)
      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_invars2
      23                 :             : 
      24                 :             :  use defs_basis
      25                 :             :  use m_abicore
      26                 :             :  use m_errors
      27                 :             :  use m_xmpi
      28                 :             :  use m_nctk
      29                 :             :  use m_sort
      30                 :             :  use m_dtset
      31                 :             :  use libxc_functionals
      32                 :             :  use netcdf
      33                 :             : 
      34                 :             :  use defs_datatypes, only : pspheader_type
      35                 :             :  use m_time,      only : timab
      36                 :             :  use m_fstrings,  only : sjoin, itoa, ltoa, tolower, toupper
      37                 :             :  use m_matrix,    only : matr3inv
      38                 :             :  use m_parser,    only : intagm, intagm_img
      39                 :             :  use m_geometry,  only : mkrdim, metric
      40                 :             :  use m_gsphere,   only : setshells
      41                 :             :  use m_xcdata,    only : get_auxc_ixc, get_xclevel
      42                 :             :  use m_inkpts,    only : inkpts
      43                 :             :  use m_ingeo,     only : invacuum
      44                 :             :  use m_ipi,       only : ipi_check_initial_consistency
      45                 :             :  use m_crystal,   only : crystal_t
      46                 :             :  use m_bz_mesh,   only : kmesh_t
      47                 :             :  use m_drivexc,   only : has_kxc
      48                 :             :  use m_mep,       only : MEP_SOLVER_STEEPEST,NEB_ALGO_CINEB
      49                 :             : 
      50                 :             :  implicit none
      51                 :             : 
      52                 :             :  private
      53                 :             : !!***
      54                 :             : 
      55                 :             :  public :: invars2m
      56                 :             :  public :: invars2
      57                 :             : !!***
      58                 :             : 
      59                 :             : contains
      60                 :             : !!***
      61                 :             : 
      62                 :             : !!****f* ABINIT/invars2m
      63                 :             : !! NAME
      64                 :             : !! invars2m
      65                 :             : !!
      66                 :             : !! FUNCTION
      67                 :             : !! Initialisation phase - main input routine.
      68                 :             : !! Big loop on the datasets :
      69                 :             : !! - for each of the datasets, write one line about the crystallographic data
      70                 :             : !! - call invars2, that read the eventual single dataset input values;
      71                 :             : !! - compute mgfft,mpw,nfft,... for this data set;
      72                 :             : !! - compute quantities for the susceptibility computation
      73                 :             : !! - compute the memory needs for this data set.
      74                 :             : !!
      75                 :             : !! INPUTS
      76                 :             : !!  bravais_(11,0:ndtset_alloc)=characteristics of Bravais lattice
      77                 :             : !!  iout=unit number of output file
      78                 :             : !!  lenstr=actual length of string
      79                 :             : !!  mband_upper_(0:ndtset_alloc)=list of mband_upper values
      80                 :             : !!  msym=default maximal number of symmetries
      81                 :             : !!  ndtset= number of datasets to be read; if 0, no multi-dataset mode
      82                 :             : !!  ndtset_alloc=number of datasets, corrected for allocation of at least
      83                 :             : !!      one data set.
      84                 :             : !!  npsp=number of pseudopotentials
      85                 :             : !!  pspheads(npsp)=<type pspheader_type>all the important information from the
      86                 :             : !!   pseudopotential file header, as well as the psp file name
      87                 :             : !!  string*(*)=character string containing all the input data.
      88                 :             : !!   Initialized previously in instrng.
      89                 :             : !! comm=MPI communicator
      90                 :             : !!
      91                 :             : !! OUTPUT
      92                 :             : !!  dtsets(0:ndtset_alloc)=<type datafiles_type>contains all input variables,
      93                 :             : !!   some of which are initialized here, while other were already
      94                 :             : !!   initialized previously.
      95                 :             : !!
      96                 :             : !! NOTES
      97                 :             : !! The outputs of this routine are the values of input variables,
      98                 :             : !! their default value is stored at the index 0 of the last dimension
      99                 :             : !! of their multi-dataset representation.
     100                 :             : !!
     101                 :             : !! SOURCE
     102                 :             : 
     103                 :        1442 : subroutine invars2m(dtsets,iout,lenstr,mband_upper_,msym,ndtset,ndtset_alloc,npsp,pspheads,string, comm)
     104                 :             : 
     105                 :             : !Arguments ------------------------------------
     106                 :             : !scalars
     107                 :             :  integer,intent(in) :: iout,lenstr,msym,ndtset,ndtset_alloc,npsp, comm
     108                 :             :  character(len=*),intent(in) :: string
     109                 :             : !arrays
     110                 :             :  integer,intent(in) :: mband_upper_(0:ndtset_alloc)
     111                 :             :  type(dataset_type),intent(inout) :: dtsets(0:ndtset_alloc)
     112                 :             :  type(pspheader_type),intent(in) :: pspheads(npsp)
     113                 :             : 
     114                 :             : !Local variables -------------------------------
     115                 :             : !scalars
     116                 :             :  integer :: idtset,jdtset,mband_upper,nsheps,nshsigx,nshwfn,usepaw
     117                 :             :  !integer,parameter :: master = 0
     118                 :             :  real(dp) :: ucvol
     119                 :             : !arrays
     120                 :             :  integer :: bravais(11)
     121                 :             :  real(dp) :: gmet(3,3),gprimd(3,3),rmet(3,3),rprimd(3,3)
     122                 :        1442 :  real(dp),allocatable :: zionpsp(:)
     123                 :             : !*************************************************************************
     124                 :             : 
     125         [ +  + ]:        8452 :  do idtset=1,ndtset_alloc
     126         [ +  + ]:        7010 :    jdtset=dtsets(idtset)%jdtset ; if(ndtset==0)jdtset=0
     127         [ +  + ]:       84120 :    bravais(:)=dtsets(idtset)%bravais(:)
     128                 :        7010 :    mband_upper  =mband_upper_(idtset)
     129                 :        7010 :    usepaw=dtsets(idtset)%usepaw
     130                 :             :    ! Allocate arrays
     131   [ -  +  +  -  :       21030 :    ABI_MALLOC(zionpsp,(npsp))
          +  -  +  -  -  
                +  +  - ]
     132         [ +  + ]:       15698 :    zionpsp(:)=pspheads(1:npsp)%zionpsp
     133                 :             : 
     134   [ -  +  -  -  :        7010 :    call mkrdim(dtsets(idtset)%acell_orig(1:3,1),dtsets(idtset)%rprim_orig(1:3,1:3,1),rprimd)
                   -  - ]
     135                 :        7010 :    call metric(gmet,gprimd,-1,rmet,rprimd,ucvol)
     136                 :             : 
     137                 :             :    ! Here, nearly all the remaining input variables are initialized
     138                 :        7010 :    call invars2(bravais,dtsets(idtset),iout,jdtset,lenstr,mband_upper,msym,npsp,string,usepaw,zionpsp,ucvol,comm)
     139                 :             : 
     140         [ -  + ]:        7010 :    ABI_FREE(zionpsp)
     141                 :             : 
     142         [ +  + ]:        8452 :    if (ANY(dtsets(idtset)%optdriver == [RUNL_SCREENING,RUNL_SIGMA,RUNL_BSE])) then
     143                 :             :     ! For GW or BSE calculations, we only use (npwwfn|ecutwfn) G-vectors read from the KSS file,
     144                 :             :     ! therefore the FFT box for the density should be defined according to ecut=ecutwfn.
     145                 :             : 
     146                 :         385 :      nshwfn=0
     147                 :             :      call setshells(dtsets(idtset)%ecutwfn,dtsets(idtset)%npwwfn,nshwfn,&
     148                 :         385 :        dtsets(idtset)%nsym,gmet,gprimd,dtsets(idtset)%symrel,'wfn',ucvol)
     149                 :             : 
     150                 :             :      ! MG: Hack to avoid portability problems under gfortran:
     151                 :             :      ! getng and getmpw are indeed quite sensitive if ecut is small
     152                 :             :      ! and, in the GW tests, mpw and ngfft might depend on the compiler used.
     153                 :             :      ! the problem shows up if we use npwwfn instead of ecutwfn, a good reason for removing npwwfn!
     154                 :         385 :      dtsets(idtset)%ecutwfn=dtsets(idtset)%ecutwfn-tol14
     155                 :             :      ! MG: This is a kind of a hack, but the problem is ecutwfn that is too much redundant!
     156                 :         385 :      dtsets(idtset)%ecut=dtsets(idtset)%ecutwfn
     157                 :             : 
     158                 :             :      ! Close the shell for (W|chi0)
     159                 :         385 :      nsheps=0
     160                 :             :      call setshells(dtsets(idtset)%ecuteps,dtsets(idtset)%npweps,nsheps,&
     161                 :         385 :       dtsets(idtset)%nsym,gmet,gprimd,dtsets(idtset)%symrel,'eps',ucvol)
     162                 :             : 
     163                 :             :      ! Close the shell for the exchange term.
     164                 :         385 :      nshsigx=0
     165                 :             :      call setshells(dtsets(idtset)%ecutsigx,dtsets(idtset)%npwsigx,nshsigx,&
     166                 :         385 :       dtsets(idtset)%nsym,gmet,gprimd,dtsets(idtset)%symrel,'sigx',ucvol)
     167                 :             :    end if ! (SIGMA|SCREENING|SCGW|BSE|RDFTM)
     168                 :             : 
     169                 :             :  end do
     170                 :             : 
     171                 :        1442 : end subroutine invars2m
     172                 :             : !!***
     173                 :             : 
     174                 :             : !!****f* ABINIT/invars2
     175                 :             : !! NAME
     176                 :             : !! invars2
     177                 :             : !!
     178                 :             : !! FUNCTION
     179                 :             : !! Initialize variables for the ABINIT code, for one particular dataset, characterized by jdtset.
     180                 :             : !! Note: some parameters have already been read in invars0 and invars1,
     181                 :             : !! and were used to dimension the arrays needed here.
     182                 :             : !!
     183                 :             : !! INPUTS
     184                 :             : !! bravais(11): bravais(1)=iholohedry
     185                 :             : !!              bravais(2)=center
     186                 :             : !!              bravais(3:11)=coordinates of rprim in the axes
     187                 :             : !!               of the conventional bravais lattice (*2 if center/=0)
     188                 :             : !! iout=unit number for echoed output
     189                 :             : !! jdtset=number of the dataset looked for
     190                 :             : !! lenstr=actual length of the string
     191                 :             : !! mband=maximum number of bands for any k-point
     192                 :             : !! msym=default maximal number of symmetries
     193                 :             : !! npsp=number of pseudopotentials
     194                 :             : !! string*(*)=character string containing all the input data.
     195                 :             : !!  Initialized previously in instrng.
     196                 :             : !! usepaw= 0 for non paw calculation; =1 for paw calculation
     197                 :             : !! zionpsp(npsp)=valence charge of each type of atom (coming from the psp files)
     198                 :             : !! ucvol: Unit cell volume
     199                 :             : !! comm=MPI communicator
     200                 :             : !!
     201                 :             : !! OUTPUT
     202                 :             : !!  (see side effects)
     203                 :             : !!
     204                 :             : !! SIDE EFFECTS
     205                 :             : !! Input/Output:
     206                 :             : !!  dtset=<type datafiles_type>contains all input variables,
     207                 :             : !!   some of which are initialized here, while other were already
     208                 :             : !! All rest of arguments given alphabetically from acell (length scales)
     209                 :             : !! to wtk (k-point weights), used to control running of the main routine.
     210                 :             : !! See abinit_help for definitions of these variables.
     211                 :             : !! These values become defined by being read from string,
     212                 :             : !! that contains all information from the input file,
     213                 :             : !! in a compressed, standardized, format
     214                 :             : !! At the input, they already contain a default value.
     215                 :             : !!
     216                 :             : !! SOURCE
     217                 :             : 
     218                 :        7010 : subroutine invars2(bravais,dtset,iout,jdtset,lenstr,mband,msym,npsp,string,usepaw,zionpsp,ucvol,comm)
     219                 :             : 
     220                 :             : !Arguments ------------------------------------
     221                 :             : !scalars
     222                 :             :  integer,intent(in) :: iout,jdtset,lenstr,mband,msym,npsp,usepaw, comm
     223                 :             :  character(len=*),intent(in) :: string
     224                 :             :  type(dataset_type),intent(inout) :: dtset
     225                 :             :  real(dp),intent(in) :: ucvol
     226                 :             : !arrays
     227                 :             :  integer,intent(in) :: bravais(11)
     228                 :             :  real(dp),intent(in) :: zionpsp(npsp)
     229                 :             : 
     230                 :             : !Local variables-------------------------------
     231                 :             : !scalars
     232                 :             :  integer,parameter :: master = 0
     233                 :             :  integer :: bantot,berryopt,dmatsize,ndim,getocc,narr,nprocs
     234                 :             :  integer :: iat,iatom,iband,ii,iimage,ikpt,intimage,ionmov,isppol,ixc_here
     235                 :             :  integer :: densfor_pred,ipsp,iscf,isiz,itypat,jj,kptopt,lpawu,marr,natom,natomcor,nband1,nberry
     236                 :             :  integer :: niatcon,nimage,nkpt,nkpthf,npspalch,nqpt,nsp,nspinor,nsppol,nsym,ntypalch,ntypat,ntyppure
     237                 :             :  integer :: occopt,occopt_tmp,response,sumnbl,tfband,tnband,tread,tread_alt,tread_dft,tread_fock,tread_key,tread_extrael
     238                 :             :  integer :: tread_brange, tread_erange, tread_kfilter, tread_qgbt, tread_cart
     239                 :             :  integer :: itol, itol_gen, ds_input, ifreq, ncerr, ierr, image, tread_dipdip, my_rank
     240                 :             :  integer :: itol_wfr, itol_gen_wfr
     241                 :             :  logical :: xc_is_mgga,xc_is_pot_only,xc_need_kden,xc_has_kxc
     242                 :             :  real(dp) :: areaxy,cellcharge_min,fband,kptrlen,nelectjell,sum_spinat
     243                 :             :  real(dp) :: rhoavg,zelect,zval
     244                 :             :  real(dp) :: toldfe_, tolrff_, toldff_, tolwfr_, tolvrs_, toldmag_
     245                 :             :  real(dp) :: tolmxde_, tolmxf_
     246                 :             :  character(len=500) :: msg
     247                 :             :  character(len=fnlen) :: key_value
     248   [ +  +  +  +  :      364520 :  type(crystal_t) :: cryst
          +  +  +  +  +  
          +  +  +  +  +  
             +  +  +  + ]
     249   [ +  +  +  +  :      182260 :  type(kmesh_t) :: kmesh, qmesh
             +  +  +  + ]
     250                 :             : !arrays
     251                 :             :  integer :: vacuum(3)
     252                 :        7010 :  integer,allocatable :: iatcon(:),natcon(:), intarr(:)
     253                 :             :  real(dp) :: tsec(2),rprimd(3,3) ! qgbt(3),
     254                 :        7010 :  real(dp),allocatable :: dmatpawu_tmp(:), dprarr(:)
     255         [ +  + ]:       21030 :  type(libxc_functional_type) :: xcfunc(2)
     256                 :             : ! *************************************************************************
     257                 :             : 
     258                 :        7010 :  call timab(191,1,tsec)
     259                 :             : 
     260                 :        7010 :  nprocs = xmpi_comm_size(comm); my_rank = xmpi_comm_rank(comm)
     261                 :             : 
     262                 :             :  ! Compute the maximum size of arrays intarr and dprarr
     263                 :        7010 :  natom=dtset%natom
     264                 :        7010 :  nimage=dtset%nimage
     265                 :        7010 :  nkpt=dtset%nkpt
     266                 :        7010 :  nkpthf=dtset%nkpthf
     267                 :        7010 :  npspalch=dtset%npspalch
     268                 :        7010 :  nspinor=dtset%nspinor
     269                 :        7010 :  nsppol=dtset%nsppol
     270                 :        7010 :  ntypat=dtset%ntypat
     271                 :        7010 :  ntypalch=dtset%ntypalch
     272                 :        7010 :  ntyppure=dtset%ntyppure
     273                 :             : 
     274                 :        7010 :  dmatsize=0 ! dmatpu not available for usepawu<0
     275   [ +  +  +  + ]:        7010 :  if (dtset%usepawu>0.and.dtset%usedmatpu/=0) then
     276         [ +  + ]:          64 :    do iatom=1,natom
     277                 :          49 :      lpawu=dtset%lpawu(dtset%typat(iatom))
     278         [ +  + ]:          64 :      if (lpawu/=-1) dmatsize=dmatsize+nsppol*nspinor*(2*lpawu+1)**2
     279                 :             :    end do
     280                 :             :  end if
     281                 :             : 
     282                 :             :  marr=max(3*natom,&
     283                 :             :    nkpt*nsppol*mband,&
     284                 :             :    2*dtset%nkptgw*nsppol,&
     285                 :             :    dmatsize,&
     286                 :             :    3*nkpt,&
     287                 :             :    npsp,&
     288                 :             :    ntypat,&
     289                 :             :    9*msym,&
     290                 :             :    60,100,&
     291                 :             :    3*dtset%nconeq*natom,&
     292                 :             :    nimage,&
     293                 :             :    3*dtset%nqptdm,&
     294                 :             :    3*dtset%natsph_extra,&
     295                 :             :    dtset%natvshift*nsppol*natom,&
     296                 :        7010 :    3*dtset%nzchempot*ntypat)
     297                 :             : 
     298   [ -  +  +  -  :       21030 :  ABI_MALLOC(intarr,(marr))
          +  -  -  +  -  
                      + ]
     299   [ -  +  +  -  :       21030 :  ABI_MALLOC(dprarr,(marr))
          +  -  -  +  -  
                      + ]
     300                 :             : 
     301                 :             :  !----------------------------------------------------------------------------
     302                 :             : 
     303                 :             :  !****   Read parameters which set remaining array dimensions ****
     304                 :             : 
     305                 :             :  !Note: some parameters have already been read in invars0 and invars1
     306                 :             :  !Also, some checking is needed here.
     307                 :             : 
     308                 :             :  !Read ngfft(1), ngfft(2), and ngfft(3), then ngfft(7)=fftalg and ngfft(8)=fftcache.
     309                 :             :  !Read ngfftdg(1:3)
     310                 :             : 
     311                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,3,string(1:lenstr),'ngfft',tread,'INT')
     312   [ +  +  +  + ]:        8366 :  if(tread==1) dtset%ngfft(1:3)=intarr(1:3)
     313                 :             : 
     314                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'fftalg',tread,'INT')
     315         [ +  + ]:        7010 :  if(tread==1) then
     316                 :         261 :    dtset%ngfft(7)=intarr(1)
     317         [ +  + ]:         261 :    if (usepaw==1) dtset%ngfftdg(7)=intarr(1)
     318                 :             :  end if
     319                 :             : 
     320                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'fftcache',tread,'INT')
     321                 :             : 
     322         [ +  + ]:        7010 :  if(tread==1) then
     323                 :           2 :    dtset%ngfft(8)=intarr(1)
     324         [ -  + ]:           2 :    if (usepaw==1) dtset%ngfftdg(8)=intarr(1)
     325                 :             :  end if
     326                 :             : 
     327                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,3,string(1:lenstr),'ngfftdg',tread,'INT')
     328   [ +  +  +  + ]:        7634 :  if(tread==1) dtset%ngfftdg(1:3)=intarr(1:3)
     329                 :             : 
     330                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'mqgrid',tread,'INT')
     331         [ +  + ]:        7010 :  if(tread==1) dtset%mqgrid=intarr(1)
     332                 :             : 
     333                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'mqgriddg',tread,'INT')
     334         [ +  + ]:        7010 :  if(tread==1) dtset%mqgriddg=intarr(1)
     335                 :             : 
     336                 :             :  ! Make special arrangements to check nband: may be a scalar
     337                 :             :  ! (for occopt=0, 1 or 3, 4, 5, 6, 7, 8) or may be an array (for occopt=2)
     338                 :             : 
     339                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'occopt',tread,'INT')
     340         [ +  + ]:        7010 :  if(tread==1) dtset%occopt=intarr(1)
     341                 :        7010 :  occopt=dtset%occopt
     342                 :             : 
     343                 :             :  ! check for variables related to genetic algorithm. ga_n_rules has been already read
     344                 :             : 
     345         [ +  + ]:        7010 :  if (dtset%imgmov==4) then
     346                 :           1 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'ga_algor',tread,'INT')
     347         [ -  + ]:           1 :    if(tread==1) dtset%ga_algor=intarr(1)
     348                 :             : 
     349                 :           1 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'ga_fitness',tread,'INT')
     350         [ +  - ]:           1 :    if(tread==1) dtset%ga_fitness=intarr(1)
     351                 :             : 
     352                 :           1 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'ga_opt_percent',tread,'ENE')
     353         [ +  - ]:           1 :    if(tread==1) dtset%ga_opt_percent=dprarr(1)
     354                 :             : 
     355                 :           1 :    call intagm(dprarr,intarr,jdtset,marr,dtset%ga_n_rules,string(1:lenstr),'ga_rules',tread,'INT')
     356         [ +  - ]:           1 :    if(tread==1)then
     357         [ +  + ]:           5 :      dtset%ga_rules(1:dtset%ga_n_rules)=intarr(1:dtset%ga_n_rules)
     358         [ +  + ]:           5 :      do ii=1,dtset%ga_n_rules
     359         [ -  + ]:           5 :        if(dtset%ga_rules(ii)<0)then
     360                 :             :          write(msg, '(3a)' )&
     361                 :           0 :          'All values for Genetic rules must be greater than 0.',ch10,&
     362                 :           0 :          'Action: check the values of ga_rules.'
     363                 :           0 :          ABI_ERROR(msg)
     364                 :             :        end if
     365                 :             :      end do
     366                 :             :    end if
     367                 :             :  end if
     368                 :             : 
     369                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'gwaclowrank',tread,'INT')
     370         [ +  + ]:        7010 :  if(tread==1) dtset%gwaclowrank=intarr(1)
     371                 :             : 
     372                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'gwcalctyp',tread,'INT')
     373         [ +  + ]:        7010 :  if(tread==1) dtset%gwcalctyp=intarr(1)
     374                 :             : 
     375                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'gwcomp',tread,'INT')
     376         [ +  + ]:        7010 :  if(tread==1) dtset%gwcomp=intarr(1)
     377                 :             : 
     378                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'gwencomp',tread,'ENE')
     379         [ +  + ]:        7010 :  if(tread==1) dtset%gwencomp=dprarr(1)
     380                 :             :  ! For the dynamic remainder (gwcomp -2), a negative value means that the energy shift
     381                 :             :  ! of the missing states is computed automatically from the Drude plasma frequency (see m_sigc).
     382   [ +  +  -  + ]:        7010 :  if(tread==0 .and. dtset%gwcomp==-2) dtset%gwencomp=-one
     383                 :             : 
     384         [ +  + ]:        7010 :  if (usepaw==1) then
     385                 :        1214 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'gw_sigxcore',tread,'INT')
     386         [ +  + ]:        1214 :    if(tread==1) dtset%gw_sigxcore=intarr(1)
     387                 :             :  end if
     388                 :             : 
     389                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'gwmem',tread,'INT')
     390         [ +  + ]:        7010 :  if(tread==1) dtset%gwmem=intarr(1)
     391                 :             : 
     392                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'gwr_nstep',tread,'INT')
     393         [ -  + ]:        7010 :  if(tread==1) dtset%gwr_nstep=intarr(1)
     394                 :             : 
     395                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'gwr_fit',tread,'INT')
     396         [ -  + ]:        7010 :  if(tread==1) dtset%gwr_fit=intarr(1)
     397                 :             : 
     398                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'gwr_tolqpe',tread,'ENE')
     399         [ -  + ]:        7010 :  if(tread==1) dtset%gwr_tolqpe=dprarr(1)
     400                 :             : 
     401                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'gwls_stern_kmax',tread,'INT')
     402         [ +  + ]:        7010 :  if(tread==1) dtset%gwls_stern_kmax=intarr(1)
     403                 :             : 
     404                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'gwls_npt_gauss_quad',tread,'INT')
     405         [ +  + ]:        7010 :  if(tread==1) dtset%gwls_npt_gauss_quad=intarr(1)
     406                 :             : 
     407                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'gwls_diel_model',tread,'INT')
     408         [ +  + ]:        7010 :  if(tread==1) dtset%gwls_diel_model=intarr(1)
     409                 :             : 
     410                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'gwls_model_parameter',tread,'ENE')
     411         [ +  + ]:        7010 :  if(tread==1) dtset%gwls_model_parameter=dprarr(1)
     412                 :             : 
     413                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'gwls_recycle',tread,'INT')
     414         [ +  + ]:        7010 :  if(tread==1) dtset%gwls_recycle=intarr(1)
     415                 :             : 
     416                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'gwls_print_debug',tread,'INT')
     417         [ +  + ]:        7010 :  if(tread==1) dtset%gwls_print_debug=intarr(1)
     418                 :             : 
     419                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'gwls_nseeds',tread,'INT')
     420         [ +  + ]:        7010 :  if(tread==1) dtset%gwls_nseeds=intarr(1)
     421                 :             : 
     422                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'gwls_kmax_complement',tread,'INT')
     423         [ +  + ]:        7010 :  if(tread==1) dtset%gwls_kmax_complement=intarr(1)
     424                 :             : 
     425                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'gwls_kmax_poles',tread,'INT')
     426         [ +  + ]:        7010 :  if(tread==1) dtset%gwls_kmax_poles=intarr(1)
     427                 :             : 
     428                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'gwls_kmax_analytic',tread,'INT')
     429         [ +  + ]:        7010 :  if(tread==1) dtset%gwls_kmax_analytic=intarr(1)
     430                 :             : 
     431                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'gwls_kmax_numeric',tread,'INT')
     432         [ +  + ]:        7010 :  if(tread==1) dtset%gwls_kmax_numeric=intarr(1)
     433                 :             : 
     434                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'gwls_exchange',tread,'INT')
     435         [ +  + ]:        7010 :  if(tread==1) dtset%gwls_exchange=intarr(1)
     436                 :             : 
     437                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'gwls_correlation',tread,'INT')
     438         [ +  + ]:        7010 :  if(tread==1) dtset%gwls_correlation=intarr(1)
     439                 :             : 
     440                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'gwls_band_index',tread,'INT')
     441         [ +  + ]:        7010 :  if(tread==1) dtset%gwls_band_index=intarr(1)
     442                 :             : 
     443                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'gw1rdm',tread,'INT')
     444         [ +  + ]:        7010 :  if(tread==1) dtset%gw1rdm=intarr(1)
     445                 :             : 
     446                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'x1rdm',tread,'INT')
     447         [ +  + ]:        7010 :  if(tread==1) dtset%x1rdm=intarr(1)
     448                 :             : 
     449                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prtchkprdm',tread,'INT')
     450         [ +  + ]:        7010 :  if(tread==1) dtset%prtchkprdm=intarr(1)
     451                 :             : 
     452                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'irdchkprdm',tread,'INT')
     453         [ +  + ]:        7010 :  if(tread==1) dtset%irdchkprdm=intarr(1)
     454                 :             : 
     455                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'gwls_first_seed',tread,'INT')
     456         [ +  + ]:        7010 :  if(tread==1) then
     457                 :           6 :    dtset%gwls_first_seed=intarr(1)
     458                 :             :  else
     459                 :        7004 :    dtset%gwls_first_seed=dtset%gwls_band_index
     460                 :             :  end if
     461                 :             : 
     462                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'extfpmd_nbcut',tread,'INT')
     463         [ +  + ]:        7010 :  if(tread==1) dtset%extfpmd_nbcut=intarr(1)
     464                 :             : 
     465                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'extfpmd_nbdbuf',tread,'INT')
     466         [ +  + ]:        7010 :  if(tread==1) dtset%extfpmd_nbdbuf=intarr(1)
     467                 :             : 
     468                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'extfpmd_nband',tread,'INT')
     469         [ +  + ]:        7010 :  if(tread==1) dtset%extfpmd_nband=intarr(1)
     470                 :             : 
     471                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'extfpmd_pawsph',tread,'INT')
     472         [ +  + ]:        7010 :  if(tread==1) dtset%extfpmd_pawsph=intarr(1)
     473                 :             : 
     474                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'extfpmd_prterr',tread,'INT')
     475         [ -  + ]:        7010 :  if(tread==1) dtset%extfpmd_prterr=intarr(1)
     476                 :             : 
     477                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'rhoqpmix',tread,'DPR')
     478         [ +  + ]:        7010 :  if(tread==1) dtset%rhoqpmix=dprarr(1)
     479                 :             : 
     480                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'rifcsph',tread,'DPR')
     481         [ +  + ]:        7010 :  if(tread==1) dtset%rifcsph=dprarr(1)
     482                 :             : 
     483                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'nfreqim',tread,'INT')
     484         [ +  + ]:        7010 :  if(tread==1) dtset%nfreqim=intarr(1)
     485         [ +  + ]:        7010 :  if (dtset%cd_customnimfrqs/=0) then
     486                 :             :    write(msg, '(3a)' )&
     487                 :           1 :    'cd_customnimfrqs not equal to zero and not equal to nfreqim',ch10,&
     488                 :           2 :    'setting nfreqim = cd_customnimfrqs'
     489                 :           1 :    ABI_WARNING(msg)
     490                 :           1 :    dtset%nfreqim = dtset%cd_customnimfrqs
     491                 :             :  end if
     492                 :             : 
     493                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'nfreqim_conv',tread,'INT')
     494         [ +  + ]:        7010 :  if(tread==1) dtset%nfreqim_conv=intarr(1)
     495                 :             : 
     496                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'freqim_alpha',tread,'DPR')
     497         [ +  + ]:        7010 :  if(tread==1) dtset%freqim_alpha=dprarr(1)
     498                 :             : 
     499                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'freqremin',tread,'ENE')
     500         [ +  + ]:        7010 :  if(tread==1) dtset%freqremin=dprarr(1)
     501                 :             : 
     502                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'freqremax',tread,'ENE')
     503         [ +  + ]:        7010 :  if(tread==1) dtset%freqremax=dprarr(1)
     504                 :             : 
     505                 :             :  ! cd_max_freq is obsolete, replaced by freqremax. Still read during a transitional period.
     506                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'cd_max_freq',tread_alt,'ENE')
     507         [ -  + ]:        7010 :  if (tread_alt==1) then
     508         [ #  # ]:           0 :    if (tread==1) then
     509                 :           0 :      ABI_ERROR('Both freqremax and the obsolete cd_max_freq are given. Use only freqremax.')
     510                 :             :    end if
     511                 :           0 :    dtset%freqremax=dprarr(1)
     512                 :             :    write(msg, '(3a)')&
     513                 :           0 :     'Input variable "cd_max_freq" is obsolete.', ch10, &
     514                 :           0 :     'Its value has been assigned to "freqremax", please update your input.'
     515                 :           0 :    ABI_COMMENT(msg)
     516                 :             :  end if
     517                 :             : 
     518                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'nfreqre',tread,'INT')
     519         [ +  + ]:        7010 :  if(tread==1) dtset%nfreqre=intarr(1)
     520                 :             : 
     521                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'nfreqsp',tread,'INT')
     522         [ +  + ]:        7010 :  if(tread==1) dtset%nfreqsp=intarr(1)
     523                 :             : 
     524                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'freqspmax',tread,'ENE')
     525         [ +  + ]:        7010 :  if(tread==1) dtset%freqspmax=dprarr(1)
     526                 :             : 
     527                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'freqspmin',tread,'ENE')
     528         [ +  + ]:        7010 :  if(tread==1) then
     529                 :             :    ! If found, set it
     530                 :           1 :    dtset%freqspmin=dprarr(1)
     531                 :             :  else
     532                 :             :    ! Else give it the value -freqspmax
     533                 :        7009 :    dtset%freqspmin=-dtset%freqspmax
     534                 :             :  end if
     535                 :             : 
     536                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'gw_frqim_inzgrid',tread,'INT')
     537         [ +  + ]:        7010 :  if(tread==1) dtset%gw_frqim_inzgrid=intarr(1)
     538                 :             : 
     539                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'gw_frqre_inzgrid',tread,'INT')
     540         [ +  + ]:        7010 :  if(tread==1) dtset%gw_frqre_inzgrid=intarr(1)
     541                 :             : 
     542                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'gw_frqre_tangrid',tread,'INT')
     543         [ +  + ]:        7010 :  if(tread==1) dtset%gw_frqre_tangrid=intarr(1)
     544                 :             : 
     545                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'gw_invalid_freq',tread,'INT')
     546         [ +  + ]:        7010 :  if(tread==1) dtset%gw_invalid_freq=intarr(1)
     547                 :             : 
     548                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'gw_icutcoul',tread,'INT')
     549         [ +  + ]:        7010 :  if(tread==1) dtset%gw_icutcoul=intarr(1)
     550                 :             : 
     551                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'gw_qprange',tread,'INT')
     552         [ +  + ]:        7010 :  if(tread==1) dtset%gw_qprange=intarr(1)
     553                 :             : 
     554         [ +  + ]:        7010 :  if(dtset%cd_customnimfrqs/=0) then
     555                 :           1 :    call intagm(dprarr,intarr,jdtset,marr,dtset%cd_customnimfrqs,string(1:lenstr),'cd_imfrqs',tread,'ENE')
     556         [ +  - ]:           1 :    if(tread==1) then
     557         [ +  + ]:           5 :      dtset%cd_imfrqs(1:dtset%cd_customnimfrqs)=dprarr(1:dtset%cd_customnimfrqs)
     558         [ +  + ]:           4 :      do ifreq=1,dtset%cd_customnimfrqs-1
     559         [ +  - ]:           4 :        if (dtset%cd_imfrqs(ifreq+1)<dtset%cd_imfrqs(ifreq)) then
     560                 :             :          write(msg, '(3a)' )&
     561                 :           0 :          'The frequencies specified in cd_imfrqs must be strictly increasing',ch10,&
     562                 :           0 :          'Action: Correct this in your input file'
     563                 :           0 :          ABI_ERROR(msg)
     564                 :             :        end if
     565                 :             :      end do
     566                 :             :    end if
     567                 :             :  end if
     568                 :             : 
     569         [ +  + ]:        7010 :  if(dtset%gw_customnfreqsp/=0) then
     570                 :           8 :    call intagm(dprarr,intarr,jdtset,marr,dtset%gw_customnfreqsp,string(1:lenstr),'gw_freqsp',tread,'ENE')
     571         [ +  - ]:           8 :    if(tread==1) then
     572         [ +  + ]:          23 :      dtset%gw_freqsp(1:dtset%gw_customnfreqsp)=dprarr(1:dtset%gw_customnfreqsp)
     573         [ +  + ]:          15 :      do ifreq=1,dtset%gw_customnfreqsp-1
     574         [ +  - ]:          15 :        if (dtset%gw_freqsp(ifreq+1)<dtset%gw_freqsp(ifreq)) then
     575                 :             :          write(msg, '(3a)' )&
     576                 :           0 :          'The frequencies specified in gw_freqsp must be strictly increasing',ch10,&
     577                 :           0 :          'Action: Correct this in your input file'
     578                 :           0 :          ABI_ERROR(msg)
     579                 :             :        end if
     580                 :             :      end do
     581                 :             :    end if
     582                 :             :  end if
     583                 :             : 
     584         [ -  + ]:        7010 :  if(dtset%gwls_n_proj_freq/=0) then
     585                 :           0 :    call intagm(dprarr,intarr,jdtset,marr,dtset%gwls_n_proj_freq,string(1:lenstr),'gwls_list_proj_freq',tread,'ENE')
     586         [ #  # ]:           0 :    if(tread==1) then
     587         [ #  # ]:           0 :      dtset%gwls_list_proj_freq(1:dtset%gwls_n_proj_freq)=dprarr(1:dtset%gwls_n_proj_freq)
     588                 :             :    end if
     589                 :             :  end if
     590                 :             : 
     591                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'cd_full_grid',tread,'INT')
     592         [ +  + ]:        7010 :  if(tread==1) dtset%cd_full_grid=intarr(1)
     593                 :             : 
     594                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'cd_frqim_method',tread,'INT')
     595         [ +  + ]:        7010 :  if(tread==1) dtset%cd_frqim_method=intarr(1)
     596                 :             : 
     597                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'cd_halfway_freq',tread,'ENE')
     598         [ +  + ]:        7010 :  if(tread==1) dtset%cd_halfway_freq=dprarr(1)
     599                 :             : 
     600                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,2,string(1:lenstr),'cd_subset_freq',tread,'INT')
     601   [ -  +  -  - ]:        7010 :  if(tread==1) dtset%cd_subset_freq(1:2)=intarr(1:2)
     602                 :             : 
     603                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'gwrpacorr',tread,'INT')
     604         [ +  + ]:        7010 :  if(tread==1) dtset%gwrpacorr=intarr(1)
     605                 :             : 
     606                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'gwgmcorr',tread,'INT')
     607         [ +  + ]:        7010 :  if(tread==1) dtset%gwgmcorr=intarr(1)
     608                 :             : 
     609                 :        7010 :  narr = size(dtset%gwr_np_kgts)
     610                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, narr, string(1:lenstr), 'gwr_np_kgts', tread, 'INT')
     611   [ -  +  -  - ]:        7010 :  if (tread == 1) dtset%gwr_np_kgts = intarr(1:narr)
     612                 :             : 
     613                 :        7010 :  narr = size(dtset%gwr_ucsc_batch)
     614                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, narr, string(1:lenstr), 'gwr_ucsc_batch', tread, 'INT')
     615   [ -  +  -  - ]:        7010 :  if (tread == 1) dtset%gwr_ucsc_batch = intarr(1:narr)
     616                 :             : 
     617                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, 1, string(1:lenstr), 'gwr_ntau', tread,'INT')
     618         [ -  + ]:        7010 :  if (tread == 1) dtset%gwr_ntau = intarr(1)
     619                 :             : 
     620                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, 1, string(1:lenstr), 'gwr_chi_algo', tread,'INT')
     621         [ -  + ]:        7010 :  if (tread == 1) dtset%gwr_chi_algo = intarr(1)
     622                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, 1, string(1:lenstr), 'gwr_sigma_algo', tread,'INT')
     623         [ -  + ]:        7010 :  if (tread == 1) dtset%gwr_sigma_algo = intarr(1)
     624                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, 1, string(1:lenstr), 'gwr_rpa_ncut', tread,'INT')
     625         [ -  + ]:        7010 :  if (tread == 1) dtset%gwr_rpa_ncut = intarr(1)
     626                 :             : 
     627                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, 1, string(1:lenstr), 'gwr_boxcutmin', tread, 'DPR')
     628         [ -  + ]:        7010 :  if (tread == 1) dtset%gwr_boxcutmin = dprarr(1)
     629                 :             : 
     630                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, 1, string(1:lenstr), 'gwr_max_hwtene', tread, 'ENE')
     631         [ -  + ]:        7010 :  if (tread == 1) dtset%gwr_max_hwtene = dprarr(1)
     632                 :             : 
     633                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, 1, string(1:lenstr), 'gwr_regterm', tread, 'DPR')
     634         [ -  + ]:        7010 :  if (tread == 1) dtset%gwr_regterm = dprarr(1)
     635                 :             : 
     636                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, 1, string(1:lenstr), "gwr_task", tread, 'KEY', key_value=key_value)
     637   [ -  +  -  - ]:        7010 :  if (tread == 1) dtset%gwr_task = toupper(trim(key_value))
     638                 :             : 
     639                 :             :  ! RESPFN integer input variables (needed here to get the value of response)
     640                 :             :  ! Warning: rfddk,rfelfd,rfmagn,rfphon,rfstrs,rfsrs_ref,rf2_dkdk and rf2_dkde are also read in invars1
     641                 :             : 
     642                 :             : !call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'rfasr',tread,'INT')
     643                 :             : !if(tread==1) dtset%rfasr=intarr(1)
     644                 :             : 
     645                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'asr',tread,'INT')
     646         [ +  + ]:        7010 :  if(tread==1) dtset%asr=intarr(1)
     647                 :             : 
     648                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'chneut',tread,'INT')
     649         [ +  + ]:        7010 :  if(tread==1) dtset%chneut=intarr(1)
     650                 :             : 
     651                 :             : 
     652                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,2,string(1:lenstr),'rfatpol',tread,'INT')
     653   [ +  +  +  + ]:        7624 :  if(tread==1) dtset%rfatpol(1:2)=intarr(1:2)
     654         [ +  + ]:        7010 :  if(dtset%rfatpol(1)==-1)then
     655                 :        6703 :    dtset%rfatpol(1)=1
     656                 :             :  endif
     657         [ +  + ]:        7010 :  if(dtset%rfatpol(2)==-1)then
     658                 :        6703 :    dtset%rfatpol(2)=dtset%natom
     659                 :             :  endif
     660                 :             : 
     661                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,2,string(1:lenstr),'mpatpol',tread,'INT')
     662   [ +  +  +  + ]:        7024 :  if(tread==1) dtset%mpatpol(1:2)=intarr(1:2)
     663         [ +  + ]:        7010 :  if(dtset%mpatpol(1)==-1)then
     664                 :        7003 :    dtset%mpatpol(1)=1
     665                 :             :  endif
     666         [ +  + ]:        7010 :  if(dtset%mpatpol(2)==-1)then
     667                 :        7003 :    dtset%mpatpol(2)=dtset%natom
     668                 :             :  endif
     669                 :             : 
     670                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,3,string(1:lenstr),'rfdir',tread,'INT')
     671   [ +  +  +  + ]:        8561 :  if(tread==1) dtset%rfdir(1:3)=intarr(1:3)
     672                 :             : 
     673                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,3,string(1:lenstr),'mpdir',tread,'INT')
     674   [ +  +  +  + ]:        7031 :  if(tread==1) dtset%mpdir(1:3)=intarr(1:3)
     675                 :             : 
     676                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'rfddk',tread,'INT')
     677         [ +  + ]:        7010 :  if(tread==1) dtset%rfddk=intarr(1)
     678                 :             : 
     679                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'rfelfd',tread,'INT')
     680         [ +  + ]:        7010 :  if(tread==1) dtset%rfelfd=intarr(1)
     681                 :             : 
     682                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'rfmagn',tread,'INT')
     683         [ +  + ]:        7010 :  if(tread==1) dtset%rfmagn=intarr(1)
     684                 :             : 
     685                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'rfmeth',tread,'INT')
     686         [ +  + ]:        7010 :  if(tread==1) dtset%rfmeth=intarr(1)
     687                 :             : 
     688                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'rfphon',tread,'INT')
     689         [ +  + ]:        7010 :  if(tread==1) dtset%rfphon=intarr(1)
     690                 :             : 
     691                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'rfstrs',tread,'INT')
     692         [ +  + ]:        7010 :  if(tread==1) dtset%rfstrs=intarr(1)
     693                 :             : 
     694                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'rfstrs_ref',tread,'INT')
     695         [ +  + ]:        7010 :  if(tread==1) dtset%rfstrs_ref=intarr(1)
     696                 :             : 
     697                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'rf2_dkdk',tread,'INT')
     698         [ +  + ]:        7010 :  if(tread==1) dtset%rf2_dkdk=intarr(1)
     699                 :             : 
     700                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'rf2_dkde',tread,'INT')
     701         [ +  + ]:        7010 :  if(tread==1) dtset%rf2_dkde=intarr(1)
     702                 :             : 
     703                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,3,string(1:lenstr),'rf2_pert1_dir',tread,'INT')
     704   [ +  +  +  + ]:        7025 :  if(tread==1) dtset%rf2_pert1_dir(1:3)=intarr(1:3)
     705                 :             : 
     706                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,3,string(1:lenstr),'rf2_pert2_dir',tread,'INT')
     707   [ +  +  +  + ]:        7025 :  if(tread==1) dtset%rf2_pert2_dir(1:3)=intarr(1:3)
     708                 :             : 
     709                 :             :  ! Set value of response to 1 and also set rfdir to 1 1 1 if we are doing
     710                 :             :  ! response calculation but rfdir was left at default 0 0 0 value.
     711                 :             :  ! For rf2_dkdk and rf2_dkde, we do the same for rf2_pert1_dir and rf2_pert2_dir
     712                 :        7010 :  response=0
     713                 :             :  if(dtset%rfddk/=0 .or. dtset%rf2_dkdk/=0 .or. dtset%rf2_dkde/=0 .or. dtset%rfelfd/=0 .or. &
     714   [ +  +  +  +  :        7010 :    dtset%rfphon/=0 .or. dtset%rfstrs/=0 ) then
          +  +  +  +  +  
                      + ]
     715                 :         714 :    response=1
     716   [ +  +  -  +  :         714 :    if( (dtset%rfdir(1) == 0) .and. (dtset%rfdir(2) == 0) .and. (dtset%rfdir(3) == 0) ) dtset%rfdir(1:3) = 1
                   -  - ]
     717         [ +  + ]:         714 :    if (dtset%rf2_dkdk/=0 .or. dtset%rf2_dkde/=0) then
     718   [ +  +  -  +  :         100 :      if (sum(abs(dtset%rf2_pert1_dir)) == 0) dtset%rf2_pert1_dir(:) = 1
                   -  - ]
     719   [ +  +  -  +  :         100 :      if (sum(abs(dtset%rf2_pert2_dir)) == 0) dtset%rf2_pert2_dir(:) = 1
                   -  - ]
     720                 :             :    end if
     721                 :             :  end if
     722                 :             : 
     723                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'rmm_diis',tread,'INT')
     724         [ +  + ]:        7010 :  if(tread==1) dtset%rmm_diis=intarr(1)
     725                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'rmm_diis_savemem',tread,'INT')
     726         [ +  + ]:        7010 :  if(tread==1) dtset%rmm_diis_savemem=intarr(1)
     727                 :             : 
     728                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'nonlinear_info',tread,'INT')
     729         [ +  + ]:        7010 :  if(tread==1) dtset%nonlinear_info=intarr(1)
     730                 :             : 
     731                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'nonlop_ylm_count',tread,'INT')
     732         [ -  + ]:        7010 :  if(tread==1) dtset%nonlop_ylm_count=intarr(1)
     733                 :             : 
     734                 :             : !Need always to be read, in order to change the default value.
     735                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,2,string(1:lenstr),'d3e_pert1_atpol',tread,'INT')
     736   [ +  +  +  + ]:        7046 :  if(tread==1) dtset%d3e_pert1_atpol(1:2)=intarr(1:2)
     737         [ +  + ]:        7010 :  if(dtset%d3e_pert1_atpol(1)==-1)then
     738                 :        6992 :    dtset%d3e_pert1_atpol(1)=1
     739                 :             :  endif
     740         [ +  + ]:        7010 :  if(dtset%d3e_pert1_atpol(2)==-1)then
     741                 :        6992 :    dtset%d3e_pert1_atpol(2)=dtset%natom
     742                 :             :  endif
     743                 :             : 
     744                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,2,string(1:lenstr),'d3e_pert2_atpol',tread,'INT')
     745   [ +  +  +  + ]:        7032 :  if(tread==1) dtset%d3e_pert2_atpol(1:2)=intarr(1:2)
     746         [ +  + ]:        7010 :  if(dtset%d3e_pert2_atpol(1)==-1)then
     747                 :        6999 :    dtset%d3e_pert2_atpol(1)=1
     748                 :             :  endif
     749         [ +  + ]:        7010 :  if(dtset%d3e_pert2_atpol(2)==-1)then
     750                 :        6999 :    dtset%d3e_pert2_atpol(2)=dtset%natom
     751                 :             :  endif
     752                 :             : 
     753                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,2,string(1:lenstr),'d3e_pert3_atpol',tread,'INT')
     754   [ +  +  +  + ]:        7024 :  if(tread==1) dtset%d3e_pert3_atpol(1:2)=intarr(1:2)
     755         [ +  + ]:        7010 :  if(dtset%d3e_pert3_atpol(1)==-1)then
     756                 :        7003 :    dtset%d3e_pert3_atpol(1)=1
     757                 :             :  endif
     758         [ +  + ]:        7010 :  if(dtset%d3e_pert3_atpol(2)==-1)then
     759                 :        7003 :    dtset%d3e_pert3_atpol(2)=dtset%natom
     760                 :             :  endif
     761                 :             : 
     762                 :             : 
     763                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,3,string(1:lenstr),'d3e_pert1_dir',tread,'INT')
     764   [ +  +  +  + ]:        7121 :  if(tread==1) dtset%d3e_pert1_dir(1:3)=intarr(1:3)
     765                 :             : 
     766                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'d3e_pert1_elfd',tread,'INT')
     767         [ +  + ]:        7010 :  if(tread==1) dtset%d3e_pert1_elfd=intarr(1)
     768                 :             : 
     769                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'d3e_pert1_phon',tread,'INT')
     770         [ +  + ]:        7010 :  if(tread==1) dtset%d3e_pert1_phon=intarr(1)
     771                 :             : 
     772                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,3,string(1:lenstr),'d3e_pert2_dir',tread,'INT')
     773   [ +  +  +  + ]:        7121 :  if(tread==1) dtset%d3e_pert2_dir(1:3)=intarr(1:3)
     774                 :             : 
     775                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'d3e_pert2_elfd',tread,'INT')
     776         [ +  + ]:        7010 :  if(tread==1) dtset%d3e_pert2_elfd=intarr(1)
     777                 :             : 
     778                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'d3e_pert2_phon',tread,'INT')
     779         [ +  + ]:        7010 :  if(tread==1) dtset%d3e_pert2_phon=intarr(1)
     780                 :             : 
     781                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,3,string(1:lenstr),'d3e_pert3_dir',tread,'INT')
     782   [ +  +  +  + ]:        7106 :  if(tread==1) dtset%d3e_pert3_dir(1:3)=intarr(1:3)
     783                 :             : 
     784                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'d3e_pert3_elfd',tread,'INT')
     785         [ +  + ]:        7010 :  if(tread==1) dtset%d3e_pert3_elfd=intarr(1)
     786                 :             : 
     787                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'d3e_pert3_phon',tread,'INT')
     788         [ +  + ]:        7010 :  if(tread==1) dtset%d3e_pert3_phon=intarr(1)
     789                 :             : 
     790                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'usepead',tread,'INT')
     791         [ +  + ]:        7010 :  if(tread==1) dtset%usepead=intarr(1)
     792                 :             : 
     793                 :        7010 :  response=0
     794                 :             :  if(dtset%rfddk/=0 .or. dtset%rfphon/=0 .or. dtset%rfelfd/=0 .or. &
     795                 :             :     dtset%rfstrs/=0 .or. dtset%rf2_dkdk/=0 .or. dtset%rf2_dkde/=0 .or. &
     796                 :             :     dtset%d3e_pert1_elfd/=0 .or. dtset%d3e_pert1_phon/=0 .or. &
     797                 :             :     dtset%d3e_pert2_elfd/=0 .or. dtset%d3e_pert2_phon/=0 .or. &
     798   [ +  +  +  +  :        7010 :     dtset%d3e_pert3_elfd/=0 .or. dtset%d3e_pert3_phon/=0 ) response=1
          +  +  +  +  +  
          +  +  +  +  +  
          +  -  +  -  -  
                      + ]
     799                 :             : 
     800                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prepanl',tread,'INT')
     801         [ +  + ]:        7010 :  if(tread==1) dtset%prepanl=intarr(1)
     802                 :             : 
     803                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prepgkk',tread,'INT')
     804         [ +  + ]:        7010 :  if(tread==1) dtset%prepgkk=intarr(1)
     805                 :             : 
     806                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'use_nonscf_gkk',tread,'INT')
     807         [ +  + ]:        7010 :  if(tread==1) dtset%use_nonscf_gkk=intarr(1)
     808                 :             : 
     809                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'use_yaml',tread,'INT')
     810         [ +  + ]:        7010 :  if(tread==1) dtset%use_yaml=intarr(1)
     811                 :             : 
     812                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'use_oldchi',tread,'INT')
     813         [ +  + ]:        7010 :  if(tread==1) dtset%use_oldchi=intarr(1)
     814                 :             : 
     815                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'brav',tread,'INT')
     816         [ +  + ]:        7010 :  if(tread==1) dtset%brav=intarr(1)
     817                 :             : 
     818                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'boxcutmin',tread,'DPR')
     819         [ +  + ]:        7010 :  if(tread==1) dtset%boxcutmin=dprarr(1)
     820                 :             : 
     821                 :             : !Initialize cellcharge, that might differ for each image
     822                 :        7010 :  cellcharge_min=huge(one)
     823         [ +  + ]:       14280 :  do iimage=1,dtset%nimage
     824         [ +  + ]:        7270 :    if (dtset%nimage /= 1) call wrtout(std_out, sjoin(' invars2: cellcharge, treat image number: ',itoa(iimage)))
     825                 :             : 
     826                 :             : !  Read cellcharge for each image, but use it only to initialize cellcharge_min
     827                 :             : !  The old name 'charge' is still tolerated. Will be removed in due time.
     828                 :        7270 :    dprarr(1)=dtset%cellcharge(iimage)
     829                 :        7270 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'cellcharge',tread,'DPR')
     830         [ +  + ]:        7270 :    if(tread==1)then
     831                 :          34 :      dtset%cellcharge(iimage)=dprarr(1)
     832                 :             :    else
     833                 :        7236 :      call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'charge',tread,'DPR')
     834         [ +  + ]:        7236 :      if(tread==1) dtset%cellcharge(iimage)=dprarr(1)
     835                 :             :    endif
     836                 :             : !  Possibly overwrite cellcharge from the first image with a specific value for the current image
     837                 :        7270 :    call intagm_img(dprarr,iimage,jdtset,lenstr,dtset%nimage,1,string,'cellcharge',tread_alt,'DPR')
     838         [ +  + ]:        7270 :    if(tread_alt==1)then
     839                 :           3 :      dtset%cellcharge(iimage)=dprarr(1)
     840                 :             :    else
     841                 :        7267 :      call intagm_img(dprarr,iimage,jdtset,lenstr,dtset%nimage,1,string,'charge',tread_alt,'DPR')
     842         [ -  + ]:        7267 :      if(tread_alt==1) dtset%cellcharge(iimage)=dprarr(1)
     843                 :             :    endif
     844                 :             : 
     845                 :       14280 :    if(dtset%cellcharge(iimage) < cellcharge_min)cellcharge_min=dtset%cellcharge(iimage)
     846                 :             :  end do
     847                 :             : 
     848                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'invovl_algo',tread,'INT')
     849         [ +  + ]:        7010 :  if(tread==1)dtset%invovl_algo=intarr(1)
     850                 :             : 
     851                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'invovl_blksliced',tread,'INT')
     852         [ +  + ]:        7010 :  if(tread==1)dtset%invovl_blksliced=intarr(1)
     853                 :             : 
     854                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'invovl_dyn_prec',tread,'INT')
     855         [ +  + ]:        7010 :  if(tread==1)dtset%invovl_dyn_prec=intarr(1)
     856                 :             : 
     857                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'invovl_precision',tread,'DPR')
     858         [ +  + ]:        7010 :  if(tread==1) dtset%invovl_precision=dprarr(1)
     859                 :             : 
     860                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'invovl_prec_ceil',tread,'DPR')
     861         [ +  + ]:        7010 :  if(tread==1) dtset%invovl_prec_ceil=dprarr(1)
     862                 :             : 
     863                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dosdeltae',tread,'ENE')
     864         [ +  + ]:        7010 :  if(tread==1) dtset%dosdeltae=dprarr(1)
     865                 :             : 
     866                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dtion',tread,'DPR')
     867         [ +  + ]:        7010 :  if(tread==1) dtset%dtion=dprarr(1)
     868                 :             : 
     869                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dtele',tread,'TIM')
     870         [ +  + ]:        7010 :  if(tread==1) dtset%dtele=dprarr(1)
     871                 :             : 
     872                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'ecut',tread,'ENE')
     873         [ +  - ]:        7010 :  if(tread==1) dtset%ecut=dprarr(1)
     874                 :             : 
     875                 :             :  ! With planewaves, ecut must use positive ecut
     876                 :             :  ! Must perform the check here instead of chkinp else the code sigfaults in mpi_setup before calling chkinp
     877         [ +  - ]:        7010 :  if(dtset%usewvl==0)then
     878         [ -  + ]:        7010 :    if (dtset%ecut < tol2) then
     879                 :             :      write(msg, '(3a)' )&
     880                 :           0 :        'The input keyword "ecut" is compulsory !',ch10,&
     881                 :           0 :        'Action: add a value for "ecut" in the input file.'
     882                 :           0 :      ABI_ERROR(msg)
     883                 :             :    end if
     884                 :             :  end if
     885                 :             : 
     886                 :             : 
     887                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,size(dtset%einterp),string(1:lenstr),'einterp',tread,'DPR')
     888   [ +  +  +  + ]:        7030 :  if(tread==1) dtset%einterp=dprarr(1:size(dtset%einterp))
     889                 :             : 
     890                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'elph2_imagden',tread,'ENE')
     891         [ +  + ]:        7010 :  if(tread==1) dtset%elph2_imagden=dprarr(1)
     892                 :             : 
     893                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'esmear',tread,'ENE')
     894         [ +  + ]:        7010 :  if(tread==1) dtset%esmear=dprarr(1)
     895                 :             : 
     896                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'fermie_nest',tread,'ENE')
     897         [ +  + ]:        7010 :  if(tread==1) dtset%fermie_nest=dprarr(1)
     898                 :             : 
     899                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dfpt_sciss',tread,'ENE')
     900         [ +  + ]:        7010 :  if(tread==1) dtset%dfpt_sciss=dprarr(1)
     901                 :             : 
     902                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,3,string(1:lenstr),'tmesh',tread,'DPR')
     903   [ +  +  +  + ]:        7244 :  if(tread==1) dtset%tmesh=dprarr(1:3)
     904   [ +  +  +  -  :       28040 :  ABI_CHECK(all(dtset%tmesh >= zero), sjoin("Invalid tmesh containing T < 0:", ltoa(dtset%tmesh)))
                   -  + ]
     905                 :             : 
     906                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'tsmear',tread,'ENE')
     907         [ +  + ]:        7010 :  if(tread==1) dtset%tsmear=dprarr(1)
     908                 :             : 
     909                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'vis',tread,'DPR')
     910         [ +  + ]:        7010 :  if(tread==1) dtset%vis=dprarr(1)
     911                 :             : 
     912                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'vloc_rcut',tread,'LEN')
     913         [ +  + ]:        7010 :  if(tread==1) dtset%vloc_rcut=dprarr(1)
     914                 :             : 
     915                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'ecutsm',tread,'ENE')
     916         [ +  + ]:        7010 :  if(tread==1) dtset%ecutsm=dprarr(1)
     917                 :             : 
     918                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'ggtrcut',tread,'DPR')
     919         [ +  + ]:        7010 :  if(tread==1) dtset%ggtrcut=dprarr(1)
     920                 :             : 
     921                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'exchmix',tread,'DPR')
     922         [ +  + ]:        7010 :  if(tread==1) dtset%exchmix=dprarr(1)
     923                 :             : 
     924                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dilatmx',tread,'DPR')
     925         [ +  + ]:        7010 :  if(tread==1) dtset%dilatmx=dprarr(1)
     926                 :             : 
     927                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'fxcartfactor',tread,'DPR')
     928         [ +  + ]:        7010 :  if(tread==1) dtset%fxcartfactor=dprarr(1)
     929                 :             : 
     930                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'strfact',tread,'DPR')
     931         [ +  + ]:        7010 :  if(tread==1) dtset%strfact=dprarr(1)
     932                 :             : 
     933                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'effmass_free',tread,'DPR')
     934         [ +  + ]:        7010 :  if(tread==1) dtset%effmass_free=dprarr(1)
     935                 :             : 
     936                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,2,string(1:lenstr),'mdtemp',tread,'DPR')
     937   [ +  +  +  + ]:        7088 :  if(tread==1) dtset%mdtemp(1:2)=dprarr(1:2)
     938                 :             : 
     939                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'rfomega',tread,'ENE')
     940         [ +  + ]:        7010 :  if(tread==1) dtset%rfomega=dprarr(1)
     941                 :             : 
     942                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'rfeta',tread,'ENE')
     943         [ -  + ]:        7010 :  if(tread==1) dtset%rfeta=dprarr(1)
     944                 :             : 
     945                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'magpen',tread,'ENE')
     946         [ +  + ]:        7010 :  if(tread==1) dtset%magpen=dprarr(1)
     947                 :             : 
     948                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prt1mag',tread,'INT')
     949         [ +  + ]:        7010 :  if(tread==1) dtset%prt1mag=intarr(1)
     950                 :             : 
     951                 :             : !LONG WAVE integer input variables
     952                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,2,string(1:lenstr),'d3e_pert1_magat',tread,'INT')
     953                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'rf1magat',tread_alt,'INT')
     954   [ +  +  -  +  :        7019 :  if(tread==1.or.tread_alt==1) dtset%d3e_pert1_magat(1:2)=intarr(1:2)
                   +  + ]
     955         [ -  + ]:        7010 :  if (tread_alt==1) tread_key=1
     956         [ +  + ]:        7010 :  if(dtset%d3e_pert1_magat(1)==-1)then
     957                 :        7007 :    dtset%d3e_pert1_magat(1)=1
     958                 :             :  endif
     959         [ +  + ]:        7010 :  if(dtset%d3e_pert1_magat(2)==-1)then
     960                 :        7007 :    dtset%d3e_pert1_magat(2)=dtset%natom
     961                 :             :  endif
     962                 :             : 
     963                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,2,string(1:lenstr),'d3e_pert2_magat',tread,'INT')
     964                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'rf2magat',tread_alt,'INT')
     965   [ +  +  -  +  :        7019 :  if(tread==1.or.tread_alt==1) dtset%d3e_pert2_magat(1:2)=intarr(1:2)
                   +  + ]
     966         [ -  + ]:        7010 :  if (tread_alt==1) tread_key=1
     967         [ +  + ]:        7010 :  if(dtset%d3e_pert2_magat(1)==-1)then
     968                 :        7007 :    dtset%d3e_pert2_magat(1)=1
     969                 :             :  endif
     970         [ +  + ]:        7010 :  if(dtset%d3e_pert2_magat(2)==-1)then
     971                 :        7007 :    dtset%d3e_pert2_magat(2)=dtset%natom
     972                 :             :  endif
     973                 :             : 
     974                 :             :  ! SCF-Preconditioning input variables
     975                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'precon_in_memory',tread,'INT')
     976         [ -  + ]:        7010 :  if(tread==1) dtset%precon_in_memory=intarr(1)
     977                 :             : 
     978                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'precon_ls_maxite',tread,'INT')
     979         [ +  + ]:        7010 :  if(tread==1) dtset%precon_ls_maxite=intarr(1)
     980                 :             : 
     981                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'precon_ls_rtol',tread,'DPR')
     982         [ +  + ]:        7010 :  if(tread==1) dtset%precon_ls_rtol=dprarr(1)
     983                 :             : 
     984                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'precon_tsmear',tread,'ENE')
     985         [ +  + ]:        7010 :  if(tread==1) dtset%precon_tsmear=dprarr(1)
     986                 :             : 
     987                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'precon_verbose',tread,'INT')
     988         [ -  + ]:        7010 :  if(tread==1) dtset%precon_verbose=intarr(1)
     989                 :             : 
     990                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prepalw',tread,'INT')
     991         [ +  + ]:        7010 :  if(tread==1) dtset%prepalw=intarr(1)
     992                 :             : 
     993         [ +  + ]:        7010 :  if(dtset%optdriver==RUNL_LONGWAVE) then
     994                 :          17 :    tread_key=0
     995                 :             : 
     996                 :          17 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'timdisp',tread,'INT')
     997         [ +  + ]:          17 :    if(tread==1) dtset%timdisp=intarr(1)
     998                 :             : 
     999                 :          17 :    call intagm(dprarr,intarr,jdtset,marr,3,string(1:lenstr),'d3e_pert1_dir',tread,'INT')
    1000   [ +  +  -  +  :          37 :    if(tread==1.or.tread_alt==1) dtset%d3e_pert1_dir(1:3)=intarr(1:3)
                   +  + ]
    1001         [ -  + ]:          17 :    if (tread_alt==1) tread_key=1
    1002                 :             : 
    1003                 :          17 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'d3e_pert1_elfd',tread,'INT')
    1004   [ +  +  -  + ]:          17 :    if(tread==1.or.tread_alt==1) dtset%d3e_pert1_elfd=intarr(1)
    1005         [ -  + ]:          17 :    if (tread_alt==1) tread_key=1
    1006                 :             : 
    1007                 :          17 :    call intagm(dprarr,intarr,jdtset,marr,3,string(1:lenstr),'d3e_pert1_magdir',tread,'INT')
    1008   [ +  +  -  +  :          37 :    if(tread==1.or.tread_alt==1) dtset%d3e_pert1_magdir(1:3)=intarr(1:3)
                   +  + ]
    1009         [ -  + ]:          17 :    if (tread_alt==1) tread_key=1
    1010                 :             : 
    1011                 :          17 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'d3e_pert1_magn',tread,'INT')
    1012   [ +  +  -  + ]:          17 :    if(tread==1.or.tread_alt==1) dtset%d3e_pert1_magn=intarr(1)
    1013         [ -  + ]:          17 :    if (tread_alt==1) tread_key=1
    1014                 :             : 
    1015                 :          17 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'d3e_pert1_phon',tread,'INT')
    1016   [ +  +  -  + ]:          17 :    if(tread==1.or.tread_alt==1) dtset%d3e_pert1_phon=intarr(1)
    1017         [ -  + ]:          17 :    if (tread_alt==1) tread_key=1
    1018                 :             : 
    1019                 :          17 :    call intagm(dprarr,intarr,jdtset,marr,3,string(1:lenstr),'d3e_pert2_dir',tread,'INT')
    1020   [ +  +  -  +  :          37 :    if(tread==1.or.tread_alt==1) dtset%d3e_pert2_dir(1:3)=intarr(1:3)
                   +  + ]
    1021         [ -  + ]:          17 :    if (tread_alt==1) tread_key=1
    1022                 :             : 
    1023                 :          17 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'d3e_pert2_elfd',tread,'INT')
    1024   [ +  +  -  + ]:          17 :    if(tread==1.or.tread_alt==1) dtset%d3e_pert2_elfd=intarr(1)
    1025         [ -  + ]:          17 :    if (tread_alt==1) tread_key=1
    1026                 :             : 
    1027                 :          17 :    call intagm(dprarr,intarr,jdtset,marr,3,string(1:lenstr),'d3e_pert2_magdir',tread,'INT')
    1028   [ +  +  -  +  :          37 :    if(tread==1.or.tread_alt==1) dtset%d3e_pert2_magdir(1:3)=intarr(1:3)
                   +  + ]
    1029         [ -  + ]:          17 :    if (tread_alt==1) tread_key=1
    1030                 :             : 
    1031                 :          17 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'d3e_pert2_magn',tread,'INT')
    1032   [ +  +  -  + ]:          17 :    if(tread==1.or.tread_alt==1) dtset%d3e_pert2_magn=intarr(1)
    1033         [ -  + ]:          17 :    if (tread_alt==1) tread_key=1
    1034                 :             : 
    1035                 :          17 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'d3e_pert2_phon',tread,'INT')
    1036   [ +  +  -  + ]:          17 :    if(tread==1.or.tread_alt==1) dtset%d3e_pert2_phon=intarr(1)
    1037         [ -  + ]:          17 :    if (tread_alt==1) tread_key=1
    1038                 :             : 
    1039                 :          17 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'d3e_pert2_strs',tread,'INT')
    1040   [ +  -  -  + ]:          17 :    if(tread==1.or.tread_alt==1) dtset%d3e_pert2_strs=intarr(1)
    1041         [ -  + ]:          17 :    if (tread_alt==1) tread_key=1
    1042                 :             : 
    1043                 :          17 :    call intagm(dprarr,intarr,jdtset,marr,2,string(1:lenstr),'d3e_pert3_atpol',tread,'INT')
    1044   [ +  -  -  +  :          17 :    if(tread==1.or.tread_alt==1) dtset%d3e_pert3_atpol(1:2)=intarr(1:2)
                   -  - ]
    1045         [ -  + ]:          17 :    if (tread_alt==1) tread_key=1
    1046                 :             : 
    1047                 :          17 :    call intagm(dprarr,intarr,jdtset,marr,3,string(1:lenstr),'d3e_pert3_dir',tread,'INT')
    1048   [ +  -  -  +  :          17 :    if(tread==1.or.tread_alt==1) dtset%d3e_pert3_dir(1:3)=intarr(1:3)
                   -  - ]
    1049         [ -  + ]:          17 :    if (tread_alt==1) tread_key=1
    1050                 :             : 
    1051                 :          17 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'d3e_pert3_elfd',tread,'INT')
    1052   [ +  -  -  + ]:          17 :    if(tread==1.or.tread_alt==1) dtset%d3e_pert3_elfd=intarr(1)
    1053         [ -  + ]:          17 :    if (tread_alt==1) tread_key=1
    1054                 :             : 
    1055                 :          17 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'d3e_pert3_phon',tread,'INT')
    1056   [ +  -  -  + ]:          17 :    if(tread==1.or.tread_alt==1) dtset%d3e_pert3_phon=intarr(1)
    1057         [ -  + ]:          17 :    if (tread_alt==1) tread_key=1
    1058                 :             : 
    1059                 :          17 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'lw_flexo',tread,'INT')
    1060         [ +  + ]:          17 :    if(tread==1) dtset%lw_flexo=intarr(1)
    1061                 :             : 
    1062                 :          17 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'lw_qdrpl',tread,'INT')
    1063         [ +  + ]:          17 :    if(tread==1) dtset%lw_qdrpl=intarr(1)
    1064                 :             : 
    1065                 :          17 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'lw_natopt',tread,'INT')
    1066         [ +  + ]:          17 :    if(tread==1) dtset%lw_natopt=intarr(1)
    1067                 :             : 
    1068                 :          17 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'ffnl_lw',tread,'INT')
    1069         [ +  + ]:          17 :    if(tread==1) dtset%ffnl_lw=intarr(1)
    1070                 :             :  end if
    1071                 :             : 
    1072                 :             :  ! Recursion input variables
    1073                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'tfkinfunc',tread,'INT')
    1074         [ +  + ]:        7010 :  if(tread==1) dtset%tfkinfunc=intarr(1)
    1075                 :             : 
    1076                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'recgratio',tread,'INT')
    1077         [ +  + ]:        7010 :  if(tread==1) dtset%recgratio=intarr(1)
    1078                 :             : 
    1079                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'recefermi',tread,'ENE')
    1080         [ +  + ]:        7010 :  if(tread==1) dtset%recefermi=dprarr(1)
    1081                 :             : 
    1082                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'recnpath',tread,'INT')
    1083         [ +  + ]:        7010 :  if(tread==1) dtset%recnpath=intarr(1)
    1084                 :             : 
    1085                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'recnrec',tread,'INT')
    1086         [ +  + ]:        7010 :  if(tread==1) dtset%recnrec=intarr(1)
    1087                 :             : 
    1088                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'recrcut',tread,'LEN')
    1089         [ +  + ]:        7010 :  if(tread==1) dtset%recrcut=dprarr(1)
    1090                 :             : 
    1091                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'recptrott',tread,'INT')
    1092         [ +  + ]:        7010 :  if(tread==1) dtset%recptrott=intarr(1)
    1093                 :             : 
    1094                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'rectesteg',tread,'INT')
    1095         [ +  + ]:        7010 :  if(tread==1) dtset%rectesteg=intarr(1)
    1096                 :             : 
    1097                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'rectolden',tread,'DPR')
    1098         [ +  + ]:        7010 :  if(tread==1) dtset%rectolden=dprarr(1)
    1099                 :             : 
    1100                 :             :  ! Constant NPT Molecular Dynamics Input variables
    1101                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'noseinert',tread,'DPR')
    1102         [ +  + ]:        7010 :  if(tread==1) dtset%noseinert=dprarr(1)
    1103                 :             : 
    1104                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'bmass',tread,'DPR')
    1105         [ +  + ]:        7010 :  if(tread==1) dtset%bmass=dprarr(1)
    1106                 :             : 
    1107                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,dtset%nnos,string(1:lenstr),'qmass',tread,'DPR')
    1108   [ +  +  +  + ]:        7040 :  if(tread==1) dtset%qmass(:)=dprarr(1:dtset%nnos)
    1109                 :             : 
    1110                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'tphysel',tread,'ENE')
    1111         [ +  + ]:        7010 :  if(tread==1) dtset%tphysel=dprarr(1)
    1112                 :             : 
    1113                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,6,string(1:lenstr),'strtarget',tread,'DPR')
    1114   [ +  +  +  + ]:        7064 :  if(tread==1) dtset%strtarget(1:6)=dprarr(1:6)
    1115                 :             : 
    1116                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,3,string(1:lenstr),'vcutgeo',tread,'DPR')
    1117   [ +  +  +  + ]:        7061 :  if(tread==1) dtset%vcutgeo(1:3)=dprarr(1:3)
    1118                 :             : 
    1119                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'friction',tread,'DPR')
    1120         [ +  + ]:        7010 :  if(tread==1) dtset%friction=dprarr(1)
    1121                 :             : 
    1122                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'frictionbar',tread,'DPR')
    1123         [ +  + ]:        7010 :  if(tread==1) dtset%frictionbar=dprarr(1)
    1124                 :             : 
    1125                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'mdwall',tread,'LEN')
    1126         [ +  + ]:        7010 :  if(tread==1) dtset%mdwall=dprarr(1)
    1127                 :             : 
    1128                 :             :  ! Path-Integral Molecular Dynamics Input variables
    1129                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'adpimd',tread,'INT')
    1130         [ +  + ]:        7010 :  if(tread==1) dtset%adpimd=intarr(1)
    1131                 :             : 
    1132                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'adpimd_gamma',tread,'DPR')
    1133         [ +  + ]:        7010 :  if(tread==1) dtset%adpimd_gamma=dprarr(1)
    1134                 :             : 
    1135                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'pimd_constraint',tread,'INT')
    1136         [ +  + ]:        7010 :  if(tread==1) dtset%pimd_constraint=intarr(1)
    1137                 :             : 
    1138                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'pitransform',tread,'INT')
    1139         [ +  + ]:        7010 :  if(tread==1) dtset%pitransform=intarr(1)
    1140                 :             : 
    1141                 :             :  ! Default for pimass is amu
    1142         [ +  + ]:       15678 :  dtset%pimass(1:ntypat)=dtset%amu_orig(1:ntypat,1)
    1143                 :             :  ! NOTE: initialisation with the first image only. TO BE MODIFIED ....
    1144                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,ntypat,string(1:lenstr),'pimass',tread,'DPR')
    1145   [ +  +  +  + ]:        7016 :  if(tread==1) dtset%pimass(1:ntypat)=dprarr(1:ntypat)
    1146                 :             : 
    1147                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'spinmagntarget',tread,'DPR')
    1148         [ +  + ]:        7010 :  if(tread==1) dtset%spinmagntarget=dprarr(1)
    1149                 :             : 
    1150                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'eshift',tread,'ENE')
    1151         [ +  + ]:        7010 :  if(tread==1) dtset%eshift=dprarr(1)
    1152                 :             : 
    1153                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,3,string(1:lenstr),'boxcenter',tread,'DPR')
    1154   [ +  +  +  + ]:        7115 :  if(tread==1) dtset%boxcenter(1:3)=dprarr(1:3)
    1155                 :             : 
    1156                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'ecuteps',tread,'ENE')
    1157         [ +  + ]:        7010 :  if(tread==1) dtset%ecuteps=dprarr(1)
    1158                 :             : 
    1159                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'ecutsigx',tread,'ENE')
    1160         [ -  + ]:        7010 :  if (any(dtset%optdriver == [RUNL_GWR])) dtset%ecutsigx = dtset%ecut
    1161         [ +  + ]:        7010 :  if (tread==1) dtset%ecutsigx=dprarr(1)
    1162                 :             :  !ABI_CHECK(dtset%ecutsigx <= four * dtset%ecut, "ecutwfn cannot be greater that 4*ecut")
    1163                 :             : 
    1164                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'ecutwfn',tread,'ENE')
    1165         [ +  + ]:        7010 :  if (any(dtset%optdriver == [RUNL_SCREENING, RUNL_SIGMA, RUNL_GWR])) dtset%ecutwfn=dtset%ecut
    1166         [ +  + ]:        7010 :  if (tread==1) dtset%ecutwfn = dprarr(1)
    1167                 :             :  !ABI_CHECK(dtset%ecutwfn <= dtset%ecut, "ecutwfn cannot be greater that ecut")
    1168                 :             : 
    1169                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'omegasimax',tread,'ENE')
    1170         [ +  + ]:        7010 :  if(tread==1) dtset%omegasimax=dprarr(1)
    1171                 :             : 
    1172                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'omegasrdmax',tread,'ENE')
    1173         [ +  + ]:        7010 :  if(tread==1) dtset%omegasrdmax=dprarr(1)
    1174                 :             : 
    1175                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'mbpt_sciss',tread,'ENE')
    1176         [ +  + ]:        7010 :  if(tread==1) dtset%mbpt_sciss=dprarr(1)
    1177                 :             : 
    1178                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'spbroad',tread,'ENE')
    1179         [ +  + ]:        7010 :  if(tread==1) dtset%spbroad=dprarr(1)
    1180                 :             : 
    1181                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'stmbias',tread,'ENE')
    1182         [ +  + ]:        7010 :  if(tread==1) dtset%stmbias=dprarr(1)
    1183                 :             : 
    1184                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'awtr',tread,'INT')
    1185         [ +  + ]:        7010 :  if(tread==1) dtset%awtr=intarr(1)
    1186                 :             : 
    1187                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'inclvkb',tread,'INT')
    1188         [ +  + ]:        7010 :  if(tread==1) dtset%inclvkb=intarr(1)
    1189                 :             : 
    1190                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'nomegasf',tread,'INT')
    1191         [ +  + ]:        7010 :  if(tread==1) dtset%nomegasf=intarr(1)
    1192                 :             : 
    1193                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'spmeth',tread,'INT')
    1194         [ +  + ]:        7010 :  if(tread==1) dtset%spmeth=intarr(1)
    1195                 :             : 
    1196                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'symchi',tread,'INT')
    1197         [ +  + ]:        7010 :  if(tread==1) dtset%symchi=intarr(1)
    1198                 :             : 
    1199                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'getefmas',tread,'INT')
    1200         [ +  + ]:        7010 :  if(tread==1) dtset%getefmas=intarr(1)
    1201                 :             : 
    1202                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'getscr',tread,'INT')
    1203         [ +  + ]:        7010 :  if(tread==1) dtset%getscr=intarr(1)
    1204                 :             : 
    1205                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'getscr_filepath',tread,'KEY', key_value=key_value)
    1206         [ +  + ]:        7010 :  if(tread==1) dtset%getscr_filepath = key_value
    1207                 :             : 
    1208                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'gwgamma',tread,'INT')
    1209         [ +  + ]:        7010 :  if(tread==1) dtset%gwgamma=intarr(1)
    1210                 :             : 
    1211                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'gwpt_wmode',tread,'INT')
    1212         [ +  + ]:        7010 :  if(tread==1) dtset%gwpt_wmode=intarr(1)
    1213                 :             : 
    1214                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'gwpt_g2mode',tread,'INT')
    1215         [ +  + ]:        7010 :  if(tread==1) dtset%gwpt_g2mode=intarr(1)
    1216                 :             : 
    1217                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'irdefmas',tread,'INT')
    1218         [ -  + ]:        7010 :  if(tread==1) dtset%irdefmas=intarr(1)
    1219                 :             : 
    1220                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'irdsuscep',tread,'INT')
    1221         [ +  + ]:        7010 :  if(tread==1) dtset%irdsuscep=intarr(1)
    1222                 :             : 
    1223                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'irdscr',tread,'INT')
    1224         [ +  + ]:        7010 :  if(tread==1) dtset%irdscr=intarr(1)
    1225                 :             : 
    1226                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'nomegasi',tread,'INT')
    1227         [ +  + ]:        7010 :  if(tread==1) dtset%nomegasi=intarr(1)
    1228                 :             : 
    1229                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'ppmodel',tread,'INT')
    1230         [ +  + ]:        7010 :  if(tread==1) dtset%ppmodel=intarr(1)
    1231                 :             : 
    1232                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'symsigma',tread,'INT')
    1233         [ +  + ]:        7010 :  if(tread==1) dtset%symsigma=intarr(1)
    1234                 :             : 
    1235                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'symsigma_de',tread,'ENE')
    1236         [ +  + ]:        7010 :  if(tread==1) dtset%symsigma_de=dprarr(1)
    1237                 :             : 
    1238                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'fftgw',tread,'INT')
    1239         [ +  + ]:        7010 :  if(tread==1) dtset%fftgw=intarr(1)
    1240                 :             : 
    1241                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'fft_count',tread,'INT')
    1242         [ -  + ]:        7010 :  if(tread==1) dtset%fft_count=intarr(1)
    1243                 :             : 
    1244                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'getsuscep',tread,'INT')
    1245         [ +  + ]:        7010 :  if(tread==1) dtset%getsuscep=intarr(1)
    1246                 :             : 
    1247                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'getqps',tread,'INT')
    1248         [ +  + ]:        7010 :  if(tread==1) dtset%getqps=intarr(1)
    1249                 :             : 
    1250                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'gwpara',tread,'INT')
    1251         [ +  + ]:        7010 :  if(tread==1) dtset%gwpara=intarr(1)
    1252                 :             : 
    1253                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'irdqps',tread,'INT')
    1254         [ +  + ]:        7010 :  if(tread==1) dtset%irdqps=intarr(1)
    1255                 :             : 
    1256                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'ppmfrq',tread,'ENE')
    1257         [ +  + ]:        7010 :  if(tread==1) dtset%ppmfrq=dprarr(1)
    1258                 :             : 
    1259                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'rcut',tread,'LEN')
    1260         [ -  + ]:        7010 :  if(tread==1) dtset%rcut=dprarr(1)
    1261                 :             : 
    1262                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'fock_rcut',tread,'LEN')
    1263         [ +  + ]:        7010 :  if(tread==1) dtset%fock_rcut=dprarr(1)
    1264                 :             : 
    1265                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'gw_rcut',tread,'LEN')
    1266         [ +  + ]:        7010 :  if(tread==1) dtset%gw_rcut=dprarr(1)
    1267                 :             : 
    1268                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'zcut',tread,'ENE')
    1269         [ +  + ]:        7010 :  if(tread==1) dtset%zcut = dprarr(1)
    1270                 :             : 
    1271                 :             :  ! q-points for long wave-length limit.
    1272         [ +  + ]:        7010 :  if (dtset%gw_nqlwl > 0) then
    1273                 :           1 :    call intagm(dprarr,intarr,jdtset,marr,3*dtset%gw_nqlwl,string(1:lenstr),'gw_qlwl',tread,'DPR')
    1274   [ +  -  +  +  :           7 :    if(tread==1) dtset%gw_qlwl(1:3,1:dtset%gw_nqlwl) = reshape(dprarr(1:3*dtset%gw_nqlwl), [3, dtset%gw_nqlwl])
             +  +  +  + ]
    1275                 :             :  end if
    1276                 :             : 
    1277                 :             :  !@bethe_salpeter
    1278                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'bs_nstates',tread,'INT')
    1279         [ +  + ]:        7010 :  if(tread==1) dtset%bs_nstates=intarr(1)
    1280                 :             : 
    1281                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'bs_algorithm',tread,'INT')
    1282         [ +  + ]:        7010 :  if(tread==1) dtset%bs_algorithm=intarr(1)
    1283                 :             : 
    1284                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'bs_haydock_niter',tread,'INT')
    1285         [ +  + ]:        7010 :  if(tread==1) dtset%bs_haydock_niter=intarr(1)
    1286                 :             : 
    1287                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'bs_hayd_term',tread,'INT')
    1288         [ +  + ]:        7010 :  if(tread==1) dtset%bs_hayd_term=intarr(1)
    1289                 :             : 
    1290                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'bs_exchange_term',tread,'INT')
    1291         [ +  + ]:        7010 :  if(tread==1) dtset%bs_exchange_term=intarr(1)
    1292                 :             : 
    1293                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'bs_calctype',tread,'INT')
    1294         [ +  + ]:        7010 :  if(tread==1) dtset%bs_calctype=intarr(1)
    1295                 :             : 
    1296                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'bs_coulomb_term',tread,'INT')
    1297         [ +  + ]:        7010 :  if(tread==1) dtset%bs_coulomb_term=intarr(1)
    1298                 :             : 
    1299                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'bs_coupling',tread,'INT')
    1300         [ +  + ]:        7010 :  if(tread==1) dtset%bs_coupling=intarr(1)
    1301                 :             : 
    1302                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'irdbseig',tread,'INT')
    1303         [ +  + ]:        7010 :  if(tread==1) dtset%irdbseig=intarr(1)
    1304                 :             : 
    1305                 :             :  !call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'irdbsr',tread,'INT')
    1306                 :             :  !if(tread==1) dtset%irdbsr=intarr(1)
    1307                 :             : 
    1308                 :             :  !call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'irdbsc',tread,'INT')
    1309                 :             :  !if(tread==1) dtset%irdbsc=intarr(1)
    1310                 :             : 
    1311                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'getbseig',tread,'INT')
    1312         [ +  + ]:        7010 :  if(tread==1) dtset%getbseig=intarr(1)
    1313                 :             : 
    1314                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'getbsreso',tread,'INT')
    1315         [ +  + ]:        7010 :  if(tread==1) dtset%getbsreso=intarr(1)
    1316                 :             : 
    1317                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'getbscoup',tread,'INT')
    1318         [ -  + ]:        7010 :  if(tread==1) dtset%getbscoup=intarr(1)
    1319                 :             : 
    1320                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'gethaydock',tread,'INT')
    1321         [ -  + ]:        7010 :  if(tread==1) dtset%gethaydock=intarr(1)
    1322                 :             : 
    1323                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'bs_interp_method',tread,'INT')
    1324         [ +  + ]:        7010 :  if(tread==1) dtset%bs_interp_method=intarr(1)
    1325                 :             : 
    1326                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'bs_interp_mode',tread,'INT')
    1327         [ +  + ]:        7010 :  if(tread==1) dtset%bs_interp_mode=intarr(1)
    1328                 :             : 
    1329                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'bs_interp_prep',tread,'INT')
    1330         [ +  + ]:        7010 :  if(tread==1) dtset%bs_interp_prep=intarr(1)
    1331                 :             : 
    1332                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'bs_interp_m3_width',tread,'DPR')
    1333         [ +  + ]:        7010 :  if(tread==1) dtset%bs_interp_m3_width=dprarr(1)
    1334                 :             : 
    1335                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,dtset%nsppol,string(1:lenstr),'bs_loband',tread,'INT')
    1336   [ +  +  +  -  :        7069 :  if(tread==1) dtset%bs_loband=intarr(1:dtset%nsppol)
          -  +  -  -  +  
                      + ]
    1337                 :             : 
    1338                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,3,string(1:lenstr),'bs_interp_kmult',tread,'INT')
    1339   [ +  +  +  + ]:        7028 :  if(tread==1) dtset%bs_interp_kmult(1:3) = intarr(1:3)
    1340                 :             : 
    1341                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,2,string(1:lenstr),'bs_eh_cutoff',tread,'ENE')
    1342   [ -  +  -  - ]:        7010 :  if(tread==1) dtset%bs_eh_cutoff(1:2)=dprarr(1:2)
    1343                 :             : 
    1344                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,3,string(1:lenstr),'bs_freq_mesh',tread,'ENE')
    1345   [ +  +  +  + ]:        7091 :  if(tread==1) dtset%bs_freq_mesh(1:3)=dprarr(1:3)
    1346                 :             : 
    1347                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,2,string(1:lenstr),'bs_haydock_tol',tread,'DPR')
    1348   [ +  +  +  + ]:        7048 :  if(tread==1) dtset%bs_haydock_tol=dprarr(1:2)
    1349                 :             : 
    1350                 :        7010 :  ntypalch=dtset%ntypalch
    1351                 :        7010 :  npspalch=dtset%npspalch
    1352                 :             : 
    1353                 :             :  ! Compute ziontypat. When the pseudo-atom is pure, simple copy
    1354         [ +  + ]:        7010 :  if(ntyppure>0)then
    1355         [ +  + ]:       15648 :    do itypat=1,ntyppure
    1356                 :       15648 :      dtset%ziontypat(itypat)=zionpsp(itypat)
    1357                 :             :    end do
    1358                 :             :  end if
    1359                 :             : 
    1360                 :             :  ! When the pseudo-atom is alchemical, must make mixing
    1361         [ +  + ]:        7010 :  if(ntypalch>0)then
    1362         [ +  + ]:          40 :    do itypat=ntyppure+1,ntypat
    1363                 :          20 :      dtset%ziontypat(itypat)=zero
    1364         [ +  + ]:          80 :      do ipsp=ntyppure+1,npsp
    1365                 :             :        dtset%ziontypat(itypat)=dtset%ziontypat(itypat) &
    1366                 :          60 :         + dtset%mixalch_orig(ipsp-ntyppure,itypat-ntyppure,1)*zionpsp(ipsp)
    1367                 :             :      end do
    1368                 :             :    end do
    1369                 :             :  end if
    1370                 :             : 
    1371                 :        7010 :  dtset%nh_qFD=zero
    1372                 :        7010 :  dtset%ne_qFD=zero
    1373                 :        7010 :  dtset%ivalence=0
    1374                 :             : 
    1375         [ +  + ]:        7010 :  if (occopt==0 .or. occopt==1 .or. (occopt>=3 .and. occopt<=9) ) then
    1376                 :        6796 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'nband',tnband,'INT')
    1377         [ +  + ]:        6796 :    if(tnband==1) then
    1378                 :        4612 :      nband1=intarr(1)
    1379                 :             :    else
    1380                 :             :      ! Default value in the metallic case, or in the insulating case
    1381                 :        2184 :      fband=0.5_dp
    1382         [ +  + ]:        2184 :      if(occopt==1)fband=0.125_dp
    1383   [ +  +  -  + ]:        2184 :      if((occopt/=1).and.(dtset%accuracy==5.or.dtset%accuracy==6)) fband =0.75_dp
    1384         [ -  + ]:        2184 :      if (dtset%usewvl == 1) fband = zero
    1385                 :        2184 :      call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'fband',tfband,'DPR')
    1386         [ +  + ]:        2184 :      if(tfband==1)then
    1387                 :           3 :        fband=dprarr(1)
    1388                 :           3 :        write(msg, '(a,es16.8,a)' )' invars2: read the value of fband=',fband,' from input file.'
    1389                 :             :      else
    1390                 :        2181 :        write(msg, '(a,es16.8)' )' invars2: take the default value of fband=',fband
    1391                 :             :      end if
    1392                 :        2184 :      dtset%fband=fband
    1393                 :        2184 :      call wrtout(std_out,msg,'COLL')
    1394                 :             :      ! First compute the total valence charge
    1395                 :        2184 :      zval=zero
    1396                 :        2184 :      sum_spinat=zero
    1397         [ +  + ]:       29232 :      do iatom=1,natom
    1398                 :       27048 :        zval=zval+dtset%ziontypat(dtset%typat(iatom))
    1399                 :       29232 :        sum_spinat=sum_spinat+dtset%spinat(3,iatom)
    1400                 :             :      end do
    1401                 :        2184 :      zelect=zval-cellcharge_min
    1402                 :             :      ! Then select the minimum number of bands, and add the required number.
    1403                 :             :      ! Note that this number might be smaller than the one computed
    1404                 :             :      ! by a slightly different formula in invars1 (difference in fband).
    1405                 :             :      nband1=dtset%nspinor * ((ceiling(zelect-tol10)+1)/2 + ceiling( fband*natom - tol10 )) &
    1406   [ -  +  +  +  :        2184 : &     + (nsppol-1)*(ceiling(half*(sum_spinat -tol10)))
                   +  + ]
    1407                 :             :    end if
    1408                 :             : 
    1409                 :             :    ! Set nband to same input number for each k point and spin
    1410                 :             :    ! where nband1 is the eventual input, computed value, or default
    1411         [ +  + ]:      124088 :    do ikpt=1,nkpt*nsppol
    1412                 :      124088 :      dtset%nband(ikpt)=nband1
    1413                 :             :    end do
    1414                 :             : 
    1415         [ +  + ]:        6796 :    if (occopt==9)then
    1416                 :             :       !Read the valence band index
    1417                 :           1 :       call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'ivalence',tread,'INT')
    1418         [ +  - ]:           1 :       if (tread==1) dtset%ivalence=intarr(1)
    1419                 :           1 :       call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'nqfd',tread,'DPR')
    1420         [ +  - ]:           1 :       if (tread==1)then
    1421                 :           1 :         dtset%nqfd=dprarr(1)
    1422                 :           1 :         dtset%ne_qFD=dprarr(1)
    1423                 :           1 :         dtset%nh_qFD=dprarr(1)
    1424                 :             :         ! Here we assume that number of excited electrons  = number of excited holes.
    1425                 :             :         ! Potentially can be relaxed in the future if consistent changes with the
    1426                 :             :         ! cellcharge tag are made.
    1427                 :             :       end if
    1428                 :             :    end if
    1429                 :             : 
    1430         [ +  - ]:         214 :  else if (occopt==2) then
    1431                 :             :    ! Give nband explicitly for each k point and spin
    1432                 :         214 :    call intagm(dprarr,intarr,jdtset,nkpt*nsppol,nkpt*nsppol,string(1:lenstr),'nband',tnband,'INT')
    1433   [ +  -  +  + ]:         728 :    if(tnband==1) dtset%nband(1:nkpt*nsppol)=intarr(1:nkpt*nsppol)
    1434                 :             : 
    1435                 :             :  else
    1436                 :           0 :    write(msg, '(a,i0,3a)' )'occopt=',occopt,' not allowed.',ch10,'Action: correct your input file.'
    1437                 :           0 :    ABI_ERROR(msg)
    1438                 :             :  end if
    1439                 :             : 
    1440                 :             :  !----------------------------------------------------------------------------
    1441                 :             :  ! Read other parameters
    1442                 :             :  ! ALL CHECKING SHOULD BE DONE IN m_chkinp.F90
    1443                 :             : 
    1444                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'builtintest',tread,'INT')
    1445         [ +  + ]:        7010 :  if(tread==1) dtset%builtintest=intarr(1)
    1446                 :             : 
    1447                 :             :  ! Here we set the values of the different chk* flags depending on the value of expert_user.
    1448                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'expert_user',tread,'INT')
    1449         [ +  + ]:        7010 :  if(tread==1) dtset%expert_user=intarr(1)
    1450                 :             : 
    1451         [ +  + ]:        7010 :  if (dtset%expert_user > 0) then
    1452                 :             :    ! Set all flags to zero although we still allow users to activate particular tests via explicit values.
    1453                 :          25 :    dtset%chkdilatmx=0
    1454                 :          25 :    dtset%chkparal=0
    1455                 :          25 :    dtset%chkprim=0
    1456                 :          25 :    dtset%chksymbreak=0
    1457                 :          25 :    dtset%chksymtnons=0
    1458                 :             :  end if
    1459                 :             : 
    1460                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'chkdilatmx',tread,'INT')
    1461         [ +  + ]:        7010 :  if(tread==1) dtset%chkdilatmx=intarr(1)
    1462                 :             : 
    1463                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'chkparal',tread,'INT')
    1464         [ +  + ]:        7010 :  if(tread==1) dtset%chkparal=intarr(1)
    1465                 :             : 
    1466                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'chkprim',tread,'INT')
    1467         [ +  + ]:        7010 :  if(tread==1) dtset%chkprim=intarr(1)
    1468                 :             : 
    1469                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'chksymbreak',tread,'INT')
    1470         [ +  + ]:        7010 :  if(tread==1) dtset%chksymbreak=intarr(1)
    1471                 :             : 
    1472                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'chksymtnons',tread,'INT')
    1473         [ +  + ]:        7010 :  if(tread==1) dtset%chksymtnons=intarr(1)
    1474                 :             : 
    1475                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'fockoptmix',tread,'INT')
    1476         [ +  + ]:        7010 :  if(tread==1) dtset%fockoptmix=intarr(1)
    1477                 :             : 
    1478                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'getocc',tread,'INT')
    1479         [ +  + ]:        7010 :  if(tread==1) dtset%getocc=intarr(1)
    1480                 :        7010 :  getocc=dtset%getocc
    1481                 :             : 
    1482                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'getwfk',tread,'INT')
    1483         [ +  + ]:        7010 :  if(tread==1) dtset%getwfk=intarr(1)
    1484                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'getwfk_filepath',tread,'KEY', key_value=key_value)
    1485         [ +  + ]:        7010 :  if(tread==1) dtset%getwfk_filepath = key_value
    1486                 :             : 
    1487                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'getwfkfine',tread,'INT')
    1488         [ +  + ]:        7010 :  if(tread==1) dtset%getwfkfine=intarr(1)
    1489                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'getwfkfine_filepath',tread,'KEY', key_value=key_value)
    1490         [ +  + ]:        7010 :  if(tread==1) dtset%getwfkfine_filepath = key_value
    1491                 :             : 
    1492                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'getxcart',tread,'INT')
    1493         [ +  + ]:        7010 :  if(tread==1) dtset%getxcart=intarr(1)
    1494                 :             : 
    1495                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'getxred',tread,'INT')
    1496         [ +  + ]:        7010 :  if(tread==1) dtset%getxred=intarr(1)
    1497                 :             : 
    1498                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'getabiwan',tread,'INT')
    1499         [ -  + ]:        7010 :  if(tread==1) dtset%getabiwan=intarr(1)
    1500                 :             : 
    1501                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'getctqmcdata',tread,'INT')
    1502         [ -  + ]:        7010 :  if(tread==1) dtset%getctqmcdata=intarr(1)
    1503                 :             : 
    1504                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'getgwan',tread,'INT')
    1505         [ -  + ]:        7010 :  if(tread==1) dtset%getgwan=intarr(1)
    1506                 :             : 
    1507                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'getddb',tread,'INT')
    1508         [ +  + ]:        7010 :  if(tread==1) dtset%getddb=intarr(1)
    1509                 :             : 
    1510                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'getdvdb',tread,'INT')
    1511         [ +  + ]:        7010 :  if(tread==1) dtset%getdvdb=intarr(1)
    1512                 :             : 
    1513                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'getdrhodb',tread,'INT')
    1514         [ -  + ]:        7010 :  if(tread==1) dtset%getdrhodb=intarr(1)
    1515                 :             : 
    1516                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'getden',tread,'INT')
    1517         [ +  + ]:        7010 :  if(tread==1) dtset%getden=intarr(1)
    1518                 :             : 
    1519                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'getden_filepath',tread,'KEY', key_value=key_value)
    1520         [ +  + ]:        7010 :  if(tread==1) dtset%getden_filepath = key_value
    1521                 :             : 
    1522                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'getpawden',tread,'INT')
    1523         [ -  + ]:        7010 :  if(tread==1) dtset%getpawden=intarr(1)
    1524                 :             : 
    1525                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'getabiwan_filepath',tread,'KEY', key_value=key_value)
    1526         [ -  + ]:        7010 :  if(tread==1) dtset%getabiwan_filepath = key_value
    1527                 :             : 
    1528                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'getgwan_filepath',tread,'KEY', key_value=key_value)
    1529         [ -  + ]:        7010 :  if(tread==1) dtset%getgwan_filepath = key_value
    1530                 :             : 
    1531                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'getddb_filepath',tread,'KEY', key_value=key_value)
    1532         [ +  + ]:        7010 :  if(tread==1) dtset%getddb_filepath = key_value
    1533                 :             : 
    1534                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'getdvdb_filepath',tread,'KEY', key_value=key_value)
    1535         [ +  + ]:        7010 :  if(tread==1) dtset%getdvdb_filepath = key_value
    1536                 :             : 
    1537                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'getdrhodb_filepath',tread,'KEY', key_value=key_value)
    1538         [ +  + ]:        7010 :  if(tread==1) dtset%getdrhodb_filepath = key_value
    1539                 :             : 
    1540                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'getpot_filepath',tread,'KEY', key_value=key_value)
    1541         [ +  + ]:        7010 :  if(tread==1) dtset%getpot_filepath = key_value
    1542                 :             : 
    1543                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'getsigeph_filepath',tread,'KEY', key_value=key_value)
    1544         [ +  + ]:        7010 :  if(tread==1) dtset%getsigeph_filepath = key_value
    1545                 :             : 
    1546                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'getgstore_filepath',tread,'KEY', key_value=key_value)
    1547         [ +  + ]:        7010 :  if(tread==1) dtset%getgstore_filepath = key_value
    1548                 :             : 
    1549                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'getqpdata_filepath',tread,'KEY', key_value=key_value)
    1550         [ -  + ]:        7010 :  if(tread==1) dtset%getqpdata_filepath = key_value
    1551                 :             : 
    1552                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'getcell',tread,'INT')
    1553         [ +  + ]:        7010 :  if(tread==1) dtset%getcell=intarr(1)
    1554                 :             : 
    1555                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'getgam_eig2nkq',tread,'INT')
    1556         [ +  + ]:        7010 :  if(tread==1) dtset%getgam_eig2nkq=intarr(1)
    1557                 :             : 
    1558                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'getwfmq',tread,'INT')
    1559         [ +  + ]:        7010 :  if(tread==1) dtset%getwfmq=intarr(1)
    1560                 :             : 
    1561                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'getwfmq_filepath',tread,'KEY', key_value=key_value)
    1562         [ -  + ]:        7010 :  if(tread==1) dtset%getwfmq_filepath = key_value
    1563                 :             : 
    1564                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'getself',tread,'INT')
    1565         [ +  + ]:        7010 :  if(tread==1) dtset%getself=intarr(1)
    1566                 :             : 
    1567                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'getvpq',tread,'INT')
    1568         [ -  + ]:        7010 :  if(tread==1) dtset%getvpq=intarr(1)
    1569                 :             : 
    1570                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'getvpq_filepath',tread,'KEY', key_value=key_value)
    1571         [ +  + ]:        7010 :  if(tread==1) dtset%getvpq_filepath = key_value
    1572                 :             : 
    1573                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'getwfq',tread,'INT')
    1574         [ +  + ]:        7010 :  if(tread==1) dtset%getwfq=intarr(1)
    1575                 :             : 
    1576                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'getwfq_filepath',tread,'KEY', key_value=key_value)
    1577         [ +  + ]:        7010 :  if(tread==1) dtset%getwfq_filepath = key_value
    1578                 :             : 
    1579                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'get1wf',tread,'INT')
    1580         [ +  + ]:        7010 :  if(tread==1) dtset%get1wf=intarr(1)
    1581                 :             :  ! TODO
    1582                 :             :  !call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'get1wf_filepath',tread,'KEY', key_value=key_value)
    1583                 :             :  !if(tread==1) dtset%get1wf_filepath = key_value
    1584                 :             : 
    1585                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'getddk',tread,'INT')
    1586         [ +  + ]:        7010 :  if(tread==1) dtset%getddk=intarr(1)
    1587                 :             : 
    1588                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'getdelfd',tread,'INT')
    1589         [ +  + ]:        7010 :  if(tread==1) dtset%getdelfd=intarr(1)
    1590                 :             : 
    1591                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'getdkdk',tread,'INT')
    1592         [ +  + ]:        7010 :  if(tread==1) dtset%getdkdk=intarr(1)
    1593                 :             : 
    1594                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'getdkde',tread,'INT')
    1595         [ +  + ]:        7010 :  if(tread==1) dtset%getdkde=intarr(1)
    1596                 :             : 
    1597                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'getvel',tread,'INT')
    1598         [ -  + ]:        7010 :  if(tread==1) dtset%getvel=intarr(1)
    1599                 :             : 
    1600                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'get1den',tread,'INT')
    1601         [ +  + ]:        7010 :  if(tread==1) dtset%get1den=intarr(1)
    1602                 :             : 
    1603                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'iomode',tread,'INT')
    1604         [ +  + ]:        7010 :  if(tread==1) dtset%iomode=intarr(1)
    1605                 :             : 
    1606                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'enunit',tread,'INT')
    1607         [ +  + ]:        7010 :  if(tread==1) dtset%enunit=intarr(1)
    1608                 :             : 
    1609                 :             :  ! eph variables
    1610                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dipdip',tread_dipdip,'INT')
    1611         [ +  + ]:        7010 :  if(tread_dipdip==1) dtset%dipdip=intarr(1)
    1612                 :             : 
    1613                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'symdynmat',tread,'INT')
    1614         [ -  + ]:        7010 :  if(tread==1) dtset%symdynmat=intarr(1)
    1615                 :             : 
    1616                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'symv1scf',tread,'INT')
    1617         [ +  + ]:        7010 :  if(tread==1) dtset%symv1scf = intarr(1)
    1618                 :             : 
    1619                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,2,string(1:lenstr),'scr_wrange',tread,'INT')
    1620   [ +  +  +  + ]:        7018 :  if(tread==1) dtset%scr_wrange = intarr(1:2)
    1621                 :             : 
    1622                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'eph_prtscratew',tread,'INT')
    1623         [ +  + ]:        7010 :  if(tread==1) dtset%eph_prtscratew = intarr(1)
    1624                 :             : 
    1625                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'eph_task',tread,'INT')
    1626         [ +  + ]:        7010 :  if(tread==1) dtset%eph_task=intarr(1)
    1627                 :             : 
    1628                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'eph_restart',tread,'INT')
    1629         [ +  + ]:        7010 :  if(tread==1) then
    1630                 :          12 :    dtset%eph_restart = intarr(1)
    1631                 :             :  else
    1632         [ +  + ]:        6998 :    if (any(dtset%eph_task == [13, -13])) then
    1633                 :             :      ! In VARPEQ, restart must be activated explicitly.
    1634                 :          11 :      dtset%eph_restart = 0
    1635                 :             :    end if
    1636                 :             :  end if
    1637                 :             : 
    1638                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'eph_mustar',tread,'DPR')
    1639         [ +  + ]:        7010 :  if(tread==1) dtset%eph_mustar=dprarr(1)
    1640                 :             : 
    1641                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,2,string(1:lenstr),'eph_tols_idelta',tread,'DPR')
    1642   [ +  +  +  + ]:        7014 :  if (tread == 1) dtset%eph_tols_idelta = dprarr(1:2)
    1643                 :             : 
    1644                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,3,string(1:lenstr),'eph_fix_wavevec',tread,'DPR')
    1645   [ +  +  +  + ]:        7016 :  if (tread == 1) dtset%eph_fix_wavevec = dprarr(1:3)
    1646                 :             : 
    1647                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,2,string(1:lenstr),'eph_phrange',tread,'INT')
    1648   [ +  +  +  + ]:        7012 :  if (tread == 1) dtset%eph_phrange = intarr(1:2)
    1649                 :             : 
    1650                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,2,string(1:lenstr),'eph_phrange_w',tread,'ENE')
    1651   [ +  +  +  + ]:        7012 :  if (tread == 1) dtset%eph_phrange_w = dprarr(1:2)
    1652                 :             : 
    1653   [ +  +  +  +  :       42057 :  if (any(abs(dtset%eph_phrange) /= 0) .and. any(abs(dtset%eph_phrange_w) > tol16)) then
          +  +  +  +  -  
                      + ]
    1654                 :           0 :    ABI_ERROR("eph_phrange and eph_phrange_w are mutually exclusive")
    1655                 :             :  end if
    1656                 :             : 
    1657                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'eph_intmeth',tread,'INT')
    1658         [ +  + ]:        7010 :  if (tread == 1) then
    1659                 :          27 :    dtset%eph_intmeth = intarr(1)
    1660                 :             :  else
    1661                 :             :    ! eph_intmeth depends on eph_task.
    1662                 :             :    !if (abs(dtset%eph_task) == 4) dtset%eph_intmeth = 1
    1663         [ +  + ]:        6983 :    if (dtset%eph_task == +4) dtset%eph_intmeth = 1
    1664   [ +  +  -  + ]:        6983 :    if (dtset%eph_task == -4 .and. dtset%symsigma == 0) dtset%eph_intmeth = 1
    1665                 :             :  end if
    1666                 :             : 
    1667                 :             :  ! Allow use to dope the system or to shift artificially the Fermi level
    1668                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'eph_extrael',tread_extrael,'DPR')
    1669         [ +  + ]:        7010 :  if (tread_extrael == 1) dtset%eph_extrael = dprarr(1)
    1670                 :             : 
    1671                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, 1, string(1:lenstr), 'eph_doping', tread, 'DPR')
    1672         [ +  + ]:        7010 :  if (tread == 1) then
    1673         [ -  + ]:          13 :    ABI_CHECK(tread_extrael == 0, "eph_extrael and eph_doping are mutually exclusive!")
    1674                 :             :    ! Units of eph_doping is e_charge / cm^3
    1675                 :          13 :    dtset%eph_extrael = - dprarr(1) * ucvol * (Bohr_meter * 100) ** 3
    1676                 :             :  end if
    1677                 :             : 
    1678                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'eph_ahc_type',tread,'INT')
    1679         [ +  + ]:        7010 :  if(tread==1) dtset%eph_ahc_type=intarr(1)
    1680                 :             : 
    1681                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,2,string(1:lenstr),'eph_path_brange',tread,'INT')
    1682   [ +  +  +  + ]:        7014 :  if(tread==1) dtset%eph_path_brange=intarr(1:2)
    1683                 :             : 
    1684                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'eph_fermie',tread,'ENE')
    1685         [ +  + ]:        7010 :  if(tread==1) dtset%eph_fermie=dprarr(1)
    1686                 :             : 
    1687                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'eph_frohlichm',tread,'INT')
    1688         [ +  + ]:        7010 :  if(tread==1) dtset%eph_frohlichm=intarr(1)
    1689                 :             : 
    1690                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'eph_frohl_ntheta',tread,'INT')
    1691         [ +  + ]:        7010 :  if(tread==1) dtset%eph_frohl_ntheta=intarr(1)
    1692                 :             : 
    1693                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'eph_fsmear',tread,'ENE')
    1694         [ +  + ]:        7010 :  if(tread==1) dtset%eph_fsmear=dprarr(1)
    1695                 :             : 
    1696                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'eph_fsewin',tread,'ENE')
    1697         [ +  + ]:        7010 :  if(tread==1) dtset%eph_fsewin=dprarr(1)
    1698                 :             : 
    1699                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'eph_ecutosc',tread,'ENE')
    1700         [ -  + ]:        7010 :  if(tread==1) dtset%eph_ecutosc=dprarr(1)
    1701                 :             : 
    1702                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'eph_phwinfact',tread,'DPR')
    1703         [ +  + ]:        7010 :  if(tread==1) dtset%eph_phwinfact = dprarr(1)
    1704                 :             : 
    1705                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,3,string(1:lenstr),'eph_ngkpt_fine',tread,'INT')
    1706   [ -  +  -  - ]:        7010 :  if(tread==1) dtset%eph_ngkpt_fine=intarr(1:3)
    1707                 :             : 
    1708                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,3,string(1:lenstr),'eph_ngqpt_fine',tread,'INT')
    1709   [ +  +  +  + ]:        7163 :  if(tread==1) dtset%eph_ngqpt_fine=intarr(1:3)
    1710                 :             : 
    1711                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'eph_nshiftk_fine',tread,'INT')
    1712         [ -  + ]:        7010 :  if(tread==1) dtset%eph_nshiftk_fine=intarr(1)
    1713         [ -  + ]:        7010 :  if (dtset%eph_nshiftk_fine < 1 .or. dtset%eph_nshiftk_fine > MAX_NSHIFTK) then
    1714                 :             :    write(msg, '(a,i0,2a,i0,3a)') &
    1715                 :           0 :      'The only allowed values of eph_nshiftk_fine are between 1 and ', MAX_NSHIFTK, ch10, &
    1716                 :           0 :      'while it is found to be ', dtset%eph_nshiftk_fine, '.', ch10, &
    1717                 :           0 :      'Action: change the value of eph_nshiftk_fine in your input file.'
    1718                 :           0 :    ABI_ERROR(msg)
    1719                 :             :  end if
    1720                 :             : 
    1721         [ -  + ]:        7010 :  ABI_CHECK(3 * dtset%eph_nshiftk_fine <= marr, "3 * eph_nshiftk_fine > marr")
    1722                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,3*dtset%eph_nshiftk_fine,string(1:lenstr),'eph_shiftk_fine',tread,'DPR')
    1723         [ -  + ]:        7010 :  ABI_SFREE(dtset%eph_shiftk_fine)
    1724   [ -  +  +  -  :       49070 :  ABI_CALLOC(dtset%eph_shiftk_fine, (3, dtset%eph_nshiftk_fine))
          +  -  +  -  -  
          +  -  +  -  +  
             +  +  +  + ]
    1725   [ -  +  -  -  :        7010 :  if(tread==1) dtset%eph_shiftk_fine = reshape(dprarr(1:3*dtset%eph_nshiftk_fine), [3, dtset%eph_nshiftk_fine])
          -  -  -  -  -  
          -  -  -  -  -  
                   -  - ]
    1726                 :             : 
    1727                 :        7010 :  narr = size(dtset%eph_np_pqbks)
    1728                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,narr,string(1:lenstr),'eph_np_pqbks',tread,'INT')
    1729   [ -  +  -  - ]:        7010 :  if (tread==1) dtset%eph_np_pqbks = intarr(1:narr)
    1730                 :             : 
    1731                 :        7010 :  narr = size(dtset%gwpt_np_wpqbks)
    1732                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,narr,string(1:lenstr),'gwpt_np_wpqbks',tread,'INT')
    1733   [ -  +  -  - ]:        7010 :  if (tread==1) dtset%gwpt_np_wpqbks = intarr(1:narr)
    1734                 :             : 
    1735                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'eph_stern',tread,'INT')
    1736         [ +  + ]:        7010 :  if(tread==1) dtset%eph_stern = intarr(1)
    1737                 :             : 
    1738                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'eph_use_ftinterp',tread,'INT')
    1739         [ -  + ]:        7010 :  if(tread==1) dtset%eph_use_ftinterp = intarr(1)
    1740                 :             : 
    1741                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'eph_transport',tread,'INT')
    1742         [ +  + ]:        7010 :  if(tread==1) dtset%eph_transport=intarr(1)
    1743                 :             : 
    1744                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'ph_wstep',tread,'ENE')
    1745         [ +  + ]:        7010 :  if(tread==1) dtset%ph_wstep=dprarr(1)
    1746                 :             : 
    1747                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'ph_intmeth',tread,'INT')
    1748         [ +  + ]:        7010 :  if(tread==1) dtset%ph_intmeth=intarr(1)
    1749                 :             : 
    1750                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'ph_smear',tread,'ENE')
    1751         [ +  + ]:        7010 :  if(tread==1) dtset%ph_smear=dprarr(1)
    1752                 :             : 
    1753                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,3,string(1:lenstr),'ddb_ngqpt',tread,'INT')
    1754   [ +  +  +  + ]:        7343 :  if(tread==1) dtset%ddb_ngqpt=intarr(1:3)
    1755                 :             : 
    1756                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,3,string(1:lenstr),'ddb_shiftq',tread,'DPR')
    1757   [ +  +  +  + ]:        7016 :  if(tread==1) dtset%ddb_shiftq=dprarr(1:3)
    1758                 :             : 
    1759                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dvdb_qdamp',tread,'DPR')
    1760         [ +  + ]:        7010 :  if(tread==1) dtset%dvdb_qdamp = dprarr(1)
    1761                 :             : 
    1762                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dvdb_rspace_cell',tread, 'INT')
    1763         [ +  + ]:        7010 :  if(tread==1) dtset%dvdb_rspace_cell = intarr(1)
    1764                 :             : 
    1765                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dvdb_add_lr',tread,'INT')
    1766         [ +  + ]:        7010 :  if(tread==1) dtset%dvdb_add_lr = intarr(1)
    1767                 :             : 
    1768                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'ph_ndivsm',tread,'INT')
    1769         [ +  + ]:        7010 :  if(tread==1) dtset%ph_ndivsm=intarr(1)
    1770                 :             : 
    1771                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'ph_nqpath',tread,'INT')
    1772         [ +  + ]:        7010 :  if(tread==1) dtset%ph_nqpath=intarr(1)
    1773                 :             : 
    1774         [ +  + ]:        7010 :  if (dtset%ph_nqpath > 0) then
    1775                 :             :    ! Read qpath for phonons
    1776   [ -  +  +  -  :         117 :    ABI_MALLOC(dtset%ph_qpath, (3, dtset%ph_nqpath))
          +  -  -  +  -  
                +  -  + ]
    1777         [ -  + ]:          39 :    ABI_CHECK(3 * dtset%ph_nqpath <= marr, "3 * dtset%ph_nqpath > marr!")
    1778                 :          39 :    call intagm(dprarr,intarr,jdtset,marr,3*dtset%ph_nqpath,string(1:lenstr),'ph_qpath',tread,'DPR')
    1779         [ -  + ]:          39 :    if (tread == 0) then
    1780                 :           0 :      ABI_ERROR("When ph_nqpath > 0, ph_qpath should be specified")
    1781                 :             :    end if
    1782   [ +  +  +  -  :         684 :    dtset%ph_qpath = reshape(dprarr(1:3*dtset%ph_nqpath), [3, dtset%ph_nqpath])
          +  -  -  +  -  
             -  +  +  +  
                      + ]
    1783                 :             :  end if
    1784                 :             : 
    1785                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'ph_nqshift',tread,'INT')
    1786         [ +  + ]:        7010 :  if(tread==1) dtset%ph_nqshift=intarr(1)
    1787                 :             : 
    1788         [ +  - ]:        7010 :  if (dtset%ph_nqshift > 0) then
    1789                 :             :    ! Read ph_qshift for phonons, default is [0,0,0]
    1790   [ -  +  +  -  :       49070 :    ABI_CALLOC(dtset%ph_qshift, (3, dtset%ph_nqshift))
          +  -  -  +  -  
          +  -  +  +  +  
                   +  + ]
    1791         [ +  + ]:        7010 :    if (tread == 1) then
    1792         [ -  + ]:          22 :      ABI_CHECK(3 * dtset%ph_nqshift <= marr, "3 * dtset%ph_nqshift > marr!")
    1793                 :          22 :      call intagm(dprarr,intarr,jdtset,marr,3*dtset%ph_nqshift,string(1:lenstr),'ph_qshift',tread,'DPR')
    1794         [ -  + ]:          22 :      if (tread == 0) then
    1795                 :           0 :        ABI_ERROR("When ph_nqshift > 0, ph_qshift should be specified")
    1796                 :             :      end if
    1797   [ +  +  +  -  :         176 :      dtset%ph_qshift = reshape(dprarr(1:3*dtset%ph_nqshift), [3, dtset%ph_nqshift])
          +  -  -  +  -  
             -  +  +  +  
                      + ]
    1798                 :             :    end if
    1799                 :             :  end if
    1800                 :             : 
    1801                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,3,string(1:lenstr),'ph_ngqpt',tread,'INT')
    1802   [ +  +  +  + ]:        7079 :  if(tread==1) dtset%ph_ngqpt=intarr(1:3)
    1803                 :             : !end e-ph variables
    1804                 :             : 
    1805                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'exchn2n3d',tread,'INT')
    1806         [ +  + ]:        7010 :  if(tread==1) dtset%exchn2n3d=intarr(1)
    1807                 :             : 
    1808                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'extrapwf',tread,'INT')
    1809         [ +  + ]:        7010 :  if(tread==1) dtset%extrapwf=intarr(1)
    1810                 :             : 
    1811                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'ibte_abs_tol',tread,'DPR')
    1812         [ +  + ]:        7010 :  if(tread==1) dtset%ibte_abs_tol=dprarr(1)
    1813                 :             : 
    1814                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'ibte_alpha_mix',tread,'DPR')
    1815         [ +  + ]:        7010 :  if(tread==1) dtset%ibte_alpha_mix=dprarr(1)
    1816                 :             : 
    1817                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'ibte_niter',tread,'INT')
    1818         [ +  + ]:        7010 :  if(tread==1) dtset%ibte_niter=intarr(1)
    1819                 :             : 
    1820                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'ibte_prep',tread,'INT')
    1821                 :             :  ! ibte_prep is only available when we compute the imaginary part.
    1822   [ +  +  +  - ]:        7010 :  if(tread==1 .and. dtset%eph_task == -4) dtset%ibte_prep=intarr(1)
    1823                 :             : 
    1824                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'iboxcut',tread,'INT')
    1825         [ +  + ]:        7010 :  if(tread==1) dtset%iboxcut=intarr(1)
    1826                 :             : 
    1827                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'icutcoul',tread,'INT')
    1828         [ +  + ]:        7010 :  if(tread==1) dtset%icutcoul=intarr(1)
    1829                 :             : 
    1830                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'fock_icutcoul',tread,'INT')
    1831         [ +  + ]:        7010 :  if(tread==1) dtset%fock_icutcoul=intarr(1)
    1832                 :             : 
    1833                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'imgwfstor',tread,'INT')
    1834         [ +  + ]:        7010 :  if(tread==1) dtset%imgwfstor=intarr(1)
    1835                 :             : 
    1836                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'mdf_epsinf',tread,'DPR')
    1837         [ +  + ]:        7010 :  if(tread==1) dtset%mdf_epsinf=dprarr(1)
    1838                 :             : 
    1839                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'mem_test',tread,'INT')
    1840         [ +  + ]:        7010 :  if(tread==1) dtset%mem_test=intarr(1)
    1841                 :             : 
    1842                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'mixprec',tread,'INT')
    1843         [ +  + ]:        7010 :  if (tread==1) dtset%mixprec = intarr(1)
    1844                 :             : 
    1845         [ +  + ]:        7010 :  if (dtset%imgmov==0.or.dtset%imgmov==2.or.dtset%imgmov==5) then
    1846                 :        6995 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'mep_mxstep',tread,'LEN')
    1847         [ +  + ]:        6995 :    if(tread==1) then
    1848                 :           4 :      dtset%mep_mxstep=dprarr(1)
    1849         [ +  + ]:        6991 :    else if(dtset%imgmov==5) then
    1850                 :           1 :      dtset%mep_mxstep=0.4_dp
    1851                 :             :    end if
    1852                 :             :  end if
    1853         [ +  + ]:        7010 :  if (dtset%imgmov==2.or.dtset%imgmov==5) then
    1854                 :          28 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'mep_solver',tread,'INT')
    1855         [ +  + ]:          28 :    if(tread==1) then
    1856                 :           5 :      dtset%mep_solver=intarr(1)
    1857         [ +  - ]:          23 :    else if(dtset%imgmov==2) then
    1858                 :          23 :      dtset%mep_solver=MEP_SOLVER_STEEPEST
    1859         [ #  # ]:           0 :    else if(dtset%imgmov==5) then
    1860                 :           0 :      dtset%mep_solver=MEP_SOLVER_STEEPEST
    1861                 :             :    end if
    1862         [ +  + ]:          28 :    if (dtset%imgmov==2) then
    1863                 :          24 :      call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'string_algo',tread,'INT')
    1864         [ +  + ]:          24 :      if(tread==1) dtset%string_algo=intarr(1)
    1865                 :             :    end if
    1866         [ +  + ]:          28 :    if (dtset%imgmov==5) then
    1867                 :           4 :      call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'neb_algo',tread,'INT')
    1868         [ +  - ]:           4 :      if(tread==1) dtset%neb_algo=intarr(1)
    1869                 :           4 :      call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'neb_cell_algo',tread,'INT')
    1870         [ +  + ]:           4 :      if(tread==1) dtset%neb_cell_algo=intarr(1)
    1871                 :           4 :      call intagm(dprarr,intarr,jdtset,marr,2,string(1:lenstr),'neb_spring',tread,'DPR')
    1872         [ +  + ]:           4 :      if(tread==1) then
    1873         [ +  + ]:           3 :        dtset%neb_spring(1:2)=dprarr(1:2)
    1874         [ -  + ]:           3 :      else if (dtset%neb_algo==NEB_ALGO_CINEB) then
    1875         [ #  # ]:           0 :        dtset%neb_spring(1:2)=(/0.02_dp,0.15_dp/)
    1876                 :             :      end if
    1877                 :           4 :      call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'cineb_start',tread,'INT')
    1878         [ +  + ]:           4 :      if(tread==1) dtset%cineb_start=intarr(1)
    1879                 :             :    end if
    1880                 :             :  end if
    1881                 :             : 
    1882                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'istatimg',tread,'INT')
    1883         [ +  + ]:        7010 :  if(tread==1) dtset%istatimg=intarr(1)
    1884                 :             : 
    1885                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'quadquad',tread,'INT')
    1886         [ -  + ]:        7010 :  if(tread==1) dtset%quadquad=intarr(1)
    1887                 :             : 
    1888                 :             :  ! variables for random positions in unit cell
    1889                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'random_atpos',tread,'INT')
    1890         [ +  + ]:        7010 :  if(tread==1) dtset%random_atpos=intarr(1)
    1891                 :             : 
    1892                 :             : ! parsing GEOmetryOPTimization keys to internal variable ionmov
    1893                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'geoopt',tread,'KEY',key_value=key_value)
    1894   [ +  +  +  - ]:        7010 :  if(tread==1) dtset%geoopt = tolower(key_value)
    1895         [ +  + ]:        7010 :  if (dtset%geoopt.ne.'none') then
    1896         [ -  + ]:          53 :    if(INDEX(dtset%geoopt,'viscous').gt.0) then
    1897                 :           0 :      dtset%ionmov=1
    1898         [ +  - ]:          53 :    elseif(INDEX(dtset%geoopt,'bfgs').gt.0) then
    1899                 :          53 :      dtset%ionmov=2
    1900         [ #  # ]:           0 :    elseif(INDEX(dtset%geoopt,'lbfgs').gt.0) then
    1901                 :           0 :      dtset%ionmov=22
    1902         [ #  # ]:           0 :    elseif(INDEX(dtset%geoopt,'mdmin').gt.0) then
    1903                 :           0 :      dtset%ionmov=5
    1904         [ #  # ]:           0 :    elseif(INDEX(dtset%geoopt,'quenched').gt.0) then
    1905                 :           0 :      dtset%ionmov=7
    1906         [ #  # ]:           0 :    elseif(INDEX(dtset%geoopt,'fire').gt.0) then
    1907                 :           0 :      dtset%ionmov=15
    1908                 :             :    end if
    1909                 :             :  end if
    1910                 :             : 
    1911                 :             : ! parsing MOLecularDYNamics keys to internal variable ionmov
    1912                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'moldyn',tread,'KEY',key_value=key_value)
    1913   [ +  +  +  - ]:        7010 :  if(tread==1) dtset%moldyn = tolower(key_value)
    1914         [ +  + ]:        7010 :  if(dtset%moldyn.ne.'none') then
    1915         [ -  + ]:           4 :    if(INDEX(dtset%moldyn,'nve_verlet').gt.0) then
    1916                 :           0 :      dtset%ionmov=6
    1917         [ -  + ]:           4 :    elseif(INDEX(dtset%moldyn,'nve_velverlet').gt.0) then
    1918                 :           0 :      dtset%ionmov=24
    1919         [ +  + ]:           4 :    elseif(INDEX(dtset%moldyn,'nvt_isokin').gt.0) then
    1920                 :           2 :      dtset%ionmov=12
    1921         [ +  + ]:           2 :    elseif(INDEX(dtset%moldyn,'nvt_langevin').gt.0) then
    1922                 :           1 :      dtset%ionmov=16
    1923         [ +  - ]:           1 :    elseif(INDEX(dtset%moldyn,'npt_langevin').gt.0) then
    1924                 :           1 :      dtset%ionmov=16
    1925         [ #  # ]:           0 :    elseif(INDEX(dtset%moldyn,'nst_langevin').gt.0) then
    1926                 :           0 :      dtset%ionmov=16
    1927         [ #  # ]:           0 :    elseif(INDEX(dtset%moldyn,'nvt_nose').gt.0) then
    1928                 :           0 :      dtset%ionmov=13
    1929         [ #  # ]:           0 :    elseif(INDEX(dtset%moldyn,'npt_martyna').gt.0) then
    1930                 :           0 :      dtset%ionmov=13
    1931         [ #  # ]:           0 :    elseif(INDEX(dtset%moldyn,'nst_martyna').gt.0) then
    1932                 :           0 :      dtset%ionmov=13
    1933                 :             :    end if
    1934                 :             :  end if
    1935                 :             : 
    1936                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'ionmov',tread,'INT')
    1937         [ +  + ]:        7010 :  if(tread==1) dtset%ionmov=intarr(1)
    1938                 :             : 
    1939                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'paral_slice',tread,'INT')
    1940         [ +  + ]:        7010 :  if(tread==1) dtset%paral_slice=intarr(1)
    1941                 :             : 
    1942                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'intxc',tread,'INT')
    1943         [ +  + ]:        7010 :  if(tread==1) dtset%intxc=intarr(1)
    1944                 :             : 
    1945                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'densfor_pred',tread,'INT')
    1946         [ +  + ]:        7010 :  if(tread==1) then
    1947                 :          67 :    dtset%densfor_pred=intarr(1)
    1948                 :             :  else
    1949         [ +  + ]:        6943 :    if (dtset%paral_kgb==1) dtset%densfor_pred=6
    1950                 :             :  end if
    1951                 :             : 
    1952                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'hmcsst',tread,'INT')
    1953         [ -  + ]:        7010 :  if(tread==1) dtset%hmcsst=intarr(1)
    1954                 :             : 
    1955                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'hmctt',tread,'INT')
    1956         [ -  + ]:        7010 :  if(tread==1) dtset%hmctt=intarr(1)
    1957                 :             : 
    1958                 :             :  ! For the moment LOTF does not use different from 2
    1959         [ -  + ]:        7010 :  if(dtset%ionmov==23) then
    1960                 :             : #ifdef HAVE_LOTF
    1961                 :             :    if(dtset%densfor_pred/=2)then
    1962                 :             :      densfor_pred=2
    1963                 :             :      dtset%densfor_pred=densfor_pred
    1964                 :             :      write(msg, '(4a)' )&
    1965                 :             :        'When ionmov==23, densfor_pred must be 2.',ch10,&
    1966                 :             :        'Set densfor_pred to 2.',ch10
    1967                 :             :      ABI_COMMENT(msg)
    1968                 :             :    end if
    1969                 :             : #else
    1970                 :           0 :    dtset%ionmov=12
    1971                 :             :    write(msg, '(4a)' )&
    1972                 :           0 :      'LOTF is disabled, ionmov can not be 23.',ch10,&
    1973                 :           0 :      'Set ionmov to 12.',ch10
    1974                 :           0 :    ABI_COMMENT(msg)
    1975                 :             : #endif
    1976                 :             :  end if
    1977                 :             : 
    1978                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'iprcel',tread,'INT')
    1979         [ +  + ]:        7010 :  if(tread==1) dtset%iprcel=intarr(1)
    1980                 :             : 
    1981                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'iprcfc',tread,'INT')
    1982         [ +  + ]:        7010 :  if(tread==1) dtset%iprcfc=intarr(1)
    1983                 :             : 
    1984                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'irandom',tread,'INT')
    1985         [ +  + ]:        7010 :  if(tread==1) dtset%irandom=intarr(1)
    1986                 :             : 
    1987                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'irdddb',tread,'INT')
    1988         [ +  + ]:        7010 :  if(tread==1) dtset%irdddb=intarr(1)
    1989                 :             : 
    1990                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'irdden',tread,'INT')
    1991         [ +  + ]:        7010 :  if(tread==1) dtset%irdden=intarr(1)
    1992                 :             : 
    1993                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'irddvdb',tread,'INT')
    1994         [ -  + ]:        7010 :  if(tread==1) dtset%irddvdb = intarr(1)
    1995                 :             : 
    1996                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'irddrhodb',tread,'INT')
    1997         [ -  + ]:        7010 :  if(tread==1) dtset%irddrhodb = intarr(1)
    1998                 :             : 
    1999                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'irdpawden',tread,'INT')
    2000         [ -  + ]:        7010 :  if(tread==1) dtset%irdpawden=intarr(1)
    2001                 :             : 
    2002                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'irdhaydock',tread,'INT')
    2003         [ -  + ]:        7010 :  if(tread==1) dtset%irdhaydock=intarr(1)
    2004                 :             : 
    2005                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'irdvdw',tread,'INT')
    2006         [ -  + ]:        7010 :  if(tread==1) dtset%irdvdw=intarr(1)
    2007                 :             : 
    2008                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'irdwfk',tread,'INT')
    2009         [ +  + ]:        7010 :  if(tread==1) dtset%irdwfk=intarr(1)
    2010                 :             : 
    2011                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'irdwfkfine',tread,'INT')
    2012         [ +  + ]:        7010 :  if(tread==1) dtset%irdwfkfine=intarr(1)
    2013                 :             : 
    2014                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'isecur',tread,'INT')
    2015         [ +  + ]:        7010 :  if(tread==1) dtset%isecur=intarr(1)
    2016                 :             : 
    2017                 :             :  ! Reading ixc must be immediately followed by reading xcname
    2018                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'ixc',tread,'INT')
    2019         [ +  + ]:        7010 :  if(tread==1) dtset%ixc=intarr(1)
    2020                 :             : 
    2021                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),"xcname",tread_key,'KEY',key_value=key_value)
    2022         [ +  + ]:        7010 :  if(tread_key==1)then
    2023         [ -  + ]:           1 :    if(tread==1)then
    2024                 :             :      write(msg, '(5a)' )&
    2025                 :           0 :       'ixc and xcname cannot be specified simultaneously',ch10,&
    2026                 :           0 :       'for the same dataset.',ch10,'Action: check the input file.'
    2027                 :           0 :      ABI_ERROR(msg)
    2028                 :             :    else
    2029                 :             :      !Note that xcname is a 'key' variable : its value is stored in keyw at output of intagm
    2030         [ +  - ]:           1 :      if(trim(key_value) == 'PW92') then
    2031                 :           1 :         dtset%ixc=7
    2032                 :             :      else
    2033                 :           0 :        ABI_ERROR(sjoin("Don't know how to convert xcname", key_value, "to ixc"))
    2034                 :             :      end if
    2035                 :             :      tread=1
    2036                 :             :    end if
    2037                 :             :  end if
    2038                 :        7010 :  ixc_here=dtset%ixc
    2039                 :             : 
    2040                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'ixcrot',tread,'INT')
    2041         [ +  + ]:        7010 :  if(tread==1) dtset%ixcrot=intarr(1)
    2042                 :             : 
    2043                 :             :  ! Read the ixc for an advanced functional
    2044                 :             :  ! If present, and relevant (only specific values for gcalctyp),
    2045                 :             :  ! the other internal variable will be adjusted to this other functional)
    2046                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'ixc_sigma',tread,'INT')
    2047         [ +  + ]:        7010 :  if(tread==1)then
    2048                 :          79 :    dtset%ixc_sigma=intarr(1)
    2049   [ +  +  +  + ]:          79 :    if (dtset%optdriver==RUNL_SIGMA.and.mod(dtset%gwcalctyp,10)==5) ixc_here=dtset%ixc_sigma
    2050                 :             :  end if
    2051                 :             : 
    2052                 :             :  ! Initialize here data related to exchange-correlation functional
    2053         [ +  + ]:        7010 :  if (ixc_here<0) then
    2054                 :        1212 :    call libxc_functionals_init(ixc_here,dtset%nspden,xc_functionals=xcfunc,xc_tb09_c=dtset%xc_tb09_c)
    2055                 :             :  end if
    2056                 :        7010 :  call get_xclevel(ixc_here, dtset%xclevel, usefock=dtset%usefock)
    2057                 :        7010 :  xc_has_kxc=has_kxc(ixc_here,xc_funcs=xcfunc)
    2058                 :             :  ! Meta-GGA
    2059         [ +  + ]:        7010 :  if (ixc_here<0) then
    2060                 :        1212 :    xc_is_mgga=libxc_functionals_ismgga(xc_functionals=xcfunc)
    2061                 :        1212 :    xc_is_pot_only=libxc_functionals_is_potential_only(xc_functionals=xcfunc)
    2062                 :        1212 :    xc_need_kden=libxc_functionals_needs_tau(xc_functionals=xcfunc)
    2063                 :             :  else
    2064                 :        5798 :    xc_is_mgga=(ixc_here>=31.and.ixc_here<=35)
    2065                 :        5798 :    xc_is_pot_only=.false.
    2066   [ +  +  -  + ]:        5798 :    xc_need_kden=(ixc_here==31.or.ixc_here==34.or.ixc_here==35)
    2067                 :             :  end if
    2068                 :             :  ! Hybrids
    2069         [ +  + ]:        7010 :  if (dtset%usefock==1) then
    2070         [ +  + ]:         146 :    if(ixc_here==40.or.ixc_here==41.or.ixc_here==42) then
    2071                 :          82 :      dtset%hyb_mixing_sr=zero
    2072                 :          82 :      dtset%hyb_range_dft=zero ; dtset%hyb_range_fock=zero
    2073         [ +  + ]:          82 :      if(ixc_here==40)dtset%hyb_mixing=one
    2074         [ +  + ]:          82 :      if(ixc_here==41)dtset%hyb_mixing=quarter
    2075         [ +  + ]:          82 :      if(ixc_here==42)dtset%hyb_mixing=third
    2076         [ +  + ]:          64 :    else if(ixc_here==-427)then
    2077                 :             :      ! Special case of HSE03
    2078                 :           8 :      dtset%hyb_mixing=zero  ; dtset%hyb_mixing_sr=quarter
    2079                 :           8 :      dtset%hyb_range_dft=0.15_dp*two**third  ; dtset%hyb_range_fock=0.15_dp*sqrt(half)
    2080         [ +  - ]:          56 :    else if (ixc_here<0) then
    2081                 :             :      call libxc_functionals_get_hybridparams(hyb_mixing=dtset%hyb_mixing,hyb_mixing_sr=dtset%hyb_mixing_sr,&
    2082                 :          56 :        hyb_range=dtset%hyb_range_dft,xc_functionals=xcfunc)
    2083                 :          56 :      dtset%hyb_range_fock=dtset%hyb_range_dft
    2084                 :             :    end if
    2085                 :             :  end if
    2086                 :             :  ! Hybrids: auxiliary functional
    2087                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'auxc_scal',tread,'DPR')
    2088         [ +  + ]:        7010 :  if(tread==1) dtset%auxc_scal=dprarr(1)
    2089                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'auxc_ixc',tread,'INT')
    2090         [ +  + ]:        7010 :  if(tread==1) dtset%auxc_ixc=intarr(1)
    2091                 :             :  ! If the default value had been given, possibly switch on
    2092                 :             :  ! the auxc_ixc corresponding to ixc, if the latter is an hybrid
    2093         [ -  + ]:        7010 :  if (dtset%auxc_ixc==0) then
    2094                 :           0 :    call get_auxc_ixc(dtset%auxc_ixc,ixc_here)
    2095                 :             :  end if
    2096         [ +  + ]:        7010 :  if (ixc_here<0) then
    2097                 :        1212 :    call libxc_functionals_end(xc_functionals=xcfunc)
    2098                 :             :  end if
    2099                 :             : 
    2100                 :             :  ! Now take care of the parameters for hybrid functionals
    2101         [ +  + ]:        7010 :  if(dtset%usefock==1)then
    2102                 :             : 
    2103                 :             :    ! Warning: the user-defined parameters for hybrids are by convention stored as negative numbers
    2104                 :             :    ! This trick will allow to echo them, and only them.
    2105                 :         146 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'hyb_mixing',tread,'DPR')
    2106         [ +  + ]:         146 :    if(tread==1)then
    2107         [ -  + ]:          16 :      if(dprarr(1)<-tol14)then
    2108                 :             :        write(msg, '(a,es16.8,2a)' )&
    2109                 :           0 :        'A negative value for hyb_mixing is not allowed, while at input hyb_mixing=',dprarr(1),ch10,&
    2110                 :           0 :        'Action: modify hyb_mixing in the input file.'
    2111                 :           0 :        ABI_ERROR(msg)
    2112                 :             :      end if
    2113                 :          16 :      dtset%hyb_mixing=-dprarr(1) ! Note the minus sign
    2114                 :             :    end if
    2115                 :             : 
    2116                 :         146 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'hyb_mixing_sr',tread,'DPR')
    2117         [ +  + ]:         146 :    if(tread==1)then
    2118         [ -  + ]:           3 :      if(dprarr(1)<-tol14)then
    2119                 :             :        write(msg, '(a,es16.8,2a)' )&
    2120                 :           0 :        'A negative value for hyb_mixing_sr is not allowed, while at input hyb_mixing_sr=',dprarr(1),ch10,&
    2121                 :           0 :        'Action: modify hyb_mixing_sr in the input file.'
    2122                 :           0 :        ABI_ERROR(msg)
    2123                 :             :      end if
    2124                 :           3 :      dtset%hyb_mixing_sr=-dprarr(1) ! Note the minus sign
    2125                 :             :    end if
    2126                 :             : 
    2127                 :         146 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'hyb_range_dft',tread_dft,'DPR')
    2128         [ +  + ]:         146 :    if(tread_dft==1)then
    2129         [ -  + ]:           6 :      if(dprarr(1)<-tol14)then
    2130                 :             :        write(msg, '(a,es16.8,2a)' )&
    2131                 :           0 :        'A negative value for hyb_range_dft is not allowed, while at input hyb_range_dft=',dprarr(1),ch10,&
    2132                 :           0 :        'Action: modify hyb_range_dft in the input file.'
    2133                 :           0 :        ABI_ERROR(msg)
    2134                 :             :      end if
    2135                 :           6 :      dtset%hyb_range_dft=-dprarr(1) ! Note the minus sign
    2136                 :             :    end if
    2137                 :             : 
    2138                 :         146 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'hyb_range_fock',tread_fock,'DPR')
    2139         [ +  + ]:         146 :    if(tread_fock==1)then
    2140         [ -  + ]:          12 :      if(dprarr(1)<-tol14)then
    2141                 :             :        write(msg, '(a,es16.8,2a)' )&
    2142                 :           0 :        'A negative value for hyb_range_fock is not allowed, while at input hyb_range_fock=',dprarr(1),ch10,&
    2143                 :           0 :        'Action: modify hyb_range_fock in the input file.'
    2144                 :           0 :        ABI_ERROR(msg)
    2145                 :             :      end if
    2146                 :          12 :      dtset%hyb_range_fock=-dprarr(1) ! Note the minus sign
    2147                 :             :    end if
    2148                 :             : 
    2149   [ +  +  +  + ]:         146 :    if(tread_fock==1 .and. tread_dft==0)dtset%hyb_range_dft=dtset%hyb_range_fock
    2150   [ +  +  +  + ]:         146 :    if(tread_fock==0 .and. tread_dft==1)dtset%hyb_range_fock=dtset%hyb_range_dft
    2151                 :             : 
    2152                 :             :  end if
    2153                 :             : 
    2154                 :             : !Note iscf has to be read after ixc, usewvl, optdriver, optforces, densfor_pred
    2155                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'iscf',tread,'INT')
    2156         [ +  + ]:        7010 :  if(tread==1) then
    2157                 :         831 :    dtset%iscf=intarr(1)
    2158         [ -  + ]:         831 :    if (dtset%usewvl==1) then
    2159                 :             :      !wvl_bigdft_comp should be 1 for iscf=0, 0 for iscf>0, except if it is set by the user
    2160                 :           0 :      call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'wvl_bigdft_comp',tread,'INT')
    2161   [ #  #  #  # ]:           0 :      if (tread==0.and.dtset%iscf==0) dtset%wvl_bigdft_comp=1
    2162   [ #  #  #  # ]:           0 :      if (tread==0.and.dtset%iscf >0) dtset%wvl_bigdft_comp=0
    2163                 :             :    end if
    2164         [ +  + ]:        6179 :  else if (dtset%optdriver==RUNL_GWLS) then
    2165                 :             :    !For GWLS, iscf=-2 is mandatory
    2166                 :           8 :    dtset%iscf=-2
    2167   [ +  +  +  + ]:        6171 :  else if (dtset%optdriver==RUNL_RESPFN.and.dtset%iscf>=10) then
    2168                 :             :    !Only potential mixing available for response function
    2169                 :          69 :    dtset%iscf=dtset%iscf-10
    2170   [ +  +  +  +  :        6102 :  else if (dtset%optdriver==RUNL_GSTATE.and.dtset%iscf>=10.and.xc_is_pot_only) then
                   +  + ]
    2171                 :             :    !For the TB09 xc functional, the potential mixing seems to be better
    2172                 :           3 :    dtset%iscf=dtset%iscf-10
    2173                 :           3 :    msg='Automatically switching to potential mixing (iscf<10); seems to be better for BJ/TB09 XC...'
    2174                 :           3 :    ABI_COMMENT(msg)
    2175                 :             :  else if (dtset%optdriver==RUNL_GSTATE.and.dtset%iscf>=10.and. &
    2176   [ +  +  +  +  :        6099 : &         dtset%densfor_pred/=0.and.abs(dtset%densfor_pred)/=5) then
             +  +  +  + ]
    2177                 :             :    !In case of density mixing (iscf>=10) and correction of forces (densfor_pred/=0 and 5)
    2178                 :             :    !  we need Kxc. If it is not available, we switch to potential mixing (iscf<10)
    2179         [ +  + ]:         966 :    if (.not.xc_has_kxc) then
    2180                 :           7 :      call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'optforces',tread,'INT')
    2181   [ -  +  -  - ]:           7 :      if (dtset%optforces/=0.or.intarr(1)/=0) then
    2182                 :           7 :        dtset%iscf=dtset%iscf-10
    2183                 :           7 :        ABI_COMMENT('Automatically switching to potential mixing (iscf<10), because XC functional doe snot provide Kxc!')
    2184                 :             :      end if
    2185                 :             :    end if
    2186                 :             :  end if
    2187                 :             : 
    2188                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'vdw_df_acutmin',tread,'DPR')
    2189         [ -  + ]:        7010 :  if(tread==1) dtset%vdw_df_acutmin=dprarr(1)
    2190                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'vdw_df_aratio',tread,'DPR')
    2191         [ -  + ]:        7010 :  if(tread==1) dtset%vdw_df_aratio=dprarr(1)
    2192                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'vdw_df_damax',tread,'DPR')
    2193         [ -  + ]:        7010 :  if(tread==1) dtset%vdw_df_damax=dprarr(1)
    2194                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'vdw_df_damin',tread,'DPR')
    2195         [ -  + ]:        7010 :  if(tread==1) dtset%vdw_df_damin=dprarr(1)
    2196                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'vdw_df_dcut',tread,'DPR')
    2197         [ -  + ]:        7010 :  if(tread==1) dtset%vdw_df_dcut=dprarr(1)
    2198                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'vdw_df_dratio',tread,'DPR')
    2199         [ -  + ]:        7010 :  if(tread==1) dtset%vdw_df_dratio=dprarr(1)
    2200                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'vdw_df_dsoft',tread,'DPR')
    2201         [ -  + ]:        7010 :  if(tread==1) dtset%vdw_df_dsoft=dprarr(1)
    2202                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'vdw_df_gcut',tread,'DPR')
    2203         [ -  + ]:        7010 :  if(tread==1) dtset%vdw_df_gcut=dprarr(1)
    2204                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'vdw_df_ndpts',tread,'INT')
    2205         [ -  + ]:        7010 :  if(tread==1) dtset%vdw_df_ndpts=intarr(1)
    2206                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'vdw_df_ngpts',tread,'INT')
    2207         [ -  + ]:        7010 :  if(tread==1) dtset%vdw_df_ngpts=intarr(1)
    2208                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'vdw_df_nqpts',tread,'INT')
    2209         [ -  + ]:        7010 :  if(tread==1) dtset%vdw_df_nqpts=intarr(1)
    2210                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'vdw_df_nrpts',tread,'INT')
    2211         [ -  + ]:        7010 :  if(tread==1) dtset%vdw_df_nrpts=intarr(1)
    2212                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'vdw_df_nsmooth',tread,'INT')
    2213         [ -  + ]:        7010 :  if(tread==1) dtset%vdw_df_nsmooth=intarr(1)
    2214                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'vdw_df_phisoft',tread,'DPR')
    2215         [ -  + ]:        7010 :  if(tread==1) dtset%vdw_df_phisoft=dprarr(1)
    2216                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'vdw_df_qcut',tread,'DPR')
    2217         [ -  + ]:        7010 :  if(tread==1) dtset%vdw_df_qcut=dprarr(1)
    2218                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'vdw_df_qratio',tread,'DPR')
    2219         [ -  + ]:        7010 :  if(tread==1) dtset%vdw_df_qratio=dprarr(1)
    2220                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'vdw_df_rcut',tread,'DPR')
    2221         [ -  + ]:        7010 :  if(tread==1) dtset%vdw_df_rcut=dprarr(1)
    2222                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'vdw_df_rsoft',tread,'DPR')
    2223         [ -  + ]:        7010 :  if(tread==1) dtset%vdw_df_rsoft=dprarr(1)
    2224                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'vdw_df_tolerance',tread,'DPR')
    2225         [ -  + ]:        7010 :  if(tread==1) dtset%vdw_df_tolerance=dprarr(1)
    2226                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'vdw_df_threshold',tread,'DPR',ds_input)
    2227         [ -  + ]:        7010 :  if(tread==1) dtset%vdw_df_threshold=dprarr(1)
    2228                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'vdw_df_tweaks',tread,'INT')
    2229         [ -  + ]:        7010 :  if(tread==1) dtset%vdw_df_tweaks=intarr(1)
    2230                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'vdw_df_zab',tread,'DPR')
    2231         [ -  + ]:        7010 :  if(tread==1) dtset%vdw_df_zab=dprarr(1)
    2232                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'vdw_xc',tread,'INT')
    2233         [ +  + ]:        7010 :  if(tread==1) dtset%vdw_xc=intarr(1)
    2234                 :             : 
    2235                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'posdoppler',tread,'INT')
    2236         [ +  + ]:        7010 :  if(tread==1) dtset%posdoppler=intarr(1)
    2237                 :             : 
    2238                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'positron',tread,'INT')
    2239         [ +  + ]:        7010 :  if(tread==1) dtset%positron=intarr(1)
    2240                 :             : 
    2241                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'ixcpositron',tread,'INT')
    2242         [ +  + ]:        7010 :  if(tread==1) dtset%ixcpositron=intarr(1)
    2243                 :             : 
    2244                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'posnstep',tread,'INT')
    2245         [ +  + ]:        7010 :  if(tread==1) dtset%posnstep=intarr(1)
    2246                 :             : 
    2247                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'posocc',tread,'DPR')
    2248         [ +  + ]:        7010 :  if(tread==1) dtset%posocc=dprarr(1)
    2249                 :             : 
    2250                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'frzfermi',tread,'INT')
    2251         [ +  + ]:        7010 :  if(tread==1) dtset%frzfermi=intarr(1)
    2252                 :             : 
    2253                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'nqpt',tread,'INT')
    2254         [ +  + ]:        7010 :  if(tread==1) dtset%nqpt=intarr(1)
    2255                 :             : 
    2256                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'efmas',tread,'INT')
    2257         [ +  + ]:        7010 :  if(tread==1) dtset%efmas=intarr(1)
    2258                 :             : 
    2259         [ +  + ]:        7010 :  if(dtset%efmas>0) then
    2260                 :          17 :    call intagm(dprarr,intarr,jdtset,marr,2*nkpt,string(1:lenstr),'efmas_bands',tread,'INT')
    2261         [ +  - ]:          17 :    if(tread==1) then
    2262   [ +  +  +  +  :         123 :      dtset%efmas_bands(1:2,1:nkpt)=reshape(intarr(1:2*nkpt), [2,nkpt])
                   +  + ]
    2263                 :             :    else
    2264         [ #  # ]:           0 :      dtset%efmas_bands(1,:)=1
    2265         [ #  # ]:           0 :      dtset%efmas_bands(2,:)=dtset%nband(:)
    2266                 :             :    end if
    2267                 :             :  end if
    2268                 :             : 
    2269                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'efmas_deg',tread,'INT')
    2270         [ +  + ]:        7010 :  if(tread==1) dtset%efmas_deg=intarr(1)
    2271                 :             : 
    2272                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'efmas_deg_tol',tread,'ENE')
    2273         [ +  + ]:        7010 :  if(tread==1) dtset%efmas_deg_tol=dprarr(1)
    2274                 :             : 
    2275                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'efmas_dim',tread,'INT')
    2276         [ +  + ]:        7010 :  if(tread==1) dtset%efmas_dim=intarr(1)
    2277                 :             : 
    2278   [ +  +  +  - ]:        7010 :  if(dtset%efmas_calc_dirs/=0 .and. dtset%efmas_n_dirs>0) then
    2279         [ +  + ]:          14 :    ndim=2+MERGE(1,0,ABS(dtset%efmas_calc_dirs)<3)
    2280                 :          14 :    call intagm(dprarr,intarr,jdtset,marr,ndim*dtset%efmas_n_dirs,string(1:lenstr),'efmas_dirs',tread,'DPR')
    2281         [ +  - ]:          14 :    if(tread==1) then
    2282   [ +  +  +  +  :         276 :      dtset%efmas_dirs(1:ndim,1:dtset%efmas_n_dirs)=reshape(dprarr(1:ndim*dtset%efmas_n_dirs),(/ndim,dtset%efmas_n_dirs/))
                   +  + ]
    2283                 :             :    end if
    2284                 :             :  end if
    2285                 :             : 
    2286                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'efmas_ntheta',tread,'INT')
    2287         [ +  + ]:        7010 :  if(tread==1) dtset%efmas_ntheta=intarr(1)
    2288                 :             : 
    2289                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'ieig2rf',tread,'INT')
    2290         [ +  + ]:        7010 :  if(tread==1) dtset%ieig2rf=intarr(1)
    2291                 :             : 
    2292                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'smdelta',tread,'INT')
    2293         [ +  + ]:        7010 :  if(tread==1) dtset%smdelta=intarr(1)
    2294                 :             : 
    2295                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'bdeigrf',tread,'INT')
    2296         [ +  + ]:        7010 :  if(tread==1) dtset%bdeigrf=intarr(1)
    2297                 :             : 
    2298                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'restartxf',tread,'INT')
    2299         [ +  + ]:        7010 :  if(tread==1) dtset%restartxf=intarr(1)
    2300                 :             : 
    2301                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'optcell',tread,'INT')
    2302         [ +  + ]:        7010 :  if(tread==1) dtset%optcell=intarr(1)
    2303                 :             : 
    2304                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'irdwfmq',tread,'INT')
    2305         [ -  + ]:        7010 :  if(tread==1) dtset%irdwfmq=intarr(1)
    2306                 :             : 
    2307                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'irdwfq',tread,'INT')
    2308         [ +  + ]:        7010 :  if(tread==1) dtset%irdwfq=intarr(1)
    2309                 :             : 
    2310                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'ird1den',tread,'INT')
    2311         [ -  + ]:        7010 :  if(tread==1) dtset%ird1den=intarr(1)
    2312                 :             : 
    2313                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'ird1wf',tread,'INT')
    2314         [ -  + ]:        7010 :  if(tread==1) dtset%ird1wf=intarr(1)
    2315                 :             : 
    2316                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'irdddk',tread,'INT')
    2317         [ +  + ]:        7010 :  if(tread==1) dtset%irdddk=intarr(1)
    2318                 :             : 
    2319                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'irddelfd',tread,'INT')
    2320         [ -  + ]:        7010 :  if(tread==1) dtset%irddelfd=intarr(1)
    2321                 :             : 
    2322                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'irddkdk',tread,'INT')
    2323         [ -  + ]:        7010 :  if(tread==1) dtset%irddkdk=intarr(1)
    2324                 :             : 
    2325                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'irddkde',tread,'INT')
    2326         [ -  + ]:        7010 :  if(tread==1) dtset%irddkde=intarr(1)
    2327                 :             : 
    2328                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'kptopt',tread,'INT')
    2329         [ +  + ]:        7010 :  if(tread==1) dtset%kptopt=intarr(1)
    2330                 :             : 
    2331                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'chkexit',tread,'INT')
    2332         [ +  + ]:        7010 :  if(tread==1) dtset%chkexit=intarr(1)
    2333                 :             : 
    2334                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'nbdblock',tread,'INT')
    2335         [ +  + ]:        7010 :  if(tread==1) dtset%nbdblock=intarr(1)
    2336                 :             : 
    2337                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'nbdbuf',tread,'INT')
    2338         [ +  + ]:        7010 :  if(tread==1)then
    2339                 :        1239 :    dtset%nbdbuf=intarr(1)
    2340                 :             :    ! A negative value is interpreted as percentage of nband, except -101. Anyhow, nbdbuf must be strictly bigger than -102
    2341         [ -  + ]:        1239 :    ABI_CHECK(dtset%nbdbuf > -102, "nbdbuf should be > -102")
    2342         [ +  + ]:        1239 :    if (dtset%nbdbuf < 0) then
    2343         [ +  + ]:          20 :      if (dtset%nbdbuf/=-101) then
    2344         [ +  + ]:          98 :        dtset%nbdbuf = max(nint(abs(dtset%nbdbuf) / 100.0_dp * maxval(dtset%nband)), 1)
    2345                 :             :      else
    2346         [ -  + ]:          15 :        ABI_CHECK(response==0,'nbdbuf=-101 is not implemented for DFPT')
    2347                 :             :      end if
    2348                 :             :    end if
    2349                 :             :  else
    2350   [ +  +  +  + ]:        5771 :    if(response/=1 .and. dtset%iscf<0) then
    2351                 :         249 :      dtset%nbdbuf=2*dtset%nspinor
    2352                 :             :      write(msg, "(5a)") &
    2353                 :         249 :         "nbdbuf is not specified in input, using `nbdbuf = 2*nspinor` that may be too small!", ch10, &
    2354                 :         249 :         "As a consequence, the NSCF cycle may have problems to converge the last bands within nstep iterations.", ch10, &
    2355                 :         498 :         "To avoid this problem specify nbdbuf in the input file and adjust nband accordingly."
    2356                 :         249 :      ABI_WARNING(msg)
    2357                 :             :    end if
    2358   [ +  +  +  +  :        5771 :    if(response==1 .and. 3<=occopt .and. occopt<=8 )dtset%nbdbuf=2*dtset%nspinor
                   +  - ]
    2359                 :             :  end if
    2360                 :             : 
    2361                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'localrdwf',tread,'INT')
    2362         [ +  + ]:        7010 :  if(tread==1) dtset%localrdwf=intarr(1)
    2363                 :             : 
    2364                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'magconon',tread,'INT')
    2365         [ +  + ]:        7010 :  if(tread==1) dtset%magconon=intarr(1)
    2366                 :             : 
    2367                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'magcon_lambda',tread,'DPR')
    2368         [ +  + ]:        7010 :  if(tread==1) dtset%magcon_lambda=dprarr(1)
    2369                 :             : 
    2370                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'ratopt',tread,'INT')
    2371         [ -  + ]:        7010 :  if(tread==1) dtset%ratopt=intarr(1)
    2372                 :             : 
    2373                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'ratsm',tread,'DPR')
    2374         [ +  + ]:        7010 :  if(tread==1) dtset%ratsm=dprarr(1)
    2375                 :             : 
    2376                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'optforces',tread,'INT')
    2377         [ +  + ]:        7010 :  if(tread==1) then
    2378                 :         359 :    dtset%optforces=intarr(1)
    2379         [ +  + ]:        6651 :  else if (xc_is_pot_only) then
    2380                 :          12 :    dtset%optforces=0
    2381                 :             :    write(msg, '(7a)' ) &
    2382                 :          12 : &      'When the selected XC functional is a potential-only functional (Becke-Johnson or Tran-Blaha),',ch10,&
    2383                 :          12 : &        'calculations cannot be self-consistent with respect to the total energy.',ch10,&
    2384                 :          12 : &        'For that reason, neither forces nor stresses can be computed.',ch10,&
    2385                 :          24 : &        'optforces and optstress are automatically set to 0.'
    2386                 :          12 :    ABI_COMMENT(msg)
    2387                 :             :  end if
    2388                 :             : 
    2389                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'optstress',tread,'INT')
    2390         [ +  + ]:        7010 :  if(tread==1) then
    2391                 :         306 :    dtset%optstress=intarr(1)
    2392         [ +  + ]:        6704 :  else if (xc_is_pot_only) then
    2393                 :          12 :    dtset%optstress=0
    2394                 :             :  end if
    2395                 :             :  ! ABINIT cannot calculate stress when fock_icutcoul is not zero (not implemented)
    2396   [ +  +  +  + ]:        7010 :  if (dtset%optstress==1.and.dtset%fock_icutcoul/=0) then
    2397                 :             :    write(msg, '(3a)' ) &
    2398                 :           1 :         'Stress can only be calculated (as of today) when fock_icutcoul=0',ch10,&
    2399                 :           2 :         'If you really want the stress, change fock_icutcoul.'
    2400         [ -  + ]:           1 :    if(tread==1) then
    2401                 :           0 :      ABI_ERROR(msg)
    2402                 :             :    else
    2403                 :           1 :      ABI_COMMENT(msg)
    2404                 :           1 :      dtset%optstress=0
    2405                 :             :    endif
    2406                 :             :  end if
    2407                 :             : 
    2408                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'optnlxccc',tread,'INT')
    2409         [ +  + ]:        7010 :  if(tread==1) dtset%optnlxccc=intarr(1)
    2410                 :             : 
    2411                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'nberry',tread,'INT')
    2412         [ -  + ]:        7010 :  if(tread==1) dtset%nberry=intarr(1)
    2413                 :             : 
    2414                 :             :  !call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'nb_protected',tread,'INT')
    2415                 :             :  !if(tread==1) dtset%nb_protected=intarr(1)
    2416                 :             : 
    2417                 :             :  !call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'nb_per_slice',tread,'INT')
    2418                 :             :  !if(tread==1) dtset%nb_per_slice=intarr(1)
    2419                 :             : 
    2420                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'nc_xccc_gspace',tread,'INT')
    2421         [ +  + ]:        7010 :  if(tread==1) dtset%nc_xccc_gspace=intarr(1)
    2422                 :             : 
    2423                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,2*nsppol,string(1:lenstr),'bdberry',tread,'INT')
    2424         [ -  + ]:        7010 :  if(tread==1) then
    2425                 :           0 :    dtset%bdberry(1)=intarr(1); dtset%bdberry(2)=intarr(2)
    2426         [ #  # ]:           0 :    if(nsppol==2)then
    2427                 :           0 :      dtset%bdberry(3)=intarr(3); dtset%bdberry(4)=intarr(4)
    2428                 :             :    end if
    2429                 :             :  end if
    2430                 :             : 
    2431                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'berrystep',tread,'INT')
    2432         [ +  + ]:        7010 :  if(tread==1) dtset%berrystep=intarr(1)
    2433                 :             : 
    2434                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'delayperm',tread,'INT')
    2435         [ +  + ]:        7010 :  if(tread==1) dtset%delayperm=intarr(1)
    2436                 :             : 
    2437                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'signperm',tread,'INT')
    2438         [ +  + ]:        7010 :  if(tread==1) dtset%signperm=intarr(1)
    2439                 :             : 
    2440                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'nbandkss',tread,'INT')
    2441         [ +  + ]:        7010 :  if(tread==1) dtset%nbandkss=intarr(1)
    2442                 :             : !This overloading of usepawu should be replaced by something cleaner ...
    2443                 :             : ! if ( dtset%usedmft > 0  .and. (dtset%nbandkss==0.or.dtset%iscf<0)) then
    2444                 :             : !   if (dtset%usepawu==4.or.dtset%usepawu==14)  dtset%usepawu=14
    2445                 :             : !   if (dtset%usepawu/=4.and.dtset%usepawu/=14) dtset%usepawu=10
    2446                 :             : ! end if
    2447                 :             : 
    2448                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'npwkss',tread,'INT')
    2449         [ -  + ]:        7010 :  if(tread==1) dtset%npwkss=intarr(1)
    2450                 :             : 
    2451                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'kssform',tread,'INT')
    2452         [ +  + ]:        7010 :  if(tread==1) dtset%kssform=intarr(1)
    2453                 :             : 
    2454                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'td_mexcit',tread,'INT')
    2455         [ +  + ]:        7010 :  if(tread==1) dtset%td_mexcit=intarr(1)
    2456                 :             : 
    2457                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'td_exp_order',tread,'INT')
    2458         [ +  + ]:        7010 :  if(tread==1) dtset%td_exp_order=intarr(1)
    2459                 :             : 
    2460                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'td_scnmax',tread,'INT')
    2461         [ +  + ]:        7010 :  if(tread==1) dtset%td_scnmax=intarr(1)
    2462                 :             : 
    2463                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'td_prtstr',tread,'INT')
    2464         [ +  + ]:        7010 :  if(tread==1) dtset%td_prtstr=intarr(1)
    2465                 :             : 
    2466                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'td_restart',tread,'INT')
    2467         [ +  + ]:        7010 :  if(tread==1) dtset%td_restart=intarr(1)
    2468                 :             : 
    2469                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'td_propagator',tread,'INT')
    2470         [ +  + ]:        7010 :  if(tread==1) dtset%td_propagator=intarr(1)
    2471                 :             : 
    2472                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'td_scthr',tread,'DPR')
    2473         [ +  + ]:        7010 :  if(tread==1) dtset%td_scthr=dprarr(1)
    2474                 :             : 
    2475                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'td_ef_type',tread,'INT')
    2476         [ +  + ]:        7010 :  if(tread==1) dtset%td_ef_type=intarr(1)
    2477                 :             : 
    2478                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'td_ef_induced_vecpot',tread,'INT')
    2479         [ +  + ]:        7010 :  if(tread==1) dtset%td_ef_induced_vecpot=intarr(1)
    2480                 :             : 
    2481                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'td_ef_tzero',tread,'TIM')
    2482         [ +  + ]:        7010 :  if(tread==1) dtset%td_ef_tzero=dprarr(1)
    2483                 :             : 
    2484                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'td_ef_tau',tread,'TIM')
    2485         [ -  + ]:        7010 :  if(tread==1) dtset%td_ef_tau=dprarr(1)
    2486                 :             : 
    2487                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,3,string(1:lenstr),'td_ef_pol',tread,'DPR')
    2488   [ -  +  -  - ]:        7010 :  if(tread==1) dtset%td_ef_pol(1:3)=dprarr(1:3)
    2489                 :             : 
    2490                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'td_ef_lambda',tread,'LEN')
    2491         [ -  + ]:        7010 :  if(tread==1) dtset%td_ef_lambda=dprarr(1)
    2492                 :             : 
    2493                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'td_ef_ezero',tread,'DPR')
    2494         [ -  + ]:        7010 :  if(tread==1) dtset%td_ef_ezero=dprarr(1)
    2495                 :             : 
    2496                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'npvel',tread,'INT')
    2497         [ +  + ]:        7010 :  if(tread==1) dtset%npvel=intarr(1)
    2498                 :             : 
    2499                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'npulayit',tread,'INT')
    2500         [ +  + ]:        7010 :  if(tread==1) dtset%npulayit=intarr(1)
    2501                 :             : 
    2502                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'diismemory',tread,'INT')
    2503         [ -  + ]:        7010 :  if(tread==1) dtset%diismemory=intarr(1)
    2504                 :             : 
    2505                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dipquad',tread,'INT')
    2506         [ -  + ]:        7010 :  if(tread==1) dtset%dipquad=intarr(1)
    2507                 :             : 
    2508                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'goprecon',tread,'INT')
    2509         [ +  + ]:        7010 :  if(tread==1) dtset%goprecon=intarr(1)
    2510                 :             : 
    2511                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,3,string(1:lenstr),'goprecprm',tread,'DPR')
    2512   [ +  +  +  + ]:        7031 :  if(tread==1) dtset%goprecprm(1:3)=dprarr(1:3)
    2513                 :             : 
    2514                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, 1, string(1:lenstr), 'gstore_with_vk', tread, 'INT')
    2515         [ -  + ]:        7010 :  if (tread == 1) dtset%gstore_with_vk = intarr(1)
    2516                 :             : 
    2517                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, 1, string(1:lenstr), 'gstore_iv1p_comm', tread, 'INT')
    2518         [ -  + ]:        7010 :  if (tread == 1) dtset%gstore_iv1p_comm = intarr(1)
    2519                 :             : 
    2520                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, 1, string(1:lenstr), 'gstore_use_lgk', tread, 'INT')
    2521         [ +  + ]:        7010 :  if (tread == 1) dtset%gstore_use_lgk = intarr(1)
    2522                 :             : 
    2523                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, 1, string(1:lenstr), 'gstore_use_lgq', tread, 'INT')
    2524         [ -  + ]:        7010 :  if (tread == 1) dtset%gstore_use_lgq = intarr(1)
    2525                 :             : 
    2526                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, 1, string(1:lenstr), 'gstore_sym', tread, 'INT')
    2527         [ -  + ]:        7010 :  if (tread == 1) dtset%gstore_sym = intarr(1)
    2528                 :             : 
    2529                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, 1, string(1:lenstr), 'gstore_kzone', tread, 'KEY', key_value=key_value)
    2530   [ +  +  +  - ]:        7010 :  if (tread == 1) dtset%gstore_kzone = tolower(key_value)
    2531                 :             : 
    2532                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, 1, string(1:lenstr), 'gstore_qzone', tread, 'KEY', key_value=key_value)
    2533   [ +  +  +  - ]:        7010 :  if (tread == 1) dtset%gstore_qzone = tolower(key_value)
    2534                 :             : 
    2535                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, 1, string(1:lenstr), 'gstore_kfilter', tread_kfilter, 'KEY', key_value=key_value)
    2536   [ +  +  +  - ]:        7010 :  if (tread_kfilter == 1) dtset%gstore_kfilter = tolower(key_value)
    2537                 :             : 
    2538                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, 1, string(1:lenstr), 'gstore_gname', tread, 'KEY', key_value=key_value)
    2539   [ +  +  +  - ]:        7010 :  if (tread == 1) dtset%gstore_gname = tolower(key_value)
    2540                 :             : 
    2541                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, 1, string(1:lenstr), 'gstore_convert', tread, 'KEY', key_value=key_value)
    2542   [ -  +  -  - ]:        7010 :  if (tread == 1) dtset%gstore_convert = tolower(key_value)
    2543                 :             : 
    2544                 :        7010 :  narr = 2 * nsppol
    2545                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, narr, string(1:lenstr), 'gstore_brange', tread_brange, 'INT')
    2546         [ +  + ]:        7010 :  if (tread_brange == 1) then
    2547   [ +  -  +  + ]:          12 :    if (nsppol == 1) dtset%gstore_brange(:, 1) = intarr(1:narr)
    2548   [ -  +  -  -  :           4 :    if (nsppol == 2) dtset%gstore_brange = reshape(intarr(1:narr), [2, nsppol])
             -  -  -  - ]
    2549                 :             :  end if
    2550                 :             : 
    2551                 :        7010 :  narr = 2 * nsppol
    2552                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, narr, string(1:lenstr), 'gstore_erange', tread_erange, 'ENE')
    2553         [ +  + ]:        7010 :  if (tread_erange == 1) then
    2554   [ +  -  +  + ]:           3 :    if (nsppol == 1) dtset%gstore_erange(:, 1) = dprarr(1:narr)
    2555   [ -  +  -  -  :           1 :    if (nsppol == 2) dtset%gstore_erange = reshape(dprarr(1:narr), [2, nsppol])
             -  -  -  - ]
    2556                 :             :  end if
    2557                 :             : 
    2558   [ +  +  -  + ]:        7010 :  if (tread_erange == 1 .and. tread_brange == 1) then
    2559                 :           0 :    ABI_ERROR("gstore_erange and gstore_brange are mutually exclusive!")
    2560                 :             :  end if
    2561   [ +  +  -  + ]:        7010 :  if (tread_erange == 1 .and. tread_kfilter == 1) then
    2562                 :           0 :    ABI_ERROR("gstore_erange and gstore_kfilter are mutually exclusive!")
    2563                 :             :  end if
    2564                 :             : 
    2565                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, 1, string(1:lenstr), 'vpq_aseed', tread, 'KEY', key_value=key_value)
    2566   [ +  +  +  - ]:        7010 :  if (tread == 1) dtset%vpq_aseed = tolower(trim(key_value))
    2567                 :             : 
    2568                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, 1, string(1:lenstr), 'vpq_mode', tread, 'KEY', key_value=key_value)
    2569   [ +  +  +  - ]:        7010 :  if (tread == 1) dtset%vpq_mode = tolower(trim(key_value))
    2570                 :             : 
    2571                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, 1, string(1:lenstr), 'vpq_pkind', tread, 'KEY', key_value=key_value)
    2572   [ +  +  +  - ]:        7010 :  if (tread == 1) dtset%vpq_pkind = tolower(trim(key_value))
    2573                 :             : 
    2574                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, 1, string(1:lenstr), 'vpq_atloc', tread, 'INT')
    2575         [ -  + ]:        7010 :  if (tread == 1) dtset%vpq_atloc = intarr(1)
    2576                 :             : 
    2577                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, 1, string(1:lenstr), 'vpq_avg_g', tread, 'INT')
    2578         [ +  + ]:        7010 :  if (tread == 1) dtset%vpq_avg_g = intarr(1)
    2579                 :             : 
    2580                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, 1, string(1:lenstr), 'vpq_translate', tread, 'INT')
    2581         [ +  + ]:        7010 :  if (tread == 1) dtset%vpq_translate = intarr(1)
    2582                 :             : 
    2583                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, 1, string(1:lenstr), 'vpq_interp', tread, 'INT')
    2584         [ -  + ]:        7010 :  if (tread == 1) dtset%vpq_interp = intarr(1)
    2585                 :             : 
    2586                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, 1, string(1:lenstr), 'vpq_nstates', tread, 'INT')
    2587         [ +  + ]:        7010 :  if (tread == 1) dtset%vpq_nstates = intarr(1)
    2588                 :             : 
    2589                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, 1, string(1:lenstr), 'vpq_hop_nstep', tread, 'INT')
    2590         [ +  + ]:        7010 :  if (tread == 1) dtset%vpq_hop_nstep = intarr(1)
    2591                 :             : 
    2592                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, 1, string(1:lenstr), 'vpq_hop_from_ip', tread, 'INT')
    2593         [ +  + ]:        7010 :  if (tread == 1) dtset%vpq_hop_from_ip = intarr(1)
    2594                 :             : 
    2595                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, 1, string(1:lenstr), 'vpq_hop_to_ip', tread, 'INT')
    2596         [ +  + ]:        7010 :  if (tread == 1) dtset%vpq_hop_to_ip = intarr(1)
    2597                 :             : 
    2598                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, 1, string(1:lenstr), 'vpq_nstep', tread, 'INT')
    2599         [ +  + ]:        7010 :  if (tread == 1) dtset%vpq_nstep = intarr(1)
    2600                 :             : 
    2601                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, 1, string(1:lenstr), 'vpq_nstep_ort', tread, 'INT')
    2602         [ +  + ]:        7010 :  if (tread == 1) dtset%vpq_nstep_ort = intarr(1)
    2603                 :             : 
    2604                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, 1, string(1:lenstr), 'vpq_select', tread, 'INT')
    2605         [ -  + ]:        7010 :  if (tread == 1) dtset%vpq_select = intarr(1)
    2606                 :             : 
    2607                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, 1, string(1:lenstr), 'vpq_mesh_fact', tread, 'INT')
    2608         [ +  + ]:        7010 :  if (tread == 1) dtset%vpq_mesh_fact = intarr(1)
    2609                 :             : 
    2610                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, 1, string(1:lenstr), 'vpq_hop_tolgrs', tread, 'DPR')
    2611         [ +  + ]:        7010 :  if(tread==1) dtset%vpq_hop_tolgrs = dprarr(1)
    2612                 :             : 
    2613                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, 1, string(1:lenstr), 'vpq_hop_ts', tread, 'DPR')
    2614         [ +  + ]:        7010 :  if(tread==1) dtset%vpq_hop_ts = dprarr(1)
    2615                 :             : 
    2616                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, 1, string(1:lenstr), 'vpq_mix_fact', tread, 'DPR')
    2617         [ -  + ]:        7010 :  if(tread==1) dtset%vpq_mix_fact = dprarr(1)
    2618                 :             : 
    2619                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, 1, string(1:lenstr), 'vpq_tolgrs', tread, 'DPR')
    2620         [ +  + ]:        7010 :  if(tread==1) dtset%vpq_tolgrs = dprarr(1)
    2621                 :             : 
    2622                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, 3, string(1:lenstr), 'vpq_trvec', tread, 'INT')
    2623   [ +  +  +  + ]:        7013 :  if (tread == 1) dtset%vpq_trvec = intarr(1:3)
    2624                 :             : 
    2625                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, 3, string(1:lenstr), 'vpq_hop_from_site', tread, 'INT')
    2626   [ +  +  +  + ]:        7013 :  if (tread == 1) dtset%vpq_hop_from_site = intarr(1:3)
    2627                 :             : 
    2628                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, 3, string(1:lenstr), 'vpq_hop_to_site', tread, 'INT')
    2629   [ +  +  +  + ]:        7013 :  if (tread == 1) dtset%vpq_hop_to_site = intarr(1:3)
    2630                 :             : 
    2631                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, 3, string(1:lenstr), 'vpq_hop_vec', tread, 'INT')
    2632   [ +  +  +  + ]:        7013 :  if (tread == 1) dtset%vpq_hop_vec = intarr(1:3)
    2633                 :             : 
    2634                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, 2, string(1:lenstr), 'vpq_gpr_energy', tread, 'DPR')
    2635   [ +  +  +  + ]:        7026 :  if (tread == 1) dtset%vpq_gpr_energy = dprarr(1:2)
    2636                 :             : 
    2637                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, 3, string(1:lenstr), 'vpq_gpr_length', tread, 'DPR')
    2638   [ -  +  -  - ]:        7010 :  if (tread == 1) dtset%vpq_gpr_length = dprarr(1:3)
    2639                 :             : 
    2640                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'vpq_hop_from_filepath',tread,'KEY', key_value=key_value)
    2641         [ +  + ]:        7010 :  if(tread==1) dtset%vpq_hop_from_filepath = key_value
    2642                 :             : 
    2643                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'vpq_hop_to_filepath',tread,'KEY', key_value=key_value)
    2644         [ +  + ]:        7010 :  if(tread==1) dtset%vpq_hop_to_filepath = key_value
    2645                 :             : 
    2646                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, 1, string(1:lenstr), 'vpq_efilter', tread, 'ENE')
    2647         [ -  + ]:        7010 :  if(tread==1) dtset%vpq_efilter = dprarr(1)
    2648                 :             : 
    2649                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,ntypat,string(1:lenstr),'lambsig',tread,'DPR')
    2650   [ +  +  +  + ]:        7059 :  if(tread==1) dtset%lambsig(1:ntypat)=dprarr(1:ntypat)
    2651                 :             : 
    2652                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'nwfshist',tread,'INT')
    2653         [ -  + ]:        7010 :  if(tread==1) dtset%nwfshist=intarr(1)
    2654                 :             : 
    2655                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, 1, string(1:lenstr), 'nscforder', tread, 'INT')
    2656         [ -  + ]:        7010 :  if (tread == 1) dtset%nscforder = intarr(1)
    2657                 :             : 
    2658                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'nomegasrd',tread,'INT')
    2659         [ +  + ]:        7010 :  if(tread==1) dtset%nomegasrd=intarr(1)
    2660                 :             : 
    2661                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,ntypat,string(1:lenstr),'corecs',tread,'DPR')
    2662         [ -  + ]:        7010 :  if(tread==1)then
    2663         [ #  # ]:           0 :    dtset%corecs(1:ntypat)=dprarr(1:ntypat)
    2664                 :             :  end if
    2665                 :             : 
    2666                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,ntypat,string(1:lenstr),'ptcharge',tread,'DPR')
    2667         [ +  + ]:        7010 :  if(tread==1)then
    2668         [ +  + ]:           3 :    dtset%ptcharge(1:ntypat)=dprarr(1:ntypat)
    2669                 :             :  end if
    2670                 :             : 
    2671                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'pulayhiststore',tread,'INT')
    2672         [ +  + ]:        7010 :  if(tread==1) dtset%pulayhiststore=intarr(1)
    2673                 :             : 
    2674                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,ntypat,string(1:lenstr),'quadmom',tread,'DPR')
    2675         [ +  + ]:        7010 :  if(tread==1)then
    2676         [ +  + ]:          26 :    dtset%quadmom(1:ntypat)=dprarr(1:ntypat)
    2677                 :             :  end if
    2678                 :             : 
    2679                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'paw_add_core',tread,'INT')
    2680         [ +  + ]:        7010 :  if(tread==1) dtset%paw_add_core=intarr(1)
    2681                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'pawcpxocc',tread,'INT')
    2682         [ +  + ]:        7010 :  if(tread==1) then
    2683                 :          48 :    dtset%pawcpxocc=intarr(1)
    2684   [ +  +  +  +  :        6962 :  else if(dtset%nspinor==2.and.(dtset%usepawu/=0.or.(dtset%usedmft>0.and.dtset%usedmft/=10))) then
                   -  + ]
    2685                 :          28 :    dtset%pawcpxocc=2
    2686   [ +  +  +  - ]:        6934 :  else if (dtset%pawspnorb>0.and.(dtset%kptopt<=0.or.dtset%kptopt>=3)) then
    2687   [ +  +  -  +  :          90 :    if (dtset%optdriver/=RUNL_GSTATE.or.dtset%ionmov<6.or.dtset%iscf<10) dtset%pawcpxocc=2
                   -  - ]
    2688   [ +  +  +  +  :      225060 :  else if (ANY(ABS(dtset%nucdipmom)>tol8)) then
             +  +  +  + ]
    2689                 :           2 :    dtset%pawcpxocc=2
    2690                 :             :  end if
    2691                 :             : 
    2692                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'pawcross',tread,'INT')
    2693         [ -  + ]:        7010 :  if(tread==1) dtset%pawcross=intarr(1)
    2694                 :             : 
    2695                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'pawecutdg',tread,'ENE')
    2696         [ +  + ]:        7010 :  if(tread==1) then
    2697                 :        1287 :    dtset%pawecutdg=dprarr(1)
    2698         [ -  + ]:        5723 :  else if (dtset%accuracy==1.or.dtset%accuracy==2) then
    2699                 :           0 :    dtset%pawecutdg=dtset%ecut
    2700         [ -  + ]:        5723 :  else if (dtset%accuracy==3.) then
    2701                 :           0 :    dtset%pawecutdg=1.2_dp*dtset%ecut
    2702         [ -  + ]:        5723 :  else if (dtset%accuracy==4) then
    2703                 :           0 :    dtset%pawecutdg=1.5_dp*dtset%ecut
    2704         [ +  + ]:        5723 :  else if (dtset%accuracy==5.or.dtset%accuracy==6) then
    2705                 :           2 :    dtset%pawecutdg=two*dtset%ecut
    2706                 :             : ! NOT YET ACTIVATED
    2707                 :             : ! else if (dtset%accuracy==0.and.usepaw==1.and.dtset%usewvl==0) then
    2708                 :             : !  dtset%pawecutdg=1.5_dp*dtset%ecut
    2709                 :             :  end if
    2710                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'pawlcutd',tread,'INT')
    2711         [ +  + ]:        7010 :  if(tread==1) dtset%pawlcutd=intarr(1)
    2712                 :             : 
    2713                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'pawlmix',tread,'INT')
    2714         [ +  + ]:        7010 :  if(tread==1) dtset%pawlmix=intarr(1)
    2715                 :             : 
    2716                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'pawmixdg',tread,'INT')
    2717         [ +  + ]:        7010 :  if(tread==1) then
    2718                 :          51 :    dtset%pawmixdg=intarr(1)
    2719   [ -  +  -  - ]:        6959 :  else if (dtset%npfft>1.and.usepaw==1) then
    2720                 :           0 :    dtset%pawmixdg=1
    2721   [ -  +  -  - ]:        6959 :  else if (dtset%usewvl==1.and.usepaw==1) then
    2722                 :           0 :    dtset%pawmixdg=1
    2723                 :             :  end if
    2724                 :             : 
    2725                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'pawnhatxc',tread,'INT')
    2726         [ +  + ]:        7010 :  if(tread==1) dtset%pawnhatxc=intarr(1)
    2727                 :             : 
    2728                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'pawntheta',tread,'INT')
    2729         [ +  + ]:        7010 :  if(tread==1) dtset%pawntheta=intarr(1)
    2730                 :             : 
    2731                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'pawnphi',tread,'INT')
    2732         [ +  + ]:        7010 :  if(tread==1) dtset%pawnphi=intarr(1)
    2733                 :             : 
    2734                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'pawnzlm',tread,'INT')
    2735         [ +  + ]:        7010 :  if(tread==1) dtset%pawnzlm=intarr(1)
    2736                 :             : 
    2737                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'pawoptmix',tread,'INT')
    2738         [ +  + ]:        7010 :  if(tread==1) then
    2739                 :          27 :    dtset%pawoptmix=intarr(1)
    2740                 :             :  else
    2741   [ +  +  +  +  :        6983 :    if (usepaw==1.and.dtset%iscf<10.and.(dtset%positron==1.or.dtset%positron<0)) dtset%pawoptmix=1
                   -  + ]
    2742                 :             :  end if
    2743                 :             : 
    2744                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'pawoptosc',tread,'INT')
    2745         [ +  + ]:        7010 :  if(tread==1) dtset%pawoptosc=intarr(1)
    2746                 :             : 
    2747                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'pawovlp',tread,'DPR')
    2748         [ +  + ]:        7010 :  if(tread==1) dtset%pawovlp=dprarr(1)
    2749                 :             : 
    2750                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'pawprtdos',tread,'INT')
    2751         [ +  + ]:        7010 :  if(tread==1) dtset%pawprtdos=intarr(1)
    2752                 :             : 
    2753                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'pawprtvol',tread,'INT')
    2754         [ +  + ]:        7010 :  if(tread==1) dtset%pawprtvol=intarr(1)
    2755                 :             : 
    2756                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'pawprtwf',tread,'INT')
    2757         [ +  + ]:        7010 :  if(tread==1) dtset%pawprtwf=intarr(1)
    2758                 :             : 
    2759                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'pawprt_k',tread,'INT')
    2760         [ -  + ]:        7010 :  if(tread==1) dtset%pawprt_k=intarr(1)
    2761                 :             : 
    2762                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'pawprt_b',tread,'INT')
    2763         [ -  + ]:        7010 :  if(tread==1) dtset%pawprt_b=intarr(1)
    2764                 :             : 
    2765                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'pawstgylm',tread,'INT')
    2766         [ +  + ]:        7010 :  if(tread==1) dtset%pawstgylm=intarr(1)
    2767                 :             : 
    2768                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'pawsushat',tread,'INT')
    2769         [ -  + ]:        7010 :  if(tread==1) dtset%pawsushat=intarr(1)
    2770                 :             : 
    2771                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'pawusecp',tread,'INT')
    2772         [ +  + ]:        7010 :  if(tread==1) dtset%pawusecp=intarr(1)
    2773                 :             : 
    2774                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'pawxcdev',tread,'INT')
    2775         [ +  + ]:        7010 :  if(tread==1) then
    2776                 :          58 :    dtset%pawxcdev=intarr(1)
    2777   [ +  +  +  + ]:        6952 :  else if (usepaw==1.and.xc_is_mgga) then
    2778                 :          36 :    dtset%pawxcdev=0
    2779                 :             :  end if
    2780                 :             : 
    2781                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'spnorbscl',tread,'DPR')
    2782         [ +  + ]:        7010 :  if(tread==1) dtset%spnorbscl=dprarr(1)
    2783                 :             : 
    2784         [ +  + ]:        7010 :  if (dtset%usedmft>0.and.dtset%usedmft/=10) then
    2785                 :          43 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_solv',tread,'INT')
    2786         [ +  - ]:          43 :    if(tread==1) dtset%dmft_solv=intarr(1)
    2787         [ -  + ]:          43 :    if (dtset%dmft_solv==6.or.dtset%dmft_solv==7) then ! change some default values for TRIQS
    2788                 :           0 :      dtset%dmft_dc=0
    2789                 :           0 :      dtset%dmft_iter=-1
    2790         [ #  # ]:           0 :      if (dtset%dmft_solv==6) dtset%dmft_triqs_pauli_prob = 1.0_dp
    2791                 :             :    end if
    2792                 :          43 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_dc',tread,'INT')
    2793         [ +  + ]:          43 :    if(tread==1) dtset%dmft_dc=intarr(1)
    2794                 :             : ! XG20220322 - Should not impose dmft_dc on the flight. Should check in m_chkinp, and possibly stop.
    2795                 :             : !  if (dtset%usepawu==14.and.dtset%dmft_dc/=5.and.dtset%dmft_dc/=6) then
    2796                 :             : !    write(msg, '(a,a,a)' )&
    2797                 :             : !     'usepawu == 4 and usedmft == 1, dmft_dc should be equal to 5 or 6 ',ch10,&
    2798                 :             : !     'imposing dmft_dc = 5'
    2799                 :             : !    ABI_WARNING(msg)
    2800                 :             : !    dtset%dmft_dc=5
    2801                 :             : !  end if
    2802         [ -  + ]:          43 :    if (dtset%dmft_dc == 7) then
    2803                 :           0 :      call intagm(dprarr,intarr,jdtset,marr,natom,string(1:lenstr),'dmft_nominal',tread,'INT')
    2804   [ #  #  #  # ]:           0 :      if(tread==1) dtset%dmft_nominal(:)=intarr(1:natom)
    2805                 :             :    end if
    2806                 :          43 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_fermi_step',tread,'ENE')
    2807         [ -  + ]:          43 :    if(tread==1) dtset%dmft_fermi_step=dprarr(1)
    2808                 :          43 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_hybri_limit',tread,'INT')
    2809         [ -  + ]:          43 :    if(tread==1) dtset%dmft_hybri_limit=intarr(1)
    2810                 :          43 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_iter',tread,'INT')
    2811         [ +  + ]:          43 :    if(tread==1) dtset%dmft_iter=intarr(1)
    2812                 :          43 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_kspectralfunc',tread,'INT')
    2813         [ +  + ]:          43 :    if(tread==1) dtset%dmft_kspectralfunc=intarr(1)
    2814                 :          43 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_magnfield',tread,'INT')
    2815         [ +  + ]:          43 :    if(tread==1) dtset%dmft_magnfield=intarr(1)
    2816                 :          43 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_magnfield_b',tread,'DPR')
    2817         [ +  + ]:          43 :    if(tread==1) dtset%dmft_magnfield_b=dprarr(1)
    2818                 :          43 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_mxsf',tread,'DPR')
    2819         [ +  + ]:          43 :    if(tread==1) dtset%dmft_mxsf=dprarr(1)
    2820                 :          43 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_nwli',tread,'INT')
    2821         [ +  + ]:          43 :    if(tread==1) dtset%dmft_nwli=intarr(1)
    2822                 :          43 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_nwlo',tread,'INT')
    2823         [ +  + ]:          43 :    if(tread==1) dtset%dmft_nwlo=intarr(1)
    2824                 :          43 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_occnd_imag',tread,'INT')
    2825         [ +  + ]:          43 :    if(tread==1) dtset%dmft_occnd_imag=intarr(1)
    2826                 :          43 :    call intagm(dprarr,intarr,jdtset,marr,ntypat,string(1:lenstr),'dmft_orbital',tread,'INT')
    2827   [ -  +  -  - ]:          43 :    if(tread==1) dtset%dmft_orbital(:)=intarr(1:ntypat)
    2828                 :          43 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),"dmft_orbital_filepath",tread,'KEY',key_value=key_value)
    2829         [ -  + ]:          43 :    if (tread==1) dtset%dmft_orbital_filepath=key_value
    2830                 :          43 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_prt_maxent',tread,'INT')
    2831         [ -  + ]:          43 :    if(tread==1) dtset%dmft_prt_maxent=intarr(1)
    2832                 :          43 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_prtself',tread,'INT')
    2833         [ -  + ]:          43 :    if(tread==1) dtset%dmft_prtself=intarr(1)
    2834                 :          43 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_prtwan',tread,'INT')
    2835         [ -  + ]:          43 :    if(tread==1) dtset%dmft_prtwan=intarr(1)
    2836                 :          43 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_read_occnd',tread,'INT')
    2837         [ +  + ]:          43 :    if(tread==1) dtset%dmft_read_occnd=intarr(1)
    2838                 :          43 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_rslf',tread,'INT')
    2839         [ +  + ]:          43 :    if(tread==1) dtset%dmft_rslf=intarr(1)
    2840                 :          43 :    call intagm(dprarr,intarr,jdtset,marr,natom,string(1:lenstr),'dmft_shiftself',tread,'ENE')
    2841   [ -  +  -  - ]:          43 :    if(tread==1) dtset%dmft_shiftself(:)=dprarr(1:natom)
    2842                 :          43 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_t2g',tread,'INT')
    2843         [ +  + ]:          43 :    if(tread==1) dtset%dmft_t2g=intarr(1)
    2844                 :             : 
    2845                 :          43 :    natomcor=0
    2846         [ +  + ]:         139 :    do iatom=1,dtset%natom
    2847         [ +  + ]:         139 :      if(dtset%lpawu(dtset%typat(iatom))>0) natomcor=natomcor+1
    2848                 :             :    enddo
    2849                 :          43 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_full_chipsi',tread,'INT')
    2850         [ -  + ]:          43 :    if(tread==1) dtset%dmft_full_chipsi=intarr(1)
    2851                 :             : 
    2852   [ +  +  +  -  :          43 :    if(natomcor>1.and.dtset%dmft_solv/=6.and.dtset%dmft_solv/=7) dtset%dmft_wanorthnorm=2
                   +  - ]
    2853                 :          43 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_wanorthnorm',tread,'INT')
    2854         [ +  + ]:          43 :    if(tread==1) dtset%dmft_wanorthnorm=intarr(1)
    2855                 :          43 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_wanrad',tread,'LEN')
    2856         [ -  + ]:          43 :    if(tread==1) dtset%dmft_wanrad=dprarr(1)
    2857                 :          43 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_x2my2d',tread,'INT')
    2858         [ -  + ]:          43 :    if(tread==1) dtset%dmft_x2my2d=intarr(1)
    2859                 :          43 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_yukawa_epsilon',tread,'DPR')
    2860         [ -  + ]:          43 :    if(tread==1) dtset%dmft_yukawa_epsilon=dprarr(1)
    2861                 :          43 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_yukawa_lambda',tread,'DPR')
    2862         [ -  + ]:          43 :    if(tread==1) dtset%dmft_yukawa_lambda=dprarr(1)
    2863                 :          43 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_yukawa_param',tread,'INT')
    2864         [ -  + ]:          43 :    if(tread==1) dtset%dmft_yukawa_param=intarr(1)
    2865                 :          43 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_tolfreq',tread,'DPR')
    2866         [ -  + ]:          43 :    if(tread==1) dtset%dmft_tolfreq=dprarr(1)
    2867                 :          43 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_tollc',tread,'DPR')
    2868         [ +  + ]:          43 :    if(tread==1) dtset%dmft_tollc=dprarr(1)
    2869                 :          43 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_charge_prec',tread,'DPR')
    2870         [ +  + ]:          43 :    if(tread==1) dtset%dmft_charge_prec=dprarr(1)
    2871                 :          43 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmftbandi',tread,'INT')
    2872         [ +  - ]:          43 :    if(tread==1) dtset%dmftbandi=intarr(1)
    2873                 :          43 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmftbandf',tread,'INT')
    2874         [ +  - ]:          43 :    if(tread==1) dtset%dmftbandf=intarr(1)
    2875                 :             :    if(((dtset%dmftbandf-dtset%dmftbandi+1)<2*maxval(dtset%lpawu(:))+1.and.&
    2876   [ +  +  +  +  :         111 :     &  (dtset%dmft_t2g==0).and.(dtset%dmft_x2my2d==0)).or.&
          -  +  -  -  -  
                +  -  - ]
    2877                 :             :     &  ((dtset%dmftbandf-dtset%dmftbandi+1)<3.and.dtset%dmft_t2g==1)) then
    2878                 :             :      write(msg, '(4a,i2,2a)' )&
    2879                 :           0 :      '   dmftbandf-dmftbandi+1<2*max(lpawu(:))+1',ch10, &
    2880                 :           0 :      '   Number of bands to construct Wannier functions is not', &
    2881         [ #  # ]:           0 :      ' sufficient to build Wannier functions for l=',maxval(dtset%lpawu(:)),ch10, &
    2882                 :           0 :      '   Action: select a correct number of KS bands with dmftbandi and dmftbandf.'
    2883                 :           0 :      ABI_ERROR(msg)
    2884                 :             :    end if
    2885                 :             : 
    2886                 :          43 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmftcheck',tread,'INT')
    2887         [ +  + ]:          43 :    if(tread==1) dtset%dmftcheck=intarr(1)
    2888                 :          43 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_entropy',tread,'INT')
    2889         [ +  + ]:          43 :    if(tread==1) dtset%dmft_entropy=intarr(1)
    2890                 :          43 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_nlambda',tread,'INT')
    2891         [ +  + ]:          43 :    if(tread==1) dtset%dmft_nlambda=intarr(1)
    2892                 :             : 
    2893   [ +  +  +  - ]:          43 :    if(dtset%dmft_solv>=5.and.dtset%dmft_solv/=6.and.dtset%dmft_solv/=7) then
    2894                 :             : 
    2895                 :          26 :      call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmftqmc_n',tread,'DPR')
    2896         [ +  - ]:          26 :      if(tread==1) dtset%dmftqmc_n=dprarr(1)
    2897                 :          26 :      call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmftqmc_l',tread,'INT')
    2898         [ +  - ]:          26 :      if(tread==1) dtset%dmftqmc_l=intarr(1)
    2899                 :          26 :      call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmftqmc_seed',tread,'INT')
    2900         [ +  + ]:          26 :      if(tread==1) dtset%dmftqmc_seed=intarr(1)
    2901                 :          26 :      call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmftqmc_therm',tread,'INT')
    2902         [ +  - ]:          26 :      if(tread==1) dtset%dmftqmc_therm=intarr(1)
    2903         [ +  - ]:          26 :      if(dtset%dmft_solv>=5.and.dtset%dmft_solv<=10) then
    2904                 :          26 :        call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmftctqmc_check',tread,'INT')
    2905         [ +  + ]:          26 :        if(tread==1) dtset%dmftctqmc_check  =intarr(1)
    2906                 :          26 :        call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmftctqmc_correl',tread,'INT')
    2907         [ +  + ]:          26 :        if(tread==1) dtset%dmftctqmc_correl =intarr(1)
    2908                 :          26 :        call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmftctqmc_gmove',tread,'INT')
    2909         [ +  - ]:          26 :        if(tread==1) dtset%dmftctqmc_gmove  =intarr(1)
    2910                 :          26 :        call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmftctqmc_grnns',tread,'INT')
    2911         [ +  + ]:          26 :        if(tread==1) dtset%dmftctqmc_grnns  =intarr(1)
    2912                 :          26 :        call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmftctqmc_localprop',tread,'INT')
    2913         [ +  + ]:          26 :        if(tread==1) dtset%dmftctqmc_localprop  =intarr(1)
    2914                 :          26 :        call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmftctqmc_meas',tread,'INT')
    2915         [ +  + ]:          26 :        if(tread==1) dtset%dmftctqmc_meas   =intarr(1)
    2916                 :          26 :        call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmftctqmc_mrka',tread,'INT')
    2917         [ +  + ]:          26 :        if(tread==1) dtset%dmftctqmc_mrka   =intarr(1)
    2918                 :          26 :        call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmftctqmc_mov',tread,'INT')
    2919         [ +  + ]:          26 :        if(tread==1) dtset%dmftctqmc_mov    =intarr(1)
    2920                 :          26 :        call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmftctqmc_chains',tread,'INT')
    2921         [ +  - ]:          26 :        if(tread==1) dtset%dmftctqmc_chains=intarr(1)
    2922                 :          26 :        call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmftctqmc_order',tread,'INT')
    2923         [ +  + ]:          26 :        if(tread==1) dtset%dmftctqmc_order  =intarr(1)
    2924                 :          26 :        call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmftctqmc_basis',tread,'INT')
    2925         [ +  + ]:          26 :        if(tread==1) dtset%dmftctqmc_basis  =intarr(1)
    2926                 :             :      end if
    2927         [ -  + ]:          17 :    elseif(dtset%dmft_solv>=6.and.dtset%dmft_solv<=7) then
    2928                 :           0 :      call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_triqs_off_diag',tread,'INT')
    2929         [ #  # ]:           0 :      if(tread==1) dtset%dmft_triqs_off_diag=intarr(1)
    2930         [ #  # ]:           0 :      if (dtset%dmft_triqs_off_diag==1) then
    2931                 :           0 :        dtset%dmft_triqs_measure_density_matrix = 0
    2932                 :           0 :        dtset%dmft_triqs_time_invariance = 0
    2933                 :           0 :        dtset%dmft_triqs_move_double = 1
    2934                 :             :      end if
    2935                 :             : 
    2936                 :           0 :      call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_triqs_basis',tread,'INT')
    2937         [ #  # ]:           0 :      if(tread==1) dtset%dmft_triqs_basis=intarr(1)
    2938                 :           0 :      call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_triqs_chiloc',tread,'INT')
    2939         [ #  # ]:           0 :      if(tread==1) dtset%dmft_triqs_chiloc  =intarr(1)
    2940                 :           0 :      call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_triqs_chiloc_ins',tread,'INT')
    2941         [ #  # ]:           0 :      if(tread==1) dtset%dmft_triqs_chiloc_ins =intarr(1)
    2942                 :           0 :      call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_triqs_compute_integral',tread,'INT')
    2943         [ #  # ]:           0 :      if(tread==1) dtset%dmft_triqs_compute_integral=intarr(1)
    2944                 :           0 :      call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_triqs_det_init_size',tread,'INT')
    2945         [ #  # ]:           0 :      if(tread==1) dtset%dmft_triqs_det_init_size=intarr(1)
    2946                 :           0 :      call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_triqs_det_n_operations_before_check',tread,'INT')
    2947         [ #  # ]:           0 :      if(tread==1) dtset%dmft_triqs_det_n_operations_before_check=intarr(1)
    2948                 :           0 :      call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_triqs_det_precision_error',tread,'DPR')
    2949         [ #  # ]:           0 :      if(tread==1) dtset%dmft_triqs_det_precision_error=dprarr(1)
    2950                 :           0 :      call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_triqs_det_precision_warning',tread,'DPR')
    2951         [ #  # ]:           0 :      if(tread==1) dtset%dmft_triqs_det_precision_warning=dprarr(1)
    2952                 :           0 :      call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_triqs_det_singular_threshold',tread,'DPR')
    2953         [ #  # ]:           0 :      if(tread==1) dtset%dmft_triqs_det_singular_threshold=dprarr(1)
    2954                 :           0 :      call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_triqs_dlr_epsilon',tread,'DPR')
    2955         [ #  # ]:           0 :      if(tread==1) dtset%dmft_triqs_dlr_epsilon=dprarr(1)
    2956                 :           0 :      call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_triqs_dlr_wmax',tread,'ENE')
    2957         [ #  # ]:           0 :      if(tread==1) dtset%dmft_triqs_dlr_wmax=dprarr(1)
    2958                 :           0 :      call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_triqs_entropy',tread,'INT')
    2959         [ #  # ]:           0 :      if(tread==1) dtset%dmft_triqs_entropy=intarr(1)
    2960                 :           0 :      call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_triqs_gaussorder',tread,'INT')
    2961         [ #  # ]:           0 :      if(tread==1) dtset%dmft_triqs_gaussorder=intarr(1)
    2962                 :           0 :      call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_triqs_imag_threshold',tread,'DPR')
    2963         [ #  # ]:           0 :      if(tread==1) dtset%dmft_triqs_imag_threshold=dprarr(1)
    2964                 :           0 :      call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_triqs_length_cycle',tread,'INT')
    2965         [ #  # ]:           0 :      if(tread==1) dtset%dmft_triqs_length_cycle=intarr(1)
    2966                 :           0 :      call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_triqs_loc_n_min',tread,'INT')
    2967         [ #  # ]:           0 :      if(tread==1) dtset%dmft_triqs_loc_n_min=intarr(1)
    2968                 :           0 :      call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_triqs_loc_n_max',tread,'INT')
    2969         [ #  # ]:           0 :      if(tread==1) dtset%dmft_triqs_loc_n_max=intarr(1)
    2970                 :           0 :      call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_triqs_measure_density_matrix',tread,'INT')
    2971         [ #  # ]:           0 :      if(tread==1) dtset%dmft_triqs_measure_density_matrix=intarr(1)
    2972         [ #  # ]:           0 :      if(dtset%dmft_triqs_measure_density_matrix==0) then
    2973                 :           0 :        dtset%dmft_triqs_time_invariance=0
    2974                 :           0 :        dtset%dmft_triqs_use_norm_as_weight=0
    2975                 :             :      end if
    2976                 :           0 :      call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_triqs_measure_g_l',tread,'INT')
    2977         [ #  # ]:           0 :      if(tread==1) dtset%dmft_triqs_measure_g_l=intarr(1)
    2978                 :           0 :      call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_triqs_move_double',tread,'INT')
    2979         [ #  # ]:           0 :      if(tread==1) dtset%dmft_triqs_move_double=intarr(1)
    2980                 :           0 :      call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_triqs_move_shift',tread,'INT')
    2981         [ #  # ]:           0 :      if(tread==1) dtset%dmft_triqs_move_shift=intarr(1)
    2982                 :           0 :      call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_triqs_n_cycles',tread,'INT')
    2983         [ #  # ]:           0 :      if(tread==1) dtset%dmft_triqs_n_cycles=intarr(1)
    2984                 :           0 :      call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_triqs_n_iw',tread,'INT')
    2985         [ #  # ]:           0 :      if(tread==1) dtset%dmft_triqs_n_iw=intarr(1)
    2986                 :           0 :      call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_triqs_n_l',tread,'INT')
    2987         [ #  # ]:           0 :      if(tread==1) dtset%dmft_triqs_n_l=intarr(1)
    2988                 :           0 :      call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_triqs_n_tau',tread,'INT')
    2989         [ #  # ]:           0 :      if(tread==1) dtset%dmft_triqs_n_tau=intarr(1)
    2990                 :           0 :      call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_triqs_n_warmup_cycles_init',tread,'INT')
    2991         [ #  # ]:           0 :      if(tread==1) dtset%dmft_triqs_n_warmup_cycles_init=intarr(1)
    2992                 :           0 :      call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_triqs_n_warmup_cycles_restart',tread,'INT')
    2993         [ #  # ]:           0 :      if(tread==1) dtset%dmft_triqs_n_warmup_cycles_restart=intarr(1)
    2994                 :           0 :      call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_triqs_nsubdivisions',tread,'INT')
    2995         [ #  # ]:           0 :      if(tread==1) dtset%dmft_triqs_nsubdivisions=intarr(1)
    2996                 :           0 :      call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_triqs_pauli_prob',tread,'DPR')
    2997         [ #  # ]:           0 :      if(tread==1) dtset%dmft_triqs_pauli_prob=dprarr(1)
    2998                 :           0 :      call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_triqs_prt_entropy',tread,'INT')
    2999         [ #  # ]:           0 :      if(tread==1) dtset%dmft_triqs_prt_entropy=intarr(1)
    3000                 :           0 :      call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_triqs_random_seed_a',tread,'INT')
    3001         [ #  # ]:           0 :      if(tread==1) dtset%dmft_triqs_random_seed_a=intarr(1)
    3002                 :           0 :      call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_triqs_random_seed_b',tread,'INT')
    3003         [ #  # ]:           0 :      if(tread==1) dtset%dmft_triqs_random_seed_b=intarr(1)
    3004                 :           0 :      call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_triqs_read_ctqmcdata',tread,'INT')
    3005         [ #  # ]:           0 :      if(tread==1) dtset%dmft_triqs_read_ctqmcdata=intarr(1)
    3006                 :           0 :      call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_triqs_shift_mu',tread,'ENE')
    3007         [ #  # ]:           0 :      if(tread==1) dtset%dmft_triqs_shift_mu=dprarr(1)
    3008                 :           0 :      call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_triqs_time_invariance',tread,'INT')
    3009         [ #  # ]:           0 :      if(tread==1) dtset%dmft_triqs_time_invariance=intarr(1)
    3010                 :           0 :      call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_triqs_tol_block',tread,'DPR')
    3011         [ #  # ]:           0 :      if(tread==1) dtset%dmft_triqs_tol_block=dprarr(1)
    3012                 :           0 :      call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_triqs_use_norm_as_weight',tread,'INT')
    3013         [ #  # ]:           0 :      if(tread==1) dtset%dmft_triqs_use_norm_as_weight=intarr(1)
    3014                 :             :    end if
    3015         [ -  + ]:        6967 :  elseif (dtset%usedmft==10) then
    3016                 :           0 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmftbandi',tread,'INT')
    3017         [ #  # ]:           0 :    if(tread==1) dtset%dmftbandi=intarr(1)
    3018                 :           0 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmftbandf',tread,'INT')
    3019         [ #  # ]:           0 :    if(tread==1) dtset%dmftbandf=intarr(1)
    3020                 :             :  end if
    3021                 :             : 
    3022   [ +  +  -  + ]:        7010 :  if (dtset%usepawu/=0.or.(dtset%usedmft>0.and.dtset%usedmft/=10)) then
    3023                 :         155 :    call intagm(dprarr,intarr,jdtset,marr,ntypat,string(1:lenstr),'f4of2_sla',tread,'ENE')
    3024   [ +  +  +  + ]:         157 :    if(tread==1) dtset%f4of2_sla(1:ntypat)=dprarr(1:ntypat)
    3025                 :         155 :    call intagm(dprarr,intarr,jdtset,marr,ntypat,string(1:lenstr),'f6of2_sla',tread,'ENE')
    3026   [ +  +  +  + ]:         157 :    if(tread==1) dtset%f6of2_sla(1:ntypat)=dprarr(1:ntypat)
    3027                 :             :  end if
    3028   [ +  +  -  + ]:        7010 :  if (dtset%usepawu>0.or.(dtset%usedmft>0.and.dtset%usedmft/=10)) then
    3029                 :         144 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmatpuopt',tread,'INT')
    3030         [ +  + ]:         144 :    if(tread==1) dtset%dmatpuopt=intarr(1)
    3031                 :         144 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmatudiag',tread,'INT')
    3032         [ +  + ]:         144 :    if(tread==1) dtset%dmatudiag=intarr(1)
    3033                 :             :  end if
    3034                 :             : 
    3035         [ +  + ]:        7010 :  if (dtset%macro_uj>0) then
    3036   [ -  +  +  +  :         160 :    dtset%pawujat=minval(pack((/ (ii,ii=1,dtset%natom) /) ,dtset%lpawu(dtset%typat(:))>0))
          +  -  +  +  +  
          -  +  +  +  -  
             +  +  +  + ]
    3037                 :          10 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'pawujat',tread,'INT')
    3038         [ +  - ]:          10 :    if(tread==1) dtset%pawujat=intarr(1)
    3039                 :             : 
    3040                 :          10 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'pawujrad',tread,'LEN')
    3041         [ +  + ]:          10 :    if(tread==1) dtset%pawujrad=dprarr(1)
    3042                 :             : 
    3043                 :          10 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'pawujv',tread,'ENE')
    3044         [ +  - ]:          10 :    if(tread==1) dtset%pawujv=dprarr(1)
    3045                 :             :  end if
    3046                 :             : 
    3047                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'pawfatbnd',tread,'INT')
    3048         [ +  + ]:        7010 :  if(tread==1) dtset%pawfatbnd=intarr(1)
    3049                 :             : 
    3050                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'bxctmindg',tread,'DPR')
    3051         [ +  + ]:        7010 :  if(tread==1) then
    3052                 :           1 :    dtset%bxctmindg=dprarr(1)
    3053   [ +  +  +  + ]:        7009 :  else if(usepaw==1.and.dtset%accuracy==0)then
    3054                 :        1204 :    dtset%bxctmindg=dtset%boxcutmin
    3055                 :             :  end if
    3056                 :             : 
    3057                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'usexcnhat',tread,'INT')
    3058         [ +  + ]:        7010 :  if(tread==1) dtset%usexcnhat_orig=intarr(1)
    3059                 :             : 
    3060                 :             :  ! gemm_nonlop (must read it before useylm)
    3061                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'use_gemm_nonlop',tread,'INT')
    3062         [ +  + ]:        7010 :  if(tread==1) dtset%use_gemm_nonlop=intarr(1)
    3063                 :             : 
    3064                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'chebfi_oracle',tread,'INT')
    3065         [ +  + ]:        7010 :  if(tread==1) dtset%chebfi_oracle=intarr(1)
    3066                 :             : 
    3067         [ +  + ]:        7010 :  if (dtset%chebfi_oracle==2) then
    3068                 :          24 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'oracle_factor',tread,'DPR')
    3069         [ +  - ]:          24 :    if(tread==1) dtset%oracle_factor = dprarr(1)
    3070                 :             :  end if
    3071                 :             : 
    3072   [ +  +  +  + ]:        7010 :  if (dtset%chebfi_oracle>0.and.dtset%nbdbuf==-101) then
    3073                 :          14 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'oracle_min_occ',tread,'DPR')
    3074         [ +  - ]:          14 :    if(tread==1) dtset%oracle_min_occ = dprarr(1)
    3075                 :             :  end if
    3076                 :             : 
    3077                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'cprj_in_memory',tread,'INT')
    3078         [ +  + ]:        7010 :  if(tread==1) then
    3079                 :         338 :    dtset%cprj_in_memory=intarr(1)
    3080   [ +  +  +  - ]:        6672 :  else if (dtset%wfoptalg==111.and.dtset%gpu_option==ABI_GPU_DISABLED) then
    3081                 :           1 :     dtset%cprj_in_memory=1 ! cprj_in_memory set to 1 by default if chebfi2 and CPU
    3082                 :             :  end if
    3083   [ +  +  -  + ]:        7010 :  if (dtset%cprj_in_memory/=0.and.dtset%optdriver/=RUNL_GSTATE) then
    3084                 :           0 :    dtset%cprj_in_memory=0
    3085                 :             :    write(msg,'(a)') 'cprj_in_memory/=0 is implemented only for ground state (optdriver=0).&
    3086                 :           0 :      & cprj_in_memory is set to 0 for this dataset.'
    3087                 :           0 :    ABI_WARNING(msg)
    3088                 :             :  end if
    3089                 :             : 
    3090                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'cprj_update_lvl',tread,'INT')
    3091         [ -  + ]:        7010 :  if(tread==1) dtset%cprj_update_lvl=intarr(1)
    3092                 :             : 
    3093                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'xg_nonlop_option',tread,'INT')
    3094         [ +  + ]:        7010 :  if(tread==1) dtset%xg_nonlop_option=intarr(1)
    3095                 :             : 
    3096                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'useylm',tread,'INT')
    3097         [ +  + ]:        7010 :  if(tread==1) dtset%useylm=intarr(1)
    3098                 :             : 
    3099                 :             :  ! Here we set useylm automatically to 1
    3100         [ +  + ]:        7010 :  if (dtset%use_gemm_nonlop == 1) dtset%useylm = 1
    3101         [ +  + ]:        7010 :  if (usepaw==1) dtset%useylm=1
    3102   [ +  +  -  + ]:        7010 :  if (usepaw==1 .and. dtset%usewvl==1) dtset%useylm=0
    3103   [ +  +  +  + ]:        7010 :  if (dtset%efmas==1 .or. dtset%rf2_dkdk/=0 .or. dtset%rf2_dkde/=0) dtset%useylm=1
    3104   [ -  +  -  - ]:        7010 :  if (dtset%gpu_option /= ABI_GPU_DISABLED .and. dtset%optdriver /= RUNL_GWR) dtset%useylm=1
    3105   [ +  +  +  - ]:        7010 :  if(dtset%tfkinfunc==2 .and. dtset%usewvl==0 ) then
    3106                 :           6 :    dtset%useylm=1
    3107                 :           6 :    dtset%userec=1
    3108                 :             :  end if
    3109         [ +  + ]:        7010 :  if (dtset%cprj_in_memory/=0) dtset%useylm=1
    3110                 :             : 
    3111                 :        7010 :  ionmov=dtset%ionmov ; densfor_pred=dtset%densfor_pred ; iscf=dtset%iscf ; nqpt=dtset%nqpt
    3112                 :        7010 :  kptopt=dtset%kptopt; nberry=dtset%nberry ; berryopt=dtset%berryopt
    3113                 :             : 
    3114                 :             :  ! Dielectric real(dp) input variables
    3115                 :             :  ! Reading of diemix/diemixmag must be inserted after iprcel
    3116                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'diecut',tread,'ENE')
    3117         [ +  + ]:        7010 :  if(tread==1) dtset%diecut=dprarr(1)
    3118                 :             :  ! Special treatment if iscf==-1
    3119         [ +  + ]:        7010 :  if(iscf==-1) dtset%diecut=four*dtset%ecut
    3120                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dielng',tread,'LEN')
    3121         [ +  + ]:        7010 :  if(tread==1) dtset%dielng=dprarr(1)
    3122                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'diemac',tread,'DPR')
    3123         [ +  + ]:        7010 :  if(tread==1) dtset%diemac=dprarr(1)
    3124                 :             : 
    3125                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'diemix',tread,'DPR')
    3126         [ +  + ]:        7010 :  if(tread==1) then
    3127                 :         916 :    dtset%diemix=dprarr(1)
    3128                 :             :  else
    3129         [ +  + ]:        6094 :    if (mod(dtset%iprcel,100)>19) dtset%diemix=one
    3130                 :             :  end if
    3131                 :             : 
    3132                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'diemixmag',tread,'DPR')
    3133         [ +  + ]:        7010 :  if(tread==1) then
    3134                 :          20 :    dtset%diemixmag=dprarr(1)
    3135                 :             :  else
    3136   [ +  +  +  +  :        6990 :    if (dtset%iscf<10.or.dtset%nspden==1.or.dtset%iprcel==0.or.(dtset%iprcel>70.and.dtset%iprcel<80)) then
             +  +  -  + ]
    3137                 :        6988 :      dtset%diemixmag=dtset%diemix
    3138                 :             :    else
    3139                 :           2 :      dtset%diemixmag=-dtset%diemix
    3140                 :             :    end if
    3141                 :             :  end if
    3142                 :             : 
    3143                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'diegap',tread,'ENE')
    3144         [ +  + ]:        7010 :  if(tread==1) dtset%diegap=dprarr(1)
    3145                 :             : 
    3146                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dielam',tread,'DPR')
    3147         [ +  + ]:        7010 :  if(tread==1) dtset%dielam=dprarr(1)
    3148                 :             : 
    3149                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'maxestep',tread,'DPR')
    3150         [ -  + ]:        7010 :  if(tread==1) dtset%maxestep=dprarr(1)
    3151                 :             : 
    3152                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'td_maxene',tread,'DPR')
    3153         [ +  + ]:        7010 :  if(tread==1) dtset%td_maxene=dprarr(1)
    3154                 :             : 
    3155   [ +  +  +  + ]:        7010 :  if((iscf==5.or.iscf==6) .and. ionmov==4 .and. densfor_pred/=3 )then
    3156                 :           1 :    densfor_pred=3
    3157                 :           1 :    dtset%densfor_pred=densfor_pred
    3158                 :             :    write(msg, '(3a)' )&
    3159                 :           1 :    'When ionmov is [4, 5, 6], densfor_pred must be 3.',ch10,&
    3160                 :           2 :    'Set densfor_pred to 3.'
    3161                 :           1 :    ABI_COMMENT(msg)
    3162                 :             :  end if
    3163                 :             : 
    3164                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'mffmem',tread,'INT')
    3165         [ -  + ]:        7010 :  if(tread==1) dtset%mffmem=intarr(1)
    3166                 :             : 
    3167                 :             :  ! Set default values of 0 for occupation numbers and k pt wts
    3168                 :        7010 :  bantot = 0
    3169                 :             :  ! nkpt and nband must be defined to execute following loop
    3170         [ +  + ]:        7010 :  if ( tnband == 1 ) then
    3171         [ +  + ]:      115784 :    do ikpt=1,nkpt*nsppol
    3172         [ +  + ]:      987963 :      do ii=1,dtset%nband(ikpt)
    3173                 :      872179 :        bantot=bantot+1
    3174         [ +  + ]:     1860170 :        dtset%occ_orig(bantot,:)=zero
    3175                 :             :      end do
    3176                 :             :    end do
    3177                 :             :  end if
    3178                 :             : 
    3179                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'nloc_alg',tread,'INT')
    3180         [ +  + ]:        7010 :  if(tread==1) dtset%nloalg(1)=intarr(1)
    3181                 :             : 
    3182                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'nloc_mem',tread,'INT')
    3183         [ +  + ]:        7010 :  if(tread==1) then
    3184         [ -  + ]:           4 :    dtset%nloalg(2)=1 ; if(intarr(1)<0)dtset%nloalg(2)=-1
    3185                 :           4 :    dtset%nloalg(3)=abs(intarr(1))-1
    3186                 :             :  end if
    3187                 :             : 
    3188                 :             :  ! LOOP variables
    3189                 :             : 
    3190                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'mdeg_filter',tread_alt,'INT')
    3191         [ +  + ]:        7010 :  if(tread_alt==1) dtset%mdeg_filter=intarr(1)
    3192                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'nline',tread,'INT')
    3193         [ +  + ]:        7010 :  if (tread==1) dtset%nline=intarr(1)
    3194   [ +  +  +  + ]:        7010 :  if (tread_alt/=1.and.tread==1) dtset%mdeg_filter = dtset%nline
    3195         [ +  + ]:        7010 :  if (mod(dtset%wfoptalg,10) == 1) then
    3196                 :             : !  For Chebyshev filtering algo, nline is the degree of the Chebyshev polynomial (but is obsolete)
    3197   [ +  +  +  + ]:         216 :    if (tread_alt==1.and.tread/=1) dtset%nline = dtset%mdeg_filter
    3198                 :             :  end if
    3199                 :             : 
    3200                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'nslice',tread,'INT')
    3201         [ +  + ]:        7010 :  if(tread==1) dtset%nslice=intarr(1)
    3202                 :             : 
    3203                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'nblock_lobpcg',tread,'INT')
    3204         [ +  + ]:        7010 :  if(tread==1) dtset%nblock_lobpcg=intarr(1)
    3205                 :             : 
    3206                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'nnsclo',tread,'INT')
    3207         [ +  + ]:        7010 :  if(tread==1) dtset%nnsclo=intarr(1)
    3208                 :             : 
    3209                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'nnsclohf',tread,'INT')
    3210         [ +  + ]:        7010 :  if(tread==1) dtset%nnsclohf=intarr(1)
    3211                 :             : 
    3212                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'nstep',tread,'INT')
    3213         [ +  + ]:        7010 :  if(tread==1) dtset%nstep=intarr(1)
    3214                 :             : 
    3215                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'nstep_mixed',tread,'INT')
    3216         [ +  + ]:        7010 :  if(tread==1) dtset%nstep_mixed=intarr(1)
    3217                 :             : 
    3218                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'ntime',tread,'INT')
    3219         [ +  + ]:        7010 :  if(tread==1) dtset%ntime=intarr(1)
    3220                 :             : 
    3221         [ +  + ]:        7010 :  if (tread == 0) then
    3222                 :             :    ! if ntime is not given but ionmov > 0 and imgmv is != 0, use a reasonable number of iterations!
    3223                 :        6500 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'ionmov',tread,'INT')
    3224   [ +  +  +  +  :        6500 :    if (tread == 1 .and. intarr(1) /= 0 .and. dtset%imgmov == 0) then
                   -  + ]
    3225                 :           0 :      dtset%ntime = 1000
    3226                 :           0 :      ABI_COMMENT("Found ionmov /= 0 without ntime in the input. ntime has been set automatically to 1000")
    3227                 :             :    end if
    3228                 :             :  end if
    3229                 :             : 
    3230         [ -  + ]:        7010 :  if (ionmov == 28) then
    3231                 :             :    ! i-pi driver mode: check whether initial geometry from server agrees with input file")
    3232                 :             :    !dtset%ntime = 10000
    3233                 :           0 :    image = 1
    3234                 :           0 :    call ipi_check_initial_consistency(natom, dtset%rprimd_orig(:,:,image), dtset%xred_orig(:,:,image), ierr)
    3235         [ #  # ]:           0 :    ABI_CHECK(ierr == 0, "Initial structure sent by i-pi server does not match the one read from file! See messages above")
    3236                 :             :  end if
    3237                 :             : 
    3238                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'nctime',tread,'INT')
    3239         [ +  + ]:        7010 :  if(tread==1) dtset%nctime=intarr(1)
    3240                 :             : 
    3241                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'nucefg',tread,'INT')
    3242         [ +  + ]:        7010 :  if(tread==1) dtset%nucefg=intarr(1)
    3243                 :             : 
    3244                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'nucfc',tread,'INT')
    3245         [ +  + ]:        7010 :  if(tread==1) dtset%nucfc=intarr(1)
    3246                 :             : 
    3247                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'orbmag',tread,'INT')
    3248         [ +  + ]:        7010 :  if(tread==1) dtset%orbmag=intarr(1)
    3249                 :             : 
    3250                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prt_lorbmag',tread,'INT')
    3251         [ +  + ]:        7010 :  if(tread==1) dtset%prt_lorbmag=intarr(1)
    3252                 :             : 
    3253                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'ortalg',tread,'INT')
    3254         [ +  + ]:        7010 :  if(tread==1) then
    3255                 :          17 :    dtset%ortalg=intarr(1)
    3256   [ +  +  +  + ]:        6993 :  else if (dtset%wfoptalg>=10 .and. dtset%ortalg>0) then
    3257                 :         181 :    dtset%ortalg=-dtset%ortalg
    3258                 :             :  end if
    3259                 :             : 
    3260                 :             :  ! Print variables
    3261                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,natom,string(1:lenstr),'prtatlist',tread,'INT')
    3262         [ +  + ]:        7010 :  if(tread==1) then
    3263   [ +  -  -  +  :         102 :    dtset%prtatlist=intarr(1:natom)
             -  -  +  + ]
    3264                 :           3 :    call sort_int(natom,dtset%prtatlist,intarr)
    3265                 :             :  end if
    3266                 :             : 
    3267                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prtbbb',tread,'INT')
    3268         [ +  + ]:        7010 :  if(tread==1) dtset%prtbbb=intarr(1)
    3269                 :             : 
    3270                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prtbltztrp',tread,'INT')
    3271         [ +  + ]:        7010 :  if(tread==1) dtset%prtbltztrp=intarr(1)
    3272                 :             : 
    3273                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prtcif',tread,'INT')
    3274         [ +  + ]:        7010 :  if(tread==1) dtset%prtcif=intarr(1)
    3275                 :             : 
    3276                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prtcurrent',tread,'INT')
    3277         [ +  + ]:        7010 :  if(tread==1) dtset%prtcurrent=intarr(1)
    3278                 :             : 
    3279                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prtden',tread,'INT')
    3280         [ +  + ]:        7010 :  if(tread==1) dtset%prtden=intarr(1)
    3281                 :             : 
    3282                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prtdipole',tread,'INT')
    3283         [ +  + ]:        7010 :  if(tread==1) dtset%prtdipole=intarr(1)
    3284                 :             : 
    3285                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prtevk',tread,'INT')
    3286         [ +  + ]:        7010 :  if(tread==1) dtset%prtevk=intarr(1)
    3287                 :             : 
    3288                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prtdos',tread,'INT')
    3289         [ +  + ]:        7010 :  if(tread==1) dtset%prtdos=intarr(1)
    3290                 :             : 
    3291                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prtdosm',tread,'INT')
    3292         [ +  + ]:        7010 :  if(tread==1) dtset%prtdosm=intarr(1)
    3293                 :             : 
    3294                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prtebands',tread,'INT')
    3295         [ +  + ]:        7010 :  if(tread==1) dtset%prtebands=intarr(1)
    3296                 :             : 
    3297                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prtefmas',tread,'INT')
    3298         [ +  + ]:        7010 :  if(tread==1) dtset%prtefmas=intarr(1)
    3299                 :             : 
    3300                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prteig',tread,'INT')
    3301         [ +  + ]:        7010 :  if(tread==1) dtset%prteig=intarr(1)
    3302                 :             : 
    3303                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prtelf',tread,'INT')
    3304         [ +  + ]:        7010 :  if(tread==1) dtset%prtelf=intarr(1)
    3305                 :             : 
    3306                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prteliash',tread,'INT')
    3307         [ +  + ]:        7010 :  if(tread==1) dtset%prteliash=intarr(1)
    3308                 :             : 
    3309                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prtfull1wf',tread,'INT')
    3310         [ +  + ]:        7010 :  if(tread==1) dtset%prtfull1wf=intarr(1)
    3311                 :             : 
    3312                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prtfsurf',tread,'INT')
    3313         [ +  + ]:        7010 :  if(tread==1) dtset%prtfsurf=intarr(1)
    3314                 :             : 
    3315                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prtgsr',tread,'INT')
    3316         [ +  + ]:        7010 :  if(tread==1) dtset%prtgsr=intarr(1)
    3317                 :             : 
    3318                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prtgden',tread,'INT')
    3319         [ +  + ]:        7010 :  if(tread==1) dtset%prtgden=intarr(1)
    3320                 :             : 
    3321                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prtgeo',tread,'INT')
    3322         [ +  + ]:        7010 :  if(tread==1) dtset%prtgeo=intarr(1)
    3323                 :             : 
    3324                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prtgkk',tread,'INT')
    3325         [ +  + ]:        7010 :  if(tread==1) dtset%prtgkk=intarr(1)
    3326                 :             : 
    3327                 :             :  ! Read usekden and set prtkden to 1 by default.
    3328                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'usekden',tread,'INT')
    3329         [ +  + ]:        7010 :  if(tread==1) then
    3330                 :          44 :    dtset%usekden=intarr(1)
    3331                 :             :  else
    3332         [ +  + ]:       13900 :    dtset%usekden=merge(1,0,xc_need_kden)
    3333                 :             :  end if
    3334   [ +  +  +  - ]:        7010 :  if (dtset%usekden == 1 .and. dtset%nimage == 1) dtset%prtkden = 1
    3335                 :             : 
    3336                 :             : ! Some variables need usekden before being red
    3337         [ +  + ]:        7010 : if (dtset%usekden==1) then
    3338                 :          76 :    dtset%getkden=dtset%getden
    3339                 :          76 :    dtset%irdkden=dtset%irdden
    3340                 :          76 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'getkden',tread,'INT')
    3341         [ +  + ]:          76 :    if(tread==1) dtset%getkden=intarr(1)
    3342                 :          76 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'irdkden',tread,'INT')
    3343         [ +  + ]:          76 :    if(tread==1) dtset%irdkden=intarr(1)
    3344                 :             :  end if
    3345                 :             : 
    3346                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prtkden',tread,'INT')
    3347         [ +  + ]:        7010 :  if(tread==1) dtset%prtkden=intarr(1)
    3348                 :             : 
    3349                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prtlden',tread,'INT')
    3350         [ +  + ]:        7010 :  if(tread==1) dtset%prtlden=intarr(1)
    3351                 :             : 
    3352                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prtnabla',tread,'INT')
    3353         [ +  + ]:        7010 :  if(tread==1) dtset%prtnabla=intarr(1)
    3354                 :             : 
    3355                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prtnest',tread,'INT')
    3356         [ +  + ]:        7010 :  if(tread==1) dtset%prtnest=intarr(1)
    3357                 :             : 
    3358                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prtocc',tread,'INT')
    3359         [ -  + ]:        7010 :  if(tread==1) dtset%prtocc=intarr(1)
    3360                 :             : 
    3361                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prtphbands',tread,'INT')
    3362         [ +  + ]:        7010 :  if(tread==1) dtset%prtphbands=intarr(1)
    3363                 :             : 
    3364                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prtphdos',tread,'INT')
    3365         [ +  + ]:        7010 :  if(tread==1) dtset%prtphdos=intarr(1)
    3366                 :             : 
    3367                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prtphsurf',tread,'INT')
    3368         [ +  + ]:        7010 :  if(tread==1) dtset%prtphsurf=intarr(1)
    3369                 :             : 
    3370                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prtposcar',tread,'INT')
    3371         [ +  + ]:        7010 :  if(tread==1) dtset%prtposcar=intarr(1)
    3372                 :             : 
    3373                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prtprocar',tread,'INT')
    3374         [ +  + ]:        7010 :  if(tread==1) dtset%prtprocar=intarr(1)
    3375                 :             : 
    3376                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prtpot',tread,'INT')
    3377         [ +  + ]:        7010 :  if (dtset%optdriver == RUNL_RESPFN) dtset%prtpot = 1
    3378         [ +  + ]:        7010 :  if(tread==1) dtset%prtpot=intarr(1)
    3379                 :             : 
    3380                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prtpsps',tread,'INT')
    3381         [ +  + ]:        7010 :  if(tread==1) dtset%prtpsps=intarr(1)
    3382                 :             : 
    3383                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prtspcur',tread,'INT')
    3384         [ +  + ]:        7010 :  if(tread==1) dtset%prtspcur=intarr(1)
    3385                 :             : 
    3386                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prtsuscep',tread,'INT')
    3387         [ +  + ]:        7010 :  if(tread==1) dtset%prtsuscep=intarr(1)
    3388                 :             : 
    3389                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prtstm',tread,'INT')
    3390         [ +  + ]:        7010 :  if(tread==1) dtset%prtstm=intarr(1)
    3391                 :             : 
    3392                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prt1dm',tread,'INT')
    3393         [ +  + ]:        7010 :  if(tread==1) dtset%prt1dm=intarr(1)
    3394                 :             : 
    3395                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prtvclmb',tread,'INT')
    3396         [ +  + ]:        7010 :  if(tread==1) dtset%prtvclmb=intarr(1)
    3397                 :             : 
    3398                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prtvdw',tread,'INT')
    3399         [ -  + ]:        7010 :  if(tread==1) dtset%prtvdw=intarr(1)
    3400                 :             : 
    3401                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prtvha',tread,'INT')
    3402         [ +  + ]:        7010 :  if(tread==1) dtset%prtvha=intarr(1)
    3403                 :             : 
    3404                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prtvhxc',tread,'INT')
    3405         [ +  + ]:        7010 :  if(tread==1) dtset%prtvhxc=intarr(1)
    3406                 :             : 
    3407                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prtkbff',tread,'INT')
    3408         [ +  + ]:        7010 :  if(tread==1) dtset%prtkbff=intarr(1)
    3409                 :             : 
    3410                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prtvol',tread,'INT')
    3411         [ +  + ]:        7010 :  if(tread==1) dtset%prtvol=intarr(1)
    3412                 :             : 
    3413                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prtvolimg',tread,'INT')
    3414         [ +  + ]:        7010 :  if(tread==1) dtset%prtvolimg=intarr(1)
    3415                 :             : 
    3416                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prtvpsp',tread,'INT')
    3417         [ +  + ]:        7010 :  if(tread==1) dtset%prtvpsp=intarr(1)
    3418                 :             : 
    3419                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prtvxc',tread,'INT')
    3420         [ +  + ]:        7010 :  if(tread==1) dtset%prtvxc=intarr(1)
    3421                 :             : 
    3422                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prtwant',tread,'INT')
    3423         [ +  + ]:        7010 :  if(tread==1) dtset%prtwant=intarr(1)
    3424                 :             : 
    3425                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prtwf',tread,'INT')
    3426         [ +  + ]:        7010 :  if(tread==1) then
    3427                 :        1121 :    dtset%prtwf=intarr(1)
    3428         [ +  + ]:        5889 :  else if (dtset%tfkinfunc==2)then
    3429                 :           6 :    dtset%prtwf=0
    3430                 :             :  endif
    3431                 :             : 
    3432                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prtwf_full',tread,'INT')
    3433         [ +  + ]:        7010 :  if (tread==1) dtset%prtwf_full=intarr(1)
    3434                 :             : 
    3435                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prtxml',tread,'INT')
    3436         [ +  + ]:        7010 :  if(tread==1) dtset%prtxml=intarr(1)
    3437                 :             : 
    3438                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'ratsph_extra',tread,'DPR')
    3439         [ +  + ]:        7010 :  if(tread==1) dtset%ratsph_extra=dprarr(1)
    3440                 :             : 
    3441                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,3,string(1:lenstr),'qprtrb',tread,'INT')
    3442   [ +  +  +  + ]:        7034 :  if(tread==1) dtset%qprtrb(:)=intarr(1:3)
    3443                 :             : 
    3444                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'strprecon',tread,'DPR')
    3445         [ +  + ]:        7010 :  if(tread==1) dtset%strprecon=dprarr(1)
    3446                 :             : 
    3447                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'tim1rev',tread,'INT')
    3448         [ +  + ]:        7010 :  if (tread==1) dtset%tim1rev=intarr(1)
    3449                 :             : 
    3450                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'xc_denpos',tread,'DPR')
    3451         [ +  + ]:        7010 :  if(tread==1) dtset%xc_denpos=dprarr(1)
    3452                 :             : 
    3453                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'xc_taupos',tread,'DPR')
    3454         [ +  + ]:        7010 :  if(tread==1) then
    3455                 :           1 :    dtset%xc_taupos=dprarr(1)
    3456                 :             :  else
    3457                 :        7009 :    dtset%xc_taupos=dtset%xc_denpos
    3458                 :             :  end if
    3459                 :             : 
    3460                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'xc_tb09_c',tread,'DPR')
    3461         [ +  + ]:        7010 :  if(tread==1) dtset%xc_tb09_c=dprarr(1)
    3462                 :             : 
    3463                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,3*dtset%natsph_extra,string(1:lenstr),'xredsph_extra',tread,'DPR')
    3464   [ +  +  +  +  :        7061 :  if(tread==1) dtset%xredsph_extra=reshape(dprarr(1:3*dtset%natsph_extra), (/3,dtset%natsph_extra/))
          +  -  +  -  -  
          +  -  -  +  +  
                   +  + ]
    3465                 :             : 
    3466                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'wfinit',tread,'INT')
    3467         [ +  + ]:        7010 :  if(tread==1) dtset%wfinit=intarr(1)
    3468                 :             : 
    3469                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'wfmix',tread,'DPR')
    3470         [ +  + ]:        7010 :  if(tread==1) dtset%wfmix=dprarr(1)
    3471                 :             : 
    3472                 :             :  ! WVL - Wavelets related values
    3473                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'wvl_hgrid',tread,'DPR')
    3474         [ -  + ]:        7010 :  if(tread==1) dtset%wvl_hgrid=dprarr(1)
    3475                 :             : 
    3476                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'wvl_crmult',tread,'DPR')
    3477         [ -  + ]:        7010 :  if(tread==1) dtset%wvl_crmult=dprarr(1)
    3478                 :             : 
    3479                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'wvl_frmult',tread,'DPR')
    3480         [ -  + ]:        7010 :  if(tread==1) dtset%wvl_frmult=dprarr(1)
    3481                 :             : 
    3482                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,2,string(1:lenstr),'wvl_ngauss',tread,'INT')
    3483   [ -  +  -  - ]:        7010 :  if(tread==1) dtset%wvl_ngauss(1:2)=intarr(1:2)
    3484                 :             : 
    3485                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'wvl_nprccg',tread,'INT')
    3486         [ -  + ]:        7010 :  if(tread==1) dtset%wvl_nprccg=intarr(1)
    3487                 :             : 
    3488                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'tl_nprccg',tread,'INT')
    3489         [ -  + ]:        7010 :  if(tread==1) dtset%tl_nprccg=intarr(1)
    3490                 :             : 
    3491                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'tl_radius',tread,'DPR')
    3492         [ -  + ]:        7010 :  if(tread==1) dtset%tl_radius=dprarr(1)
    3493                 :             : 
    3494                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'eph_fix_korq',tread,'KEY', key_value=key_value)
    3495         [ +  + ]:        7010 :  if(tread==1) dtset%eph_fix_korq = key_value(1:1)
    3496                 :             : 
    3497                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'cwfs_wouth',tread,'INT')
    3498         [ -  + ]:        7010 :  if(tread==1) dtset%cwfs_wouth = intarr(1)
    3499                 :             : 
    3500                 :             :  ! RCPAW variables
    3501                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'use_rcpaw',tread,'INT')
    3502         [ +  + ]:        7010 :  if(tread==1) dtset%use_rcpaw = intarr(1)
    3503                 :             : 
    3504         [ +  + ]:        7010 :  if(dtset%use_rcpaw==1) then
    3505                 :           3 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'rcpaw_frocc',tread,'INT')
    3506         [ -  + ]:           3 :    if(tread==1) dtset%rcpaw_frocc = intarr(1)
    3507                 :             : 
    3508                 :           3 :    call intagm(dprarr,intarr,jdtset,marr,2,string(1:lenstr),'rcpaw_updatepaw',tread,'INT')
    3509   [ -  +  -  - ]:           3 :    if(tread==1) dtset%rcpaw_updatepaw(1:2) = intarr(1:2)
    3510                 :             : 
    3511                 :           3 :    dtset%rcpaw_updatetnc=dtset%nstep
    3512                 :           3 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'rcpaw_updatetnc',tread,'INT')
    3513         [ -  + ]:           3 :    if(tread==1) dtset%rcpaw_updatetnc = intarr(1)
    3514                 :             : 
    3515                 :           3 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'rcpaw_tolnc',tread,'DPR')
    3516         [ -  + ]:           3 :    if(tread==1) dtset%rcpaw_tolnc = dprarr(1)
    3517                 :             : 
    3518                 :           3 :    call intagm(dprarr,intarr,jdtset,marr,ntypat,string(1:lenstr),'rcpaw_rctypat',tread,'INT')
    3519   [ -  +  -  - ]:           3 :    if(tread==1) dtset%rcpaw_rctypat(1:ntypat) = intarr(1:ntypat)
    3520                 :             : 
    3521                 :           3 :    call intagm(dprarr,intarr,jdtset,marr,ntypat,string(1:lenstr),'rcpaw_sc',tread,'DPR')
    3522   [ -  +  -  - ]:           3 :    if(tread==1) dtset%rcpaw_sc(1:ntypat) = dprarr(1:ntypat)
    3523                 :             : 
    3524                 :           3 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'rcpaw_elin',tread,'INT')
    3525         [ -  + ]:           3 :    if(tread==1) dtset%rcpaw_elin = intarr(1)
    3526                 :             : 
    3527                 :           3 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'rcpaw_prtpaw',tread,'INT')
    3528         [ -  + ]:           3 :    if(tread==1) dtset%rcpaw_prtpaw = intarr(1)
    3529                 :             : 
    3530                 :           3 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'rcpaw_tpaw',tread,'INT')
    3531         [ -  + ]:           3 :    if(tread==1) dtset%rcpaw_tpaw = intarr(1)
    3532                 :             : 
    3533                 :           3 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'rcpaw_vhtnzc',tread,'INT')
    3534         [ -  + ]:           3 :    if(tread==1) dtset%rcpaw_vhtnzc = intarr(1)
    3535                 :             :  endif
    3536                 :             : 
    3537                 :             : ! Print variables
    3538                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'write_files',tread,'KEY', key_value=key_value)
    3539         [ +  + ]:        7010 :  if(tread==1) dtset%write_files = key_value
    3540         [ +  + ]:        7010 :  if(dtset%write_files=='default') then
    3541                 :             :   !!!EMPTY ON PURPOSE
    3542         [ -  + ]:          67 :  else if(dtset%write_files=='all') then
    3543                 :           0 :    dtset%ncout      = 1 !Already the default but good to keep track
    3544                 :           0 :    dtset%prtddb     = 1
    3545                 :           0 :    dtset%prtden     = 1
    3546                 :             :    !dtset%prtdos     = 1
    3547                 :           0 :    dtset%prtebands  = 1 !DEFAULT in all set to xgr
    3548                 :           0 :    dtset%prteig     = 1
    3549                 :           0 :    dtset%prtelf     = 1 ! TO BE CHECKED FOR CONSISTENCY
    3550                 :           0 :    dtset%prtevk     = 1
    3551                 :             : #ifndef HAVE_NETCDF_MPI
    3552                 :             :    if (dtset%paral_rf==1) dtset%prtevk = 0
    3553                 :             : #endif
    3554                 :             :    !dtset%prtfsurf   = 1  ! TO BE CHECKED FOR CONSISTENCY
    3555                 :             :    !dtset%prtgden    = 1  ! TO BE CHECKED FOR CONSISTENCY
    3556                 :           0 :    dtset%prtgeo     = 1
    3557                 :           0 :    dtset%prtgkk     = 1
    3558                 :           0 :    dtset%prtgsr     = 1
    3559                 :           0 :    dtset%prthist    = 1
    3560                 :           0 :    dtset%prtkbff    = 1
    3561                 :             :    !dtset%prtkden    = 1  ! TO BE CHECKED FOR CONSISTENCY
    3562                 :           0 :    dtset%prtlden    = 1  ! TO BE CHECKED FOR CONSISTENCY
    3563                 :           0 :    dtset%prtpot     = 1
    3564                 :             :    !dtset%prtpsps    = 1  ! TO BE CHECKED FOR CONSISTENCY
    3565                 :             :    !dtset%prtstm     = 1  ! TO BE CHECKED FOR CONSISTENCY
    3566                 :           0 :    dtset%prtsuscep  = 1  ! TO BE CHECKED FOR CONSISTENCY
    3567                 :           0 :    dtset%prtvclmb   = 2  ! NC default
    3568                 :           0 :    dtset%prtvha     = 1
    3569                 :           0 :    dtset%prtvhxc    = 1
    3570                 :             :    dtset%prtvhxc    = 1
    3571                 :           0 :    dtset%prtvpsp    = 1  ! TO BE CHECKED FOR CONSISTENCY
    3572                 :           0 :    dtset%prtvxc     = 1
    3573                 :             :    !dtset%prtwant    = 1   ! TO BE CHECKED FOR CONSISTENCY
    3574                 :           0 :    dtset%prtwf      = 1
    3575                 :           0 :    dtset%prtxml     = 1
    3576         [ +  + ]:          67 :  else if(dtset%write_files=='none') then
    3577                 :          29 :    dtset%ncout      = 0
    3578                 :          29 :    dtset%prtddb     = 0
    3579                 :          29 :    dtset%prtden     = 0
    3580                 :          29 :    dtset%prtdos     = 0
    3581                 :          29 :    dtset%prtebands  = 0
    3582                 :          29 :    dtset%prteig     = 0
    3583                 :          29 :    dtset%prtelf     = 0
    3584                 :          29 :    dtset%prtevk     = 0
    3585                 :          29 :    dtset%prtfsurf   = 0
    3586                 :          29 :    dtset%prtgden    = 0
    3587                 :          29 :    dtset%prtgeo     = 0
    3588                 :          29 :    dtset%prtgkk     = 0
    3589                 :          29 :    dtset%prtgsr     = 0
    3590                 :          29 :    dtset%prthist    = 0
    3591                 :          29 :    dtset%prtkbff    = 0
    3592                 :          29 :    dtset%prtkden    = 0
    3593                 :          29 :    dtset%prtlden    = 0
    3594                 :          29 :    dtset%prtpot     = 0
    3595                 :          29 :    dtset%prtpsps    = 0
    3596                 :          29 :    dtset%prtstm     = 0
    3597                 :          29 :    dtset%prtsuscep  = 0
    3598                 :          29 :    dtset%prtvclmb   = 0
    3599                 :          29 :    dtset%prtvha     = 0
    3600                 :          29 :    dtset%prtvhxc    = 0
    3601                 :             :    dtset%prtvhxc    = 0
    3602                 :          29 :    dtset%prtvpsp    = 0
    3603                 :          29 :    dtset%prtvxc     = 0
    3604                 :          29 :    dtset%prtwant    = 0
    3605                 :          29 :    dtset%prtwf      = 0
    3606                 :          29 :    dtset%prtxml     = 0
    3607                 :             :  !!!PLEASE ADD IN ALPHABETICAL ORDER THE FUTURE OPTIONS BELOW!!!
    3608                 :             :  else if (dtset%write_files.ne.'none' .or. dtset%write_files.ne.'all' .or. dtset%write_files.ne.'default' ) then
    3609         [ +  + ]:          38 :    if (INDEX(dtset%write_files,'ddb') .gt. 0) then
    3610                 :           1 :       dtset%prtddb = 1
    3611                 :             :    else
    3612                 :          37 :       dtset%prtddb = 0
    3613                 :             :    end if
    3614         [ +  + ]:          38 :    if (INDEX(dtset%write_files,'den_1') .gt. 0) then
    3615                 :           1 :       dtset%prtden = 1
    3616         [ -  + ]:          37 :    else if (INDEX(dtset%write_files,'den_2') .gt. 0) then
    3617                 :           0 :       dtset%prtden = 2
    3618         [ -  + ]:          37 :    else if (INDEX(dtset%write_files,'den_3') .gt. 0) then
    3619                 :           0 :       dtset%prtden = 3
    3620         [ -  + ]:          37 :    else if (INDEX(dtset%write_files,'den_4') .gt. 0) then
    3621                 :           0 :       dtset%prtden = 4
    3622         [ -  + ]:          37 :    else if (INDEX(dtset%write_files,'den_5') .gt. 0) then
    3623                 :           0 :       dtset%prtden = 5
    3624         [ -  + ]:          37 :    else if (INDEX(dtset%write_files,'den_6') .gt. 0) then
    3625                 :           0 :       dtset%prtden = 6
    3626         [ -  + ]:          37 :    else if (INDEX(dtset%write_files,'den_7') .gt. 0) then
    3627                 :           0 :       dtset%prtden = 7
    3628                 :             :    else
    3629                 :          37 :       dtset%prtden = 0
    3630                 :             :    end if
    3631   [ +  +  +  - ]:          38 :    if ( (INDEX(dtset%write_files,'dos_1') .gt. 0) .AND. (dtset%occopt .ge. 3 .AND. dtset%occopt .le. 7 ) )then
    3632                 :           1 :       dtset%prtdos = 1
    3633   [ -  +  -  - ]:          37 :    else if ( (INDEX(dtset%write_files,'dos_1') .gt. 0) .AND. (dtset%iscf .eq. -3 ) )then
    3634                 :           0 :       dtset%prtdos = 1
    3635         [ +  + ]:          37 :    else if ( INDEX(dtset%write_files,'dos_2') .gt. 0 )then
    3636                 :           1 :       dtset%prtdos = 2
    3637         [ +  + ]:          36 :    else if ( INDEX(dtset%write_files,'dos_3') .gt. 0 )then
    3638                 :           2 :       dtset%prtdos = 3
    3639         [ +  + ]:          34 :    else if ( INDEX(dtset%write_files,'dos_4') .gt. 0 )then
    3640                 :           1 :       dtset%prtdos = 4
    3641   [ -  +  -  - ]:          33 :    else if ( (INDEX(dtset%write_files,'dos_5') .gt. 0 ) .AND. (dtset%nspinor .eq. 2 ) )then
    3642                 :           0 :       dtset%prtdos = 5
    3643                 :             :    else
    3644                 :          33 :       dtset%prtdos = 0
    3645                 :             :    end if
    3646   [ +  +  +  - ]:          38 :    if ( (INDEX(dtset%write_files,'dosm_1') .gt. 0) .AND. (dtset%prtdos .eq. 3 ) )then
    3647                 :           1 :       dtset%prtdosm = 1
    3648                 :           1 :       dtset%prtdos  = 3
    3649                 :             :    else
    3650                 :          37 :       dtset%prtdosm = 0
    3651                 :             :    end if
    3652         [ +  + ]:          38 :    if (INDEX(dtset%write_files,'ebands_1') .gt. 0) then
    3653                 :           1 :       dtset%prtebands = 1
    3654         [ +  + ]:          37 :    else if (INDEX(dtset%write_files,'ebands_2') .gt. 0) then
    3655                 :           1 :       dtset%prtebands = 2
    3656                 :             :    else
    3657                 :          36 :       dtset%prtebands = 0
    3658                 :             :    end if
    3659         [ +  + ]:          38 :    if (INDEX(dtset%write_files,'eig') .gt. 0) then
    3660                 :           2 :       dtset%prteig = 1
    3661                 :             :    else
    3662                 :          36 :       dtset%prteig = 0
    3663                 :             :    end if
    3664         [ +  + ]:          38 :    if (INDEX(dtset%write_files,'elf') .gt. 0) then
    3665                 :           1 :       dtset%prtelf = 1
    3666                 :             :    else
    3667                 :          37 :       dtset%prtelf = 0
    3668                 :             :    end if
    3669         [ -  + ]:          38 :    if (INDEX(dtset%write_files,'evk') .gt. 0) then
    3670                 :           0 :       dtset%prtevk = 1
    3671                 :             :    end if
    3672         [ -  + ]:          38 :    if (INDEX(dtset%write_files,'fsurf') .gt. 0) then
    3673                 :           0 :       dtset%prtfsurf = 1
    3674                 :             :    else
    3675                 :          38 :       dtset%prtfsurf = 0
    3676                 :             :    end if
    3677         [ +  + ]:          38 :    if (INDEX(dtset%write_files,'gden') .gt. 0) then
    3678                 :           1 :       dtset%prtgden = 1
    3679                 :             :    else
    3680                 :          37 :       dtset%prtgden = 0
    3681                 :             :    end if
    3682         [ -  + ]:          38 :    if (INDEX(dtset%write_files,'geo_1') .gt. 0) then
    3683                 :           0 :       dtset%prtgeo = 1
    3684         [ -  + ]:          38 :    else if (INDEX(dtset%write_files,'geo_2') .gt. 0) then
    3685                 :           0 :       dtset%prtgeo = 2
    3686         [ -  + ]:          38 :    else if (INDEX(dtset%write_files,'geo_3') .gt. 0) then
    3687                 :           0 :       dtset%prtgeo = 3
    3688         [ +  + ]:          38 :    else if (INDEX(dtset%write_files,'geo') .gt. 0) then
    3689                 :           1 :       dtset%prtgeo = 1
    3690                 :             :    else
    3691                 :          37 :       dtset%prtgeo = 0
    3692                 :             :    end if
    3693         [ -  + ]:          38 :    if (INDEX(dtset%write_files,'gkk') .gt. 0) then
    3694                 :           0 :       dtset%prtgkk = 1
    3695                 :             :    else
    3696                 :          38 :       dtset%prtgkk = 0
    3697                 :             :    end if
    3698         [ +  + ]:          38 :    if (INDEX(dtset%write_files,'gsr') .gt. 0) then
    3699                 :           7 :       dtset%prtgsr = 1
    3700                 :             :    else
    3701                 :          31 :       dtset%prtgsr = 0
    3702                 :             :    end if
    3703         [ -  + ]:          38 :    if (INDEX(dtset%write_files,'hist') .gt. 0) then
    3704                 :           0 :       dtset%prthist = 1
    3705                 :             :    else
    3706                 :          38 :       dtset%prthist = 0
    3707                 :             :    end if
    3708   [ -  +  -  - ]:          38 :    if ( (INDEX(dtset%write_files,'kbff') .gt. 0) .AND. (dtset%iomode .eq. 3) )then
    3709                 :           0 :       dtset%prtkbff = 1
    3710                 :             :    else
    3711                 :          38 :       dtset%prtkbff = 0
    3712                 :             :    end if
    3713         [ -  + ]:          38 :    if (INDEX(dtset%write_files,'kden') .gt. 0) then
    3714                 :           0 :       dtset%prtkden = 1
    3715                 :             :    else
    3716                 :          38 :       dtset%prtkden = 0
    3717                 :             :    end if
    3718         [ -  + ]:          38 :    if (INDEX(dtset%write_files,'lden') .gt. 0) then
    3719                 :           0 :       dtset%prtlden = 1
    3720                 :             :    else
    3721                 :          38 :       dtset%prtlden = 0
    3722                 :             :    end if
    3723         [ -  + ]:          38 :    if (INDEX(dtset%write_files,'ncout') .gt. 0) then
    3724                 :           0 :       dtset%ncout = 1
    3725                 :             :    else
    3726                 :          38 :       dtset%ncout = 0
    3727                 :             :    end if
    3728         [ +  + ]:          38 :    if (INDEX(dtset%write_files,'pot') .gt. 0) then
    3729                 :           1 :       dtset%prtpot = 1
    3730                 :             :    else
    3731                 :          37 :       dtset%prtpot = 0
    3732                 :             :    end if
    3733         [ -  + ]:          38 :    if (INDEX(dtset%write_files,'psps_1') .gt. 0) then
    3734                 :           0 :       dtset%prtpsps = 1
    3735         [ -  + ]:          38 :    else if (INDEX(dtset%write_files,'psps_-1') .gt. 0) then
    3736                 :           0 :       dtset%prtpsps = -1
    3737                 :             :    else
    3738                 :          38 :       dtset%prtpsps = 0
    3739                 :             :    end if
    3740         [ -  + ]:          38 :    if (INDEX(dtset%write_files,'stm') .gt. 0) then
    3741                 :           0 :       dtset%prtstm = 1
    3742                 :             :    else
    3743                 :          38 :       dtset%prtstm = 0
    3744                 :             :    end if
    3745         [ -  + ]:          38 :    if (INDEX(dtset%write_files,'suscep') .gt. 0) then
    3746                 :           0 :       dtset%prtsuscep = 1
    3747                 :             :    else
    3748                 :          38 :       dtset%prtsuscep = 0
    3749                 :             :    end if
    3750         [ +  + ]:          38 :    if (INDEX(dtset%write_files,'vclmb_1') .gt. 0) then
    3751                 :           1 :       dtset%prtvclmb = 1
    3752         [ +  + ]:          37 :    else if (INDEX(dtset%write_files,'vclmb_2') .gt. 0) then
    3753                 :           1 :       dtset%prtvclmb = 2
    3754                 :             :    else
    3755                 :          36 :       dtset%prtvha = 0
    3756                 :             :    end if
    3757         [ +  + ]:          38 :    if (INDEX(dtset%write_files,'vha') .gt. 0) then
    3758                 :           3 :       dtset%prtvha = 1
    3759                 :             :    else
    3760                 :          35 :       dtset%prtvha = 0
    3761                 :             :    end if
    3762         [ +  + ]:          38 :    if (INDEX(dtset%write_files,'vhxc') .gt. 0) then
    3763                 :           1 :       dtset%prtvhxc = 1
    3764                 :             :    else
    3765                 :          37 :       dtset%prtvhxc = 0
    3766                 :             :    end if
    3767         [ -  + ]:          38 :    if (INDEX(dtset%write_files,'vpsp') .gt. 0) then
    3768                 :           0 :       dtset%prtvpsp = 1
    3769                 :             :    else
    3770                 :          38 :       dtset%prtvpsp = 0
    3771                 :             :    end if
    3772         [ +  + ]:          38 :    if (INDEX(dtset%write_files,'vxc') .gt. 0) then
    3773                 :           1 :       dtset%prtvxc = 1
    3774                 :             :    else
    3775                 :          37 :       dtset%prtvxc = 0
    3776                 :             :    end if
    3777         [ -  + ]:          38 :    if (INDEX(dtset%write_files,'want_1') .gt. 0) then
    3778                 :           0 :       dtset%prtwant = 1
    3779         [ -  + ]:          38 :    else if (INDEX(dtset%write_files,'want_2') .gt. 0) then
    3780                 :           0 :       dtset%prtwant = 2
    3781         [ -  + ]:          38 :    else if (INDEX(dtset%write_files,'want_3') .gt. 0) then
    3782                 :           0 :       dtset%prtwant = 3
    3783                 :             :    else
    3784                 :          38 :       dtset%prtwant = 0
    3785                 :             :    end if
    3786         [ +  + ]:          38 :    if (INDEX(dtset%write_files,'wf_1') .gt. 0) then
    3787                 :           6 :       dtset%prtwf = 1
    3788         [ -  + ]:           6 :       if (INDEX(dtset%write_files,'wf_full_1') .gt. 0) then
    3789                 :           0 :          dtset%prtwf_full = 1
    3790                 :             :       end if
    3791         [ -  + ]:          32 :    else if (INDEX(dtset%write_files,'wf_2') .gt. 0) then
    3792                 :           0 :       dtset%prtwf = 2
    3793         [ -  + ]:          32 :    else if (INDEX(dtset%write_files,'wf_3') .gt. 0) then
    3794                 :           0 :       dtset%prtwf = 3
    3795         [ -  + ]:          32 :    else if (INDEX(dtset%write_files,'wf_-1') .gt. 0) then
    3796                 :           0 :       dtset%prtwf = -1
    3797                 :             :    else
    3798                 :          32 :       dtset%prtwf = 0
    3799                 :             :    end if
    3800         [ -  + ]:          38 :    if (INDEX(dtset%write_files,'xml') .gt. 0) then
    3801                 :           0 :       dtset%prtxml = 1
    3802                 :             :    else
    3803                 :          38 :       dtset%prtxml = 0
    3804                 :             :    end if
    3805                 :             :  end if
    3806                 :             : 
    3807                 :             :  ! Wannier90 interface related variables
    3808                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'w90iniprj',tread,'INT')
    3809         [ +  + ]:        7010 :  if(tread==1) then
    3810                 :          15 :    dtset%w90iniprj=intarr(1)
    3811                 :             : !  These checks should be moved to m_chkinp.F90
    3812   [ +  +  +  +  :          15 :    if ( usepaw == 0 .and. ( dtset%w90iniprj /= 2  .and. dtset%w90iniprj/=0 .and. dtset%w90iniprj /= 1 )) then
                   -  + ]
    3813                 :             :      write(msg, '(a,i0,2a)' )&
    3814                 :           0 :       'w90iniprj should be set to 0, 1 or 2, however, it was ',dtset%w90iniprj,ch10,&
    3815                 :           0 :       'Action: check the values of w90iniprj.'
    3816                 :           0 :      ABI_ERROR(msg)
    3817                 :             :    end if
    3818                 :             : !  These checks should be moved to m_chkinp.F90
    3819                 :             :    if ( usepaw == 1 .and. ( dtset%w90iniprj < 2 .or. dtset%w90iniprj>6 ) &
    3820   [ +  +  -  +  :          15 :       .and. ( dtset%w90iniprj /= 1 .and. dtset%w90iniprj/=0 )) then
                   -  - ]
    3821                 :             :      write(msg, '(a,i0,2a)' )&
    3822                 :           0 :       'In the PAW case, the only valid values for w90iniprj are 0, 1, 2, 5 and 6 however, it was ',dtset%w90iniprj,ch10,&
    3823                 :           0 :       'Action: check the values of w90iniprj.'
    3824                 :           0 :      ABI_ERROR(msg)
    3825                 :             :    end if
    3826                 :             :  end if
    3827                 :             : 
    3828                 :             :  ! w90prtunk
    3829                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'w90prtunk',tread,'INT')
    3830         [ +  + ]:        7010 :  if(tread==1) then
    3831                 :          10 :    dtset%w90prtunk=intarr(1)
    3832                 :             : !  if ( dtset%w90prtunk < 0 ) then
    3833                 :             : !    write(msg, '(4a)' )&
    3834                 :             : !     'w90prtunk should be greater or equal to zero, however, it was ',dtset%w90prtunk,ch10,&
    3835                 :             : !     'Action: check the values of w90prtunk.'
    3836                 :             : !    ABI_ERROR(msg)
    3837                 :             : !  end if
    3838                 :             :  end if
    3839                 :             : 
    3840                 :             :  ! Wannier90 - GW quasiparticle interface
    3841         [ +  + ]:        7010 :  if(dtset%prtwant==3) then
    3842                 :           1 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'getqps',tread,'INT')
    3843         [ +  - ]:           1 :    if(tread==1) dtset%getqps=intarr(1)
    3844                 :           1 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'irdqps',tread,'INT')
    3845         [ -  + ]:           1 :    if(tread==1) dtset%irdqps=intarr(1)
    3846                 :             :  end if
    3847                 :             : 
    3848                 :             :   !van der Waals with DFT-D approach
    3849         [ +  + ]:        7010 :  if(dtset%vdw_xc==5.or.dtset%vdw_xc==6.or.dtset%vdw_xc==7) then
    3850                 :           8 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'vdw_tol',tread,'DPR')
    3851         [ +  - ]:           8 :    if(tread==1) dtset%vdw_tol=dprarr(1)
    3852         [ +  + ]:           8 :    if (dtset%vdw_xc==6.or.dtset%vdw_xc==7) then
    3853                 :           7 :      call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'vdw_tol_3bt',tread,'DPR')
    3854         [ +  + ]:           7 :      if(tread==1) dtset%vdw_tol_3bt=dprarr(1)
    3855                 :             :    end if
    3856                 :             :  end if
    3857                 :             : 
    3858                 :             :  ! van der Waals with Wannier functions (Silvestrelli's approach versions 1,2 and 3)
    3859         [ +  + ]:        7010 :  if(dtset%vdw_xc==10.or.dtset%vdw_xc==11.or.dtset%vdw_xc==12.or.dtset%vdw_xc==14) then
    3860                 :           4 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'vdw_nfrag',tread,'INT')
    3861         [ +  - ]:           4 :    if(tread==1) dtset%vdw_nfrag=intarr(1)
    3862                 :             : 
    3863                 :           4 :    call intagm(dprarr,intarr,jdtset,marr,dtset%natom,string(1:lenstr),'vdw_typfrag',tread,'INT')
    3864         [ +  - ]:           4 :    if(tread==1)then
    3865         [ +  + ]:           8 :      dtset%vdw_typfrag(1:dtset%natom)=intarr(1:dtset%natom)
    3866                 :             : !    These checks should be moved to m_chkinp.F90
    3867         [ +  + ]:           8 :      do ii=1,dtset%natom
    3868         [ -  + ]:           8 :        if(dtset%vdw_typfrag(ii)<0)then
    3869                 :             :          write(msg, '(a,a,a,i0,a,i0,a,a)' )&
    3870                 :           0 :           'All the components of vdw_typfrag must be greater than 0.',ch10,&
    3871                 :           0 :           'The component',ii,' is equal to ',dtset%vdw_typfrag(ii),ch10,&
    3872                 :           0 :           'Action: check the values of vdw_typfrag.'
    3873                 :           0 :          ABI_ERROR(msg)
    3874                 :             :        end if
    3875                 :             :      end do
    3876                 :             :    end if
    3877                 :             :  end if
    3878         [ +  + ]:        7010 :  if(dtset%vdw_xc==10.or.dtset%vdw_xc==11.or.dtset%vdw_xc==12.or.dtset%vdw_xc==14) then
    3879                 :           4 :    call intagm(dprarr,intarr,jdtset,marr,3,string(1:lenstr),'vdw_supercell',tread,'INT')
    3880         [ +  + ]:           4 :    if(tread==1)then
    3881         [ +  + ]:          12 :      dtset%vdw_supercell(1:3)=intarr(1:3)
    3882                 :             : !    These checks should be moved to m_chkinp.F90
    3883   [ -  +  -  - ]:           3 :      if (dtset%vdw_supercell(1)<zero.and.dtset%vdw_supercell(2)<zero) then
    3884                 :             :        write(msg, '(7a)' )&
    3885                 :           0 :         ' only one component of vdw_supercell could be < 0, however, it was ',ch10,&
    3886                 :           0 :         dtset%vdw_supercell(1),dtset%vdw_supercell(2),dtset%vdw_supercell(3),ch10,&
    3887                 :           0 :         'Action: check the components of vdw_supercell.'
    3888                 :           0 :        ABI_ERROR(msg)
    3889                 :             :      end if
    3890   [ -  +  -  - ]:           3 :      if (dtset%vdw_supercell(2)<zero.and.dtset%vdw_supercell(3)<zero) then
    3891                 :             :        write(msg, '(7a)' )&
    3892                 :           0 :         'only one component of vdw_supercell could be < 0, however, it was ',ch10,&
    3893                 :           0 :         dtset%vdw_supercell(1),dtset%vdw_supercell(2),dtset%vdw_supercell(3),ch10,&
    3894                 :           0 :         'Action: check the components of vdw_supercell.'
    3895                 :           0 :        ABI_ERROR(msg)
    3896                 :             :      end if
    3897   [ -  +  -  - ]:           3 :      if (dtset%vdw_supercell(1)<zero.and.dtset%vdw_supercell(3)<zero) then
    3898                 :             :        write(msg, '(7a)' )&
    3899                 :           0 :         'only one component of vdw_supercell could be < 0, however, it was ',ch10,&
    3900                 :           0 :         dtset%vdw_supercell(1),dtset%vdw_supercell(2),dtset%vdw_supercell(3),ch10,&
    3901                 :           0 :         'Action: check the components of vdw_supercell.'
    3902                 :           0 :        ABI_ERROR(msg)
    3903                 :             :      end if
    3904                 :             :    end if
    3905                 :             : 
    3906                 :             :  end if !vdw_xc==10 or vdw_xc==11 or vdw_xc==12 or vdw_xc==14
    3907                 :             : 
    3908                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'ucrpa',tread,'INT')
    3909         [ -  + ]:        7010 :  if(tread==1) dtset%ucrpa=intarr(1)
    3910                 :             : 
    3911                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,2,string(1:lenstr),'ucrpa_bands',tread_key,'INT')
    3912         [ -  + ]:        7010 :  if(tread_key==1) then
    3913         [ #  # ]:           0 :    if(dtset%nsym/=1) then
    3914                 :             :      write(msg,"(a,i0,3a)")&
    3915                 :           0 :       'Value of nsym different from 1 when ucrpa_bands is used is under test ',dtset%nsym,&
    3916                 :           0 :       ' (because symmetry is not yet used)',ch10,&
    3917                 :           0 :       'Action: check your calculation  with nsym=1'
    3918                 :           0 :      ABI_WARNING(msg)
    3919                 :             :    end if
    3920         [ #  # ]:           0 :    dtset%ucrpa_bands(1:2)=intarr(1:2)
    3921                 :             :  end if
    3922                 :             : 
    3923                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,2,string(1:lenstr),'ucrpa_window',tread,'ENE')
    3924         [ -  + ]:        7010 :  if(tread==1) then
    3925         [ #  # ]:           0 :    if(dtset%nsym/=1) then
    3926                 :             :      write(msg,*)&
    3927                 :           0 :       'Value of nsym different from 1 when ucrpa_windows is used is under test ',dtset%nsym,&
    3928                 :           0 :       ' (because symmetry is not yet used)',ch10,&
    3929                 :           0 :       'Action: check your calculation  with nsym=1'
    3930                 :           0 :      ABI_WARNING(msg)
    3931                 :             :    end if
    3932         [ #  # ]:           0 :    dtset%ucrpa_window(1:2)=dprarr(1:2)
    3933                 :             :  end if
    3934                 :             : 
    3935   [ -  +  -  - ]:        7010 :  if(tread==1.and.tread_key==1) then
    3936                 :             :    write(msg, '(a,a,a,a,a)' )&
    3937                 :           0 :     'ucrpa_bands and ucrpa_window cannot be specified simultaneously',ch10,&
    3938                 :           0 :     'for the same dataset.',ch10,&
    3939                 :           0 :     'Action: check the input file.'
    3940                 :           0 :    ABI_ERROR(msg)
    3941                 :             :  end if
    3942                 :             : 
    3943                 :             :  ! Tolerance variables
    3944                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'tolimg',tread,'ENE')
    3945         [ +  + ]:        7010 :  if(tread==1) dtset%tolimg=dprarr(1)
    3946                 :             : 
    3947                 :             :  ! find which tolerance is used for the ionic relaxations
    3948                 :        7010 :  tolmxde_=dtset%tolmxde
    3949                 :        7010 :  tolmxf_=dtset%tolmxf
    3950                 :        7010 :  itol=0
    3951                 :        7010 :  itol_gen=0
    3952                 :             : 
    3953                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'tolmxde',tread,'ENE',ds_input)
    3954         [ +  + ]:        7010 :  if(tread==1) then
    3955         [ +  - ]:           1 :    if (ds_input == 0) then
    3956                 :           1 :      tolmxde_=dprarr(1)
    3957         [ +  - ]:           1 :      if(abs(dprarr(1))>tiny(0._dp))itol_gen=itol_gen+1
    3958                 :             :    else
    3959                 :           0 :      dtset%tolmxde=dprarr(1)
    3960         [ #  # ]:           0 :      if(abs(dprarr(1))>tiny(0._dp))itol=itol+1
    3961                 :             :    end if
    3962                 :             :  end if
    3963                 :             : 
    3964                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'tolmxf',tread,'DPR',ds_input)
    3965         [ +  + ]:        7010 :  if(tread==1) then
    3966         [ +  + ]:         280 :    if (ds_input == 0) then
    3967                 :         178 :      tolmxf_=dprarr(1)
    3968         [ +  + ]:         178 :      if(abs(dprarr(1))>tiny(0._dp))itol_gen=itol_gen+1
    3969                 :             :    else
    3970                 :         102 :      dtset%tolmxf=dprarr(1)
    3971         [ +  - ]:         102 :      if(abs(dprarr(1))>tiny(0._dp))itol=itol+1
    3972                 :             :    end if
    3973                 :             :  else
    3974                 :        6730 :    itol_gen=itol_gen+1
    3975                 :             :  end if
    3976                 :             : 
    3977                 :             :  ! check for definitions of tolmxf and tolmxde for the present dataset
    3978         [ -  + ]:        7010 :  if (itol > 1 .or. itol_gen > 1) then
    3979                 :             :    write(msg, '(5a)' )&
    3980                 :           0 :     'Only one of the tolmxf/tolmxde variables may be defined at once.',ch10,&
    3981                 :           0 :     'Action: check values of tolmxf, tolmxde. If you want to use ',ch10,&
    3982                 :           0 :     'tolmxde, you should explicitly put tolmxf to 0.0.'
    3983                 :           0 :    ABI_ERROR(msg)
    3984                 :             :  end if
    3985                 :             : 
    3986                 :             :  ! if no value is given for jdtset, use defaults
    3987         [ +  + ]:        7010 :  if (itol == 0 .and. itol_gen == 1) then
    3988                 :        6908 :    dtset%tolmxde=tolmxde_
    3989                 :        6908 :    dtset%tolmxf=tolmxf_
    3990                 :             :  end if
    3991                 :             : 
    3992                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'tolcum',tread,'DPR',ds_input)
    3993         [ +  + ]:        7010 :  if(tread==1) dtset%tolcum=dprarr(1)
    3994                 :             : 
    3995                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'focktoldfe',tread,'DPR')
    3996         [ -  + ]:        7010 :  if(tread==1) dtset%focktoldfe=dprarr(1)
    3997                 :             : 
    3998                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'tolrde',tread,'DPR')
    3999         [ +  + ]:        7010 :  if(tread==1) dtset%tolrde=dprarr(1)
    4000                 :             : 
    4001                 :             :  ! find which tolXXX are defined generically and for this jdtset
    4002                 :        7010 :  tolwfr_=zero
    4003                 :        7010 :  toldfe_=zero
    4004                 :        7010 :  toldff_=zero
    4005                 :        7010 :  toldmag_=zero
    4006                 :        7010 :  tolrff_=zero
    4007                 :        7010 :  tolvrs_=zero
    4008                 :        7010 :  itol=0
    4009                 :        7010 :  itol_gen=0
    4010                 :        7010 :  itol_wfr=0
    4011                 :        7010 :  itol_gen_wfr=0
    4012                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'tolwfr',tread,'DPR',ds_input)
    4013         [ +  + ]:        7010 :  if(tread==1) then
    4014         [ +  + ]:        2116 :    if (ds_input == 0) then
    4015                 :        1308 :      tolwfr_=dprarr(1)
    4016         [ +  - ]:        1308 :      if(abs(dprarr(1))>tiny(0._dp)) then
    4017                 :        1308 :        itol_gen_wfr=itol_gen_wfr+1
    4018                 :             :        ! Set tolwfr_diago to tolwfr by default.
    4019                 :             :        ! Will be overwritten below if tolwfr_diago is specified by the user
    4020                 :        1308 :        dtset%tolwfr_diago=dprarr(1)
    4021                 :             :      end if
    4022                 :             :    else
    4023                 :         808 :      dtset%tolwfr=dprarr(1)
    4024         [ +  + ]:         808 :      if(abs(dprarr(1))>tiny(0._dp)) then
    4025                 :         800 :        itol_wfr=itol_wfr+1
    4026                 :             :        ! Set tolwfr_diago to tolwfr by default.
    4027                 :             :        ! Will be overwritten below if tolwfr_diago is specified by the user
    4028                 :         800 :        dtset%tolwfr_diago=dprarr(1)
    4029                 :             :      end if
    4030                 :             :    end if
    4031                 :             :  end if
    4032                 :             : 
    4033                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'toldff',tread,'DPR',ds_input)
    4034         [ +  + ]:        7010 :  if(tread==1) then
    4035         [ +  + ]:         404 :    if (ds_input == 0) then
    4036                 :         305 :      toldff_=dprarr(1)
    4037         [ +  - ]:         305 :      if(abs(dprarr(1))>tiny(0._dp))itol_gen=itol_gen+1
    4038                 :             :    else
    4039                 :          99 :      dtset%toldff=dprarr(1)
    4040         [ +  - ]:          99 :      if(abs(dprarr(1))>tiny(0._dp))itol=itol+1
    4041                 :             :    end if
    4042                 :         404 :    dtset%optforces=1
    4043                 :             :  end if
    4044                 :             : 
    4045                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'toldmag',tread,'DPR',ds_input)
    4046         [ +  + ]:        7010 :  if(tread==1) then
    4047         [ -  + ]:           2 :    if (ds_input == 0) then
    4048                 :           0 :      toldmag_=dprarr(1)
    4049         [ #  # ]:           0 :      if(abs(dprarr(1))>tiny(0._dp))itol_gen=itol_gen+1
    4050                 :             :    else
    4051                 :           2 :      dtset%toldmag=dprarr(1)
    4052         [ -  + ]:           2 :      if(abs(dprarr(1))>tiny(0._dp))itol=itol+1
    4053                 :             :    end if
    4054                 :             :  end if
    4055                 :             : 
    4056                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'tolrff',tread,'DPR',ds_input)
    4057         [ +  + ]:        7010 :  if(tread==1) then
    4058         [ +  + ]:          41 :    if (ds_input == 0) then
    4059                 :          38 :      tolrff_=dprarr(1)
    4060         [ +  - ]:          38 :      if(abs(dprarr(1))>tiny(0._dp))itol_gen=itol_gen+1
    4061                 :             :    else
    4062                 :           3 :      dtset%tolrff=dprarr(1)
    4063         [ +  - ]:           3 :      if(abs(dprarr(1))>tiny(0._dp))itol=itol+1
    4064                 :             :    end if
    4065                 :          41 :    dtset%optforces=1
    4066                 :             :  end if
    4067                 :             : 
    4068                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'toldfe',tread,'ENE',ds_input)
    4069         [ +  + ]:        7010 :  if(tread==1) then
    4070         [ +  + ]:        2611 :    if (ds_input == 0) then
    4071                 :        2258 :      toldfe_=dprarr(1)
    4072         [ +  - ]:        2258 :      if(abs(dprarr(1))>tiny(0._dp))itol_gen=itol_gen+1
    4073                 :             :    else
    4074                 :         353 :      dtset%toldfe=dprarr(1)
    4075         [ +  - ]:         353 :      if(abs(dprarr(1))>tiny(0._dp))itol=itol+1
    4076                 :             :      ! A negative value is interpreted as energy per atom.
    4077         [ +  - ]:         353 :      if (dtset%toldfe < zero) dtset%toldfe = abs(dtset%toldfe) * dtset%natom
    4078                 :             :    end if
    4079                 :             :  end if
    4080                 :             : 
    4081                 :             :  if((dtset%accuracy>0).and.(itol>0.or.itol_gen>0)) tolvrs_=zero
    4082                 :             : 
    4083                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'tolvrs',tread,'DPR',ds_input)
    4084         [ +  + ]:        7010 :  if(tread==1) then
    4085         [ +  + ]:        1687 :    if (ds_input == 0) then
    4086                 :        1320 :      tolvrs_=dprarr(1)
    4087         [ +  - ]:        1320 :      if(abs(dprarr(1))>tiny(0._dp))itol_gen=itol_gen+1
    4088                 :             :    else
    4089                 :         367 :      dtset%tolvrs=dprarr(1)
    4090         [ +  + ]:         367 :      if(abs(dprarr(1))>tiny(0._dp))itol=itol+1
    4091                 :             :    end if
    4092                 :             :  end if
    4093                 :             : 
    4094                 :             :  !write(ab_out,*)"GGGGG", itol_gen,itol
    4095                 :             :  ! check for multiple definitions of tolXXX for the present dataset
    4096         [ -  + ]:        7010 :  if (itol > 1 .or. itol_gen > 1) then
    4097                 :             :    write(msg, '(3a)' )&
    4098                 :           0 :    'Only one of the tolXXX variables may be defined at once.',ch10,&
    4099                 :           0 :    'Action: check values of tolvrs, toldfe, tolrff, toldmag and toldff.'
    4100                 :           0 :    ABI_ERROR(msg)
    4101                 :             :  end if
    4102                 :             : 
    4103                 :             : ! Now we take into account that tolwfr can be coupled with an other tolerance,
    4104                 :             : ! ONLY if both tolerances are given for this dataset, or both generic values are defined
    4105                 :             : !if tol/=tolwfr is set without tolwfr, tolwfr should be 0
    4106         [ +  + ]:        7010 :  if (itol == 1 .and. itol_wfr == 0) then
    4107                 :         811 :    dtset%tolwfr=zero
    4108                 :         811 :    dtset%tolwfr_diago=zero
    4109                 :             :  end if
    4110                 :             : !if tolwfr is set without tol/=tolwfr, tol/=tolwfr should be 0
    4111         [ +  + ]:        7010 :  if (itol == 0 .and. itol_wfr == 1) then
    4112                 :         791 :    dtset%toldfe=zero
    4113                 :         791 :    dtset%toldff=zero
    4114                 :         791 :    dtset%toldmag=zero
    4115                 :         791 :    dtset%tolrff=zero
    4116                 :         791 :    dtset%tolvrs=zero
    4117                 :             :  end if
    4118                 :             : 
    4119                 :             : ! up to here:
    4120                 :             : ! -- dtset%tolXXX is set if given for this dataset (itol or itol_wfr>0)
    4121                 :             : ! -- tolXXX_ is non-zero if a generic value is defined (itol_gen or itol_wfr_gen>0)
    4122                 :             : !if no value is given for jdtset, use defaults:
    4123         [ +  + ]:        7010 :  if (itol == 0 .and. itol_wfr == 0) then
    4124         [ +  + ]:        5399 :    if (itol_gen == 1) then
    4125                 :        3795 :      dtset%toldfe=toldfe_
    4126                 :        3795 :      dtset%toldff=toldff_
    4127                 :        3795 :      dtset%toldmag=toldmag_
    4128                 :        3795 :      dtset%tolrff=tolrff_
    4129                 :        3795 :      dtset%tolvrs=tolvrs_
    4130                 :             :    end if
    4131         [ +  + ]:        5399 :    if (itol_gen_wfr == 1) then
    4132                 :        1299 :      dtset%tolwfr=tolwfr_
    4133                 :             :    end if
    4134                 :             :  end if
    4135                 :             : 
    4136                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'tolwfr_diago',tread,'DPR')
    4137         [ +  + ]:        7010 :  if(tread==1) dtset%tolwfr_diago = dprarr(1)
    4138                 :             : 
    4139                 :             :  ! Tolerance variable for TFW initialization step
    4140                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'tfw_toldfe',tread,'ENE',ds_input)
    4141         [ +  + ]:        7010 :  if(tread==1) then
    4142                 :           1 :    dtset%tfw_toldfe=dprarr(1)
    4143   [ -  +  -  - ]:        7009 :  else if (dtset%tfkinfunc>10.and.dtset%toldfe>tiny(0._dp)) then
    4144                 :           0 :    dtset%tfw_toldfe=dtset%toldfe
    4145                 :             :  end if
    4146                 :             : 
    4147                 :             :  ! Tolerance variables for electrons-positron tc-dft
    4148                 :        7010 :  toldfe_=zero;toldff_=zero
    4149                 :        7010 :  itol=0;itol_gen=0
    4150                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'postoldff',tread,'DPR',ds_input)
    4151         [ +  + ]:        7010 :  if(tread==1) then
    4152         [ -  + ]:           1 :    if (ds_input == 0) then
    4153                 :           0 :      toldff_=dprarr(1)
    4154         [ #  # ]:           0 :      if(abs(dprarr(1))>tiny(0._dp))itol_gen=itol_gen+1
    4155                 :             :    else
    4156                 :           1 :      dtset%postoldff=dprarr(1)
    4157         [ +  - ]:           1 :      if(abs(dprarr(1))>tiny(0._dp))itol=itol+1
    4158                 :             :    end if
    4159                 :           1 :    dtset%postoldfe=zero
    4160                 :             :  end if
    4161                 :             : 
    4162                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'postoldfe',tread,'ENE',ds_input)
    4163         [ +  + ]:        7010 :  if(tread==1) then
    4164         [ +  - ]:           9 :    if (ds_input == 0) then
    4165                 :           9 :      toldfe_=dprarr(1)
    4166         [ +  - ]:           9 :      if(abs(dprarr(1))>tiny(0._dp))itol_gen=itol_gen+1
    4167                 :             :    else
    4168                 :           0 :      dtset%postoldfe=dprarr(1)
    4169         [ #  # ]:           0 :      if(abs(dprarr(1))>tiny(0._dp))itol=itol+1
    4170                 :             :    end if
    4171                 :             :  end if
    4172         [ -  + ]:        7010 :  if (itol > 1.or.itol_gen >1) then
    4173                 :             :    write(msg, '(3a)' )&
    4174                 :           0 :    'Only one of the postolXXX variables may be defined at once.',ch10,&
    4175                 :           0 :    'Action: check values of postoldfe and postoldff.'
    4176                 :           0 :    ABI_ERROR(msg)
    4177                 :             :  end if
    4178         [ +  + ]:        7010 :  if (itol==0.and.itol_gen==1) then
    4179                 :           8 :    dtset%postoldfe=toldfe_
    4180                 :           8 :    dtset%postoldff=toldff_
    4181                 :             :  end if
    4182                 :             : 
    4183                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,2,string(1:lenstr),'vprtrb',tread,'ENE')
    4184   [ +  +  +  + ]:        7026 :  if(tread==1) dtset%vprtrb(:)=dprarr(1:2)
    4185                 :             : 
    4186                 :             : !TODO: should this test be just on natsph without caring about the others? natsph might be used for other purposes
    4187   [ +  +  +  +  :        7010 :  if((dtset%pawfatbnd>0.or.dtset%prtdos==3) .and. dtset%natsph>0)then
                   +  - ]
    4188                 :          42 :    call intagm(dprarr,intarr,jdtset,marr,dtset%natsph,string(1:lenstr),'iatsph',tread,'INT')
    4189   [ +  +  +  + ]:          70 :    if(tread==1) dtset%iatsph(1:dtset%natsph)=intarr(1:dtset%natsph)
    4190                 :             :  end if
    4191                 :             : 
    4192                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prtdensph',tread,'INT')
    4193         [ +  + ]:        7010 :  if(tread==1) then
    4194                 :          17 :    dtset%prtdensph=intarr(1)
    4195   [ +  +  +  + ]:        6993 :  else if (dtset%nsppol==1.and.dtset%nspden==2) then
    4196                 :          34 :    dtset%prtdensph=1
    4197                 :             :  end if
    4198                 :             : 
    4199                 :             :  ! Initialize atvshift
    4200         [ +  + ]:        7010 :  if(dtset%natvshift>0)then
    4201                 :          15 :    call intagm(dprarr,intarr,jdtset,marr,dtset%natvshift*nsppol*dtset%natom,string(1:lenstr),'atvshift',tread,'ENE')
    4202         [ +  + ]:          15 :    if(tread==1) dtset%atvshift(1:dtset%natvshift,1:nsppol,1:dtset%natom)=&
    4203   [ +  +  +  +  :         111 : &   reshape(dprarr(1:dtset%natvshift*nsppol*dtset%natom),(/dtset%natvshift,nsppol,dtset%natom/))
             +  +  +  + ]
    4204                 :             :  end if
    4205                 :             : 
    4206                 :             :  ! Initialize wtatcon
    4207         [ +  + ]:        7010 :  if(dtset%nconeq>0)then
    4208                 :             : 
    4209                 :             :    ! Read and check natcon
    4210   [ -  +  +  -  :          15 :    ABI_MALLOC(natcon,(dtset%nconeq))
          +  -  -  +  -  
                      + ]
    4211                 :           5 :    call intagm(dprarr,intarr,jdtset,marr,dtset%nconeq,string(1:lenstr),'natcon',tread,'INT')
    4212         [ +  - ]:           5 :    if(tread==1)then
    4213         [ +  + ]:          10 :      natcon(:)=intarr(1:dtset%nconeq)
    4214                 :             :    else
    4215                 :             :      write(msg, '(3a)' )&
    4216                 :           0 :       'When nconeq is positive, natcon MUST be defined.',ch10,&
    4217                 :           0 :       'Action: check the values of nconeq and natcon.'
    4218                 :           0 :      ABI_ERROR(msg)
    4219                 :             :    end if
    4220         [ +  + ]:          10 :    do ii=1,dtset%nconeq
    4221         [ -  + ]:          10 :      if(natcon(ii)<0)then
    4222                 :             :        write(msg, '(3a,i0,a,i0,2a)' )&
    4223                 :           0 :         'All the components of natcon must be greater than 0.',ch10,&
    4224                 :           0 :         'The component',ii,' is equal to ',natcon(ii),ch10,&
    4225                 :           0 :         'Action: check the values of natcon.'
    4226                 :           0 :        ABI_ERROR(msg)
    4227                 :             :      end if
    4228                 :             :    end do
    4229         [ +  + ]:          10 :    niatcon=sum(natcon(:))
    4230                 :             : 
    4231                 :             :    ! Read and check iatcon
    4232   [ -  +  +  -  :          15 :    ABI_MALLOC(iatcon,(niatcon))
          +  -  +  -  -  
                +  -  + ]
    4233                 :           5 :    call intagm(dprarr,intarr,jdtset,marr,niatcon,string(1:lenstr),'iatcon',tread,'INT')
    4234         [ +  - ]:           5 :    if(tread==1)then
    4235         [ +  + ]:          14 :      iatcon(:)=intarr(1:niatcon)
    4236                 :             :    else
    4237                 :             :      write(msg, '(3a)' )&
    4238                 :           0 :      'When nconeq is positive, natcon MUST be defined.',ch10,&
    4239                 :           0 :      'Action: check the values of nconeq and natcon.'
    4240                 :           0 :      ABI_ERROR(msg)
    4241                 :             :    end if
    4242         [ +  + ]:          14 :    do ii=1,niatcon
    4243         [ -  + ]:          14 :      if(iatcon(ii)<0)then
    4244                 :             :        write(msg, '(a,a,a,i4,a,i4,a,a)' )&
    4245                 :           0 :         'All the components of iatcon must be greater than 0.',ch10,&
    4246                 :           0 :         'The component',ii,' is equal to ',iatcon(ii),ch10,&
    4247                 :           0 :         'Action: check the values of iatcon.'
    4248                 :           0 :        ABI_ERROR(msg)
    4249                 :             :      end if
    4250                 :             :    end do
    4251                 :             : 
    4252                 :             :    ! Read wtatcon, and unfold it.
    4253                 :           5 :    call intagm(dprarr,intarr,jdtset,marr,3*niatcon,string(1:lenstr),'wtatcon',tread,'DPR')
    4254         [ -  + ]:           5 :    if(tread/=1)then
    4255                 :             :      write(msg, '(3a)' )&
    4256                 :           0 :      'When nconeq is positive, wtatcon MUST be defined.',ch10,&
    4257                 :           0 :      'Action: check the values of nconeq and wtatcon.'
    4258                 :           0 :      ABI_ERROR(msg)
    4259                 :             :    end if
    4260                 :           5 :    iat=0
    4261         [ +  + ]:          10 :    do ii=1,dtset%nconeq
    4262         [ +  + ]:          14 :      do jj=1,natcon(ii)
    4263         [ +  + ]:          41 :        dtset%wtatcon(1:3,iatcon(jj+iat),ii)=dprarr(1+3*(jj+iat-1):3+3*(jj+iat-1))
    4264                 :             :      end do
    4265                 :          10 :      iat=iat+natcon(ii)
    4266                 :             :    end do
    4267                 :             : 
    4268         [ -  + ]:           5 :    ABI_FREE(iatcon)
    4269         [ -  + ]:           5 :    ABI_FREE(natcon)
    4270                 :             :  end if
    4271                 :             : 
    4272                 :             :   ! Initialize chempot
    4273         [ +  + ]:        7010 :  if(dtset%nzchempot>0)then
    4274                 :           7 :    call intagm(dprarr,intarr,jdtset,marr,3*dtset%nzchempot*ntypat,string(1:lenstr),'chempot',tread,'DPR')
    4275         [ +  - ]:           7 :    if(tread==1) dtset%chempot(1:3,1:dtset%nzchempot,1:ntypat)=&
    4276   [ +  +  +  +  :         154 : &   reshape(dprarr(1:3*dtset%nzchempot*ntypat),(/3,dtset%nzchempot,ntypat/))
             +  +  +  + ]
    4277                 :             :  end if
    4278                 :             : 
    4279                 :             :  ! Initialize the list of k points, as well as wtk and istwfk
    4280         [ +  + ]:        7010 :  intimage=1 ; if(nimage>2)intimage=(1+nimage)/2
    4281   [ -  +  -  -  :        7010 :  call invacuum(jdtset,lenstr,natom,dtset%rprimd_orig(1:3,1:3,intimage),string,vacuum,dtset%xred_orig(1:3,1:natom,intimage))
          -  -  -  +  -  
          -  -  -  -  -  
                   -  + ]
    4282                 :             : 
    4283                 :             :  ! reset rfdir to 1 1 1 in case it was left at the default of 0 0 0 for berryopt -1
    4284                 :             :  if( (dtset%berryopt == -1) .AND. &
    4285                 :             : & (dtset%rfdir(1) == 0) .AND. &
    4286   [ +  +  +  +  :        7010 : & (dtset%rfdir(2) == 0) .AND. &
                   -  + ]
    4287         [ #  # ]:           0 : & (dtset%rfdir(3) == 0) ) dtset%rfdir(1:3) = 1
    4288                 :             : 
    4289                 :             : !In case of a Berryphase calculation put response = 1
    4290                 :             : !in order to set istwfk = 1 at all k-points
    4291         [ +  + ]:        7010 :  if ( dtset%berryopt/=0 ) then
    4292                 :          83 :    response = 1
    4293                 :             :  end if
    4294                 :             : 
    4295                 :             : !In case of longwave calculation put response = 1
    4296                 :             : !in order to set istwfk = 1 at all k-points
    4297         [ +  + ]:        7010 :  if ( dtset%optdriver==RUNL_LONGWAVE ) then
    4298                 :          17 :    response = 1
    4299                 :             :  end if
    4300                 :             : 
    4301                 :        7010 :  nsym=dtset%nsym
    4302         [ +  + ]:        7010 :  ii=0;if (mod(dtset%wfoptalg,10)==4) ii=2
    4303                 :             : #ifdef HAVE_DFTI
    4304         [ +  + ]:        7010 :  if (dtset%wfoptalg==114.or.dtset%wfoptalg==111) ii=0 ! allow any istwfk for LOBPCG or Chebfi with xg_tools
    4305                 :             : #else
    4306                 :             :  if (dtset%wfoptalg==114.or.dtset%wfoptalg==111) ii=2 ! allow only istwfk=1 or 2 for LOBPCG or Chebfi with xg_tools
    4307                 :             : #endif
    4308         [ -  + ]:        7010 :  if(dtset%ngfft(7)==314)ii=1
    4309   [ +  +  +  +  :        7010 :  if(dtset%usefock==1.and.dtset%optdriver/=RUNL_SIGMA.and.mod(dtset%wfoptalg,10)/=5.and.nkpt>1) ii=1
             +  -  +  + ]
    4310                 :             :  !Enforce istwfk = 1 for all k-points in RT-TDDFT calculations
    4311         [ +  + ]:        7010 :  if(dtset%optdriver==RUNL_RTTDDFT) ii=1
    4312                 :             : 
    4313                 :             :  call inkpts(bravais,dtset%chksymbreak,dtset%fockdownsampling,iout,iscf,dtset%istwfk(1:nkpt),jdtset,&
    4314                 :             :    dtset%kpt(:,1:nkpt),dtset%kptns_hf(:,1:nkpthf),kptopt,dtset%kptnrm,&
    4315                 :             :    dtset%kptrlatt_orig,dtset%kptrlatt,kptrlen,lenstr,nsym, dtset%getkerange_filepath, &
    4316                 :             :    nkpt,nkpthf,nqpt,dtset%ngkpt,dtset%nshiftk,dtset%nshiftk_orig,dtset%shiftk_orig,nsym,&
    4317                 :             :    occopt,dtset%qptn,response,dtset%rprimd_orig(1:3,1:3,intimage),dtset%shiftk,string,&
    4318   [ -  +  -  -  :        7010 :    dtset%symafm(1:nsym),dtset%symrel(:,:,1:nsym),vacuum,dtset%wtk(1:nkpt), comm, impose_istwf_1=ii)
                   -  - ]
    4319                 :             : 
    4320                 :        7010 :  dtset%kptrlen=kptrlen
    4321                 :             : 
    4322   [ +  +  +  + ]:      461810 :  dtset%kptns(:,1:nkpt)=dtset%kpt(:,1:nkpt)/dtset%kptnrm
    4323   [ +  +  +  +  :        7010 :  if(nqpt>=1 .and. dtset%optdriver/=RUNL_RESPFN.and.dtset%optdriver/=RUNL_LONGWAVE)then
                   +  + ]
    4324         [ +  + ]:        4223 :    dtset%kptns(1,1:nkpt)=dtset%kptns(1,1:nkpt)+dtset%qptn(1)
    4325         [ +  + ]:        4223 :    dtset%kptns(2,1:nkpt)=dtset%kptns(2,1:nkpt)+dtset%qptn(2)
    4326         [ +  + ]:        4223 :    dtset%kptns(3,1:nkpt)=dtset%kptns(3,1:nkpt)+dtset%qptn(3)
    4327                 :             :  end if
    4328                 :             : 
    4329         [ +  + ]:        7010 :  if(nkpthf/=0)then
    4330   [ +  +  +  + ]:     3010253 :    dtset%kptns_hf(:,1:nkpthf)=dtset%kptns_hf(:,1:nkpthf)/dtset%kptnrm
    4331                 :             :  end if
    4332                 :             : 
    4333                 :             :  ! Read variables defining the k-path
    4334                 :             :  ! If kptopt < 0  --> Band structure and kptbounds size is given by abs(kptopt)
    4335                 :             :  ! If kptopt >= 0 --> We may have a k-path specified by nkpath and kptbounds (used by post-processing tools)
    4336                 :             :  ! TODO: ndivk?
    4337                 :             : 
    4338                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'ndivsm',tread,'INT')
    4339         [ +  + ]:        7010 :  if (tread == 1) dtset%ndivsm = intarr(1)
    4340                 :             : 
    4341         [ +  + ]:        7010 :  if (dtset%kptopt < 0) then
    4342                 :         142 :    dtset%nkpath = abs(dtset%kptopt)
    4343                 :             :  else
    4344                 :        6868 :    dtset%nkpath = 0
    4345                 :        6868 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'nkpath',tread,'INT')
    4346         [ +  + ]:        6868 :    if (tread==1) dtset%nkpath = intarr(1)
    4347                 :             :  end if
    4348                 :             : 
    4349         [ +  + ]:        7010 :  if (dtset%nkpath /= 0) then
    4350                 :         146 :    call intagm(dprarr,intarr,jdtset,marr,3*dtset%nkpath,string(1:lenstr),'kptbounds',tread,'DPR')
    4351                 :             : 
    4352         [ +  - ]:         146 :    if (tread == 1) then
    4353   [ -  +  +  -  :         438 :      ABI_MALLOC(dtset%kptbounds, (3, dtset%nkpath))
          +  -  +  -  -  
             +  -  +  -  
                      + ]
    4354   [ +  +  +  -  :        2216 :      dtset%kptbounds = reshape(dprarr(1:3*dtset%nkpath), [3, dtset%nkpath])
          +  -  -  +  -  
             -  +  +  +  
                      + ]
    4355                 :             :    else
    4356                 :           0 :      ABI_ERROR("When nkpath /= 0 or kptopt < 0, kptbounds must be defined in the input file.")
    4357                 :             :    end if
    4358                 :             :  else
    4359   [ -  +  -  + ]:        6864 :    ABI_MALLOC(dtset%kptbounds, (0,0))
    4360                 :             :  end if
    4361                 :             : 
    4362                 :             :  ! if prtkpt==-2, write the k-points in netcdf format and exit here so that AbiPy can read the data.
    4363                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'prtkpt',tread,'INT')
    4364   [ +  +  -  + ]:        7010 :  if (tread == 1 .and. intarr(1) == -2) then
    4365         [ #  # ]:           0 :    if (my_rank == 0) then
    4366                 :           0 :      ncerr= nctk_write_ibz("kpts.nc", dtset%kptns(:,1:nkpt), dtset%wtk(1:nkpt))
    4367         [ #  # ]:           0 :      NCF_CHECK(ncerr)
    4368                 :             :    end if
    4369                 :           0 :    call xmpi_barrier(comm)
    4370                 :           0 :    ABI_ERROR_NODUMP("kpts.nc file written. Aborting now")
    4371                 :             :  end if
    4372                 :             : 
    4373         [ +  + ]:        7010 :  if (dtset%nkptgw>0) then
    4374                 :             :    ! Read bdgw.
    4375                 :         302 :    call intagm(dprarr,intarr,jdtset,marr,2*dtset%nkptgw*dtset%nsppol,string(1:lenstr),'bdgw',tread,'INT')
    4376         [ +  + ]:         302 :    if (tread==1) then
    4377                 :             :      dtset%bdgw(1:2,1:dtset%nkptgw,1:dtset%nsppol) =  &
    4378   [ +  +  +  +  :        4491 :        reshape(intarr(1:2*dtset%nkptgw*dtset%nsppol),[2,dtset%nkptgw,dtset%nsppol])
             +  +  +  + ]
    4379                 :             :    end if
    4380                 :             : 
    4381                 :             :    ! Test bdgw values.
    4382         [ +  + ]:         302 :    if (any(dtset%optdriver == [RUNL_SIGMA, RUNL_EPH])) then
    4383   [ +  +  +  +  :        2002 :      if (any(dtset%bdgw(1:2,1:dtset%nkptgw,1:dtset%nsppol) <= 0)) then
          +  +  +  -  -  
                      + ]
    4384                 :           0 :        ABI_ERROR("bdgw entries cannot be <= 0. Check input file")
    4385                 :             :      end if
    4386   [ +  +  +  +  :         942 :      if (any(dtset%bdgw(1,1:dtset%nkptgw,1:dtset%nsppol) > dtset%bdgw(2,1:dtset%nkptgw,1:dtset%nsppol))) then
             +  -  -  + ]
    4387                 :           0 :        ABI_ERROR("First band index in bdgw cannot be greater than the second index")
    4388                 :             :      end if
    4389                 :             :    end if
    4390                 :             : 
    4391                 :         302 :    call intagm(dprarr,intarr,jdtset,marr,3*dtset%nkptgw,string(1:lenstr),'kptgw',tread,'DPR')
    4392   [ +  -  +  +  :        4842 :    if(tread==1) dtset%kptgw(1:3,1:dtset%nkptgw) = reshape(dprarr(1:3*dtset%nkptgw), [3, dtset%nkptgw])
             +  +  +  + ]
    4393                 :             :  end if
    4394                 :             : 
    4395         [ +  + ]:        7010 :  if (dtset%nqptdm > 0) then
    4396                 :           3 :    call intagm(dprarr,intarr,jdtset,marr,3*dtset%nqptdm,string(1:lenstr),'qptdm',tread,'DPR')
    4397   [ +  -  +  +  :          33 :    if(tread==1) dtset%qptdm(1:3,1:dtset%nqptdm)=reshape(dprarr(1:3*dtset%nqptdm), [3, dtset%nqptdm])
             +  +  +  + ]
    4398                 :             :  end if
    4399                 :             : 
    4400         [ +  + ]:        7010 :  if(dtset%npvel>0) then
    4401                 :           2 :    call intagm(dprarr,intarr,jdtset,marr,3,string(1:lenstr),'pvelmax',tread,'DPR')
    4402   [ +  -  +  + ]:           8 :    if(tread==1) dtset%pvelmax(1:3)=dprarr(1:3)
    4403                 :             :  end if
    4404                 :             : 
    4405         [ +  + ]:        7010 :  if(dtset%imgmov==6)then
    4406                 :           6 :    call intagm(dprarr,intarr,jdtset,marr,dtset%nimage,string(1:lenstr),'mixesimgf',tread,'DPR')
    4407   [ +  -  +  + ]:          18 :    if(tread==1)dtset%mixesimgf(1:dtset%nimage)=dprarr(1:dtset%nimage)
    4408                 :             :  endif
    4409                 :             : 
    4410                 :             :  ! Read remaining input variables depending on images : occ_orig, upawu, jpawu.
    4411                 :             :  ! MT oct 15: these lines are inspired from invars1 but are not really understood
    4412         [ +  + ]:        7010 :  intimage=2 ; if(dtset%nimage==1)intimage=1
    4413         [ +  + ]:       14325 :  do ii=1,dtset%nimage+1
    4414                 :       14280 :    iimage=ii
    4415   [ +  +  +  + ]:       14280 :    if(dtset%nimage==1 .and. ii==2)exit
    4416   [ +  +  +  + ]:        7320 :    if(dtset%nimage==2 .and. ii==3)exit
    4417   [ +  +  +  + ]:        7315 :    if(dtset%nimage> 2 .and. ii==intimage)cycle ! Will do the intermediate reference image at the last reading
    4418   [ +  +  +  + ]:        7270 :    if(dtset%nimage>=2 .and. ii==dtset%nimage+1)iimage=intimage
    4419                 :             : 
    4420                 :             :    ! Only read occ if (iscf >0 or iscf=-1 or iscf=-3) and (occopt==0 or occopt==2)
    4421         [ +  + ]:        7270 :    if  (iscf>=0.or.iscf==-1.or.iscf==-3)  then
    4422   [ +  +  +  + ]:        6774 :      if (occopt==2 .and. getocc==0) then
    4423                 :             :        ! Read occ(nband(kpt)*nkpt*nsppol) explicitly
    4424                 :         200 :        call wrtout(std_out,' invars2: reading occ(nband*nkpt*nsppol) explicitly','COLL')
    4425                 :         200 :        call intagm(dprarr,intarr,jdtset,marr,bantot,string(1:lenstr),'occ',tread,'DPR')
    4426   [ +  -  +  + ]:        1837 :        if(tread==1) dtset%occ_orig(1:bantot,iimage)=dprarr(1:bantot)
    4427                 :         200 :        call intagm_img(dprarr(1:bantot),iimage,jdtset,lenstr,dtset%nimage,bantot,string,'occ',tread_alt,'DPR')
    4428   [ -  +  -  - ]:         200 :        if(tread_alt==1) dtset%occ_orig(1:bantot,iimage)=dprarr(1:bantot)
    4429         [ +  + ]:        6574 :      else if(occopt==0) then
    4430                 :         256 :        nband1=dtset%nband(1)
    4431                 :             :        ! Read usual occupancy--same for all k points but might differ for spins
    4432                 :         256 :        call intagm(dprarr,intarr,jdtset,marr,nband1*nsppol,string(1:lenstr),'occ',tread,'DPR')
    4433   [ +  +  +  + ]:        2630 :        if(tread==1) dtset%occ_orig(1:nband1*nsppol,iimage)=dprarr(1:nband1*nsppol)
    4434                 :         256 :        call intagm_img(dprarr(1:nband1*nsppol),iimage,jdtset,lenstr,dtset%nimage,nband1*nsppol,string,'occ',tread_alt,'DPR')
    4435   [ +  +  +  + ]:         608 :        if(tread_alt==1) dtset%occ_orig(1:nband1*nsppol,iimage)=dprarr(1:nband1*nsppol)
    4436                 :             :        ! Fill in full occ array using input values for each k and spin
    4437                 :             :        ! (make a separate copy for each k point and spin)
    4438         [ +  + ]:         256 :        if(nkpt>1)then
    4439         [ +  + ]:         218 :          do isppol=nsppol,1,-1
    4440         [ +  + ]:         674 :            do ikpt=1,nkpt
    4441                 :             :              dtset%occ_orig(1+(ikpt-1)*nband1+nkpt*nband1*(isppol-1):ikpt*nband1+nkpt*nband1*(isppol-1),iimage)=&
    4442   [ +  -  +  +  :       13484 : &             dtset%occ_orig(1+nband1*(isppol-1):nband1*isppol,iimage)
                   +  + ]
    4443                 :             :            end do
    4444                 :             :          end do
    4445                 :             :        endif
    4446                 :             :      end if
    4447                 :             :    end if
    4448                 :             : 
    4449   [ +  +  -  + ]:       14280 :    if (dtset%usepawu/=0.or.(dtset%usedmft>0.and.dtset%usedmft/=10)) then
    4450                 :             : 
    4451         [ +  + ]:         392 :      dprarr(1:ntypat)=dtset%upawu(1:ntypat,iimage)
    4452                 :         155 :      call intagm(dprarr,intarr,jdtset,marr,ntypat,string(1:lenstr),'upawu',tread,'ENE')
    4453   [ +  +  +  + ]:         374 :      if(tread==1) dtset%upawu(1:ntypat,iimage)=dprarr(1:ntypat)
    4454                 :         155 :      call intagm_img(dprarr(1:ntypat),iimage,jdtset,lenstr,dtset%nimage,ntypat,string,'upawu',tread_alt,'ENE')
    4455   [ -  +  -  - ]:         155 :      if(tread_alt==1) dtset%upawu(1:ntypat,iimage)=dprarr(1:ntypat)
    4456                 :             : 
    4457         [ +  + ]:         392 :      dprarr(1:ntypat)=dtset%jpawu(1:ntypat,iimage)
    4458                 :         155 :      call intagm(dprarr,intarr,jdtset,marr,ntypat,string(1:lenstr),'jpawu',tread,'ENE')
    4459   [ +  +  +  + ]:         356 :      if(tread==1) dtset%jpawu(1:ntypat,iimage)=dprarr(1:ntypat)
    4460                 :         155 :      call intagm_img(dprarr(1:ntypat),iimage,jdtset,lenstr,dtset%nimage,ntypat,string,'jpawu',tread_alt,'ENE')
    4461   [ -  +  -  - ]:         155 :      if(tread_alt==1) dtset%jpawu(1:ntypat,iimage)=dprarr(1:ntypat)
    4462                 :             : 
    4463   [ +  +  +  - ]:         155 :      if (dtset%usedmatpu/=0.and.dmatsize>0) then
    4464                 :          15 :        nsp=nsppol*nspinor
    4465                 :          15 :        call intagm(dprarr,intarr,jdtset,marr,dmatsize,string(1:lenstr),'dmatpawu',tread,'DPR')
    4466         [ +  - ]:          15 :        if(tread==1) then
    4467                 :          15 :          iat=1;jj=1
    4468         [ +  + ]:          64 :          do iatom=1,natom
    4469                 :          49 :            lpawu=dtset%lpawu(dtset%typat(iatom))
    4470         [ +  + ]:          64 :            if (lpawu/=-1) then
    4471                 :          26 :              isiz=nsp*(2*lpawu+1)**2
    4472                 :             :              dtset%dmatpawu(1:2*lpawu+1,1:2*lpawu+1,1:nsp,iat,iimage)= &
    4473   [ +  +  +  +  :        1448 : &             reshape(dprarr(jj:jj+isiz),(/2*lpawu+1,2*lpawu+1,nsp/))
             +  +  +  + ]
    4474                 :          26 :              iat=iat+1;jj=jj+isiz
    4475                 :             :            end if
    4476                 :             :          end do
    4477                 :             :        end if
    4478                 :             : 
    4479   [ -  +  +  -  :          45 :        ABI_MALLOC(dmatpawu_tmp,(dmatsize))
          +  -  +  -  -  
                +  -  + ]
    4480                 :          15 :        iat=1;jj=1
    4481         [ +  + ]:          64 :        do iatom=1,natom
    4482                 :          49 :          lpawu=dtset%lpawu(dtset%typat(iatom))
    4483         [ +  + ]:          64 :          if (lpawu/=-1) then
    4484                 :          26 :            isiz=nsp*(2*lpawu+1)**2
    4485                 :             :            dmatpawu_tmp(jj:jj+isiz-1)= &
    4486         [ +  + ]:          52 : &           reshape(dtset%dmatpawu(1:2*lpawu+1,1:2*lpawu+1,1:nsp,iat,iimage),(/isiz/))
    4487                 :          26 :            iat=iat+1;jj=jj+isiz
    4488                 :             :          end if
    4489                 :             :        end do
    4490                 :          15 :        call intagm_img(dmatpawu_tmp,iimage,jdtset,lenstr,dtset%nimage,dmatsize, string,'dmatpawu',tread_alt,'DPR')
    4491         [ -  + ]:          15 :        if(tread_alt==1) then
    4492                 :           0 :          iat=1;jj=1
    4493         [ #  # ]:           0 :          do iatom=1,natom
    4494                 :           0 :            lpawu=dtset%lpawu(dtset%typat(iatom))
    4495         [ #  # ]:           0 :            if (lpawu/=-1) then
    4496                 :           0 :              isiz=nsp*(2*lpawu+1)**2
    4497                 :             :              dtset%dmatpawu(1:2*lpawu+1,1:2*lpawu+1,1:nsp,iat,iimage)= &
    4498   [ #  #  #  #  :           0 : &             reshape(dmatpawu_tmp(jj:jj+isiz-1),(/2*lpawu+1,2*lpawu+1,nsp/))
             #  #  #  # ]
    4499                 :           0 :              iat=iat+1;jj=jj+isiz
    4500                 :             :            end if
    4501                 :             :          end do
    4502                 :             :        end if
    4503         [ -  + ]:          15 :        ABI_FREE(dmatpawu_tmp)
    4504                 :             : 
    4505   [ -  +  -  - ]:          15 :        if (tread/=1.and.tread_alt/=1) then
    4506                 :             :          write(msg, '(3a)' )&
    4507                 :           0 :          'When LDA/GGA+U is activated and usedmatpu/=0, dmatpawu MUST be defined.',ch10,&
    4508                 :           0 :          'Action: add dmatpawu keyword in input file.'
    4509                 :           0 :          ABI_ERROR(msg)
    4510                 :             :        end if
    4511                 :             :      end if
    4512                 :             : 
    4513                 :             :    end if
    4514                 :             : 
    4515                 :             :  end do
    4516                 :             : 
    4517                 :        7010 :  nelectjell=zero
    4518         [ +  + ]:        7010 :  if(dtset%jellslab/=0)then
    4519                 :           6 :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'slabwsrad',tread,'LEN')
    4520         [ +  - ]:           6 :    if(tread==1) dtset%slabwsrad=dprarr(1)
    4521                 :             : 
    4522                 :             :    ! Update number of electrons taking into account jellium
    4523                 :             :    ! Suppose that the cell has z axis perpendicular to x and y axes.
    4524                 :             :    ! This will be checked later
    4525                 :           6 :    areaxy=abs(dtset%rprimd_orig(1,1,1)*dtset%rprimd_orig(2,2,1)-dtset%rprimd_orig(1,2,1)*dtset%rprimd_orig(2,1,1))
    4526                 :           6 :    rhoavg=three/(four_pi*dtset%slabwsrad**3)
    4527                 :           6 :    nelectjell=areaxy*(dtset%slabzend-dtset%slabzbeg)*rhoavg
    4528                 :             :  end if
    4529                 :             : 
    4530                 :             :  ! Initialize occ if occopt==1 or 3 ... 8,
    4531                 :             :  ! while if getocc/=0, make a fake initialization
    4532                 :             :  ! If iscf>0, check the charge of the system, and compute nelect.
    4533                 :        7010 :  occopt_tmp=occopt
    4534         [ +  + ]:        7010 :  if(getocc/=0)occopt_tmp=1
    4535                 :        7010 :  call dtset%initocc_chkneu(nelectjell,occopt_tmp)
    4536                 :             : 
    4537                 :             :  ! Now that the occupation numbers have been initialized, can meaningfully define nbandhf.
    4538                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'nbandhf',tread,'INT')
    4539         [ +  + ]:        7010 :  if(tread==1) then
    4540                 :          13 :    dtset%nbandhf=intarr(1)
    4541                 :             :  else
    4542                 :             :    ! If the occupation numbers might change, must keep the maximum number of bands
    4543         [ +  + ]:        6997 :    if(occopt>=3 .and. occopt<=9)then
    4544         [ +  + ]:       50323 :      dtset%nbandhf=maxval(dtset%nband(1:nkpt*nsppol))
    4545         [ +  - ]:        4459 :    else if(occopt==0 .or. occopt==1 .or. occopt==2) then
    4546                 :             :      ! Eliminate all the bands that are never occupied
    4547                 :        4459 :      nband1=0 ; bantot=0
    4548         [ +  + ]:        9301 :      do isppol=1,dtset%nsppol
    4549         [ +  + ]:       79266 :        do ikpt=1,dtset%nkpt
    4550         [ +  + ]:      612534 :          do iband=1,dtset%nband(ikpt+(isppol-1)*dtset%nkpt)
    4551                 :      537727 :            bantot=bantot+1
    4552   [ +  -  -  +  :     1687877 :            if(maxval(abs(dtset%occ_orig(bantot,:)))>tol8)then
          -  -  +  +  +  
                      + ]
    4553                 :      537727 :              if(iband>nband1)nband1=iband
    4554                 :             :            end if
    4555                 :             :          end do
    4556                 :             :        end do
    4557                 :             :      end do
    4558                 :        4459 :      dtset%nbandhf=nband1
    4559                 :             :    else
    4560                 :           0 :      write(msg, '(a,i0,3a)' )'occopt=',occopt,' not allowed.',ch10,'Action: correct your input file.'
    4561                 :           0 :      ABI_ERROR(msg)
    4562                 :             :    end if
    4563                 :             :  end if
    4564                 :             : 
    4565                 :             :  ! Initialize Berry phase vectors
    4566                 :             :  ! Should check that nberry is smaller than 20
    4567         [ +  + ]:        7010 :  if(berryopt>0 .and. nberry>0)then
    4568                 :          26 :    call intagm(dprarr,intarr,jdtset,marr,3*nberry,string(1:lenstr),'kberry',tread,'INT')
    4569   [ -  +  -  -  :          26 :    if(tread==1) dtset%kberry(1:3,1:nberry)=reshape(intarr(1:3*nberry), [3,nberry])
             -  -  -  - ]
    4570                 :             :  end if
    4571                 :             : 
    4572                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'ddamp',tread,'DPR')
    4573         [ -  + ]:        7010 :  if (tread==1) dtset%ddamp = dprarr(1)
    4574                 :             : 
    4575                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,3,string(1:lenstr),'polcen',tread,'DPR')
    4576   [ -  +  -  - ]:        7010 :  if (tread==1) dtset%polcen(1:3) = dprarr(1:3)
    4577                 :             : 
    4578                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,ntypat,string(1:lenstr),'densty',tread,'DPR')
    4579   [ +  +  +  + ]:        7098 :  if(tread==1) dtset%densty(1:ntypat,1)=dprarr(1:ntypat)
    4580                 :             : 
    4581                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,npsp,string(1:lenstr),'so_psp',tread,'INT')
    4582   [ +  +  +  +  :        7213 :  if (tread==1.and.dtset%usepaw==0) dtset%so_psp(1:npsp) = intarr(1:npsp)
                   +  + ]
    4583                 :             : 
    4584                 :             :  ! LOTF variables
    4585                 :             : #if defined HAVE_LOTF
    4586                 :             :  if(dtset%ionmov==23) then
    4587                 :             :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'lotf_classic',tread,'INT')
    4588                 :             :    if(tread==1) dtset%lotf_classic=intarr(1)
    4589                 :             :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'lotf_nitex',tread,'INT')
    4590                 :             :    if(tread==1) dtset%lotf_nitex=intarr(1)
    4591                 :             :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'lotf_nneigx',tread,'INT')
    4592                 :             :    if(tread==1) dtset%lotf_nneigx=intarr(1)
    4593                 :             :    call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'lotf_version',tread,'INT')
    4594                 :             :    if(tread==1) dtset%lotf_version=intarr(1)
    4595                 :             :  end if
    4596                 :             : #endif
    4597                 :             : 
    4598                 :             : !Read input variables related to Projected Local Orbitals Wannier functions (plowan)
    4599                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'plowan_bandi',tread,'INT')
    4600         [ -  + ]:        7010 :  if(tread==1) dtset%plowan_bandi=intarr(1)
    4601                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'plowan_bandf',tread,'INT')
    4602         [ -  + ]:        7010 :  if(tread==1) dtset%plowan_bandf=intarr(1)
    4603                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'plowan_realspace',tread,'INT')
    4604         [ -  + ]:        7010 :  if(tread==1) dtset%plowan_realspace=intarr(1)
    4605                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'plowan_natom',tread,'INT')
    4606         [ -  + ]:        7010 :  if(tread==1) dtset%plowan_natom=intarr(1)
    4607                 :        7010 :  call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'plowan_nt',tread,'INT')
    4608         [ -  + ]:        7010 :  if(tread==1) dtset%plowan_nt=intarr(1)
    4609                 :             : 
    4610                 :             : ! if (dtset%plowan_compute>0) then
    4611                 :        7010 :    call intagm(dprarr,intarr,jdtset,marr,3*dtset%plowan_nt,string(1:lenstr),'plowan_it',tread,'INT')
    4612   [ -  +  -  - ]:        7010 :    if(tread==1) dtset%plowan_it(1:3*dtset%plowan_nt)=intarr(1:3*dtset%plowan_nt)
    4613                 :             : 
    4614                 :        7010 :    call intagm(dprarr,intarr,jdtset,marr,dtset%plowan_natom,string(1:lenstr),'plowan_iatom',tread,'INT')
    4615   [ -  +  -  - ]:        7010 :    if(tread==1) dtset%plowan_iatom(1:dtset%plowan_natom)=intarr(1:dtset%plowan_natom)
    4616                 :             : 
    4617                 :        7010 :    call intagm(dprarr,intarr,jdtset,marr,dtset%plowan_natom,string(1:lenstr),'plowan_nbl',tread,'INT')
    4618   [ -  +  -  - ]:        7010 :    if(tread==1) dtset%plowan_nbl(1:dtset%plowan_natom)=intarr(1:dtset%plowan_natom)
    4619         [ +  + ]:       61874 :    sumnbl=sum(dtset%plowan_nbl(:))
    4620                 :             : 
    4621                 :        7010 :    call intagm(dprarr,intarr,jdtset,marr,sumnbl,string(1:lenstr),'plowan_lcalc',tread,'INT')
    4622   [ -  +  -  - ]:        7010 :    if(tread==1) dtset%plowan_lcalc(1:sumnbl)=intarr(1:sumnbl)
    4623                 :             : 
    4624                 :        7010 :    call intagm(dprarr,intarr,jdtset,marr,sumnbl,string(1:lenstr),'plowan_projcalc',tread,'INT')
    4625   [ -  +  -  - ]:        7010 :    if(tread==1) dtset%plowan_projcalc(1:sumnbl)=intarr(1:sumnbl)
    4626                 :             : ! end if
    4627                 :             : 
    4628                 :             : 
    4629   [ -  +  -  - ]:        7010 :    if ((dtset%ucrpa > 0 .and. dtset%plowan_compute >=0 )) then
    4630                 :             :    !   dtset%plowan_natom=1
    4631                 :             :    !   dtset%plowan_nbl(:)=1
    4632                 :           0 :      dtset%plowan_nt=1
    4633         [ #  # ]:           0 :      dtset%plowan_it(:)=0
    4634                 :           0 :      dtset%plowan_realspace=1
    4635                 :             :    !   call intagm(dprarr,intarr,jdtset,marr,1,string(1:lenstr),'dmft_t2g',tread,'INT')
    4636                 :             :    !   if(tread==1) dtset%dmft_t2g=intarr(1)
    4637                 :             :    !   do iatom=1,dtset%natom
    4638                 :             :    !     lpawu=dtset%lpawu(dtset%typat(iatom))
    4639                 :             :    !     if (lpawu/=-1) then
    4640                 :             :    !       dtset%plowan_lcalc(:)=lpawu
    4641                 :             :    !       dtset%plowan_iatom(:)=iatom
    4642                 :             :    !       dtset%plowan_projcalc(:)=-2
    4643                 :             :    !     end if
    4644                 :             :    !   end do
    4645                 :             :    !   dtset%plowan_bandi=dtset%dmftbandi
    4646                 :             :    !   dtset%plowan_bandf=dtset%dmftbandf
    4647                 :             :    !   if (dtset%nbandkss /= 0 .and. dtset%usedmft/=0) then
    4648                 :             :    !     dtset%plowan_compute=1
    4649                 :             :    !     dtset%usedmft=0
    4650                 :             :    !   else if (dtset%optdriver==3) then
    4651                 :             :    !     dtset%plowan_compute=10
    4652                 :             :    !   else if(dtset%optdriver==4) then
    4653                 :             :    !     dtset%plowan_compute=10
    4654                 :             :    !   end if
    4655                 :             :    end if
    4656                 :             : 
    4657                 :             :  ! band range for self-energy sum
    4658                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, 2, string(1:lenstr), 'sigma_bsum_range', tread, 'INT')
    4659         [ +  + ]:        7010 :  if (tread == 1) then
    4660         [ +  + ]:           6 :     dtset%sigma_bsum_range = intarr(1:2)
    4661   [ +  +  +  -  :           6 :     ABI_CHECK(all(dtset%sigma_bsum_range > 0), "sigma_bsum_range cannot be negative")
                   -  + ]
    4662         [ -  + ]:           2 :     ABI_CHECK(dtset%sigma_bsum_range(2) >= dtset%sigma_bsum_range(1), "sigma_bsum_range(2) must be >= (1)")
    4663                 :             :  end if
    4664                 :             : 
    4665                 :             :  ! band range for self-energy corrections.
    4666                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, 2, string(1:lenstr), 'sigma_erange', tread, 'ENE')
    4667         [ +  + ]:        7010 :  if (tread == 1) then
    4668         [ +  + ]:          57 :    dtset%sigma_erange = dprarr(1:2)
    4669                 :             :    !if (all(dtset%sigma_erange < zero) .and. .not. tread_dipdip == 1) dtset%dipdip = 0
    4670                 :             :  end if
    4671                 :             : 
    4672                 :             :  ! IBZ k-points for transport calculation in terms of transport_ngkpt
    4673                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, 3, string(1:lenstr), 'transport_ngkpt', tread, 'INT')
    4674   [ +  +  +  + ]:        7013 :  if (tread == 1) dtset%transport_ngkpt = intarr(1:3)
    4675                 :             : 
    4676                 :             :  ! IBZ k-points for electron self-energy given in terms of sigma_ngkpt
    4677                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, 3, string(1:lenstr), 'sigma_ngkpt', tread, 'INT')
    4678                 :             : 
    4679         [ +  + ]:        7010 :  if (tread == 1) then
    4680                 :             :    ! sigma_ngkpt mode --> initialize shifts, provide default if not given in input
    4681                 :             :    ! Consistency check: nkptgw must be zero, sigma_erange should not be given.
    4682         [ -  + ]:           8 :    ABI_CHECK(dtset%nkptgw == 0, "nkptgw and sigma_ngkpt are mutually exclusive.")
    4683                 :             : 
    4684         [ +  + ]:          32 :    dtset%sigma_ngkpt = intarr(1:3)
    4685                 :           8 :    call intagm(dprarr, intarr, jdtset, marr, 1, string(1:lenstr), 'sigma_nshiftk', tread, 'INT')
    4686         [ +  + ]:           8 :    if (tread == 1) dtset%sigma_nshiftk = intarr(1)
    4687         [ -  + ]:           8 :    if (dtset%sigma_nshiftk < 1 .or. dtset%sigma_nshiftk > MAX_NSHIFTK ) then
    4688                 :             :      write(msg, '(a,i0,2a,i0,3a)' ) &
    4689                 :           0 :      'The only allowed values of nshiftk are between 1 and ',MAX_NSHIFTK,ch10,&
    4690                 :           0 :      'while it is found to be ',dtset%sigma_nshiftk,'.',ch10,&
    4691                 :           0 :      'Action: change the value of sigma_nshiftk in your input file, or change kptopt.'
    4692                 :           0 :      ABI_ERROR(msg)
    4693                 :             :    end if
    4694                 :             : 
    4695                 :           8 :    call intagm(dprarr, intarr, jdtset, marr, 3*dtset%sigma_nshiftk, string(1:lenstr), 'sigma_shiftk', tread, 'DPR')
    4696                 :             :    ! Yes, I know that multidatasets will likely crash if sigma_nshiftk changes...
    4697   [ -  +  +  -  :          56 :    ABI_CALLOC(dtset%sigma_shiftk, (3, dtset%sigma_nshiftk))
          +  -  +  -  -  
          +  -  +  -  +  
             +  +  +  + ]
    4698         [ +  + ]:           8 :    if (tread == 1) then
    4699   [ +  +  +  +  :          14 :      dtset%shiftk(:,1:dtset%sigma_nshiftk) = reshape(dprarr(1:3*dtset%sigma_nshiftk), [3,dtset%sigma_nshiftk])
                   +  + ]
    4700                 :             :    end if
    4701                 :             :  end if
    4702                 :             : 
    4703                 :        7010 :  call intagm(dprarr, intarr, jdtset, marr, 1, string(1:lenstr), "wfk_task", tread, 'KEY', key_value=key_value)
    4704         [ +  + ]:        7010 :  if (tread==1) dtset%wfk_task = str2wfktask(tolower(key_value))
    4705   [ +  +  -  + ]:        7010 :  if (dtset%optdriver == RUNL_WFK .and. dtset%wfk_task == WFK_TASK_NONE) then
    4706                 :           0 :     ABI_ERROR(sjoin("A valid wfk_task must be specified when optdriver= ", itoa(dtset%optdriver), ", Received:", key_value))
    4707                 :             :  end if
    4708                 :             : 
    4709         [ +  + ]:        7010 :  if (dtset%use_gbt /= 0) then
    4710                 :          14 :    call intagm(dprarr, intarr, jdtset, marr, 3, string(1:lenstr), 'qgbt', tread_qgbt, 'DPR')
    4711   [ +  -  +  + ]:          56 :    if (tread_qgbt == 1) dtset%qgbt(1:3) = dprarr(1:3)
    4712                 :          14 :    call intagm(dprarr, intarr, jdtset, marr, 3, string(1:lenstr), 'qgbt_cart', tread_cart, 'DPR')
    4713   [ +  -  -  + ]:          14 :    if (tread_qgbt ==1 .and. tread_cart == 1) then
    4714                 :           0 :      ABI_ERROR("Both 'qgbt' and 'qgbt_cart' are defined, choose to define only one of these.")
    4715         [ -  + ]:          14 :    else if (tread_cart == 1) then
    4716         [ #  # ]:           0 :      dtset%qgbt_cart = dprarr(1:3)
    4717   [ #  #  #  #  :           0 :      call mkrdim(dtset%acell_orig(1:3,1),dtset%rprim_orig(1:3,1:3,1),rprimd)
                   #  # ]
    4718   [ #  #  #  #  :           0 :      dtset%qgbt(1:3) = MATMUL(TRANSPOSE(rprimd)/two_pi, dtset%qgbt_cart)
          #  #  #  #  #  
                      # ]
    4719                 :             :    end if
    4720                 :             :  end if
    4721                 :             : 
    4722         [ -  + ]:        7010 :  ABI_FREE(intarr)
    4723         [ -  + ]:        7010 :  ABI_FREE(dprarr)
    4724                 :             : 
    4725         [ -  + ]:        7010 :  if (dtset%nqptdm == -1) then
    4726   [ #  #  #  #  :           0 :    cryst = dtset%get_crystal(1)
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
                   #  # ]
    4727                 :             :    !call cryst%print(mode_paral='COLL')
    4728                 :           0 :    call Kmesh%init(Cryst, dtset%nkpt, dtset%kptns, Dtset%kptopt, wrap_1zone=.FALSE.)
    4729                 :             : 
    4730                 :             :    ! Some required information are not filled up inside kmesh_init
    4731                 :             :    ! So doing it here, even though it is not clean
    4732   [ #  #  #  # ]:           0 :    Kmesh%kptrlatt(:,:) = Dtset%kptrlatt(:,:)
    4733                 :           0 :    Kmesh%nshift = Dtset%nshiftk
    4734   [ #  #  #  #  :           0 :    ABI_MALLOC(Kmesh%shift, (3, Kmesh%nshift))
          #  #  #  #  #  
             #  #  #  #  
                      # ]
    4735   [ #  #  #  # ]:           0 :    Kmesh%shift(:,:) = Dtset%shiftk(:,1:Dtset%nshiftk)
    4736                 :             :    !call Kmesh%print("K-mesh for the wavefunctions",ab_out, dtset%prtvol)
    4737                 :           0 :    call Qmesh%find_qmesh(Cryst, Kmesh)
    4738         [ #  # ]:           0 :    if (my_rank == master) then
    4739         [ #  # ]:           0 :      NCF_CHECK(nctk_write_ibz("qptdms.nc", qmesh%ibz, qmesh%wt))
    4740                 :             :    end if
    4741                 :           0 :    call xmpi_barrier(comm)
    4742                 :           0 :    ABI_ERROR_NODUMP("Aborting now")
    4743                 :             :  end if
    4744                 :             : 
    4745                 :        7010 :  call timab(191,2,tsec)
    4746                 :             : 
    4747   [ -  +  -  +  :        7010 : end subroutine invars2
          -  +  -  +  -  
          +  -  +  -  +  
          -  +  -  +  -  
          +  -  +  -  +  
          -  +  -  +  -  
          +  -  +  -  +  
          -  +  -  +  -  
          +  -  +  -  +  
          -  +  -  +  -  
          +  -  +  -  +  
          -  +  -  +  -  
          +  -  +  -  +  
          -  +  -  +  -  
          +  -  +  -  +  
          -  +  -  +  -  
                      + ]
    4748                 :             : !!***
    4749                 :             : 
    4750                 :             : end module m_invars2
    4751                 :             : !!***
        

Generated by: LCOV version 2.3-1