TABLE OF CONTENTS


ABINIT/wvl_denspot_free [ Functions ]

[ Top ] [ Functions ]

NAME

  wvl_denspot_free

FUNCTION

  FIXME: add description.

COPYRIGHT

  Copyright (C) 2012-2018 ABINIT group (FIXME: add author)
  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

      gstate,wvl_wfsinp_reformat

CHILDREN

      deallocate_denspot_distribution,deallocate_rho_descriptors
      denspot_free_history,f_free_ptr

SOURCE

 34 #if defined HAVE_CONFIG_H
 35 #include "config.h"
 36 #endif
 37 
 38 #include "abi_common.h"
 39 
 40 subroutine wvl_denspot_free(den)
 41     
 42  use defs_basis
 43  use defs_wvltypes
 44  use m_profiling_abi
 45  use m_errors
 46 #if defined HAVE_BIGDFT
 47  use BigDFT_API, only: deallocate_rho_descriptors, &
 48       & deallocate_denspot_distribution, denspot_free_history
 49  use dynamic_memory
 50 #endif
 51 
 52 !This section has been created automatically by the script Abilint (TD).
 53 !Do not modify the following lines by hand.
 54 #undef ABI_FUNC
 55 #define ABI_FUNC 'wvl_denspot_free'
 56 !End of the abilint section
 57 
 58  implicit none
 59 
 60 !Arguments ------------------------------------
 61  type(wvl_denspot_type), intent(inout) :: den
 62 
 63 !Local variables-------------------------------
 64  
 65 ! *************************************************************************
 66  
 67 !DEBUG
 68 !write (std_out,*) ' wvl_denspot_free : enter'
 69 !ENDDEBUG
 70 
 71 #if defined HAVE_BIGDFT
 72  if(associated(den%denspot%rhov)) then
 73    call f_free_ptr(den%denspot%rhov)
 74  end if
 75  if(associated(den%denspot%rho_psi)) then
 76    call f_free_ptr(den%denspot%rho_psi)
 77  end if
 78  if(associated(den%denspot%rho_C)) then
 79    call f_free_ptr(den%denspot%rho_C)
 80  end if
 81  if(associated(den%denspot%V_ext)) then
 82    call f_free_ptr(den%denspot%V_ext)
 83  end if
 84  if(associated(den%denspot%V_XC)) then
 85    call f_free_ptr(den%denspot%V_XC)
 86  end if
 87  if(associated(den%denspot%Vloc_KS)) then
 88    call f_free_ptr(den%denspot%Vloc_KS)
 89  end if
 90  if(associated(den%denspot%f_XC)) then
 91    call f_free_ptr(den%denspot%f_XC)
 92  end if
 93  if(associated(den%denspot%rho_work)) then
 94    call f_free_ptr(den%denspot%rho_work)
 95  end if
 96  if(associated(den%denspot%pot_work)) then
 97    call f_free_ptr(den%denspot%pot_work)
 98  end if
 99  nullify(den%denspot%rhov)
100  nullify(den%denspot%rho_psi)
101  nullify(den%denspot%rho_C)
102  nullify(den%denspot%V_ext)
103  nullify(den%denspot%V_XC)
104  nullify(den%denspot%Vloc_KS)
105  nullify(den%denspot%f_XC)
106  nullify(den%denspot%rho_work)
107  nullify(den%denspot%pot_work)
108  !
109  call deallocate_rho_descriptors(den%denspot%rhod)
110  call deallocate_denspot_distribution(den%denspot%dpbox)
111  call denspot_free_history(den%denspot)
112 #else
113  BIGDFT_NOTENABLED_ERROR()
114  if (.false.) write(std_out,*) den%symObj
115 #endif
116 
117 end subroutine wvl_denspot_free