15#include "../base/base_uses.f90"
37 INTEGER,
INTENT(in) :: itype, nd
38 INTEGER,
INTENT(out) :: nrange
39 REAL(kind=
dp),
DIMENSION(0:nd),
INTENT(out) :: a, x
41 INTEGER :: i, i_all, m, ni, nt
42 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: y
43 REAL(kind=
dp),
DIMENSION(:),
POINTER :: cg, cgt, ch, cht
54 ALLOCATE (y(0:nd), stat=i_all)
56 cpabort(
"Scaling_function: problem of memory allocation")
67 CALL back_trans(nd, nt, x, y, m, ch, cg)
68 CALL dcopy(nt, y, 1, x, 1)
75 a(i) = 1._dp*i*ni/nd - (.5_dp*ni - 1._dp)
77 DEALLOCATE (ch, cg, cgt, cht)
88 SUBROUTINE wavelet_function(itype, nd, a, x)
91 INTEGER,
INTENT(in) :: itype, nd
92 REAL(kind=
dp),
DIMENSION(0:nd),
INTENT(out) :: a, x
94 INTEGER :: i, i_all, m, ni, nt
95 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: y
96 REAL(kind=
dp),
DIMENSION(:),
POINTER :: cg, cgt, ch, cht
105 ALLOCATE (y(0:nd), stat=i_all)
107 cpabort(
"Wavelet_function: problem of memory allocation")
114 x(nt + nt/2 - 1) = 1._dp
118 CALL back_trans(nd, nt, x, y, m, ch, cg)
119 CALL dcopy(nd, y, 1, x, 1)
127 a(i) = 1._dp*i*ni/nd - (.5_dp*ni - .5_dp)
129 DEALLOCATE (ch, cg, cgt, cht)
132 END SUBROUTINE wavelet_function
143 PURE SUBROUTINE scf_recursion(itype, n_iter, n_range, kernel_scf, kern_1_scf)
144 INTEGER,
INTENT(in) :: itype, n_iter, n_range
145 REAL(kind=
dp),
INTENT(inout) :: kernel_scf(-n_range:n_range)
146 REAL(kind=
dp),
INTENT(out) :: kern_1_scf(-n_range:n_range)
149 REAL(kind=
dp),
DIMENSION(:),
POINTER :: cg, cgt, ch, cht
154 CALL scf_recurs(n_iter, n_range, kernel_scf, kern_1_scf, m, ch)
155 DEALLOCATE (ch, cg, cgt, cht)
164 PURE SUBROUTINE zero(n, x)
165 INTEGER,
INTENT(in) :: n
166 REAL(kind=
dp),
INTENT(out) :: x(n)
189 PURE SUBROUTINE for_trans(nd, nt, x, y, m, cgt, cht)
190 INTEGER,
INTENT(in) :: nd, nt
191 REAL(kind=
dp),
INTENT(in) :: x(0:nd - 1)
192 REAL(kind=
dp),
INTENT(out) :: y(0:nd - 1)
193 INTEGER,
INTENT(in) :: m
194 REAL(kind=
dp),
DIMENSION(:),
POINTER :: cgt, cht
219 y(i) = y(i) + cht(j)*x(ind)
220 y(nt/2 + i) = y(nt/2 + i) + cgt(j)*x(ind)
225 END SUBROUTINE for_trans
237 PURE SUBROUTINE back_trans(nd, nt, x, y, m, ch, cg)
243 INTEGER,
INTENT(in) :: nd, nt
244 REAL(kind=
dp),
INTENT(in) :: x(0:nd - 1)
245 REAL(kind=
dp),
INTENT(out) :: y(0:nd - 1)
246 INTEGER,
INTENT(in) :: m
247 REAL(kind=
dp),
DIMENSION(:),
POINTER :: ch, cg
266 IF (ind >= nt/2)
THEN
273 y(2*i + 0) = y(2*i + 0) + ch(2*j - 0)*x(ind) + cg(2*j - 0)*x(ind + nt/2)
274 y(2*i + 1) = y(2*i + 1) + ch(2*j + 1)*x(ind) + cg(2*j + 1)*x(ind + nt/2)
279 END SUBROUTINE back_trans
291 PURE SUBROUTINE scf_recurs(n_iter, n_range, kernel_scf, kern_1_scf, m, ch)
292 INTEGER,
INTENT(in) :: n_iter, n_range
293 REAL(kind=
dp),
INTENT(inout) :: kernel_scf(-n_range:n_range)
294 REAL(kind=
dp),
INTENT(out) :: kern_1_scf(-n_range:n_range)
295 INTEGER,
INTENT(in) :: m
296 REAL(kind=
dp),
DIMENSION(:),
POINTER :: ch
298 INTEGER :: i, i_iter, ind, j
299 REAL(kind=
dp) :: kern, kern_tot
303 loop_iter_scf:
DO i_iter = 1, n_iter
304 kern_1_scf(:) = kernel_scf(:)
305 kernel_scf(:) = 0._dp
306 loop_iter_i:
DO i = 0, n_range
310 IF (abs(ind) > n_range)
THEN
313 kern = kern_1_scf(ind)
315 kern_tot = kern_tot + ch(j)*kern
317 IF (kern_tot == 0._dp)
THEN
321 kernel_scf(i) = 0.5_dp*kern_tot
322 kernel_scf(-i) = kernel_scf(i)
326 END SUBROUTINE scf_recurs
Defines the basic variable types.
integer, parameter, public dp
Filters for interpolating scaling functions .
pure subroutine, public lazy_arrays(itype, m, ch, cg, cgt, cht)
...
Creates the wavelet kernel for the wavelet based poisson solver.
subroutine, public scaling_function(itype, nd, nrange, a, x)
Calculate the values of a scaling function in real uniform grid.
pure subroutine, public scf_recursion(itype, n_iter, n_range, kernel_scf, kern_1_scf)
Do iterations to go from p0gauss to pgauss order interpolating scaling function.