8 USE iso_c_binding,
ONLY: c_associated, &
15 USE iso_c_binding,
ONLY: &
31#include "../../base/base_uses.f90"
40#if defined ( __FFTW3 )
41#if defined ( __FFTW3_MKL )
42#include "fftw/fftw3.f03"
49 MODULE PROCEDURE :: fftw_alloc_complex_1d
50 MODULE PROCEDURE :: fftw_alloc_complex_2d
51 MODULE PROCEDURE :: fftw_alloc_complex_3d
55 MODULE PROCEDURE :: fftw_dealloc_complex_1d
56 MODULE PROCEDURE :: fftw_dealloc_complex_2d
57 MODULE PROCEDURE :: fftw_dealloc_complex_3d
63 SUBROUTINE fftw_alloc_complex_1d(array, n)
64 COMPLEX(C_DOUBLE_COMPLEX),
DIMENSION(:),
CONTIGUOUS,
POINTER,
INTENT(OUT) :: array
65 INTEGER,
DIMENSION(1),
INTENT(IN) :: n
68 TYPE(c_ptr) :: data_ptr
69 data_ptr = fftw_alloc_complex(int(product(n), kind=c_size_t))
70 CALL c_f_pointer(data_ptr, array, n)
73 ALLOCATE (array(n(1)))
76 END SUBROUTINE fftw_alloc_complex_1d
78 SUBROUTINE fftw_dealloc_complex_1d(array)
79 COMPLEX(C_DOUBLE_COMPLEX),
DIMENSION(:),
CONTIGUOUS,
POINTER,
INTENT(INOUT) :: array
82 CALL fftw_free(c_loc(array))
89 END SUBROUTINE fftw_dealloc_complex_1d
91 SUBROUTINE fftw_alloc_complex_2d(array, n)
92 COMPLEX(C_DOUBLE_COMPLEX),
DIMENSION(:, :),
CONTIGUOUS,
POINTER,
INTENT(OUT) :: array
93 INTEGER,
DIMENSION(2),
INTENT(IN) :: n
96 TYPE(c_ptr) :: data_ptr
97 data_ptr = fftw_alloc_complex(int(product(n), kind=c_size_t))
98 CALL c_f_pointer(data_ptr, array, n)
101 ALLOCATE (array(n(1), n(2)))
104 END SUBROUTINE fftw_alloc_complex_2d
106 SUBROUTINE fftw_dealloc_complex_2d(array)
107 COMPLEX(C_DOUBLE_COMPLEX),
DIMENSION(:, :),
CONTIGUOUS,
POINTER,
INTENT(INOUT) :: array
110 CALL fftw_free(c_loc(array))
117 END SUBROUTINE fftw_dealloc_complex_2d
119 SUBROUTINE fftw_alloc_complex_3d(array, n)
120 COMPLEX(C_DOUBLE_COMPLEX),
DIMENSION(:, :, :),
CONTIGUOUS,
POINTER,
INTENT(OUT) :: array
121 INTEGER,
DIMENSION(3),
INTENT(IN) :: n
124 TYPE(c_ptr) :: data_ptr
125 data_ptr = fftw_alloc_complex(int(product(n), kind=c_size_t))
126 CALL c_f_pointer(data_ptr, array, n)
129 ALLOCATE (array(n(1), n(2), n(3)))
132 END SUBROUTINE fftw_alloc_complex_3d
134 SUBROUTINE fftw_dealloc_complex_3d(array)
135 COMPLEX(C_DOUBLE_COMPLEX),
DIMENSION(:, :, :),
CONTIGUOUS,
POINTER,
INTENT(INOUT) :: array
138 CALL fftw_free(c_loc(array))
145 END SUBROUTINE fftw_dealloc_complex_3d
147#if defined ( __FFTW3 )
151 SUBROUTINE dummy_routine_to_call_mark_used()
155 mark_used(fftw_redft00)
156 mark_used(fftw_redft01)
157 mark_used(fftw_redft10)
158 mark_used(fftw_redft11)
159 mark_used(fftw_rodft00)
160 mark_used(fftw_rodft01)
161 mark_used(fftw_rodft10)
162 mark_used(fftw_rodft11)
163 mark_used(fftw_forward)
164 mark_used(fftw_backward)
165 mark_used(fftw_measure)
166 mark_used(fftw_destroy_input)
167 mark_used(fftw_unaligned)
168 mark_used(fftw_conserve_memory)
169 mark_used(fftw_exhaustive)
170 mark_used(fftw_preserve_input)
171 mark_used(fftw_patient)
172 mark_used(fftw_estimate)
173 mark_used(fftw_wisdom_only)
174 mark_used(fftw_estimate_patient)
175 mark_used(fftw_believe_pcost)
176 mark_used(fftw_no_dft_r2hc)
177 mark_used(fftw_no_nonthreaded)
178 mark_used(fftw_no_buffering)
179 mark_used(fftw_no_indirect_op)
180 mark_used(fftw_allow_large_generic)
181 mark_used(fftw_no_rank_splits)
182 mark_used(fftw_no_vrank_splits)
183 mark_used(fftw_no_vrecurse)
184 mark_used(fftw_no_simd)
185 mark_used(fftw_no_slow)
186 mark_used(fftw_no_fixed_radix_large_n)
187 mark_used(fftw_allow_pruning)
198 CHARACTER(LEN=*),
INTENT(IN) :: wisdom_file
201#if defined ( __FFTW3 )
202 CHARACTER(LEN=1, KIND=C_CHAR),
DIMENSION(:),
ALLOCATABLE :: wisdom_file_name_c
203 INTEGER :: file_name_length, i, iunit, istat
204 INTEGER(KIND=C_INT) :: isuccess
210 OPEN (unit=iunit, file=wisdom_file, status=
"UNKNOWN", form=
"FORMATTED", action=
"WRITE", iostat=istat)
213 file_name_length = len_trim(wisdom_file)
214 ALLOCATE (wisdom_file_name_c(file_name_length + 1))
215 DO i = 1, file_name_length
216 wisdom_file_name_c(i) = wisdom_file(i:i)
218 wisdom_file_name_c(file_name_length + 1) = c_null_char
219 isuccess = fftw_export_wisdom_to_filename(wisdom_file_name_c)
221 CALL cp_warn(__location__,
"Error exporting wisdom to file "//trim(wisdom_file)//
". "// &
222 "Wisdom was not exported.")
228 mark_used(wisdom_file)
240 CHARACTER(LEN=*),
INTENT(IN) :: wisdom_file
242#if defined ( __FFTW3 )
243 CHARACTER(LEN=1, KIND=C_CHAR),
DIMENSION(:),
ALLOCATABLE :: wisdom_file_name_c
244 INTEGER :: file_name_length, i, istat, iunit
245 INTEGER(KIND=C_INT) :: isuccess
258#if defined (__INTEL_COMPILER) && defined (__MKL)
270#include <mkl_version.h>
273 isuccess = fftw_init_threads()
275 cpabort(
"Error initializing FFTW with threads")
282 file_name_length = len_trim(wisdom_file)
284 OPEN (unit=iunit, file=wisdom_file, status=
"OLD", form=
"FORMATTED", position=
"REWIND", &
285 action=
"READ", iostat=istat)
288 file_name_length = len_trim(wisdom_file)
289 ALLOCATE (wisdom_file_name_c(file_name_length + 1))
290 DO i = 1, file_name_length
291 wisdom_file_name_c(i) = wisdom_file(i:i)
293 wisdom_file_name_c(file_name_length + 1) = c_null_char
294 isuccess = fftw_import_wisdom_from_filename(wisdom_file_name_c)
296 CALL cp_warn(__location__,
"Error importing wisdom from file "//trim(wisdom_file)//
". "// &
297 "Maybe the file was created with a different configuration than CP2K is run with. "// &
298 "CP2K continues without importing wisdom.")
309#if defined(INTEL_MKL_VERSION) && (110100 < INTEL_MKL_VERSION)
311#elif defined (__INTEL_COMPILER)
333 mark_used(wisdom_file)
354 INTEGER,
DIMENSION(*) :: data
355 INTEGER,
INTENT(INOUT) :: max_length
357 INTEGER :: h, i, j, k, m, maxn, maxn_elevens, &
358 maxn_fives, maxn_sevens, &
359 maxn_thirteens, maxn_threes, &
360 maxn_twos, ndata, nmax, number
361 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: dlocal,
idx
379 DO i = 0, maxn_threes
381 DO k = 0, maxn_sevens
382 DO m = 0, maxn_elevens
383 number = (3**i)*(5**j)*(7**k)*(11**m)
385 IF (number > nmax) cycle
388 IF (number >= maxn) cycle
397 ALLOCATE (dlocal(ndata),
idx(ndata))
403 DO i = 0, maxn_threes
405 DO k = 0, maxn_sevens
406 DO m = 0, maxn_elevens
407 number = (3**i)*(5**j)*(7**k)*(11**m)
409 IF (number > nmax) cycle
412 IF (number >= maxn) cycle
415 dlocal(ndata) = number
422 CALL sortint(dlocal, ndata,
idx)
423 ndata = min(ndata, max_length)
424 DATA(1:ndata) = dlocal(1:ndata)
427 DEALLOCATE (dlocal,
idx)
437 SUBROUTINE sortint(iarr, n, index)
439 INTEGER,
INTENT(IN) :: n
440 INTEGER,
INTENT(INOUT) :: iarr(1:n)
441 INTEGER,
INTENT(OUT) :: index(1:n)
443 INTEGER,
PARAMETER :: m = 7, nstack = 50
445 INTEGER :: a, i, ib, ir, istack(1:nstack), itemp, &
446 j, jstack, k, l, temp
463 IF (iarr(i) <= a)
EXIT
464 iarr(i + 1) = iarr(i)
465 index(i + 1) = index(i)
470 IF (jstack == 0)
RETURN
472 l = istack(jstack - 1)
477 iarr(k) = iarr(l + 1)
480 index(k) = index(l + 1)
482 IF (iarr(l + 1) > iarr(ir))
THEN
484 iarr(l + 1) = iarr(ir)
487 index(l + 1) = index(ir)
490 IF (iarr(l) > iarr(ir))
THEN
498 IF (iarr(l + 1) > iarr(l))
THEN
500 iarr(l + 1) = iarr(l)
503 index(l + 1) = index(l)
512 DO WHILE (iarr(i) < a)
516 DO WHILE (iarr(j) > a)
532 IF (jstack > nstack) cpabort(
" Nstack too small in sortr")
533 IF (ir - i + 1 >= j - l)
THEN
535 istack(jstack - 1) = i
538 istack(jstack) = j - 1
539 istack(jstack - 1) = l
546 END SUBROUTINE sortint
567 SUBROUTINE fftw3_create_guru_plan(plan, fft_rank, dim_n, &
568 dim_istride, dim_ostride, hm_rank, &
569 hm_n, hm_istride, hm_ostride, &
570 zin, zout, fft_direction, fftw_plan_type, &
575 TYPE(c_ptr),
INTENT(INOUT) :: plan
576 COMPLEX(KIND=dp),
DIMENSION(*),
INTENT(INOUT) :: zin, zout
577 INTEGER,
INTENT(IN) :: dim_n(2), dim_istride(2), dim_ostride(2), &
578 hm_n(2), hm_istride(2), hm_ostride(2), fft_rank, &
579 fft_direction, fftw_plan_type, hm_rank
580 LOGICAL,
INTENT(OUT) :: valid
583 TYPE(fftw_iodim) :: dim(2), hm(2)
587 dim(i) = fftw_iodim(dim_n(i), dim_istride(i), dim_ostride(i))
588 hm(i) = fftw_iodim(hm_n(i), hm_istride(i), hm_ostride(i))
591 plan = fftw_plan_guru_dft(fft_rank, &
594 fft_direction, fftw_plan_type)
596 valid = c_associated(plan)
602 mark_used(dim_istride)
603 mark_used(dim_ostride)
606 mark_used(hm_istride)
607 mark_used(hm_ostride)
608 mark_used(fft_direction)
609 mark_used(fftw_plan_type)
611 IF (.false.) then; do;
IF (abs(zin(1)) > abs(zout(1))) exit;
END do;
END IF
624 FUNCTION fftw3_is_mkl_wrapper()
RESULT(is_mkl)
629#if defined ( __FFTW3 )
630 LOGICAL :: guru_supported
631 INTEGER :: dim_n(2), dim_istride(2), dim_ostride(2), &
632 howmany_n(2), howmany_istride(2), howmany_ostride(2)
633 TYPE(c_ptr) :: test_plan
634 COMPLEX(KIND=dp),
DIMENSION(1, 1, 1) :: zin
647 howmany_istride(1) = 1
648 howmany_istride(2) = 1
649 howmany_ostride(1) = 1
650 howmany_ostride(2) = 1
651 zin = cmplx(0.0_dp, 0.0_dp, kind=dp)
652 CALL fftw3_create_guru_plan(test_plan, 1, &
653 dim_n, dim_istride, dim_ostride, &
654 2, howmany_n, howmany_istride, howmany_ostride, &
656 fftw_forward, fftw_estimate, guru_supported)
657 IF (guru_supported)
THEN
658 CALL fftw_destroy_plan(test_plan)
681 SUBROUTINE fftw3_compute_rows_per_th(nrows, nt, rows_per_thread, rows_per_thread_r, &
684 INTEGER,
INTENT(IN) :: nrows, nt
685 INTEGER,
INTENT(OUT) :: rows_per_thread, rows_per_thread_r, &
688 IF (mod(nrows, nt) .EQ. 0)
THEN
689 rows_per_thread = nrows/nt
690 rows_per_thread_r = 0
694 rows_per_thread = nrows/nt + 1
695 rows_per_thread_r = nrows/nt
696 th_plana = mod(nrows, nt)
697 th_planb = nt - th_plana
721 SUBROUTINE fftw3_create_3d_plans(plan, plan_r, dim_n, dim_istride, dim_ostride, &
722 hm_n, hm_istride, hm_ostride, &
724 fft_direction, fftw_plan_type, rows_per_th, &
727 TYPE(c_ptr),
INTENT(INOUT) :: plan, plan_r
728 INTEGER,
INTENT(INOUT) :: dim_n(2), dim_istride(2), &
729 dim_ostride(2), hm_n(2), &
730 hm_istride(2), hm_ostride(2)
731 COMPLEX(KIND=dp),
DIMENSION(*),
INTENT(INOUT) :: input, output
732 INTEGER,
INTENT(INOUT) :: fft_direction, fftw_plan_type
733 INTEGER,
INTENT(IN) :: rows_per_th, rows_per_th_r
739 hm_n(2) = rows_per_th
740 CALL fftw3_create_guru_plan(plan, 1, &
741 dim_n, dim_istride, dim_ostride, &
742 2, hm_n, hm_istride, hm_ostride, &
744 fft_direction, fftw_plan_type, valid)
746 IF (.NOT. valid)
THEN
747 cpabort(
"fftw3_create_plan")
751 hm_n(2) = rows_per_th_r
752 CALL fftw3_create_guru_plan(plan_r, 1, &
753 dim_n, dim_istride, dim_ostride, &
754 2, hm_n, hm_istride, hm_ostride, &
756 fft_direction, fftw_plan_type, valid)
757 IF (.NOT. valid)
THEN
758 cpabort(
"fftw3_create_plan (remaining)")
774 TYPE(fft_plan_type),
INTENT(INOUT) :: plan
775 COMPLEX(KIND=dp),
DIMENSION(*),
INTENT(INOUT) :: zin
776 COMPLEX(KIND=dp),
DIMENSION(*),
INTENT(INOUT) :: zout
777 INTEGER :: plan_style
778#if defined ( __FFTW3 )
779 INTEGER :: n1, n2, n3
781 INTEGER :: rows_per_th
782 INTEGER :: rows_per_th_r
783 INTEGER :: fft_direction
784 INTEGER :: th_plana, th_planb
785 COMPLEX(KIND=dp),
ALLOCATABLE :: tmp(:)
788 INTEGER :: dim_n(2), dim_istride(2), dim_ostride(2), &
789 howmany_n(2), howmany_istride(2), howmany_ostride(2)
791 INTEGER :: fftw_plan_type
792 SELECT CASE (plan_style)
794 fftw_plan_type = fftw_estimate
796 fftw_plan_type = fftw_measure
798 fftw_plan_type = fftw_patient
800 fftw_plan_type = fftw_exhaustive
802 cpabort(
"fftw3_create_plan_3d")
805#if defined (__FFTW3_UNALIGNED)
806 fftw_plan_type = fftw_plan_type + fftw_unaligned
809 IF (plan%fsign == +1)
THEN
810 fft_direction = fftw_forward
812 fft_direction = fftw_backward
826 IF ((fftw3_is_mkl_wrapper()) .OR. &
827 (.NOT. plan_style == 1) .OR. &
828 (n1 < 256 .AND. n2 < 256 .AND. n3 < 256 .AND. nt == 1))
THEN
834 plan%separated_plans = .false.
837 IF (plan%fft_in_place)
THEN
838 plan%fftw_plan = fftw_plan_dft_3d(n3, n2, n1, zin, zin, fft_direction, fftw_plan_type)
840 plan%fftw_plan = fftw_plan_dft_3d(n3, n2, n1, zin, zout, fft_direction, fftw_plan_type)
843 ALLOCATE (tmp(n1*n2*n3))
868 CALL fftw3_compute_rows_per_th(n3, nt, rows_per_th, rows_per_th_r, &
875 howmany_n(2) = rows_per_th
876 howmany_istride(1) = n1
877 howmany_istride(2) = n1*n2
878 howmany_ostride(1) = 1
879 howmany_ostride(2) = n1*n2
880 CALL fftw3_create_3d_plans(plan%fftw_plan_nx, plan%fftw_plan_nx_r, &
881 dim_n, dim_istride, dim_ostride, howmany_n, &
882 howmany_istride, howmany_ostride, &
884 fft_direction, fftw_plan_type, rows_per_th, &
888 CALL fftw3_compute_rows_per_th(n3, nt, rows_per_th, rows_per_th_r, &
894 howmany_n(2) = rows_per_th
895 howmany_istride(1) = n2
896 howmany_istride(2) = n1*n2
898 howmany_ostride(1) = n2*n3
899 howmany_ostride(2) = 1
901 CALL fftw3_create_3d_plans(plan%fftw_plan_ny, plan%fftw_plan_ny_r, &
902 dim_n, dim_istride, dim_ostride, &
903 howmany_n, howmany_istride, howmany_ostride, &
905 fft_direction, fftw_plan_type, rows_per_th, &
909 CALL fftw3_compute_rows_per_th(n1, nt, rows_per_th, rows_per_th_r, &
915 howmany_n(2) = rows_per_th
916 howmany_istride(1) = n3
917 howmany_istride(2) = n2*n3
918 howmany_ostride(1) = n3
919 howmany_ostride(2) = n2*n3
921 CALL fftw3_create_3d_plans(plan%fftw_plan_nz, plan%fftw_plan_nz_r, &
922 dim_n, dim_istride, dim_ostride, &
923 howmany_n, howmany_istride, howmany_ostride, &
925 fft_direction, fftw_plan_type, rows_per_th, &
928 plan%separated_plans = .true.
935 mark_used(plan_style)
937 IF (.false.) then; do;
IF (abs(zin(1)) > abs(zout(1))) exit;
END do;
END IF
956 SUBROUTINE fftw3_workshare_execute_dft(plan, plan_r, split_dim, nt, tid, &
957 input, istride, output, ostride)
959 INTEGER,
INTENT(IN) :: split_dim, nt, tid
960 INTEGER,
INTENT(IN) :: istride, ostride
961 COMPLEX(KIND=dp),
DIMENSION(*),
INTENT(INOUT) :: input, output
962 TYPE(c_ptr) :: plan, plan_r
964 INTEGER :: i_off, o_off
965 INTEGER :: th_plana, th_planb
966 INTEGER :: rows_per_thread, rows_per_thread_r
968 CALL fftw3_compute_rows_per_th(split_dim, nt, rows_per_thread, &
972 IF (th_planb .GT. 0)
THEN
973 IF (tid .LT. th_plana)
THEN
974 i_off = (tid)*(istride*(rows_per_thread)) + 1
975 o_off = (tid)*(ostride*(rows_per_thread)) + 1
976 IF (rows_per_thread .GT. 0)
THEN
977 CALL fftw_execute_dft(plan, input(i_off), &
980 ELSE IF ((tid - th_plana) < th_planb)
THEN
982 i_off = (th_plana)*istride*(rows_per_thread) + &
983 (tid - th_plana)*istride*(rows_per_thread_r) + 1
984 o_off = (th_plana)*ostride*(rows_per_thread) + &
985 (tid - th_plana)*ostride*(rows_per_thread_r) + 1
987 CALL fftw_execute_dft(plan_r, input(i_off), &
992 i_off = (tid)*(istride*(rows_per_thread)) + 1
993 o_off = (tid)*(ostride*(rows_per_thread)) + 1
995 CALL fftw_execute_dft(plan, input(i_off), &
1002 mark_used(split_dim)
1008 IF (.false.) then; do;
IF (abs(input(1)) > abs(output(1))) exit;
END do;
END IF
1025 TYPE(fft_plan_type),
INTENT(IN) :: plan
1026 REAL(kind=dp),
INTENT(IN) :: scale
1027 COMPLEX(KIND=dp),
DIMENSION(*),
INTENT(INOUT),
TARGET:: zin
1028 COMPLEX(KIND=dp),
DIMENSION(*),
INTENT(INOUT),
TARGET:: zout
1029 INTEGER,
INTENT(OUT) :: stat
1030#if defined ( __FFTW3 )
1031 COMPLEX(KIND=dp),
POINTER :: xout(:)
1032 COMPLEX(KIND=dp),
ALLOCATABLE :: tmp1(:)
1033 INTEGER :: n1, n2, n3
1044 IF (plan%fft_in_place)
THEN
1045 xout => zin(:n1*n2*n3)
1047 xout => zout(:n1*n2*n3)
1051 IF (.NOT. plan%separated_plans)
THEN
1052 CALL fftw_execute_dft(plan%fftw_plan, zin, xout)
1055 ALLOCATE (tmp1(n1*n2*n3))
1062 CALL fftw3_workshare_execute_dft(plan%fftw_plan_nx, plan%fftw_plan_nx_r, &
1064 zin, n1*n2, tmp1, n1*n2)
1067 CALL fftw3_workshare_execute_dft(plan%fftw_plan_ny, plan%fftw_plan_ny_r, &
1069 tmp1, n1*n2, xout, 1)
1071 CALL fftw3_workshare_execute_dft(plan%fftw_plan_nz, plan%fftw_plan_nz_r, &
1073 xout, n2*n3, tmp1, n2*n3)
1080 xout((i - 1) + (j - 1)*n1 + (k - 1)*n1*n2 + 1) = &
1081 tmp1((k - 1) + (j - 1)*n3 + (i - 1)*n3*n2 + 1)
1090 IF (scale /= 1.0_dp)
THEN
1091 CALL zdscal(n1*n2*n3, scale, xout, 1)
1098 IF (.false.) then; do;
IF (abs(zin(1)) > abs(zout(1))) exit;
END do;
END IF
1118 TYPE(fft_plan_type),
INTENT(INOUT) :: plan
1119 COMPLEX(KIND=dp),
DIMENSION(*),
INTENT(IN) :: zin
1120 COMPLEX(KIND=dp),
DIMENSION(*),
INTENT(IN) :: zout
1121 INTEGER,
INTENT(IN) :: plan_style
1122#if defined ( __FFTW3 )
1123 INTEGER :: ii, di, io, do, num_threads, num_rows
1125 INTEGER :: fftw_plan_type
1126 SELECT CASE (plan_style)
1128 fftw_plan_type = fftw_estimate
1130 fftw_plan_type = fftw_measure
1132 fftw_plan_type = fftw_patient
1134 fftw_plan_type = fftw_exhaustive
1136 cpabort(
"fftw3_create_plan_1dm")
1139#if defined (__FFTW3_UNALIGNED)
1140 fftw_plan_type = fftw_plan_type + fftw_unaligned
1143 plan%separated_plans = .false.
1151 num_rows = plan%m/num_threads
1170 IF (plan%fsign == +1 .AND. plan%trans)
THEN
1173 ELSEIF (plan%fsign == -1 .AND. plan%trans)
THEN
1178 IF (plan%fsign == +1)
THEN
1179 CALL dfftw_plan_many_dft(plan%fftw_plan, 1, plan%n, num_rows, zin, 0, ii, di, &
1180 zout, 0, io,
DO, fftw_forward, fftw_plan_type)
1182 CALL dfftw_plan_many_dft(plan%fftw_plan, 1, plan%n, num_rows, zin, 0, ii, di, &
1183 zout, 0, io,
DO, fftw_backward, fftw_plan_type)
1199 mark_used(plan_style)
1201 IF (.false.) then; do;
IF (abs(zin(1)) > abs(zout(1))) exit;
END do;
END IF
1212 TYPE(fft_plan_type),
INTENT(INOUT) :: plan
1214#if defined ( __FFTW3 )
1219 IF (.NOT. plan%separated_plans)
THEN
1220 CALL fftw_destroy_plan(plan%fftw_plan)
1224 CALL fftw_destroy_plan(plan%fftw_plan_nx)
1225 CALL fftw_destroy_plan(plan%fftw_plan_ny)
1226 CALL fftw_destroy_plan(plan%fftw_plan_nz)
1227 CALL fftw_destroy_plan(plan%fftw_plan_nx_r)
1228 CALL fftw_destroy_plan(plan%fftw_plan_ny_r)
1229 CALL fftw_destroy_plan(plan%fftw_plan_nz_r)
1247 TYPE(fft_plan_type),
INTENT(IN) :: plan
1248 COMPLEX(KIND=dp),
DIMENSION(*),
INTENT(IN),
TARGET :: zin
1249 COMPLEX(KIND=dp),
DIMENSION(*),
INTENT(INOUT), &
1251 REAL(kind=dp),
INTENT(IN) :: scale
1252 INTEGER,
INTENT(OUT) :: stat
1254 INTEGER :: in_offset, my_id, num_rows, out_offset, &
1256 TYPE(c_ptr) :: fftw_plan
1271 fftw_plan = plan%fftw_plan
1292#if defined ( __FFTW3 )
1296 CALL dfftw_execute_dft(fftw_plan, zin(in_offset:in_offset), zout(out_offset:out_offset))
1301 IF (scale /= 1.0_dp)
CALL zdscal(plan%n*num_rows, scale, zout(scal_offset:scal_offset), 1)
1308 IF (.false.) then; do;
IF (abs(zin(1)) > abs(zout(1))) exit;
END do;
END IF
static GRID_HOST_DEVICE int idx(const orbital a)
Return coset index of given orbital angular momentum.
Utility routines to open and close files. Tracking of preconnections.
integer function, public get_unit_number(file_name)
Returns the first logical unit that is not preconnected.
logical function, public file_exists(file_name)
Checks if file exists, considering also the file discovery mechanism.
Defines the basic variable types.
integer, parameter, public dp
Type to store data about a (1D or 3D) FFT, including FFTW plan.
subroutine, public fftw3_do_cleanup(wisdom_file, ionode)
...
subroutine, public fftw3_destroy_plan(plan)
...
subroutine, public fftw3_create_plan_3d(plan, zin, zout, plan_style)
...
subroutine, public fftw3_get_lengths(data, max_length)
...
subroutine, public fftw33d(plan, scale, zin, zout, stat)
...
subroutine, public fftw31dm(plan, zin, zout, scale, stat)
...
subroutine, public fftw3_do_init(wisdom_file)
...
subroutine, public fftw3_create_plan_1dm(plan, zin, zout, plan_style)
...