TABLE OF CONTENTS


ABINIT/paw2wvl_ij [ Functions ]

[ Top ] [ Functions ]

NAME

  paw2wvl_ij

FUNCTION

  FIXME: add description.

COPYRIGHT

  Copyright (C) 2012-2018 ABINIT group (TR, MT)
  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

      scfcv

CHILDREN

      nullify_paw_ij_objects

SOURCE

 33 #if defined HAVE_CONFIG_H
 34 #include "config.h"
 35 #endif
 36 
 37 #include "abi_common.h"
 38 
 39 subroutine paw2wvl_ij(option,paw_ij,wvl)
 40     
 41  use defs_basis
 42  use defs_wvltypes
 43  use m_profiling_abi
 44  use m_errors
 45  use m_paw_ij, only : paw_ij_type
 46 
 47 #if defined HAVE_BIGDFT
 48  use BigDFT_API, only : nullify_paw_ij_objects
 49 #endif
 50 
 51 !This section has been created automatically by the script Abilint (TD).
 52 !Do not modify the following lines by hand.
 53 #undef ABI_FUNC
 54 #define ABI_FUNC 'paw2wvl_ij'
 55 !End of the abilint section
 56 
 57  implicit none
 58 
 59 !Arguments ------------------------------------
 60  integer,intent(in)::option
 61  type(wvl_internal_type), intent(inout)::wvl
 62  type(paw_ij_type),intent(in) :: paw_ij(:)
 63 !Local variables-------------------------------
 64 #if defined HAVE_BIGDFT
 65  integer :: iatom,iaux,my_natom
 66  character(len=500) :: message
 67 #endif
 68  
 69 ! *************************************************************************
 70  
 71  DBG_ENTER("COLL")
 72 
 73 #if defined HAVE_BIGDFT
 74  my_natom=size(paw_ij)
 75 
 76 !Option==1: allocate and copy
 77  if(option==1) then
 78    ABI_DATATYPE_ALLOCATE(wvl%paw%paw_ij,(my_natom))
 79    do iatom=1,my_natom
 80      call nullify_paw_ij_objects(wvl%paw%paw_ij(iatom))
 81      wvl%paw%paw_ij(iatom)%cplex          =paw_ij(iatom)%cplex
 82      wvl%paw%paw_ij(iatom)%cplex_dij      =paw_ij(iatom)%cplex_dij
 83      wvl%paw%paw_ij(iatom)%has_dij        =paw_ij(iatom)%has_dij
 84      wvl%paw%paw_ij(iatom)%has_dijfr      =0
 85      wvl%paw%paw_ij(iatom)%has_dijhartree =0
 86      wvl%paw%paw_ij(iatom)%has_dijhat     =0
 87      wvl%paw%paw_ij(iatom)%has_dijso      =0
 88      wvl%paw%paw_ij(iatom)%has_dijU       =0
 89      wvl%paw%paw_ij(iatom)%has_dijxc      =0
 90      wvl%paw%paw_ij(iatom)%has_dijxc_val  =0
 91      wvl%paw%paw_ij(iatom)%has_exexch_pot =0
 92      wvl%paw%paw_ij(iatom)%has_pawu_occ   =0
 93      wvl%paw%paw_ij(iatom)%lmn_size       =paw_ij(iatom)%lmn_size
 94      wvl%paw%paw_ij(iatom)%lmn2_size      =paw_ij(iatom)%lmn2_size
 95      wvl%paw%paw_ij(iatom)%ndij           =paw_ij(iatom)%ndij
 96      wvl%paw%paw_ij(iatom)%nspden         =paw_ij(iatom)%nspden
 97      wvl%paw%paw_ij(iatom)%nsppol         =paw_ij(iatom)%nsppol
 98      if (paw_ij(iatom)%has_dij/=0) then
 99        iaux=paw_ij(iatom)%cplex_dij*paw_ij(iatom)%lmn2_size
100        ABI_ALLOCATE(wvl%paw%paw_ij(iatom)%dij,(iaux,paw_ij(iatom)%ndij))
101        wvl%paw%paw_ij(iatom)%dij(:,:)=paw_ij(iatom)%dij(:,:)
102      end if
103    end do
104 
105 !  Option==2: deallocate
106  elseif(option==2) then
107    do iatom=1,my_natom
108      wvl%paw%paw_ij(iatom)%has_dij=0
109      if (associated(wvl%paw%paw_ij(iatom)%dij)) then
110        ABI_DEALLOCATE(wvl%paw%paw_ij(iatom)%dij)
111      end if
112    end do
113    ABI_DATATYPE_DEALLOCATE(wvl%paw%paw_ij)
114 
115 !  Option==3: only copy
116  elseif(option==3) then
117    do iatom=1,my_natom  
118      wvl%paw%paw_ij(iatom)%cplex     =paw_ij(iatom)%cplex
119      wvl%paw%paw_ij(iatom)%cplex_dij =paw_ij(iatom)%cplex_dij
120      wvl%paw%paw_ij(iatom)%lmn_size  =paw_ij(iatom)%lmn_size
121      wvl%paw%paw_ij(iatom)%lmn2_size =paw_ij(iatom)%lmn2_size
122      wvl%paw%paw_ij(iatom)%ndij      =paw_ij(iatom)%ndij
123      wvl%paw%paw_ij(iatom)%nspden    =paw_ij(iatom)%nspden
124      wvl%paw%paw_ij(iatom)%nsppol    =paw_ij(iatom)%nsppol
125      wvl%paw%paw_ij(iatom)%dij(:,:)  =paw_ij(iatom)%dij(:,:)
126    end do 
127    
128  else 
129    message = 'paw2wvl_ij: option should be equal to 1, 2 or 3'
130    MSG_ERROR(message)
131  end if
132 
133 #else
134  if (.false.) write(std_out,*) option,wvl%h(1),paw_ij(1)%ndij
135 #endif
136 
137  DBG_EXIT("COLL")
138 
139 end subroutine paw2wvl_ij