Line data Source code
1 : !!****m* ABINIT/mod_prc_memory
2 : !! NAME
3 : !! mod_prc_memory
4 : !!
5 : !! FUNCTION
6 : !! This modules defines arrays and data used for the real-space kerker
7 : !! preconditionning of potential residuals.
8 : !!
9 : !! COPYRIGHT
10 : !! Copyright (C) 2009-2026 ABINIT group (PMA).
11 : !! This file is distributed under the terms of the
12 : !! GNU General Public License, see ~abinit/COPYING
13 : !! or http://www.gnu.org/copyleft/gpl.txt .
14 : !! For the initials of contributors, see ~abinit/doc/developers/contributors.txt .
15 : !!
16 : !! NOTES
17 : !! FIXME: this is highly non-kosher. Should be a datastructure which is declared dynamically
18 : !! MG: I completely agree! We don't use modules to share data and I don't see why we should
19 : !! break the rule here.
20 : !!
21 : !! SOURCE
22 :
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
49 : !!***
50 :
51 : !!****f* ABINIT/prc_mem_init
52 : !! NAME
53 : !! prc_mem_init
54 : !!
55 : !! FUNCTION
56 : !! This subroutine allocates the module's main component
57 : !!
58 : !! SOURCE
59 :
60 7 : subroutine prc_mem_init(nfft)
61 :
62 : !Arguments -------------------------------
63 : integer, intent(in) :: nfft
64 : !Local variables -------------------------
65 : ! *********************************************************************
66 :
67 7 : if (.not. allocated(rdiemac)) then
68 3 : ABI_MALLOC(rdiemac,(nfft))
69 : end if
70 7 : if(nfft.ne.size(rdiemac)) then ! This steps should be done over "istep" instead
71 0 : ABI_FREE(rdiemac)
72 0 : ABI_MALLOC(rdiemac,(nfft))
73 0 : cycle=0
74 : end if
75 :
76 7 : end subroutine prc_mem_init
77 : !!***
78 :
79 : !!****f* ABINIT/prc_mem_free
80 : !! NAME
81 : !! prc_mem_free
82 : !!
83 : !! FUNCTION
84 : !! This subroutine deallocates the module's main component
85 : !!
86 : !! SOURCE
87 :
88 6918 : subroutine prc_mem_free()
89 :
90 : ! *********************************************************************
91 :
92 6918 : ABI_SFREE(rdiemac)
93 :
94 6918 : end subroutine prc_mem_free
95 : !!***
96 :
97 : end module mod_prc_memory
98 : !!***
|