TABLE OF CONTENTS


ABINIT/mod_prc_memory [ Modules ]

[ Top ] [ Modules ]

NAME

 mod_prc_memory

FUNCTION

 This modules defines arrays and data used for the real-space kerker
 preconditionning of potential residuals.

COPYRIGHT

 Copyright (C) 2009-2022 ABINIT group (PMA).
 This file is distributed under the terms of the
 GNU General Public License, see ~abinit/COPYING
 or http://www.gnu.org/copyleft/gpl.txt .
 For the initials of contributors, see ~abinit/doc/developers/contributors.txt .

NOTES

  FIXME: this is highly non-kosher. Should be a datastructure which is declared dynamically
  MG: I completely agree! We don't use modules to share data and I don't see why we should
  break the rule here.

SOURCE

23 #if defined HAVE_CONFIG_H
24 #include "config.h"
25 #endif
26 
27 #include "abi_common.h"
28 
29 module mod_prc_memory
30 
31  use defs_basis
32  use m_abicore
33 
34  implicit none
35 
36 private
37 
38   real(dp),public,save,allocatable :: rdiemac(:)
39 
40   integer,save,public :: cycle=0 ! This is great! A global variable with the same name as a Fortran Statement!
41   real(dp),save,public :: energy_min
42 
43 public :: prc_mem_init
44 public :: prc_mem_free
45 
46 ! *********************************************************************
47 
48  contains

ABINIT/prc_mem_free [ Functions ]

[ Top ] [ Functions ]

NAME

 prc_mem_free

FUNCTION

 This subroutine deallocates the module's main component

SOURCE

 90 subroutine prc_mem_free()
 91 
 92 implicit none
 93 
 94 ! *********************************************************************
 95 
 96    if (allocated(rdiemac))  then
 97      ABI_FREE(rdiemac)
 98    end if
 99 
100  end subroutine prc_mem_free

ABINIT/prc_mem_init [ Functions ]

[ Top ] [ Functions ]

NAME

 prc_mem_init

FUNCTION

 This subroutine allocates the module's main component

SOURCE

60 subroutine prc_mem_init(nfft)
61 
62 implicit none
63 
64 !Arguments -------------------------------
65 integer, intent(in) :: nfft
66 !Local variables -------------------------
67 ! *********************************************************************
68 
69    if (.not. allocated(rdiemac))  then
70      ABI_MALLOC(rdiemac,(nfft))
71    end if
72    if(nfft.ne.size(rdiemac)) then ! This steps should be done over "istep" instead
73      ABI_FREE(rdiemac)
74      ABI_MALLOC(rdiemac,(nfft))
75      cycle=0
76    end if
77 
78  end subroutine prc_mem_init