TABLE OF CONTENTS


ABINIT/wvl_prcref [ Functions ]

[ Top ] [ Functions ]

NAME

  wvl_prcref

FUNCTION

  FIXME: add description.

COPYRIGHT

  Copyright (C) 2012-2018 ABINIT group (T. Rangel)
  This file is distributed under the terms of the
  GNU General Public License, see ~abinit/COPYING
  or http://www.gnu.org/copyleft/gpl.txt .

INPUTS

  argin(sizein)=description

OUTPUT

  argout(sizeout)=description

SIDE EFFECTS

NOTES

PARENTS

      newrho,newvtr

CHILDREN

SOURCE

 32 #if defined HAVE_CONFIG_H
 33 #include "config.h"
 34 #endif
 35 
 36 #include "abi_common.h"
 37 
 38 subroutine wvl_prcref(dielar,iprcel,my_natom,nfftprc,npawmix,nspden,pawrhoij,&
 39 & rhoijrespc,usepaw,vresid,vrespc)
 40     
 41  use defs_basis
 42  use m_profiling_abi
 43  use defs_wvltypes
 44  use m_pawrhoij, only : pawrhoij_type
 45  use m_errors
 46 
 47 !This section has been created automatically by the script Abilint (TD).
 48 !Do not modify the following lines by hand.
 49 #undef ABI_FUNC
 50 #define ABI_FUNC 'wvl_prcref'
 51 !End of the abilint section
 52 
 53  implicit none
 54 
 55 !Arguments ------------------------------------
 56  integer , intent(in)  :: iprcel,nfftprc,my_natom,npawmix,nspden,usepaw
 57  real(dp), intent(in)  :: dielar(7)
 58  real(dp), intent(in)  :: vresid(nfftprc,nspden)
 59  real(dp),intent(out) :: rhoijrespc(npawmix)
 60  real(dp),intent(out) :: vrespc(nfftprc,nspden)
 61  type(pawrhoij_type),intent(inout) :: pawrhoij(my_natom*usepaw)
 62 
 63 !Local variables-------------------------------
 64  integer :: iatom,index,ispden,klmn,kmix
 65  real(dp):: diemix,diemixmag,mixfac_eff
 66  character(len=500) :: message                   ! to be uncommented, if needed
 67  
 68 ! *************************************************************************
 69  
 70  DBG_ENTER("COLL")
 71 
 72 !PENDING:
 73 !optres==1, or 0, for density or potential mixing.
 74 !for potential mixing, we have to average over spins.
 75 !check prcref.F90 and moddiel.F90
 76 
 77 
 78 #if defined HAVE_BIGDFT
 79 #endif
 80 
 81  if(iprcel .ne. 0) then
 82    write(message, '(a,i3,a,a,a,a)' )&
 83 &   '  From the calling routine, iprcel=',iprcel,ch10,&
 84 &   '  For wavelets, the only allowed value is 0.',ch10,&
 85 &   '  Action : correct your input file.'
 86    MSG_ERROR(message)
 87  end if
 88 
 89 !call wvl_moddiel  !PENDING
 90  diemix=dielar(4)
 91 !dielng=dielar(2) ; diemac=dielar(3) ; diemix=dielar(4) ; 
 92  diemixmag=abs(dielar(7))
 93  vrespc(:,1)=diemix*vresid(:,1)
 94  if (nspden/=1) vrespc(:,2:nspden)=diemixmag*vresid(:,2:nspden)
 95 
 96 !3) PAW only : precondition the rhoij quantities (augmentation
 97 !occupancies) residuals. Use a simple preconditionning
 98 !with the same mixing factor as the model dielectric function.
 99 
100  if (usepaw==1.and.my_natom>0) then
101 !  mixfac=dielar(4);mixfacmag=abs(dielar(7))
102    if (pawrhoij(1)%cplex==1) then
103      index=0
104      do iatom=1,my_natom
105        do ispden=1,pawrhoij(iatom)%nspden
106          mixfac_eff=diemix;if (ispden>1) mixfac_eff=diemixmag
107          do kmix=1,pawrhoij(iatom)%lmnmix_sz
108            index=index+1;klmn=pawrhoij(iatom)%kpawmix(kmix)
109            rhoijrespc(index)=mixfac_eff*pawrhoij(iatom)%rhoijres(klmn,ispden)
110          end do
111        end do
112      end do
113    else
114      index=-1
115      do iatom=1,my_natom
116        do ispden=1,pawrhoij(iatom)%nspden
117          mixfac_eff=diemix;if (ispden>1) mixfac_eff=diemixmag
118          do kmix=1,pawrhoij(iatom)%lmnmix_sz
119            index=index+2;klmn=2*pawrhoij(iatom)%kpawmix(kmix)-1
120            rhoijrespc(index:index+1)=mixfac_eff*pawrhoij(iatom)%rhoijres(klmn:klmn+1,ispden)
121          end do
122        end do
123      end do
124    end if
125  end if
126 
127 
128 
129  DBG_EXIT("COLL")
130 
131 end subroutine wvl_prcref