LCOV - code coverage report
Current view: top level - src/57_iovars - m_invars2.F90 (source / functions) Coverage Total Hit
Test: coverage.info Lines: 87.6 % 2910 2549
Test Date: 2026-11-08 00:10:28 Functions: 100.0 % 2 2
Branches: 73.9 % 3824 2826

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

Generated by: LCOV version 2.3-1