1! ---
2! Copyright (C) 1996-2016	The SIESTA group
3!  This file is distributed under the terms of the
4!  GNU General Public License: see COPYING in the top directory
5!  or http://www.gnu.org/copyleft/gpl.txt .
6! See Docs/Contributors.txt for a list of contributors.
7! ---
8      module meshphi
9
10      use precision, only : grid_p, phi_grid_p
11
12      implicit none
13
14      public :: resetMeshPhi
15
16! ----------------------------------------------------------------------
17! Stores variables and arrays related to basis orbitals on the mesh
18! ----------------------------------------------------------------------
19! logical DirectPhi     : If true the phi is calculated on the fly
20! integer endpht(0:nmpl): Last position occupied by points in lstpht
21! integer lstpht(ntopl) : List of non-zero orbitals at point
22! integer listp2(ntopl) : Maps orbital-mesh point to iop
23! integer nphi          : Length of phi array second dimension
24! real    phi(nsp,ntopl): Basis orbitals at mesh points (sparse)
25! ----------------------------------------------------------------------
26      logical,                   save :: DirectPhi
27      integer,                   save :: nphi
28      integer,          pointer, save :: endpht(:)
29      integer,          pointer, save :: lstpht(:)
30      integer,          pointer, save :: listp2(:)
31      real(phi_grid_p), pointer, save :: phi(:,:)
32
33      CONTAINS
34
35      subroutine resetMeshPhi( )
36!
37! Deallocate arrays of module meshphi if necessary
38!
39      use alloc,         only : de_alloc
40
41      implicit none
42
43      if (associated(endpht))
44     $     call de_alloc( endpht, 'endpht',  'PhiOnMesh' )
45      if (associated(lstpht))
46     $     call de_alloc( lstpht, 'lstpht',  'PhiOnMesh' )
47      if (associated(listp2))
48     $     call de_alloc( listp2, 'listp2',  'PhiOnMesh' )
49      if (associated(phi))
50     $     call de_alloc( phi, 'phi',  'PhiOnMesh' )
51
52      end subroutine resetMeshPhi
53
54      end module meshphi
55
56!
57