## Documentation for module ps_wavelet_util

Performs a wavelet based solution of the Poisson equation.

source: ps_wavelet_util.F

#### public Subroutines/Functions:

SUBROUTINE
f_fft_dimensions (n01, n02, n03, m1, m2, m3, n1, n2, n3, md1, md2, md3, nd1, nd2, nd3, nproc)
Calculate four sets of dimension needed for the calculation of the zero-padded convolution
Calculate the Poisson equation $\nabla^2 V(x,y,z)=-4 \pi \rho(x,y,z)$
SUBROUTINE
p_fft_dimensions (n01, n02, n03, m1, m2, m3, n1, n2, n3, md1, md2, md3, nd1, nd2, nd3, nproc)
Calculate four sets of dimension needed for the calculation of the convolution for the periodic system
SUBROUTINE
s_fft_dimensions (n01, n02, n03, m1, m2, m3, n1, n2, n3, md1, md2, md3, nd1, nd2, nd3, nproc)
Calculate four sets of dimension needed for the calculation of the convolution for the surface system

#### SUBROUTINEf_fft_dimensions(n01, n02, n03, m1, m2, m3, n1, n2, n3, md1, md2, md3, nd1, nd2, nd3, nproc)^

Calculate four sets of dimension needed for the calculation of the zero-padded convolution

##### Arguments:
 INTEGER, INTENT(in) :: n01 original real dimensions (input) INTEGER, INTENT(in) :: n02 original real dimensions (input) INTEGER, INTENT(in) :: n03 original real dimensions (input) INTEGER, INTENT(out) :: m1 original real dimension with the dimension 2 and 3 exchanged INTEGER, INTENT(out) :: m2 original real dimension with the dimension 2 and 3 exchanged INTEGER, INTENT(out) :: m3 original real dimension with the dimension 2 and 3 exchanged INTEGER, INTENT(out) :: n1 ... INTEGER, INTENT(out) :: n2 ... INTEGER, INTENT(out) :: n3 the double of the first FFT even dimension greater than m3 (improved for the HalFFT procedure) INTEGER, INTENT(out) :: md1 half of n1,n2,n3 dimension. They contain the real unpadded space, properly enlarged to be compatible with the FFT dimensions n_i. md2 is further enlarged to be a multiple of nproc INTEGER, INTENT(out) :: md2 half of n1,n2,n3 dimension. They contain the real unpadded space, properly enlarged to be compatible with the FFT dimensions n_i. md2 is further enlarged to be a multiple of nproc INTEGER, INTENT(out) :: md3 half of n1,n2,n3 dimension. They contain the real unpadded space, properly enlarged to be compatible with the FFT dimensions n_i. md2 is further enlarged to be a multiple of nproc INTEGER, INTENT(out) :: nd1 fourier dimensions for which the kernel FFT is injective, formally 1/8 of the fourier grid. Here the dimension nd3 is enlarged to be a multiple of nproc INTEGER, INTENT(out) :: nd2 fourier dimensions for which the kernel FFT is injective, formally 1/8 of the fourier grid. Here the dimension nd3 is enlarged to be a multiple of nproc INTEGER, INTENT(out) :: nd3 fourier dimensions for which the kernel FFT is injective, formally 1/8 of the fourier grid. Here the dimension nd3 is enlarged to be a multiple of nproc INTEGER, INTENT(in) :: nproc ...

#### SUBROUTINEpsolver(geocode, iproc, nproc, n01, n02, n03, hx, hy, hz, rhopot, karray, pw_grid)^

Calculate the Poisson equation $\nabla^2 V(x,y,z)=-4 \pi \rho(x,y,z)$

##### Arguments:
 CHARACTER(1), INTENT(in) :: geocode Indicates the boundary conditions (BC) of the problem: 'F' free BC, isolated systems. The program calculates the solution as if the given density is "alone" in R^3 space. 'S' surface BC, isolated in y direction, periodic in xz plane The given density is supposed to be periodic in the xz plane, so the dimensions in these direction mus be compatible with the FFT Beware of the fact that the isolated direction is y! 'P' periodic BC. The density is supposed to be periodic in all the three directions, then all the dimensions must be compatible with the FFT. No need for setting up the kernel. INTEGER, INTENT(in) :: iproc label of the process,from 0 to nproc-1 INTEGER, INTENT(in) :: nproc number of processors INTEGER, INTENT(in) :: n01 global dimension in the three directions. INTEGER, INTENT(in) :: n02 global dimension in the three directions. INTEGER, INTENT(in) :: n03 global dimension in the three directions. REAL(dp), INTENT(in) :: hx grid spacings. For the isolated BC case for the moment they are supposed to be equal in the three directions REAL(dp), INTENT(in) :: hy grid spacings. For the isolated BC case for the moment they are supposed to be equal in the three directions REAL(dp), INTENT(in) :: hz grid spacings. For the isolated BC case for the moment they are supposed to be equal in the three directions REAL(dp), INTENT(inout) :: rhopot(*) main input/output array. On input, it represents the density values on the grid points On output, it is the Hartree potential, namely the solution of the Poisson equation PLUS (when ixc/=0) the XC potential PLUS (again for ixc/=0) the pot_ion array. The output is non overlapping, in the sense that it does not consider the points that are related to gradient and WB calculation REAL(dp), INTENT(in) :: karray(*) kernel of the poisson equation. It is provided in distributed case, with dimensions that are related to the output of the PS_dim4allocation routine it MUST be created by following the same geocode as the Poisson Solver. TYPE(pw_grid_type), POINTER :: pw_grid ...

#### SUBROUTINEp_fft_dimensions(n01, n02, n03, m1, m2, m3, n1, n2, n3, md1, md2, md3, nd1, nd2, nd3, nproc)^

Calculate four sets of dimension needed for the calculation of the convolution for the periodic system

##### Arguments:
 INTEGER, INTENT(in) :: n01 original real dimensions (input) INTEGER, INTENT(in) :: n02 original real dimensions (input) INTEGER, INTENT(in) :: n03 original real dimensions (input) INTEGER, INTENT(out) :: m1 original real dimension, with m2 and m3 exchanged INTEGER, INTENT(out) :: m2 original real dimension, with m2 and m3 exchanged INTEGER, INTENT(out) :: m3 original real dimension, with m2 and m3 exchanged INTEGER, INTENT(out) :: n1 the first FFT dimensions, for the moment supposed to be even INTEGER, INTENT(out) :: n2 the first FFT dimensions, for the moment supposed to be even INTEGER, INTENT(out) :: n3 the first FFT dimensions, for the moment supposed to be even INTEGER, INTENT(out) :: md1 the n1,n2,n3 dimensions. They contain the real unpadded space, properly enlarged to be compatible with the FFT dimensions n_i. md2 is further enlarged to be a multiple of nproc INTEGER, INTENT(out) :: md2 the n1,n2,n3 dimensions. They contain the real unpadded space, properly enlarged to be compatible with the FFT dimensions n_i. md2 is further enlarged to be a multiple of nproc INTEGER, INTENT(out) :: md3 the n1,n2,n3 dimensions. They contain the real unpadded space, properly enlarged to be compatible with the FFT dimensions n_i. md2 is further enlarged to be a multiple of nproc INTEGER, INTENT(out) :: nd1 fourier dimensions for which the kernel is injective, formally 1/8 of the fourier grid. Here the dimension nd3 is enlarged to be a multiple of nproc INTEGER, INTENT(out) :: nd2 fourier dimensions for which the kernel is injective, formally 1/8 of the fourier grid. Here the dimension nd3 is enlarged to be a multiple of nproc INTEGER, INTENT(out) :: nd3 fourier dimensions for which the kernel is injective, formally 1/8 of the fourier grid. Here the dimension nd3 is enlarged to be a multiple of nproc INTEGER, INTENT(in) :: nproc ...

#### SUBROUTINEs_fft_dimensions(n01, n02, n03, m1, m2, m3, n1, n2, n3, md1, md2, md3, nd1, nd2, nd3, nproc)^

Calculate four sets of dimension needed for the calculation of the convolution for the surface system

##### Arguments:
 INTEGER, INTENT(in) :: n01 original real dimensions (input) INTEGER, INTENT(in) :: n02 original real dimensions (input) INTEGER, INTENT(in) :: n03 original real dimensions (input) INTEGER, INTENT(out) :: m1 original real dimension, with 2 and 3 exchanged INTEGER, INTENT(out) :: m2 original real dimension, with 2 and 3 exchanged INTEGER, INTENT(out) :: m3 original real dimension, with 2 and 3 exchanged INTEGER, INTENT(out) :: n1 the first FFT dimensions, for the moment supposed to be even INTEGER, INTENT(out) :: n2 the first FFT dimensions, for the moment supposed to be even INTEGER, INTENT(out) :: n3 the double of the first FFT even dimension greater than m3 (improved for the HalFFT procedure) INTEGER, INTENT(out) :: md1 the n1,n2 dimensions. INTEGER, INTENT(out) :: md2 the n1,n2,n3 dimensions. INTEGER, INTENT(out) :: md3 the half of n3 dimension. They contain the real unpadded space, properly enlarged to be compatible with the FFT dimensions n_i. md2 is further enlarged to be a multiple of nproc INTEGER, INTENT(out) :: nd1 fourier dimensions for which the kernel is injective, formally 1/8 of the fourier grid. Here the dimension nd3 is enlarged to be a multiple of nproc INTEGER, INTENT(out) :: nd2 fourier dimensions for which the kernel is injective, formally 1/8 of the fourier grid. Here the dimension nd3 is enlarged to be a multiple of nproc INTEGER, INTENT(out) :: nd3 fourier dimensions for which the kernel is injective, formally 1/8 of the fourier grid. Here the dimension nd3 is enlarged to be a multiple of nproc INTEGER, INTENT(in) :: nproc ...